akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,div=0;cin>>n;
  for(ll i=1;i*i<=n;i++) if(n%i==0) div=i;
  print(n/div+div-2);
  return 0;
}

Measured memory_bytes: 256
array = Array.new

while val = gets do
    array.push(val.chomp.split.map(&:to_i))
end

n = array[0][0]
multiple = array[1]
sum = 1

if multiple.include?(0)
    puts(0)
    exit
else
    for i in 1..n do
        sum = sum * multiple[i-1]
        if sum > 10 ** 18
            puts(-1)
            exit
        end
    end
end
puts(sum)

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

using namespace std;

int main(){
    int N,x,res;
    string s;
    scanf("%d",&N);
    cin >> s;

    x = 0;
    res = 0;
    for(int i=0;i<s.size();i++){
        if(s[i] == 'I')
            x++;
        else if(s[i] == 'D')
            x--;
        
        if(x>res)
            res = x;
    }

    printf("%d\n",res);
    return 0;
}

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

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

    rep(i, N) {
        string S;
        cin >> S;

        if (S == "Y") {
            cout << "Four" << endl;
            break;
        } 
        if (i == N - 1) {
            cout << "Three" << endl;
        }
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <map>
#include <math.h>
#include <vector>

#define INF 100000000

int n,m,k;
char a[100], b[100], c[100];

int strlen(char ch[]){
  int i = 0;
  while(ch[i] != '\0')i++;
  return i;
}

int main(){
  scanf("%s%s%s", a, b, c);

  if(a[strlen(a) - 1] == b[0] && b[strlen(b) - 1] == c[0]){
    printf("YES");
  }else{
    printf("NO");
  }
}


Measured memory_bytes: 128
#include <iostream>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
//const int MAX=;

int main(){
	int x1,x2,y1,y2,a,b;
	cin>>x1>>y1>>x2>>y2;
	a=x2-x1;
	b=y2-y1;
	cout<<x2-b<<" "<<y2+a<<" "<<x2-a-b<<" "<<y2+a-b;
}

Measured memory_bytes: 256
s = gets().chomp().split()
a = s[0].to_i()
b = s[1].to_i()
c = s[2].to_i()
k = gets().chomp().to_i()

arr = [a, b, c]
max = arr.max

sum = max

k.times { sum *= 2 }
sum = sum + a + b + c - max
puts sum


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

using namespace std;

long long n, k;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    n = n % k;
    cout << min(n, abs(k - n));
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <cassert>

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

const int64_t kMOD = 998244353;
struct mint {
    mint(int64_t x):val_((x%kMOD+kMOD)%kMOD) {
    }

    mint operator-() const { return mint(-val_);}
    mint& operator+=(const mint a) {
        if ((val_ += a.val_) >= kMOD) val_ -= kMOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((val_ += kMOD-a.val_) >= kMOD) val_ -= kMOD;
        return *this;
    }
    mint& operator*=(const mint a) { (val_ *= a.val_) %= kMOD; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(int64_t t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime kMOD
    mint inv() const { return pow(kMOD-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}

    int64_t val_;
};
istream& operator>>(istream& is, const mint& a) { return is >> a.val_;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.val_;}

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

    map<int, int> freq;
    rep(i, N) {
        cin >> D[i];
        freq[D[i]]++;
    }

    if(D[0] != 0 || freq[0] != 1) {
        cout << 0 << endl;
        return 0;
    }

    if(N == 1) {
        cout << 1 << endl;
        return 0;
    }

    sort(D.rbegin(), D.rend());
    int maxN = D[0];
    mint ret = 1;
    for(int i=1; i<=maxN; ++i) {
        if(freq[i] == 0) {
            cout << 0 << endl;
            return 0;
        }

        mint tmp = 1;
        rep(j, freq[i]) {
#if 0
            tmp %= MOD;
            tmp = tmp * modinv(tmp, MOD) % MOD;
#else
            tmp *= freq[i-1];
#endif
        }
        ret *= tmp;
//        cout << i << ": tmp=" << tmp << ", ret=" << ret << endl;
    }
    cout << ret << endl;

    return 0;
}



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

using namespace __gnu_pbds;
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)    for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<int, int>
#define    FO           find_by_order
#define    OK           order_of_key
#define    mem(a)       memset(a,0,sizeof(a))
#define    ff           first
#define    ss           second


typedef tree <
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update >
set_t;


void fio()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}


template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
	double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
	time_taken *= 1e-9;
	cout << "\nExecuted in: " << fixed
	     << time_taken << setprecision(9);
	cout << " sec";
#endif
}

///----------------------------- | FUNCTIONS | --------------------------------------///

/*
const int N = 2e5 + 5;

vector<int> adj[N];
bool visited[N];
//int val[N];
int depth[N];
//int parent[N];

void dfs(int v)
{
	visited[v] = true;
	for (int u : adj[v])
	{
		if (!visited[u])
		{
			//parent[u] = v;
			depth[u] = depth[v] + 1;
			dfs(u);
		}
	}
}
*/

// left shift << multiply by 2
// right shift >> divide by 2

///----------------------------- | START FROM HERE | --------------------------------------///

#define int long long //change int main to int32_t main
const int N = 2e5 + 5;
int n, ww;
int w[N], v[N];
int dp[105][N];

int rec(int i, int cap)
{
	if (dp[i][cap] != -1) return dp[i][cap];
	int result = 0;
	if (cap > 0 && i < n)
	{
		if (w[i] > cap)
		{
			result = rec(i + 1, cap);
		}
		else
		{
			int x = rec(i + 1, cap);
			int y = v[i] + rec(i + 1, cap - w[i]);
			result = max(x, y);
		}
	}
	dp[i][cap] = result;
	return result;
}

void solve()
{
	cin >> n >> ww;
	fr0(i, n) cin >> w[i] >> v[i];
	memset(dp, - 1, sizeof(dp));
	int ans = rec(0, ww);
	cout << ans;

}





int32_t main()
{
	auto start = chrono::high_resolution_clock::now();
	boost;
	fio();
	int t;
	t = 1;
	//cin >> t;
	while (t--) solve();
	auto end = chrono::high_resolution_clock::now();
	TIME(start, end);
	return 0;
}




Measured memory_bytes: 167716
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
typedef long long int ll;
int n;
int now[30];
int index=0;
void solve(int sum,int t){
	if(sum==n){
		printf("%d",now[0]);
		for(int i=1;i<index;i++){
			printf(" %d",now[i]);
		}
		printf("\n");
		return ;
	}
	for(int i=t;i>=1;i--){
		if(sum+i<=n){
			now[index++]=i;
			solve(sum+i,i);
			index--;
		}
	}
	return ;
}
int main()
{
    for(;;){
		cin >> n;
		if(n==0)return 0;
		solve(0,n);
	}
}

Measured memory_bytes: 1148
#include<iostream>

int JudgeGrade(int MiddleExam_, int FinalExam_, int ReExam_);

int main(void) {
	int MiddleExam=-2, FinalExam=-2, ReExam = -2;
	while (1) {
		std::cin >> MiddleExam >> FinalExam >> ReExam;
		if (MiddleExam == -1 && FinalExam == -1 && ReExam == -1) { break; }
		JudgeGrade( MiddleExam,  FinalExam,  ReExam);
	}
	//	system("pause");
	return 0;
}
int JudgeGrade(int MiddleExam_, int FinalExam_ ,int ReExam_){
	
	if (MiddleExam_ == -1 || FinalExam_ == -1) { 
		std::cout << "F" << std::endl; 
		//return 0;
	}
	else   {
		int ResultScore = MiddleExam_ + FinalExam_;
		if (80 <= ResultScore) {
			std::cout << "A" << std::endl;
		}
		else if (65<=ResultScore  &&ResultScore<80) {
			std::cout << "B" << std::endl;
		}
		else if (50<=ResultScore  &&ResultScore<65) {
			std::cout << "C" << std::endl;
		}
		else if (30 <= ResultScore  &&ResultScore<50) {
			if(50<=ReExam_){ std::cout << "C" << std::endl; }
			else { std::cout << "D" << std::endl; }
		}
		else if (ResultScore<30) {
			std::cout << "F" << std::endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100010;
const int inf=1000000007;
const long long INF=1000000000000000007;
using ll=long long;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main(){
	int n,m,Q,r,l,p,q;
	int pass[501][501]={},dp[501][501]={};
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin>>n>>m>>Q;
	rep(i,0,m){
		cin>>l>>r;
		rep(j,0,l+1)rep(k,r,501)pass[j][k]++;
	}
	rep(i,1,501){
		rep(j,i,501){
			rep(k,0,j-i+1)dp[i][j]=max(dp[i][j],pass[i+k][j]);
		}
	}
	rep(i,0,Q){
		cin>>p>>q;
		print(dp[p][q]);
	}
}


Measured memory_bytes: 2944
n, m = map(int, input().split())

height = list(map(int, input().split()))

good = [1 for j in range(n)] 


for i in range(m):
    a,b  = map(int, input().split())
    
    if height[a-1] >= height[b-1]:
        good[b-1] = 0
    if height[a-1] <= height[b-1]:
        good[a-1] = 0

ans = good.count(1)
print(ans)

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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int X, Y;
	cin >> X >> Y;
	// a + b = X;
	// 2a + 4b = Y;
	// 2b = Y - 2X;

	if (Y - 2 * X < 0) {
		cout << "No" << endl;
		return 0;
	}
	if ((Y - 2 * X) % 2 != 0) {
		cout << "No" << endl;
		return 0;
	}
	int b = (Y - 2 * X) / 2;
	int a = X - b;
	if (a < 0) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 3652
#include <cstdio>
using namespace std;

int main(){
		int ans=0,n=0;
		int a,b;
		scanf("%d",&n);
		for(int i=0;i<n;i++){
				scanf("%d %d",&a,&b);
				ans+=(b-a+1);
		}
		printf("%d\n",ans);
		return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
void printArray(int a[],int n){
    for(int i=0;i<n;i++){
        cout << a[i];
        if(i<n-1){
            cout << " ";
        }
    }
    cout << endl;
}
int selectionSort(int a[],int n){
    int sortNum = 0;
    for(int i=0;i<n;i++){
        int minj = i;
        for(int j=i;j<n;j++){
            if(a[j]<a[minj]){
                minj = j;
            }
        }
        if(i != minj){
            int temp = a[i];
            a[i] = a[minj];
            a[minj] = temp;
            sortNum = sortNum + 1;
        }
    }
    return sortNum;
}
int main(){
    int n;
    cin >> n;
    int a[n];
    int num;
    if(n>=1 && n<=100){
        for(int i=0;i<n;i++){
            cin >> a[i];
        }
        num = selectionSort(a,n);
        printArray(a,n);
        cout << num << endl;
    }else{
        return 0;
    }
    return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

  int n, c;
  cin >> n >> c;
  int d[c][c], color[n][n];
  for(int i = 0; i < c; i++){
    for(int j = 0; j < c; j++){
      cin >> d[i][j];
    }
  }
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      cin >> color[i][j];
    }
  }

  int cost[3][c];
  for(int i = 0; i < 3; i++){
    fill(cost[i], cost[i] + c, 0);
  }
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      for(int k = 0; k < c; k++){
        cost[(i + j) % 3][k] += d[color[i][j] - 1][k];
      }
    }
  }

  int ans = INF_INT;
  for(int c1 = 0; c1 < c; c1++){
    for(int c2 = 0; c2 < c; c2++){
      if(c1 == c2) continue;
      for(int c3 = 0; c3 < c; c3++){
        if(c2 == c3 || c1 == c3) continue;
        ans = min(ans, cost[0][c1] + cost[1][c2] + cost[2][c3]);
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1280
import copy
class Dice(object):
  def __init__(self, List):
    self.face = List

  def n_spin(self, a_List):
    List = copy.copy(a_List)
    temp = List[0]
    List[0] = List[1]
    List[1] = List[5]
    List[5] = List[4]
    List[4] = temp
    return List

  def s_spin(self, a_List):
    List = copy.copy(a_List)
    temp = List[0]
    List[0] = List[4]
    List[4] = List[5]
    List[5] = List[1]
    List[1] = temp
    return List

  def e_spin(self, a_List):
    List = copy.copy(a_List)
    temp = List[0]
    List[0] = List[3]
    List[3] = List[5]
    List[5] = List[2]
    List[2] = temp
    return List

  def w_spin(self, a_List):
    List = copy.copy(a_List)
    temp = List[0]
    List[0] = List[2]
    List[2] = List[5]
    List[5] = List[3]
    List[3] = temp
    return List

dice = Dice(map(int, raw_input().split()))
emer = copy.copy(dice.face)
face_storage = []
face_storage.append(emer)
q = input()
for a in range(q):
  question = map(int, raw_input().split())
  for a in range(24):
    face_storage.append(dice.n_spin(face_storage[a]))
    face_storage.append(dice.s_spin(face_storage[a]))
    face_storage.append(dice.w_spin(face_storage[a]))
    face_storage.append(dice.e_spin(face_storage[a]))
  for c in face_storage:
    if c[0] == question[0] and c[1] == question[1]:
      print c[2]
      break

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

#define REP(i,num) for(int i=0;i<(num);++i)

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

ll gcd(ll a,ll b){
	if(a<b){
		swap(a,b);
	}
    if(b<1) return a;

	while(ll r=(a%b)){
		a = b;
		b = r;
	}
	return b;
}

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

  int N=in();
  vector<ll> A(N);
  REP(i,N) A[i]=in();
  ll m=0;
  vector<ll> lm(N+1),rm(N+1);
  lm[0]=0,rm[N]=0;
  for(int i=0;i<N;i++){
    lm[i+1] = gcd(A[i],lm[i]);
  }
  for(int i=N-1;i>=0;i--){
    rm[i] = gcd(A[i],rm[i+1]);
  }
  for(int i=0;i<N;i++){
    m = max(m,gcd(lm[i],rm[i+1]));
  }
	
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 2560
// Practice AtCoder
// authoer: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!(usize);
    let k = get!(usize);
    let mut vs = vec![];
    
    for _ in 0 .. n {
        vs.push(get!());
    }
    
    use std::cmp::{max, min};
    let mut ans = 0;
    for t in 1 .. min(n, k)+1 {
        for p in 0 .. min(t, n)+1 {
            let mut tmp = vec![];
            let mut sum = 0;
            for x in 0 .. p {
                tmp.push(vs[x]);
                sum += vs[x];
            }
            for x in 0 .. t-p  {
                let x = vs.len()-1 - x;
                tmp.push(vs[x]);
                sum += vs[x];
            }
            if tmp.len() >= k {
                ans = max(ans, sum);
                continue;
            }
            tmp.sort();
            for i in 0 .. min(k-tmp.len(), tmp.len()) {
                if tmp[i] < 0 {
                    sum -= tmp[i];
                }
            }
            ans = max(ans, sum);
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e10;
const ll MOD = 1e9 + 7;

int main(){
	ll N;
	cin >> N;
	vll A;
	ll i, j;
	for (i = 0; i < N; i++){
		ll a;
		cin >> a;
		A.push_back(a);
	}
	unordered_map<ll, ll> m;
	ll sum = 0;
	for (i = 0; i < N; i++){
		sum += A[i];
		auto itr = m.find(sum);
		if (itr != m.end()){
			m[sum]++;
		}
		else{
			m[sum] = 1;
		}
	}
	auto itr = m.find(0);
	ll ans = 0;
	if (itr != m.end()){
		ans += m[0];
	}
	for (auto itr = m.begin(); itr != m.end(); itr++){
		ll num = itr->second;
		if (num >= 2){
			ans += num*(num - 1) / 2;
		}
	}
	cout << ans << endl;
}


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

int main() {
  int h, w;
  cin >> h >> w;
  
  for (int i = 0; i < w + 2; i++) {
    cout << '#';
  }
  cout << endl;
  
  for (int i = 0; i < h; i++) {
    string a;
    cin >> a;
    cout << '#' << a << '#' << endl;
  }
  
  for (int i = 0; i < w + 2; i++) {
    cout << '#';
  }
  cout << endl;
}


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

const int mod = 1000000007;
const int maxn = 100005;

int add_mod (int a, int b) {
	if (a + b < mod)
		return a + b;
	return a + b - mod;
}

int trips (int a) {
	return add_mod(a, add_mod(a, a));
}

int n, t = 1;
string s;
int dp[maxn][3];

signed main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> s;
	n = s.size();
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j < 3; ++j)
			dp[i][j] = dp[i - 1][j];
		if (s[i - 1] == 'A')
			dp[i][0] = add_mod(dp[i - 1][0], t);
		else if (s[i - 1] == 'B') 
			dp[i][1] = add_mod(dp[i - 1][1], dp[i - 1][0]);
		else if (s[i - 1] == 'C')
			dp[i][2] = add_mod(dp[i - 1][2], dp[i - 1][1]);
		else {
			dp[i][0] = add_mod(trips(dp[i - 1][0]), t);
			dp[i][1] = add_mod(trips(dp[i - 1][1]), dp[i - 1][0]);
			dp[i][2] = add_mod(trips(dp[i - 1][2]), dp[i - 1][1]);
			t = trips(t);
		}
	}
	cout << dp[n][2] << '\n';
}


Measured memory_bytes: 4916
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 998244353;


     signed main(){
         cout << std::fixed << std::setprecision(15);
int a,b,c,d,e,f,ans1=0,ans2;
cin>>a>>b>>c>>d>>e>>f;ans2=100*a;
for(int i=0;i*a*100<=f;i++)for(int j=0;(j*b+i*a)*100<=f;j++){
     for(int p=0;p*c<=min(f-(i*a+j*b)*100,(i*a+j*b)*e);p++){
          if(((min(f-(i*a+j*b)*100,(i*a+j*b)*e)-p*c)/d*d+p*c)*(ans1+ans2)>(((min(f-(i*a+j*b)*100,(i*a+j*b)*e)-p*c)/d*d+p*c)+(j*b+i*a)*100)*ans1){
               ans1=((min(f-(i*a+j*b)*100,(i*a+j*b)*e)-p*c)/d*d+p*c);
               ans2=(j*b+i*a)*100;
           //    cerr<<i<<' '<<j<<' '<<p<<' '<<(min(f-(i*a+j*b)*100,(i*a+j*b)*e)-p*c)/d<<' '<<ans1<<' '<<ans2<<endl;
          }
     }
}
cout<<ans1+ans2<<' '<<ans1<<endl;



 }

 


 






    





      

        


Measured memory_bytes: 256
from enum import Enum
from queue import Queue

import numpy as np

import collections
import bisect
import sys
import math

from scipy.sparse.csgraph import floyd_warshall

N,K = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
for i in range(N):
    if h[i] >= K:
        ans += 1

print(ans)

Measured memory_bytes: 23640
#include <stdio.h>
#include <math.h>
char x[15];
int p[11],q[11],i,k;

int check(int in,int add){
	int n,pass=0,i;
	for(n=1;n<10;n++)q[n]=p[n];q[in]++;
	for(n=(10+add)%10;n%10>0;n+=add){
		switch(q[n]){
			case 1:
			if(q[n+add]>0 && q[n+add*2]>0){q[n]--; q[n+add]--; q[n+add*2]--;}else return 0;
			break;
			case 2:
			if(q[n+add]>1 && q[n+add*2]>1){q[n]-=2; q[n+add]-=2; q[n+add*2]-=2;}
			else if(pass==0)pass=n; else return 0;
			break;
			case 3:
			if(q[n+add]!=1 || q[n+add*2]<2){q[n]-=3;}
			else if(q[n+add]>0 && q[n+add*2]>0 && pass==0){q[n]--; q[n+add]--; q[n+add*2]--; pass=n;}else return 0;
			break;
			case 4:
			if(q[n+add]>0 && q[n+add*2]>0){q[n]=0; q[n+add]--; q[n+add*2]--;}
			else if(q[n+add]>1 && q[n+add*2]>1 && pass==0){q[n]-=2; q[n+add]-=2; q[n+add*2]-=2; pass=n;} else return 0;
			break;
		}
	}
	return 1;
}

int main(void){
	while(fgets(x,15,stdin)!=NULL){
		for(i=0;i<11;i++){p[i]=0;q[i]=0;}
		for(i=0;i<13;i++)p[x[i]-'0']++;
		k=0;
		for(i=1;i<10;i++){
			if(p[i]<4){
				if(check(i,1) || check(i,-1)){
					if(k>0)printf(" ");
					k++;printf("%d",i);
				}
			}
		}
		if(k==0)printf("0");
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 524
require 'pp'

# Nと空白区切の入力値を数値の配列で返却する
def gets_n_and_i_list()
  return gets.chomp.to_i, gets.chomp.split(" ").map(&:to_i)
end

N, a_list = gets_n_and_i_list

edge_hash = a_list.group_by(&:itself).map{|k,v| [k, v.count] }.to_h

edge_hash = edge_hash.select do |k, v|
  v >= 2
end

if edge_hash.empty?
  puts 0
  exit
end

e1 = 0
edge_hash.keys.sort.reverse_each do |k|
  v = edge_hash[k]
  if v >= 4 && e1.zero?
    puts k * k
    exit
  elsif !e1.zero?
    puts e1 * k
    exit
  else
    e1 = k
  end
end

Measured memory_bytes: 34568
#include<bits/stdc++.h>
using namespace std;
#define fr(i,n)  for(int i = 0;i<n;++i)
#define fri(i,a,b) for(int i= a;i<=b;++i)
#define fro(i,a,b) for(int i= a;i>=b;--i)
#define debug(P) cout<<#P<<" = "<<P<<endl;
#define fi first
#define se second
#define pb(x) push_back(x)
#define  mp(x,y) make_pair(x,y)
#define endl  "\n"
#define  ii  pair<int,int>
#define  LL  long long
#define  maxm(a,b,c)  max(a,max(b,c))
const int INF = 1e9+7;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> a(n);
  fr(i,n){
  	cin>>a[i];
  }
 vector<bool> dp(k+1);
 for(int stones = 0;stones<=k; ++stones){
 	for(auto x:a){
 		if(stones >=x && !dp[stones-x])dp[stones] = true;
	 }
 }
 puts(dp[k] ? "First" :"Second");
  }
  


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long int lli;
#define rept(soeji, start, n) for (int soeji = start; x < n; x++)
int main(void){
    int p,q,r;
    scanf("%d %d %d",&p,&q,&r);
    int min = p+q;
    if(p+r<min){
        min = p+r;
    }
    if(q+r<min){
        min = q+r;
    }
    cout << min <<endl;
    return 0;
}

Measured memory_bytes: 256
N,M,K = map(int,input().split(" "))
ans = 'No'
for i in range(1,N+1):
    for j in range(1,M+1):
        tmp = i*(M-j)+j*(N-i)
        if tmp == K:
            ans = 'Yes'
            break
        else:continue
    if ans == 'Yes':
        break
if K == N*M or K == 0:
    ans = 'Yes'
print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int d = sc.nextInt();
    int x = sc.nextInt();
    int[]a = new int[n];
    
    int cou = 0;
    for(int i=0; i<n; i++) {
    	a[i] = sc.nextInt();
    	for(int j=0; j<d; j++) {
    		if(a[i]*j+1 <= d) {
    			cou++;
    		}
    	}
    }
    		System.out.println(cou+x);
      }
}



Measured memory_bytes: 35860
#!/usr/bin/python3
n = int(input())
A = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
    l = list(map(int, input().split()))
    u = l[0]
    V = l[2:]
    for v in V:
        A[u - 1][v - 1] = 1
for a in A:
    print(" ".join(map(str, a)))

Measured memory_bytes: 7756
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int ar[100005];

int32_t main(){
	int n,q,l,r;
	string s;
	cin>>n>>q>>s;
	for(int i=0;i<n-1;i++){
		if(s[i]=='A' && s[i+1]=='C'){
			ar[i+1]=ar[i]+1;
		}
		else {
			ar[i+1]=ar[i];
		}
	}
	for(int i=1;i<=q;i++){
		cin>>l>>r;
		cout<<ar[r-1]-ar[l-1]<<"\n";
	}
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);
	
	ld a,b,c; cin >> a >> b >> c;
	if(c-a-b <= 0LL) No
	ld v = c - a - b;
	ld vv = v * v / 4LL;
	ld u = a * b;
	if(u < vv) Yes
	else No

}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
using namespace std;
int main()
{
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    int both = min(a+b,c*2),aonly = min(a,2*c),bonly = min(b,2*c),com = min(x,y);
    char m = (x>y?'x':'y');
    int ans =0;
    ans += both*com;
    if(m=='x')ans += aonly*(x+y-2*com);
    else ans += bonly*(x+y-2*com);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
#define MOD 1000000007ll // prime
// How to devide :
// ModInt a(6ll);
// ModInt b(2ll);
// a *= b.exp(MOD-2ll);  -> a/=b;  result: a = 3
struct ModInt{
	ll val;
	ModInt():val(0ll){}
	ModInt(ll v):val(((v%MOD)+MOD)%MOD){}
	ModInt exp(ll y)const{
		if(!y)return ModInt(1ll);
		ModInt a = exp(y/2ll);
		a *= a;
		if(y&1)a*=(*this);
		return a;
	}
	bool operator==(const ModInt& x)const{return val==x.val;}
	inline bool operator!=(const ModInt& x)const{return !(*this==x);}
	bool operator<(const ModInt& x)const{return val<x.val;}
	bool operator>(const ModInt& x)const{return val>x.val;}
	inline bool operator>=(const ModInt& x)const{return !(*this<x);}
	inline bool operator<=(const ModInt& x)const{return !(*this>x);}
	ModInt& operator+=(const ModInt& x){if((val+=x.val)>=MOD)val-=MOD;return *this;}
	ModInt& operator-=(const ModInt& x){if((val+=MOD-x.val)>=MOD)val-=MOD;return *this;}
	ModInt& operator*=(const ModInt& x){(val*=x.val)%=MOD;return *this;}
	ModInt operator+(const ModInt& x)const{return ModInt(*this)+=x;}
	ModInt operator-(const ModInt& x)const{return ModInt(*this)-=x;}
	ModInt operator*(const ModInt& x)const{return ModInt(*this)*=x;}
};
istream& operator>>(istream&i,ModInt&x){i>>x.val;return i;}
ostream& operator<<(ostream&o,const ModInt&x){o<<x.val;return o;}
ModInt pow(ModInt a,ll x){
	ModInt res = ModInt(1ll);
	while(x){
		if(x&1)res *= a;
		x >>= 1;
		a = a*a;
	}
	return res;
}
const int SIZE = 100100;
ModInt inv[SIZE+10],fac[SIZE+10],facinv[SIZE+10];
// notice: 0C0 = 1 
ModInt nCr(int n,int r){
	assert(!(n<r));
	assert(!(n<0||r<0));
	return fac[n]*facinv[r]*facinv[n-r];
}
void init(){
	fac[0]=ModInt(1ll);
	for(int i=1;i<=SIZE;i++)fac[i]=fac[i-1]*ModInt(i);
	inv[1]=ModInt(1ll);
	for(int i=2;i<=SIZE;i++)inv[i]=ModInt(0ll)-ModInt(MOD/i)*inv[MOD%i];
	facinv[0]=ModInt(1ll);
	for(int i=1;i<=SIZE;i++)facinv[i]=facinv[i-1]*inv[i];
	return;
}
int N;
ll K;
ll A[2010];
ll B[2010];
int main(){
	init();
	cin >> N >> K;
	for(int i=0;i<N;i++){
		cin >> A[i];
		B[i] = A[i];
	}
	ll cnt = 0;
	for(int i=0;i<N;i++){
		for(int j=i+1;j<N;j++){
			if(A[i]>A[j])cnt++;
		}
	}	
	ModInt ans = ModInt(cnt)*ModInt(K);
	for(int i=0;i<N;i++){
		ll x = 0;
		for(int j=0;j<N;j++){
			if(A[i]<A[j])x++;
		}
		ans += ModInt(K)*ModInt(K-1)*inv[2]*ModInt(x);
	}
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 2560
# C
from collections import deque

N, M = map(int, input().split())
s = list(input())
s_ = []
for c in s:
    s_.append(c)

# Graph
G = dict()
for i in range(1, N+1):
    G[i] = dict()

for _ in range(M):
    a, b = map(int, input().split())
    G[a][b] = 1
    G[b][a] = 1
    
# clean up
queue = deque()
go = True

As = [0]*N
Bs = [0]*N

for i in range(1, N+1):
    if s[i-1] != "C":
        a = 0
        b = 0
        for k in G[i].keys():
            v = s_[k-1]
            if v == "A":
                a += 1
            elif v == "B":
                b += 1
        As[i-1] = a
        Bs[i-1] = b
        if a*b == 0:
            queue.append(i)
            s[i-1] = "C"

while len(queue) > 0:
    j = queue.popleft()
    for i in G[j].keys():
        if s[i-1] != "C":
            if s_[j-1] == "A":
                As[i-1] -= 1
            else:
                Bs[i-1] -= 1
            if As[i-1] * Bs[i-1] == 0:
                queue.append(i)
                s[i-1] = "C"

if "A" in s and "B" in s:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 102188
r, c = gets.split.map(&:to_i)

lines = []

r.times do
  line = gets.split.map(&:to_i)
  line.push(line.inject(:+))
  lines.push(line)
end

sum = Array.new(c + 1, 0)
lines.each do |line|
  puts line.join("\s")
  sum = sum.zip(line).map{|a, b| a + b }
end
puts sum.join("\s")

Measured memory_bytes: 9124
#include <stdio.h>

int main(void)
{
	int ball;
	int i;
	int l, r;
	int n;
	int flag;
	
	scanf("%d", &n);
	
	while (n != 0){
		l = r = flag = 0;
		for (i = 0; i < 10; i++){
			scanf("%d", &ball);
			
			if (ball > l){
				l = ball;
			}
			else if (ball > r){
				r = ball;
			}
			else {
				flag = 1;
			}
		}
		if (flag == 1){
			printf("NO\n");
		}
		else {
			printf("YES\n");
		}
		n--;
	}
	
	return (0);
}

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

int main(){
  int n;cin >> n;
  int a[n];rep(i,n)cin >> a[i];
  int j = 1;
  int ans = 0;
  rep(i,n){
    if(a[i] == j){j += 1;ans += 1;}
  }
  if(ans == 0)cout << -1 << endl;
  else cout << n - ans << endl;
  return 0;
}

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

int main(){
	// sengen
	int n;
	// nyuryoku
	cin >> n;
	int p[n];
	int mn[n] = {};
	for(int i=0;i<n;i++){
		cin >> p[i];
		if(i){
			mn[i] = min(mn[i-1],p[i]);
		}else{
			mn[i] = p[i];
		}
	}
	// keisan
	int sum = 1;
	for(int i=1;i<n;i++){
		if(p[i] <= mn[i]){
			sum++;
		}
	}
	// syutsuryoku
	cout << sum;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


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

    if(a>=13){
        cout << b << endl;
    }else if(a<=5){
        cout << 0 << endl;
    }else{
        cout <<b/2 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
int main(){
    string s;cin>>s;
    map<ll,ll> mp;
    int n=sz(s);
    ll p=2019;
    ll now=0;
    mp[now]++;
    ll d=1;
    ll ans=0;
    for(int i=n-1;i>=0;i--){
        now+=d*(s[i]-'0');
        now%=p;
        ans+=mp[now];
        mp[now]++;
        d*=10;d%=p;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, k, q;
  cin >> n >> k >> q;
  vl ans(n, k - q);
  rep(i, q) {
    ll a;
    cin >> a;
    ans[a - 1]++;
  }
  rep(i, n) cout << (ans[i] > 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 4020
#include <iostream>
#include <cstdio>
#include <math.h>
#include <vector>





using namespace std;

typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
const int MOD = 1000000007;
const int INF = INT_MAX;



int main(int argc, char const *argv[])
{
    int n, k;
    cin >> n >> k;
    ll h[n];
    for (int i=0; i < n; i++){
        cin >> h[i];
    }

    sort(h, h + n);

    ll dif[n-k+1];
    for (int i=0; i < n-k+1; i++){
        dif[i] = h[i+k-1] - h[i];
    }

    ll min = *min_element(dif + 0, dif + (n-k+1));


    cout << min << endl;
    


    return 0;
}




//              g++ -std=c++1z  

Measured memory_bytes: 1792
n,a,b,c=[int(i) for i in input().split()]
ts = [a,b,c]
ls = []
for _ in range(n):
    ls.append(int(input()))
r = 10**18
for i in range(4**n):
    xs = [[] for _ in range(4)]
    for j in range(n):
        k, i = i%4, i//4
        xs[k].append(ls[j])
    ir = 0
    for l in range(3):
        if len(xs[l]) == 0:
            ir = 10 ** 18
            break
        ir += 10*(len(xs[l])-1) + abs(ts[l]-sum(xs[l]))
    r = min(r, ir)
print(r)


Measured memory_bytes: 44124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define _GLIBCXX_DEBUG 

int main(){
    int n,k;
    cin>>n>>k;
    ll ans;
    if(n==1) ans=k;
    if(n>=2) ans=k*pow(k-1,n-1);
    cout<<ans<<endl;
}

Measured memory_bytes: 3884
#include <stdio.h>
#define N_MAX 10000

int main(void){

  int a[N_MAX]={0},n,i,j,work;
  double sum;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    sum+=a[i];
  }
  
  for(i=0;i<n;i++){
    for(j=0;j<n-1;j++){
      if(a[j]>a[j+1]){
	work = a[j];
	a[j] = a[j+1];
	a[j+1] = work;
      }
    }
  }
  
  printf("%d %d %.0f\n",a[0],a[n-1],sum);

  return 0;
}

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

int n,t;
vector<int>G[101];
int d[101],f[101];
bool used[101];

void dfs(int v){
  used[v]=true;
  d[v]=++t;
  rep(i,G[v].size()){
    int e=G[v][i];
    if(used[e]==false)dfs(e);
  }
  f[v]=++t;
}

int main(){
  cin>>n;
  rep(i,n){
    int u,k;
    cin>>u>>k;
    u--;
    rep(j,k){
      int v;
      cin>>v;
      v--;
      G[u].push_back(v);
    }
  }
  rep(i,n)if(used[i]==false)dfs(i);
  rep(i,n)cout<<i+1<<" "<<d[i]<<" "<<f[i]<<endl;
  return 0;
}


Measured memory_bytes: 3140
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  ll a,b,v,w,t;
  cin >> a >> v >> b >> w >> t;
  if(w >=v) cout<<"NO"<<endl;
  else{
    ll kyori = abs(a-b);
    ll hayasa =abs(v-w);
    if(kyori <= hayasa * t) cout<< "YES"<<endl;
    else cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <array>
#include <limits>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i = (a); i < (b); i++)

const int MAX = 100005;

enum Country {
	NONE, IN, OUT
};

int main() {
	const string yes = "Yes";
	const string no = "No";
	int n, a, b;
	string line;
	cin >> n >> a >> b;
	cin >> line;

	int pass = 0;
	int passB = 0;
	REP(i, line.length()) {
		switch (line[i]) {
		case 'a':
			if (pass < a + b) {
				cout << yes << endl;
				pass++;
			}
			else {
				cout << no << endl;
			}
			break;
		case 'b':
			if (pass < a + b && passB < b) {
				cout << yes << endl;
				pass++; passB++;
			}
			else {
				cout << no << endl;
			}
			break;
		case 'c':
			cout << no << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 896
N = int(input())
S = input()
east = [0]*N
west = [0]*N

tmp1 = 0
for i in range(N-1,-1,-1):
    east[i] = tmp1
    if S[i] == "E":
        tmp1 += 1

tmp2 = 0
for i in range(N):
    west[i] = tmp2
    if S[i] == "W":
        tmp2 += 1

ans = N
for e, w in zip(east,west):
    if ans > e + w:
        ans = e + w
print(ans)

Measured memory_bytes: 17596
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
        }


        int leftColor  = a[0];
        int result = 0;
        for (int i = 1; i < N; i++) {
            int centerColor = a[i];
            if (leftColor == centerColor) {
                result ++;
                leftColor = 100001;
            }else{
                leftColor = centerColor;
            }

        }
        System.out.println(result);
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define len(val) static_cast<long long>(val.size())
#define rep(i, n) for(int i=0; i<(n); i++)
typedef long long ll;
typedef pair<int, int> P;


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

    map<int, int> mp1;
    int N;
    cin >> N;
    for(int i=0; i<N; i++){
      int tmp;
      cin >> tmp;
      mp1[tmp]++;
    }

    int M;
    cin >> M;
    for(int i=0; i<M; i++){
      int tmp;
      cin >> tmp;
      if(mp1[tmp] < 1){
        cout << "NO" << endl;
        return 0;
      }else{
        mp1[tmp]--;
      }
    }
    cout << "YES" << endl;

}


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

int main(){
  ll n;
  cin >> n;
  ll INF = 1e13;
  ll m = sqrt(n);
  ll sum = INF;
  for (int i = 1;i<m+1;i++){
    if (n%i == 0){
      sum = min(sum,i+n/i);
    }
  }
  cout << sum-2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mems(x,y) memset(x,y,sizeof(x))
using namespace std;
typedef long long ll;
const int MS=30,mod=1e9+7;
struct Mat//矩阵
{
    ll a[MS][MS];
    int n,m;
    Mat(int n=0,int m=0):n(n),m(m) { mems(a,0);}
    Mat operator*(const Mat&B)const
    {
        Mat C(n,B.m);
        for(int i=1;i<=n;i++)
            for(int j=1;j<=B.m;j++)
                for(int k=1;k<=m;k++)
                C.a[i][j]=(C.a[i][j]+a[i][k]*B.a[k][j])%mod;
        return C;
    }
};
Mat qpow(Mat a,int n)
{
    Mat ans(a.n,a.n);
    for(int i=1;i<=a.n;i++) ans.a[i][i]=1;
    while(n)
    {
        if(n&1) ans=ans*a;
        a=a*a;
        n>>=1;
    }
    return ans;
}
int main()
{
    int t;scanf("%d",&t);
    while(t--)
    {
        int n;scanf("%d",&n);
        n+=10;
        Mat A(21,21);
        for(int i=1;i<=5;i++) A.a[16+i][i]=1;
        for(int i=2;i<=5;i++) A.a[i-1][i]=1;
        for(int i=6;i<=16;i++) A.a[i-1][i]=A.a[i][i]=1;
        for(int i=17;i<=21;i++) A.a[i-16][i]=1;
        A=qpow(A,n);
        printf("%lld\n",A.a[1][16]);
    }
}



Measured memory_bytes: 3812
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<string>
#include<bits/stdc++.h>
#include<vector>
using namespace std;
using ll = long long;
using lli = long long int;
ll MM = 1000000000;
ll mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
signed main(){
    ll n; cin >> n;
    ll m = n;
    ll cnt = 0;
    bool flag = false;
    for(int i = 1; i < 10; i++){
        if(m == pow(10, i)) flag = true;
    }
    if(flag){
        cnt += 10;
    }
    if(!flag){
        while(m > 0){
            cnt += m % 10;
            m /= 10;
        }
    }
    cout << cnt << endl;
}

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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

const int N=4e6+100;

int h,w,k;
string c[N];

int encode(int x,int y)
{
    return x*(w+2)+y;
}

int encode(pii p)
{
    return encode(p.x,p.y);
}

int decode_x(int q)
{
    return q/(w+2);
}

int decode_y(int q)
{
    return q%(w+2);
}

pii decode(int q)
{
    return {decode_x(q),decode_y(q)};
}

int lef[N],rig[N],up[N],down[N];

int dsu(int*arr,int q)
{
    return arr[q]==q?q:arr[q]=dsu(arr,arr[q]);
}

vector<int> dist[N];
queue<pii> qu;

bool add(int x,int y,int d)
{
//    cout<<"add "<<x<<" "<<y<<" "<<d<<" -> ";
    if(c[x][y]!='.')
        return false;
    c[x][y]='*';
    dist[x][y]=d;
    qu.push({x,y});
    int q=encode(x,y);
    lef[q]=encode(x,y-1);
    rig[q]=encode(x,y+1);
    up[q]=encode(x-1,y);
    down[q]=encode(x+1,y);
//    cout<<"true\n";
    return true;
}

bool add(pii p,int d)
{
    return add(p.x,p.y,d);
}

bool add(int q,int d)
{
    return add(decode(q),d);
}

int len(int q1,int q2)
{
    pii p1=decode(q1),p2=decode(q2);
//    cout<<"len ("<<p1.x<<","<<p1.y<<") ("<<p2.x<<","<<p2.y<<") = "<<abs(p1.x-p2.x)+abs(p1.y-p2.y)<<"\n";
    return abs(p1.x-p2.x)+abs(p1.y-p2.y);
}

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

    cin>>h>>w>>k;
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    for(int i=1;i<=h;i++)
        cin>>c[i],
        c[i]='@'+c[i]+'@';
    c[0]=c[h+1]=string(w+2,'@');
    for(int i=0;i<=h+1;i++)
        dist[i].assign(w+2,-1);
    for(int i=0;i<N;i++)
        lef[i]=rig[i]=up[i]=down[i]=i;
    add(x1,y1,0);
    while(!qu.empty())
    {
        pii p=qu.front();
        qu.pop();
        int x=p.x,y=p.y,q0=encode(p),d=dist[x][y];
//        cout<<x<<" "<<y<<" -> "<<d<<"\n";

//        cout<<"lef:\n";
        for(int q=dsu(lef,q0);len(q,q0)<=k;q=dsu(lef,q))
            if(!add(q,d+1))
                break;

//        cout<<"rig:\n";
        for(int q=dsu(rig,q0);len(q,q0)<=k;q=dsu(rig,q))
            if(!add(q,d+1))
                break;

//        cout<<"up:\n";
        for(int q=dsu(up,q0);len(q,q0)<=k;q=dsu(up,q))
            if(!add(q,d+1))
                break;

//        cout<<"down:\n";
        for(int q=dsu(down,q0);len(q,q0)<=k;q=dsu(down,q))
            if(!add(q,d+1))
                break;
    }
    cout<<dist[x2][y2];
}


Measured memory_bytes: 373452
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n;
    cin >> n;
    string s[n], t;
    int count=1;
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    sort(s,s+n);
    t = s[0];
    for(int i=1;i<n;i++){
        if(s[i]!=t){
            t = s[i];
            count++;
        }
    }

    cout << count;
    

    return 0;
}

Measured memory_bytes: 9856
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector<string> open, close, both;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    int m = (int) s.size();
    vector<int> v(m);
    int c = 0;
    for (int j = 0; j < m; j++) {
      if (s[j] == '(') c++;
      else if (c > 0) {
        v[j] = 1;
        c--;
      }
    }
    c = 0;
    for (int j = m - 1; j >= 0; j--) {
      if (s[j] == ')') c++;
      else if (c > 0) {
        v[j] = 1;
        c--;
      }
    }
    string ss;
    for (int j = 0; j < m; j++) {
      if (v[j] == 0) ss.push_back(s[j]);
    }
    bool op = false, cl = false;
    for (char& c : ss) {
      if (c == '(') op = true;
      if (c == ')') cl = true;
    }
    if (op && cl) both.push_back(ss);
    else if (op) open.push_back(ss);
    else if (cl) close.push_back(ss);
  }
  sort(both.begin(), both.end(), [] (const string& s, const string& t) {
    int cs = 0, ct = 0;
    for (auto& ch : s) {
      if (ch == '(') cs++;
      else cs--;
    }
    for (auto& ch : t) {
      if (ch == '(') ct++;
      else ct--;
    }
    return cs > ct;
  });
  string res;
  for (auto& s : open) res += s;
  for (auto& s : both) res += s;
  for (auto& s : close) res += s;
  int c = 0;
  for (char& ch : res) {
    if (ch == '(') c++;
    else c--;
    if (c < 0) {
      cout << "No\n";
      return 0;
    }
  }
  cout << (c == 0 ? "Yes\n" : "No\n");
  return 0;
}

Measured memory_bytes: 37344
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int n;
  cin >> n;
  vector<ll> v(n + 1);
  v[n] = 1000000001;
  ll ans = 0;
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  int cnt = 1;
  for (int i = 0; i < n; i++) {
    if (v[i] == v[i + 1]) cnt++;
    else {
      ans += cnt % 2;
      cnt = 1;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024