akhauriyash/Code-Regression huggingface dataset:
n,m= map(int, input().split())

drinkList= []
for i in range(n):
  drinkList.append(list(map(int, input().split())))

sortedList= sorted(drinkList)

need = m
count = 0
for i in range (n):
  if(need >= sortedList[i][1]):
    need-= sortedList[i][1]
    count+= sortedList[i][0]*sortedList[i][1]
  else:
    count+= sortedList[i][0]*need
    break

print(count)

Measured memory_bytes: 28656
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""abc080_c"""


import sys


def numFromBitList(l):
    """Get number from bit list."""
    n = 0
    for i, v in enumerate(l):
        n += v * 2 ** i
    return n

def main():
    """Main function."""
    n = int(input())

    fs = []
    for _ in range(n):
        fs.append(numFromBitList(list(map(int, input().split(' ')))))

    ps = []
    for _ in range(n):
        ps.append(list(map(int, input().split(' '))))

    max_ = -sys.maxsize
    for i in range(1, 1024):
        profit = 0
        for idx, f in enumerate(fs):
            profit += ps[idx][bin(i & f)[2:].count('1')]
        max_ = max(max_, profit)

    print(max_)


if __name__ == '__main__':
    sys.exit(main())

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=998244353;

//status unsolved

int main(){
    long long n,k;
    cin>>n>>k;
    long long l[k],r[k];
    rep(i,k){
        cin>>l[i]>>r[i];
    }
    
    vector<long long>dp(n+1,0);
    
    vector<long long>add(2*n+10,0);
    dp[1]=1;
    for(int i=1;i<n;i++){
        long long np=dp[i];
        rep(u,k){
            add[l[u]+i]+=np;
            add[l[u]+i]%=mod;
            add[r[u]+i+1]-=np;
            if(add[r[u]+i+1]<0)add[r[u]+i+1]+=mod;
        }
        dp[i+1]=dp[i]+add[i+1];
        dp[i+1]%=mod;
    }

    //rep2(i,n)cout<<add[i]<<" ";
    cout<<add[n]<<endl;
    //cout<<dp[n]<<endl;

    return 0;

}
/*


*/


Measured memory_bytes: 8008
N,K,Q = map(int,input().split())
member_score = [0]*N
for _ in range(Q):
    a = int(input())
    member_score[a-1] += 1

    

for i in range(N):
    point = K - Q + member_score[i]
    if 0 < point:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 4680
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from bisect import bisect_left
setrecursionlimit(1000000)

INF = int(1e10)
MOD = int(1e9 + 7)

def input():
    return stdin.readline()[:-1]


def main():
    from builtins import int, map
    from math import pi
    r = int(input())
    print("{:.10f}".format(2 * r * pi))
   
if __name__ == '__main__':
    main()

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

int main()
{
  string s;
  cin>>s;
  int flag=0;
  for(int i=0;i<s.length();i++)
  {
    if(i%2==0){if(s[i]=='L'){flag=1;break;}}
    else{if(s[i]=='R'){flag=1;break;}}
  }
if(flag==0)cout<<"Yes";
else cout<<"No";
}

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

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

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


Measured memory_bytes: 256
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
#include <math.h>

int main() {
  int n;
  scanf("%d", &n);
  double x[n], y[n], sum=0;
  for (int i=0; i<n; i++) scanf("%lf%lf", x+i, y+i);
  int f=1;
  for (int i=1; i<n; i++) f *= i;
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) {
      sum += sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))*f;
    }
  }
  sum /= f*n;
  printf("%lf\n", sum);
  return 0;
}


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

using namespace std;

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

    if(n >= 10)
        cout << r << endl;
    else
        cout << 100 * (10 - n) + r<< endl;
   return 0; 
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

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

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  rep(i, N) cin >> v.at(i);

  // sort
  sort(v.begin(), v.end());

  double ans = v.at(0);

  for (int i = 1; i < N; i++) {
    ans = (ans + v.at(i)) / 2;
  }

  printf("%.5f\n", ans);
}

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

int main()
{
    string S;
    cin >> S;
    if (S[2] == S[3] && S[4] == S[5])
    {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!

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

    #pragma GCC target("popcnt")

    string to_string(const string& s) { return '"' + s + '"'; }
    void debug_out() { cout << endl; }
    template <typename Head, typename... Tail>
    void debug_out(Head H, Tail... T) { cout << " " << to_string(H); debug_out(T...); }
    #ifdef LOCAL
        #define debug(...) cout << "#" << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
    #else
        #define debug(...) 3;
    #endif

    #define fast_io ios_base::sync_with_stdio(false); \
                    cin.tie(nullptr); cout.tie(nullptr);
    using ld = long double;  using ui = uint_fast32_t;
    using ll = int_fast64_t; using ul = uint_fast64_t;

// -----------------------------------------------------------------------------

const int N = 1e5 + 5;
const int INF = 1e9 + 5;
int n, k;
int h[N];
int dp[N];

void solve() {
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    fill_n(dp, n, INF);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j <= i + k; ++j) {
            if (j >= n) break;
            dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
        }
    }
    cout << dp[n - 1] << '\n';
}

// -----------------------------------------------------------------------------

int main() {
    fast_io; int t = 1;
    // cin >> t;
    // precompute();
    for (int i = 1; i <= t; ++i) solve();
}

Measured memory_bytes: 1024
#include<stack>
#include<iostream>
#include<sstream>
#include<string>
#include<cstdlib>
using namespace std;
string its(int n){
  stringstream s;
  s<<n;
  return s.str();
}
stack<string> mep(stack<string> me,string s){
  int a,b;
  b=atoi(me.top().c_str());
  me.pop();
  a=atoi(me.top().c_str());
  me.pop();
  if(s=="+")
    me.push(its(a+b));
  else if(s=="-")
    me.push(its(a-b));
  else if(s=="*")
    me.push(its(a*b));
  else if(s=="/")
    me.push(its(a/b));
  return me;
}
int main(){
  int h,i,j;
  int n,len;
  string s;
  stack<string> me,st;
  cin>>n;
  for(h=0;h<n;h++){
    cin>>s;
    len=s.length()-1;
    for(i=0;i<len;i++){
      if('0'<=s[i]&&s[i]<='9'){
	for(j=i;j<len;j++)
	  if(s[j]<'0'||'9'<s[j])
	    break;	
	me.push(s.substr(i,j-i));
	i=j-1;
      }else if(s[i]=='('){
	st.push(s.substr(i,1));
      }else if(s[i]==')'){
	while(st.top()!="("){
	  me=mep(me,st.top());
	  st.pop();
	}
	st.pop();
      }else if(s[i]=='+'||s[i]=='-'){
	if(st.empty());
	else if(st.top()=="(");
	else{
	  while(st.empty()==0){
	    if(st.top()=="(")
	      break;
	    else{
	      me=mep(me,st.top());
	      st.pop();
	    }
	  }
	}
	st.push(s.substr(i,1));
      }else if(s[i]=='*'||s[i]=='/'){
	if(st.empty());
	else if(st.top()=="(");
	else if(st.top()=="+"||st.top()=="-");
	else{
	  while(st.empty()==0){
	    if(st.top()=="(")
	      break;
	    else if(st.top()=="+"||st.top()=="-")
	      break;
	    else{
	      me=mep(me,st.top());
	      st.pop();
	    }
	  }
	}
	st.push(s.substr(i,1));
      }
    }
    while(st.empty()==0){
      me=mep(me,st.top());
      st.pop();
    }
    cout<<me.top()<<endl;
    me.pop();
  }
  return 0;
}

Measured memory_bytes: 0
S = list(input())
S = list(map(int,S))
N = len(S)
S1 = []
S2 = []
for i in range(N):
    if i%2==0:
        S1.append(0)
        S2.append(1)
    else:
        S1.append(1)
        S2.append(0)
d1 = 0
d2 = 0
for i in range(N):
    d1 += (S[i]+S1[i])%2
    d2 += (S[i]+S2[i])%2
print(min(d1,d2))

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

using namespace std;

int n, m, whi;
bool bro[100005];
int dp[100010];

int main()
{
    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; i ++)
    {
        scanf("%d", &whi);
        bro[whi] = 1;
    }
    dp[0] = 1;
    for(int i = 0; i <= n; i ++)
    {
        //cout<<dp[i]<<' ';
        if(bro[i]) continue;
        dp[i + 1] += dp[i];
        dp[i + 1] %= 1000000007;
        dp[i + 2] += dp[i];
        dp[i + 2] %= 1000000007;
    }
    printf("%d", dp[n]);
    //system("pause");
    return 0;
}

Measured memory_bytes: 768
import java.util.*;


import java.io.*;

public class Main {
    
    static long solve(int[] cost, int[][] points, int[] bucket, int x, int book){
        
        if(book >= cost.length){
            for(int i = 0; i < bucket.length; i++){
                if(bucket[i] < x){
                    return Long.MAX_VALUE;
                }
               
            }
            return 0;
        }
            
      
        long ans =  Long.MAX_VALUE;
        // leave current book
        long small = solve(cost, points, bucket, x, book+1);
        if(small != Long.MAX_VALUE)
            ans= Math.min(ans,small);
        
        int[] copy = bucket.clone();
        for(int i = 0; i < bucket.length; i++){
            copy[i] += points[book][i]; 
        }

     small = solve(cost, points, copy, x, book+1);
        if(small != Long.MAX_VALUE){
            ans = Math.min(ans,cost[book] + small); 
    
        }
        
        return ans;
    }
    

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String in[] = br.readLine().trim().split(" ");
        int n = Integer.parseInt(in[0]);
        int m = Integer.parseInt(in[1]);
        int x = Integer.parseInt(in[2]);
        int bucket[] = new int[m];
      
        StringTokenizer token;
        int[] cost = new int[n];
        
        int[][] points = new int[n][m];
        for(int i = 0; i < n; i++){
            token =  new StringTokenizer(br.readLine().trim()," ");
            cost[i] = Integer.parseInt(token.nextToken());
            for(int j = 0; j < m; j++){
                points[i][j] = Integer.parseInt(token.nextToken());
            }
        }

        long ans = solve(cost, points, bucket, x, 0);
        if(ans == Long.MAX_VALUE)  System.out.println(-1); else System.out.println(ans);
    
    }
}

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

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

using namespace std;

typedef long long ll;

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

int main() {
  ll a, b, n;
  cin >> a >> b >> n;
  cout << a * min(n, b - 1) / b << endl;
}


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
ll dp[105][5][2]; //桁 0以外 確定 == 1
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;int k,n;
    cin >> s; n = s.size();
    cin >> k;
    dp[0][0][0] = 1;
    rep(m,0,2){
        rep(i,0,4){
            rep(j,0,n){
                rep(d,0,10){
                    int ui = i,uj = j+1,um = m;
                    if(d != 0) ui++;
                    if(m == 0 && d > s[j]-'0') continue;
                    if(d < s[j]-'0') um =1;
                    dp[uj][ui][um] += dp[j][i][m];
                }
            }                
        }
    }
    cout << dp[n][k][0] + dp[n][k][1] << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() 
{
 
	ll n,s=0,k;
	cin>>n>>k;
	ll h[n];
	for(ll i=0;i<n;i++)
	{
	    cin>>h[i];
	   
	}
	ll dp[n];
	dp[0]=0;
	dp[1]=abs(h[0]-h[1]);
	ll m=INT_MAX;
	for(ll i=2;i<n;i++)
	{
	  m=INT_MAX;
	  for(ll j=1;j<=k;j++)
	  {
	      if(i>=j)
	      m=min(m, dp[i-j]+abs(h[i]-h[i-j]));
	      
	  }
	  dp[i]=m;
    }
	cout<<dp[n-1];
}

  

Measured memory_bytes: 1792
#include <stdio.h>
int max(int a,int b)
{
	int t;
	if(a>b)
		t=a;
	else if(a==b)
		t=a;
	else
		t=b;
	return t;
}
int main()
{
	int m,n,h[21]={0},k=1,i=0;
	scanf("%d\n",&n);
	for(;i<n;i++)
		scanf("%d",&h[i]);
	m=h[0];
	for(i=1;i<n;i++)
	{
		if(m<=h[i])
			k++;
		m=max(m,h[i]);
	}
	printf("%d\n",k);
	return 0;
}

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


#define vt vector
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define ll long long
#define ld long double
#define ar array
#define inf() ifstream cin("d.txt")
#define onf() ofstream cout("test.txt")
#define mod 1000000007
#define pb push_back
#define endl cout<<"\n";
#define prt1(a) cout<<a<<" "
#define prt2(a,b) cout<<a<<" "<<b<<" "
#define prt3(a,b,c) cout<<a<<" "<<b<<" "<<c<<" "
#define in(a) cin>>a
#define inn(a,b) cin>>a>>b
#define innn(a,b,c) cin>>a>>b>>c 
#define rep(i,st,end) for(int i=st;i<end;i++)
#define repv(i,st,end) for( i=st;i>=end;i--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define TEST ll tc;cin>>tc;while(tc--)
#define EACH(x, a) for (auto& x: a)

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {
    cin >> x;
}
void read(double& d) {
    string t;
    read(t);
    d=stod(t);
}
void read(long double& d) {
    string t;
    read(t);
    d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
template<class A> void read(vt<A>& x) {
    EACH(a, x)
        read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
    EACH(a, x)
        read(a);
}
#define debug(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 <<"\n";
    err(++it, args...);
}


// call using power (x,y,p)    to cal  (x^y)%p
ll power(ll x, ll y,ll p) 
{ 
  
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res; 
} 


void solve()
{
    ll n;
    read(n);
    ll ans = (power(10,n,mod)) ;
    ll b = (2*power(9,n,mod))%mod ;
    ll c = power(8,n,mod);
    ans=(ans - b +mod)%mod;
    ans = (ans+c)%mod;
    cout<<ans;
}

 int main()
 {
    fio;
    ll k = 1;
    ll tc = 1;
    //cin>>tc;
    while(tc--){
       // cout<<"Case #"<<k<<": ";k++;
        solve();
        endl;
    }
    
 }




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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

string s = "ACGT";

int main(int argc, char const *argv[]) {
	string S; cin >> S;
	int len = 0, ans = 0;
	rep(i, S.size()) {
		bool flg = false;
		rep(j, s.size()) if (S[i] == s[j]) flg = true;
		if (flg) len++;
		else len = 0;
		ans = max(ans, len);
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int x,y,count;
  count =0;
  string S;
  cin >> S;
  x=S.size();
  y = x/2;
  int i=0;
  while(i<y){
    if (!(S.at(i) == S.at(x-1-i))){
      count++;
    }
    i++;
      }
  cout << count << endl;
  

    
 
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long A = in.nextLong();
		long B = in.nextLong();
		long C = in.nextLong();
		if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0) {
			System.out.println(0);
		} else {
			long min = Math.min(A * B, Math.min(A * C, B * C));
			System.out.println(min);
		}
		in.close();
	}
}

Measured memory_bytes: 21844
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>
// #include "atcoder/all"

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n){

    vector<i64> v(n + 1, 0);
    for(int i = 1; i <= n; ++i){
        for(int j = i; j <= n; j += i)
            ++v[j];
    }

    i64 ans = 0;
    for(int i = 1; i <= n; ++i){
        int m = n - i;
        ans += 1LL * v[m];
    }
    cout << ans << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 11104
x = gets.to_i

400.times{|a|
  aa = a-200
  a5 = aa**5
  400.times{|b|
    bb = b-200
    b5 = bb**5
    if(a5 - b5 == x) then
      puts("#{aa} #{bb}")
      exit(0)
    end
  }
}



Measured memory_bytes: 14244
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>       // for next_permutation
#include <vector>
#include <cstdlib>
#define INF 998244353

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pi;

const ll MOD = 1e9+7;

static long gcd(long a, long b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
/*
long long int facctorialMethod(int k){//階乗
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}*/

long long int tousasum(long long int n){//等差数列
    return n*(n+1)/2;
}

unsigned GetDigit(unsigned num){//桁数
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

bool IsPrime(int num)//素数判定
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

map< ll, ll > prime_factor(ll n) {//素因数分解
    map< ll, ll > ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

ll calcNumOfCombination(ll n, ll r){
    ll num = 1;
    for(ll i = 1; i <= r; i++){
        num = num * (n - i + 1) / i;
    }
    return num;
}

int bubblesort(vector<int> array,int size){//バブルソート　転倒数
    int kaisu = 0;
    for(int i = 0; i < size; i++){
        for(int j = i + 1; j < size; j++){
            if(array[i] > array[j]){
                int number = array[i];
                array[i] = array[j];
                array[j] = number;
                kaisu++;
            }
        }
    }
    return kaisu;
}

ll facctorialMethod(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum = (sum * i)%MOD;
    }
    return sum;
}

// nPnの順列に対して処理を実行する
void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}



int main() {
    int M[2],D[2];
    cin >> M[0] >> D[0] >> M[1] >> D[1];
   if(M[1]==M[0]+1&&D[1]==1){
       cout << 1 << endl;
   }else{
       cout << 0 << endl;
   }




}






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


def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1000

    for i in range(1, N):
        if A[i - 1] < A[i]:
            stock = ans // A[i - 1]
            ans += stock * (A[i] - A[i - 1])
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 8972
#include <stdio.h>

struct diceOne{
    int number[6];
};
struct diceTwo{
    int number[6];
};

int search(struct diceOne *x, struct diceTwo *y, int z){
    for(int i = 0; i < 6; i++){
        if(y->number[z] == x->number[i]){
            return i;       //０とiの添字の要素が等しい数字を持つ
        }
    }
    return 6;
}

void rollN(struct diceOne *x){
    int diceNumber;
    diceNumber = x->number[0];
    x->number[0] = x->number[1];
    x->number[1] = x->number[5];
    x->number[5] = x->number[4];
    x->number[4] = diceNumber;
}

void rollS(struct diceOne *x){
    int diceNumber;
    diceNumber = x->number[0];
    x->number[0] = x->number[4];
    x->number[4] = x->number[5];
    x->number[5] = x->number[1];
    x->number[1] = diceNumber;
}

void rollE(struct diceOne *x){
    int diceNumber;
    diceNumber = x->number[0];
    x->number[0] = x->number[3];
    x->number[3] = x->number[5];
    x->number[5] = x->number[2];
    x->number[2] = diceNumber;
}

void rollW(struct diceOne *x){
    int diceNumber;
    diceNumber = x->number[0];
    x->number[0] = x->number[2];
    x->number[2] = x->number[5];
    x->number[5] = x->number[3];
    x->number[3] = diceNumber;
}

int main(void){
    int j, q, k;
    int ans;
    char order[120];
    struct diceOne x;
    struct diceTwo y;
    
    fgets(order, 120, stdin);
    sscanf(order, "%d %d %d %d %d %d",
           &x.number[0], &x.number[1], &x.number[2], &x.number[3], &x.number[4], &x.number[5]);
    fgets(order, 120, stdin);
    sscanf(order, "%d %d %d %d %d %d",
           &y.number[0], &y.number[1], &y.number[2], &y.number[3], &y.number[4], &y.number[5]);
           
    ans = search(&x, &y, 1);                //お互いの数字が一致する配列の添字を見つける関数search。
    switch(ans){
        case 0: rollS(&x);
                break;
        case 1: break;
        case 2: rollW(&x);
                rollS(&x);
                break;
        case 3: rollE(&x);
                rollS(&x);
                break;
        case 4: rollS(&x);
                rollS(&x);
                break;
        case 5: rollN(&x);
                break;
        case 6: printf("このダイスは同一ではありません\n");
    }
    
    ans = search(&x, &y, 0);
    switch(ans){
        case 0: break;
        case 1: break;
        case 2: rollW(&x);
                break;
        case 3: rollE(&x);
                break;
        case 4: printf("このダイスは同一ではありません\n");
                break;
        case 5: rollW(&x);
                rollW(&x);
                break;
        case 6: printf("このダイスは同一ではありません\n");
    }
    ans = 0;
    for(j = 0; j < 6; j++){
        if(x.number[j] == y.number[j])
            ans++;
    }
    if(ans == 6){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 998244353;
int n;
char s[N];
int main() {
	scanf("%d%s", &n, s);
	if ((int)strlen(s) <= n)puts(s);
	else {
		for (int i = 0; i < n; i++)printf("%c", s[i]);
		puts("...");
	}
	return 0;
}

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

using namespace std;

const double EPS = 1e-10;
const double INF = 1e12;
const double PI = acos(-1);

using Point = complex<double>;
using Polygon = vector<Point>;

inline int sgn(const double &a) { return (a < -EPS ? -1 : (a > EPS ? 1 : 0)); }

inline bool eq(const Point &a, const Point &b) { return abs(a - b) < EPS; }

inline bool operator<(const Point &a, const Point &b){
    if (sgn(a.real() - b.real()))
        sgn(a.real() - b.real()) < 0;
    return sgn(a.imag() - b.imag());
}

double dot(const Point &a, const Point &b) { return real(conj(a) * b); }

double det(const Point &a, const Point &b) { return imag(conj(a) * b); }

struct Line {
    Point p1, p2;

    Line(Point p1 = Point(), Point p2 = Point()) : p1(p1), p2(p2) {}

    bool operator<(const Line &rhs) const {
        if (eq(p2, rhs.p2))
            return p1 < rhs.p1;
        return p2 < rhs.p2;
    }
    bool operator==(const Line &rhs) const {
        return (eq(p1, rhs.p1) && eq(p2, rhs.p2)) ||
               (eq(p1, rhs.p2) && eq(p2, rhs.p1));
    }
};


bool is_parallel(Line a, Line b){
    if(sgn(det(a.p1-a.p2, b.p1-b.p2)))return false;
    return true;
}

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;++i){
        double x1, y1, x2, y2, x3, y3, x4, y4;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        if(is_parallel(Line(Point(x1,y1),Point(x2,y2)),Line(Point(x3,y3),Point(x4,y4))))
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }

    return 0;
}



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

using namespace std;

int main(void) {
    int N;
    int64_t K;
    cin >> N >> K;
    vector<int> A(N);
    for(int i=0;i<N; i++) {
        cin >> A[i];
    }

    int ng = 0, ok = 1'000'000'001;
    while(ng + 1 < ok) {
        int mid = (ng + ok) / 2;
        int64_t cnt = 0;
        for(int i=0; i<N; i++) {
            cnt += (A[i]+mid-1) / mid - 1;
        }
        if(cnt <= K) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    cout << ok << endl;
    return 0;
}


Measured memory_bytes: 4040
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<map>  
#include<set>
#include<iterator>
#include<list>
#include<utility>
#include<cstdlib>
#include<queue>
#include<stack>
#include<bitset>
//#include<bits/stdc++.h>
#define PI  2*acos(0.0)
#define pb push_back

       
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;



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

ll a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

ll size=sizeof(a)/sizeof(a[0]);

ll n;
cin>>n;

cout<<a[n-1]<<"\n";














	
	
	return 0;
	
	
	       /***Israil Hosen
	            Computer Science & Engineering
	         University Of Rajshahi.
	         ***/
	
	
	
}


Measured memory_bytes: 3144
use std::io::Read;
use std::cmp::{min, max};

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let h: usize = iterator.next().unwrap().parse().unwrap();
    let w: usize = iterator.next().unwrap().parse().unwrap();

    if h % 3 == 0 || w % 3 == 0 {
        return "0".to_string();
    }

    let result = min(calc(h, w), calc(w, h));
    result.to_string()
}

fn calc(h: usize, w: usize) -> usize {
    let mut results = vec![std::usize::MAX];

    {
        let h1 = h / 3;
        let s1 = h1 * w;
        let s2 = ((h - h1) / 2) * w;
        let s3 = h * w - s1 - s2;
        let smax = max(s1, max(s2, s3));
        let smin = min(s1, min(s2, s3));
        results.push(smax - smin);

        let s2 = (h - h1) * (w / 2);
        let s3 = h * w - s1 - s2;
        let smax = max(s1, max(s2, s3));
        let smin = min(s1, min(s2, s3));
        results.push(smax - smin);
    }

    {
        let h1 = h / 3 + 1;
        let s1 = h1 * w;
        let s2 = ((h - h1) / 2) * w;
        let s3 = h * w - s1 - s2;
        let smax = max(s1, max(s2, s3));
        let smin = min(s1, min(s2, s3));
        results.push(smax - smin);

        let s2 = (h - h1) * (w / 2);
        let s3 = h * w - s1 - s2;
        let smax = max(s1, max(s2, s3));
        let smin = min(s1, min(s2, s3));
        results.push(smax - smin);
    }

    *results.iter().min().unwrap()
}


Measured memory_bytes: 2104
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.*;

class Main {
	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		int cnt = 1;
		while(true) {
			int W = in.nextInt();
			if(W == 0) return;
			int N = in.nextInt();
			int v[] = new int[N+1];
			int w[] = new int[N+1];
			in.nextLine();
			for(int i=1;i<=N;i++) {
				String[] strs = in.nextLine().split(",");
				v[i] = Integer.parseInt(strs[0]);
				w[i] = Integer.parseInt(strs[1]);
			}
			System.out.println("Case "+cnt+":");
			solve(W, N, v, w);
			cnt++;
		}
	}

	public static void solve(int W, int N, int[] v, int[] w) {
		int[][] dp = new int[N+2][W+2];
		for(int i=0;i<N+2;i++) dp[0][i] = 0;

		for(int i=1;i<=N;i++) {
			for(int j=1;j<=W;j++) {
				dp[i][j] = dp[i-1][j];
				if(j-w[i] >= 0) {
					dp[i][j] = Math.max(dp[i - 1][j - w[i]] + v[i], dp[i - 1][j]);
				}
			}
		}
		int ans_V = 0;
		int ans_W = Integer.MAX_VALUE / 2;
		for(int i=0;i<=W;i++) {
			if(ans_V < dp[N][i]) {
				ans_V = dp[N][i];
				ans_W = i;
			}
		}
		System.out.println(ans_V);
		System.out.println(ans_W);
	}
}

Measured memory_bytes: 36460
#!/usr/bin/env python
"""AtCoder Beginner Contest 171: A - αlphabet
https://atcoder.jp/contests/abc17/tasks/abc171_a
"""


def main():
    c = input()
    if c.islower():
        print('a')
    else:
        print('A')


if __name__ == '__main__':
    main()


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

int main()
{
    int n,m;
    cin>>n>>m;
    
    double a[n],total=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        total=total+a[i];
    }
    
    sort(a,a+n);
    reverse(a,a+n);
    double temp=total/(4*m);

    for(int i=0;i<m;i++)
    {
        if(a[i]<temp)
        {
            cout<<"No";
            return 0;
        }
    }
    
    cout<<"Yes";
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
// bool debug=false;

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

int main() {
  string check[] = {"dreamer", "dream", "erase", "eraser"};
  for(int i = 0; i < 4; i++) reverse(all(check[i]));
  string S;
  cin >> S;
  reverse(all(S));
  int idx = 0;
  while(idx != S.size()) {
    bool update = false;
    for(auto str : check) {
      bool ok = true;
      for(int i = 0; i < str.size(); i++) {
	if(S[idx + i] != str[i]) {
	  ok = false;
	  break;
	}
      }
      if(ok) {
	idx += str.size();
	update = true;
      }
    }
    if(!update) break;
  }
  if(idx == S.size()) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N, M;
    cin >> N >> M;

    vector<int> A(M);

    for (int i = 0; i < M; i++){
        A[i] = 0;
    }

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

    int ans = 0;
    for (int i = 0; i < M; i++){
        if (A[i] == N){
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
program eee
  implicit none
  integer :: N,K,i
  character(len=10) :: S,Se
  character :: origin

  read(*,*) N
  read(*,*) S
  read(*,*) K
  origin=S(K:K)
  Se='          '
  do i=1,N
!     Se(i:i)=S(i:i)                                                            
     if(S(i:i).eq.origin) then
        Se(i:i)=origin
     else
        Se(i:i)='*'
     endif
  enddo
  write(*,'(a)') trim(Se)
end program eee

Measured memory_bytes: 256
import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int a = scan.nextInt();
      	int b = scan.nextInt();
      	int x = a + b;
      	int ans = 0;
      	if(x % 2 == 0){
        	ans = x / 2;
        }
      	else{
        	ans = x / 2 + 1;
        }
      	
      	System.out.print(ans);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  vector<ll> a(4);
  REP(i, 4) cin >> a[i];
  cout << max(a[0]*a[1], a[2]*a[3]) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int n, m;
    cin >> n >> m;
    vi h(n);
    rep(i, n) cin >> h[i];
    vi ans(n, 1);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        if(h[a] == h[b]) {
            ans[a] = ans[b] = 0;
        } 
        else {
            if(h[a] > h[b]) swap(a, b);
            ans[a] = 0;
        }
    }
    cout << accumulate(all(ans), 0) << '\n';
    return 0;
}

Measured memory_bytes: 4052
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
ll n,m;
ll solve(){
	if(n==1&&m==1) return 1;
	if(n==1){
		return m-2;
	}
	if(m==1) return n-2;
	return (n-2)*(m-2);
}
int main(){
	scanf("%lld%lld",&n,&m);
	printf("%lld",solve());
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main { 
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		PriorityQueue<Integer> queue1 = new PriorityQueue<Integer>();
		PriorityQueue<Integer> queue2 = new PriorityQueue<Integer>();
		while(true) {
			int n = stdIn.nextInt();
			if(n == 0) break;
			queue1 = new PriorityQueue<Integer>();
			queue2 = new PriorityQueue<Integer>();
			
			for (int i = 0; i < n; i++) {
				String A = stdIn.next();
				String B = stdIn.next();
				String[] a0 = A.split(":");
				String[] b0 = B.split(":");
				int a2 = 0;
				int b2 = 0;
				for (int j = 0; j < 3; j++) {
					int a1 = Integer.parseInt(a0[j]);
					int b1 = Integer.parseInt(b0[j]);
					if (j == 0) {
						a2 += a1 * 3600;
						b2 += b1 * 3600;
					} else if (j == 1) {
						a2 += a1 * 60;
						b2 += b1 * 60;
					} else if (j == 2) {
						a2 += a1;
						b2 += b1;
					}
				}
				queue1.add(a2);
				queue2.add(b2);
			}
			int c = 0;
			for(int i = 0; i < n; i++) {
				int cx = queue1.poll();
				if(cx >= queue2.peek()) {
					queue2.poll();
				}
				else {
					c++;
				}
			}
			System.out.println(c);
		}
	}
}

Measured memory_bytes: 86052
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		char[] s = br.readLine().toCharArray();
		String p = br.readLine();
		int point;
		Boolean flag = false;

		for(int i = 0; i < s.length; i++) {
			point = i;
			for(int j = 0; j < p.length(); j++) {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			}

			if(sb.toString().equals(p)) {
				flag = true;
				break;
			}
			sb.setLength(0);
		}

		if(flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 24132
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("Ofast")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int x, y;
	scanf("%d%d", &x, &y);
	bool f = false;
	rep(i, x + 1) {
		if (i * 2 + (x - i) * 4 == y)f = true;
	}
	printyn(f);

	Please AC;
}

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

int n, m, sum = 0;
int t[105] = {0};

int main() {
  cin >> n;
  for(int i = 0; i < n; ++i) {
    cin >> t[i];
    sum += t[i];
  }
  cin >> m;
  for(int i = 0; i < m; ++i) {
    int p, x;
    cin >> p >> x;
    cout << sum - t[--p] + x << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    double a,b,c,d,e,f;
    while(cin >> a >> b >> c >> d >> e >> f){
        double Xa = c * e - b * f;
        double Xb = a * e - b * d;
        double Ya = c * d - a * f;
        double Yb = b * d - a * e;
        printf("%.3lf %.3lf\n", Xa / Xb + 1e-9, Ya / Yb + 1e-9);

    }
}


Measured memory_bytes: 3132
def examA():
    N, M, A, B = LI()
    C = [I()for _ in range(M)]
    ans = 0
    for i,c in enumerate(C):
        if N<=A:
            N += B
        N -= c
        if N<0:
            ans = i+1
            break
    if ans==0:
        ans = "complete"
    print(ans)
    return

def examB():
    N = LI()
    P = LI()
    return

def examC():
    S = LSI()
    N = I()
    NG = [SI()for _ in range(N)]
    ans = []
    #print(S)
    for s in S:
        flag = True
        for ng in NG:
            if not flag:
                break
            if len(s)!=len(ng):
                continue
            f = True
            for i,t in enumerate(ng):
                if s[i]!=t and t!="*":
                    f = False
                    break
            if f:
                flag = False
                break
        if not flag:
            ans.append("*"*len(s))
        else:
            ans.append(s)
    print(" ".join(map(str,ans)))
    return

def examD():
    H, W = LI()
    S = [SI()for _ in range(H)]
    D = defaultdict(int)
    for s in S:
        for d in s:
            D[d] += 1
    odd = 1
    two = (H//2)*(W%2) + (W//2)*(H%2)
    for d in D.values():
        if d%2==1:
            odd -= 1
        elif d%4==2:
            two -= 1
    if odd<0 or two<0:
        print("No")
        return
    print("Yes")
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    N, K = LI()
    S = SI()
    D = [defaultdict(int) for _ in range(N+1)]
    for i in range(N):
        D[i+1] = deepcopy(D[i])
        D[i+1][S[i]] += 1
    ans = "No"
    L = [defaultdict(int) for _ in range(N-K+1)]
    for i in range(N-K+1):
        cur = deepcopy(D[i+K])
        for s,j in D[i].items():
            cur[s] -= j
        L[i] = cur



    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examD()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 5104
#include<iostream>
using namespace std;
int h[1500001]={};
int w[1500001]={};
int n,m,i,j,p[1500],k;
int main(){
    while(1){
        cin>>n>>m;
        if(n==0)
            break;
        for(i=0;i<n;i++){
            cin>>p[i];
            for(j=i,k=0;j>=0;j--)
            {
                k+=p[j];
                h[k]++;
            }
            //h[1500001]??????????????????????????¨????????´??????????????????????????????
        }
        n=k;
        for(i=0;i<m;i++){
            cin>>p[i];
            for(j=i,k=0;j>=0;j--)
            {
                k+=p[j];
                w[k]++;
            }
            //w[1500001]????¨?????????????????????¨????????´???????????????????????????
        }
        if(k<n)//?¨???¨????????¨?????????????????????????????§????????????k??¨?????????
            k=n;
        n=0;
        for(i=1;i<=k;i++){
            n+=h[i]*w[i];
            h[i]=w[i]=0;
        }
        cout<<n<<endl;
    }
    return 0;
}

Measured memory_bytes: 7248
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 1024
char s[N][N] = {};
vpii v;
queue<tuple<int, int, int>> que;
int dy[4] = {0,1,0,-1};
int dx[4] = {1,0,-1,0};

void dfs(int y, int x){
	if(s[y][x] == '#') return;
	s[y][x] = '#';
	v.EB(y, x);
	REP(k, 4) dfs(y + dy[k], x + dx[k]);
}

int main(){
	int h, w; scanf("%d%d", &h, &w);
	int sy, sx, ty, tx; scanf("%d%d%d%d", &sy, &sx, &ty, &tx);
	sy++; sx++; ty++; tx++;
	REP(i, h) scanf("%s", s[i+2]+2);
	REP(i, N){
		REP(j, N){
			if(i < 2 || 2 + h <= i || j < 2 || 2 + w <= j){
				s[i][j] = '#';
			}
		}
	}
	que.emplace(0, sy, sx);

	while(que.size()){
		auto [ans, y, x] = que.front(); que.pop();
		v.clear();
		dfs(y, x);
		for(auto [i, j] : v){
			if(i == ty && j == tx){
				printf("%d\n", ans);
				return 0;
			}
			FOR(k, i-2, i+3){
				FOR(l, j-2, j+3){
					if(s[k][l] == '.'){
						que.emplace(ans+1, k, l);
					}
				}
			}
		}
	}
	printf("-1\n");
}


Measured memory_bytes: 5072
n = int(input())
a = list(map(int, input().split()))
ans=1000

import itertools
a = [k for k, v in itertools.groupby(a)]

a.insert(0,1000)
a.append(1)

now_y=1000
now_k=0

for i in range(1,len(a)-1):
    if a[i-1] < a[i] < a[i+1]:
        continue
    if a[i-1] > a[i] > a[i+1]:
        continue

    if a[i-1] < a[i] > a[i+1]: # sell all
        now_y += now_k * a[i]
        now_k=0
        ans=max(ans,now_y)

    if a[i-1] > a[i] < a[i+1]: # buy all
        kabu = now_y // a[i]
        now_k += kabu
        now_y-=kabu*a[i]

print(ans)


Measured memory_bytes: 62244