akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        long K = sc.nextInt();
        long A = sc.nextInt();
        long B = sc.nextInt();
        
        long nBiscuits = 1;
        while (K > 0) {
            if (nBiscuits < A) {
                nBiscuits += 1;
                K -= 1;
            } else {
                if (B - A > 2 && K > 1) {
                    nBiscuits += B - A;
                    K -= 2;
                } else {
                    nBiscuits += 1;
                    K -= 1;
                }
            }
        }

        System.out.println(nBiscuits);

    }

}


Measured memory_bytes: 23892
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;


int main(void){
  int n,i,j,a[1003][1003],k[1003]={};
  
  cin >> n;
  for (i=0;i<n;i++) for (j=0;j<n-1;j++){
    cin >> a[i][j];
    a[i][j]--;
  }
  
  int qs,p,ne,t;
  queue<int> q;
  bool rk=true;
  
  for (i=0;i<n;i++) q.push(i);
  
  t=0;
  while (rk && !q.empty()){
    bool u[1003]={false};
    rk=false;
    qs=q.size();
    for (i=0;i<qs;i++){
      p=q.front();
      q.pop();
      ne=a[p][k[p]];
      if (!u[p] && !u[ne] && a[ne][k[ne]]==p){
        rk=true;
        u[p]=u[ne]=true;
        k[p]++;
        k[ne]++;
        if (k[p]<n-1) q.push(p);
        if (k[ne]<n-1) q.push(ne);
      }
    }
    t++;
  }
  
  for (i=0;i<n;i++){
    if (k[i]<n-1){
      cout << -1 << endl;
      return 0;
    }
  }
  
  cout << t << endl;
  
  return 0;
}

Measured memory_bytes: 4224
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;


int main(){

    ll N, ans = 0;
    cin >> N;
    rep(i, N){
        ll l, r;
        cin >> l >> r;
        ans += r - l + 1;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var idealFlowers = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
        var flowers = new int[n];
        flowers.Select(x => x = 0);
        var count = 0;

        var l = 0;
        while(l < n)
        {
            if (flowers[l] == idealFlowers[l])
            {
                l++;
                continue;
            }

            for (int r = l; r <= n; r++)
            {
                if (r == n || flowers[r] == idealFlowers[r])
                {
                    count++;
                    break;
                }

                flowers[r]++;
            }
        }

        Console.WriteLine(count);
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;


int main() {
	int n, m, c,a[25][25],ans=0,sum;
	array<int, 25> b;
	cin >> n >> m >> c;
	for (int i = 1; i <= m;i++) {
		cin >> b[i];
	}
	for (int i = 1; i <= n;i++) {
		for (int j = 1; j <= m;j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 1; i <= n;i++) {
		sum = c;
		for (int j = 1; j <= m;j++) {
			sum += a[i][j] * b[j];
		}
		if (sum > 0) {
			ans++;
		}
	}
	cout << ans << endl;

}

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

using namespace std;

int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, k, l;
	cin >> n >> k >> l;
	vector<int> a(n + 1);
	vector<int> b(n + 1);
	iota(a.begin(), a.end(), 0);
	iota(b.begin(), b.end(), 0);
	vector<unordered_map<int, int>> mp(n + 1);
	function<int (int)> finda = [&] (int x) -> int {
		if (x == a[x]) {
			return x;
		}
		return a[x] = finda(a[x]);
	};
	function<int (int)> findb = [&] (int x) -> int {
		if (x == b[x]) {
			return x;
		}
		return b[x] = findb(b[x]);
	};
	for (int i = 0; i < k; i++) {
		int p, q;
		cin >> p >> q;
		p = finda(p);
		q = finda(q);
		a[p] = q;
	}
	for (int i = 0; i < l; i++) {
		int r, s;
		cin >> r >> s;
		r = findb(r);
		s = findb(s);
		b[r] = s;
	}
	for (int i = 1; i <= n; i++) {
		mp[finda(i)][findb(i)]++;
	}
	for (int i = 1; i <= n; i++) {
		cout << mp[finda(i)][findb(i)] << (i == n ? '\n' : ' ');
	}

	return 0;
}



Measured memory_bytes: 24064
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef int ll;
typedef pair<ll, ll> pll;

class PMA {
  PMA* next[256];
  vector<ll> matched;

  PMA() { REP(i, 0, 256) next[i] = NULL; }

  void build(vector<string> &p) {
    REP(i, 0, 256) next[i] = NULL;
    this->next[0] = this;
    REP(i, 0, p.size()) {
      PMA *now = this;
      REP(j, 0, p[i].length()) {
        if(now->next[p[i][j]] == 0) now->next[p[i][j]] = new PMA;
        now = now->next[p[i][j]];
      }
      now->matched.push_back(i);
    }

    queue<PMA*> q;
    REP(i, 1, 256) {
      if(!this->next[i]) this->next[i] = this;
      else {
        this->next[i]->next[0] = this;
        q.push(this->next[i]);
      }
    }

    while(!q.empty()) {
      PMA *now = q.front();
      q.pop();
      REP(i, 1, 256) if(now->next[i]){
        PMA *nxt = now->next[0];
        while(!nxt->next[i]) nxt = nxt->next[0];
        now->next[i]->next[0] = nxt->next[i];
        vector<ll> &m1 = now->next[i]->matched, &m2 = nxt->next[i]->matched;
        REP(j, 0, m2.size()) if(!binary_search(m1.begin(), m1.end(), m2[j])) m1.push_back(m2[j]);
        sort(m1.begin(), m1.end());
        q.push(now->next[i]);
      }
    }
  }

public:
  PMA(vector<string> &p) {
    build(p);
  }

  vector<pll> match(string s) {
    vector<pll> ret;
    PMA* pma = this;
    REP(i, 0, s.length()) {
      while(!pma->next[s[i]]) pma = pma->next[0];
      pma = pma->next[s[i]];
      for(ll j : pma->matched) ret.push_back(pll(i, j));
    }
    return ret;
  }
};

int main(void) {
  string S;
  cin >> S;
  ll N;
  cin >> N;
  vector<string> P(N);
  REP(i, 0, N) cin >> P[i];

  sort(P.begin(), P.end());

  vector<string> Q;
  Q.push_back(P[0]);
  REP(i, 1, P.size()) {
    ll len = min(Q[(ll) Q.size() - 1].size(), P[i].size());
    bool ok = true;
    REP(j, 0, len) ok = ok && (Q[(ll) Q.size() - 1][j] == P[i][j]);
    if(!ok) Q.push_back(P[i]);
  }

  PMA pma(Q);
  vector<pll> p = pma.match(S);
  REP(i, 0, p.size()) p[i].second = p[i].first + 1 - Q[p[i].second].length();
  sort(p.begin(), p.end());

  ll ans = 0, t = -1;
  REP(i, 0, p.size()) {
    if(t < p[i].second) {
      ans++;
      t = p[i].first;
    }
  }

  cout << ans << endl;
}



Measured memory_bytes: 174040
MOD = 10**9+7
n = int(input())
A = list(map(int, input().split()))

colors = [0]*3
ans = 1
for i in range(n):
    c = colors.count(A[i])
    ans = ans*c % MOD
    if c == 0:
        break
    colors[colors.index(A[i])] += 1

print(ans % MOD)

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

/*{
}*/

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int,int>;

//constexpr int mod = 1e9+7;
//constexpr int inf = 1LL<<60;

signed main() {
  int n, k;
  cin >> n >> k;

  vi a(n);
  rep(i, 0, n) cin >> a[i];
  sort(all(a));

  int l = -1, r = n;
  while(r-l > 1){
    int m = (l+r)/2;

    vvi dp(n+1, vi(k+1));
    dp[0][0] = 1;
    rep(i, 0, n) rep(j, 0, k+1) if(dp[i][j]){
      dp[i+1][j] = 1;
      if(i != m and j+a[i] < k+1){
        dp[i+1][j+a[i]] = 1;
      }
    }

    bool ok = false;
    rep(i, max(0LL, k-a[m]), k){
      if(dp[n][i]) ok = true;
    }

    if(ok) r = m;
    else l = m;
  }

  cout << r << endl;

  return 0;
}



Measured memory_bytes: 195928
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int,int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int N;
vector<vector<Edge>> G;
vector<int> E;

void dfs(int v,int pre,int pre_c){
    int color = 1;
    for (auto e :G[v]){
        if (e.first == pre) continue;
        if (color == pre_c) color++;
        E[e.second] = color;
        dfs(e.first,v,E[e.second]);
        color++;
    }
}

int main() {
    cin >> N;
    G.assign(N,vector<Edge>());
    E.assign(N - 1,-1);
    for (int i = 0;i < N - 1;i++){
        int a,b;cin >> a >> b;a--,b--;
        G[a].push_back(Edge(b,i));G[b].push_back(Edge(a,i));
    }
    int Mx = 0;int m;
    for (int i = 0;i < N;i++){
        int cur = G[i].size();
        Mx = max(cur,Mx);
        if (cur == Mx) m = i;
    }
    cout << Mx << endl;
    dfs(m,-1,-1);
    rep(i,N - 1) cout << E[i] << endl;
}

Measured memory_bytes: 8320
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/

/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/

#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         1000000000000000000
using namespace std;

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=result * x;
        x=x*x;
        n=n/2;
    }
    return result;
}

int n,w,dp[105][100005];

signed main()
{
    tezz

    memset(dp,0,sizeof(dp));
    cin>>n>>w;
    vii mat;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        mat.pb(a,b);
    }
    sort(all(mat));
    /*for(auto it:mat) cout<<it.x<<' '<<it.y<<endl;
        cout<<endl;*/
    
    dp[0][mat[0].x] = mat[0].y;
    
    for(int i=1;i<n;i++){
        for(int j=0;j<=w;j++){
            if(j<mat[i].x){
                dp[i][j] = dp[i-1][j];
            }
            else if(j == mat[i].x){
                dp[i][j] = max(dp[i-1][j], mat[i].y);
            }
            else if(j>mat[i].x){
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-mat[i].x] + mat[i].y);
            }
        }
    }

    /*for(int i=0;i<n;i++){
        for(int j=0;j<=w;j++) cout<<dp[i][j]<<' ';
            cout<<endl;
    }*/
    int mx=0;
    for(int i=0;i<=w;i++) mx = max(mx,dp[n-1][i]);
        cout<<mx;
}

Measured memory_bytes: 82304
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int x = sc.nextInt();
		int[] a = new int[n];
		int sum = n + x;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			sum += (d - 1) / a[i];
		}
		System.out.println(sum);
	}
}

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

int main() {
    long long int n;
    cin >> n;
    vector<long long int> a(n+1), b(n);
    for(auto& e : a) cin >> e;
    for(auto& e : b) cin >> e;

    auto la = a, lb = b;
    for(int i = 0;i + 1 <= n;i++){
        if(la[i] > lb[i]){
            la[i] -= lb[i];
            lb[i] = 0;
        }else{
            lb[i] -= la[i];
            la[i] = 0;
        }

        if(la[i+1] > lb[i]){
            la[i+1] -= lb[i];
        }else{
            la[i+1] = 0;
        }
    }
    
    auto ra = a, rb = b;
    for(int i = n;i - 1 >= 0;i--){
        if(ra[i] > rb[i-1]){
            ra[i] -= rb[i-1];
            rb[i-1] = 0;
        }else{
            rb[i-1] -= ra[i];
            ra[i] = 0;
        }

        if(ra[i-1] > rb[i-1]){
            ra[i-1] -= rb[i-1];
        }else{
            ra[i-1] = 0;
        }
    }
    auto sum = accumulate(begin(a), end(a), 0ll);
    cout << max(sum - accumulate(begin(la), end(la), 0ll), sum - accumulate(begin(ra), end(ra), 0ll)) << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	int n; cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	vector<vector<ll>> dp(n + 2, vector<ll>(3));
	for (int i = 0; i < n; i++) {
		dp[i][0] = (i >= 2 ? dp[i - 2][0] : 0) + a[i];
		dp[i][1] = max({
			(i >= 2 ? dp[i - 2][1] : 0) + a[i],
			(i >= 3 ? dp[i - 3][0] : 0) + a[i]
		});
		dp[i][2] = max({
			(i >= 2 ? dp[i - 2][2] : 0) + a[i],
			(i >= 3 ? dp[i - 3][1] : 0) + a[i],
			(i >= 4 ? dp[i - 4][0] : 0) + a[i]
		});
	}
	if (n & 1)
		cout << max({ dp[n - 1][0], dp[n - 1][1], dp[n - 1][2],
			dp[n - 2][0], dp[n - 2][1] }) << endl;
	else
		cout << max({ dp[n - 1][0], dp[n - 1][1], dp[n - 2][0] }) << endl;
	return 0;
}

Measured memory_bytes: 15668
A = [[i for i in range(1 ,14)] for j in range(4)]
a = int(input())
for i in range(a):
    b,c = map(str,input().split())
    c=int(c)
    if b=="S":
        A[0].remove(c)
    if b=="H":
        A[1].remove(c)
    if b=="C":
        A[2].remove(c)
    if b=="D":
        A[3].remove(c)
def name(number,name):
    if A[number]==[]:
        pass
    else:    
        x=A[number]
        x=map(str,x)
        print("%s " %name+("\n%s " %name).join(x))
    
name(0,"S")
name(1,"H")
name(2,"C")
name(3,"D")

Measured memory_bytes: 7732
#include<stdio.h>
#include<ctype.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#include<math.h>
int main()
{
	int i,j;
	for(i = 1 ; i <= 9 ; i++)
	{
		for(j = 1 ;j <= 9 ; j++)
		{
			printf("%dx%d=%d\n",i , j ,i * j);	
		}
	}
	return 0;
}

Measured memory_bytes: 924
from sys import maxsize
N, M = map(int, input().split())
bridges = []
for i in range(M):
    a, b = map(int, input().split())
    bridges.append((a, b))

res = 0
end = -maxsize

bridges.sort(key=lambda x: x[1])

for bridge in bridges:
    if end <= bridge[0]:
        res += 1
        end = bridge[1]
print(res)

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

int main(){
	int N,M;
	cin >> N >> M;
	priority_queue<ll> q;
	ll a;
	for(int i(0);i<N;++i){
		cin >> a;
		q.push(a);
	}
	for(int i(0);i<M;++i){
		a = q.top();
		q.pop();
		a /= 2;
		q.push(a);
	}
	ll ans(0);
	for(int i(0);i<N;++i){
		ans+=q.top();
		q.pop();
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1400
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,string> tp;
//typedef vector<tp> vt;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	string s;
	cin>>n;
	vi in(n);
	rep(i,n)cin>>in[i];
	vi out(n);
	int l=n/2-1,r=n/2;
	if(n%2){
		out[r]=in[0];
		r++;
	}
	rep(i,n/2){
		int t=i*2;
		if(n%2)t++;
		out[r]=in[t];
		out[l]=in[t+1];
		r++;
		l--;
	}
	rep(i,n-1)cout<<out[i]<<" ";
	cout<<out[n-1]<<endl;
}











Measured memory_bytes: 3712
package main

import "fmt"

func main() {
	var h, w int
	fmt.Scan(&h, &w)

	c := [10][10]int{}
	for i := 0; i <= 9; i++ {
		for j := 0; j <= 9; j++ {
			fmt.Scan(&c[i][j])
		}
	}

	for k := 0; k < 10; k++ {
		for i := 0; i < 10; i++ {
			for j := 0; j < 10; j++ {
				c[i][j] = min(c[i][j], c[i][k]+c[k][j])
			}
		}
	}

	ans := 0
	for i := 0; i < h; i++ {
		var a int
		for j := 0; j < w; j++ {
			fmt.Scan(&a)
			if a == -1 {
				continue
			}
			ans += c[a][1]
		}
	}

	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 2560
X, Y = map(int, input().split())
ranks = [X, Y]
ans = 0

for i in ranks:
    if i == 1:
        ans += 300000
    elif i == 2:
        ans += 200000
    elif i == 3:
        ans += 100000

if (X, Y) == (1, 1):
    ans = 1000000

print(ans)

Measured memory_bytes: 3060
/*
 * Author: madlogic
 * It's better to do something than nothing
*/
#include <bits/stdc++.h>
using namespace std;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define int long long
const int INF = 1000000000;
const int MOD = 1000000007;
const double PI = 2*acos(0.0);
signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
    cout << (n - 1 + k - 2)  / (k - 1) << endl;
	return 0;	
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int C = scanner.nextInt();
        int D = scanner.nextInt();
        scanner.close();

        while (true) {
            C -= B;
            if (C <= 0) {
                System.out.println("Yes");
                return;
            }
            A -= D;
            if (A <= 0) {
                System.out.println("No");
                return;
            }

        }

    }
}

Measured memory_bytes: 35796
def main():
    N, K = map(int, input().split())
    A = [int(a) for a in input().split()]
    visited = [False for i in range(N)]

    ind = 0
    cnt_toloop = 0
    for i in range(N):
        if visited[ind] == False:
            visited[ind] = True
            ind = A[ind] - 1
            cnt_toloop += 1
        else:
            break

    start = ind
    ind = start
    cnt = 0
    for i in range(N):
        if A[ind] - 1 == start:
            cnt += 1
            break
        else:
            ind = A[ind] - 1
            cnt += 1

    step = 0
    ind = 0
    
    if K >= cnt_toloop:
        K -= cnt_toloop
        K = K % cnt

        step = cnt_toloop + K

        for i in range(step):
                ind = A[ind] - 1
        print(ind + 1)
   
    else:
        step = K
        for i in range(step):
            ind = A[ind] - 1
        print(ind + 1)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 33440
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;

    while(scanf("%d",&n)==1)
    {
        if(n>=30)
        {
            printf("Yes\n");
        }
        else
        {
            printf("No\n");
        }
    }








return 0;
}


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

int main(){
  vector<string> whether={"Sunny", "Cloudy", "Rainy" ,"Sunny"};
  string s;
  cin >> s;
  for(int i=0;i<3;i++){
    if(s == whether[i]){
      cout << whether[i+1] << endl;
    }
  }
  return 0;
}
      

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

string f(string& s, int& i) {
	string res;
	int x = 0;
	i++;
	for (;;) {
		if (s[i] == '[') {
			string t = f(s, i);
			reverse(t.begin(), t.end());
			res += t;
		}
		else if (s[i] == ']') return res;
		else if (s[i] == '+') x++;
		else if (s[i] == '-') x--;
		else {
			char c = s[i];
			if (c != '?') c = 'A' + (c - 'A' + x + 104) % 26;
			if (c == '?') c = 'A';
			res += c;
			x = 0;
		}
		i++;
	}
}

int main() {
	for (;;) {
		string s; cin >> s;
		if (s == ".") break;
		int i = 0;
		s = "[" + s + "]";
		cout << f(s, i) << endl;
	}
}

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

using namespace std;

#define ll long long
#define MoD 1e9 + 7
#define clear(a) memset(a, 0, sizeof(a))
#define fo(i, a, b) for(int i = a; i < b; i++)
//#define re(i, a, b) for(int i = b; i > a; i--)
#define pb(a) push_back(a)

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

const int mxn=2e5+10;
int n;
ll a[mxn];

void solve(){
	cin >> n;

	fo(i, 0, n){
		cin >> a[i];
	}
	ll ans=0;
	ll b;
	fo(i, 1, n){
		if(a[i-1]>a[i]){
			b= a[i];
			ans+=a[i-1]-b;
			a[i]= a[i-1];
		}
	}
	cout << ans << '\n';
}

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

	int t=1;
	for(int i=1; i<=t; ++i) {
		solve();
	}

}


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

int main() {
  int a,b; cin>>a>>b;
  int ans=0;
  if(b==1){ans=0;}
  else if(b<a){ans=1;}
  else{
    ans=(b-1)/(a-1); 
    if((b-1)%(a-1)!=0){ans++;}
  }
  cout<<ans;
}



Measured memory_bytes: 256
import sys


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


N, Q = map(int, input().split())
S = input()

hit = [0] * N

for i in range(0, N - 1):
    hit[i + 1] = hit[i]

    if S[i:i+2] == 'AC':
        hit[i + 1] += 1

for _ in range(0, Q):
    l, r = map(int, input().split())
    result = hit[r - 1] - hit[l - 1]
    print(result)


Measured memory_bytes: 52824
#include <stdio.h>

int main (void) {
  int n, searchnum, cent;
  int i, count = 0;
  int begin, end;
  int a[100];

  
  while (1) {
    scanf("%d", &n);
    if (n == 0) break;
    for (i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    scanf("%d", &searchnum);

    begin = 0; end = n-1;
    cent = (begin + end) / 2;
    count = 0;
    while(begin <= end) {
      count++;
      //printf("count:%d\nbegin:%d\nend:%d\ncent:%d\n", count, begin, end, cent);
      if (a[cent] == searchnum) {
	break;
      } else if (a[cent] < searchnum) {
	begin = cent + 1;
	cent  = (begin + end) / 2;
      } else {
	end   = cent - 1;
	cent  = (begin + end) / 2;
      }
      
    }

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

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

int64_t Q=1000000007;

 int64_t si(int64_t x,int64_t y){
   int64_t A=x,B=y,C=1;//A,Bを入れる
  for(int64_t i=1;i<=B;i++){
    C=(C*i)%Q;
  }
  int64_t N=Q-2,a=1,b=0,c=1;
  while(N>0){
    a*=2;
    if(N%a!=0){
      N-=a/2;
      int64_t d=C;
      for(int j=0;j<b;j++){
        d=(d*d)%Q;
      }
      c=(c*d)%Q;
    }
    b++;
  }
  C=c;
  for(int i=0;i<B;i++){
    C=(C*(A-i))%Q;
  }//答はC
  return C;
}


int main() {
  int64_t S,Z=0,K=0;
  cin>>S;
  S-=3;
  while(S-K>=0){
    Z+=si(S,K);
    Z%=Q;
    S-=2;
    K++;
  }
  cout<<Z<<endl;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){
    int i,j,k;
    int N,D,human = 0;
    
    scanf("%d %d",&N,&D);
    
    for(human = 1;human*(2*D + 1) < N;human++){
        
    }
    
    printf("%d\n",human);
    
    
    return 0;
}



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

int main(void) {
	string s;
	int k;
	cin >> s >> k;
	
	for (int i = 0; i < s.size(); i++) {
		if (k == 0) {
			break;
		}

		if (123 - s[i] <= k&&s[i] != 'a') {
			k -= ('z' - s[i] +1);
			s[i] = 'a';
		}

	}

	s[s.size() - 1] += (k % 26);

	cout << s;

	return 0;
}

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

struct Info {
    int ci, cj, cost, dir;
    Info(int i, int j, int c, int d) : ci(i), cj(j), cost(c), dir(d) {}
};
bool operator<(const Info &a, const Info &b) { return a.cost >= b.cost; }

int grid[35][35];
int dist[6][35][35];

int di[] = {-1, 0, 1, 0};
int dj[] = {0, 1, 0, -1};

int main() {
    int w, h;
    while (cin >> w >> h) {
        if (w == 0 && h == 0) break;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cin >> grid[i][j];
            }
        }
        int c[4] = {};
        cin >> c[0] >> c[1] >> c[2] >> c[3];
        priority_queue<Info> que;
        for (int i = 0; i < 6; i++) {
            for (int j = 0; j < 35; j++) {
                for (int k = 0; k < 35; k++) {
                    dist[i][j][k] = 1e9;
                }
            }
        }
        dist[1][0][0] = 0;
        que.push(Info(0, 0, 0, 1));
        while (!que.empty()) {
            int ci = que.top().ci;
            int cj = que.top().cj;
            int cost = que.top().cost;
            int dir = que.top().dir;
            que.pop();
            if (dist[dir][ci][cj] < cost) continue;
            for (int i = 0; i < 4; i++) {
                int ndir = (dir + i) % 4;
                int ni = ci + di[ndir];
                int nj = cj + dj[ndir];
                if (ni < 0 || ni >= h || nj >= w || nj < 0) continue;
                if (i == grid[ci][cj]) {
                    if (dist[ndir][ni][nj] > cost) {
                        dist[ndir][ni][nj] = cost;
                        que.push(Info(ni, nj, cost, ndir));
                    }
                } else {
                    if (dist[ndir][ni][nj] > cost + c[i]) {
                        dist[ndir][ni][nj] = cost + c[i];
                        que.push(Info(ni, nj, cost + c[i], ndir));
                    }
                }
            }
        }
        int ans = 1e9;
        for (int i = 0; i < 4; i++) {
            ans = min(ans, dist[i][h - 1][w - 1]);
        }
        cout << ans << endl;
    }
    return 0;
}


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

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

using namespace std;

double sq(double x) {
  return x * x;
}

int main() {
  double A, B, H, M;
  cin >> A >> B >> H >> M;

  double pi = 3.141592653589793;
  double at = (H + M / 60) / 12 * 2 * pi;
  double ax = cos(at) * A;
  double ay = sin(at) * A;
  double bt = (M / 60) * 2 * pi;
  double bx = cos(bt) * B;
  double by = sin(bt) * B;
  printf("%.20f\n", sqrt(sq(ax - bx) + sq(ay - by)));
}


Measured memory_bytes: 4088
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i > 0; i++)
const int MOD =1e9+7;
    
int n=1, x=1;
vector<int> ANS;
int main(){
  while(1){
    cin >> n >> x;
    if(n==0&&x==0) break;
    int ans = 0;
    for(int i = 1; i<=n;i++){
      for(int j = i+1; j<=n;j++){
        for(int k = j+1; k<=n;k++){
          if(i+j+k == x) ans++;
        }
      }
    }
    ANS.push_back(ans);
  }
  rep(i,ANS.size()){
    cout << ANS[i] << endl;
  }
}



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

typedef long long ll;

int main()
{
    int h,n,i;
    cin >> h >> n;
    int a;
    int sum = 0;
    for(i = 0;i < n;++i){
        cin >> a;
        sum += a;
    }
    if(sum >= h){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
s=input()
t=input()

dp=[[0]*(len(t)+1) for _ in range(len(s)+1)]
ans=[[(-1,-1) for _ in range(len(t)+1)] for _ in range(len(s)+1)]

for i,c in enumerate(s):
    for j,d in enumerate(t):
        if c==d:
            dp[i+1][j+1]=dp[i][j]+1
            ans[i+1][j+1]=(i,j)
        else:
            dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j])
            ans[i+1][j+1]=ans[i][j+1] if dp[i+1][j+1]==dp[i][j+1] else ans[i+1][j]

i=len(s)
j=len(t)
ss=['']*dp[i][j]
l=dp[i][j]-1
while i>0 and j>0:
    i,j=ans[i][j]
    if i>-1:
        ss[l]=s[i]
        l-=1

print(''.join(ss))


Measured memory_bytes: 385032
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		long result = 0;
		int n = s.length();
		int p = 2019;
		
		int[] sum = new int[n+1];
		int pow = 1;
		for(int i = 0; i < n; i++){
		    sum[i+1] = (sum[i] + (s.charAt(n-1-i)-'0')*pow)%p;
		    pow *= 10;
		    pow %= p;
		}
		int[] cnt = new int[p];
		for(int i = 0; i < n+1; i++){
		    result += cnt[sum[i]];
		    cnt[sum[i]]++;
		}
		
		// 出力
		System.out.println(result);
	}
}


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

int main(){

  string s;
  cin >> s;
  rep(i, s.size()){
    cout << "x";
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc142/tasks/abc142_a
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n = int(input())
    odd = n - n // 2
    print(odd/n)

if __name__ == '__main__':
    main()


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);

  int n;
  string s;
  cin >> n >> s;

  int cnt = 0;
  for (auto c : s) {
    cnt += (c == '1');
  }

  // special
  if (cnt == 0) {
    for (int i = 0; i < n; i++) {
      cout << 1 << '\n';
    }
    return 0;
  }
  if (cnt == 1) {
    for (int i = 0; i < n; i++) {
      if (s[i] == '1') cout << 0 << '\n';
      else {
        if (s[n - 1] == '1' || i == n - 1) cout << 2 << '\n';
        else cout << 1 << '\n';
      }
    }
    return 0;
  }

  auto poly = [&](int mod) {
    vector<int> r(n);
    r[0] = 1;
    for (int i = 1; i < n; i++) {
      r[i] = r[i - 1] * 2 % mod;
    }
    return r;
  };

  auto f = [&](vector<int> &a, int mod) {
    int sum = 0;
    for (int i = 0; i < n; i++) {
      sum = (sum + (s[i] - '0') * a[n - 1 - i]) % mod;
    }
    return sum;
  };

  // one 1 to 0
  auto a0 = poly(cnt - 1);
  int r0 = f(a0, cnt - 1);

  auto a1 = poly(cnt + 1);
  int r1 = f(a1, cnt + 1);

  auto solve = [](int x) {
    int res = 0;
    while (x) {
      int cnt = __builtin_popcount(x);
      x = x % cnt;
      res++;
    }
    return res;
  };
  
  for (int i = 0; i < n; i++) {
    int sum;
    if (s[i] == '1') {
      sum = (r0 - a0[n - 1 - i]) % (cnt - 1);
      if (sum < 0) sum += (cnt - 1);
    } else {
      sum = (r1 + a1[n - 1 - i]) % (cnt + 1);
      if (sum < 0) sum += (cnt + 1);
    }
    cout << solve(sum) + 1 << '\n';
  }

  return 0;
}



Measured memory_bytes: 5128
#include <bits/stdc++.h>
#define rep(i,n); for(long long i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
int main(){
  int n; cin >> n;
  vector<pair<double,double>>p(n);
  rep(i,n)cin >> p[i].first >> p[i].second;
  double sum = 0;
  rep(i,n){
    for(ll j = i+1;j < n;j++){
      double r =(p[i].first - p[j].first)*(p[i].first - p[j].first) + (p[i].second - p[j].second)*(p[i].second - p[j].second);
      sum += sqrt(r);
    }}
    cout << fixed << setprecision(10);
    cout << sum * 2 / n << endl;
}

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


using namespace std;
 
int main(){
    int N;
    cin >> N;
    int count = 0;
    int c = 0;
    int sum = 0;
    vector<int> a(N);
    for(int i=0; i < N; i++) cin >> a[i];

    for(int i = 0; i < N; i++){
        sum += a[i];
    }

    if(sum % 2 == 0) cout << "YES";
    else cout << "NO";

   
    return 0;


}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;


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

  int ans = min(c,b/a);
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
string s;
bool flag1,flag2;
int main()
{
	cin>>s;
	int len=s.size();
	for(int i=0;i<len;i++)
	{
		if(s[i]=='C')flag1=1;
		if(s[i]=='F'&&flag1)flag2=1;
	}
	if(flag1&&flag2)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int A,B,M;
	cin>>A>>B>>M ;
	
	int a[A],b[B],c[M],x[M],y[M];
	for(int i=0;i<A;i++)cin>>a[i];
	for(int i=0;i<B;i++)cin>>b[i];
	for(int i=0;i<M;i++)cin>>x[i]>>y[i]>>c[i];
	
	int ans=INT_MAX;
	for(int i=0;i<M;i++)
	{
		int cost= a[x[i]-1]+b[y[i]-1]-c[i];
		
		//cout<<c[i]<<"]\n";
		cost=max(0, cost);
		ans=min(ans,cost);
	}
	sort(b,b+B);
	sort(a,a+A);
	for(int i=0;i<min(A,B);i++)ans=min(ans,a[i]+b[i]);
	cout<<ans;
	
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std ;
int main()
{
	int n,k,x,y,a,b;
	cin>>n>>k>>x>>y;
	a=k*x+(n-k)*y;
	b=n*x;
	if(n>k)cout<<a<<endl;
	else   cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 256
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    auto s = readln.split(',').join(' ');
    writeln(s);
}


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

int main(){
    using namespace std;
    int n,m;
    cin >> n >> m;
    vector<int> sw[n];
    for(int i=0; i<m; i++){
        int k;
        cin >> k;
        for(int j=0; j<k; j++){
            int s;
            cin >>s;
            sw[s-1].push_back(i);
        }
    }
    int p[m];
    for(int i=0; i<m; i++){
        cin >> p[i];
    }

    int ans=0;

    for(int i=0; i<pow(2,n); i++){
        int state[m] = {};
        bool judge = true;
        for(int j=0; j<n; j++){
            if((i & static_cast<int>(pow(2,j)))
                    == static_cast<int>(pow(2,j))){
                for(auto k:sw[j]){
                    state[k] = (state[k] + 1) % 2;
                }
            }
        }
        for(int j=0; j<m; j++){
            judge = judge && (state[j] == p[j]);
        }
        if(judge) ans++;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
# abc166 B
n, k = gets.split.map(&:to_i)
a = []

sn = Array.new(n, 0)

k.times  {
  d = gets.to_i
  a << gets.split.map(&:to_i)
}


a.each do |aa|
  aa.each do |x|
    sn[x-1] += 1
  end
end

p sn.count(&:zero?)


Measured memory_bytes: 14380
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {

	public void execute(int input) throws Exception {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		if (input == 1) {
			br = new BufferedReader(new FileReader("test.txt"));
		}

		int n = Integer.parseInt(br.readLine());
		
		for(int i=0; i<n; i++) {
			System.out.print("ACL");
		}
	}

	public static void main(String[] args) throws Exception {

		Main a = new Main();

		a.execute(0);

	}
}

Measured memory_bytes: 32616
#include<stdio.h>
int main(){
  char mark[52];
  int num[52];
  int S[13]={0,0,0,0,0,0,0,0,0,0,0,0,0},H[13]={0,0,0,0,0,0,0,0,0,0,0,0,0},C[13]={0,0,0,0,0,0,0,0,0,0,0,0,0},D[13]={0,0,0,0,0,0,0,0,0,0,0,0,0};
  int n,i;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%d",&mark[i],&num[i]);
  }

  for(i=0;i<n;i++){
    if(mark[i] == 'S') S[num[i]-1] = 1;
    else if(mark[i] == 'H') H[num[i]-1] = 1;
    else if(mark[i] == 'C') C[num[i]-1] = 1;
    else D[num[i]-1] = 1;
  }
  
  for(i=0;i<13;i++){
    if(S[i]!=1) printf("S %d\n",i+1);
  }
  for(i=0;i<13;i++){
    if(H[i]!=1) printf("H %d\n",i+1);
  }
  for(i=0;i<13;i++){
    if(C[i]!=1) printf("C %d\n",i+1);
  }
  for(i=0;i<13;i++){
    if(D[i]!=1) printf("D %d\n",i+1);
  }

  return 0;
}

Measured memory_bytes: 596
#include<stdio.h>
int main(void)
{
	int kukan[10], a1, a2, sum, i, sure, surea;
	while(scanf( "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &kukan[0], &kukan[1], &kukan[2], &kukan[3],
                  &kukan[4], &kukan[5], &kukan[6], &kukan[7], &kukan[8], &kukan[9],
                  &a1, &a2) != EOF) {
        sum = 0;
		for(i = 0; i < 10; i++){
			sum += kukan[i];
		}
		sure = sum * a1 / (a1 + a2);
		surea = sum * a1 % (a1 + a2);
		sum = 0;
		for(i = 0 ; i < 10; i++){
			sum += kukan[i];
			if(sure < sum) break;
			else if(sure == sum) {
				if(kukan[i] > kukan[i+1] || surea > 0)
					i = i + 1;
				break;
			}
		}
			printf( "%d\n", i + 1 );
	}
	
	return 0;
}

Measured memory_bytes: 596
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ATherefore {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        int d = N % 10;
        switch (d) {
            case 2:
            case 4:
            case 5:
            case 7:
            case 9:
                cout << "hon" << endl;
                break;
            case 0:
            case 1:
            case 6:
            case 8:
                cout << "pon" << endl;
                break;
            case 3:
                cout << "bon" << endl;
                break;
        }

    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ATherefore solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>

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

int main(void){
	long a, b, c, d;
	scanf("%ld %ld %ld %ld", &a, &b, &c, &d);
	a--;
	long sum = b - a;
	sum -= b / c - a / c;
	sum -= b / d - a / d;
	long tmp = c * d / gcd(c, d);
	sum += b / tmp - a / tmp;
	printf("%ld\n", sum);
	return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
import java.util.ArrayList;
class Main
{
	public static void main(String[] av)
	{
		Scanner sc  = new Scanner( System.in );
		ArrayList<Integer> al = new ArrayList<Integer>();

		while( sc.hasNextInt() )
		{
			int a = sc.nextInt();
			int b = sc.nextInt();
			int sum = a + b;
			int digit = String.valueOf(sum).length();	
			al.add( digit );
		}
		for ( Integer num : al )
		{
			System.out.println(num );
		}
	}
}
		

Measured memory_bytes: 20448
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    int[] B = new int[N];
    int[] C = new int[N-1];

    int ans = 0;
    for (int i = 0; i < N ; i++) {
      A[i]=sc.nextInt()-1;
    }
    for (int i = 0; i < N ; i++) {
      B[i]=sc.nextInt();
      ans += B[i];
    }
    for (int i = 0; i < N-1 ; i++) {
      C[i]=sc.nextInt();
    }

    for (int i = 1; i < N; i++) {
      int curMinus1 =A[i]-1;
      int prev = A[i-1];
      if( curMinus1 == prev ){
        ans += C[prev];
      }
    }


    System.out.println(ans);

  }



}


Measured memory_bytes: 22996
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;


void solve(long long X, long long Y, long long A, long long B, long long C, std::vector<long long> p, std::vector<long long> q, std::vector<long long> r){
    sort(ALL(p));
    sort(ALL(q));
    priority_queue<ll> queR(ALL(r));
    deque<ll> queP(p.begin() + A-X, p.end());
    deque<ll> queQ(q.begin() + B-Y, q.end());
    while(!queR.empty()){
        if(queR.top() <= queP.front() && queR.top() <= queQ.front() ){
            break;
        }
        if(queP.front() < queQ.front()){
            queP.pop_front();
            queP.push_back(queR.top());
            queR.pop();
        }
        else{
            queQ.pop_front();
            queQ.push_back(queR.top());
            queR.pop();
        }
    }
    ll ans = 0;
    for(auto x: queP) ans += x;
    for(auto x: queQ) ans += x;
    cout<<ans<<endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    std::vector<long long> p(A);
    for(int i = 0 ; i < A ; i++){
        scanf("%lld",&p[i]);
    }
    std::vector<long long> q(B);
    for(int i = 0 ; i < B ; i++){
        scanf("%lld",&q[i]);
    }
    std::vector<long long> r(C);
    for(int i = 0 ; i < C ; i++){
        scanf("%lld",&r[i]);
    }
    solve(X, Y, A, B, C, std::move(p), std::move(q), std::move(r));
    return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  //map<string,int> s;
  //map<string,int> s{};
  //string res;
  
  cin >> n;
  
  
  double ans = n*M_PI*2;
  
  cout << ans << endl;
}

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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int n, ai, ans=0;
	cin >> n;
	map<int, int> mp[2];
	for(int i=0; i<n; ++i) {
		cin >> ai;
		++mp[i&1][ai];
	}
	pair<int, int> p1[2], p2[2];
	for(int i=0; i<2; ++i) {
		for(auto it=mp[i].begin(); it!=mp[i].end(); ++it) {
			pair<int, int> p={it->second, it->first};
			if(p>p1[i])
				swap(p, p1[i]);
			if(p>p2[i])
				swap(p, p2[i]);
		}
	}
	if(p1[0].second!=p1[1].second)
		ans=p1[0].first+p1[1].first;
	else
		ans=max(p1[0].first+p2[1].first, p2[0].first+p1[1].first);
	cout << n-ans;
}

Measured memory_bytes: 4992
H, W, A, B = map(int, input().split())

if A > min(A, W - A):
    print('No')
elif B > min(B, H - B):
    print('No')
else:
    table = [[None] * W for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if i < B and j < A:
                table[i][j] = 1
            elif B <= i and A <= j:
                table[i][j] = 1
            else:
                table[i][j] = 0
    #
    for i in range(H):
        print(''.join(map(str, table[i])))

Measured memory_bytes: 12020
#D
import itertools
n, k = map(int, input().split())
max_num = min_num = 0

for i in range(k):
    max_num += n - i
    min_num += i
ans = max_num - min_num + 1

for i in range(k, n + 1):
    max_num += n - i
    min_num += i
    ans += max_num - min_num + 1
print(ans % (10 ** 9 + 7))

Measured memory_bytes: 9068
/*
  B - すぬけ君の塗り絵 2 イージー / Snuke's Coloring 2 (ABC Edit)
  <http://abc047.contest.atcoder.jp/tasks/abc047_b>
*/

#include <stdio.h>

int main(int argc, char const *argv[]) {
  int W, H, N;
  int x, y, a;
  int w0, w1, h0, h1;
  int i;

  scanf("%d %d %d", &W, &H, &N);
  w0 = 0;
  w1 = W;
  h0 = 0;
  h1 = H;

  for( i=0; i<N; i++ ){
    scanf("%d %d %d", &x,&y,&a );
    if( (a==1)&&(x>w0) ) w0 = x;
    if( (a==2)&&(x<w1) ) w1 = x;
    if( (a==3)&&(y>h0) ) h0 = y;
    if( (a==4)&&(y<h1) ) h1 = y;
  }
  if( ((w1-w0)<0) || ((h1-h0)<0) ){
    printf("%d\n", 0);
  }else{
    printf( "%d\n", (w1-w0)*(h1-h0) );
  }

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

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

	if(s == "ABC"){
		cout << "ARC" << endl;
	}else{
		cout << "ABC" << endl;
	}


	return 0;
}

Measured memory_bytes: 3624
import numpy as np

# Input
N, A, B, C, D, E = [int(input()) for _ in range(6)]

# Main
waits = [N, 0, 0, 0, 0, 0]
narrowest = min(A,B,C,D,E)
narrowest_id = [A,B,C,D,E].index(narrowest)

t = 4
t += np.ceil(N / narrowest)
print(int(t))

Measured memory_bytes: 12492
#include<bits/stdc++.h>
using namespace std;
#define N 5010
int f[N][N], n;
string s;

int main() {
    //freopen("sample.in", "r", stdin);
    cin >> n >> s;
    int ans = 0;
    for(int i = n - 1; i >= 0; i--)
        for(int j = n - 1; j >= 0; j--) {
            if (s[i] == s[j]) f[i][j] = max(f[i][j], f[i + 1][j + 1] + 1);
            ans = max(ans, min(f[i][j], j - i));
        }
    cout << ans << endl;
}

Measured memory_bytes: 98048
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define pb push_back
#define ff first
#define ss second
#define all(v) (v).begin(), (v).end()
#define mod (int)(998244353)
#define PI 3.14159265358979323846264338327950L
#define debug(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl
#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout << endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << "[ " << *it << " = " << a << " ] ";
    err(++it, args...);
}
const int N = 1e6 + 5;
signed main(){

    fastIO

    vector<int> fre(N, 0), div(N, 0);
    int n;
    cin >> n;
    for (int i = 0, a; i < n; i++) {
    	cin >> a;
    	fre[a]++;
    }
    for (int i = 1; i < N; i++){
    	for (int j = i; j < N; j += i) {
    		div[j] += fre[i];
    	}
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
    	if (fre[i] > 0 && div[i] == 1) {
    		ans++;
    	}
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 18668