akhauriyash/Code-Regression huggingface dataset:
arr = []
5.times do |i|
  a = gets.to_i
  arr << a/10.to_f
end
cmb = arr.permutation(5).to_a

ans = arr.inject(:+) * 100
cmb.each do |a|
  sum = 0
  5.times do |i|
    if i != 4
      tmp = a[i]
      sum += tmp.ceil
    elsif
      sum += a[i]
    end
  end
  if ans > sum
    ans = sum
  end
end

puts (ans * 10).floor
    

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i = 0; i < (n); i++)
int main()
{
     int n;
    cin >> n;
    int v[n], c[n];
    REP(i,n) cin >> v[i];
    int sum = 0;
    REP(i,n) {
        cin >> c[i];
        if (v[i] > c[i]) sum += v[i] - c[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

void swap(int &l, int &r) {
    int tmp = l;
    l = r;
    r = tmp;
}

int main() {
    int N;
    scanf("%d", &N);

    int p[N];
    for (int i = 0; i < N; ++i) {
        scanf("%d", &p[i]);
    }

    int count = 0;
    for (int i = 0; i < N; ++i) {
        if (p[i] == i + 1) {
            if (i == N - 1) swap(p[i - 1], p[i]);
            else swap(p[i], p[i + 1]);
            count++;
        }
    }

    printf("%d\n", count);

    return 0;
}


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

int nth_bit(int64_t num, int n){
    return (num >> n) & 1;
}

int64_t AS[1<<16], dp[1<<16];

int main(){
    int N, A[16][16];
    cin >> N;
    for(int i=0; i<N; i++) for(int j=0; j<N; j++) cin >> A[i][j];

    AS[0] = 0;
    for(int bits=1; bits<(1<<N); bits++){
        for(int i=0; i<N; i++){
            if(nth_bit(bits, i)){
                AS[bits] = AS[bits - (1<<i)];
                for(int j=i+1; j<N; j++) if(nth_bit(bits, j)) AS[bits] += A[i][j];
                break;
            }
        }
    }

    dp[0] = 0;
    for(int bits=1; bits<(1<<N); bits++){
        dp[bits] = AS[bits];
        for(int bits2=(bits-1)&bits; bits2>0; bits2=(bits2-1)&bits){
            dp[bits] = max(dp[bits], dp[bits2] + AS[bits-bits2]);
        }
    }
    cout << dp[(1<<N)-1] << endl;
    return 0;
}

Measured memory_bytes: 1280
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ASTring solver = new ASTring();
        solver.solve(1, in, out);
        out.close();
    }

    static class ASTring {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            String x = in.string();
            int ans = x.length();
            int stack = 0;
            for (char c : x.toCharArray()) {
                if (c == 'S') {
                    stack++;
                } else if (stack > 0) {
                    stack--;
                    ans -= 2;
                }
            }
            out.println(ans);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 25300
#include <bits/stdc++.h>
typedef long long int ll;

using namespace std;
const double PI = 3.14159265358979323846;

int main()
{

    int H, N;
    cin >> H >> N;

    vector<int> A(N);
    vector<int> B(N);

    for (int i = 0; i < N; i++)
    {

        cin >> A[i] >> B[i];
    }

    vector<vector<int>> dp(N + 1, vector<int>(H + 1, 1000000000));

    for (int i = 0; i <= min(A[0],H); i++)
    {
        dp[1][i] = B[0];
    }

    for (int i = 0; i <= N; i++)
    {
        dp[i][0] = 0;
    }

    for (int i = 0; i < N; i++)
    {

        for (int j = 1; j < H + 1; j++)
        {

            if (j >= A[i])
            {
                dp[i + 1][j] = min(dp[i + 1][j - A[i]] + B[i], dp[i][j]);
            }
            else
            {

                dp[i + 1][j] = min(dp[i][j], dp[i + 1][0] + B[i]);
            }
        }
    }

    cout << dp[N][H] << endl;;

    return 0;
}

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

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

  if (K <= A)
    cout << K << endl;
  else if (K <= A + B)
    cout << A << endl;
  else 
    cout << 2*A + B - K << endl;
  
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define vec vector
#define fi first
#define se second
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
#define bit(x) (1ll<<(x))

void mainsolve(){
	
	ll n;
	cin >> n;
	vec<P> red(n), blue(n);
	rep(i,n){
		ll a,b;
		cin >> a >> b;
		red[i] = P(a,b);
	}
	rep(i,n){
		ll c,d;
		cin >> c >> d;
		blue[i] = P(c,d);
	}
	
	// sort
	auto comp = [&](P xx, P yy){return xx.fi > yy.fi;};
	sort(red.begin(), red.end(), comp);
	sort(blue.begin(), blue.end(), comp);
	
	vec<bool> blueused(n,false); // blue[i]でペア成立済み
	ll res = 0;
	
	rep(i,n){
		P rr = red[i];
		ll tmpy = 1e9;
		ll aite = -1;
		rep(j,n){
			P bb = blue[j];
			if(!blueused[j] && rr.fi < bb.fi && rr.se < bb.se && tmpy > bb.se){
				tmpy = bb.se;
				aite = j;
			}
		}
		if(aite!=-1){
			blueused[aite] = true; // もう選ばれない
			res++;
		}
	}
	
	/*
	vec<vec<ll>> redto(n); // red[i]はblue[j]とペアになれる
	vec<vec<ll>> blueto(n); // blue[i]はred[j]とペアになれる
	rep(i,n){
		rep(j,n){
			P rr = red[i];
			P bb = blue[j];
			if(rr.fi < bb.fi && rr.se < bb.se){
				redto[i].push_back(j);
				blueto[j].push_back(i);
			}
		}
	}
	
	vec<ll> cnt(n); // red[i]の相手候補数
	rep(i,n) cnt[i] = redto[i].size();
	
	ll res = 0;
	vec<bool> checked(n,false);
	rep(i,n){
		// blue[i]の相手を探す
		ll aite = -1;
		ll tmp = 1e9;
		for(auto rr : blueto[i]){
			if(!checked[rr] && cnt[rr] > 0 && tmp > cnt[rr]){
				aite = rr;
				tmp = cnt[rr];
			}
		}
		if(aite!=-1){
			checked[aite] = true; // もう選ばれない
			res++;
		}
		for(auto rr : blueto[i]) cnt[rr]--; // blue[i]はもう使わない
	}
	*/
	
	cout << res << endl;
	
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int N, M; cin >> N >> M;
    bool x[30][30] = {};

    for(int i = 0; i < N; i++) {
        int K; cin >> K;
        for(int j = 0; j < K; j++) {
            int index; cin >> index;
            x[i][index-1] = true;
        }
    }

    int count = 0;
    for(int j = 0; j < M; j++) {
        bool t = true;
        for(int i = 0; i < N; i++) {
            t &= x[i][j];
        }
        if(t) count++;
    }

    cout << count << endl;
}


Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <cstdlib>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

template <class T>
struct prop_segtree {
  int n;
  vector<T> data;
  vector<bool> propFlag;

  prop_segtree(const int s) {
    init(s);
  }

  prop_segtree(const int s, const T u) {
    init(s);
    for (int i = 0; i < s; i++) {
      data[i+n-1] = u;
    }
    for (int i = n-2; i >= 0; i--) {
      data[i] = 0;
    }
  }

  prop_segtree(const vector<T> &v) {
    int s = v.size();
    init(s);
    for (int i = 0; i < s; i++) {
      data[i+n-1] = v[i];
    }
    for (int i = n-2; i >= 0; i--) {
      data[i] = 0;
    }
  }

  void init(const int s) {
    n = 1;
    while (n < s) n <<= 1;
    data = vector<T>(2*n-1);
    propFlag = vector<bool>(2*n-1);
  }

  void propagate(int p, int a, int b) {
    if (propFlag[p]) {
      if (b - a > 1) {
        data[p*2+1] += data[p];
        data[p*2+2] += data[p];
        propFlag[p*2+1] = true;
        propFlag[p*2+2] = true;
        data[p] = 0;
      }
      propFlag[p] = false;
    }
  }

  void update(int l, int r, T v, int p = 0, int a = 0, int b = -1) {
    if (b < 0) b = n; // init

    // propagate value
    propagate(p, a, b);

    if (r <= a || b <= l) return; // out of range
    if (l <= a && b <= r) { // fully covered
      data[p] += v;
      propFlag[p] = true;
      propagate(p, a, b);
    }
    else {
      update(l, r, v, p*2+1, a, (a + b) / 2); // left
      update(l, r, v, p*2+2, (a + b) / 2, b); // right
    }
    return;
  }

  T query(int x, T p = 0, int a = 0, int b = -1) {
    if (b < 0) b = n; // init

    // propagate value
    propagate(p, a, b);

    if (b - a == 1) return data[p];// reached to bottom

    if (x < (a + b) / 2) return query(x, p*2+1, a, (a + b) / 2); // left
    else return query(x, p*2+2, (a + b) / 2, b); // right
  }
};

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

  int n, q;
  cin >> n >> q;
  vector<vector<int> > query(q, vector<int>(4));
  for (int i = 0; i < q; i++) {
    cin >> query[i][0] >> query[i][1];
    if (query[i][0] == 0) cin  >> query[i][2] >> query[i][3];
  }

  prop_segtree<ll> pst(n);
  vector<ll> ans;
  for (int i = 0; i < q; i++) {
    if (query[i][0] == 0) { // add
      pst.update(query[i][1]-1, query[i][2], query[i][3]);
    }
    else { // get
      ans.push_back(pst.query(query[i][1]-1));
    }
  }

  for (auto &x: ans) cout << x << endl;

  return 0;
}



Measured memory_bytes: 11352
flag=0
N,M=map(int,input().split())
A=[-1]+[int(input()) for _ in range(M)]+[N+1]
mod=10**9+7
    
fib=[1,1]
for i in range(10**5):
    fib.append((fib[i]+fib[i+1])%mod)
    
for i in range(1,M):
    if A[i+1]==A[i]+1:
        flag=1

if flag==0:
    B=[A[i+1]-A[i]-2 for i in range(M+1)]
    ans=1
    for i in range(M+1):
        ans=(ans*fib[B[i]])%mod
    print(ans)
else:
    print(0)

Measured memory_bytes: 10888
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int i,j,s=0,x=0,h[n];
	for(i=0;i<n;i++)
	{
		cin>>h[i];
		
	}
	for(i=n-1;i>0;i--)
	{
		if(h[i-1]>=h[i])
		{
			x++;
		}
		else
		{
			if(x>=s)
			{
				s=x;
			}
			x=0;
			
		}
		
	}
	if(x>=s)
	{
		s=x;
	}
	cout<<s<<endl;
	
}

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

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll h,w; cin>>h>>w;
	ll best = ll(1e18);
	for(int i = 1; i < w; i++)
	{
		ll a[3];
		{
			a[0] = h*i;
			a[1] = (h/2)*(w-i);
			a[2] = (h-h/2)*(w-i);
			sort(a,a+3);
			best=min(best,a[2]-a[0]);
		}
		{
			a[0] = h*i;
			a[1] = ((w-i)/2)*h;
			a[2] = (w-i-((w-i)/2))*h;
			sort(a,a+3);
			if(a[0]>0)
			{
				best=min(best,a[2]-a[0]);
			}
		}
	}
	swap(h,w);
	for(int i = 1; i < w; i++)
	{
		ll a[3];
		{
			a[0] = h*i;
			a[1] = (h/2)*(w-i);
			a[2] = (h-h/2)*(w-i);
			sort(a,a+3);
			best=min(best,a[2]-a[0]);
		}
		{
			a[0] = h*i;
			a[1] = ((w-i)/2)*h;
			a[2] = (w-i-((w-i)/2))*h;
			sort(a,a+3);
			if(a[0]>0)
			{
				best=min(best,a[2]-a[0]);
			}
		}
	}
	cout<<best<<'\n';
}


Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>

using namespace std;
string s;
int main(){
    cin >> s;
    int k = s.length() - 1;
    int l=0,r=k;
    while( s[l] != 'A') l++;
    while( s[r] != 'Z') r--;
    cout << r - l + 1 << endl;
    return 0;
}


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

main()
{
    long long n,k;
    scanf("%lld %lld",&n,&k);
    long long ans=0;
    for(long long b=k+1;b<=n;b++)
    {
        long long mx_q=n/b;
        ans+=(mx_q)*(b-k);
        ans+=max(n%b-k+1,0LL);
        //printf("%lld\n",ans);
    }
    if(k==0)
        ans=n*n;
    printf("%lld\n",ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
class dice{
public:
  int d[6];
  void rotate(char a){
    if(a=='N'){
      int top=d[0];
      d[0]=d[1];
      d[1]=d[5];
      d[5]=d[4];
      d[4]=top;
    }
    else if(a=='S'){
      int top=d[0];
      d[0]=d[4];
      d[4]=d[5];
      d[5]=d[1];
      d[1]=top;
    }
    else if(a=='E'){
      int top=d[0];
      d[0]=d[3];
      d[3]=d[5];
      d[5]=d[2];
      d[2]=top;
    }
    else if(a=='W'){
      int top=d[0];
      d[0]=d[2];
      d[2]=d[5];
      d[5]=d[3];
      d[3]=top;
    }
    else if(a=='R'){
      rotate('N');
      rotate('E');
      rotate('S');
    }
    else if(a=='L'){
      rotate('N');
      rotate('W');
      rotate('S');
    }
    return;
  }
  void rotate2(int t,int f){
    int i;
    for(i=0;i<6;i++) if(d[i]==t) break;
      if(i==1) rotate('N');
      else if(i==2) rotate('W');
      else if(i==3) rotate('E');
      else if(i==4) rotate('S');
      else if(i==5) rotate('S'),rotate('S');

      for(i=1;i<5;i++) if(d[i]==f) break;
      if(i==2) rotate('L');
      else if(i==3) rotate('R');
      else if(i==4) rotate('R'),rotate('R');

      return;
  }
};
int main(){
  int n;
  cin>>n;
  dice d[n];
  bool b=false;
  for(int i=0;i<n;i++){
    for(int j=0;j<6;j++){
      cin>>d[i].d[j];
    }
  }
  for(int l=0;l<n;l++){
    for(int m=l+1;m<n;m++){
      for(int j=0;j<4;j++){
	for(int k=0;k<4;k++){
	  d[l].rotate('L');
	  if(d[l].d[0]==d[m].d[0] && d[l].d[1]==d[m].d[1] && d[l].d[2]==d[m].d[2] && d[l].d[3]==d[m].d[3] && d[l].d[4]==d[m].d[4] && d[l].d[5]==d[m].d[5]) b=true;
	}
	d[l].rotate('N');
      }
      for(int j=0;j<4;j++){
	for(int k=0;k<4;k++){
	  d[l].rotate('L');
	  if(d[l].d[0]==d[m].d[0] && d[l].d[1]==d[m].d[1] && d[l].d[2]==d[m].d[2] && d[l].d[3]==d[m].d[3] && d[l].d[4]==d[m].d[4] && d[l].d[5]==d[m].d[5]) b=true;
	}
	d[l].rotate('E');
      }
    }
  }
  if(b) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}



Measured memory_bytes: 3100
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

inline int read() {
  int f = 1;
  int x = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    f = (ch == '-') ? -1 : 1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}

const int N = 1e6 + 5;
const int P = 1e9 + 7;

inline int mul(int a, int b) {
  return (long long) a * b % P;
}
inline int sub(int a, int b) {
  return a - b < 0 ? a - b + P : a - b;
}
inline int add(int a, int b) {
  return a + b >= P ? a + b - P : a + b;
}
inline int modexp(int a, int x) {
  int ret = 1;
  while (x) {
    if (x & 1) {
      ret = mul(ret, a);
    }
    a = mul(a, a);
    x >>= 1;
  }
  return ret;
}

int n;
int fac[N];
int inv[N];

inline int calc(int m, int n) {
  int k = 2 * m - n;
  if (k >= 0 && m - k >= 0) {
    return mul(fac[m], mul(inv[k], inv[m - k]));
  } else {
    return 0;
  }
}

inline int C(int n, int m) {
  if (n < 0 || m < 0 || n < m) {
    return 0;
  }
  return mul(fac[n], mul(inv[m], inv[n - m]));
}

int sum[N];

int main() {
  n = read();
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) {
    fac[i] = mul(fac[i - 1], i);
  }
  inv[n] = modexp(fac[n], P - 2);
  for (int i = n - 1; i >= 0; --i) {
    inv[i] = mul(inv[i + 1], i + 1);
  }
  int ans = 0;
  for (int i = (n + 1) / 2; i < n; ++i) {
    sum[i] = mul(fac[n - i - 1], mul(C(i - 1, n - i - 1), fac[i]));
    ans = add(ans, mul(i, sub(sum[i], sum[i - 1])));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9984
def solve():
    from itertools import product
    input()
    A = tuple(map(lambda x: (0, int(x)), input().split()))
    result = [0]*(2000*20+1)
    for a in product(*A):
        result[sum(a)] = 1

    input()
    print(*("yes" if result[q] else "no" for q in map(int, input().split())), sep="\n")


if __name__ == "__main__":
    solve()


Measured memory_bytes: 5792
N = int(input())
R = [int(input()) for i in range(N)]

min_R = R[0]
max_diff = R[1] - R[0]
for i in range(2, N):
    min_R = min(min_R, R[i-1])
    max_diff = max(max_diff, R[i]-min_R)
print(max_diff)


Measured memory_bytes: 13592
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int m,temp;
	temp = n;
	m = 0;
	while (temp != 0)
	{
		m = m + temp % 10;
		temp = temp / 10;
	}
	if (n%m == 0)
		printf("Yes");
	else
		printf("No");

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll poc(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
void nckinit(ll n,ll md){
  kai[0]=1;
  kai[1]=1;
  for(int i=2;i<=n;i++){
    kai[i]=kai[i-1]*i;
    kai[i]%=md;
  }
  gya[n]=gyaku(kai[n],md);
  for(int i=n-1;i>=1;i--){
    gya[i]=gya[i+1]*(i+1);
    gya[i]%=md;
  }
  gya[0]=1;
}
ll nck(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0||n==k)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  ret*=gya[k];
  ret%=md;
  return ret;
}
ll npk(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n,m,k;cin>>n>>m>>k;
    nckinit(n+1,mod2);
    ll ans=0;
    rep(i,n-k,n+1){
        ll sum=nck(n-1,i-1,mod2)*m%mod2;
        (sum*=beki(m-1,i-1,mod2))%=mod2;
        (ans+=sum)%=mod2;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6768
/* winners never quit and quitters never win.
      #swap                                 */
      
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize ("-O3")
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
const ll rk = 256;

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

#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(v) v.begin(),v.end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define T ll t=0;cin>>t;for(ll test=0;test<t;test++)


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	//isprime();
	//coeff();
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    ll n,m;
    cin>>n>>m;
    cout<<(n+m-1)/m<<endl;
	return 0;
}

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

using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

struct ModularFactory {
    int mod;
    vector<int> fact;

    ModularFactory(int n, int mod) {
        this->mod = mod;
        fact.resize(n + 1);
        fact[0] = 1;
        for (int i = 1; i <= n; i++) {
            fact[i] = 1ll * fact[i-1] * i % mod;
        }
    }

    int pow_mod(int a, int n, int m) {
        if (n == 0)
            return 1 % m;
        if (n == 1)
            return a % m;
        int ans = pow_mod(a, n / 2, m);
        ans = 1ll * ans * ans % m;
        if (n % 2)
            ans = 1ll * ans * a % m;
        return ans;
    }

    int div_mod(int a, int b, int m) {
        int inv_b = pow_mod(b, m - 2, m);
        return 1ll * a * inv_b % m;
    }

    int comb_mod(int n, int r) {
        if (n >= r && r >= 0) {
            int a = fact[n];
            int b = fact[r];
            int c = fact[n - r];
            int ans = div_mod(a, b, mod);
            ans = div_mod(ans, c, mod);
            return ans;
        }
        return 0;
    }

    int repeat_comb_mod(int n, int r) {
        if (n >= 0 && r >= 1) {
            return comb_mod(n + r - 1, n);
        }
        return 0;
    }

};

ModularFactory factory(1e6+100, 1e9+7);
int mod = 1e9 + 7;

int solve(int x, int y) {
    long long ans = 0;
    for (int i = 0; i <= x && (i<<1) <= y; i++) {
        int x2 = x - i;
        int y2 = y - (i<<1);
        if (x2 == (y2<<1)) {
            int j = y2;
            int val = factory.comb_mod(i + j, i);
            ans = (ans + val) % mod;
            // cout << "i: " << i << ", j: " << j << ", val: " << val << ", ans: " << ans << endl;
        }
    }
    return ans;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int x, y;
    cin >> x >> y;
    int ans = solve(x, y);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4224
import numpy as np

a, b, h, m = [float(i) for i in input().split()]
kakua = 2*np.pi/12*h+2*np.pi/12*m/60
kakub = 2*np.pi/60*m
kaku = abs( kakua - kakub )
x = np.sqrt(a*a + b*b - 2*a*b*np.cos(kaku))
print(x)

Measured memory_bytes: 27188
#include"bits/stdc++.h"
//#include<boost/multi_array.hpp>
//#include<boost/optional.hpp>
//#include<boost/range/irange.hpp>
//#include<boost/range/algorithm.hpp>
//#include<boost/range/adaptors.hpp>

using namespace std;
//namespace adaptor = boost::adaptors;

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main()
{
	int x, n;
	cin >> x >> n;
	vector<bool> p(102, false);
	rep(i, n){
		int num;
		cin >> num;
		p[num] = true;
	}

	int min = 1000;
	int ans;

	rep(i, 102){
		if(p[i] == false){
			if(abs(i - x) < min){
				min = abs(i - x);
				ans = i;
			}
		}
	}
	rep(i, 102){
		if(p[i] == false){
			if(abs(i - x) == min && i < ans){
				//min = abs(i - x);
				ans = i;
			}
		}
	}

	cout << ans << endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MOD 1000000007
typedef long long  ll;

using namespace std;

ll ans, cnt;

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

	ll N;
	cin >> N;

	vector<ll> A(N);
	rep(i, N) {
		int a;
		cin >> a;
		if (a < 0) cnt++;
		A[i] = abs(a);
		ans += A[i];
	}

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

	if (cnt % 2 == 0) {
		cout << ans << endl;
	}
	else {
		cout << ans - (2 * A[0]) << endl;
	}

	return 0;
}

Measured memory_bytes: 3976
//Optimize
#pragma GCC optimize("Ofast")

//Head File
#include<bits/stdc++.h>
using namespace std;

#define il inline

//Variable
#define ll long long
#define ull unsigned long long
#define db double
#define lb long double
#define ui unsigned int

//Debug
#define B cerr<<"Break Point"<<endl;
#define P(x) cerr<<#x<<' '<<"="<<' '<<(x)<<endl;
#define p(x) cerr<<#x<<' '<<"="<<' '<<(x)<<' ';
#define ml(x) cerr<<"Size of array is "<<x*4/1024/1024<<" MB"<<endl;

//Vector
#define vc vector
#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define vbe(x) x.begin(),x.end()

//Memset
#define ms(x) memset(x,0,sizeof(x))
#define MS(x) memset(x,0x3f3f3f3f,sizeof(x))

//Pair
#define fi first
#define se second

//File

#define fin(x) freopen(x,"r",stdin)
#define fou(x) freopen(x,"w",stdout)
void fio()
{
    #ifndef ONLINE_JUDGE
    freopen("sample.in","r",stdin);
    freopen("sample.out","w",stdout);
    #endif
}
void pti()
{
    double timeuse = clock()*1000.0/CLOCKS_PER_SEC;
    cerr<<"Timeuse "<<timeuse<<"ms"<<endl;
}
void end()
{
    pti();
    exit(0);
}

//Inf
#define INF 0x3f3f3f3f
#define LINF ((long long)(0x3f3f3f3f3f3f3f3f))

//IO
#define pc(s) putchar(s)
#define say(s) cout<<s<<endl
namespace io
{
    const int SIZ=55;int que[SIZ],op,qr;char ch;
    template<class I>
    il void gi(I &w)
    {
        ch=getchar(),op=1,w=0;while(!isdigit(ch)){if(ch=='-') op=-1;ch=getchar();}
        while(isdigit(ch)){w=w*10+ch-'0';ch=getchar();}w*=op;
    }
    template<class I>
    il void print(I w)
    {
        qr=0;if(!w) putchar('0');if(w<0) putchar('-'),w=-w;while(w) que[++qr]=w%10+'0',w/=10;
        while(qr) putchar(que[qr--]);
    }
}
using io::gi;
using io::print;

const int N=1e6+5;

int n;
int f[N][2];
char s[N];

int main()
{
    scanf("%s",s+1),n=strlen(s+1);
    f[n][0]=s[n]-'0',f[n][1]=10-f[n][0];
    for(int i=n-1;i>=1;--i)
    {
        int t=s[i]-'0';
        f[i][0]=min(f[i+1][0]+t,f[i+1][1]+t+1);
        f[i][1]=min(f[i+1][1]+9-t,f[i+1][0]+10-t);
    }
    print(min(f[1][0],f[1][1]+1));
    end();
}

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

using namespace std;

typedef long long ll;
#define int ll

const int N = 5000 + 7;
int n, q, a[N];

int sm(int len, int s, int mod) {
  int lint = len, zezo = 0;
  s %= mod;
  lint = len;
  len--;
  for (int i = 0; i < n; i++) {
    s += (len / n) * (a[i] % mod);
  }
  for (int i = 0; i < len % n; i++) {
    s += (a[i] % mod);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] % mod == 0) {
      zezo += len / n;
    }
  }
  for (int i = 0; i < len % n; i++) {
    if (a[i] % mod == 0) {
      zezo++;
    }
  }
 // return s / mod;
 // return zezo;
return lint - zezo - s / mod - 1;
}

int d(int len, int s, int mod) {
  vector<int> v = {s};
  for (int i = 0; i < len - 1; i++) v.push_back(v.back() + a[i % n]);
  int sol = 0;
  for (int i = 0; i < len - 1; i++) sol += ((v[i] % mod) < (v[i + 1] % mod));
  return sol;
}

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

  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  while (q--) {
    int len, s, mod, zezo = 0, lint;
    cin >> len >> s >> mod;
    cout << sm(len, s, mod) << "\n";
  //  cout << sm(len, s, mod) << " " << d(len, s, mod) << "\n";
  }


}


Measured memory_bytes: 384
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc=new Scanner(System.in);
    // String S[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    String s=sc.nextLine();

    if(s.equals("SUN")){
      System.out.println("7");
    }
    if (s.equals("MON")) {
      System.out.println("6");
    }
    if (s.equals("TUE")) {
      System.out.println("5");
    }
    if (s.equals("WED")) {
      System.out.println("4");
    }
    if (s.equals("THU")) {
      System.out.println("3");
    }
    if (s.equals("FRI")) {
      System.out.println("2");
    }
    if (s.equals("SAT")) {
      System.out.println("1");
    }


    }
  }

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

char m[2005][2005];
int ans[2005][2005][2];//0 = 横、1 = 縦



int main() {
  int h,w;
  cin >> h >> w;

  for(int i = 0; i < h; i++) {
    string S;
    cin >> S;
    for(int j = 0; j < w; j++) {
      m[i][j] = S[j];
    }
  }

  for(int i = 0; i < h; i++) {
    int l = 0;
    for(int j = 0; j < w; j++) {
      if(m[i][j] == '#') {
	ans[i][j][0] = 0;
	l = 0;
      }
      else {
	l++;
	ans[i][j][0] = l;
      }
    }
  }
  for(int i = 0; i < w; i++) {
    int l = 0;
    for(int j = 0; j < h; j++) {
      if(m[j][i] == '#') {
	ans[j][i][1] = 0;
	l = 0;
      }
      else {
	l++;
	ans[j][i][1] = l;
      }
    }
  }

  for(int i = 0; i < h; i++) {
    int l = 0;
    for(int j = w-1; j >= 0; j--) {
      if(m[i][j] == '#') {
	l = 0;
      }
      else {
	l = max(l,ans[i][j][0]);
      ans[i][j][0] = l;
      }
    }
  }

  for(int i = 0; i < w; i++) {
    int l = 0;
    for(int j = h-1; j >= 0; j--) {
      if(m[j][i] == '#') {
	l = 0;
      }
      else {
	l = max(l,ans[j][i][1]);
	ans[j][i][1] = l;
      }
    }
  }

  int ANS = 0;
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      //  cout << ans[i][j][0] <<"   "<<ans[i][j][1]<<endl;
      ANS = max(ANS,ans[i][j][0] + ans[i][j][1]);
    }
  }

  cout << ANS - 1 << endl;
}
      
      

  

  
      


Measured memory_bytes: 35584
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
int x1[41000];
int Y1[41000];
int x2[41000];
int y2[41000];
double r[41000];
double len[41000];
const double EPS = 1e-10;
const double INF = 1e+10;
const double PI = acos(-1);
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
inline double ABS(double a){return max(a,-a);}
struct Pt {
	double x, y;
	Pt() {}
	Pt(double x, double y) : x(x), y(y) {}
	Pt operator+(const Pt &a) const { return Pt(x + a.x, y + a.y); }
	Pt operator-(const Pt &a) const { return Pt(x - a.x, y - a.y); }
	Pt operator*(const Pt &a) const { return Pt(x * a.x - y * a.y, x * a.y + y * a.x); }
	Pt operator-() const { return Pt(-x, -y); }
	Pt operator*(const double &k) const { return Pt(x * k, y * k); }
	Pt operator/(const double &k) const { return Pt(x / k, y / k); }
	double ABS() const { return sqrt(x * x + y * y); }
	double abs2() const { return x * x + y * y; }
	double arg() const { return atan2(y, x); }
	double dot(const Pt &a) const { return x * a.x + y * a.y; }
	double det(const Pt &a) const { return x * a.y - y * a.x; }
};
double tri(const Pt &a, const Pt &b, const Pt &c) { return (b - a).det(c - a); }
Pt p1[41000];
Pt p2[41000];
int iLL(Pt a, Pt b, Pt c, Pt d) {
	if (sig((b - a).det(d - c))) return 1; // intersect
	if (sig((b - a).det(c - a))) return 0; // parallel
	return -1; // correspond
}
Pt pLL(Pt a, Pt b, Pt c, Pt d) {
	b = b - a; d = d - c; return a + b * (c - a).det(d) / b.det(d);
}
double v[41000];
double gett(double a,double s,double v1,double v2){
	double vt=sqrt(a*s+(v1*v1+v2*v2)/2);
	//printf("%f %f\n",vt,(2*vt-v1-v2)/a);
	return (2*vt-v1-v2)/a;
}
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%d%d%d%d",x1+i,Y1+i,x2+i,y2+i);
		p1[i]=Pt((double)x1[i],(double)Y1[i]);
		p2[i]=Pt((double)x2[i],(double)y2[i]);
	}
	for(int i=0;i<a-1;i++){
		if(iLL(p1[i],p2[i],p1[i+1],p2[i+1])==0){
			double d=(p2[i]-p1[i+1]).ABS();
			r[i]=d/2;
			len[i]=d*PI/2;
		}else{
			Pt p=pLL(p2[i],p2[i]+(p1[i]-p2[i])*Pt(0,1),p1[i+1],p1[i+1]+(p2[i+1]-p1[i+1])*Pt(0,1));
			r[i]=(p-p2[i]).ABS();
			double d=(p2[i]-p1[i+1]).ABS()/2;
			double th=asin(d/r[i])*2;
			if((p2[i]-p1[i]).dot(p1[i+1]-p2[i])<-EPS)th+=PI;
			len[i]=r[i]*th;
		}
	}
	double now=0;
	for(int i=0;i<a-1;i++){
		now=sqrt((p2[i]-p1[i]).ABS()*2*b+now*now);
		now=min(now,sqrt(r[i]*b));
		v[i+1]=now;
	}
	now=0;
	for(int i=a-1;i>0;i--){
		now=sqrt((p2[i]-p1[i]).ABS()*2*b+now*now);
		now=min(now,sqrt(r[i-1]*b));
		now=min(now,v[i]);
		v[i]=now;
	}
	//for(int i=0;i<=a;i++)printf("%f %f %f\n",v[i],r[i],len[i]);
	double ret=0;
	for(int i=0;i<a;i++){
		ret+=gett((double)b,(p2[i]-p1[i]).ABS(),v[i],v[i+1]);
		if(i<a-1){
			ret+=len[i]/v[i+1];
		}
	}
	printf("%.10f\n",ret);
}

Measured memory_bytes: 3908
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
using namespace std;

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


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

	map<int, int> mp;
	rep(i, n) mp[A[i]]++;

	int cnt = 0;
	int N[n];
	for (auto p : mp) {
		N[cnt]= p.second;
		cnt++;
	}
	sort(N, N+cnt);

	if (cnt+1<=k) {
		cout << 0 << endl;
		return 0;
	}
	else {
		cout << accumulate(N, N+cnt-k, 0) << endl;
	}
}

Measured memory_bytes: 11136
#include <cstdio>
#include <algorithm>
using namespace std ;
long long get_xorsum(long long l,long long r){
	l--;
	long long ans=0,b=2,l1,r1,d1;
	for(long long i=0;i<=61;i++){
		l1=(b/2)*(l/b)+max(0LL,l%b-b/2+1);
		r1=(b/2)*(r/b)+max(0LL,r%b-b/2+1);
		d1=r1-l1;
		if(d1&1)ans+=b/2;
		b<<=1;	
	}
	return ans;
}
int main(int argc, char *argv[]) {
	long long a,b,c,ans;
	while(~scanf("%lld %lld",&a,&b)){
		//if(c&1)
			ans=get_xorsum(a,b);
		//else
			//ans=0;
		printf("%lld\n",ans);
	}
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"
  ll N, X, A;
  string S, T;
  cin >> S >> T;
  T.erase(T.size() - 1);
  if (S == T)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    string s;
    cin >> s;
    cout << s.rfind('Z') - s.find('A') + 1 << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int           long long
#define pb            push_back
#define ppb           pop_back
#define si            set <int>
#define endl          '\n'
#define fr            first
#define sc            second     
#define rep(i,a,b)    for(int  i=a;i<b;i++)
#define repr(i,a,b)      for(int i=b-1;i>=a;i--)
#define trav(it,v)      for(auto it=v.begin();it!=v.end();it++)
#define all(v)        v.begin(),v.end()
#define srt(v)        sort(all(v))
#define vs            vector<string>
#define sz(x)         (int )x.size()
#define M             1000000007
#define bs            binary_search
#define sp(n)         setprecision(n)
#define spl           " "
#define arr(a,n)      rep(i,0,n) cin>>a[i]
#define mod           998244353
#define MAXN             10001

using namespace std;

bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
} 


//int dx[4]={0,0,1,-1};
//int dy[4]={1,-1,0,0};
// vector<int>adj[100001];
// int vis[100001]={0};
// vector<int>v1;


void solve()
{
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
        cout<<"Yes";
    else cout<<"No";

}   
    


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}

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

a_sum = sum(a)
cnt = 0

def check(ai, m, a_sum):
    return ai*4*m >= a_sum

for ai in a:
    if check(ai, m, a_sum):
        cnt += 1

if cnt >= m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#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 int nmax = 8;
bool graph[nmax][nmax];
const int INF = 1e9;
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]);
            }
        }
    }
}
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);
    }
}

int dfs(int v, ll N, bool visited[nmax])
{
    bool all_visited = true;
 
    for (int i = 0; i < N; i++)
    {
        if (!visited[i])
        {
            all_visited = false;
        }
    }
 
    if (all_visited)
    {
        return 1;
    }
    int ret = 0;
    for (size_t i = 0; i < N; i++)
    {
        if (!graph[v][i])
        {
            continue;
        }
        if (visited[i])
        {
            continue;
        }
 
        visited[i] = true;
        ret += dfs(i, N, visited);
        visited[i] = false;
    }
 
    return ret;
}

void solve(long long A, long long B, long long C){
    if(A*C <= B){
        cout << C << endl;
    }else{
        cout << B /A << endl;
    }
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256
#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,l;
  cin >> n >> l;
  ll total=0;
  rep(i,n){
    total+=i+l;
  }
  //cout << total << endl;
  
  if(l<=0 && l>-n) cout << total << endl;
  else if(l <= -n) cout << total - (n-1+l) << endl;
  else cout << total - l << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 100005;
int a[MAXN],n;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",a+i);
	sort(a+1,a+n+1,greater<int>());
	int p=0;
	for(int i=1;i<=n;++i){
		if(a[i+1]<i+1){p=i;break;}
	}
	int rr=p;
	while(a[rr+1]>=p)++rr;
	int k1=rr-p,k2=a[p]-p;
	if((k1&1)+(k2&1))puts("First");
	else puts("Second");
	return 0;
}


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

using namespace std;
typedef long long int lld;
typedef pair<int,int> pii;
bool solve_game(vector<pii> v,int size,int start){
  int lo,hi;
  lo=0;
  hi=size+1;
  //r(int i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<endl;
  for(int i=v.size()-1;i>-1;i--){
    if(v[i].first== 1){
      if(v[i].second==-1){
	lo++;
      }else hi--;
    }else{
      if(v[i].second==+1){
	lo=max(lo-1,0);
      }else hi=min(hi+1,size+1);
    }
    //ut<<lo<<" "<<hi<<endl;
    if(hi-lo<=1)return false;
  }
  if(lo<start && start<hi)return true;
  return false;
}
int main(){
  int h,w,n;
  cin>>h>>w>>n;
  int s1,s2;
  cin>>s1>>s2;
  string A,B;
  cin>>A>>B;
  vector<pii > v1,v2;
  for(int i=0;i<n;i++){
    char c=A[i];
    if(c=='R'){
      v2.push_back(pii(1,1));
    }
    if(c=='L'){
      v2.push_back(pii(1,-1));
    }
    if(c=='U'){
      v1.push_back(pii(1,-1));
    }
    if(c=='D'){
      v1.push_back(pii(1,1));
    }
    c=B[i];
    if(c=='R'){
      v2.push_back(pii(-1,1));
    }
    if(c=='L'){
      v2.push_back(pii(-1,-1));
    }
    if(c=='U'){
      v1.push_back(pii(-1,-1));
    }
    if(c=='D'){
      v1.push_back(pii(-1,1));
    }
  }
  bool b1=solve_game(v1,h,s1);
  bool b2=solve_game(v2,w,s2);
  //cout<<b1<<" "<<b2<<endl;
  if(b1 && b2)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 5972
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
typedef long long ll;
using namespace std;
int INF=1000000;
int dp[402][402][42];

int main(){
    int n,ma,mb;cin>>n>>ma>>mb;
    int a[n+1],b[n+1],c[n+1];for(int i=1;i<=n;i++)cin>>a[i]>>b[i]>>c[i];
    
    for(int i=0;i<=400;i++)for(int j=0;j<=400;j++)for(int k=0;k<=n;k++)dp[i][j][k]=INF;
    dp[0][0][0]=0;
    for(int i=0;i<=400;i++)for(int j=0;j<=400;j++)for(int k=1;k<=n;k++){
        if(i<a[k]||j<b[k])dp[i][j][k]=dp[i][j][k-1];
        else dp[i][j][k]=min(dp[i][j][k-1],dp[i-a[k]][j-b[k]][k-1]+c[k]);
    }
    int min=INF;
    for(int i=1;i<=400/(max(ma,mb));i++){
        if(dp[i*ma][i*mb][n]<min)min=dp[i*ma][i*mb][n];
    }
    if(min==INF)cout<<"-1"<<endl;
    else cout<<min<<endl;
    return 0;
}



Measured memory_bytes: 26752
#include <iostream>
#include <stdio.h>
#include <stdlib.h> //rand() 0~RAND_MAX2147483647
#include <math.h>
#include <time.h>   //srand((unsigned int)time(NULL));
#include <unistd.h> //sleep
#include <algorithm>
#include <cmath>
#include <vector>
#include <regex> //正規表現
#include <map>
#include <unordered_map>
#include <set>
#include <cassert> //assart
#include <numeric>
#include <iterator>
#include <list>

using namespace std;
#define ll long long int
#define FOR(i,min,max) for(int i=(min);i<(max);i++)
#define FOReq(i,min,max) for(int i=(min);i<=(max);i++)
#define FORREV(i,max,min) for(int i=(max)-1;i>=(min);i--)
#define FORREVeq(i,max,min) for(int i=(max);i>=(min);i--)
const int MOD=1e9+7;
const int MOD2=998244353;

const int INF=2000000001;
const ll INFll=2e18;
//const int MAX_V=10000;
const double  Micro=1e-5;

int UnUsedVariable(){
    if(INF || Micro || MOD || INFll || MOD2){;}
    return 0;
}

#define pf printf
#define sf scanf
#define inarray(array,min,max) FOR(i,min,max){cin>>array[i];}
#define inarrayW(arrayA,arrayB,min,max) FOR(i,min,max){cin>>arrayA[i]>>arrayB[i];}
#define br printf("\n");
#define OutputAndReturn0(x) {cout<<(x)<<endl;return 0;}
#define elif else if

#define issame(a,b,c,d) ((a)==(b) and (b)==(c) and (c)==(d))
#define isdiff3(a,b,c) ((a)!=(b) and (b)!=(c) and (c)!=(a))
#define isdiff4(a,b,c,d) ((a)!=(b) and (b)!=(c) and (c)!=(a) and (d)!=(a) and (d)!=(b) and (d)!=(c))
inline int isEven(int x){return x%2==0;}
inline int isOdd (int x){return x%2==1;}
inline ll  gcd(ll a,ll b){ if(b==0)return a;else return gcd(b,a%b);}//最大公約数 なお一方が0なら答えは他方になるので番兵は０で良い また、負の数もOK -4%3=-1となるため
inline ll  lcm(ll a,ll b){return a*b/gcd(a,b);}//MODやオーバーフローには注意！
//inline ll  ceil(double a){return (ll)a+1;}


//Eと名のつくのはデバッグ用！
int EintN(ll array[],const ll num){
    for(int i=0;i<num;i++){cerr<<array[i]<<" ";}
    br;
    return 0;
}
int EintNN(const int heighth,const int width,int array[heighth][width]){
    FOR(i, 0, heighth){
        FOR(k, 0, width){
            {cerr<<array[i][k]<<" ";}
        }
        br;
    }
    br;
    return 0;
}
int Eint(string str,const ll num){
    cerr<<str<<" is "<<num<<" now."<<endl;
    return 0;
}





int prob(){
    ll ans;ans=0;
    pair<ll, ll> p[100010];
    
    
    ll N,mustbuy;cin>>N>>mustbuy;
    FOR(i, 0, N){
        cin>>p[i].first>>p[i].second;
    }
    
    
    
    
    sort(p, p+N);
    
    ll bought=0;
    FOR(i, 0, N){
        ll buyhere=min(p[i].second,mustbuy-bought);
        bought+=buyhere;
        ans+=buyhere*p[i].first;
        
        buyhere=buyhere;
    }
    
    OutputAndReturn0(ans);
    return 0;
}



signed main(){
    prob();
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>

int main(int argc, char const* argv[])
{
	int n, x;

	while (std::cin >> n >> x)
	{
		if( n == 0 & x == 0)
			break;
		int count = 0;
		for (size_t i = 1; i <= n; i++)
			for (size_t j = i + 1; j <= n; j++)
				for (size_t k = j + 1; k <= n; k++)
					if(x - k == i + j)
						count++;

		std::cout << count << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pii pair<pi,int>
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll x,ans=1e18;
int main()
{
    go;
    cin>>x;
    for(ll i=1;i*i<=x;i++)
    {
        if(x%i==0)
        {
            ll j=x/i;
            ans=min(ans,j-1+i-1);
            
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys


X,Y,A,B,C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))


Conf = []
for p in P:
    Conf.append([p,0])
for p in Q:
    Conf.append([p,1])
for p in R:
    Conf.append([p,2])

Conf.sort(reverse = True)
ans = 0
cnt = [0]*3
limit = [X,Y]
for p,idx in Conf:
    if idx==2:
        ans += p
        cnt[idx] += 1
    else:
        if cnt[idx]==limit[idx]:
            continue
        else:
            cnt[idx] += 1
            ans += p
    
    if sum(cnt)==X+Y:
        break

print(ans)
        


Measured memory_bytes: 128100