akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int main()
{
	ll t=1;
	//cin>>t;
	while(t--)
	{
		ll n,m;
		cin>>n>>m;
		ll arr[n+1][m+1],ans[n+1][m+1],i,j,x=1;
		char a;
		for(i=1;i<=n;i++)
		{
			for(j=1;j<=m;j++)
			{
				cin>>a;
				if(a=='.')
					arr[i][j]=0;
				else
					arr[i][j]=1;
			}
		}
		x=1;
		for(i=1;i<=n;i++)
		{
			if(arr[i][1]==1)
				x=0;
			ans[i][1]=x;
		}
		x=1;
		for(j=1;j<=m;j++)
		{
			if(arr[1][j]==1)
				x=0;
			ans[1][j]=x;
		}
		for(i=2;i<=n;i++)
		{
			for(j=2;j<=m;j++)
			{
				if(!arr[i][j])
					ans[i][j]=(ans[i-1][j]+ans[i][j-1])%mod;
				else
					ans[i][j]=0;
			}
		}
		cout<<ans[n][m]<<endl;
	}
	return 0;
}

Measured memory_bytes: 15872
import kotlin.math.abs
import kotlin.math.min

//

fun main() {
    abc175c()
}

fun abc175c() {
    val (x, k, d) = readLine()!!.split(" ").map { it.toLong() }
    val xx = abs(x)
    var temp = xx / d
    if (temp >= k) {
        println(xx - (d * k))
        return
    }
    val remain = k - temp
    val t = xx - temp * d
    if (remain % 2 == 0L) {
        // この座標が答え
        println(abs(t))
    } else {
        println(abs(t - d))
    }
}


Measured memory_bytes: 36380
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <limits>
#include <iterator>
#include <cmath>
#include <numeric>
#include <stack>
#include <queue>
#include <cassert>
#include <forward_list>
#include <chrono>
#include <deque>
#include <list>
#include <random>
#include <cstdio>
#include <sstream>

using namespace std;

//最大公約数
template<class T>
T GCD(T m, T n)
{
	T temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
template<class T>
T LCM(T m, T n)
{
	return m * n / GCD(m, n);
}



int main()
{
	int n, m; cin >> n >> m;
	vector<int> L(m), R(m);
	for (int i = 0; i < m; i++) { cin >> L[i] >> R[i]; }

	pair<int, int> ans(L[0],R[0]);
	for (int i = 0; i < m; i++)
	{
		if (ans.first <= L[i] && L[i] <= ans.second) { ans.first = L[i]; }
		else if (ans.second < L[i]) { ans.first = 0; break; }
		if (R[i] <= ans.second && ans.first <= R[i]) { ans.second = R[i]; }
		else if (R[i] < ans.first) { ans.second = 0; break; }
	}

	cout << (ans.first != 0 && ans.second != 0 ? ans.second - ans.first + 1 : 0) << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<math.h>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
ll f(ll x,ll y,ll s){
    ll sq=(ll)sqrt(s);
    if(x<=sq){
	return min(x,s/y);
    }
    
    ll sh=s/(sq+1);
    if(sh==s/sq)sh--;
    return min(x-sq,sh-y+1)+sq;
}
int main(){
    int q;cin>>q;
    lol(u,q){
	ll a,b;cin>>a>>b;
	ll x=f(a-1,b+1,a*b-1);
	ll y=f(b-1,a+1,a*b-1);
	cout<<x+y<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll K;
    cin >> K;
    vl a(K);
    rep(i,K){
        cin >> a[i];
    }
    if(a[K-1] != 2){
        cout << "-1\n";
        return 0;
    }
    ll l = 2,r = 3;
    rrep(i,K-1){
        ll st = (l-1) / a[i] + 1;
        ll ed = r / a[i];
        if(st > ed){
            cout << "-1\n";
            return 0;
        }
        l = st*a[i],r = (ed+1)*a[i]-1;
    }
    cout << l << " " << r << "\n";
    return 0;
}


Measured memory_bytes: 1024
/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog ender-zzm.enbar.cn
*/
#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
inline int readint(){
    register int x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), Isdigit(ch = getchar()));
	return x * flag;
}

inline long long readlong() {
	register long long x = 0, flag = 1;
	register char ch;
	while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), Isdigit(ch = getchar()));
	return x * flag;
}
template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10); 
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define For(i, x, y) for (int i = (x); i <= (y); i++) 
#define Rep(i, x, y) for (int i = (x); i >= (y); i--) 
#define ri readint
#define rl readlong

const int maxn = 3e5 + 20;
int n, m;
int a[maxn], b[maxn], tot = 0;
int ji[maxn], ou[maxn];
int tot1, tot2;
int tong[maxn], t[maxn];
int main() {
	n = ri();
	for (int i = 1; i <= n; i++) {
		a[i] = ri();
		t[i] = a[i];
		b[i] = a[i];
	}
	sort(b + 1, b + 1 + n);
	for (int i = 1; i <= n; i++) {
		a[i] = lower_bound(b + 1, b + 1 + n, a[i]) - b;
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if ((a[i] % 2) != (i % 2)) ans++;
	}
	cout << ans / 2;
	return 0;
}


Measured memory_bytes: 4764
#include <iostream>
#include <queue>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
using namespace std;

struct data{
	unsigned long value;
	int num;

	data(unsigned long v, int n) {
		value = v; num = n;
	}
	data() {}

	bool operator==(const data &a) const {
		return a.value == value;
	}
	bool operator<(const data &a) const {
		return value < a.value;
	}
};

int main() {
	string in;
	unsigned long l = 001234567;
	queue<data> que;
	que.push(data(l,0));
	set<data> used;
	used.insert(data(l,0));

	while(!que.empty()) {
		data d;
		d = que.front(); que.pop();

		/* decode */
		int board[2][4];
		for(int i = 0; i < 2; i++) {
			for(int j = 0; j < 4; j++) {
				board[i][j] = ((070000000 >> ((i * 4 + j) * 3)) & d.value) >> ((7 - (i * 4 + j)) * 3);
			}
		}
		/* search */
		for(int i = 0; i < 2; i++) {
			for(int j = 0; j < 4; j++) {
				if(!board[i][j]) {
					if(i != 0) {
						swap(board[i - 1][j], board[i][j]);
						unsigned long enc = 0;
						for(int k = 0; k < 8; k++) {
							enc |= board[0][k] << (21 - k * 3);
						}
						if(used.find(data(enc,0)) == used.end()) {
							used.insert(data(enc, d.num + 1));
							que.push(data(enc, d.num + 1));
						}
						swap(board[i - 1][j], board[i][j]);
					}
					if(i != 1) {
						swap(board[i][j], board[i + 1][j]);
						unsigned long enc = 0;
						for(int k = 0; k < 8; k++) {
							enc |= board[0][k] << (21 - k * 3);
						}
						if(used.find(data(enc,0)) == used.end()) {
							used.insert(data(enc, d.num + 1));
							que.push(data(enc, d.num + 1));
						}
						swap(board[i][j], board[i + 1][j]);
					}
					if(j != 0) {
						swap(board[i][j - 1], board[i][j]);
						unsigned long enc = 0;
						for(int k = 0; k < 8; k++) {
							enc |= board[0][k] << (21 - k * 3);
						}
						if(used.find(data(enc,0)) == used.end()) {
							used.insert(data(enc, d.num + 1));
							que.push(data(enc, d.num + 1));
						}
						swap(board[i][j - 1], board[i][j]);
					}
					if(j != 3) {
						swap(board[i][j], board[i][j + 1]);
						unsigned long enc = 0;
						for(int k = 0; k < 8; k++) {
							enc |= board[0][k] << (21 - k * 3);
						}
						if(used.find(data(enc,0)) == used.end()) {
							used.insert(data(enc, d.num + 1));
							que.push(data(enc, d.num + 1));
						}
						swap(board[i][j], board[i][j + 1]);
					}
				}
			}
		}
	}

	while(getline(cin, in)) {
		l = 0;
		stringstream sstr(in);
		 int tmp;
		while(sstr >> tmp) {
			l <<= 3;
			l |= tmp;
		}
		cout << used.find(data(l,0))->num << endl;
	}
}

Measured memory_bytes: 2516
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
vector<P> res;
signed main(){
    int n;cin >> n;
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0){
            int cnt = 0;
            while(n%i == 0 && n ){
                n /= i;
                cnt++;
            }
            res.emplace_back(i,cnt);
        }
        
    }
    if(n > 1)res.emplace_back(n,1);
    //for(auto p:res){
    //    trace(p.first,p.second);
    //}
    int ret = 0;
    for(auto p:res){
        int num = p.first,hoge = p.second;
        for(int i = 1;i < 200;i++){
            if(hoge - i >= 0){
                hoge -= i;
                ret++;
            }
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

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

    for(int i=0; i<=N; ++i){
        for(int j=0; j<=N-i; ++j){
            int k = N-i-j;
            if(10000*i + 5000*j + 1000*k == Y){
                printf("%d %d %d\n", i, j, k);
                return 0;
            }
        }
    }

    printf("-1 -1 -1\n");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <queue>
#include <map>
#include <vector>
#include <cstdio>
#include <string>
#include <climits>
#include <cmath>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
    int x,a,b;
    cin>>x>>a>>b;
    if(min(abs(x-a), abs(x-b)) == abs(x-a)){
        cout<<'A'<<endl;
    }else{
        cout<<'B'<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;



int main() {
  int N;
  string s;
  cin >> N >> s;
  vector<int> e(N + 1, 0), w(N + 1, 0);
  for (int i = 0; i < N;i++){
    if(s[i]=='W'){
      w[i + 1] = w[i] + 1;
      e[i + 1] = e[i];
    } else {
      e[i + 1] = e[i] + 1;
      w[i + 1] = w[i];
    }
  }

  int ans = INF;
  for (int i = 0; i < N;i++){
    int sum = w[i] + e[N] - e[i + 1];
    ans = min(ans, sum);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3076
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define STRMAX 200
#define PNUM 4

using namespace std;

class Point{
  public:
    double x, y;
  public:
    bool isLeft( Point *p, Point *q );
};
enum State{
  NONE,
  LEFT,
  RIGHT
};
bool Point::isLeft( Point *p, Point *q ){
  double x1 = p->x - this->x;
  double x2 = q->x - this->x;
  double y1 = p->y - this->y;
  double y2 = q->y - this->y;
  return (x1 * y2 - x2 * y1 > 0) ? true : false;
}

void c2s( char str[] ){
  for( int i = 0; str[ i ] != '\0'; i++ ){
    str[ i ] = ( ( str[ i ] == ',' ) ? ' ' : str[ i ] );
  }
}

int main(){
  char str[ STRMAX ];
  Point *p[ PNUM ] = { NULL, NULL, NULL, NULL };
  while( scanf( "%s", str ) != EOF ){
    c2s( str );
      for( int i = 0; i < PNUM; i++ ){
        if( p[ i ] == NULL ){
          delete p[ i ];
        }
        p[ i ] = new Point();
      }
      sscanf(
          str,
          "%lf%lf%lf%lf%lf%lf%lf%lf", 
          &(p[ 0 ]->x), 
          &(p[ 0 ]->y), 
          &(p[ 1 ]->x), 
          &(p[ 1 ]->y), 
          &(p[ 2 ]->x), 
          &(p[ 2 ]->y), 
          &(p[ 3 ]->x), 
          &(p[ 3 ]->y) 
     );
     State state = NONE;
     bool ok = true;
     for( int i = 0; i < PNUM; i++ ){
        State s = LEFT;
        if( !p[(i+2)%PNUM]->isLeft( p[i%PNUM], p[(i+1)%PNUM] ) ){
          s = RIGHT;
        }
        if( state != NONE && state != s ){
          ok = false;
          break;
        }
        state = s;
     }
     puts( ok ? "YES" : "NO" );
  }

  return EXIT_SUCCESS;
}

Measured memory_bytes: 1052
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

vector<ll> to[100000];
vector<ll> dist(100000, -1);
void dfs(int v, int p = -1, ll d = 0){
  if(dist[v] != -1 && dist[v] <= d) return;
  dist[v] = d;
  for(int u : to[v]){
    if(u == p || u == v) continue;
    dfs(u, v, d+1);
  }
}

int main(void){
  int n;
  cin >> n;
  REP(i, n){
    int a;
    cin >> a;
    to[i].emplace_back(--a);
  }
  dfs(0);
  if(dist[1] == -1) cout << -1 << endl;
  else cout << dist[1] << endl;
  return 0;
}

Measured memory_bytes: 11136
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007


signed main(){
    int N;
    cin>>N;
    cout<<N/2+N%2<<endl;
}


Measured memory_bytes: 3140
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;
constexpr double PI = 3.141592653589793;
constexpr int INF = 1e9 + 10;
constexpr ll INFL = 1e18 + 10;

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

using namespace std;
//    cout << setprecision(20) << ans << "\n";



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

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

    int count = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            for (int k = j + 1; k < n; k++)
            {
                
                if (l[i] + l[j] > l[k] && l[i] + l[k] > l[j] && l[j] + l[k] > l[i]){
                    if (l[i] != l[k] && l[j] != l[k] && l[i] != l[j]){
                        count++;
                    }
                }
            }
        }
    }

    cout << count << "\n";
    return 0;
}


Measured memory_bytes: 3652
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
int main()
{
	int d,m;
	cin>>m>>d;
	if(d<m)
	 cout<<m-1<<endl;
	 else
	 cout<<m<<endl;
	return 0;
 } 

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

int dp[maxn][maxn];
string s1, s2;

int main()
{
    cin >> s1 >> s2;
    int len1 = s1.length(), len2 = s2.length();
    rep(i, len1)
        rep(j, len2)
    {
        if (s1[i] == s2[j])
            dp[i + 1][j + 1] = dp[i][j] + 1;
        else
        {
            if (dp[i + 1][j] > dp[i][j + 1])
                dp[i + 1][j + 1] = dp[i + 1][j];
            else
                dp[i + 1][j + 1] = dp[i][j + 1];
        }
    }
    char ans[maxn];
    int p = 0;
    while (len1 && len2)
    {
        if (s1[len1 - 1] == s2[len2 - 1])
        {
            len1--;
            len2--;
            ans[p++] = s1[len1];
        }
        else
        {
            if (dp[len1][len2] == dp[len1 - 1][len2])
                len1--;
            else
                len2--;
        }
    }
    rrep(i, p) cout << ans[i];
    return 0;
}

Measured memory_bytes: 35968
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D, LEFT, RIGHT;
  cin >> A >> B >> C >> D;
 
  LEFT = A + B;
  RIGHT = C + D;

  if (LEFT > RIGHT) {
    cout << "Left" << endl;
  }
  else if (LEFT < RIGHT){
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
a,b=map(int,input().split())
n=1
while True:
  aa=int(n*0.08)
  bb=int(n*0.1)
  if a==aa and b==bb:
    print(n)
    exit()
  elif aa>a and bb>b:
    print(-1)
    exit()
  n+=1







Measured memory_bytes: 3064
import java.util.Scanner;

/**
 *
 * @author bhatti
 */
public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int fiveCount = 0, sevenCount = 0;
        if ( A == 5){
            fiveCount++;
        }
        if ( A == 7){
            sevenCount++;
        }
        if ( B == 5){
            fiveCount++;
        }
        if ( B == 7){
            sevenCount++;
        }
        if ( C == 5){
            fiveCount++;
        }
        if ( C == 7){
            sevenCount++;
        }
        
        System.out.println((fiveCount == 2 && sevenCount == 1)? "YES" : "NO");
        
    }
    
    
}


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

long long int calcmin(int n, int k) {
  long long int sum = 0;
  for(int i=0; i<k; i++) {
    sum += i;
  }
  return sum;
}
long long int calcmax(int n, int k) {
  long long int sum = 0;
  for(int i=n; i>=n-k+1; i--) {
    sum += i;
  }
  return sum;
}

int main() {
  int n, k;
  cin >> n >> k;
  long long int sum = 0;

  int mod = 1000000000+7;
  long long int min = calcmin(n, k);
  long long int max = calcmax(n, k);
  for(int i=k; i<=n+1; i++) {
    sum += max - min + 1;
    sum %= mod;
    min += i;
    max += n-i;
  }
    cout << sum << endl;
}


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

int main(){
  int H,W,Ch,Cw,Dh,Dw;
  cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
  Ch--;
  Cw--;
  Dh--;
  Dw--;

  vector<string> S(H);
  for(int i=0;i<H;i++){
    cin >> S.at(i);
  }

  vector< vector< pair<int,int> > > vvp(H*W);
  vector< vector<bool> > flag(H,vector<bool>(W,false));
  vector< pair<int,int> > temp;
  vector<int> vx={1,0,-1,0};
  vector<int> vy={0,1,0,-1};
  stack< pair<int,int> > sp;
  int x,y,nx,ny;

  vvp.at(0).emplace_back(Ch,Cw);
  flag.at(Ch).at(Cw)=true;

  for(int i=0;i<H*W;i++){
    temp=vvp.at(i);
    for(auto & p:temp){
      sp.push(p);
      while(!sp.empty()){
        tie(x,y)=sp.top();
        sp.pop();
        for(int j=0;j<4;j++){
          nx=x+vx.at(j);
          ny=y+vy.at(j);
          if(nx<0||nx>=H||ny<0||ny>=W){
            continue;
          }
          if(!flag.at(nx).at(ny)&&S.at(nx).at(ny)=='.'){
            if(nx==Dh&&ny==Dw){
              cout << i << endl;
              return 0;
            }
            vvp.at(i).emplace_back(nx,ny);
            sp.push(make_pair(nx,ny));
            flag.at(nx).at(ny)=true;
          }
        }
      }
    }
    for(auto & p:vvp.at(i)){
      tie(x,y)=p;
      for(int j=-2;j<=2;j++){
        for(int k=-2;k<=2;k++){
          nx=x+j;
          ny=y+k;
          if(nx<0||nx>=H||ny<0||ny>=W){
            continue;
          }
          if(!flag.at(nx).at(ny)&&S.at(nx).at(ny)=='.'){
            if(nx==Dh&&ny==Dw){
              cout << i+1 << endl;
              return 0;
            }
            vvp.at(i+1).emplace_back(nx,ny);
            flag.at(nx).at(ny)=true;
          }
        }
      }
    }
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 33672
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
int N,num_sum,tmp;
cin>>N;
int A[N];
int a;
int ans[N]={};
int ans_num=0;
for(int i=0;i<N;++i){
  cin>>a;
  A[i]=a;
}
for(int i=N;i>0;--i){
  num_sum=0;
  tmp=i;
  while(tmp<=N){
    num_sum+=ans[tmp-1];
    tmp+=i;
  }
  if(num_sum%2==A[i-1]){
    ans[i-1]=0;
  }
  else{
    ans[i-1]=1;
    ans_num+=1;
  }
}
cout<<ans_num<<"\n";
for(int i=0;i<N;++i){
  if(ans[i]==1){
    cout<<i+1<<" ";
  }
}
return 0;
}


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

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			998244353

ll mod_pow(ll a,ll b) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2);
}

void solve()
{
	int x , y;
	
	cin >> x >> y;
	
	for(int i = 0; i <= x; ++i) {
		if(2*i+(x-i)*4 == y) {
			cout << "Yes";
			return;
		}
	}
	
	cout << "No";
}

signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N,T; cin>>N>>T;
    int c=0,t=0;
    int minimum=9999999;
    bool can=false;
    for(int i=0;i<N;i++){
        cin>>c>>t;
        if(t<=T){
            minimum=min(minimum,c);
            can=true;
        }
    }
    if(can) {
        cout << minimum;
    }
    else{
        cout<<"TLE";
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

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

    cout << 8 - (x - 400) / 200 << endl;
}


Measured memory_bytes: 3620
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
if H%3==0 or W%3==0:
    answer = 0
else:
    answer = min(H, W)
# さらに小さくするには縦と横で割る
def cal(H, W):
    global answer
    h = H // 3
    area = [h * W, (H-h) * (W//2), (H-h) * ((W+1)//2)]
    answer = min(answer, max(area)-min(area))
    h += 1
    area = [h * W, (H-h) * (W//2), (H-h) * ((W+1)//2)]
    answer = min(answer, max(area)-min(area))

cal(H, W)
cal(W, H)
print(answer)
# 13

Measured memory_bytes: 3064
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c,x,y,z;
double d,e,f;
string s,t;
//

signed main() {
  RAPID;
  IN(n);
  if(n%2==0) OUT(n);
  else OUT(n*2);
}

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

int main()
{
    int A,B,flag=0;
    cin>>A;
    cin>>B;

    for(int i=0;i<A||i<B;i++)
    {
        if(abs(A-i)==abs(B-i))
        {
            flag=1;
            cout<<i<<endl;
            break;
        }
    }
    if(flag==0)
        cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define vec vector<int> 
#define int long long 
#define pii pair<int,int>
//int dp[100001][2];
int seg[1000000];
int query(int node,int low,int high,int l,int r){
	if(l>high ||r<low || l>r ||low>high) return 0; 
	if(l<=low && r>=high){
		return seg[node];
	}
	int mid=(low+high)/2;
	return max(query(2*node+1,low,mid,l,r),query(2*node+2,mid+1,high,l,r));
}

void update(int node,int low,int high,int l,int r,int val){
	if(l>high||r<low ||low>high||l>r) return;
	if(l<=low && r>=high){
		seg[node]=val;
		return ;
	} 
	int mid=(low+high)/2;
	update(2*node+1,low,mid,l,r,val);
	update(2*node+2,mid+1,high,l,r,val);
	seg[node]=max(seg[2*node+1],seg[2*node+2]);
	return;
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ios_base& scientific (ios_base& str);
	
	int t=1;
	//cin>>t;
	while(t--){
		int n;
		cin>>n;
		int hei[n],val[n];
		rep(i,n){
			cin>>hei[i];
		}
		rep(i,n){
			cin>>val[i];
		}
		int dp[n+1]={0};
		int ans=0;
		rep(i,n){
			int h=hei[i];
			int x=query(0,1,n,1,h-1);
			dp[i]=val[i]+x;
			ans=max(ans,dp[i]);
			update(0,1,n,h,h,dp[i]);
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 11136
// ABC154_A
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <cstring>  // std::memset
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> pll;
#define rep(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define rep1(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define repr(i, n) for (ll i=n-1; i >= 0; i++)  // n-1 ~ 0
#define all(vec) (vec).begin(), (vec).end()
#define sum(vec) accumulate(all(vec), 0LL)  // 0 は初期値
#define min_vec(vec) min_element(all(vec))  // iterator: * を先頭につける
#define max_vec(vec) max_element(all(vec))  // iterator: * を先頭につける
#define idx(vec, element_iter) distance((vec).begin(), element_iter)
const ll INF = 1LL<<60;  // 10^18（const int inf = 1<<29;）
const double PI = acos(-1);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    // input(sunippets: inpv, inpn, inps)
    string S, T, U;
    ll A, B;
    cin >> S >> T;
    cin >> A >> B;
    cin >> U;
    
    // calculation
    if (S == U) A--;
    else B--;
    cout << A << ' ' << B << "\n";
    
    return 0;
}



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

int main() {
    double pi = atan(1.0)*4.0;
    double r;
    cin >> r;
    cout << fixed << setprecision(6);
    cout << r*r*pi << " " << 2*r*pi << endl;
    return 0;
}


Measured memory_bytes: 3272
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)

char ban[128];
int sum[128];

string table;
int n;

int main(){
	while(cin >> n && n){
		rep(i,128) ban[i] = 0;
		rep(i,128) sum[i] = 0;
		table = "";
		rep(i,n){
			string s;
			cin >> s;
			if(s.size() != 1)ban[s[0]] = true;
			int w = 1 , islst = 1-2*(i == n-1);
			rep(j,s.size()){
				sum[s[s.size()-j-1]] += w * islst;
				w *= 10;
			}
			table += s;
		}
		sort(table.begin(),table.end());
		table.erase(unique(table.begin(),table.end()),table.end());
		int s = table.size();
		int ans = 0 , x[10] = {0} , bit = (1<<s)-1 , clc = 0;
		while(bit < (1<<10)){
			int p = 0;
			rep(j,10) if(bit>>j&1) x[p++] = j;
			do{
				rep(k,p) if(x[k] == 0 && ban[table[k]]) goto exit;
				clc = 0;
				rep(k,p) clc += sum[ table[k] ] * x[k];
				if(clc == 0)ans++;
				exit:;
			}while(next_permutation(x,x+p));
			int x = bit & -bit, y = bit + x;
			bit = ((bit & ~y) / x >> 1) | y;
		}
		cout << ans << endl;
	}
}

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

int main(){
	int N;
	cin >> N;
	vector<int> ans(N-1,0);
	int l=1;
	for(int i=0;i<N-1;i++){
		if(ans[i]>0)continue;
		int p=(int)pow(2,l);
		for(int k=i;k<N-1;k+=p)ans[k]=l;
		l++;
	}
	
	for(int i=0;i<N-1;i++){
		for(int j=i+1;j<N;j++){
			if(j==N-1)cout << ans[j-i-1] << endl;
			else cout << ans[j-i-1] << " ";
		}
	}
	
	return 0;
}

Measured memory_bytes: 512
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


word = sys.stdin.buffer.readline().decode().rstrip()
input = sys.stdin.buffer.readline().decode().rstrip()
# dist[v][w]: input を v 文字、word を w 文字見たときの、それ以前の編集距離
dist = [[INF] * (len(word) + 1) for _ in range(len(input) + 1)]
dist[0] = list(range((len(word) + 1)))
for v in range(1, len(input) + 1):
    vc = input[v - 1]
    dist[v][0] = v
    for w in range(1, len(word) + 1):
        wc = word[w - 1]
        dist[v][w] = min(dist[v][w], dist[v - 1][w - 1] + (0 if vc == wc else 1))
        dist[v][w] = min(dist[v][w], dist[v][w - 1] + 1)
        dist[v][w] = min(dist[v][w], dist[v - 1][w] + 1)
print(dist[-1][-1])



Measured memory_bytes: 42876
#include <stdio.h>
main()
{
 int x;
 int i = 1;
   
  while(1)
 {
   
    scanf("%d", &x);
    if(x == 0)
       break;
    printf("Case %d: %d\n", i, x);
 i++;
  }
 return 0;
}

Measured memory_bytes: 600
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        if (N < 105) {
          System.out.println(0);
        } else if (N < 135) {
          System.out.println(1);
        } else if (N < 165) {
          System.out.println(2);
        } else if (N < 189) {
          System.out.println(3);
        } else if (N < 195) {
          System.out.println(4);
        } else {
          System.out.println(5);
        }  
    }
}

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

long long int a, b, x;
long long int res;

int main(){
  cin >> a >> b >> x;
  long long int n = ((a + x - 1) / x) * x ;
  long long int m = b - (b % x);
  //cout << n << " " << m << endl;
  if(n > m){
    res = 0;
  }else{
    res = (m - n) / x;
    res++;
  }
  
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// const ll INF = 1LL <<60;
const int INF = 10000;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始
int main(){
  int n;
  string s;
  cin>>n>>s;
  int q = 0;
  int left=0;
  for(int i = 0; i < n; i++){
    if(s[i]=='('){
      q++;
    }
    else{
      if(q<=0){
        left++;
      }
      else q--;
    }
  }

  for(int i = 0; i < left; i++) cout<<'(';
  cout<<s;
  for(int i = 0; i < q; i++) cout<<')';
  cout<<endl;
  return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

"""
[解法メモ]
各桁(桁数iとする)を10**i mod pの形で持っておく.
それの累積和をとって, 再びmod pをとると, 同じ数のペアの範囲はpの倍数になっていることが分かる.(他の問題でもこの解法あった気がする)
よって, 答えは同じ数のペアの数をすべて足したもの.

pが2や5の場合, *10が付くと必ず割り切れるので注意.
つまり, 1桁目が割り切れたら必ず割り切れる.⇒各桁を見ていってpで割り切れるならそれ以前の数を足せば良い.
(例)p=5, s=100のとき
    1は割り切れないからx
    0は割り切れるからo ⇒ 2桁目なので+2(10,0の場合)
    0は割り切れるからo ⇒ 3桁目なので+3(100,00,0の場合)
    ⇒答えは5
"""

n, p = LI() 
s = list(map(int,list(input())))
t = []
ans = 0
if p == 2 or p == 5:
    for i in range(n):
        if s[i] % p == 0:
            ans += i+1
    print(ans)
    quit()
 
for i in range(n):
    t.append(s[i]*pow(10,n-i-1,p))
t = list(accumulate(t))
u = [i % p for i in t]
u = list(Counter(u).items())
ans = 0
for i,j in u:
    if i == 0:
        ans += j
    if j >= 2:
        ans += j*(j-1) // 2
print(ans)


Measured memory_bytes: 69960
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n, m; cin >> n >> m;
    ll a[n]; zep(i, 0, n){cin >> a[i];}
    
    ll sm = 0;
    zep(i, 0, n){sm += a[i];}
    
    ll ans = 0;
    zep(i, 0, n){
    	if(4*m*a[i] >= sm){
    		ans++;
    	}
    }
    print((ans >= m)? "Yes" : "No")
    return 0;
}

Measured memory_bytes: 256
from itertools import product
N = int(input())
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
A = [0, 1]
M = -10**18
Pr = list(product(A, repeat=10))
Pr.remove((0,0,0,0,0,0,0,0,0,0))
for I in Pr:
  s = 0
  for i in range(N):
    s += P[i][sum(i*f for i, f in zip(I, F[i]))]
  M = max(M, s)
print(M)

Measured memory_bytes: 9232
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll inf = numeric_limits<ll>::max()/3;

int main(void){
  int n,a;
  cin >> n >> a;
  int m = n % 500;
  cout << ( m <= a ? "Yes" : "No") << endl;
  return 0;
}


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

using namespace std;

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v; stringstream ss(s); string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}
#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }
void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

#define in(x) int x; cin >> x
#define ou(x) cout << x << endl

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	in(n);
	vector<int> a(n);
	REPU(i, 0, n) {
		cin >> a[i];
	}
	int sum = accumulate(ALL(a), 0);

	int ans = 0, dist = abs(sum - n * a[0]);
	REPU(i, 1, n) {
		if (abs(sum - n * a[i]) < dist) {
			ans = i;
			dist = abs(sum - n * a[i]);
		}
	}
	ou(ans);

	return 0;
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

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

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=1e9+7;

ll modpow(ll a, ll n, ll mod){
    ll res=1;
    while(n > 0){
        if(n & 1) res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

int main(){
    int N; cin >> N;
    vector<ll> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    vi cnt(60);
    for(int i=0; i<N; i++){
        for(int j=0; j<60; j++){
            if(A[i]>>j & 1) cnt[j]++;
        }
    }
    ll res=0;
    for(ll i=0; i<60; i++){
        res=(res+cnt[i]%MOD*(N-cnt[i])%MOD*modpow(2LL, i, MOD)%MOD)%MOD;
    }
    cout << res << endl;
    return 0;
}

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


int main() {
    int N,M,X;
    cin >>N>>M>>X;
    int sum=0;
    int ad =0;
    vector<int>data(M);
    rep(i,M){
        cin >>data[i];
        sum+=data[i];
    }
    int j=0;
    while(data[j]<=X){
        ad++;
        j++;
    }
    int mn =min(ad,M-ad);
    cout << mn <<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int a, b, k;
    scanf("%d%d%d",&a,&b,&k);
    int c[100];
    int index = 0;
    for(int i = 1; ; i++){
        if(a % i == 0 && b % i == 0){
            c[index] = i;
            index ++;
        }
        if(a < i || b < i){
            break;
        }
    }
    printf("%d\n",c[index - k]);
    return 0;
}

Measured memory_bytes: 128
package main

import("fmt")

func main(){
  var n int
  fmt.Scan(&n)
  
  a:=[]int{}
  for i:=1; i<10; i++{
    for j:=1; j<10; j++{
      a=append(a,i*j)
    }
  }
  
  if contains(a,n)==true{
    fmt.Print("Yes")
  }else {
    fmt.Print("No")
  }
} 

func contains(s []int, e int) bool {
    for _, a := range s {
        if a == e {
            return true
        }
    }
    return false
}



Measured memory_bytes: 512
x=int(input())
c=0
for i in range(0,501):
    for j in range(0,501):
        if (i*i*i*i*i)+(j*j*j*j*j)==x:
            print(i,"-"+str(j))
            c+=1
            break
        elif (i*i*i*i*i)-(j*j*j*j*j)==x:
            print(i,j)
            c+=1
            break
    if c==1:
        break


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

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

    int c = 0;
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a;
        if (a < c) ans += c - a;
        if (a > c) c = a;
    }
    cout << ans << endl;
}

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

long long int N, M, Q, dp[505][505], l, r;

int main(){
    scanf("%lld%lld%lld", &N, &M, &Q);
    for(int i = 0; i < M; ++i){
        scanf("%lld%lld", &l, &r);
        ++dp[1][r];
        --dp[l + 1][r];
    }
    for(int i = 1; i <= N; ++i){
        for(int j = 0; j <= N; ++j){
            dp[i][j] += dp[i - 1][j];
        }
    }
    for(int i = 0; i <= N; ++i)partial_sum(dp[i], dp[i + 1], dp[i]);
    for(int i = 0; i < Q; ++i){
        scanf("%lld%lld", &l, &r);
        cout << dp[l][r] << endl;
    }
    return 0;
}


Measured memory_bytes: 2944
import sys
sys.setrecursionlimit(10**7)
vec = [(1,0),(0,1),(-1,0),(0,-1),(1,1),(-1,-1),(1,-1),(-1,1)]
def dfs(x,y,visited,field):
        
     
        visited[x][y] = 1
        for nx,ny in vec:
            tx = x + nx
            ty = y+ny
            if tx < 0 or ty < 0 or tx > h-1 or ty > w-1:continue
            if visited[tx][ty]:continue
            if field[tx][ty] == 0:continue
            dfs(tx,ty,visited,field)
            
        return
while True:    
    w,h = map(int,input().split())
    if w == 0 and h == 0:break
    field = [list(map(int,input().split()))for i in range(h)]
    visited = [[0]*w for i in range(h)]
    ans = 0
    
    for i in range(h):
        for j in range(w):
            if field[i][j] == 1 and visited[i][j] == 0:
                dfs(i,j,visited,field)
                ans +=1
    
    print(ans)
    



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

int main(){
    int q;
    cin >> q;
    long long a, b;
    for (int i = 0; i < q; i++){
        cin >> a >> b;
        if (a > b) swap(a, b);
        if (b - a < 2) cout << a*2 - 2 << endl;
        else {
            long long c = (long long)(sqrt(a*b));
            if (c == sqrt(a*b)) c--;
            if (c*(c+1) >= a*b) cout << c*2 - 2 << endl;
            else cout << c*2 - 1 << endl;
        }
    }
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

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

bool iskaibun(string s){
	string t = s;
	reverse(all(t));
  	return s == t;
}

void Main(){
	string s;
	cin >> s;
	int m = s.size()/2;
  	string s1 = s.substr(0,m);
	if(!iskaibun(s)) {
        puts("No");
      	return;
    }
	if(!iskaibun(s1)) {
      	puts("No");
      	return;
    };
    puts("Yes");
    return;
}

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

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

using namespace std;

const int N = 1e2+7;

long long n, res;

int main()
{
    cin >> n;
    res = n-1;
    for (long long i = 2; i*i <= n; ++i) {
        if (n%i) continue;
        res = min(res, i+n/i-2);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256