akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
const int INF = INT_MAX;
const int MOD = 1000000007;

bool cmp(pair<int, int> a, int b){
    return a.second < b;
}

int main() {
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    vector<bool> prime(x + 151, true);
    for (int i = 2; i <= x + 150; i++){
        for (int j = 2 * i; j <= x + 150; j += i){
            prime[j] = false;
        }
    }
    while (!prime[x])
        x++;
    cout << x;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    sc.close();
    String[] m = s.split("");
    int cnt = 0;
    if ("1".equals(m[0])) cnt++;
    if ("1".equals(m[1])) cnt++;
    if ("1".equals(m[2])) cnt++;
    System.out.println(cnt);
  }
}

Measured memory_bytes: 35784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define CEIL(a, b) ((a) + (b)-1) / (b)

ll H, W, N;

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

    ll ans = CEIL(N, max(H, W));

    OUT(ans);
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <limits>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-9)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;
const long long inf = 1e12;
long long mymod = 998244353;

long long mypow(long long a, long long b)
{
	long long res = 1;
	while (b)
	{
		if (b % 2 == 1)
			res = (res * a) % mymod;
		a = (a * a) % mymod;
		b /= 2;
	}
	return res;
}
int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
	int n;
	cin >> n;
	map<int, int> cnt;
	int max_elem = 0;
	for (int i = 0; i < n; i++)
	{
		int cur;
		cin >> cur;
		cnt[cur]++;
		max_elem = max(max_elem, cur);
		if (i == 0 && cur != 0)
		{
			cout << 0;
			return 0;
		}
	}
	long long res = 1;
	int prev = 1;
	if (cnt[0] != 1)
	{
		cout << 0;
		return 0;
	}
	for (int i = 1; i <= max_elem; i++)
	{
		if (cnt[i] == 0)
		{
			cout << 0;
			return 0;
		}
		
		res = res * mypow(prev, cnt[i]) % mymod;
		
		prev = cnt[i];
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


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

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 long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<int, int> P;
ll ma = 1000000000 + 7;
ll h, w, n,k,m; string s,t;
char maze[60][60];
int dis[101][101]; int graph[50][50]; bool vis[50];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
int main() {
	cin >> n;
	int res = 0;
	int bcnt = 0; int acnt = 0; int abcnt = 0;
	rep(i, n) {
		string str;
		cin >> str;
		rep(j, str.size()-1) {
			if (str[j] == 'A') {
				if (str[j + 1] == 'B') {
					res++;
				}
			}
		}
		bool flg = true;
		if (str[0] == 'B') {
			bcnt++; flg = false;
		}
		int f = str.size() - 1;
		if (str[f] == 'A') {
			acnt++;
			if (!flg) {
				abcnt++; bcnt--; acnt--;
			}
		}
	}
	if (0 == abcnt) {
		res += min(bcnt, acnt);
	}
	else if(abcnt!=0&&bcnt+acnt>0){
		res +=abcnt+ min(bcnt, acnt);
	}
	else if (bcnt + acnt == 0) {
		res += abcnt - 1;
	}
	cout << res << endl;
}

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

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int MOD = 1000000007;

int main() {
    int N;
    cin>>N;
    int ans;
    long sum = 0;
    long sqSum = 0;
    REP(i, 0, N){
        long j;
        cin >> j;
        sum += j;
        sum %= MOD;
        sqSum += j*j;
        sqSum %= MOD;
    }
    sum *= sum;
    sum %= MOD;
    sum -= sqSum;
    if(sum < 0) sum += MOD;
    if(sum % 2 == 0) ans = sum / 2;
    else ans = (sum + MOD) / 2;
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
using namespace std;
int n, a, b; string S; int p[1000000];
int main() {
	cin >> n >> a >> b >> S;
	int r = 0, s = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'a') {
			if (r + s < a + b) { p[i] = 1; r++; }
		}
		if (S[i] == 'b') {
			if (r + s < a + b && s < b) { p[i] = 1; s++; }
		}
	}
	for (int i = 0; i < S.size(); i++) {
		if (p[i] == 1)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
n=int(input())
def prime_factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f**2<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return(a)
import collections
A=collections.Counter(prime_factorize(n))
ans=0
import math
for v in A.values():
    x=math.floor(v**0.5)
    while x*(x+1)<=v*2:
        x+=1
    ans+=x-1
print(ans)

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

vector<long long> divisor(long long m) {
  vector<long long> items; 
  for(long long i =1;i*i <= m;i++) {
    if(m % i == 0) {
      items.push_back(i);

      if(i*i != m) {
	items.push_back(m / i);
      }
    }
  }
  sort(items.begin(), items.end(), greater<long long>());
  return items;
}

long long partition(long long n, long long m) {
  vector<long long> divisors = divisor(m);
  long long answer = -1;
  for(auto iter = divisors.begin(); iter != divisors.end(); iter++) {
    long long a = *iter;
    if(m >= a * n) {
      answer = a;
      break;
    }
  }
  return answer;
}

int main() {
  long long n, m;
  cin >> n;
  cin >> m;
  cout << partition(n, m);
}


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

int main()
{
    int n, x, y;
    cin >> n >> x >> y;
    --x, --y;

    vector<vector<int>> A(n);
    rep(i, n - 1)
    {
        A[i].emplace_back(i + 1);
        A[i + 1].emplace_back(i);
    }
    A[x].emplace_back(y);
    A[y].emplace_back(x);

    vector<int> ans(n, 0);
    // BFS のためのデータ構造
    for (int i = 0; i < n; ++i)
    {
        vector<int> dist(n, -1);
        queue<int> que;

        // initial state
        dist[i] = 0;
        que.push(i);

        // bfs
        while (!que.empty())
        {
            int v = que.front();
            if (v > i)
                ++ans[dist[v]];
            que.pop();

            for (int nv : A[v])
            {
                if (dist[nv] != -1)
                    continue;

                dist[nv] = dist[v] + 1;
                que.push(nv);
            }
        }
    }

    for (int i = 1; i < n; ++i)
        cout << ans[i] << endl;
}

Measured memory_bytes: 3744
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
      Scanner in = new Scanner(System.in);

      int N = in.nextInt();

      int A = N / 1000;
      N = N % 1000;
      int B = N /100;
      N = N % 100;
      int C = N /10;
      N = N % 10;
      int D = N;

      if(A+B+C+D == 7) {
          System.out.println(A+"+"+B+"+"+C+"+"+D+"=7");
      }
      else if(A+B+C-D == 7) {
          System.out.println(A+"+"+B+"+"+C+"-"+D+"=7");
      }
      else if(A+B-C-D == 7) {
          System.out.println(A+"+"+B+"-"+C+"-"+D+"=7");
      }
      else if(A-B-C-D == 7) {
          System.out.println(A+"-"+B+"-"+C+"-"+D+"=7");
      }
      else if(A+B-C+D == 7) {
          System.out.println(A+"+"+B+"-"+C+"+"+D+"=7");
      }
      else if(A-B-C+D == 7) {
          System.out.println(A+"-"+B+"-"+C+"+"+D+"=7");
      }
      else if(A-B+C+D == 7) {
          System.out.println(A+"-"+B+"+"+C+"+"+D+"=7");
      }
      else {
          System.out.println(A+"-"+B+"+"+C+"-"+D+"=7");
      }

    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <vector>
using namespace std;

vector<int> G[100];
pair<int, int> T[100];
const int Inf = 10000*100000+100;
int timer = 1;

int main() {
  void dfs(int cur);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    int u, k;
    cin >> u >> k;
    for (int l = 0; l < k; l++) {
      int v;
      cin >> v;
      G[i].push_back(v - 1);
    }
    T[i] = make_pair(Inf, Inf);
  }
  for (int i = 0; i < n; i++) {
    if (T[i].first == Inf) {
      dfs(i);
    }
  }
  for (int i = 0; i < n; i++)
  {
    cout << i + 1 << " " << T[i].first << " " << T[i].second << endl;
  }
}

void dfs(int cur) { // cur を訪問
  // cur の訪問時刻を記録
  T[cur].first = timer;
  timer += 1;
  // 動作確認用表示
  for (int dst : G[cur]) { // 全ての節点 dst について
    if (T[dst].first == Inf)
    { // cur から dst に辺があり，dst を未訪問なら
      dfs(dst);
    }
  }
  T[cur].second = timer;
  timer += 1;
}


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

int n, ma, mb, a[50], b[50], c[50], inf = 1e9 + 7, Ma, Mb;
int dp[50][444][444]; //dp[i][j][k] i番目まででj[g],k[g]となる最小費用

int main()
{
    cin >> n >> ma >> mb;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i] >> b[i] >> c[i];
        Ma = max(a[i], Ma);
        Mb = max(b[i], Mb);
    }
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= n * Ma; j++)
        {
            for (int k = 0; k <= n * Mb; k++)
            {
                dp[i][j][k] = inf;
            }
        }
    }

    dp[0][0][0] = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= n * Ma; j++)
        {
            for (int k = 0; k <= n * Mb; k++)
            {
                if (dp[i][j][k] == inf)
                    continue;
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
                dp[i + 1][j + a[i]][k + b[i]] = min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
            }
        }
    }
    int ans = inf;
    for (int i = 1; i <= n * Ma; i++)
    {
        for (int j = 1; j <= n * Mb; j++)
        {
            if (i * mb == j * ma)
                ans = min(ans, dp[n][i][j]);
        }
    }
    if (ans == inf)
        ans = -1;
    cout << ans << endl;
}

Measured memory_bytes: 32896
#include <iostream>
#include <string>
using namespace std;
int main(){
	string S;
  	cin >> S;
  int count[4] = {0,0,0,0};
  	for(int i=0;i<4;i++){
      if(S[i]==S[0])count[0]++;
      if(S[i]==S[1])count[1]++;
      if(S[i]==S[2])count[2]++;
      if(S[i]==S[3])count[3]++;
    }
  bool flag = false;
  for(int i=0;i<4;i++){
  	if(count[i]!=2)flag = true;
  }
  if(flag){cout << "No"<<"\n";}else{cout << "Yes"<<"\n";}
  //cout <<count[0]<<count[1]<<count[2]<<count[3]<<"\n";
  return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
f = lambda x : int(x) - 1
p = list(map(f,input().split()))
par = [i for i in range(n)]

def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]

def unite(x,y):
    if root(x) == root(y):
        return
    else:
        par[root(x)] = root(y)

for i in range(m):
    x,y = map(f,input().split())
    unite(x,y)

ans = 0
for i in range(n):
    if root(i) == root(p[i]): ans += 1

print(ans)

Measured memory_bytes: 14008
n = int(input())
if n == 1:
    print('Hello World')
elif n == 2:
    a = int(input())
    b = int(input())
    if 1 <= a <= 9 and 1 <= b <= 9:
        print(a + b)
    else:
        print('hoge!')
else:
    print('hoge!')

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

int main() {
  int n;
  cin >> n;
  vector<string> s(10);
  s[0] = "pon";
  s[1] = "pon";
  s[2] = "hon";
  s[3] = "bon";
  s[4] = "hon";
  s[5] = "hon";
  s[6] = "pon";
  s[7] = "hon";
  s[8] = "pon";
  s[9] = "hon";
  cout << s[n%10] << endl;
  return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,K;
    cin>>n>>K;
    int k[40];
    for(int i=39;i>=0;i--){
        if(K%2)k[i]=1;
        else k[i]=0;
        K/=2;
    }
    long long sum=0;
    long long a[n];
    long long one[40]={};
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
        for(int j=0;j<40;j++){
            if(a[i]%2)one[j]++;
            a[i]/=2;
        }
    }
    long long w=1,v[40];
    for(int i=0;i<40;i++){
        v[i]=max(0ll,n-one[i]*2)*w;
        w*=2;
    }
    vector<vector<long long>>dp(41,vector<long long>(2,-1000000000000000000));
    dp[0][1]=0;
    for(int i=0;i<40;i++){
        dp[i+1][0]=dp[i][0]+v[39-i];
        if(k[i]){
            dp[i+1][1]=dp[i][1]+v[39-i];
            dp[i+1][0]=max(dp[i+1][0],dp[i][1]);
        }
        else dp[i+1][1]=dp[i][1];
    }
    cout<<max(dp[40][0],dp[40][1])+sum<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;

const int mxn=2e5+1;

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

  int t=1;
//  cin>>t;
  int tt=1;
  while(t--){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=b-a+1;
    ans-=(b/c-(a-1)/c);
    ans-=(b/d-(a-1)/d);
    ll lcm=(c*d)/__gcd(c,d);
   // cout<<lcm<<" ";
    ans+=(b/lcm-(a-1)/lcm);
    cout<<ans;
   // cout<<"Case #"<<tt<<": ";
   // tt++;
    }
  return 0;
}



Measured memory_bytes: 256
n, k, q = map(int, input().split())
l = [int(input())-1 for _ in range(q)]
l.sort()

for i in range(n):
  cnt = 0
  if l and l[0] == i:
    while l and l[0] == i:
      l.pop(0)
      cnt += 1
  print(('No','Yes')[k > q - cnt])

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

int main() {
     
     long long n,h,i,j,t,m,l,r,q;
     long long p=0,k,w,z,x,y,d,p1,h1;
     string s="",st="",s1="",s2="";
     q=1;
     for(l=0;l<q;l++)
     {
          std::cin >> s;
          n=s.length();
          p=0;
          for(i=n-1;i>=0;i--)
               p=p+(s[i]-48);
          if(p%9==0)
               std::cout << "Yes" << std::endl;
          else
               std::cout << "No" << std::endl;
     }
     return 0;
}

Measured memory_bytes: 3732
def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0
    cnt = 0
    minimum = float("inf")
    for i in range(N):
        ans += abs(A[i])
        minimum = min(minimum, abs(A[i]))
        if A[i] < 0:
            cnt += 1
    if cnt % 2 == 1:
        ans -= minimum * 2
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 64752
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;

bool is_prime(ll v) {
    for (ll i = 2; i * i <= v; ++i) {
        if (v % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X;
    cin >> X;
    while (!is_prime(X)) ++X;
    cout << X << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int n,k;
ll cnt[100001];
const int mod=1000000007;
ll modpow(ll x,ll n,ll mod){
    ll res=1;
    while(n>0){if(n&1) res=res*x%mod;x=x*x%mod;n>>=1;}
    return res;
}
int main(){
    cin>>n>>k;
    ll ans=0;
    for(int i=k;i>=1;--i){
        ll cur=modpow(k/i,n,mod);
        for(int j=2*i;j<=k;j+=i){
            cur=cur+mod-cnt[j];
            cur%=mod;
        }
        cnt[i]=cur;
        cur*=i;cur%=mod;
        ans+=cur;ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4344
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int sum = 0;
	string s;
	vector<pair<int,int>> a;
	
	cin>>s;
	
	for(int i = 0; i < s.size(); i++){
		int z = s[i] == '>';
		if(a.size() == 0) a.push_back(make_pair(z,1));
		else if(a.back().first == z)a.back().second++;
		else a.push_back(make_pair(z,1));
	}
	
	for(int i = 0; i < a.size(); i++){
		if(i == 0 && i == a.size()-1){
			sum += a[i].second*(a[i].second+1)/2;
		} else if(i == 0){
			if(a[i].first == 1){
				sum += a[i].second*(a[i].second+1)/2;
			} else {
				sum += a[i].second*(a[i].second-1)/2;
				sum += max(a[i].second,  a[i+1].second);
			}
		} else if(i == a.size()-1){
			if(a[i].first == 0){
				sum += a[i].second*(a[i].second+1)/2;
			} else {
				sum += a[i].second*(a[i].second-1)/2;
			}
			
		} else {
			if(a[i].first == 1){
				sum += a[i].second*(a[i].second-1)/2;
			} else {
				sum += a[i].second*(a[i].second-1)/2;
				sum += max(a[i].second,  a[i+1].second);
			}
		}
	}
	
	cout<<sum<<endl;
	
	return 0;
}

Measured memory_bytes: 6292
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
int main() {
	char str[100001], *s;
	scanf("%s", str);
	int len = strlen(str);
	s = str;
	while(*s) {
		if (strncmp(s, "dreamere", 8) == 0 || strncmp(s, "dreamerd", 8) == 0
			|| s - str == len - 7 && strncmp(s, "dreamer", 7) == 0) {
			s += 7;
		}
		else if (strncmp(s, "dream", 5) == 0) {
			s += 5;
		}
		else if (strncmp(s, "eraser", 6) == 0) {
			s += 6;
		}
		else if (strncmp(s, "erase", 5) == 0) {
			s += 5;
		}
		else {
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define sort(vec) sort(vec.begin(),vec.end())
#define reverse(vec) reverse(vec.begin(),vec.end())
int gcd(int x,int y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}
int n,x,p,ans=0;
vector<int>a;
signed main(){
    cin>>n>>x;
    rep(i,n){
        cin>>p;
        a.push_back(p);
    }
    sort(a);
    for(int i=0;i<n;i++){
        if(x>=a[i]&&i!=n-1){
            x-=a[i];
            ans++;
        }
        else if(x==a[i]&&i==n-1){
            ans++;
        }
        else break;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>


int main(void) {
    int N, n, i, b, top[2], possible;

    scanf("%d", &N);

    for (n = 0; n < N; n++) {
        top[0] = top[1] = 0;
        for (i = 0, possible = 1; i < 10; i++) {
            scanf("%d", &b);
            if (top[0] < b) {
                top[0] = b;
                continue;
            }
            else if (top[1] < b) {
                top[1] = b;
                continue;
            }
            possible = 0;
        }
        if (possible) {
            puts("YES");
        }
        else {
            puts("NO");
        }
    }
    return 0;
}

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

int main(){
    int n , k , temp;
    cin >> n >> k;
    vector<int> l;
    for(int i = 0; i < n; i++){
        cin >> temp;
        l.push_back(temp);
    }
    sort(l.begin(),l.end());
    int ans = 0;
    for(int i = n-1; i >= n - k; i--){
        ans += l[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
M=10**9+7;*I=r=j=x=1;eval"N,*Z="+`dd`.split*?,;Z.map{|k|x=$*[k]||x+1;$*[k]=$.+=1}.map{|i|I<<s=i<2?1:M/i*-I[M%i];p (-j+r=r*(N+2-i)*s%M)%M;j=j*(x-i)*s%M}

Measured memory_bytes: 46432
s = input()
n = len(s)
zero = ""
one = ""
for i in range(n):
  if i%2 == 0:
    zero += "0"
    one += "1"
  else:
    zero += "1"
    one += "0"
z = 0
o = 0
for i in range(n):
  tmp = s[i]
  if tmp != zero[i]:
    z += 1
  if tmp != one[i]:
    o += 1
if z < o:
  print(z)
else:
  print(o)


Measured memory_bytes: 3316
import sys
n = int(sys.stdin.readline())
B = list(map(int, input().split()))

A =[1000001 for i in range(n)]
for i in range(n-1):
    if A[i] > B[i]:
        A[i] = B[i]
    if A[i+1] > B[i]:
        A[i+1] = B[i]

print(sum(A))

Measured memory_bytes: 3060
def solve(balls):
    B,C=balls[0],0
    for ball in balls[1:]:
        if B<ball:
            B=ball
        else:
            if C<ball:
                C=ball
            else:
                return "NO"
    return "YES"

if __name__=='__main__':
    N=int(raw_input())
    for i in range(N):
        balls=map(int,raw_input().split())
        print solve(balls)

Measured memory_bytes: 4228
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include <iomanip>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int N;
  cin>>N;
  cout<<cei(N,2)-1;
return 0;}

Measured memory_bytes: 3540
import java.util.*;

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();

        if(a < b){
            if(b < c)   System.out.println("Yes");
            else    System.out.println("No");
        }
        else    System.out.println("No");
    }
}


Measured memory_bytes: 26208
N = int(input())
A = list(map(int,input().split()))
ans = 10**15

for s in [1,-1]:
  cos = 0
  tot = 0
  
  for a in A:
    tot+=a
    if s*tot<=0:
      cos+=abs(tot-s)
      tot=s
    s*=-1
  
  ans=min(ans,cos)

print(ans)

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

int main()
{
    int k, x;
    cin >> k >> x;

    int LimitMin = -1000000;
    int LimitMax = 1000000;

    LimitMin = max(LimitMin, x - k + 1);
    LimitMax = min(x + k - 1, LimitMax);

    for(int i=LimitMin; i<=LimitMax; i++)
        cout << i << " ";

    cout << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		for (int i = 1; i <= n; i++) {
			if (i % 3 == 0) {
				System.out.printf(" %d", i);
				continue;
			}
			int x = i;
			while (x > 0) {
				if (x % 10 == 3) {
					System.out.printf(" %d", i);
					break;
				}
				x /= 10;
			}
		}
		System.out.println();
	}
}

Measured memory_bytes: 38888
#include<iostream>
#include<iomanip>
#include<cmath>

using namespace std;

int main(){
  double a,b,C,c,S,r,h;
  cout<<fixed<<setprecision(6);
  cin>>a>>b>>C;
  //c=sqrt(pow(a,2.0)+pow(b,2.0)-2*a*b*cos(C*3.141593/180));
  // S=sin(C*3.141593/180)*a*b/2;
  //r=a+b+c;
  //h=2*S/a;
  cout<<sin(C*acos(-1)/180)*a*b/2<<endl<<
  a+b+sqrt(pow(a,2.000000)+pow(b,2.000000)-2*a*b*cos(C*acos(-1)/180))<<endl
  <<2*sin(C*acos(-1)/180)*a*b/2/a<<endl;
  return 0;
}



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

int main()
{
  int n;
  cin >> n;
  vector<string> s(n);
  vector<int> p(n);
  vector<int> num(n);
  int i;
  for(i = 0; i < n; i++)
  {
    cin >> s.at(i) >> p.at(i);
    num.at(i) = i;
  }
  vector<pair<pair<string, int>, int> > pairs(n);
  for(i = 0; i < n; i++)
  {
    pairs.at(i) = make_pair(make_pair(s.at(i), p.at(i)*(-1)), num.at(i));
  }
  sort(pairs.begin(), pairs.end());
  for(i = 0; i < n; i++)
  {
    cout << pairs.at(i).second+1 << endl;
  }
}

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

constexpr int MAX_N = 100000;

int main() {
  int N;
  cin >> N;
  vector<int> A;
  for (int i{0}; i < N; ++i) {
    int a;
    cin >> a;
    A.push_back(a);
  }
  int ans{};
  while (true) {
    sort(A.begin(), A.end());
    while (A[0] == 0) {
      A.erase(A.begin());
    }
    for (int i{1}; i < N; ++i) {
      A[i] %= A[0];
    }
    ans = 0;
    for (int i{}; i < N; ++i) {
      if (A[i] > 0) {
        if (ans > 0)
          goto NEXT;
        ans = A[i];
      }
    }
    break;
    NEXT:;
  }

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


Measured memory_bytes: 1272
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
#define ar array
using namespace std;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int m, n, a[1000], sum=0, sume=0;
	cin >> n >> m;
	for(int i=0;i<n;i++) {
		cin >> a[i];
		sum+=a[i];
	}
	double frac=ceil(sum/(4*m));
	for(int i=0;i<n;i++) {
		if(4*m*a[i]>=sum) {
			sume++;
		}
		else {
			sume+=0;
		}
	}
	if(sume>=m) {
		cout << "Yes";
	}else {
		cout << "No";
	}
}



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


#define ALL(a) 		(a.begin() , a.end())
#define ll 			long long int
#define ff          first
#define ss          second
#define pb          push_back
#define ar 			array
#define mp 			make_pair
#define f(i,a,b)   	for(ll i =a;i<=b;i++)
#define inf 		INT_MAX
#define pll 		pair<ll,ll>
#define mat 		vector<vector<ll>>
/*
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define deb(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 //debug & operator << (debug & dd, P p) { dd << "(" << p.x << ", " << p.y << ")"; return dd; }

 */
 

//const ll INF = 1e18;
void init(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE 
		freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#endif
}
 
bool checkp2(ll n){
	return n && !(n & (n-1));
}

ll numsetbit(ll n){
	ll count = 0;
	for(;n;count++){
		n = n & (n-1);
	}
	return count;
}
 
ll power(ll x , ll n , ll mod){
    x = x % mod;
	ll po = 1;
	while(n){
		if(n & 1){
			po = (po*x) % mod;
		}
		n = n>>1;
		x = ((x % mod) * (x % mod)) % mod;
	}
	return po;
}
 
bool isPrime(ll x){
	if(x < 2)
		return 0;
	for(ll y = 2; y * y <= x; y++){
		if(x % y == 0){
			return 0;
		}
	}
	return true;
}

const ll mxn = 2e5 + 10 , mxm = 2e5 + 10;
vector<ll> adj[mxn+10];
bool vis[mxn + 10];

ll dfs(ll u){

	ll ans = 1;
	vis[u] = 1;
	for(ll v : adj[u]){

		if(!vis[v]){
			//vis[v] = 1;
			ll temp = dfs(v);
			ans += temp;
		}
	}
	//cout<<ans<<endl;
	return ans;

}

void solve(){

		ll n , m;
		cin>>n>>m;
		memset(vis , 0, sizeof(vis));
		for(ll i = 0;i<m;i++){
			ll u , v;
			cin>>u>>v , --u,--v;
			adj[u].pb(v);
			adj[v].pb(u);
		}

		ll answer = -1;
		//vis[0] = 1;
		for(ll i = 0;i<n;i++){
			if(!vis[i]){
				ll temp = dfs(i);
				//cout<<temp<<endl;
				answer = max(answer , temp);
				//cout<<temp<<endl;
			}
		}
		cout<<answer<<endl;


}

int main(){
	
	init();
	ll t = 1;
	//cin>>t;
	for(ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
		//cout<<"solve\n";
		solve();
	}
}

Measured memory_bytes: 24056
// i_am_arin

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<string> vs;


#define f(i, a, n) for(ll i=a; i<(ll)n; i++)
#define f2(i, a, b) for(ll i=a; i<=(ll)b; i++)
#define PB push_back
#define FF first
#define SS second
const ll MOD = 1e9+7;
const ll INF = LLONG_MAX;

void solve(){
ll n,w;
cin>>n>>w;
ll dp[w+1]={0};
f(i,0,n){
	ll weight,value;
	cin>>weight>>value;
	for(ll j=w-weight;j>=0;j--){
		dp[j+weight]=max(dp[j]+value,dp[j+weight]);
	}
	//f(j,0,w+1) cout<<dp[j]<<" ";
	//cout<<endl;
}
ll ans=0;
f(i,0,w+1) ans=max(ans,dp[i]);
cout<<ans<<endl;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int A, B, C, D;
  cin>>A>>B>>C>>D;
  int ans = 0;
  for(int i=0;i<=105;++i) {
    if(A<=i && i<B && C<=i && i<D) ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
 
using namespace std;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<long long , long long>
#define pb push_back
#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;}
const ll mod = 1e9 + 7;
 
int run_test(){
    string s;
    cin >> s;
    int count = 0, ans = 0;
    for(int i=0; i<s.length(); i++){
        if(s[i] == 'R'){
            count++;
        } 
        else{
            ans = max(ans, count);
            count = 0;
        }
    }
    ans = max(ans, count);
    cout << ans;
    return 0;
}
 
int main(){
    FAST;
    ll t;
    t = 1;
 
    while(t--){
        run_test();
    }
}

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

int main() {
    int N;
    int r, l;
    int ans = 0;
    cin >> N;
    rep(i, N) {
        cin >> r >> l;
        rep2(i, r, l + 1) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N,K;
    cin >>N>>K;
    map<int,int> m;
    rep(i,K){
        int d;
        cin>>d;
        rep(i,d){
            int a;
            cin>>a;
            m[a]++;
        }
    }
    int cou=0;
    for(auto p:m){
        cou++;
    }
    cout << N-cou << endl;




}


Measured memory_bytes: 3648
n = int(input())
ss = [input() for _ in range(n + 1)]
sp = [[s[0]] for s in ss]
for i, s in enumerate(ss):
    for j in range(1, len(s)):
        if s[j - 1].isdigit() != s[j].isdigit():
            sp[i].append('')
        sp[i][-1] += s[j]
s0 = sp[0]
for s in sp[1:]:
    p = 0
    m = min(len(s0), len(s))
    while p < m and s0[p] == s[p]:
        p += 1
    if p == m:
        print('-+'[len(s0) <= len(s)])
        continue
    a = s0[p].isdigit()
    b = s[p].isdigit()
    if a and b:
        print('-+'[int(s0[p]) <= int(s[p])])
    elif a or b:
        print('-+'[a])
    else:
        print('-+'[s0[p] <= s[p]])



Measured memory_bytes: 5988
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 1000000007
int main()
{
ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  //freopen("input.txt","r",stdin);
#endif

  ll n,k;
  cin>>n>>k;
  vector<ll> v(n+1);
  v[0]=1;
  ll p=2;
  for(int i=1;i<=n;i++)
  {
    v[i]=p+v[i-1];
    p++;
  }

  ll count=0;
  for(int i=k;i<=n;i++)
  {
    ll sum1=v[i-1];
    ll sum2=v[n]-v[n-i];
    ll t=sum2-sum1+1;
    count=(count+t)%N;
  }

  count=(count+1)%N;
  cout<<count<<endl;

  return 0;
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int n;
    cin>>n;
    long long int ans=0;
    rep(i,n+1){
        ans+=i;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <queue>

using namespace std;
typedef long long ll;

int main(){
    ll A,B,C;
    cin>>A>>B>>C;
    ll ans = 0;
    ans += B;
    ans += min(C,A+B+1);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
  var X, Y int
  fmt.Scanf("%d %d", &X, &Y)
  
  if Y%2 == 1 {
    fmt.Println("No")
    return
  }
  
  if Y < X*2 {
    fmt.Println("No")
    return
  }
  
  if X*4 < Y {
    fmt.Println("No")
    return
  }
  
  fmt.Println("Yes")
}

Measured memory_bytes: 1816
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++){
        int x = i;
        if (x % 3 == 0){
            cout << " " << i;
        }
        else{
            while (x){
                if (x % 10 == 3){
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }
        }
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3100
/**
 * author: BueVonHun 🐼🎋
 * More Info: https://github.com/Bue-von-hon
**/

#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <cstring>
#include <cmath>

typedef long long ll;
using namespace std;

#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl '\n'
#define m_p make_pair
#define pii pair<int,int>
#define piii pair<int,pii>
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

template <class T> T _min(T a,T b){return (a<b ? a : b);}
template <class T> T _max(T a,T b){return (a>b ? a : b);}
template<class T> void read(T& x) {cin >> x;}

int test_case;
int main(void) {
    fast_cin();

    read(test_case);

    if (test_case>=30)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  
  char turn = 'a';
  bool fin = true;
  char ans;
  while(fin){
    if(turn == 'a'){
      if(a.size() == 0){
        ans = 'A';
        fin = false;
      }
      else{
        turn = a.at(0);
        a.erase(0, 1);
      }
    }
    if(turn == 'b'){
      if(b.size() == 0){
        ans = 'B';
        fin = false;
      }
      else{
        turn = b.at(0);
        b.erase(0, 1);
      }
    }
    if(turn == 'c'){
      if(c.size() == 0){
        ans = 'C';
        fin = false;
      }
      else{
        turn = c.at(0);
        c.erase(0, 1);
      }
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
import math
import numpy as np

# tはラジアン
def rot_rev(t, v):
    R = np.array([[ np.cos(t), np.sin(t)],
                  [-np.sin(t), np.cos(t)]])
    return np.dot(R, v)

A, B, H, M = map(int, input().split())

# h時m分を 60*h + m 分に換算し、割合を計算
H_rad = ((H * 60 + M) / (12 * 60)) * 2 * np.pi
M_rad = (M / 60) * 2 * np.pi

P_A = (0, A)
P_B = (0, B)

rot_A = rot_rev(H_rad, P_A)
rot_B = rot_rev(M_rad, P_B)

print(np.linalg.norm(rot_A - rot_B))


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

int main() {
	int h, w;
	cin >> h >> w;
	vector<string> x(h);
	vector<bool> row(h, false);
	vector<bool> col(w, false);

	for (int i = 0; i < h; i++)
		cin >> x[i];

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (x[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		if(row[i]){
			for (int j = 0; j < w; j++) {
				if(col[j])
					cout << x[i][j];
			}
			cout << endl;
		}
	}
}


Measured memory_bytes: 256
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        d: usize,
        t: usize,
        s: usize,
    }

    if d<= t*s {
        println!("Yes");
    } else {
        println!("No");
    }

}


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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

template <typename T>
inline void chkmax(T &x, T y) { if (x < y) x = y; }

template <typename T>
inline void chkmin(T &x, T y) { if (x > y) x = y; }

inline int read() {
  #define nc getchar()
  int x = 0;
  char c = nc;
  while (c < 48) c = nc;
  while (c > 47) x = x * 10 + (c ^ 48), c = nc;
  return x;
  #undef nc
}

typedef long long ll;

int main() {
  double x;
  cin >> x;
  double tmp = acos(-1);
  cout << 2.0 * tmp * x << endl;
  return 0;
}

Measured memory_bytes: 3784
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

void Init() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	struct Init_caller { Init_caller() { Init(); } }caller;
}

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using ppi = pair<pi, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
using vppi = vector<ppi>;

#pragma endregion

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}

#pragma endregion 


/*****************************************************************************/
signed main(void) {
	int n;
	cin >> n;
	vi dp(n + 1, ll_INF);
	dp[0] = 0;
	f(i, 0, n) {
		f(j, 0, 7) {
			if (i + pow(9, j) <= n)dp[i + pow(9, j)] = min(dp[i + pow(9, j)], dp[i] + 1);
			if (i + pow(6, j) <= n)dp[i + pow(6, j)] = min(dp[i + pow(6, j)], dp[i] + 1);
			dp[i + 1] = min(dp[i + 1], dp[i] + 1);
		}
	}
	cout << dp[n];
	return 0;
}

Measured memory_bytes: 1024
from bisect import bisect_left,bisect
n = int(input())
a = sorted(list(map(int,input().split())))
b = list(map(int,input().split()))
c = sorted(list(map(int,input().split())))
ans = 0
for i in b:
    ans += bisect_left(a,i)*(n- bisect(c,i))
print(ans)

Measured memory_bytes: 23968
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define clr clear()
#define sqr(a) (a*a)
#define mk make_pair
#define pb push_back
string en="\n";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
#define srch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,c=0;
    while(cin>>n)
    {
            x=n/2;
            if(n%2) x++;
            double d=(x*1.0)/n;
            cout<<fixed<<setprecision(8)<<d<<en;

    }
}



Measured memory_bytes: 256
n,k = map(int,input().split())
ret = 0
for b in range(1, n+1):
    if b<k+1:
        continue
    else:
        m = n//b
        l = n%b
        ret += (b-k)*m
        if k!=0 and l>=k:
            ret += l-k+1
        elif k==0:
            ret += l
print(ret)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define mst(a,b) memset(a,b,sizeof(a))
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define eps 1e-3
inline int lowbit(int x){ return x & -x; }
const int N = 1e6 + 10;
const int mod = (int) 1e9 +7;
const int INF = 0x3f3f3f3f;
const long long LINF = (1LL << 62);
typedef long long LL;
typedef unsigned long long ULL;
const double PI = acos(-1.0);
using namespace std;

char buf[100000],*p1=buf,*p2=buf;
inline char nc(){
  return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline bool read(int & x){
  char c=nc();x=0;
  if(c==EOF) return false;
  bool flag = false;
  for(;!isdigit(c);c=nc()) flag = true;
  for(;isdigit(c);x=x*10+c-'0',c=nc());
  if(flag) x *= -1;
  return true;
}
inline bool readL(LL & x){
  char c=nc();x=0;
  if(c==EOF) return false;
  bool flag = false;
  for(;!isdigit(c);c=nc()) flag = true;
  for(;isdigit(c);x=x*10+c-'0',c=nc());
  if(flag) x *= -1;
  return true;
}



int main(){
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
//    freopen("out.txt","w",stdout);
#endif
//  printf("%d", 2147483647 >> 30);
  int A, B;
  scanf("%d%d", &A, &B);
  if(A * B % 2) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {

	int H,W;
	int i,n,m;

	while (1) {

                cin>>H>>W;

		if (H == 0 && W == 0) break;

		for (n = 0; n < H; n++) {

			for (m = 0; m < W; m++) {
				cout << "#";
			}

			cout << endl;

		}

		cout << endl;

	}
	return 0;
}

Measured memory_bytes: 3048
while True:
    s = raw_input()

    left = "qwertasdfgzxcvb"
    right = "yuiophjklnm"

    if s == "#":
        break

    p = ""
    ans = 0

    for i in range(len(s)):
        if i == 0:
            if s[i] in left:
                p = "left"
            else:
                p = "right"
        elif p == "left" and s[i] in right:
            ans += 1
            p = "right"
        elif p == "right" and s[i] in left:
            ans += 1
            p = "left"

    print ans



Measured memory_bytes: 4652
a,b,c = gets.split.map(&:to_i)
x = [0, ((a**0.5 * b**0.5)).to_i - 10].max
x *= 2
while x ** 2 <= 4 * a * b
  x += 1
end
x -= 1
puts a + b + x < c ? "Yes" : "No"


Measured memory_bytes: 1788