akhauriyash/Code-Regression huggingface dataset:
import math
A, B, H, M = map(int,input().split())

kakudo = min(abs(M*6 - (H*60 + M)*0.5),360-abs(M*6 - (H*60 + M)*0.5))

ans = (A**2 + B**2 - 2*A*B*math.cos(math.radians(kakudo)))**(1/2)

print(ans)

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

string str;
int ans = 20;
char c[] = { 'i' , 'w' , '(' , ')' };

char f(char c){
    if( c == '(' )
        c = ')';
    else if( c == ')' )
        c = '(';
    return c;
}

bool check(string s){
    bool flag = true;
    for(unsigned int i=0 ; i<s.size()/2 ; ++i ){
        if( s[i] != f(s[s.size()-i-1]) ){
            flag = false;
        }
    }
    if( (s.size() % 2) == 1 ){
        int i = s.size()/2;
        if( s[i] == ')' || s[i] == '(' ){
            flag = false;
        }
    }
    return flag;
}




int def(string s){
    int cnt = 0;
    for(int i=0 ; i<s.size() ; ++i ){
        if( str[i] != s[i] )
            cnt++;
    }
    return cnt;
}

void solve(string s, int i){
    if( i == s.size()-1 ){
        if( check(s) ){
            ans = min( ans , def(s) );
        }
    }else if( i < s.size() ){
        s[i] = c[0];
        solve( s , i+1 );
        s[i] = c[1];
        solve( s , i+1 );
        s[i] = c[2];
        solve( s , i+1 );
        s[i] = c[3];
        solve( s , i+1 );
    }
}
int main(){
    cin >> str;
    solve( str , 0 );
    cout << ans << endl; 
}

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

typedef long long int ll;
typedef long double ld;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define MOD (ll)(1e9 + 7)
#define vi vector<int>
#define vii vector<vector<int> >
#define vl vector<ll>
#define vll vector<vector<ll> >
#define vc(T, nm) vector<T> nm
#define pb push_back
#define popb pop_back
#define si set<int>
#define sl set<ll>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define ins insert
#define ers erase
#define endl "\n"
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define adr(a, b) ((a % MOD) + (b % MOD)) % MOD
#define FORA(x, s, e, inc) for(ll x = s; x != e; x += inc)
#define ROFA(x, s, e, inc) for(ll x = s; x != e; x -= inc)
#define FOR(x, s, e) FORA(x, s, e, 1)
#define ROF(x, s, e) ROFA(x, s, e, 1)
#define loop(x, n) FOR(x, 0, n)
#define rd1(t, a) 					t a; cin >> a;
#define rd2(t, a, b) 				rd1(t, a); rd1(t, b); 
#define rd3(t, a, b, c) 			rd2(t, a, b); rd1(t, c);
#define rd4(t, a, b, c, d) 			rd3(t, a, b, c); rd1(t, d);
#define rd5(t, a, b, c, d, e) 		rd4(t, a, b, c, d); rd1(t, e);
#define rd6(t, a, b, c, d, e, f) 	rd5(t, a, b, c, d, e); rd1(t, f);
#define rdA(t, nm, len)				t nm[len]; loop(i, len) {cin >> nm[i];}
#ifdef DEBUG
	#define deb(v) cout << endl << #v << ": " << v << endl
	#define db1(v) cout << endl << #v << ": " << "[ "; for(auto x: v) {cout << x << " ";}; cout << "]" << endl;
	#define db2(v) cout << endl << #v << ": " << endl; for(auto r: v) {cout << "[ "; for(auto x: r) {cout << x << " ";}; cout << "]" << endl;};
	#define dbl cout << "-------------------------------" << endl
#else
	#define deb(v)
	#define db1(v)
	#define db2(v)
	#define dbl
#endif

void solve() {
    rd3(ll, d, t, s);
    ll tm = d / s;
    if(d % s != 0)
        tm++;
    if(tm <= t)
        cout << "Yes";
    else
        cout << "No";
}


int main() {
	
	fastio;
	
	ll t = 1;
    while(t--) {
        solve();
    }


	return 0;
}


Measured memory_bytes: 3608
import sys

sys.setrecursionlimit(1000000)


def main():
    n, m = map(int, input().split())
    h_list = list(map(int, input().split()))
    not_good = set()
    for i in range(m):
        a, b = map(int, input().split())
        # ll.append((a-1, b-1))
        x = a-1
        y = b-1
        hx = h_list[x]
        hy = h_list[y]
        if hx == hy:
            not_good.add(x)
            not_good.add(y)
        elif hx > hy:
            not_good.add(y)
        else:
            not_good.add(x)

    print(n - len(not_good))


main()


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

using namespace std;
using ll = long long;
using pii = pair<int,int>;

int main() {
	// freopen("in.txt","r",stdin);
	string s;
	cin >> s;
	if (s.size() < 4 || s.substr(0,4) != "YAKI") {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
}

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

bool flag[1000001] = { false };
int main()
{
    int n;
    cin >> n;
    vector<int> vi(n);
    REP(i, n)
    {
        cin >> vi[i];
    }
    sort(ALL(vi));
    set<int> seti;
    REP(i, n)
    {
        if (!flag[vi[i]]) {
            if (seti.find(vi[i]) == seti.end()) {
                seti.insert(vi[i]);
                for (int j = vi[i] * 2; j < 1000001; j += vi[i]) {
                    flag[j] = true;
                }
            } else {
                seti.erase(vi[i]);
                flag[vi[i]] = true;
            }
        }
    }
    cout << seti.size() << endl;
}

Measured memory_bytes: 13364
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
using namespace std;
#define int long long
#define inf   1000000009
#define minf -1000000009
int x[51], y[51];
vector<int>xa, ya;

signed main() {
	int n, t;
	cin >> n >> t;
	for (int i = 0; i < n; i++)cin >> x[i] >> y[i];
	for (int i = 0; i < n; i++){xa.push_back(x[i]); ya.push_back(y[i]);
}
	sort(xa.begin(), xa.end());
	sort(ya.begin(), ya.end());
	int res = 5000000000000000002;

	for (int xi = 0; xi < n; xi++) {
		for (int xj = xi + 1; xj < n; xj++) {
			for (int yi = 0; yi < n; yi++) {
				for (int yj = yi + 1; yj < n; yj++) {

					int p = 0;
					for (int i = 0; i < n; i++) {
						if (xa[xi] <= x[i] && x[i] <= xa[xj]
							&& ya[yi] <= y[i] && y[i] <= ya[yj])p++;
					}

					if (p >= t)res = min(res, abs((xa[xj] - xa[xi])*(ya[yj] - ya[yi])));

				}
			}
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, P> PP;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
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; }


int main() {
    ll h, w;
    cin >> h >> w;
    vector<vector<ll> > a(h, vector<ll>(w, 0));
    ll odd = 0;
    rep1(i, h) rep1(j, w) {
            cin >> a[i][j];
            if (a[i][j] & 1) odd++;
    }
    vector<PP> res;
    ll num = 0;
    ll x = 0, y = 0;
    rep1(i, w*h){
        if (a[x][y] & 1) num++;

        ll nx = x, ny = y;
        if (x % 2 == 0) {
            if (ny == w-1) nx++;
            else ny++;
        }
        else {
            if (ny == 0) nx++;
            else ny--;
        }
        if (num & 1) if (num < odd) res.push_back(PP(P(x, y), P(nx, ny)));
        x = nx, y = ny;
    }
    
    cout << res.size() << endl;
    for (auto p: res) {
        cout << p.first.first+1 << " " << p.first.second+1 << " " << p.second.first+1 << " " << p.second.second+1 << endl;
    }
    //printf("%.12f", ans);
}

Measured memory_bytes: 9444
#include<stdio.h>
int main()
{
	int a[20000][5];
	int n,i,j,k,t,d,b,c;

	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%d%d%d",&a[i][1],&a[i][2],&a[i][3]);
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=2;j++)
		{
			for(k=j+1;k<=3;k++)
			{
				if(a[i][j]<a[i][k])
				{
					t=a[i][j];
					a[i][j]=a[i][k];
					a[i][k]=t;
				}
			}
		}
		b=a[i][2]*a[i][2];
		c=a[i][3]*a[i][3];
		d=a[i][1]*a[i][1];
		
		
		if(b+c==d)
			printf("YES\n");
		else
			printf("NO\n");
	}
	
	return 0;
} 

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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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; }


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

    vector<int> x(N);
    rep(i,N) cin >> x[i];

    ll ans = 0;

    rep(i,N)
    {
        ans += min( x[i], K-x[i] )*2;
    }
    cout << ans << endl;
}


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

#define MAX 2000000
#define INF 1000000
int size;
int S[MAX];

void maxHeapify(int i){
  int l=2*i;
  int r=2*i+1;
  int largest=0,tmp;

  if(l<=size && S[l]>S[i]){
    largest=l;
  }else{
    largest=i;
  }

  if(r<=size && S[r]>S[largest]){
    largest=r;
  }

  if(largest!=i){
    tmp=S[i];
    S[i]=S[largest];
    S[largest]=tmp;
    maxHeapify(largest);
  }
}

int extractMax(){
  int max;

  max=S[1];
  S[1]=S[size];
  size--;
  maxHeapify(1);

  return max;
}

void heapIncreaseKey(int k){
  int i=size;
  int tmp;

  S[i]=k;
  while(i>1 && S[i/2]<S[i]){
    tmp=S[i];
    S[i]=S[i/2];
    S[i/2]=tmp;
    i=i/2;
  }
}

void insert(int k){
  size+=1;
  S[size]=-INF;
  heapIncreaseKey(k);
}

int main(){
  char c[10];
  int k;

  while(1){
    scanf("%s",c);
    if(strcmp(c,"insert")==0){
      scanf("%d",&k);
      insert(k);
    }else if(strcmp(c,"extract")==0){
      printf("%d\n",extractMax());
    }else if(strcmp(c,"end")==0){
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 4696
use std::io;

fn main() {
    let mut buf: String = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let x: i32 = buf.trim().parse::<i32>().unwrap();
    let mut buf: String = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let a: i32 = buf.trim().parse::<i32>().unwrap();
    let mut buf: String = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let b: i32 = buf.trim().parse::<i32>().unwrap();
    println!("{}", (x - a) % b);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;

template<int mod> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % mod) {
        if (val < 0) val += mod;
    }
    constexpr int getmod() { return mod; }
    constexpr Fp operator - () const noexcept {
        return val ? mod - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= mod) val -= mod;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += mod;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % mod;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = mod, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % mod;
        if (val < 0) val += mod;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<mod>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<mod> modpow(const Fp<mod> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

vector<pair<ll, ll> > prime_factorize(ll n) {
    vector<pair<ll, ll> > res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

const int mod = 1e9+7;
using mint = Fp<mod>;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    mint ans = 0;
    mint lcm = 1;
    map<ll, ll> mp;
    rep(i,n){
        auto pf = prime_factorize(a[i]);
        for(auto f : pf) mp[f.first] = max(mp[f.first], f.second);
    }
    for(auto num : mp){
        rep(i,num.second){
            lcm *= (mint)num.first;
        }
    }
    rep(i,n) ans += lcm / (mint)a[i];
    cout << ans << endl;
}

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

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

using namespace std;




void one_case() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a + b >= c ? "Yes\n" : "No\n") << "\n";
}


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


    int t = 1;
//    cin >> t;
    while (t--) {
        one_case();
    }

    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
  #include "_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

struct UnionFind{
  vector<int> par; //親
  vector<int> size; //集合の大きさ

  UnionFind(int n){
    par.resize(n); size.resize(n, 1);
    for(int i = 0; i < n; i++){
      par[i] = i;
    }
  }

  //木の根を求める
  int root(int x){
    if(par[x] == x){
      return x;
    }else{
      return par[x] = root(par[x]);
    }
  }

  //xとyの属する集合を併合
  void unite(int x,int y){
    x = root(x), y = root(y);
    if(x == y) return;
    if(size[x] < size[y]) swap(x,y);
    par[y] = x;
    size[x] += size[y];
  }

  bool same(int x, int y){
    return root(x) == root(y);
  }
};

signed main(){

  int n, m; cin >> n >> m;
  UnionFind uf(n);
  for(int i = 0; i < m; i++){
    int a, b; cin >> a >> b;
    a--, b--;
    uf.unite(a, b);
  }

  int ans = 0;
  for(int i = 0; i < n; i++){
    ans = max(ans, uf.size[i]);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6428
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n,h;
	cin>>n>>h;
	int w[n],v[n];
	for(int i=0;i<n;i++)
	cin>>w[i]>>v[i];
	long long int z[n+1][h+1];
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=h;j++)
		{
			if(i==0||j==0)
			z[i][j]=0;
			else if(w[i-1]<=j)
			{
				z[i][j]=max(z[i-1][j],z[i-1][j-w[i-1]]+v[i-1]);
			}
			else 
			{
				z[i][j]=z[i-1][j];
			}
		}
	}
	cout<<z[n][h];
}

Measured memory_bytes: 79104
import math

N = int(input())

def prime(n):
    if n <=1:return []
    primes = [i for i in range(n+1)]
    primes[1] = 0
    for i in primes:
        if i == 0:continue
        if i > math.sqrt(n):break
        for j in range(2*i, n+1, i):primes[j]=0
            
    return [prime for prime in primes if prime!=0]

cnt =[0]*N

for i, j in enumerate(prime(N)):
    for k in range(2,N+1):
        while k%j==0:
            cnt[i]+=1
            k/=j

cnts =1
for l in cnt:
    if l>0:cnts*=l+1
      
print(cnts%(10**9+7))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define MAXN 100005
using namespace std;
inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while (ch<'0'||ch>'9'){
		if (ch=='-') f=-1;
		ch=getchar();
	}
	while (ch>='0'&&ch<='9'){
		x=(x<<3)+(x<<1)+(ch^'0');
		ch=getchar();
	}
	return x*f;
}
vector<int>G[MAXN];
inline void AddEdge(int u,int v){
	G[u].push_back(v);
}
int n;
int fa[MAXN],d[MAXN];
int vis[MAXN];
queue<int>Q;
inline int bfs(int u){
    while (Q.size()) Q.pop();
    memset(vis,0,sizeof(vis));
    memset(fa,0,sizeof(fa));
    memset(d,0,sizeof(d));
    d[u]=0,vis[u]=true;
    Q.push(u);
    int ans=0;
    while (Q.size()){
        int u=Q.front();Q.pop();
        vis[u]=true;
        if (d[u]>d[ans]) ans=u;
        for (register int i=0;i<G[u].size();++i){
            int v=G[u][i];
            if (vis[v]) continue;
            d[v]=d[u]+1;
            fa[v]=u;//记录父亲，等于是记录直径
            Q.push(v);
        }
    }
    return ans;
}
int mark[MAXN],now;//mark所有直径上面的点的邻居 
int ans1[MAXN],cnt1,ans2[MAXN],cnt2;
inline void GetAns(int pre,int u,int nex,int *ans,int &cnt){
	int adj=0;
	mark[u]=true;
	for (register int i=0;i<G[u].size();++i){
		int v=G[u][i];
		if (v!=pre&&v!=nex) adj++,mark[v]=true;
	}
	now++;
	for (register int i=1;i<=adj;++i){
		ans[++cnt]=now+i;
	}
	ans[++cnt]=now;
	now+=adj;
}
inline void GetChain(int p,int q,int *ans,int &cnt){
	bfs(q);//建立fa数组
	int x=p,y=0;
	now=0;
	while (x){
		GetAns(y,x,fa[x],ans,cnt);
		y=x,x=fa[x];
	}
}
int main(){
	int n=read();
	for (register int i=1;i<n;++i){
		int u=read(),v=read();
		AddEdge(u,v);
		AddEdge(v,u);
	}
	int p=bfs(1);
	int q=bfs(p);
	//找到直径的两个端点
	GetChain(p,q,ans1,cnt1);
	GetChain(q,p,ans2,cnt2);
//	for (register int i=1;i<=n;++i){
//		printf("%d ",mark[i]);
//	}
//	puts("");
	for (register int i=1;i<=n;++i){
		if (!mark[i]) return puts("-1"),0;
	}
	bool flag=false;
	for (register int i=1;i<=cnt1;++i){
		if (ans1[i]<ans2[i]){flag=true;break;}
		if (ans1[i]>ans2[i]){flag=false;break;}
	}
	if (flag){
		for (register int i=1;i<=cnt1;++i){
			printf("%d ",ans1[i]);
		}
	}
	else {
		for (register int i=1;i<=cnt2;++i){
			printf("%d ",ans2[i]);
		}
	}
}
/*
6
1 2
1 3
1 4
1 5
5 6
*/

Measured memory_bytes: 9464
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		String N = sc.next();

		if (N.charAt(0) == N.charAt(1) && N.charAt(1) == N.charAt(2)
				|| N.charAt(1) == N.charAt(2) && N.charAt(2) == N.charAt(3))
			System.out.println("Yes");
		else
			System.out.println("No");
	}
	//以下、自作ライブラリ

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 23124
#include <stdio.h>

int main(void){

    int A = 0;
    int B = 0;
    int sum = 0;
    int count = 0;

    scanf("%d %d", &A, &B);

    if (B > 1){
        sum += A;
        count++;

        while (sum < B){
            sum += A - 1;
            count++;
        }
    }
    printf("%d\n", count);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define ld long double
    #define oo 0x3f3f3f3f

    int main()
    {
        ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
        string s;
        cin>>s;
        if(s=="RRR")cout<<3;
        else if(s.find("RR")!=-1)cout<<2;
        else if(s.find("R")!=-1)cout<<1;
        else cout<<0;
    }


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

int n, k;
int a[10];
int x[10];

int main(){
	cin >> n >> k;
	for (int i{0}; i < k; i++) cin >> a[i], x[a[i]]++;
	for (int i{n}; i < 100000; i++){
		string s{to_string(i)};
		bool f{false};
		for (char c: s){
			if (x[minus<char>()(c, '0')]){
				f++;
				break;
			}
		}
		if (!f){
			cout << i << endl;
			return 0;
		}
	}
}

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

int main()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("a.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int N, A, B;
    cin >> N >> A >> B;

    if (A*N > B)
    {
        cout << B;
    }
    else
    {
        cout << A*N;
    }

    return 0;
}


Measured memory_bytes: 256
MOD = 10**9+7
n = gets.to_i

if n < 2
  puts 0
else
  all = 1
  ans9 = 1
  ans8 = 1
  for i in 1..n
    all = (all*10) % MOD
    ans9 = (ans9*9) % MOD
    ans8 = (ans8*8) % MOD
  end
  puts (all-ans9-ans9+ans8) % MOD
end

Measured memory_bytes: 14228
#include<cstdio>
using namespace std;
void func(int,int);
int za[91][91];
int m,n;
int cnt,max;
int x,y;
int main(void)
{
	int i,j;
	while(1){
		scanf("%d %d",&m,&n);
		if(m==0 && n==0) break;
		max=-1;
		for(i=0;i<m;i++){
			for(j=0;j<n;j++){
				scanf("%d",&za[i][j]);
			}
		}
		for(i=0;i<m;i++){
			for(j=0;j<n;j++){
				if(za[i][j]==1){ 
					func(i,j);
					cnt=0;
				}
			}
		}
		printf("%d\n",max);
	}
	return 0;
}
void func(int x,int y)
{
	int i,j;
	if(x+1<=m){
		if(za[x+1][y]==1){
			cnt++;
			if(max<cnt) max=cnt;
			za[x+1][y]=0;
			func(x+1,y);
			za[x+1][y]=1;
			cnt--;
		}
	}
	if(x-1>=0){
		if(za[x-1][y]==1){
			cnt++;
			if(max<cnt) max=cnt;
			za[x-1][y]=0;
			func(x-1,y);
			za[x-1][y]=1;
			cnt--;
		}
	}
	if(y+1<=n){
		if(za[x][y+1]==1){
			cnt++;
			if(max<cnt) max=cnt;
			za[x][y+1]=0;
			func(x,y+1);
			za[x][y+1]=1;
			cnt--;
		}
	}
	if(y-1>=0){
		if(za[x][y-1]==1){
			cnt++;
			if(max<cnt) max=cnt;
			za[x][y-1]=0;
			func(x,y-1);
			za[x][y-1]=1;
			cnt--;
		}
	}
}

Measured memory_bytes: 1056
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner scan = new Scanner(System.in);
		
		int k = scan.nextInt();
		int a = scan.nextInt();
		int b = scan.nextInt();
		
		int large = (b / k) * k;
	
		
		
		if(large >= a && large <= b) {
			System.out.println("OK");
		}
		else if(a == b && (k == 1 || k == a)) {
			System.out.println("OK");
		}
		else {
			System.out.println("NG");
		}
		
	}

}


Measured memory_bytes: 35732
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P) 
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int N, M;
int x, y, W, H;
int cx, cy;

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) {
        int res = 0;
        cin >> x >> y >> W >> H;
        cin >> M;
        for (int j = 0; j < M; ++j) {
            cin >> cx >> cy;
            if (x <= cx && cx <= x + H && y <= cy && cy <= y + W) ++res;
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 1156
n = int(input())
for i in range(n):
    a = list(map(int, input().split()))
    if a[0]**2 == a[1]**2 + a[2]**2 or a[1]**2 == a[2]**2 + a[0]**2 or a[2]**2 == a[0]**2 + a[1]**2 :
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 7508
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

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

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            char[] str = in.next().toCharArray();
            Arrays.sort(str);
            if (new String(str).equals("abc")) {
                out.print("Yes");
            } else {
                out.print("No");
            }
        }

    }
}



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

int main(){
    int N, M;
    cin >> N >> M;
    priority_queue<int> que;
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        que.push(a);
    }
    while(M--){
        int a = que.top(); que.pop();
        que.push(a/2);
    }

    int64_t ans = 0;
    while(que.size()){
        int a = que.top(); que.pop();
        ans += a;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 892
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        DecimalFormat df = new DecimalFormat("0.00000000");

        final int N = Integer.parseInt(sc.next());
        final int M = Integer.parseInt(sc.next());
        final int C = Integer.parseInt(sc.next());
        int ans = 0;
        int[] b = new int[M];
        int[][] a = new int[N][M];
        for (int i = 0; i < M; i++) {
            b[i] = Integer.parseInt(sc.next());
        }
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                a[i][j] = Integer.parseInt(sc.next());
            }
        }
        for (int i=0; i<N; i++) {
            long sum = 0;
            for (int j=0; j<M; j++) {
                sum += a[i][j] * b[j];
            }
            if (sum + C > 0) ans++;
        }
        out.println(ans);
        
        out.flush();
    }
}

Measured memory_bytes: 21844
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def main(argv)
  s = InputLine.to_s
  t = InputLine.to_s

  c = 0
  s.size.times do |i|
    c += 1 unless s[i] == t[i]
  end
  puts c.to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 15156
object Main{
  def main(args: Array[String]){
    val input=io.Source.stdin.getLines().mkString("\n")
    println(solve(input).trim())
  }

  def solve(input:String):String={
    val Array(n,k)=input.split("\n").map(_.toInt)
    val tmp1=List.iterate(1,n)(v=>v*2)
    val tmp2=List.fill(n)(k)
    ((tmp1, tmp2).zipped.map(List(_,_).min).sum + 1).toString
  }
}


Measured memory_bytes: 25412
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    s = s.replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "")
    print("YES" if s == "" else "NO")


if __name__ == '__main__':
    slove()


Measured memory_bytes: 39920
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int n;

	bool valid = true;

	scanf("%d", &n);

	for (int i = 0; i < n; i++)
	{
		int input;

		scanf("%d", &input);

		if (!(input % 2) && input % 3 && input % 5)
		{
			valid = false;
		}
	}

	if(valid)
	{
		printf("APPROVED\n");
	}

	else
	{
		printf("DENIED\n");
	}

	return 0;
}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define INF 2000000000000000000LL
#define EPS 1e-9
#define debug(a) cerr<<#a<<"="<<(a)<<"\n"
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL);

typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> cd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll mod = 1e9+7;
const double PI = acos(-1);

int n,i,j,k,t;
int a,b,c;

int main(){
    scanf("%d %d %d", &a, &b, &c);
    if(a+b >= c){
        printf("%d\n", b+c);
    }
    else{
        printf("%d\n", a+b+b+1);
    }
	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

typedef std::vector<std::vector<int>> graph;

int main() {
  int n, m;
  cin >> n >> m;
  graph g(n);
  vi s(n);
  REP(i, n + m - 1) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    s[b]++;
    g[a].push_back(b);
  }
  int root = -1;
  REP(i, n) {
    if (s[i] == 0) {
      root = i;
    }
  }

  vi ans(n);
  ans[root] = 0;

  queue<int> q;
  q.push(root);
  while (!q.empty()) {
    auto u = q.front();
    q.pop();
    for (auto v : g[u]) {
      if (s[v] == 0)
        continue;
      s[v]--;
      if (s[v] == 0) {
        ans[v] = u + 1;
        q.push(v);
      }
    }
  }
  REP(i, n) { cout << ans[i] << endl; }
}


Measured memory_bytes: 7040
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

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

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(c,it) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

int main() {
	map<string, int> m;
	for(string s; getline(cin,s);) {
		rep(i,s.length()) if(s[i] == ',') s[i] = ' ';
		istringstream ss(s);
		int num;
		string blood;
		ss >> num >> blood;

		m[blood]++;
	}
	cout << m["A"] << endl;
	cout << m["B"] << endl;
	cout << m["AB"] << endl;
	cout << m["O"] << endl;
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

vector<int> longestCommonPrefixes(const string& s)
{
    const int n = s.size();
    vector<int> z(n);

    int l = 1;
    fill(z.begin(), z.end(), 0);
    for (int i = 1; i < n; i++) {
        if (l + z[l] > i + z[i - l]) {
            z[i] = z[i - l];
        } else {
            int j = max(0, l + z[l] - i);
            while (i + j < n && s[j] == s[i + j])
                j++;
            z[i] = j;
            l = i;
        }
    }
    z[0] = n;

    return move(z);
}

int main()
{
    int n;
    string s;
    cin >> n >> s;

    int result = 0;
    rep(i, n)
    {
        string t = s.substr(i);
        auto z = longestCommonPrefixes(t);
        rep(j, z.size())
        {
            result = max(result, min((int)j, z[j]));
        }
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

using Graph = vector<vector<int>>;

int main(){
	double r; cin >> r;
	cout << 2 * r * 3.14159265358979 << endl;
}


Measured memory_bytes: 3796
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	counter := 0
	var mountain []int
	for scanner.Scan() {
		i, err := strconv.Atoi(scanner.Text())
		if err != nil {
			break
		}
		mountain = append(mountain, i)
		counter++
		if counter == 10 {
			break
		}

	}
	sort.Ints(mountain)
	fmt.Println(mountain[9])
	fmt.Println(mountain[8])
	fmt.Println(mountain[7])
}



Measured memory_bytes: 1140
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i = 0;i < (n); ++i)
#define all(v) sort(v.begin(),v.end())
#define ALL(v) sort(v.begin(),v.end(),greater<ll>())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    int d,n;
    cin >> d >> n;
    if(d == 0){
        if(n != 100){
            cout << n << endl;
            return 0;
        }else{
            cout << "101" << endl;
            return 0;
        }
    }
    if(d == 1){
        if(n != 100){
            cout << n*100 << endl;
            return 0;
        }else{
            cout << "10100" << endl;
            return 0;
        }  
    }
    if(d == 2){
        if(n != 100){
            cout << n*10000 << endl;
            return 0;
        }else{
            cout << "1010000" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  int A[M];
  int nums[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
  REP(i, M) cin >> A[i];
  int dp[N + 1];
  dp[0] = 0;
  REPS(i, N + 1) {
    int max = -INF;
    int cand = -INF;
    REP(j, M) {
      if (nums[A[j]] <= i) {
        cand = dp[i - nums[A[j]]] + 1;
      }
      if (max < cand) {
        max = cand;
      }
    }
    dp[i] = max;
  }
  string result = "";
  sort(A, A + M, greater<int>());
  int n = N;
  while (n > 0) {
    REP(j, M) {
      if (nums[A[j]] <= n && dp[n - nums[A[j]]] == dp[n] - 1) {
        result.push_back(A[j] + '0');
        n -= nums[A[j]];
        break;
      }
    }
  }

  cout << result << endl;
}

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

int isPrime(int);

int main(){
int count = 0;
int fact,i,n;

scanf("%d", &n);

for(i =0; i < n; i ++){
scanf("%d", &fact);
if(isPrime(fact)) count++;
}

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

int isPrime(int x){
int i;
    if(x == 2){
    return 1;
    }
    if((x < 2) || (x%2 == 0)){
        return 0;
    }
     i = 3;
     while(i <= sqrt(x)){
        if(x%i == 0){
            return 0;
        }
        i = i +2;
      }
      return 1;
}



Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define QOEINDIEDIS freesteed
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
void solve(){
	int n,m;
	cin>>n>>m;
	VI a(n);
	int sum=0;
	rep(i,0,n){
		cin>>a[i];
		sum+=a[i];
	}
	sort(all(a));
	int j=n-1;
	while(j>=n-m){
		if(a[j]<(double)sum/4/m){
			cout<<"No\n";
			return ;
		}
		j--;
	}
	cout<<"Yes\n";
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
enum Query
{
    enqueue = 0,
    front = 1,
    dequeue = 2,
};
int main()
{
    typedef queue<int> ls;

    int n;
    cin >> n;

    vector<ls> Q(n);

    int q;
    cin >> q;

    for (int i = 0; i < q; i++)
    {
        int query, t;
        cin >> query >> t;
        ls &l = Q.at(t);
        if (query == enqueue)
        {
            int x;
            cin >> x;
            l.push(x);
        }
        if (query == front)
        {
            int begin = l.front();
            //空なら何もしない
            if (!l.empty())
            {
                cout << begin << endl;
            }
        }
        if (query == dequeue)
        {
            //空なら何もしない
            if (!l.empty())
            {
                l.pop();
            }
        }
    }
}


Measured memory_bytes: 4300
#include <stdio.h>

int main(void)
{
    int n, m;
    scanf("%d %d", &n, &m);
    int sth[n];
    int sum = 0;
    int count = 0;

    //scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i ++){
        scanf("%d", &sth[i]);
        sum += sth[i];
    }
    
    for (int i = 0; i < n; i++){
        if (sth[i] >= ((float)sum / (4*m)))
            count++;
    }

    if (count >= m)
        printf("Yes");
    else
        printf("No");
    
    return 0;
}

Measured memory_bytes: 128
n = int(input())
s = [input() for i in range(n)]

a = {}

for j in range(n):
    if not(s[j] in a):
        a[s[j]] = 1
    else:
        a[s[j]] += 1

b = 0
for num in a.values():
  if num > b:
    b = num

c = []
for name,num in a.items():
  if num==b:
    c.append(name)

d=sorted(c)

for k in d:
    print(k)

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

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(1)
	n = int(sys.stdin.readline())
	s = 0
	for i in range(1, n+1):
		if i % 3 != 0 and i % 5 != 0:
			s += i
	print(s)
	


main()

Measured memory_bytes: 9952
S = input() [::-1]
ans = 0
mod = 0
ten = 1
count = [0]* 2019
count[0] = 1
for i in range(len(S)):
    mod = (mod + int(S[i]) * ten) % 2019
    ten = ten*10 % 2019
    count[mod] += 1
for c in count:
    ans += c*(c-1)//2
print(ans)

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

using namespace std;

int main(){
  int N,K;
  string S;
  cin>>N>>K>>S;
  N>=K;

  if(S.at(K-1)=='A')
    S.at(K-1)='a';
  else if(S.at(K-1)=='B')
    S.at(K-1)='b';
  else if(S.at(K-1)=='C')
    S.at(K-1)='c';
  
  cout<<S<<endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

long long gcd(long long,long long);
long long lcm(long long,long long);

int main(void){
	int n;
	 long long t[101],ans=0;
	
	cin>>n;
	
	for(int lop=0;lop<101;lop++){
		t[lop]=0;
	}
	
	cin>>ans;
	for(int lop=0;lop<n-1;lop++){
		cin>>t[lop];
		ans=lcm(ans,t[lop]);
	}
	cout<<ans<<endl;
	
	return 0;
}

long long gcd(long long a,long long b){
	long long c;
	if(a<b){
		c=a;
		a=b;
		b=c;
	}
	if(b==0){
		b=1;
	}
	c=a%b;
	
	if(c==0){
		return b;
	}else{
		return gcd(b,c);
	}
	
}

long long lcm(long long a,long long b){
	long long c;
	
	c=gcd(a,b);
	return a/c*b;
}

Measured memory_bytes: 256
n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
mod = 10**9 + 7
c = 0
for i in range(n):
        a = 0
        p = 0
        b = 0
        d = 0
        for j in range(n):
                if i > j:
                        if  A[i] < A[j]:
                                a += 1
                        if A[i] > A[j]:
                                p += 1
                elif j > i:
                        if A[i] > A[j]:
                                b += 1
                        elif A[i] < A[j]:
                                d += 1
        #print(a,d,(k*(k+1)*(a+d)//2 - k * d))
        c += (k*(k+1)*(a+d)//2 - k * d) #- (a * k)
        c %= mod

print(c)


Measured memory_bytes: 43116
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int sosu[66666];
main(){
  for(int i=2;i<=60000;i++){
    if(sosu[i]==1) continue;
    for(int j=i*2;j<=60000;j+=i){
      sosu[j]=1;
    }
  }
   
  int N;
  while(~scanf("%d",&N))
    {
      int i=N-1;
      while(sosu[i]) i--;
      printf("%d ",i);
      i=N+1;
      while(sosu[i]) i++;
      printf("%d\n",i);
    }
}

Measured memory_bytes: 1420
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>

#define llong long long int

using namespace std;

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    double sum = 0;
    int a[101];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum += a[i];
    }

    double av = sum / n;
    int ans;
    double dif = 10000;
    for (int i = n - 1; i >= 0; --i) {
        if (abs(a[i] - av) <= dif) {
            ans = i;
            dif = abs(a[i] - av);
        }
    }

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


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
//
//
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long
#define ll long long
#define ld long double
#define gap ' '
#define endl '\n'
vector<vector<int>> task(100005,vector<int>(4));
int dp[100005][4];
int f(int n,int l) {
	if(n==0) return 0;
	if(dp[n][l]!=-1) return dp[n][l];
	int a=0;
	for(int i=1;i<=3;i++) 
	if(i!=l) a=max(a,f(n-1,i)+task[n][i]);
	return dp[n][l]=a;
}
void solve() {
	int n;
	cin>>n;
	memset(dp,-1,sizeof(dp));
	for(int i=1;i<=n;i++) for(int j=1;j<=3;j++) cin>>task[i][j];
	cout<<f(n,0)<<endl;
}
void solve(bool testcase) {
	int t;cin>>t;while(t--)solve();
}
int32_t main() {
	fio
	solve();
	return 0;
}


Measured memory_bytes: 15360
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll a=0;
    string s,s1;

    cin>>s>>s1;
    for(int i = 0;i < s.size();i++)
    {
        if(s[i]!=s1[i])
        {
            a++;
        }
    }
    cout<<a;

}




Measured memory_bytes: 3808
#include <stdio.h>
#include <stdlib.h>//random,NULL
#include <string.h>
#include <time.h>
#include <unistd.h>//sleep()
#include <math.h>
#include <stdbool.h>

#define rep(i,n) for(int i=0; i<((int)n); i++)
#define REP(i,n) for(int i=0; i<=((int)n); i++)
#define srep(i,a,n) for(int i=a; i<((int)n); i++)
#define SREP(i,a,n) for(int i=a; i<=((int)n); i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)
#define RREP(i,n) for(int i=n; i>=0; i--)
#define INF 1000000000

int main(){
  char buf[1024];
  int N,M;

  fgets(buf,sizeof(buf),stdin);
  sscanf(buf, "%d %d", &N, &M);

  int *L=(int *)malloc(sizeof(int)*M);
  int *R=(int *)malloc(sizeof(int)*M);
  rep(i,M){
    fgets(buf,sizeof(buf),stdin);
    sscanf(buf, "%d %d", &L[i], &R[i]);
  }

  int start=1;
  int end=N;

  rep(i,M){
    if(L[i]>start){
      start=L[i];
    }
    if(R[i]<end){
      end=R[i];
    }
  }

  if(start>end){
    printf("%d\n", 0);
  }
  else{
    printf("%d\n", end-start+1);
  }

  return 0;

}


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

using namespace std;
#define ll long long
int main()
{
    string s;
    cin>>s;
    int q;
    cin>>q;
    int k=1;
    deque<char>v;
    for (int i=0;i<s.length();i++)
        v.push_back(s[i]);
    for (int i=0;i<q;i++)
    {
        int t;
        cin>>t;
        if (t==1)
            k=(k+1)%2;
        else
        {
            int f;
            cin>>f;
            char c;
            cin>>c;
            if (f%2==k)
               v.push_front(c);
            else
                v.push_back(c);
        }
    }
    if (k==0)
    for (int i=v.size()-1;i>=0;i--)
        cout<<v[i];
    else
        for (int i=0;i<v.size();i++)
        cout<<v[i];
    return 0;
}


Measured memory_bytes: 896
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s: Vec<char> = read::<String>().chars().collect();

    let mut ans = 0;
    for i in 0..s.len() {
        let si = s[i];
        if si == '1' {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352