akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;

constexpr int INF = 1e9;

using P = pair<int, int>;

int N, M, L, K, A, H;

struct edge {
    int to, cost;
};

using edges = vector<edge>;
using graph = vector<edges>;

void add_edge(graph& g, int from, int to, int cost) {
    g[from].push_back((edge){to, cost});
}

vector<int> dijkstra(graph& g, int s) {
    vector<int> d(g.size(), INF);
    d[s*(M+1)+M] = 0;
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P{0, s*(M+1)+M});
    while(!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        for(int i=0; i<g[v].size(); ++i) {
            edge& e = g[v][i];
            if(d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P{d[e.to], e.to});
            }
        }
    }
    return d;
}

int main() {
    while(cin >> N >> M >> L >> K >> A >> H, N) {
        graph g(N*(M+1)); // <town, rest_time>: g[T + r] = state of town(T), rest_time = r;
        for(int i=0; i<M; ++i) {
            add_edge(g, (M+1)*A+i, (M+1)*A+i+1, 1);
            add_edge(g, (M+1)*H+i, (M+1)*H+i+1, 1);
        }
        for(int i=0; i<L; ++i) {
            int l; cin >> l;
            for(int j=0; j<M; ++j) {
                add_edge(g, (M+1)*l+j, (M+1)*l+j+1, 1);
            }
        }
        for(int i=0; i<K; ++i) {
            int x, y, t;
            cin >> x >> y >> t;
            if(M < t) continue;
            for(int j=t; j<=M; ++j) {
                add_edge(g, x*(M+1)+j, y*(M+1)+j-t, t);
                add_edge(g, y*(M+1)+j, x*(M+1)+j-t, t);
            }
        }

        auto d = dijkstra(g, A);
        int res = INF;
        for(int i=0; i<=M; ++i) {
            res = min(res, d[H*(M+1)+i]);
        }
        if(res == INF) {
            cout << "Help!" << endl;
        } else {
            cout << res << endl;
        }
    }
}


Measured memory_bytes: 4632
// https://atcoder.jp/contests/abc177/tasks/abc177_d

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
using ll = long long;
using ld = long double;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
template <typename T>
using VV = V<V<T>>;
using VVL = VV<ll>;
template <typename T>
using VVV = VV<V<T>>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
using asc_pq = priority_queue<T, V<T>, greater<T>>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

#ifndef TEST
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif
struct UnionFind {
  vector<ll> parents;

  UnionFind(ll n) : parents(vector<ll>(n, -1)) {}

  ll root(ll a) {
    if (parents[a] < 0) {
      return a;
    }

    auto r = root(parents[a]);
    parents[a] = r;
    return r;
  }

  bool same(ll a, ll b) { return root(a) == root(b); }

  void merge(ll a, ll b) {
    ll ar = root(a);
    ll br = root(b);

    if (ar == br) {
      return;
    }

    // make less index one as a root
    if (ar > br) {
      swap(ar, br);
    }

    parents[ar] += parents[br];
    parents[br] = ar;
  }

  ll size(ll a) { return -parents[root(a)]; }

  ll group_count() {
    ll res = 0;

    for (auto s : parents) {
      if (s < 0) {
        res++;
      }
    }

    return res;
  }
};

void solve() {
  ll N, M;
  cin >> N >> M;

  UnionFind uf(N);

  rep(i, M) {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    uf.merge(a, b);
  }

  ll res = 0;

  rep(i, N) { chmax(res, uf.size(i)); }

  cout << res << "\n";
}


Measured memory_bytes: 4772
#include<stdio.h>
int main()
{
  int x[5];
  
  scanf("%d%d%d%d%d",&x[0],&x[1],&x[2],&x[3],&x[4]);
  if(x[0]==0){printf("1");};
  if(x[1]==0){printf("2");};
  if(x[2]==0){printf("3");};
  if(x[3]==0){printf("4");};
  if(x[4]==0){printf("5");};  
  return 0;
};

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
void solve()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(a+c==b||b+c==a||a+b==c)
        cout << "Yes";
        else
        {
            cout << "No";
        }
        
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    solve();
    return 0;
}


Measured memory_bytes: 256
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = [int(input()) for i in range(n)]
    #a = list(map(int, input().split()))
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    n = int(input())
    a = list(map(int, input().split()))
    res = a[0]
    for i in range(1,n):
        res += max(0, a[i] - a[i-1])
    print(res)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main() {

  int r[MAX], n;

  cin >> n;
  for (int i = 0; i < n; i++) cin >> r[i];

  int maxv = -1000000000;
  int minv = r[0];

  for (int i = 1; i < n; i++) {
    maxv = max(maxv,r[i] - minv);
    minv = min(minv,r[i]);    
  }

  cout << maxv << endl;
  
  return 0;
}



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

using namespace std;
typedef long long ll;
const int maxn = 100050;
map<ll,ll>mp;

void solve()
{

    ll n;
    scanf("%lld",&n);
    ll cnt  = 0;
    mp[0] = 1;
    for(ll i=0; i<n; i++)
    {
        ll t;
        scanf("%lld",&t);
        cnt += t;
        mp[cnt]++;
    }
    ll ans = 0;

    for(map<ll,ll>::iterator it = mp.begin(); it!=mp.end(); it++)
    {
        cnt = it->second;
        cnt--;
        ans += (1+cnt)*cnt/2;
    }

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

}
int main()
{
    solve();
    return 0;
}


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

int main() {
  ll L, R;
  cin >> L >> R;
  ll c2019 = R/2019-(L-1)/2019;
  ll c673 = R/673-(L-1)/673;
  ll c3 = R/3-(L-1)/3;
  if (c2019 > 0 || c673*c3 > 0) {
    cout << 0 << endl;
    return 0;
  }
  
  ll m = 2019;
  for (ll i = L; i < R; i++) {
    for (ll j = i+1; j <= R; j++) {
      m = min(m,(i*j) % 2019);
    }
  }
  
  cout << m << endl;
}

Measured memory_bytes: 256
void 
solve();

int main() {
	solve();
	return 0;
}

//////////////////////////////////////////////////
//////////////////////////////////////////////////
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

typedef pair<int, int> pii;
int N;
vector<int> X, Y;
map<pii, int> m;

void solve() {
	cin >> N;
	X.resize(N); Y.resize(N);
	for (int n = 0; n < N; n++)cin >> X[n] >> Y[n];
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			int dx = X[i] - X[j], dy = Y[i] - Y[j];
			if (m.find(pii(dx, dy)) != m.end()) {
				(*(m.find(pii(dx, dy)))).second++;
			}
			else if (m.find(pii(-dx, -dy)) != m.end()) {
				(*(m.find(pii(-dx, -dy)))).second++;
			}
			else m.insert(pair<pii,int>(pii(dx, dy), 1));
		}
	}
	int countmax = 0;
	for (auto itr = m.begin(); itr != m.end(); itr++) {
		countmax = max(countmax, (*itr).second);
	}
	cout << N - countmax << endl;
	return;
}

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

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

    string s1,s2;
    long long n1,n2;
    string s3;
    cin >> s1 >> s2 >> n1 >> n2 >> s3;
    if(s3 == s1){
        cout << n1-1 << " " << n2;
    }
    else cout << n1 << " " << n2-1;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

char t[111][55],a[111][55],d[111][55];
int y[111],m[111],D[111];


int main(void)
{
  int n,q;
  scanf("%d",&n);
  for( int i = 0; i < n; i++ ) {
    scanf("%s%s%s",t[i],a[i],d[i]);
    y[i] = atoi(d[i]);
    m[i] = atoi(d[i]+5);
    D[i] = atoi(d[i]+8);
  }
  scanf("%d",&q);
  for( int i = 0; i < q; i++ ) {
    char ti[55],aa[55],ff[55],tt[55];
    if( i ) puts("");
    scanf("%s%s%s%s",ti,aa,ff,tt);
    bool o = false;
    for( int j = 0; j < n; j++ ) {
      bool hit = true;
      if( *ti != '*' ) {
        if( !strstr(t[j],ti) ) hit = false;
      }
      //printf("%d:%d %d\n",i,j,hit);
      if( *aa != '*' ) {
        if( !strstr(a[j],aa) ) hit = false;
      }
      //printf("%d:%d %d\n",i,j,hit);
      if( *ff != '*' ) {
        int yy,mm,dd;
        yy = atoi(ff);
        mm = atoi(ff+5);
        dd = atoi(ff+8);
        if( yy > y[j] ) hit = false;
        if( yy == y[j] ) {
          if( mm > m[j] ) hit = false;
          if( mm == m[j] ) {
            if( dd > D[j] ) hit = false;
          }
        }
      }
      //printf("%d:%d %d\n",i,j,hit);
      if( *tt != '*' ) {
        int yy,mm,dd;
        yy = atoi(tt);
        mm = atoi(tt+5);
        dd = atoi(tt+8);
        if( yy < y[j] ) hit = false;
        if( yy == y[j] ) {
          if( mm < m[j] ) hit = false;
          if( mm == m[j] ) {
            if( dd < D[j] ) hit = false;
          }
        }
      }
      //printf("%d:%d %d\n",i,j,hit);
      if( hit ) puts(t[j]);
      o |= hit;
    }
    //if( !o ) puts("");
  }
  return 0;
}

Measured memory_bytes: 1044
/*input
211 5
31 41 59 26 53
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back

#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)

#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int raise(int a,int n,int m = MOD){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= raise(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

int floor1(int n,int k){
    if(n%k == 0 || n >= 0)return n/k;
    return (n/k)-1;
}

int ceil1(int n,int k){
    return floor1(n+k-1,k);
}

void solve(){
    int h,n,sum = 0;
    cin >> h >> n;
    while(n--){
      int x;cin >> x;
      sum += x;
    }
    (sum >= h)?cout << "Yes":cout << "No";
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int N;
    cin >> N;
    set<char> st;
    char c;
    REP( i, N )
    {
        cin >> c;
        st.emplace( c );
    }
    cout << ( st.size() == 4 ? "Four" : "Three" ) << endl;
    return 0;
}

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

int main() {
  int A,B,C;
  cin >>A >>B >>C;
  if(A>B){
    cout <<"No" <<endl;
    return 0;
  }
  else{
    if(C<A){
      cout <<"No" <<endl;
      return 0;
    }
    else{
      if(B<C){
        cout <<"No" <<endl;
        return 0;
      }
    }
  }
  cout <<"Yes" <<endl;
  return 0;
}

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

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


int main(){long H, W;
cin >> H >> W;
vector<string> a(H);
rep(i, H)cin >> a.at(i);
vector<string> b(H + 2);
rep(i, W + 2){
    b.at(0) = b.at(0) + '#';
    b.at(H + 1) = b.at(H + 1) + '#';
}
for(long i = 1; i < H + 1; i++){
    b.at(i) = '#' + a.at(i-1) + '#';
}
rep(i, H + 2){
    cout << b.at(i) << endl;
}
// cout << ans << endl;
return 0;
}



Measured memory_bytes: 256
r,g,b,n = gets.split.map(&:to_i)
result = 0

(n+1).times do |rn|
  (n+1).times do |gn|
    k = n - rn*r - gn*g
    if k % b == 0 and k >= 0
      result += 1
    end
  end
end

puts result


Measured memory_bytes: 1788
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <ctype.h>
#include <cstdlib>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <map>
#include <queue>
#include <utility>
#define rep(i, n) for(int i = 0; i < n; i++);

using namespace std;

const int INF = 1000000007;
const double PI = acos(-1.0);
typedef long long llong;


int main()
{	
	int n, k, p;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> k >> p;
		cout << ((k % p != 0) ? k % p : p) << endl;
	}
	
	return 0;
}

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

int bubbleSort( int* a, int n )
{
    int cnt = 0;
    for( int i = 0; i < n; i++ )
        for( int j = 0; j < n - 1; j++ )
        {
            if( a[j] > a[j+1] )
            {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1] = temp;
                cnt++;
            }
        }
    return cnt;
}

int main()
{
    int n, a[100];

    while( cin >> n )
    {
        if( n == 0 )
            break;
        for( int i = 0; i < 100; i++ )
            a[i] = 0;
        for( int i = 0; i < n; i++ )
            cin >> a[i];
        cout << bubbleSort( a, n ) << endl;
    }
    return 0;
}


Measured memory_bytes: 3012
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] chars = s.toCharArray();
    for (int i = 0; i < chars.length; i++) {
      if (i % 2 == 0) {
        if (chars[i] != 'R' && chars[i] != 'U' && chars[i] != 'D') {
          System.out.println("No");
          return;
        }
      } else {
        if (chars[i] != 'L' && chars[i] != 'U' && chars[i] != 'D') {
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");
  }
}


Measured memory_bytes: 26996
N, K = map(int, input().split())
if K % 2:
    a = 0
    for i in range(1, N + 1):
        if i % K == 0:
            a += 1
    print(a ** 3)
else:
    a, b = 0, 0
    for i in range(1, N + 1):
        if i % K == 0:
            a += 1
        elif i % K == K / 2:
            b += 1
    print(a ** 3 + b ** 3)

Measured memory_bytes: 39408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,q;
    cin>>n>>q;
    vector<vector<ll>> g(n+1);
    vector<ll> d(n+1,0);
    rep(i,n-1){
      ll a,b;
      cin>>a>>b;
      g[a].push_back(b);
      g[b].push_back(a);
    }
    rep(loop,q){
      ll p,x;
      cin>>p>>x;
      d[p]+=x;
    }
    queue<ll> que;
    que.push(1);
    vector<bool> used(n+1,false);
    while(!que.empty()){
      ll v=que.front();
      que.pop();
      used[v]=true;
      for(auto itr:g[v]){
        if(used[itr]) continue;
        d[itr]+=d[v];
        que.push(itr);
      }
    }
    FOR(i,1,n+1){
      cout<<d[i]<<' ';
    }
    cout<<endl;
}

Measured memory_bytes: 17904
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
	String s;
	int ans = 0;

	Scanner sc = new Scanner(System.in);
	s = sc.next();
	//String型の配列に変換
	String a[] = new String[4];
	a = s.split("");
	//for文を回す
	for(int i =0 ; i<4 ; i++){
		 if(a[i].equals("+")){
			 ans++;
		 }else{
			 ans--;
		 }
		
	}
	System.out.println(ans);
}}


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

int main() {
  long long n,k; cin >> n >> k;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin >> a[i];
  int t=0, nt=0;
  for(int i=0; i<n-1; i++) {
    for(int j=i+1; j<n; j++) {
      if(a[i]>a[j]) t++;
      else if(a[i]<a[j]) nt++;
    }
  }
  long long x = ((k+1)*k/2)%1000000007;
  long long y = (k*(k-1)/2)%1000000007;
  long long ans = (t*x+nt*y)%1000000007;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
#define rg register
#define ll long long 
#define inf 0x3f3f3f3f
inline int read()
{
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
    return x*f;
}
inline double nd(int x,int y){return 1.0*y/(x+y);}
int a,b,c,d,e,f;
map<int,map<int,int> >mp;
double E;
int mx,my;
double maxn;
void dfs(int x,int y)//x表示水，y表示tang 
{
    if(mp[x][y]) return;
    mp[x][y]=1;
    if(maxn<=nd(x,y))
    {
        maxn=nd(x,y);
        mx=x,my=y;
    }
    if(x+y+a<=f && nd(x+a,y)<=E) dfs(x+a,y);
    if(x+y+b<=f && nd(x+b,y)<=E) dfs(x+b,y);
    if(x+y+c<=f && nd(x,y+c)<=E) dfs(x,y+c);
    if(x+y+d<=f && nd(x,y+d)<=E) dfs(x,y+d);
}
int main(){
    //freopen("a.in","r",stdin);
    a=100*read(),b=100*read(),c=read(),d=read(),e=read(),f=read();
    E=nd(100,e);
    dfs(0,0);
    printf("%d %d\n",mx+my,my);
    //cout<<E<<endl;
    return 0;
}

Measured memory_bytes: 640
def __main():
    x = 1;
    while x <= 9 :
        y = 1;
        while y <= 9 :
             z = x * y;
             print(str(x) + "x" + str(y)  + "=" + str(z) )
             y = y + 1
        x = x + 1
        
        
__main()



Measured memory_bytes: 4624
#include<iostream>
#include <cstddef>
#include<set>
#include<stack>
#include <deque>
#include<queue>
#include<utility>
#include<vector>
#include<map>
#include<cmath>
#include<cstring>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#define  ll  long long
#define ull unsigned long long
#define  sl(a)  scanf("%lld",&a)
#define  si(a)  scanf("%d",&a)
#define mem(n,m) memset(n,m,sizeof(n))
#define PI acos(-1)
#define pb    push_back
#define pf    push_front
#define vll   vector<ll>
#define pll   pair<ll,ll>
#define mp  make_pair
#define vpll vector< pair <ll,ll> >
#define vplpll vector<pair<ll,pair<ll,ll> > >
#define mp make_pair
#define all(v) v.begin(),v.end()
#define S(X) ( (X) * (X) )
#define forab(i, a, b) for(i = a; i <= b; i++)
#define forn(i, n) for(i = 0; i < n; i++)
#define print(a,b) printf("Case %lld: %lld\n",a,b)
using namespace std;
ll powd(ll a,ll b){if(b==1){return a;}if(b%2==1){return powd(a,b-1)*a;}else{ll x=powd(a,b/2); return x*x;}}
ll powm(ll a,ll b,ll m){if(b==0){return 1;}if(b==1){return a%m;}if(b%2==1){return ((powm(a,b-1,m)%m)*(a%m))%m;}else{ll x=powm(a,b/2,m); return ((x%m)*(x%m))%m;}}
ll gcd(ll a,ll b){if(a==0){return b;}return gcd(b,a%b);}
ll a[200006];
int main()
{
    ll n;
    sl(n);
    for(ll i=0;i<n;i++)
    {
        sl(a[i]);
    }
    ll sum=0;
    for(ll i=1;i<n;i++)
    {
        if(a[i]<a[i-1])
        {
            sum+=(a[i-1]-a[i]);
            a[i]=a[i-1];
        }

    }
    cout<<sum<<endl;
    return 0;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 100005

int t , p;

int main()
{
    _FastIO;
    int a , b , c , k;
    cin >> a >> b >> c;
    cin >> k;
    while(b <= a && k){
        b *= 2;
        k--;
    }
    while(c <= b && k){
        c *= 2;
        k--;
    }
    if(c > b && b > a){
        cout << "Yes" << endl;
    }
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
#define YMAX 250001
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int H,W,d;
	char m[4]={'R','Y','G','B'};
	scan(H);scan(W);scan(d);
	if(d%2==0){
		rep(i,H){
			rep(j,W){
				int clustnum=(i+j)/d%2;
				int colornum=(j-i+H+W)/d%2;
				printf("%c",m[clustnum*2+colornum]);
			}
			kaigyo;
		}
	}
	else{
		rep(i,H){
			rep(j,W){
				printf("%c",m[(i+j)%4]);
			}
			kaigyo;
		}
	}
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,w;
  string s;
  cin>>h>>w;
  bool a=false;
  vector<bool> height(h,false);
  vector<bool> width(w,false);
  vector<vector<string>> data(h, vector<string>(w));
  for(int i=0; i<h; i++){
    cin>>s;
    for(int j=0; j<w; j++){
      data.at(i).at(j)=s.at(j);
      }
  }
  for(int i=0; i<h; i++){
    for(int j=0; j<w-1; j++){
      if(data.at(i).at(j)==data.at(i).at(j+1)&&data.at(i).at(j)=="."){
        a=true;
      } else {a=false;  break;}
    }
    if(a==true){
      height.at(i)=true;
      a=false;
    }
  }
  for(int i=0; i<w; i++){
    for(int j=0; j<h-1; j++){
      if(data.at(j).at(i)==data.at(j+1).at(i)&&data.at(j).at(i)=="."){
        a=true;
      } else {a=false; break;}
    }
    if(a==true){
      width.at(i)=true;
      a=false;
      }
  }
  for(int i=0; i<h; i++){
    if(height.at(i)==false){
      for(int j=0; j<w; j++){
        if(width.at(j)==false){
          cout<<data.at(i).at(j);
        } 
      }
      cout<<endl;
    }
  }
}

Measured memory_bytes: 768
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, s[100];

void push(int);
int pop(void);

int main(){
  int a,b;
  top = 0;

  char s[100];

  while(scanf("%s",s) != EOF){

    if( (*s < 48) || (*s > 57)){
      s[0] = *s;
    }

    if(s[0]=='+'){

      a = pop();
      b = pop();
      push(a+b);
    }

    else if(s[0] == '-'){

      b = pop();
      a = pop();
      push(a-b);
    }

    else if(s[0] == '*'){

      a = pop();
      b = pop();
      push(a*b);
    }

    else{
      push(atoi(s));
    }

  }

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

void push (int x){

  s[++top] = x;
}

int pop(){

  top--;
  return s[top+1];
}


Measured memory_bytes: 2108
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    S = [input().strip() for _ in range(N)]
    a = 0
    b = 0
    ba = 0
    za = 0

    ans = 0
    for s in S:
        if ba == 0 and s[0] == 'B' and s[-1] == 'A':
            ba = 1
        if za == 0 and s[0] != 'B' and s[-1] == 'A':
            za = 1

        ans += s.count("AB")

        if s[-1] == 'A':
            a += 1
        if s[0] == 'B':
            b += 1

    if ba == 1 and za == 0:
        print(ans + min(max(a, b) - 1, min(a, b)))
    else:
        print(ans + min(a, b))


if __name__ == '__main__':
    main()



Measured memory_bytes: 3700
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <limits>//setprecision
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set,multiset
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#include <numeric> //accumulate,,,
#define endl "\n";
using namespace std;

const long long INF = 4000000000000000001;
const int inf = 1001001001;
long long MOD = 1000000007;

void chmax(long long &a,long long b){if(a < b) a = b;}
void chmin(long long &a,long long b){if(a > b) a = b;}

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //When end-of-a bit is 1, times simple N.
    if (M & 1) res = (res * N) % MOD;
    return res %= MOD;
}
long long gcd(long long a, long long b) {
    if (b == 0) return a; else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int N;cin >> N;
    vector<pair<int,int>> ans;
    //天才以外お断り
    if(N % 2 == 0){
        for(int i = 1;i<=N;i++){
            for(int j = 1;j<=N;j++){
                if(i+j != N+1 && i < j){
                    ans.push_back(make_pair(i,j));
                }
            }
        }
        cout << ans.size() << endl;
        for(pair<int,int> OUTPUT : ans){
            cout << OUTPUT.first << " " << OUTPUT.second << endl;
        }
    }
    else{
        for(int i = 1;i<=N-1;i++){
            for(int j = 1;j<=N-1;j++){
                if(i+j != N && i < j){
                    ans.push_back(make_pair(i,j));
                }
            }
        }
        for(int i = 1;i<N;i++){
            ans.push_back(make_pair(N,i));
        }
        cout << ans.size() << endl;
        for(pair<int,int> OUTPUT : ans){
            cout << OUTPUT.first << " " << OUTPUT.second << endl;
        }
    }
    
}


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

int main(){
  long int N,K,X,Y;
  cin >> N >> K >> X >> Y;
  
  if(N<K+1){
  cout << X*N << endl;
  }else{
  cout << X*K+Y*(N-K) << endl;  
  }
}

Measured memory_bytes: 256
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque


def main():
    num, k, q_num = map(int, input().split())
    data = [int(input()) for i in range(q_num)]

    now_num = 0
    dp = [k for i in range(num + 1)]
    seikai = [0 for i in range(num + 1)]
    for i in range(q_num):
        seikai[data[i]] += 1

    for i in range(num):
        if k - (q_num - seikai[i + 1]) > 0:
            print('Yes')
        else:
            print('No')



if __name__ == '__main__':
    main()


Measured memory_bytes: 59348
/* Filename: ABC076A.java
 * Author: Mushiyo
 */

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		while(input.hasNext()){
			int R = input.nextInt();
			int G = input.nextInt();
			
			System.out.println(2 * G - R);
		}
	}

}


Measured memory_bytes: 22612
import java.util.*

fun main(args: Array<String>) {
	val sc = Scanner(System.`in`)
	val a = sc.nextLong()
	val b = sc.nextLong()
	val x = sc.nextLong()

	var ans = b / x
	ans -= if (a != 0L) (a - 1) / x else -1

	println(ans)
}


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

typedef long long int llint;

int main()
{
  int n;
  cin>> n;
  
  int fx = 0;
  for(int i = n; i > 0; i /= 10) fx += i % 10;

  cout<< (n % fx == 0 ? "Yes" : "No") <<endl;

  return 0;
}


Measured memory_bytes: 256
/*Jai Bhole Nath */
#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#define int long long int
#define f(i,a,n)    for(int i = a; i < (n); ++i)
#define fe(i, a, n)  for(int i = a; i <= (n); ++i)
#define fr(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define input(arr,n) for(int i=0;i<n;i++) cin>>arr[i];
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define mod 1000000007
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MAX 100
int countWays(vector<int>arr, int m, int N) 
{ 
    ll count[N + 1]; 
    memset(count, (ll)0, sizeof(count)); 
      
    // base case 
    count[0]=1;
      for (ll i = 1; i <= N; i++) 
        for (ll j = 0; j < m; j++) 
  
            if (i >= arr[j]) {
                count[i] += count[i - arr[j]]; 
                count[i]=(count[i]+mod)%mod;
            }

      
    // required number of ways  
    return count[N]%mod; 
      
} 

void solve()
{
	int n,k=3;;
	cin>>n;
	vector<int>arr;
	for(int i=3;i<=n;i++){
		arr.pb(i);
	}
	cout<<countWays(arr,arr.size(),n)<<endl;
	


}

signed main()
{
    FIO;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t=1;
    //cin >> t;
    while(t--)
        solve();
    return 0;
}



Measured memory_bytes: 3668
import qualified Data.Vector.Unboxed as V
import Data.Array.IArray (listArray, accumArray, (!))
import Data.Array.MArray
import Data.Array.ST (STUArray, runSTUArray)
import Data.Array.Unboxed (UArray)
import Data.List (sortOn, sortBy, unfoldr, partition)
import Data.Char (isSpace)
import Control.Monad.ST (ST)
import Control.Monad.Trans.State (StateT(..))
import qualified Data.ByteString.Char8 as B

import Debug.Trace (trace)

-- utility functions

tr = id

--   Input functions
readInt = B.readInt . B.dropWhile isSpace

readInts :: Int -> B.ByteString -> [Int]
readInts n = take n . unfoldr readInt

readIntsV :: Int -> B.ByteString -> V.Vector Int
readIntsV n = V.unfoldrN n readInt

readIntsA :: Int -> B.ByteString -> UArray Int Int
readIntsA n bs = runSTUArray $ do
  arr <- newArray_ (0,n-1)
  go arr 0 bs
  return arr
  where
    go :: STUArray s Int Int -> Int -> B.ByteString -> ST s ()
    go arr i bs
      | i==n = return ()
      | otherwise = do
        let Just (x,bs') = readInt bs
        writeArray arr i x
        go arr (i+1) bs'

readTsV :: Int -> B.ByteString -> V.Vector (Int,Int)
readTsV n = V.unfoldrN n $ runStateT ((,) <$> StateT readInt <*> StateT readInt)

readTs :: Int -> B.ByteString -> [(Int,Int)]
readTs n = take n . unfoldr readT where
  readT = runStateT ((,) <$> StateT readInt <*> StateT readInt)


-- main
solv h w mat = all check [(i,j)| i<-[0..w-1], j<-[0..h-1]]
  where
    check (x,y)
      | ix x y == '.' = True
      | otherwise =
        any (=='#') $ tr [ix x' y'| (x',y')<-around x y, inRange w x', inRange h y']
    inRange si i = 0 <= i && i < si
    around x y = [(x+1,y), (x-1,y), (x, y+1), (x, y-1)]
    ix x y = B.index mat $ y*w + x

main = do
  [h,w] <- map read . words <$> getLine
  mat <- (B.concat . B.lines) <$> B.getContents
  let res = solv h w mat
  putStrLn $ if res then "Yes" else "No"


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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	ll i,j,n,m,k,cnt=0,ans=0,t=1;
	cin>>n;
	ll b[n-1];
	rep(i,0,n-1) cin>>b[i];
	ll a[n];
	a[0]=b[0];
	rep(i,1,n-1){
		a[i]=min(b[i-1],b[i]);
	}	
	a[n-1]=b[n-2];
	rep(i,0,n) ans+=a[i];
	ret(ans)
	return 0;
}

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

using namespace std;

typedef long long ll;
#define eb emplace_back

int main() {
    int n, p;
    cin >> n >> p;
    string s;
    cin >> s;
    ll ans = 0;
    if (p == 2) {
        for (int i = 0; i < n; ++i) {
            if ((s[i] - '0') % 2 == 0)
                ans += i + 1;
        }
    } else if (p == 5) {
        for (int i = 0; i < n; ++i) {
            if ((s[i] - '0') % 5 == 0)
                ans += i + 1;
        }
    } else {
        map<int, ll> mp;
        ++mp[0];
        int t = 0, p2 = 1;
        for (int i = n - 1; ~i; --i) {
            t = (t + (s[i] - '0') * p2) % p;
            ans += mp[t];
            ++mp[t]; 
            p2 = (p2 * 10) % p;   
        }
    }
    cout << ans << "\n";
    return 0;
}

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

int main() {

	int n;
	cin >> n;
	vector<pair<string, int> > vc;
	for (int i=0; i<n; i++) {
		string a;
		cin >> a;
		int x;
		cin >> x;
		vc.push_back(make_pair(a, x));
	}
	
	string se;
	cin >> se;
	int ta = 0;
	for (int i=0; i<n; i++) {
		if (vc[i].first == se) ta = i;
	}
	
	int sm = 0;
	for (int j=ta+1; j<n; j++) {
		sm += vc[j].second;
	}
	cout << sm << endl;
	
}


Measured memory_bytes: 256
r,c=map(int,input().split())
grid=[[__ for __ in input()] for _ in range(r)]
grid2=[["#" for _ in range(c)] for _ in range(r)]
def pos(x,y):
    dx = [+0, +0, +1, -1, -1, +1, -1, +1]
    dy = [-1, +1, +0, +0, +1, +1, -1, -1]
    tot=0
    for a,b in zip(dx,dy):
        if 0<=a+x<r and 0<=b+y<c and grid[a+x][b+y]=="#":
            tot+=1
    return str(tot)
for i in range(r):
    for j in range(c):
        if grid[i][j]=='.':
            grid2[i][j]=pos(i,j)
for __ in grid2:
    print(''.join(__))


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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    for (int i = 0; i < n; i++) cin >> q[i];
    vector<int> a(n);
    for (int i = 0; i < n; i++) a[i] = i + 1;
    map<vector<int>, int> b;
    do {
        b[a] = b.size();
    } while (next_permutation(a.begin(), a.end()));
    cout << abs(b[p] - b[q]) << endl;

    return 0;
}

Measured memory_bytes: 8620
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 205;
const int MAXM = 10000005;
int n, x[MAXN], f[MAXM], p[MAXM], cnt, match[MAXN], w[MAXN][MAXN];
bool ip[MAXM];
void pre(int N) {
	for(int i = 2; i <= N; ++i) {
		if(!ip[i]) p[++cnt] = i;
		for(int j = 1; j <= cnt && p[j]*i <= N; ++j) {
			ip[p[j]*i] = 1;
			if(i % p[j] == 0) break;
		}
	}
}
bool vis[MAXN];
bool dfs(int u) {
	for(int v = 1; v <= n; ++v)
		if(w[u][v] && !vis[v]) {
			vis[v] = 1;
			if(!match[v] || dfs(match[v])) {
				match[v] = u;
				match[u] = v;
				return 1;
			}
		}
	return 0;
}
int maxmatch() {
	int re = 0;
	for(int i = 1; i <= n; ++i)
		if(x[i]&1) {
			memset(vis,0,sizeof vis);
			re += dfs(i);
		}
	return re;
}
int main () {
	scanf("%d", &n);
	for(int i = 1,y; i <= n; ++i) scanf("%d", &y), f[y] = 1;
	for(int i = 10000001; i >= 1; --i) f[i] ^= f[i-1];
	n = 0;
	for(int i = 1; i <= 10000001; ++i) if(f[i]) x[++n] = i;
	pre(x[n]); ip[2] = ip[1] = 1;
	for(int i = 1; i <= n; ++i)
		for(int j = i+1; j <= n; ++j)
			if(!ip[x[j]-x[i]])
				w[i][j] = w[j][i] = 1;
	int ans = maxmatch();
	int c1 = 0, c2 = 0;
	for(int i = 1; i <= n; ++i)
		if(!match[i]) (x[i] & 1) ? ++c1 : ++c2;
	ans += 2*(c1/2) + 2*(c2/2) + (c1&1)*3;
	printf("%d\n", ans);
}


Measured memory_bytes: 55552
/**
*    author:  Dooloper
*    created: 06.06.2020 10:26:45
**/

#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <functional>
#include <cassert>


using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main() {
    cin.tie(0);
    int N;
    cin >> N;
    N %= 10;
    if (N == 2 || N == 4 || N == 5 || N == 7 || N == 9)
    {
        cout << "hon" << endl;
    }
    else if (N == 0 || N == 1 || N == 6 || N == 8)
    {
        cout << "pon" << endl;
    }
    else
    {
        cout << "bon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include<cstdio>
#include<iostream>
#include<fstream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define Set(a) memset(a,0,sizeof(a))
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define openf(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define re register
#define ri re int
#define il inline
typedef long long ll;
typedef unsigned long long ull;
template<typename T> inline T rd(T& x)
{
	T f=1;x=0;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(T)(c-'0');
	x*=f;
	return x;
}
ll rd(){ll x;rd(x);return x;}
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
const int inf=1<<30;

const int N=200005;
char s[N];int n,k,c;
int pre[N],nxt[N];
bool f1[N],f2[N];
int main()
{
	rd(n);rd(k);rd(c);
	scanf("%s",s+1);
	pre[0]=0;F(i,1,n) pre[i]=s[i]=='o'?i:pre[i-1];
	nxt[n+1]=n+1;UF(i,n,1) nxt[i]=s[i]=='o'?i:nxt[i+1];
	//F(i,1,n) cout<<pre[i]<<' ';cout<<endl;
	//F(i,1,n) cout<<nxt[i]<<' ';cout<<endl;
	int mx=0,t=1;
	while(1<=t&&t<=n)
	{
		t=nxt[t];
		if(1<=t&&t<=n) {f1[t]=true;t+=c+1;}
	}
	//F(i,1,n) cout<<f1[i]<<' ';cout<<endl;
	mx=0,t=n;
	while(1<=t&&t<=n)
	{
		t=pre[t];
		if(1<=t&&t<=n) {f2[t]=true;t-=c+1;++mx;}
	}
	//F(i,1,n) cout<<f2[i]<<' ';cout<<endl;
	if(mx!=k) return 0;
	F(i,1,n) if(f1[i]&&f2[i]) printf("%d\n",i);
	return 0;
}

Measured memory_bytes: 3584
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val S = sc.next()
        val T = sc.next()
        var ans = 0
        for (i in S.indices) {
            if (S[i] != T[i]) ans++
        }
    pw.println(ans)
    }
}


Measured memory_bytes: 41984
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;

#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 

#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define len length
#define ret0 return 0
#define ret return 

#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound

#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>

// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;

#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN 2005

ll n, m;
ll s[MAXN], t[MAXN];
ll dp[MAXN][MAXN];

ll func(ll i, ll j){
    if(i == n || j == m){
        ret0;
    }
    else if(dp[i][j] !=-1) ret dp[i][j];
    else {
        if(s[i] == t[j]){
            return dp[i][j] =  (1 + (func(i+1, j)%mod + func(i, j+1)%mod)%mod)%mod;
        }
        else if(s[i] != t[j]){
            ret dp[i][j] = ((func(i+1, j)%mod + func(i, j+1)%mod)%mod - func(i+1, j+1)%mod + mod)%mod;
        }
    }
}

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

    cin>>n>>m;
    loop(i,0,n) cin>>s[i];
    loop(i,0,m) cin>>t[i];
    loop(i,0,MAXN) loop(j,0,MAXN) dp[i][j] = -1;
    print(func(0, 0) + 1);
   
}



Measured memory_bytes: 31872
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb emplace_back
#define koto_memory(a) cout<<(sizeof(a)/1048576.0)<<" MB";
#define res(v) sort(all(v)),v.erase(unique(all(v)), v.end());
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
#define deb(x) cout<<"\n["<<#x<<" = "<<x<<"]\n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
string s,t;int n,m,ans=inf;
void solve(){
  cin>>s>>t;n=s.length(),m=t.length();
  rep(i,0,n-1){
    int cnt=0;
    rep(j,0,m-1){
      if(i+j<s.length())
      cnt+=(s[i+j]!=t[j]);
      else cnt=inf;
    }
    ans=min(cnt,ans);
  }
  cout<<ans;
}
int32_t main()
{
  ibs;cti;
  solve();return 0;
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,a,b,count=0,sum=0;
    cin >> n >> a >> b;
    char c;
    for(int i=0;i<n;i++){
        cin >> c;
        if(c == 'a'){
            if(count<a+b){
                cout << "Yes" << endl;
            }else{
                cout << "No" << endl;
            }
            count++;
        }else if(c == 'b'){
            if(count<a+b&&sum<b){
                cout << "Yes" << endl;
                count++;
                sum++;
            }else{
                cout << "No" << endl;
            }
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3592
def strr():
 a=raw_input()
 return a
def sstrr():
 a=raw_input().split()
 return a
def intt():
 a=int(raw_input())
 return a
def iintt():
 a=[int(s) for s in raw_input().split()]
 return a
def nestt(t):
 a=[raw_input().split() for s in range(t)] 
 return a

nr=iintt()
n=nr[0]
r=nr[1]
if n>=10:
 a=r
else:
 a=r+100*(10-n)
print a

Measured memory_bytes: 2696
#include<stdio.h>
#include<stdlib.h>

int main(){
	int i,n;
	int a,b,c;
	scanf("%d", &n);
	for(i=0;i<n;i++){
		scanf("%d %d %d", &a,&b,&c);
		if(a*a==b*b+c*c || b*b==a*a+c*c || c*c==a*a+b*b) printf("YES\n");
		else printf("NO\n");
	}
    return 0;
}

Measured memory_bytes: 580
n = int(input())
a = tuple(map(int, input().split()))

if(n <= 3):
    print(max(a))
    exit()

dp = [[0] * 2 for _ in range(n+1)]
dp[1][1] = a[0]
dp[2][1] = a[1]
dp[3][0] = a[2]
dp[3][1] = a[0] + a[2]

for i in range(4,n+1):
    if(i%2 == 0):
        dp[i][1] = a[i-1] + max(dp[i-2][1], dp[i-3][1])
    else:
        dp[i][0] = a[i-1] + max(dp[i-2][0], dp[i-3][1], dp[i-4][1])
        dp[i][1] = a[i-1] + dp[i-2][1]

if(n%2==0):
    ans = max(dp[-1][1], dp[-2][1])
else:
    ans = max(dp[-1][0], dp[-2][1], dp[-3][1])

print(ans)

Measured memory_bytes: 50800