akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

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

/*==================================================*/
/*variable*/
int N, C;
int s[100005], t[100005], c[100005];
int sum[200005];

/*==================================================*/
/*function*/

/*==================================================*/

int main() {
    cin>>N>>C;
    REP(i,0,N){
        cin>>s[i]>>t[i]>>c[i];
    }

    REP(i,0,C){
        int ts[200005];
        REP(j,0,200005) ts[j] = 0;

        REP(j,0,N){
            if(c[j]-1 == i){
                ts[s[j]*2-1]++;
                ts[t[j]*2]--;
            }
        }
        REP(j, 1, 200005) ts[j] += ts[j-1];
        REP(j, 0, 200005) if(ts[j] > 0) sum[j]++;
    }

    int ans = 0;
    REP(i,0,200005){
        ans = max(ans, sum[i]);
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 2944
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    int H, W, i, j, count=0;
    string A[20];

    cin >> H >> W;

    for(i=1; i<=H; i++){
        for(j=1; j<=W; j++){
            cin >> A[i][j];

            if(A[i][j] == '#'){
                count++;
            }
        }
    }

    if(count == H+W-1){
        cout << "Possible" << endl;
    }
    else{
        cout << "Impossible" << endl;
    }

    return 0;
}

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<int> cnt(26);
  rep(i, N) cnt[S[i] - 'a']++;
  ll ans = 1;
  rep(i, 26) { ans = (ans * (cnt[i] + 1)) % 1000000007; }
  cout << ans - 1 << endl;
  return 0;
}


Measured memory_bytes: 512
#include <cassert>
#include <cstdlib>
#include <iostream>
#include <stdint.h>
using namespace std;

int main()
{
    int64_t N;
    cin >> N;

    for (int64_t h = 1; h <= 3500; h++) {
        for (int64_t n = 1; n <= 3500; n++) {
            // cout << h << ", " << n << endl;

            int64_t den = h * n * N;
            int64_t num = 4 * h * n - h * N - n * N;

            if (num > 0 && den % num == 0) {
                int64_t w = den / num;
                cout << h << " " << n << " " << w << endl;
                return 0;
            }
        }
    }
    abort();

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
#include <math.h>

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int h,w;
    while(cin>>h>>w,h!=0 && w!=0){
	reps(i,h){
	    reps(j,w){
		cout<<'#';
	    }
	    cout<<'\n';
	}
	cout<<'\n';
    }
    return 0;
}



Measured memory_bytes: 3136
n = int(input())
h = list(map(int, input().split()))

if h[0]>0:
    h[0] -= 1

for i in range(n-1):
    if h[i+1]>h[i]:
        h[i+1] -= 1
    if h[i+1]<h[i]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 14252
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = getLine >>= print . solve 

solve :: String -> Int
solve = minimum . count
    where
        count s@(_ : _ : _ : _) = abs (753 - v) : count (tail s)
            where
                v = read $ take 3 s
        count _ = []

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

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

int main(){
    int l;
    cin >> l;
    stack<int> s;
    bool b[101] = {};
    for(int i = 1; i <= l; i++){
        int x;  cin >> x;
        bool ok = true;
        if(x > 0){
            if(b[x])    ok = false;
            b[x] = true;
            s.push(x);
        }else{
            x = -x;
            if(s.empty() || s.top() != x)  ok = false;
            if(!s.empty())  s.pop();
            b[x] = false;
        }
        if(!ok){
            cout << i << endl;
            return 0;
        }
    }
    cout << "OK" << endl;
    return 0;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
int main(){
	long int t,a,b,ans=0,cnt=0;
	cin>>t;
	for(int i=1;i<t;i++){
		for(int j=1;j<t;j++){
			if(t-i*j>0){
				ans++;
			}
			else{
				break;
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <queue>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::vector;

struct Cell {
  int x;
  int y;
  int cost;
};

bool operator<(const Cell &lhs, const Cell &rhs) { return lhs.cost < rhs.cost; }
bool operator>(const Cell &lhs, const Cell &rhs) { return lhs.cost > rhs.cost; }

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

  vector<vector<char>> map(H + 1, vector<char>(W + 1));
  vector<vector<int>> cost(H + 1, vector<int>(W + 1, -1));

  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      char cell;
      cin >> cell;
      map[i][j] = cell;
    }
  }

  std::priority_queue<Cell, std::vector<Cell>, std::greater<Cell>> queue;
  int init_cost = (map[1][1] == '.') ? 0 : 1;
  queue.push({1, 1, init_cost});

  while (!queue.empty()) {
    auto cell = queue.top();
    queue.pop();
    int x = cell.x;
    int y = cell.y;

    if (x < W && cost[y][x + 1] == -1) {
      int move_cost = (map[y][x] == map[y][x + 1]) ? 0 : 1;
      cost[y][x + 1] = cell.cost + move_cost;
      queue.push({x + 1, y, cost[y][x + 1]});
    }
    if (y < H && cost[y + 1][x] == -1) {
      int move_cost = (map[y][x] == map[y + 1][x]) ? 0 : 1;
      cost[y + 1][x] = cell.cost + move_cost;
      queue.push({x, y + 1, cost[y + 1][x]});
    }
  }
  int ans = cost[H][W];
  if (map[H][W] == '#') ans++;
  cout << ans / 2 << endl;
}


Measured memory_bytes: 256
def main():
    X = int(input())

    a = X // 200
    print(10 - a)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


Measured memory_bytes: 9084
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define N 1000005
using namespace std;

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

int n,w[N],mn = inf, top;
int main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    cin >> n;

    for(int i = 0; i < n; i++)
    {
      cin >> w[i];
      top += w[i];
    }

    int a1 = 0;
    for (int i = 0; i < n; i++) {
      a1 += w[i];
      int a2 = top - a1;
      mn = min(mn, abs(a1 - a2));
    }

    cout << mn;
    return 0;
}


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

#define REP(i,n) for(int i=0;i<(n);++i)
const long long INF = 1LL<<60;
const long long mod=1e9+7;

int main(){
    string S;
    cin >> S;
    if(S[0] == S[1] && S[2] == S[3] && S[1] != S[2]) cout << "Yes" << endl;
    else if(S[0] == S[3] && S[1] == S[2] && S[3] != S[1]) cout << "Yes" << endl;
    else if(S[0] == S[2] && S[1] == S[3] && S[0] != S[1]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<bitset>
#include<algorithm>
using namespace std;
const int N=1e3+88;
int tim[N],be[N],inv[N],ans[N];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;++i) scanf("%d%d%d",tim+i,be+i,inv+i);
	int now=0;
	ans[n]=0;
	for(int i=n-1;i>=1;--i) {
		int now=0;
		for(int j=i;j<n;++j) {
			if(now<be[j]) now=be[j];
			else if((now-be[j])%inv[j]) now+=inv[j]-(now-be[j])%inv[j];
			now+=tim[j];
		}
		ans[i]=now;
	}
	for(int i=1;i<=n;++i) printf("%d\n",ans[i]);
} 

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);++i)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;--i)
#define FOR(i,s,n) for(int i = s;i < (int)n;++i)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;--i)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline void out(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout<<t<<" ";out(ts...);}
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
constexpr int INF = 1e18;



signed main(){
	int N,K;
	cin >> N >> K;
	int cnt = 0;
	while(N){
		N /= K;
		cnt++;
	}
	out(cnt);
}

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

using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define pb push_back
// #define int long long
// const int MAX=1e9;

signed main(){

	int n,k;
	int total=0;

	cin>>n>>k;

	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		
		// cout<<min(a,k-a)<<endl;

		total+=(min(a,k-a)*2);

	}
	cout<<total<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
  char s1[12], s2[12];
  scanf("%s%s", s1, s2);
  for(int i=0; i<strlen(s1); i++){
    if(s1[i] != s2[i]){
      printf("No\n");
      return 0;
    }}
  printf("Yes\n");
 
 
 
 
  return 0;
}

Measured memory_bytes: 1620
import qualified Data.IntMap as IM
import qualified Data.Vector as V
main=print.solve.map(map read.words).lines=<<getContents
solve([n,m]:abs)=fst(f g(-1)0 IM.empty)-1 where
  g=V.accum(flip(:))(V.replicate n[])$concatMap(\[a,b]->[(a,b),(b,a)])$map(map pred)abs
f g s t v=(c+if p==w IM.! t then 1 else 0,w)where
  p=IM.size v
  (c,w)=foldr h(0,IM.insert t p v)$g V.! t
  h i a@(c,v)
    |i==s=a
    |IM.member i v=(c,IM.adjust(min(v IM.! i))t v)
    |otherwise=let(d,w)=f g t i v in(c+d,IM.adjust(min(w IM.! i))t w)

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

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(ll i=ll(m); i<ll(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int  INF = (1 << 30) - 1;
const ll INFL = 1LL << 60;
const ll mod = 10000000007;




int main() {

	int n;
	cin >> n;

	ll m = 1000;
	ll s = 0;

	VLL a(n);
	REP(i, n)cin >> a[i];

	FOR(i, 1, n) {
		if (a[i] > a[i - 1]) {
			s += m / a[i - 1];
			m = m % a[i - 1];
		}
		else {
			m += s * a[i - 1];
			s = m / a[i];
			m %= a[i];
		}
		//cout << m << ' ' << s << endl;
	}

	m += a[n - 1] * s;
	cout << m << endl;


}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for (int i = a; i < (int)b; ++i)
#define rrep(i, n) for (int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep (i, n) cin >> a[i];
    sort(a.begin(), a.end());
    int res = 0;
    rep (i, k) res += a[i];
    cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <iomanip>
#include <map>
using namespace std;



int main()
{
   for (int i = 0; i < 5; i++)
   {
      int x;
      cin >> x;
      if (x == 0)
      {
         cout << i + 1;
      }
   }

   return 0;
}

Measured memory_bytes: 3584
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    let d: Vec<char> = buf.trim().chars().collect();
    if d[0] == d[1] && d[1] == d[2] || d[1] == d[2] && d[2] == d[3] {
        println!("Yes");
    } else {
        println!{"No"};
    }
}


Measured memory_bytes: 4352
import sys
from operator import itemgetter
import collections
import math


def r(s):
    a = s.count('a')
    b = s.count('b')
    c = s.count('c')
    ma = max(a, b, c)
    mn = min(a, b, c)
    return 'YES' if 1 >= ma - mn else 'NO'


def main():
    input = sys.stdin.readline
    s = input()
    print(r(s))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9440
#!/usr/bin/env python3
def primes(n):
    m = 10000
    is_prime = [True] * (m + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(m**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, m + 1, i):
            is_prime[j] = False
    return [i for i in range(m + 1)
            if is_prime[i] and str(i).endswith("3")][:n]


print(*primes(int(input())))


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF (int)1e9  //
#define LINF (ll)4e18  //
#define MOD (int)(1e9)+7
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define PI 3.1415926535898

//------------------------------------------------------

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
        cout << 0 << endl;
    } else {
        ll m = max({a, b, c});
        if (a == m) cout << b * c << endl;
        else if (b == m) cout << a * c << endl;
        else cout << a * b << endl;
    }

    return 0;
}



Measured memory_bytes: 256
require 'pp'

class Surface
  def initialize
    results = []

    while input = $stdin.gets 
      @map = Array.new(8).map{Array.new(8,0)}
      if input =~ /\d/
        @map[0] = input.chomp.split('')
        7.times do |n|
          @map[n+1] = $stdin.gets.chomp.split('')
        end

        results << check
      end
    end

    results.each do |ans|
      puts ans
    end
  end

  def check_bc(x,y)
    begin
      if @map[y+1][x] == "1"
        return "B"
      else
        return "C"
      end
    rescue
      return "C"
    end
  end

  def check_def(x,y)
    begin
      if @map[y][x+1] == "1"
        return "E"
      elsif @map[y+1][x-1] == "1"
        return "D"
      else
        return "F"
      end
    rescue
      return "D"
    end
  end

  def check_ag(x,y)
    begin
      if @map[y+1][x-1] == "1"
        return "G"
      else
        return "A"
      end
    rescue
      return "A"
    end
  end

  def check
    0.upto(7) do |y|
      0.upto(7) do |x|
        if @map[y][x] == "1"
          case get_around(x,y)
          when 1
            return check_bc(x,y)
          when 2
            return check_def(x,y)
          when 3
            return check_ag(x,y)
          end
        end
      end
    end
  end
  
  def range_check(x,y)
    0 <= x && x < 8 && 0 <= y && y < 8
  end

  def get_around(x,y)
    count = 0
    (y-1).upto(y+1) do |ypos|
      (x-1).upto(x+1) do |xpos|
        if range_check(xpos,ypos) && (xpos != x || ypos != y)
          count += 1 if @map[ypos][xpos] == "1"
        end
      end
    end
    return count
  end
end

s = Surface.new

Measured memory_bytes: 3560
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`
										`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	n := nextInt()
	c := next()

	rc := 0

	for i := 0; i < n; i++ {
		if c[i] == 'R' {
			rc++
		}
	}

	wc := 0
	for i := 0; i < rc; i++ {
		if c[i] == 'W' {
			wc++
		}
	}

	ans := wc

	//fmt.Fprintln(out, "[DEBUG]", a)
	fmt.Fprintln(out, ans)

}

// 挿入ソート配列
type slist struct {
	l []int
}

func makeSlist() slist {
	return slist{[]int{}}
}

func (s *slist) add(a int) {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	if pos < len(s.l) {
		s.l = append(s.l[:pos+1], s.l[pos:]...)
		s.l[pos] = a
	} else {
		s.l = append(s.l, a)
	}
}
func (s slist) contains(a int) bool {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	return pos < len(s.l) && s.l[pos] == a
}

//------------------------------------------------------------------------------

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func printArray(a []int) {
	for i := 0; i < len(a); i++ {
		if i >= 1 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, a[i])
	}
	fmt.Fprintln(out)
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}


Measured memory_bytes: 2204
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define Maxn 1000000 + 7
using namespace std;
string a,b;
int x = 0;
int main()
{
    cin>>a>>b;
    a = a + b;
    for (int i = 0; i < a.size(); i++)
    {
        x = x + pow(10,a.size() - i) * (a[i] - '0');
    }
    x/=10;
    int k = sqrt(x);
    if(k * k == x)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (ll i = (ll)(start); i < (ll)(n); ++i)
static const ll INFTY = 1L << 62L;
ll solver(string s,string t)
{
    ll ans=INFTY;
    rep(i,0,s.size()-t.size()+1){
        ll tmp=0;
        rep(j,0,t.size()){
            if(s[i+j]!=t[j])++tmp;
        }
        if(ans>tmp)ans=tmp;
    }
    return ans;
}
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
string s,t;
cin>>s>>t;
cout<<solver(s,t)<<endl;
}

Measured memory_bytes: 3664
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    long long N, K, i, j, h[100001], dp[100001];

    cin >> N >> K;

    for(i=1; i<=N; i++){
        cin >> h[i];
    }

    for(i=1; i<=N; i++){
        dp[i] = INF;
    }

    dp[1] = 0;

    for(i=1; i<=N; i++){
        for(j=1; j<=K; j++){
            if(i+j <= N){
                chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
            }
        }
    }

    cout << dp[N] << endl;

    return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < static_cast<int>(b); i++)
#define FORR(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) FOR (i, 0, n)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
template <typename T>
void print(const vector<vector<T>> matrix);
template <typename T>
void print(const vector<T> vec);
template <typename Arg>
void print(const Arg arg);
template <typename Head, typename... Args>
void print(const Head head, const Args... args);
template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
using ll = long long;

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

    int a, b;
    cin >> a >> b;

    if (a < 9 and b < 9)
        print("Yay!");
    else
        print(":(");

    return 0;
}

//---------------------------------------------
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    repall (i, vec)
        cout << i << ' ';
    cout << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()
#define INF 1000000000000000LL

struct edge {
    ll from, to, coin;
};

ll N, M;
edge es[5000];
ll d[2500];

bool longest_path() {
    FOR(i, 1, 2500) d[i] = INF;

    ll tmp = INF;
    REP(i, 2 * N) {
        for (edge e : es) {
            if (d[e.from] != INF && d[e.to] > d[e.from] + e.coin) {
                d[e.to] = d[e.from] + e.coin;
            }
        }
        if (i == N) tmp = d[N - 1];
    }
    if (tmp != d[N - 1]) return true;
    else return false;
}

int main() {
    int P;
    cin >> N >> M >> P;
    REP(i, M) {
        int A, B, C;
        cin >> A >> B >> C;
        A--; B--;
        es[i] = {A, B, P - C};
    }

    if (longest_path()) {
        cout << -1 << endl;
    }
    else {
        cout << max(0LL, -d[N - 1]) << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main(int argc, char *argv[]) {
  int point[100][100], path = 0;
  string s;
  while (getline(cin, s)) {
    for (int i = 0; i < s.size(); i++)
      s[i] = (s[i] == ',' ? ' ' : s[i]);
    stringstream ss(s);
    int tmp;
    int i = 0;
    while (ss >> tmp)
      point[path][i++] = tmp;
    path++;
  }

  for (int i = 1; i < path; i++)
    for (int j = 0; j < i+1; j++)
      if (i <= path / 2) {
        if (j-1 < 0)
          point[i][j] += point[i-1][j];
        else if (j == i)
          point[i][j] += point[i-1][j-1];
        else if (point[i-1][j] > point[i-1][j-1])
          point[i][j] += point[i-1][j];
        else
          point[i][j] += point[i-1][j-1];
      } else {
        if (point[i-1][j] > point[i-1][j+1])
          point[i][j] += point[i-1][j];
        else
          point[i][j] += point[i-1][j+1];
      }
  cout << point[path-1][0] << endl;
  return 0;
}

Measured memory_bytes: 1264
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

void Main()
{
	int N, M;
	std::cin >> N >> M;
	std::vector<std::multiset<std::int64_t>> works(M);
	for (int i : boost::irange(0, N))
	{
		int A;
		std::int64_t B;
		std::cin >> A >> B;
		if (A - 1 < M)
		{
			works[A - 1].emplace(B);
		}
	}
	std::multiset<std::int64_t> set;
	std::int64_t result = 0;
	for (int i : boost::irange(0, M))
	{
		for (auto v : works[i])
		{
			set.emplace(v);
		}
		auto ite = set.end();
		if (ite != set.begin())
		{
			--ite;
			result += *ite;
			set.erase(ite);
		}
	}
	std::cout << result << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 14336
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>

using namespace std;

#define ll long long

void solve()
{
    string S;
    cin >> S;
    int count = 0;
    for (int i = 0; i < S.size(); i++)
    {
        if (S[i] == '1')
        {
            count++;
        }
    }
    cout << count << endl;
    return;
}

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

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

process.stdin.on('data', function (chunk) {
    let lines = chunk.toString().split(' ');
    
    let arr= lines.map(n => parseInt(n));
    let v = parseInt(lines[0]);
    let h = parseInt(lines[1]);
    console.log(`${v * h} ${2 * (v + h)}`);
});


Measured memory_bytes: 15520
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

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

  int n, k, x, y;
  cin >> n >> k >> x >> y;

  if(n > k){
    cout<< k*x + (n-k)*y << endl;
  }
  else{
    cout << x*n << endl;
  }
  
  return 0;
}


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

int main() {
 	int X, Y; scanf("%d%d", &X, &Y);
    for (int A = 0, B = X; A <= X; A++, B--) {
     	if (A * 2 + B * 4 == Y) {
         	puts("Yes");
          	return 0;
        }
    }
  	puts("No");
  	return 0;
}

Measured memory_bytes: 3640
//Hey u r far away to know this
#include <bits/stdc++.h>
using namespace std;
#define     ff      	    	first
#define     pb 	         	push_back
#define     ss          		second
#define     ll      	    	long long
#define     MAX  	       	5000
#define     mpi         		map<int, int>
#define     mpll        		map<ll, ll>
#define     pll         		pair<ll, ll>
#define     plld        		pair<ll, double>
#define     SKILLER     		ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     vi          		std::vector<int>
#define     vll         		std::vector<ll>
#define     vs          		std::vector<string>
#define     vvi         		std::vector<std::vector<int>>
#define     vvll        		std::vector<std::vector<ll>>
#define     all(v)      		v.begin(), v.end()
#define     allr(v)      		v.rbegin(), v.rend()
#define     loop(i, a, b) 	for(int i = a; i < b; i++)
#define 	  debug(x) 		cout << x <<" " <<"\n";
#define 	  debug1(x, y) 	cout << x << " " << y  << "\n";
#define 	  debug2(x, y, z) 	cout << x << " " << y << " " << z<<"\n";
#define 	  int 			ll
const   int N = 1e6+5, Mod = 1e9 + 7;
int32_t main(){
    	SKILLER;
    
       string s, t; cin >> s >> t;
       int n = s.length();
       if(t.substr(0, n) == s){
       	if(t.length() - 1 == n)
       		cout << "Yes";
       	else cout << "No";
       }
       else cout << "No";
    	return 0;
}

Measured memory_bytes: 3656
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
//#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (10);   小数点以下１０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);

int main() {
  int n;
  cin >>n;
 
  int ans = 0;
  
  vector<int> p(n);
  rep(i,n) {
  cin >> p[i];
  }
  
  auto copy = p;
  
  sort(all(p));
  
  rep(i,n) {
    if(p[i]!=copy[i]) ans++;
  }
  
  cout << (ans==2 || ans==0?"YES":"NO") << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define FOR(i, a, b) for(decltype(b) i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
4
BRRR
)");
#define cin input
#endif

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

	string s;
	cin >> s;

	int a[26] = {};

	for (auto x : s)
		a[x - 'A']++;

	cout << (a['R' - 'A'] > a['B' - 'A'] ? "Yes" : "No") << endl;

	return 0;
}


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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<ll> acc(N + 1);
    for (int i = 0; i < N; i++) {
        acc[i + 1] = acc[i] + A[i];
    }

    ll ans = 1LL << 62;
    for (int b = 0; b <= N; b++) {
        int a1 = lower_bound(all(acc), acc[b] / 2) - acc.begin();
        int c1 = lower_bound(all(acc), (acc[N] - acc[b]) / 2 + acc[b]) - acc.begin();
        int a2 = a1 - 1;
        int c2 = c1 - 1;
        vector<ll> I1 = {a1}, I2 = {c1};
        if (a2 >= 0) I1.push_back(a2);
        if (c2 >= 0) I2.push_back(c2); 
        for (int i1 = 0; i1 < I1.size(); i1++) {
            for (int i2 = 0; i2 < I2.size(); i2++) {
                int a = I1[i1];
                int c = I2[i2];
                vector<ll> S = {acc[N] - acc[c], acc[c] - acc[b], acc[b] - acc[a], acc[a]};
                sort(all(S));
                ans = min(ans, abs(S[0] - S.back()));
            }
        }
    }
    cout << ans << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <math.h> 
#include <string> 
#include <algorithm>
using namespace std;

int main() {

	int H, W; cin >> H >> W;

	char a[1000][1000]; for (int i = 1; i <= H; i++) { for (int j = 1; j <= W; j++) cin >> a[i][j]; }

	int noh[1000], now[1000];

	for (int i = 1; i <= H; i++) {//圧縮できる列の操作。
		noh[i] = 0;
		for (int j = 1; j <= W; j++) if (a[i][j] == '#') noh[i] = 1;
	}

	for (int i = 1; i <= W; i++) {//圧縮できる行の操作。
		now[i] = 0;
		for (int j = 1; j <= H; j++) if (a[j][i] == '#') now[i] = 1;
	}
	// a[i][j] は noh[i] == 0 または now[j] == 0で圧縮される。


	for (int i = 1; i <= H; i++) { 
		for (int j = 1; j <= W; j++) {

			if (noh[i] == 1 && now[j] == 1) cout << a[i][j]; 

		}
		if (noh[i] == 1) cout << endl;
	}

}

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

string s;

int32_t main()
{
     cin >> s;
     int r;
     r = s[0] - '0';
     r *= 10;
     r += s[1] - '0';
     //int l = s.length();
     int ans = 9999999999999;
     for(int i = 2; s[i]; i++){
          r *= 10;
          r += s[i] - '0';
         // cout << r << endl;
          ans = min(ans, abs(r-753));
          int n = r%100;
          r = n;
     }
     cout << ans;
     return 0;
}


Measured memory_bytes: 256
#include <stdio.h> 

char w[110];
int cnt[30];
int check;
int main(){ 
	scanf("%s",w);
	for(int i=0;w[i]!='\0';i++){
		cnt[w[i]]++;
	}
	for(int i='a';i<='z';i++){
		if(cnt[i]%2)
			check=1;
	}
	if(check)
		printf("No");
	else
		printf("Yes");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);

#define N 4e7
#define nl "\n"
#define f first
#define s second
#define pi acos(-1.0)
#define MOD 1000000007
#define pb push_back
#define vector<int> VI;
#define vector<long long> VII;

typedef long long ll;
typedef double db;

using namespace std;
set<int>st;
int main()
{
    io;
    //freopen("in.txt" , "r" , stdin);
    //freopen("out.txt" , "w" , stdout);

    ///Let the showdown begin

    int t;
    cin >> t;

    int sz=t;
    while(t--)
    {
        int x;
        cin >> x;
        st.insert(x);
    }
    if(sz == (int)st.size())
        cout << "YES" << nl;
    else
        cout << "NO" << nl;

    ///Happily DONE
    return 0;
}


Measured memory_bytes: 12940
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n>=2000)
	{
		cout<<1<<endl;
		return 0;
	}
	int p1=n%100;
	int p2=n/100;
	if(p2*5>=p1)
		cout<<1<<endl;
	else
		cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
S=str(input())
A=int(S[0])
B=int(S[1])
C=int(S[2])
D=int(S[3])
value1=A+B+C+D
value2=A+B+C-D
value3=A+B-C+D
value4=A+B-C-D
value5=A-B+C+D
value6=A-B+C-D
value7=A-B-C+D
value8=A-B-C-D
sum_dict={"{0}+{1}+{2}+{3}".format(A,B,C,D):value1,\
"{0}+{1}+{2}-{3}".format(A,B,C,D):value2,\
"{0}+{1}-{2}+{3}".format(A,B,C,D):value3,\
"{0}+{1}-{2}-{3}".format(A,B,C,D):value4,\
"{0}-{1}+{2}+{3}".format(A,B,C,D):value5,\
"{0}-{1}+{2}-{3}".format(A,B,C,D):value6,\
"{0}-{1}-{2}+{3}".format(A,B,C,D):value7,\
"{0}-{1}-{2}-{3}".format(A,B,C,D):value8}

for k,v in sum_dict.items():
    if v==7:
        print(k+"=7",sep="")
        break

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


int main()
{
	int D;
	cin >> D;
	if (D == 25)
		cout << "Christmas" << endl;
	else if (D == 24)
		cout << "Christmas Eve" << endl;
	else if (D == 23)
		cout << "Christmas Eve Eve" << endl;
	else
		cout << "Christmas Eve Eve Eve" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int N; int M;
  cin >> N >> M;
  vector<int> v(N);
  int total=0;
    for(int i=0;i<N;i++){
      cin >> v.at(i);
      total += v.at(i);
    }
  sort(v.begin(), v.end());
  if(total <= v.at(N-M)*M*4){
    cout << "Yes";
  }else{
    cout << "No";
  }
}


Measured memory_bytes: 256
n,k = [int(x) for x in input().split()]
r,s,p = [int(x) for x in input().split()]
t = list(input())

for i in range(n-k):
    if t[k+i] == t[i]:
        t[k+i] = 0

print(t.count("r")*p + t.count("s")*r + t.count("p")*s)


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

int main(){
    string str; cin >> str;
    bool judge = true;

    for(int i = 0; i < str.length(); i+=2){
        if(str[i] == 'L') judge = false;
    }

    for(int i = 1; i < str.length(); i+=2){
        if(str[i] == 'R') judge = false;
    }

    cout << (judge ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define inRange(x,a,b) (a <= x && x < b)
typedef long long ll;

int main(){
    int x[4], y[4];
    while(cin >> x[0], x[0] < 4){
        cin >> y[0];
        for(int i = 1; i < 4; i++)  cin >> x[i] >> y[i];
        vector<int> v;
        for(int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){
                int origin = i*4+j;
                for(int k = 0; k < 4; k++){
                    int ni = i+x[k], nj = j+y[k];
                    if(!inRange(ni,0,4)||!inRange(nj,0,4))  continue;
                    int next = ni*4+nj;
                    v.push_back((1<<origin) + (1<<next));
                }
            }
        }
        sort(v.begin(),v.end());
        v.erase(unique(v.begin(),v.end()),v.end());
        vector<ll> dp(1<<16, 0);
        dp[0] = 1;
        for(int s = 0; s < 1<<16; s++){
            for(int j : v){
                if((s&j) == 0)  dp[s^j] += dp[s];
            }
        }
        cout << dp.back()/40320 << endl;
    }
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=100005;
//i_am_noob
int n;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9) print1("hon");
	else if(n%10==0||n%10==1||n%10==6||n%10==8) print1("pon");
	else print1("bon");
	return 0;
}

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

#define rep(ii,aa,bb) for(int (ii)=int(aa);(ii)<(int)(bb);++(ii))
#define ll long long
#define NL '\n'
#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define pi 2.0*acos(0.0)
#define eps 1e-11
#define sz(x) x.size()
#define FIN freopen("input.txt", "r", stdin);
#define FOUT freopen("output.txt", "w", stdout);

int main(){
    int a, b;
    cin >> a >> b;
    int s = a + b;
    if(a%3==0 || s%3==0 || b%3==0 ) cout << "Possible" << NL;
    else cout << "Impossible" << NL;
}








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

using db = double;
using ll = long long;
using vi = vector <int>;
#define op operator
#define pb push_back

int a[13][13];

int main() {
	cout << fixed << setprecision(9);
	ios :: sync_with_stdio(0);

	for(string s; cin >> s; ) {
		for(int i = 0; i < 10; i ++)
			a[0][i] = s[i] - '0';
		for(int i = 1; i < 10; i ++)
			for(int j = 0; j < 10 - i; j ++)
				a[i][j] = (a[i - 1][j] + a[i - 1][j + 1]) % 10;
		cout << a[9][0] << '\n';
	}

	return 0;
}

Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    lli A;
    string b;
    cin>>A>>b;
    string temp="";
    temp+=b[0];
    temp+=b[2];
    temp+=b[3];
    int tmp=stoi(temp);
    lli B=tmp;
    lli ans=A*B;
    ans/=100;
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  int a=0,b=0,o=0,ab=0;
  int x;
  char s[3];
  while(~scanf("%d,%s",&x,s)){
    if(s[0]=='A'){
      if(s[1]=='B')++ab;
      else ++a;
    }else if(s[0]=='B') ++b;
    else ++o;
  }
  cout<<a<<endl;
  cout<<b<<endl;
  cout<<ab<<endl;
  cout<<o<<endl;
  return 0;
}

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

int main() {
    int64_t n;
    cin >> n;
    for (auto i = 1; i <= n; i++) {
        if (i * (i + 1) / 2 >= n) {
            for (auto j = 1; j <= i; j++)
                if (i * (i + 1) / 2 - n != j)
                    cout << j << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=4003,INF=1<<30;
ll dis[MAX][MAX];
vector<pair<int,ll>> G[MAX];
int V;

struct edge{int from,to;ll dis;};

bool compare(edge a,edge b){
    return a.dis<b.dis;
}

int par[MAX];

void init(int n){
    for(int i=0;i<n;i++){
        par[i]=i;
    }
}

int root(int a){
    if(par[a]==a) return a;
    else return par[a]=root(par[a]);
}

void unite(int a,int b){
    if(root(a)!=root(b)) par[root(b)]=root(a);
}

bool check(int a,int b){
    return root(a)==root(b);
}

void BFS(){
    for(int i=0;i<V;i++){
        for(int j=0;j<V;j++){
            dis[i][j]=-1;
        }
        dis[i][i]=0;
        queue<int> Q;
        Q.push(i);
        
        while(!Q.empty()){
            int a=Q.front();Q.pop();
            for(int k=0;k<G[a].size();k++){
                int b=G[a][k].first;
                ll c=G[a][k].second;
                
                if(dis[i][b]!=-1) continue;
                
                dis[i][b]=max(dis[i][a],c);
                Q.push(b);
            }
        }
    }
}


int main(){
    
    int E;cin>>V>>E;
    vector<edge> S(E);
    for(int i=0;i<E;i++){
        int a,b;
        ll c;cin>>a>>b>>c;
        a--;b--;
        S[i]={a,b,c};
    }
    
    sort(all(S),compare);
    
    init(V);
    
    ll sum=0;
    
    for(int i=0;i<E;i++){
        int a=S[i].from,b=S[i].to;
        ll c=S[i].dis;
        if(check(a,b)) continue;
        unite(a,b);
        sum+=c;
        G[a].push_back({b,c});
        G[b].push_back({a,c});
    }
    
    BFS();
    
    int Q;cin>>Q;
    while(Q){
        int a,b;cin>>a>>b;
        a--;b--;
        cout<<sum-dis[a][b]<<endl;
        
        Q--;
    }
    
}



Measured memory_bytes: 133120
#include <bits/stdc++.h>
using namespace std;
int dp[11][10005];
int p[11], c[11];
int main(){
	int d, g;
	scanf("%d%d", &d, &g);
	for(int i=0;i<d;i++){
		scanf("%d%d", &p[i], &c[i]);
	}
	int ans = 1e9;
	for(int i=0;i<(1<<d);i++){
		int res = 0;
		int cnt = 0;
		priority_queue<int> pq;
		for(int j=0;j<d;j++){
			if((i>>j)&1){
				res += c[j] + p[j]*100*(j+1);
				cnt += p[j];
			}
			else{
				for(int k=0;k<p[j];k++){
					pq.push(100*(j+1));
				}
			}
		}
		while(res < g){
			cnt++;
			res += pq.top();
			pq.pop();
		}
		ans = min(ans, cnt);
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 256