akhauriyash/Code-Regression huggingface dataset:
Sd = input()
T = input()

S_l = len(Sd)
T_l = len(T)

ans_list = []

for i in range(S_l-T_l+1):
    flag = 0
    for j in range(T_l):
        if Sd[i+j] != '?':
            if Sd[i+j] != T[j]:
                flag = 1
                break

    if flag == 0:
        ans = Sd[:i] + T + Sd[i+T_l:]
        ans_list.append(ans.replace('?', 'a'))

if len(ans_list) == 0:
    print('UNRESTORABLE')
else:
    print(sorted(ans_list)[0])


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cmath>

template <typename T>
T gcd(T x, T y)
{
	return y == 0 ? x : gcd(y, x % y);
}

template <typename T>
std::vector<T> EratosthenesSieve(T n)
{
	std::vector<bool> sieve(n + 1, 1);	
	const T sqrt_n = static_cast<T>(std::sqrt(n));
	for (T i = 2; i <= sqrt_n; ++i)
	{
		if (sieve.at(i) == 1)
		{
			for (T j = i * 2; j <= n; j += i)
			{
				sieve.at(j) = 0;
			}
		}
	}

	std::vector<T> prime_numbers;
	for (T i = 2; i <= n; ++i)
	{
		if (sieve.at(i) == 1)
		{
			prime_numbers.push_back(i);
		}
	}

	return std::move(prime_numbers);
}

template <typename T>
std::vector<std::pair<T, int>> primeFactorizationWithEratosthenesSieve(T n)
{
	std::vector<std::pair<T, int>> answer;

	std::vector<T> prime_numbers = EratosthenesSieve(static_cast<T>(std::sqrt(n)));
	for (T prime_number : prime_numbers)
	{
		if (prime_number * prime_number > n)
		{
			break;
		}

		if (n % prime_number != 0)
		{
			continue;
		}

		answer.emplace_back(prime_number, 0);
		do
		{
			n /= prime_number;
			answer.back().second++;
		} while (n % prime_number == 0);
	}

	if (n != 1)
	{
		answer.emplace_back(n, 1);
	}

	return std::move(answer);
}

int main()
{
	long long A, B;
	std::cin >> A >> B;

	auto g = gcd(A, B);
	auto pf = primeFactorizationWithEratosthenesSieve(g);

	std::cout << pf.size() + 1;

	return 0;
}

Measured memory_bytes: 1528
#include <bits/stdc++.h>
using i64 = long long;

i64 dp[55][55][2505];

int main() {
    constexpr i64 mod = 1000000007;
    int n, k;
    std::cin >> n >> k;

    dp[0][0][0] = 1;

    for (int t = 0; t <= k; t++) {
        for (int i = 1; i <= n; i++) for (int j = 0; 2 * j <= t && j <= i; j++) {
            dp[i][j][t] = (dp[i][j][t] + (2 * j + 1) * dp[i - 1][j][t - 2 * j] % mod) % mod;
            if (j + 1 <= i - 1) dp[i][j][t] = (dp[i][j][t] + (j + 1) * (j + 1) * dp[i - 1][j + 1][t - 2 * j] % mod) % mod;
            if (j > 0) dp[i][j][t] = (dp[i][j][t] + dp[i - 1][j - 1][t - 2 * j]) % mod;
        }
    }

    std::cout << dp[n][0][k] << std::endl;

    return 0;
}


Measured memory_bytes: 53504
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
  int N,T,A;
  cin >> N >> T >> A;
  int H[1100];
  int i = 0;
  while (i < N){
    cin >> H[i];
    i++;
  }
  i = 0;
  double K[1100];
  for(int j = 0; j < N; j++){
    K[j] = A - (T- H[j]*0.006);
    K[j] = abs(K[j]);
    if(K[0] >= K[j]){
      K[0] = K[j];
      i = j + 1;
    }
  }
  cout << i << endl; 
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int N,tmp1,tmp2;
	scanf("%d", &N);
	tmp1 = N % 10; N /= 10;
	tmp2 = N % 10;
	if (tmp1 == 9 || tmp2 == 9) {
		printf("Yes");
	}
	else {
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        switch (s) {
        case "Sunny":
            System.out.println("Cloudy");
            break;
        case "Cloudy":
            System.out.println("Rainy");
            break;
        case "Rainy":
            System.out.println("Sunny");
            break;
        }
    }
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

signed main(){
	int r;
	scanf("%lld",&r);
	cout<<3*r*r<<endl;
	return 0;
}

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

ll solve() {
    vector<ll> A(3);
    for ( int i = 0; i < 3; i++ ) {
        cin >> A[i];
    }
    if ( A[0] == A[1] && A[1] == A[2] ) {
        if ( A[0] % 2 == 0 ) return -1;
        else return 0;
    }
    ll n = 0;
    while ( A[0] % 2 == A[1] % 2 && A[1] % 2 == A[2] % 2 ) {
        n++;
        A[0] >>= 1;
        A[1] >>= 1;
        A[2] >>= 1;
    }
    return n;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

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

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

    int ans = 0;
    for(int i=1; i<n; i++) {
        ans += max(0, h[i-1]-h[i]);
    }
    ans += h[n-1];

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


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define ll long long
#define Test int t;cin>>t;while(t--)
#define endl "\n"
#define PI acos(-1)
using namespace std;
const int dx[]={-1,-1,-1,0,0,0,1,1,1};
const int dy[]={-1,0,1,-1,0,1,-1,0,1};
void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
ll lcm(ll a,ll b){
    return a*b/__gcd(a,b);
}
bool prime (int x){
    for(int i=2;i*i<=x;i++){
        if(x%i==0)return 0;
    }
    return 1;
}
int main()
{
    fast();
    int n;
    cin>>n;
    n=n%10;
    if(n==2||n==4||n==5||n==7||n==9){
        cout<<"hon";
    }
    else if(n==0||n==1||n==6||n==8){
        cout<<"pon";
    }
    else{
        cout<<"bon";
    }
    return 0;
}


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

using namespace std;

//State
//dp[i][j]: The probability of getting exactly i heads 
//	when first j coins are tossed

//Initialization
//dp[0][0...N-1] = 1
//dp[1][0] = p0 and dp[i][j] = 0 for all i>j

//Transitions 
//dp[i][j] = pj*dp[i-1][j-1] + (1-pj)*dp[i][j-1]

//Order of Evaluation 
//Rowwise or Columnwise

//Answer dp[N/2+1][N-1]+...+dp[N][N-1] 

int main(){
    int N;
	cin >> N;
	vector<double> P(N,0);
	vector<vector<double>> dp(N+1,vector<double>(N,0)); 
	for(int i=0; i<N; i++){
		cin >> P[i];
	}
	dp[0][0] = 1-P[0];
	dp[1][0] = P[0];
	for(int j=0; j<N; j++){
		for(int i=0; i<=j+1; i++){
		    //cout << "i "<< i << " j "<< j << endl;
			if(i-1>=0 && j-1>=0){
				dp[i][j] = dp[i][j] + P[j]*(dp[i-1][j-1]);
				//cout << dp[i][j] << " Hey" << endl;
			}
			if(j-1>=0){
				dp[i][j] = dp[i][j] + (1-P[j])*(dp[i][j-1]);
				//cout << dp[i][j] << " Hey" << endl;
			}
		}
	}
	/*for(int i=0; i<=N; i++){
	    for(int j=0; j<N; j++){
	        cout << dp[i][j] << " ";
	    }
	    cout << endl;
	}*/
	double result = 0;
	for(int i=N/2+1; i<=N; i++){
		result = result + dp[i][N-1];
	}
	printf("%0.10lf\n",result);
}


Measured memory_bytes: 73748
N = str(int(input()))
i = 1
total = 0
digits = [i for i in range(len(N)) if i != 0 and i % 2 != 0]

if len(N) % 2 != 0:
    total += int(N) - int(str(1) + (len(N) - 1) * "0") + 1

for digit in digits:
    total += int("9" * digit) - int("1" + "0" * (digit - 1)) + 1

print(total)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
vector<int> G[100000],euler;
int dbl[100000][18],ff[100000],ss[100000],bit[200001],n,q;
int sum(int i){
	int s=0;
	while(i>0){
		s+=bit[i];
		i-= i&-i;
	}
	return s;
}
void add(int i,int x){
	while(i<=2*n){
		bit[i]+=x;
		i+= i&-i;
	}
}
void dfs(int v){
	ff[v]=euler.size();
	euler.push_back(v);
	rep(i,G[v].size()) dfs(G[v][i]);
	ss[v]=euler.size();
	euler.push_back(v);
}
int main(){
	while(true){
		cin >> n >> q;
		if(n==0) break;
		euler.clear();
		rep(i,n) G[i].clear();
		rep(i,n) rep(j,18) dbl[i][j]=-1;
		rep(i,2*n+1) bit[i]=0;
		rep(i,n-1){
			int p;
			cin >> p;
			G[p-1].push_back(i+1);
			dbl[i+1][0]=p-1;
		}
		rep(i,17){
			rep(j,n){
				if(dbl[j][i]==-1) dbl[j][i+1]=-1;
				else dbl[j][i+1]=dbl[dbl[j][i]][i];
			}
		}
		dfs(0);
		add(ff[0]+1,1);
		add(ss[0]+1,-1);
		long long ans=0;
		rep(i,q){
			char c;
			int v;
			cin >> c >> v;
			v--;
			if(c=='M'){
				add(ff[v]+1,1);
				add(ss[v]+1,-1);
			}else{
				int x=sum(ff[v]+1);
				for(int j=17;j>=0;j--){
					if(dbl[v][j]!=-1 && sum(ff[dbl[v][j]]+1)>=x) v=dbl[v][j];
				}
				ans+=(v+1);
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 19892
#include<bits/stdc++.h>
#include <queue>
#include <cstring>
#define mp make_pair
#define pb push_back
#define p push

#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long int

#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld%lld",&a,&b)
#define getLLl(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);
#define pfd(a) printf("%lf",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);

#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define SIZE 1000000007
#define MAXN 100005

using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph ;


int main(){
    ll a,b;
    cin >>a>>b;
    string s;
    cin >>s;
    for (int i = 0; i <s.size() ; ++i) {
        if(i == b-1){
            ll dif = 'A'-'a';
            cout <<char( s[i]-dif);
            continue;
        }
        cout << s[i];
    }
    return 0;
}

Measured memory_bytes: 256
s = input()
k = int(input())

ans = ''

for i in range(len(s)-1):
    a = 123-ord(s[i])
    if a==26:
        ans += s[i]
    elif a<=k:
        ans += 'a'
        k-=a
    else:
        ans += s[i]

ans += chr((ord(s[-1])+k%26-97)%26+97)

print(ans)

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

// --------------------------------------------------------------------------------
#define fastio	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define fset(arr,n,val) for(int i=0;i<=n;++i) arr[i]=val;
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------


void solve_main()
{
 	int n,m;cin>>n>>m;
 	int height[n+1];
 	frepi(1,n,1)cin>>height[i];
 	bool ok[n+1];
 	fset(ok,n,true);
 	while(m--)
 	{
 		int a,b;cin>>a>>b;
 		if(height[a]==height[b])
 		{
 			ok[a]=ok[b]=false;
 		}
 		if(height[a]>height[b]) ok[b]=false;
 		if(height[b]>height[a]) ok[a] = false;
 	} 
 	int ans = 0;
 	frepi(1,n,1)
 	{
 		if(ok[i])
 			ans++;
 	}
 	cout<<ans<<"\n";
}

int main()
{
	#ifndef ONLINE_JUDGE
    	freopen("/home/suryakant/input.txt","r",stdin);
        freopen("/home/suryakant/output.txt","w",stdout);
    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve_main();
    }
    
}

Measured memory_bytes: 4068
// C - Multiple Gift /
// https://atcoder.jp/contests/arc088/tasks/arc088_a
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
#define pb push_back
#define eb emplace_back
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using P = pair<lli, lli>;
using vp = vector<P>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
ll gcd(ll a, ll b)
{
  while (b)
  {
    ll c = b;
    b = a % b;
    a = c;
  }
  return a;
}
ll lcm(ll a, ll b)
{
  if (!a || !b)
    return 0;
  return a * b / gcd(a, b);
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, k, n, w, x, y, ans = 2, count = 0, tmp = 0;
  string s, t;
  cin >> x >> y;
  while (x <= y)
  {
    count = x;
    x = count * 2;
    tmp++;
  }
  cout << tmp << endl;
}

Measured memory_bytes: 256
import sys

X, N = map(int, input().split())
P = list(map(int, input().split()))

# print(sorted(P))

now = 0
while 1:
    if X - now not in P:
        print(X - now)
        sys.exit()
    elif X + now not in P:
        print(X + now)
        sys.exit()
    now += 1


Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main() {
  int n,k;
  while(cin >> n >> k && (n||k)) {
    map<string,int> m;
    rep(i,n) {
      string t;
      int x;
      cin >> t >> x;
      m[t]=x;
    }
    string s[k];
    rep(i,k) cin >> s[i];
    int ans=0;
    tr(it,m) {
      string t=it->F;
      while(t[0]=='*') t.erase(t.begin());
      rep(i,k) {
	if(t==s[i].substr(s[i].size()-t.size())) ans+=it->S;
      }
    }
    pr(ans);
  }
  return 0;
}


Measured memory_bytes: 1292
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>

using namespace std; using ll=long long; const int INF=1e9;
typedef pair<int,int> P;

ll check(ll x, ll b) {
  ll bb = b*b*b*b*b;
  ll res = -1;
  for(ll a=-4000;a<=4000;a++) {
    if (a*a*a*a*a - bb == x) {res = a; break;}
    else if (a*a*a*a*a - bb > x) break;
  }
  return res;
}

int main() {
  ll x; cin>>x;
  for(ll b=-4000;b<=4000;b++) {
    ll rr = check(x, b);
    if (rr != -1) {
      cout << rr << " " << b << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

string in;
const string name[8] = {
  "black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"
};

bool is_digit(char c) { return '0' <= c && c <= '9'; }
int c2i(char c) { return c - '0'; }

string solve() {
  in.erase(0, 1);
  int my[3];
  rep (i,3) my[i] = 0;
  rep (i,3) {
    if (is_digit(in[i*2])) {
      my[i] = c2i(in[i*2]) * 16;
    } else {
      my[i] = (10 + (in[i*2] - 'a')) * 16;
    }
    
    if (is_digit(in[i*2+1])) {
      my[i] += c2i(in[i*2+1]);
    } else {
      my[i] += (10 + (in[i*2+1] - 'a'));
    }
  }
  
  double dk = double(1 << 28);
  int l = -1;
  rep (S,8) {
    int ar[3], temp = 0;
    rep (i,3) ar[2-i] = (S >> i & 1) ? 255 : 0 ;
    rep (i,3) {
      temp += (ar[i] - my[i]) * (ar[i] - my[i]);
    }
    double d = sqrt(double(temp));
    if (dk > d) {
      dk = d;
      l = S;
    }
  }
  return name[l];
}

int main() {
  while (cin >> in) {
    if (in == "0") break;
    cout << solve() << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll N=1e5+5;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n;cin>>n;
    pair<ll,ll> a[n];for(ll i=0;i<n;i++)cin>>a[i].first,a[i].second=i;
    sort(a,a+n);
    ll ans = 0;
    for(ll i=0;i<n;i++)if(a[i].second%2 != i%2)ans++;
    cout<<ans/2;
}



Measured memory_bytes: 1792
#include <iostream>
#include <string>

using namespace std;

int R, S, P;

int tokuten(char t){
  if(t == 'r') return R;
  if(t == 's') return S;
  if(t == 'p') return P;
}

char kachite(char t){
  if(t == 'r') return 'p';
  if(t == 's') return 'r';
  if(t == 'p') return 's';
}

int main(void){

  int N, K;
  int x = 0;
  string T;
  string te, l;

  cin >> N >> K;
  cin >> R >> S >> P;
  cin >> T;

  l = {"rsp"};

  for(int i=0; i<N; i++){
    if(i<K || kachite(T[i])!=te[i-K]){
      te+=kachite(T[i]);
      x+=tokuten(te[i]);
    }
    else
      for(int j=0; j<3; j++)
        if(l[j]!=te[i-K] && l[j]!=kachite(T[i+K])){
          te+=l[j];
          break;
        }
  }
  cout << x << endl;

  return 0;
}

Measured memory_bytes: 640
import sys

def main():
  input = sys.stdin.readline
  A = list(map(int, input().split()))
  A = sorted(A)
  ans = 0
  for i in range(len(A)-1):
    ans += A[i+1] - A[i]
  print(ans)


if __name__ == '__main__':
  main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
	int N;
	cin >> N;
	vector<int> A(N);
	
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int res=1;
	int x = 0;
	for (int i = 0; i < N-1; i++) {
		if (x == 0) {
			if (A[i] < A[i + 1]) {
				x = 1;
			}
			else if (A[i] > A[i + 1]) {
				x = -1;
			}
		}
		else if (x == 1) {
			if (A[i] > A[i + 1]) {
				x = 0;
				res++;
			}
		}
		else {
			if (A[i] < A[i + 1]) {
				x = 0;
				res++;
			}
		}
	}
	
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1024
//
//  main.cpp
//  Study
//
//  Created by 佐々木勇星 on 2020/03/12.
//  Copyright © 2020 佐々木勇星. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <map>

using namespace std;


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

    int n, ans = 0;
    bool flag = false;
    cin >> n;
    
    vector<string> s(n);
    
    for(int i=0; i<n; i++) {
        cin >> s[i];
    }
    
    sort(s.begin(), s.end());
    
    string before;
    for(int i=0; i<n; i++)
    {
        if(s[i] == before) continue;
        ans++;
        before = s[i];
    }
    
    cout << ans << endl;
    
    
    return 0;
    
}


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

using namespace std;

int INF = 1 << 29;
int N, A, B, C;
vector<int> L(8);

int f(int a, int b, int c, int cur) {
  if (cur == N) {
    if (min({a, b, c}) > 0)
      return abs(a - A) + abs(b - B) + abs(c - C);
    else
      return INF;
  }
  int ret0 = f(a, b, c, cur + 1);
  int ret1 = f(a + L[cur], b, c, cur + 1) + 10;
  int ret2 = f(a, b + L[cur], c, cur + 1) + 10;
  int ret3 = f(a, b, c + L[cur], cur + 1) + 10;
  return min({ret0, ret1, ret2, ret3});
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++)
    cin >> L[i];
  cout << f(0, 0, 0, 0) - 30 << '\n';
  return 0;
}


Measured memory_bytes: 256
import math

def isPrime(n):
    if n <= 1:
        return False
    if n == 2:
        return True
    for i in range(2,int(math.sqrt(n) + 1)):
        if n % i == 0:
            return False
    return True

t = int(input())
cnt = 0
for i in range(t):
    if isPrime(int(input())):
        cnt +=1
print(cnt)



Measured memory_bytes: 5676
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>

using ll = long long;
using namespace std;
#define modmod 1000000007

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n) for(int i=k;i<n;i++)


int main(){
    int n;
    cin >> n;
    string S[n];
    string sortS[n];
    for(int i = 0 ; i < n; i ++){
        cin >> S[i];
        sort(S[i].begin(),S[i].end());
    }

    int mat[n][26]={0};
    for(int i = 0; i < n; i++){
        for(int j = 0; j < S[i].length(); j++){
            mat[i][S[i][j]-'a']++;
        }
    }

    /*
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 26; j++){
            printf("%d ",mat[i][j]);
        }
        printf("\n");
    }
    */

    int mini = 50;
    string result = "";
    for(int i = 0; i < 26; i++){
        mini = 50;
        for(int j = 0; j < n; j++){
            if(mini > mat[j][i]){
                mini = mat[j][i];
            }
        }
        for(int k = 0; k < mini; k++){
            result += (char)('a'+i);
        }
    }

    cout << result << endl;

    return 0;
}


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

int main() {
    string n;
    cin >> n;
    for(auto& s:n){
        if(s == '7'){
            cout << "Yes" << endl;
            return 0;
        }
    }  
    cout << "No" << endl;
//--------------------
    return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
vector<ll> node[100005];
bool used[100005]={0};
ll dist[100005]={0};
ll dp_val[100005]={0};
void dfs(ll pos,ll cos){
  dist[pos]=cos;
  used[pos]=true;
  cos++;
  for(int i=0;i<node[pos].size();i++){
    ll to=node[pos][i];
    if(!used[to]){
      used[to]=true;
      dfs(to,cos);
    }
  }
}
ll dp(ll pos){
  used[pos]=true;
  ll zcnt=0,res=0;
  for(int i=0;i<node[pos].size();i++){
    ll son=node[pos][i];
    if(!used[son]){
      ll kans=dp(son);
      res+=kans;
      if(kans==0) zcnt++;
    }
  }
  return dp_val[pos]=res+max(zcnt-1,(ll)0);
}
int main(){
  ll n;
  cin>>n;
  for(int i=0;i<n;i++) used[i]=false;
  for(int i=1;i<n;i++){
    ll s,t;
    cin>>s>>t;
    node[s].push_back(t);
    node[t].push_back(s);
  }
  ll st=0,md=0;
  for(int i=0;i<n;i++){
    if(node[i].size()>md){
      st=i;
      md=node[i].size();
    }
  }
  if(md<3){
    cout<<1<<endl;
    return 0;
  }
//  cout<<st<<endl;
  for(int i=0;i<n;i++) used[i]=false;
  ll ans=dp(st);
  cout<<ans<<endl;
}


Measured memory_bytes: 11520
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;

    int passou = 0;
    int ov = 0;
    fo(i, (int) s.size()) {
        if ( s[i] == 'c' ) {
            cout << "No\n";
            continue;
        }
        if ( s[i] == 'a' ) {
            if ( a + b > passou ) {
                cout << "Yes\n";
                passou++;
            } else {
                cout << "No\n";
            }
        } else {
            ov++;
            if ( a + b > passou and ov <= b ) {
                passou++;
                cout << "Yes\n";
            } else cout << "No\n";
        }
    }

    return 0;
}


Measured memory_bytes: 896
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>

#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define IN(x) int (x); cin >> x
#define INL(x) ll (x); cin >> x
#define VINT(a,n) vector<int> a(n)
#define VIN(a,n) VINT(a,n); REP(i,n){cin >> a[i];}
#define ALL(x) (x).begin(),(x).end()

int main () {
  INL(n);
  INL(a);
  INL(b);
  INL(c);
  INL(d);
  INL(e);
  ll m = min({a, b, c, d, e});
  cout<<ll((n-1)/m+5);

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e12)
#define PI (acos(-1))
#define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;
int main() {
    int n,m;
    ll k;
    cin >> n >> m >> k;
    //a[0] = 0, a[1] = A1, ... , a[n] = An
    vector<ll> a(n+1);
    vector<ll> b(m+1);
    //asum[0] = 0, asum[1] = asum[0] + a[1], ... , asum[n] = asum[n-1] + a[n], asum[n+1] = INF
    vector<ll> asum(n+2);
    vector<ll> bsum(m+2);
    rep(i,n){
        cin >> a[i+1];
        asum[i+1] = asum[i] + a[i+1];
    }
    rep(i,m){
        cin >> b[i+1];
        bsum[i+1] = bsum[i] + b[i+1];
    }
    asum[n+1] = INF;
    bsum[m+1] = INF;
    int ans = 0;
    auto bsum_last = bsum.end();
    rep(i,n+1){
        if(asum[i] > k) break;
        int a_cnt = i;
        //bsumのなかでk - asum[i]を超えるところの左端のindexをさがす。それに-1する。
        //bsum.end()まで見ていると遅い？
        //bsum_lastを左にずらしていく
        bsum_last = upper_bound(bsum.begin(), bsum_last, k - asum[i]);
        int b_cnt = bsum_last - bsum.begin() - 1;
        ans = max(ans, a_cnt + b_cnt);
    }
    // debug(a);
    // debug(b);
    // debug(asum);
    // debug(bsum);    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9596
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<20;
LL a,b,c,d;
void solve() {
    LL an=-2e18;
    an=max(an,b*d);
    an=max(an,a*d);
    an=max(an,a*c);
    an=max(an,b*c);
    W(an);
}
void input() {
    R(a,b,c,d);
}
int main(){
#define MULTITEST 0
#if MULTITEST    
    CASET
#endif
    {
        input();
        solve();
    }
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

int dy[] = {0, 1, 0, -1};
int dx[] = {1, 0, -1, 0};

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

  ll h, w;
  cin >> h >> w;
  vector<string> a(h);
  for (int i = 0; i < h; i++) {
    cin >> a[i];
  }

  ll cnt = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (a[i][j] == '#') cnt++;
    }
  }

  if (cnt == h + w - 1) {
    cout << "Possible" << ln;
  } else {
    cout << "Impossible" << ln;
  }

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=2005;
typedef long long ll;
const ll mod=1e9+7;
int n,m,k;
int d[2][N][2],sum[N];
int main()
{
    scanf("%d%d%d",&n,&m,&k);
    m--;
    k--;
    for(int i=1;i<=k;i++){
        d[0][i][1]=1;
    }
    d[0][0][0]=1;
    int ans=0;
    for(int i=0;i<=n;i++)
        if(k-i<=m&&i%k==n%k&&(k-i)%k==m%k){
            ans+=d[0][i][1];
            ans%=mod;
        }
    int v=1,u=0;
    for(int i=2;i<=max(n,m)*2;i++){
        u^=1;
        v^=1;
        memset(d[u],0,sizeof d[u]);
        for(int j=0;j<=n;j++)
            sum[j+1]=((sum[j]+d[v][j][0])%mod+d[v][j][1])%mod;
        for(int j=0;j<=n;j++){
            d[u][j][0]=(sum[j+1]-sum[j])%mod;
            d[u][j][0]=(d[u][j][0]%mod+mod)%mod;
            int l=max(j-k,0);
            d[u][j][1]=(sum[j]-sum[l])%mod;
            d[u][j][1]=(d[u][j][1]%mod+mod)%mod;
        }
        for(int j=0;j<=n;j++){
            if(k*i-j<=m&&j%k==n%k&&(k*i-j)%k==m%k){
                ans+=d[u][j][1];
                ans%=mod;
            }
        }
    }
    ans=(ans%mod+mod)%mod;
    printf("%d\n",ans);
}


Measured memory_bytes: 256
w,h,x,y=list(map(int,input().split()))
ans=0
if w%2==1 or h%2==1:
  ans=0
else:
  if x==w//2 and y==h//2:
    ans=1
  else:
    ans=0
print(w*h/2,ans,end=' ')
  

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <iostream>
typedef long long ll;
#define rep(i,a,b) for(ll i =a ;i <= b;i++)
#define per(i,a,b) for(ll i =a ;i >= b;i--)
using namespace std;
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
 


int main()
{
	//ifstream cin("input.txt");
	ll n,m,a,b;
	cin>>n>>m;
	
	vector<pair<ll, ll>> nums(n);
	rep(i,0, n-1){
		cin>>a>>b;
		nums[i] = make_pair(a, b);
	}

	sort(nums.begin(), nums.end());
	ll count = 0, cost = 0,i = 0;
	while(count < m)
	{
		if(count + nums[i].second > m)
		{
			cost += (m - count) * nums[i].first;
			count = m;
		}
		else
		{
			cost += nums[i].first * nums[i].second;
			count += nums[i].second;
		}
		i++;
	}
	cout<<cost;
	
}


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

using namespace std;
#define ll long long int

int main() {
    ll N,ans=0;
    cin>>N;
    while(N){
        if(N%10 == 7 ){
            ans++;
            break;
        }
        N=N/10;
    }
    if (ans==1){
        cout<<"Yes"<<"\n";
    }
    else {
        cout<<"No"<<"\n";
    }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <string.h>

using namespace std;

const int N_MAX = 200 * 1000;

int main(void) {
	int n;
	scanf("%d", &n);
	long long int a[N_MAX];
	long long int b[N_MAX];
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++) {
		scanf("%lld", &b[i]);
	}
	long long bc[N_MAX];
	long long int ans = 0;

	for (int k = 0; k < 30; k++) {
		long long int t = 1 << k;
		long long int count = 0;
		for (int i = 0; i < n; i++) {
			bc[i] = b[i] % (t<<1);
		}
		sort(bc, bc + n);
		for (int i = 0; i < n; i++) {
			long long int aa = a[i]%(t<<1);

			count += lower_bound(bc,bc+n,t*2-aa) - lower_bound(bc,bc+n,t-aa) + 
				lower_bound(bc,bc+n,t*4-aa) - lower_bound(bc,bc+n,t*3-aa);
		}

		ans += count%2 << k;
	}

	printf("%lld\n", ans);
}


Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const ll MOD = (ll)1e9 + 7;
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}
ll rev(ll x) {
	return bin_pow(x, MOD - 2);
}

const int N = 5050;
ll dp[N];
int n, m;

int main()
{
	startTime = clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%d", &n, &m);
	for (int i = 0; i <= m; i++)
		dp[i] = 1;
	for (int it = 1; it <= n; it++) {
		ll sum = 0;
		ll lst = dp[0];
		for (int i = 1; i <= m; i++) {
			if (i > 0) {
				sum = add(sum, sum);
				sum = add(sum, mult(i - 1, lst));
				lst = dp[i];
			}
			dp[i] = add(mult(i + 1, dp[i]), sum);
		}
	}
	printf("%lld\n", dp[m]);

	return 0;
}


Measured memory_bytes: 3264
#include <cmath>
#include <iostream>
#include <limits>
#include <vector>


int main() {
    std::ios_base::sync_with_stdio (false);
    int n, k;
    std::cin >> n >> k;
    std::vector<long long> answers;
    answers.reserve(n);
    std::vector<int> heights(n);
    for(auto& e : heights) std::cin >> e;
    answers.push_back(0);
    for(int i = 1; i < n; i++) {
        long long ans = std::numeric_limits<long long>::max();
        const int lookBack = std::min(k, i);
        for (int j = 1; j <= lookBack ; j++) {
            const long long option = answers[i - j] + std::abs(heights[i - j] - heights[i]);
            ans = std::min(ans, option);
        }
        answers.push_back(ans);
    }
    std::cout << answers.back() << "\n";
}


Measured memory_bytes: 1408
#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
typedef long long ll;
#define INF (1 << 30)
#define MOD 1000000007

template<class T> inline void chmax(T& a, T b) { if (a < b) a = b; }
template<class T> inline void chmin(T& a, T b) { if (a > b) a = b; }

class Combination
{
	vector<ll> fact, finv;
public:Combination(int n) {
	fact.resize(n + 1, 1);
	finv.resize(n + 1, 1);
	vector<ll> inv(n + 1, 1);
	for (int i = 2; i <= n; ++i) {
		fact[i] = fact[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
public:ll comb(int n, int k) {
	return fact[n] * (finv[n - k] * finv[k] % MOD) % MOD;
}
};
map<int, int> factorize(int x)
{
	map<int, int> m;
	for (int i = 2; i * i <= x; ++i) {
		while (x % i == 0) {
			x = x / i;
			++m[i];
		}
	}
	if (x != 1) {
		++m[x];
	}
	return m;
}
int main()
{
	int N, M; cin >> N >> M;
	auto m = factorize(M);
	auto C = Combination(N + 100);
	ll ans = 1;
	for (auto i : m) {
		ans *= C.comb(N + i.second - 1, i.second);
		ans = ans % MOD;
	}
	cout << ans << endl;
	return 0;
}


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

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

int main()
{
    int inp[5];
    for (int i = 0; i < 5; i++)
        scanf("%d", &inp[i]);
    sort(inp, inp + 5);

    int k;
    scanf("%d", &k);

    if (inp[4] - inp[0] <= k)
        printf("Yay!\n");
    else
        printf(":(\n");

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define NUMBER 10000

int main(void){

  int  i,num;

  int a[NUMBER];

  scanf("%d\n",&num);


  for(i=0;i<num;i++){

      scanf("%d ",&a[i]);

  }   long min,max,sum;

  min=max=sum=a[0];

  for(i=1;i<num;i++){

      if(a[i]>max){

      max=a[i];}

      if(a[i]<min){

      min=a[i];}

      sum+=a[i];

  }

  printf("%ld %ld %ld\n",min,max,sum);

  return 0;

}


Measured memory_bytes: 2104
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {
    var s = input[0];

    if (s.match(/AC/)) {
        console.log('Yes');
    }
    else {
        console.log('No');
    }

    return 0;
}


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

int ctoi(char c)
{
    return c - '0';
}

int main()
{
    string a, b;
    cin >> a >> b;
    if (a.size() != b.size())
    {
        cout << (a.size() > b.size() ? "GREATER" : "LESS") << "\n";
    }
    else
    {
        for (int i = 0; i < a.size(); i++)
        {
            if (ctoi(a[i]) > ctoi(b[i]))
            {
                cout << "GREATER" << "\n";
                return 0;
            }
            else if (ctoi(a[i]) < ctoi(b[i]))
            {
                cout << "LESS"  << "\n";
                return 0;
            }
        }
        cout << "EQUAL" << "\n";
    }
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);
impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}
impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

fn solve() {
    let (n,d,a) = get!(usize, usize, usize);
    let mut xh = get!(usize, usize; n);

    xh.sort_by_key(|e| e.0); 
    let mut heap = BinaryHeap::new();

    let mut val = 0usize;
    let mut count = 0usize;
    for (x,h) in xh {
        while let Some((Rev(k), v)) = heap.pop() {
            if k + 2*d < x {
                val -= v;
            } else {
                heap.push((Rev(k), v));
                break;
            }
        }
        if h > val {
            let c = (h-val-1)/a+1;
            count += c;
            heap.push((Rev(x),a*c));
            val += a*c;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 16636
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from collections import deque
from heapq import heapify,heappush,heappop
from copy import deepcopy

def main():
    n = int(input())
    ans = 0
    for i in range(1,n + 1):
        if i%3 == 0 or i%5 == 0:
            continue
        else:
            ans += i
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 9604
#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 sum = 0, ab = 0;
  rep(i,3)rep(j,3) {
    int c;
    cin >> c;
    sum += c;
    if (i == j) ab += c;
  }
  if(sum == 3 * ab) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <vector>
#include <iostream>
using namespace std;
 
void dfs(const vector<vector<int>> &G, vector<int> &C,
         int v, int prev){
  for(auto v_ : G[v]){
    if(v_ == prev) continue;
    C[v_] += C[v];
    dfs(G,C,v_,v);
  }
}
 
int main(){
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> G(N);
  for(int i = 1; i < N; ++i){
    int a, b;
    cin >> a >> b;
    --a,--b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<int> C(N,0);
  for(int i = 0; i < Q; ++i){
    int p, x;
    cin >> p >> x;
    --p;
    C[p] += x;
  }
  dfs(G,C,0,-1);
  cout << C[0];
  for(int i = 1; i < N; ++i)
    cout << " " << C[i];
  cout << endl;
}

Measured memory_bytes: 30612
<?php
$n = intval(fgets(STDIN));
$s = intval(fgets(STDIN));

function f($b, $n){
    if($n < $b)return $n;
    return f($b, intdiv($n, $b)) + $n % $b;
}
if($n == $s){
    echo $n+1;exit;
}
for($i = 2, $I = sqrt($n); $i <= $I; $i++){
    if(f($i, $n) == $s){
        echo $i;exit;
    }
}
for($p = floor(sqrt($n)); $p >= 1; $p--){
    $q = $s - $p;
    if(($n-$q) % $p != 0)continue;
    $b = ($n-$q)/$p;
    if($b >= 2 && f($b, $n) == $s){
        echo $b;exit;
    }
}
echo -1;


Measured memory_bytes: 4728
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();
    int k=sc.nextInt();
    int ans=0;
    if(k<a)
    {
      ans=k;
      k=0;
    }
    else
    {
      ans+=a;
      k-=a;
    }
    if(k<b)
    {
      k=0;
    }
    else
    {
      k-=b;
    }
    if(k<c)
    {
      ans-=k;
      k=0;
    }
    else
    {
      ans-=c;
    }
    System.out.println(ans);
  }
}

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

long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}

int main(){
  int X; cin >> X;
  cout << 360 / gcd(X, 360) << endl;
}


Measured memory_bytes: 3628
using System;

namespace Registration
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine(); 
            var T = Console.ReadLine(); 
			Console.WriteLine(T.StartsWith(S) && T.Length - S.Length == 1 ? "Yes": "No");
            return;
        }
    }
}



Measured memory_bytes: 25932
import java.util.Scanner;



public class Main{

    boolean[] isPrime;



    void run(){

	isPrime = new boolean[1000001];

	for(int i=0;i<=1000000;i++) isPrime[i] = true;



	isPrime[0] = false;

	isPrime[1] = false;



	for(int i=2;i<=1000000;i++){

	    if(!isPrime[i]) continue;

	    for(int j=i+i;j<=1000000;j+=i){

		isPrime[j] = false;

	    }

	}





	Scanner sc = new Scanner(System.in);

	while(sc.hasNext()){

	    int n=sc.nextInt();

	    int count = 0;

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

		if(isPrime[i]) count++;

	    }

	    System.out.println(count);

	}

    }



    public static void main(String[] args){

	new Main().run();

    }

}

Measured memory_bytes: 12000
use proconio::*;

fn main() {
    input! {
        x:i32,
        n:isize,
        ar:[i32; n],
    }
    let mut dif = 0;
    loop {
        let minus = x - dif;
        let plus = x + dif;
        let mut f = false;
        for e in 0..ar.len() {
            if ar[e] == minus {
                f = true;
            }
        }
        if !f {
            println!("{}", minus);
            return;
        }

        f = false;
        for e in 0..ar.len() {
            if ar[e] == plus {
                f = true;
            }
        }
        if !f {
            println!("{}", plus);
            return;
        }

        dif += 1;
    }
    // unreachable!();
}


Measured memory_bytes: 2188