akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i < n; ++i)
#define repe(i, n) for(int i=0; i <= n; ++i)
#define repr(i, n) for(int i=n-1; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)

using namespace std;
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 (b<a) {a = b; return 1;} return 0;}
template <class T> using V=vector<T>;
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main() {
    int m1,m2,d1,d2;
    cin >> m1 >> d1;
    cin >> m2 >> d2;
    if (m1 != m2) {
        cout << 1 << "\n";
    } else {
        cout << 0 << "\n";
    }
}




Measured memory_bytes: 256
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt();
    const isprime = function (p) {
        if (p == 1) return false;
        for (let i = 2; i < p; i++) {
            if (p % i == 0) return false;
        }
        return true;
    }
    let n = N, ans = [];
    for (let i = 31; i <= 55555 && n > 0; i += 30) {
        if (isprime(i) == true) {
            ans.push(i);
            n--;
        }
    }
    console.log(ans.join(' '));
}
class Inputer{constructor(t){if(typeof t=='undefined')throw new Error('引数（stdin）を省略できません！');this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

const int mxN = 2e5 + 2;
int n, k, nums[mxN], dp[mxN];

int main()
{
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> nums[i];
    
    for (int i = n - 2; i >= 0; i--)
    {
        int ret = 1e9;
        for (int j = 1; j <= k && i + j < n; j++)
        {
            ret = min(ret, dp[i + j] + abs(nums[i + j] - nums[i]));
        }
        dp[i] = ret;
    }
    cout << dp[0] << endl;
}

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

using namespace std;

int main()
{
    int n;
    cin >> n;
    for(int i = 1; i <= 9; i++)
    {
        for(int j = 1; j <= 9; j++)
        {
            if(i * j == n)
            {
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
}


Measured memory_bytes: 256
import math

def parent(i):
    return math.floor(i / 2)

def left(i):
    return 2 * i

def right(i):
    return 2 * i + 1

def get_largest(A, n, i):
    l = left(i)
    r = right(i)
    largest = None
    if l <= n and A[i] < A[l]:
        largest = l
    else:
        largest = i
    if r <= n and A[largest] < A[r]:
        largest = r
    return largest


def max_heapify(A, n, i):
    largest = get_largest(A, n, i)
    x = i
    while largest is not x:
        tmp = A[x]
        A[x] = A[largest]
        A[largest] = tmp
        x = largest
        largest = get_largest(A, n, x)

def build_max_heap(A, n):
    for i in range(math.floor(n/2), 0, -1):
        max_heapify(A, n, i)

n = int(input())
heap = [None] + list(map(int, input().split()))

build_max_heap(heap, n)

ans = ''
for i in heap[1:]:
    ans += ' {}'.format(str(i))
print(ans)

Measured memory_bytes: 65568
r, c, n = map(int, input().split())
dots = []
num = 0
for i in range(n):
	x1, y1, x2, y2 = map(int, input().split())
	if (0 < x1 < r and 0 < y1 < c) or (0 < x2 < r and 0 < y2 < c):
		continue
	else:
		num += 1
		d1 = (x1, y1)
		d2 = (x2, y2)
		if x1 == 0:
			dots.append((y1, i))
		elif y1 == c:
			dots.append((c + x1, i))
		elif x1 == r:
			dots.append((2 * c + r - y1, i))
		else:
			dots.append((2 * (r + c) - x1, i))

		if x2 == 0:
			dots.append((y2, i))
		elif y2 == c:
			dots.append((c + x2, i))
		elif x2 == r:
			dots.append((2 * c + r - y2, i))
		else:
			dots.append((2 * (r + c) - x2, i))

#print(dots)
if num <= 1:
	print("YES")
else:
	dots.sort(key=lambda x: x[0])
	stack = []
	for i in range(num * 2):
		if stack == []:
			stack.append(dots[i][1])
		else:
			if stack[-1] == dots[i][1]:
				stack.pop()
			else:
				stack.append(dots[i][1])
	if stack:
		print("NO")
	else:
		print("YES")

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

int main() {
	int w,h,x,y,r;

	std::cin>>w>>h>>x>>y>>r;

	if((x<=w-r)&&(x>=r)&&(y<=h-r)&&(y>=r )){

		std::cout<<"Yes"<<std::endl;
	}
	else{
		std::cout<<"No"<<std::endl;
	}

}



Measured memory_bytes: 3112
n = int(input())
a = list(map(int, input().split()))
ans = [0 for _ in range(n)]
total_rain = sum(a)
tmp = total_rain

#一つ飛ばしで合計から引いていく。
#X1 = S − (X2 + ... + XN ) = S − 2(A2 + A4 + ... + AN−1)がtmp
for r in a[:-1:2]:
  tmp -= r*2
  

#tmp=XN+1なのでX1も漸化式から計算
ans[-1] = tmp
ans[0] = a[-1] * 2 - tmp

tmp = ans[0]
#Xi+1 = 2Ai − Xi で他を求める
#i=n-1の時に最後もちゃんと更新される
for i in range(1, n-1):
    ans[i] = 2 * a[i-1] - ans[i-1]

print(*ans)

Measured memory_bytes: 14032
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
 
 
using namespace std;
void file(){
	#ifndef ONLINE_JUDGE
    	freopen("tst.txt", "r", stdin);
	#endif	
}
int tc;
const int N=3e5+5,M=3e5+5,MOD=1e9+7,OO=1e9;

int main()
{	
	//ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	//file();
 	
 	int r;
 	cin>>r;
 	printf("%d\n",r*r );
}


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

using namespace std;

int main(){
    int N, i, diff = 0;
    cin >> N;

    string A, B, C;
    cin >> A >> B >> C;

    for (i=0; i<N; i++){
        if (B[i] != A[i]) diff++;
        if (C[i] != A[i] && C[i] != B[i]) diff++;
    }

    cout << diff << '\n'; 
    
}

Measured memory_bytes: 256
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fi first
#define se second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>
 
using std::cin;
using std::cout;
using std::endl;
 
typedef long long ll;
typedef unsigned long long ull;
 
const int N = 100000 + 5;
const int M = 1000 + 5;
const int K = 1e7 + 5;
const int MOD = 1e9 + 7;
const int inv2 = 500000004;
const int LOG = 40;
const ull BASE = 19260817;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };
const double PI = acos(-1);
 
template<class T>
inline T readT() {
    T res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}
#define read readT<int>

int main() {
    bool flag = false;
    int n;
    cin >> n;
    for (int i = 0; i < 10000; i++) {
        int tmp = 4 * i;
        if (n - tmp >= 0 && (n - tmp) % 7 == 0) flag = true;
    }
    if (flag) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

main(){
    INCANT;
    int n, k, a, res = 0;
    string s;
    in(n, k);
    vector<int> q;
    rep(i, n){
        in(a);
        q.pb(a);
    }
    for(int l = 0; l <= min(k, n); l++){
        for(int r = 0; l + r <= min(k, n); r++){
            int lsum = 0, rsum = 0;
            priority_queue<int, vector<int>> qq;
            rep(i, l){
                lsum += q[i];
                qq.push(-q[i]);
            }
            rep(i, r){
                rsum += q[q.size() - 1 - i];
                qq.push(-q[q.size() - 1 - i]);
            }
            //debug(l), debug(r);
            int tmp = lsum + rsum;
            chmax(res, tmp);
            for(int del = 0; l + r + del < k; del++){
                if(!qq.empty()){
                    if(qq.top() > 0){
                        tmp += qq.top();qq.pop();
                    }

                }
                chmax(res, tmp);
                /*
                if(l==3 && r == 0){
                    debug(del);
                    debug(lsum), debug(rsum);

                }
                */

            }


        }
    }
    print(res);
}


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

using u64 = std::uint64_t;
constexpr u64 inf = std::numeric_limits<u64>::max();

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

namespace io {
  constexpr int is = 1 << 17;
  char ib[is], *ip = ib + is, it;
  inline char getc() {
    if (ip == ib + is) { read(STDIN_FILENO, ib, is); ip = ib; }
    return *ip++;
  }
  inline u64 scan() {
    u64 r = 0;
    if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';
    else while ((it = *ip++) & 16) r = r * 10 + it - '0';
    return r;
  }
  constexpr int os = 1 << 17;
  char ob[os], *op = ob, ot;
  inline void putc(const char c) {
    *op++ = c;
    if (op == ob + os) { write(STDOUT_FILENO, ob, os); op = ob; }
  }
  /* x shoud be greater than or equal to zero */
  inline void print(u64 x) {
    char d[20];
    int i = 0;
    while (true) {
      d[i] = x % 10 + 48;
      x /= 10;
      ++i;
      if (x <= 0) break;
    }
    while (i--) {
      putc(d[i]);
    }
  }
  inline void flush() {
    write(STDOUT_FILENO, ob, op - ob);
  }
}

signed main() {
  u64 n = io::scan();
  auto G = vector<vector<u64>>(n);
  auto H = vector<u64>(n);
  REP(i, n - 1) {
    u64 a = io::scan() - 1;
    u64 b = io::scan() - 1;
    G[a].push_back(i);
    G[b].push_back(i);
    H[i] = a ^ b;
  }
  u64 m = io::scan();
  auto paths = vector<u64>(m);
  auto collect = [&G, &H](auto &&collect, u64 u, u64 v, u64 p) -> u64 {
    if (u == v) return 0;
    for (auto e : G[u]) {
      u64 t = H[e] ^ u;
      if (t == p) continue;
      u64 s = collect(collect, t, v, u);
      if (s != inf) {
        return s | (1ULL << e);
      }
    }
    return inf;
  };
  REP(j, m) {
    u64 u = io::scan() - 1;
    u64 v = io::scan() - 1;
    paths[j] = collect(collect, u, v, -1);
  }
  auto search = [&paths](auto &&search, u64 ans, u64 j, u64 m, u64 mask) -> u64 {
    if (j != m) {
      return (
        search(search, ans, j + 1, m, mask)
      - search(search, ans, j + 1, m, mask | paths[j])
      );
    } else {
      return ans >> __builtin_popcountll(mask);
    }
  };
  u64 ans = search(search, 1ULL << (n - 1), 0, m, 0);
  io::print(ans);
  io::flush();
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    for(int i = 0; i < n; ++i)  cin >> a[i] >> b[i];
    ll ans = 0;
    ll sum = 0;
    for(int i = n - 1; i >= 0; --i){
        a[i] += sum;
        int foo = a[i] % b[i];
        foo = (foo != 0) ? (b[i] - foo) : 0;
        ans += foo;
        sum += foo;
    }
    cout << ans << endl;    
}

Measured memory_bytes: 1792
d, g = map(int, input().split())
pc = [0] + [[int(i) for i in input().split()] for i in range(d)]

def dfs(g, i):
    if i == 0:
        return 10 ** 12
    
    n = min(g // (100 * i), pc[i][0])
    score = n * 100 * i
    
    if n == pc[i][0]:
        score += pc[i][1]
        
    if g > score:
        n += dfs(g - score, i - 1)
        
    return min(n, dfs(g, i - 1))

print(dfs(g, d))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,n,m=1;
    cin>>n;
    for(i=1;i<=9;i++)
    {
        if(!(n%i)&&(n/i>=1&&n/i<=9))
        {
            puts("Yes");
            m=0;
            break;

        }
    }
    if(m)
        puts("No");
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using  namespace  std;
using ll=long long;
int main(){
  string s;
  cin>>s;
  int sum=0;
  for (int i=0;i<s.size();i++){
   if(s.at(i)=='+')sum++;
    else sum--;
}
  cout<<sum<<endl;
}

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

int main(){
  int n;
  cin >> n;
  VI h(n);
  rep(i,n) cin >> h[i];
  
  int cnt=0,max=0;
  rep(i,n-1){
    if(h[i+1] <= h[i]){
      cnt++;
    }else{
      cnt = 0;
    }
    if(cnt > max) max = cnt;
  }
  
  cout << max << endl;
  
  return 0;
}

Measured memory_bytes: 640
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra																													   																				   list<int>::iterator it;																								   
																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////

int a[100005];
int x[100005];
int y[100005];
int ans;
///////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////



/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	for(int i = 1; i <= n; i++){
		x[i] = __gcd(x[i-1], a[i]);
	}
	for(int i = n; i >= 1; i--){
		y[i] = __gcd(y[i+1], a[i]);
	}
	
	for(int i = 1; i <= n; i++){
		ans = max(ans, __gcd(x[i - 1], y[i + 1]));
	}
	
	cout << ans << endl;
	
	
	
	
	
    
    
	return 0;
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll k;
    string s;
    cin >> k >> s;
    ll n = s.length();
    if (n <= k) {
        cout << s << endl;
    } else {
        s = s.substr(0, k) + "...";
        cout << s << endl;
    }
    return 0;
}



Measured memory_bytes: 3632
#include <iostream>
#include <numeric>

using namespace std;

#define MAX 1<<15

int dp[MAX + 1][5] = {};

int main() {
	dp[0][0] = 1;
	for (int i = 1; i * i <= MAX; ++i)
		for (int j = i * i; j <= MAX; ++j)
			for (int k = 1; k < 5; ++k)
				dp[j][k] += dp[j - i * i][k - 1];
	int n;
	while (cin >> n, n)
	    cout << accumulate(dp[n] + 1, dp[n] + 5, 0) << endl;

	return 0;
}


Measured memory_bytes: 3720
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let s: Vec<char> = itr.next().unwrap().chars().collect();
    if s[2] == s[3] && s[4] == s[5] {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {  
  int N;
  cin >> N;
  vector<pair<int, int>> xy(N);
  for (int i = 0; i < N; i++) cin >> xy[i].first >> xy[i].second;
  sort(xy.begin(),xy.end());
 
  vector<bool> check(N);
  int ans = N;
  for (int i = 0; i < N-1; i++) {
    for (int j = i+1; j < N; j++) {
      int count = N;
      int p = xy[j].first - xy[i].first;
      int q = xy[j].second - xy[i].second;
      for (int k = 0; k < N-1; k++) {
        for (int l = k+1; l < N; l++) {
          int pp = xy[l].first - xy[k].first;
          int qq = xy[l].second - xy[k].second;
          if (p == pp && q == qq) count--;
        }
      }
      ans = min(ans,count);
    }
  }
  
  cout << ans << endl;      
}

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

#define ll long long
#define ld long double
#define COIN const int
#define ite iterator
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define sz(s) (s).size()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/
const ll mod=1e9+7;
const ll INF=1e18;
/*****************************************************************************/

using namespace std;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int x; cin >>x;
	if (x>=30) cout <<"Yes";
	else cout <<"No";
	return 0;
}
/******************************************************************************
******************************************************************************/


Measured memory_bytes: 3620
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<string,int> P;

int main(){
	
	int d;
	string ge5[] = {"* ="," *="};
	string lt5[] = {" ****","* ***","** **","*** *", "**** "};
	bool isnl=false;
	while(~scanf("%d",&d)){
		if(isnl) cout << endl;
		vector<string> res;

		string str;
		while(d>0){ str += (d % 10) + '0'; d/=10;}
		reverse(str.begin(),str.end());

		//for(int i=0;i<str.size();i++){if(!isdigit(str[i])) str = str.substr(0,i); break;}
		while(str.size()<5) str = "0" + str;
		for(int i=0;i<str.size();i++){
			string tmp="";
			tmp = ge5[(str[i]-'0') >= 5 ? 1 : 0];
			tmp = tmp + lt5[(str[i]-'0') % 5];
			res.push_back(tmp);
		}

		while(res.size()<5) res.push_back(ge5[0]+lt5[0]);

		char table[8][5];
		for(int i=0;i<8;i++){
			for(int j=0;j<5;j++){
				table[i][j]=res[j][i];
				//printf("%c%s",res[j][i],j==res.size()-1 ? "\n" : "");
			}
		}

		for(int i=0;i<8;i++){
			for(int j=0;j<5;j++){
				cout << table[i][j];
			}
			cout << endl;
		}
		isnl = true;
	}

	exit(0);
}

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

vector<int> a(1000001);
int n;

bool pairwise() {
  vector<int> d(1000001);
  d[1]=1;
  int maxa = 0;
  for(int i=0;i<n;i++) {
    maxa = max(maxa, a[i]);
  }
  vector<int> pr(1000001);
  int point=0;
  for (int i=2; i<=maxa; ++i) {
    if (d[i] == 0) {
        d[i] = i;
        pr[point++]=i;
    }
    for (int j=0; j<point && pr[j]<=d[i] && i*pr[j]<=maxa; ++j)
      d[i * pr[j]] = pr[j];
  }
  unordered_set<int> div;
  for(int i=0;i<n;i++){
    int e = a[i];
    while(e!=1) {
      if(div.find(d[e])!=div.end()) {
        return false;
      }
      div.insert(d[e]);
      int f = d[e];
      while(e%f==0) e/=f;
    }
  }
  return true;
}

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

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

    bool p = pairwise();
    if(p) {
      cout << "pairwise coprime";
      return 0;
    }

    int g = a[0];
    for(int i=1;i<n;i++) g = __gcd(g,a[i]);
    if(g==1) {
      cout << "setwise coprime";
      return 0;
    }

    cout << "not coprime";

    return 0;
}

Measured memory_bytes: 18388
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
t=(len(a)-2)//2
ans=a[0]
if (len(a)-2)%2==0:
  for i in range(1,t+1):
    ans+=a[i]*2
else:
  ans=ans+a[t+1]
  for i in range(1,t+1):
    ans+=a[i]*2
print(ans)


Measured memory_bytes: 31596
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int n,h,i,a[100010],b[100010],ans=0;
  cin >> n >> h;
  for (i=0;i<n;i++) cin >> a[i] >> b[i];
  sort(a,a+n,greater<int>());
  sort(b,b+n,greater<int>());
  i=0;
  while (h>0 && b[i]>a[0]){
    h-=b[i];
    i++;
    ans++;
  }
  if (h>0) ans+=(h+a[0]-1)/a[0];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
# ENV[Z = 'RUBY_THREAD_VM_STACK_SIZE'] || exec( { Z => '50000000' },'ruby',$0)
# readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) }
$a, $b = gets.split.map(&:to_i)

def valid?(e)
  hatipa = (e * 0.08).to_i
  zyuppa = (e * 0.1).to_i

  hatipa == $a && zyuppa == $b
end

(1..1300).to_a.each do |e|
  if valid?(e)
    puts e
    exit
  end
end

puts '-1'



Measured memory_bytes: 1916
#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 <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <bits/stdc++.h> // isupper, islower, isdigit, toupper, tolower
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pl;
typedef pair<int, int> P;
typedef vector<ll> Vll;
typedef vector<Vll> VVll;

bool isLunLun(ll input)
{
  bool lunlun = true;
  ll tmp = 0;
  ll tmp2 = 0;
  while (input)
  {
    tmp = input % 10;
    input /= 10;
    tmp2 = input % 10;
    if (input == 0)
    {
      break;
    }
    if (abs(tmp - tmp2) > 1)
    {
      lunlun = false;
    }
  }

  return lunlun;
}
int main()
{
  ll K, count;
  cin >> K;
  queue<ll> q;
  ll x;
  rep(i, 9)
  {
    q.push(i + 1);
  }
  rep(i, K - 1)
  {
    x = q.front();
    q.pop();
    if (x % 10 != 0)
    {
      q.push(10 * x + x % 10 - 1);
    }
    q.push(10 * x + x % 10);
    if (x % 10 != 9)
    {
      q.push(10 * x + x % 10 + 1);
    }
  }
  cout << q.front() << endl;

  return 0;
}


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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

int main(int argc, char const *argv[])
{
    int R;
    string ans = "AGC\n";
    cin >> R;
    if (R < 1200)
        ans = "ABC\n";
    else if (R < 2800)
        ans = "ARC\n";
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
#define all(x) begin(x), end(x)
#define lowbit(x) ((x) & -(x))
#define EB emplace_back
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define maxn 1005
using namespace std;

struct DSU {
    vector<int> s, p;
    DSU(int sz) : s(sz + 1, 1), p(sz + 1, -1) {}
    int find(int x) {
        return (p[x] == -1) ? x : (p[x] = find(p[x]));
    }
    bool join(int x, int y) {
        x = find(x);
        y = find(y);
        if(x == y) return false;
        if(s[x] < s[y]) swap(x, y);
        s[x] += s[y]; p[y] = x;
        return true;
    }
    int cnt() {
        int ret = 0;
        for(int i = 1; i < SZ(p); i++) {
            if(p[i] == -1) ret++;
        }
        return ret;
    }
};

int mx[4] = {0, 0, -1, 1};
int my[4] = {-1, 1, 0, 0};
char mp[maxn][maxn];
int id[maxn][maxn];
int n, m;

bool cool(int i, int j) {
    if(i < 0 || i >= n) return false;
    if(j < 0 || j >= m) return false;
    return mp[i][j] == '#';
}

int solve() {
    int R = 0, C = 0;
    for(int i = 0; i < n; i++) {
        int cnt = 0;
        if(mp[i][0] == '#') cnt++;
        if(mp[i][m - 1] == '#') cnt++;
        for(int j = 1; j < m; j++) {
            if(mp[i][j - 1] != mp[i][j]) cnt++;
        }
        if(cnt > 2) return -1;
        if(cnt) R++;
    }
    for(int j = 0; j < m; j++) {
        int cnt = 0;
        if(mp[0][j] == '#') cnt++;
        if(mp[n - 1][j] == '#') cnt++;
        for(int i = 1; i < n; i++) {
            if(mp[i - 1][j] != mp[i][j]) cnt++;
        }
        if(cnt > 2) return -1;
        if(cnt) C++;
    }
    if((R + C) > 0 && (R != n || C != m)) return -1;
    DSU loli(n * m);
    int cnt = 0;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            if(mp[i][j] == '.') cnt++;
            else {
                for(int k = 0; k < 4; k++) {
                    int ii = i + mx[k];
                    int jj = j + my[k];
                    if(cool(ii, jj)) {
                        loli.join(id[i][j], id[ii][jj]);
                    }
                }
            }
        }
    }
    return loli.cnt() - cnt;
}


int main() {
    //ios_base::sync_with_stdio(false);
    //cin.tie(nullptr);
    /*cin >> n >> m; int tot = 0;
    for(int i = 0; i < n; i++) {
        cin >> mp[i];
        for(int j = 0; j < m; j++)
            id[i][j] = ++tot;
    }
    cout << solve() << '\n';*/
    int n;
    cin >> n;
    vector<int> arr(n);
    for(auto &x : arr) cin >> x;
    sort(begin(arr), end(arr));
    int ans = 0;
    for(int i = 0; i < n; i++) {
        if(i & 1) ans -= arr[i];
        else ans += arr[i];
    }
    cout << abs(ans) << '\n';
    return 0;
}










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

vector<int> divisor(int n) {
  vector<int> res;
  for (int i = 1; i < floor(sqrt(n)) + 1; i++) {
    if (n % i) continue;
    int j = n / i;
    res.emplace_back(i);
    if (j != i) res.emplace_back(j);
  }
  sort(res.begin(), res.end());
  return res;
}

int gcd(int a, int b) {
  while (b) {
    int c = a % b;
    a = b;
    b = c;
  }
  return abs(a);
}

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

  int a, b, k;
  cin >> a >> b >> k;
  vector<int> cand = divisor(gcd(a, b));
  cout << cand[cand.size()-k] << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

void CountingSort(unsigned short*,unsigned short*,int *,int,int);

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code */
  j=-1;
  for(i=0;i<n;i++){ /* jに最大値を入れる＋ Aにすべての数を入れる */
    scanf("%d",&A[i]);
    if(j<A[i]) j=A[i];
  }
  
  CountingSort(A,B,C,j,n);
  


  for(i=1;i<=n;i++){
    printf("%d",B[i]);
    
    if(i!=n) printf(" ");
    else printf("\n");
  }

  return 0;
}

void CountingSort(unsigned short* A,unsigned short* B,int *C,int k,int n){
  int i;

  for(i=0;i<=k;i++) C[i]=0;/* Cを初期化 */

  for(i=0;i<n;i++) C[A[i]]++;

  for(i=1;i<=k;i++) C[i]=C[i]+C[i-1];

  for(i=n-1;i>=0;i--){
    B[C[A[i]]]=A[i]; 
    C[A[i]]--;
  }

  return;
}



Measured memory_bytes: 9596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  vector<int> A(N),B(N),C(N);
  int sum=0;
  
  cin >> N;
  for(int i=0; i < N; i++){
    cin >> A.at(i);
  }
  for(int i=0; i < N; i++){
    cin >> B.at(i);
  }
  for(int i=0; i < N-1; i++){
    cin >> C.at(i);
  }
  
  sum+= B.at(A.at(0)-1);
  //cout << sum <<endl;
  
  for(int i=1; i < N; i++){
    sum += B.at(A.at(i)-1);
    
    if(A.at(i) - A.at(i-1) == 1){
      sum += C.at(A.at(i)-2);
    }
    //cout << sum << endl;
  }
  cout << sum <<endl;
}

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

int main() {
  int N, Q;
  long long K;
  cin >> N >> K >> Q;
  vector<int> A(Q);
  vector<int> B(N);
  for(int i = 0; i < Q; i++) {
    cin >> A.at(i);
  }
  for(int i = 0; i < Q; i++) {
    B.at(A.at(i)-1)++;
  }
  for(int i = 0; i < N; i++) {
    if(B.at(i) >= Q-K+1) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 3972
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    m = I()
    aa = [LI() for _ in range(m)]
    r = 0
    cc = collections.defaultdict(int)
    for d,c in aa:
        cc[d] += c
    f = True
    r = 0
    v = []
    for i in range(10):
        s = str(i * 2)
        t = []
        for c in s:
            t.append(int(c))
        v.append(t)

    r = 0
    while f:
        f = False
        for i in range(1,10):
            t = cc[i]
            if t > 1:
                cc[i] = t % 2
                r += t // 2
                for c in v[i]:
                    cc[c] += t // 2
                f = True
    a = []
    for i,c in cc.items():
        if i == 0:
            r += c
        elif c > 0:
            a.append(i)

    t = a[0]
    for c in a[1:]:
        r += 1
        t += c
        while t > 9:
            r += 1
            t = t//10 + t%10

    return r


print(main())





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

int dp[101][1<<16],mask[101];
int l[100];
int main(){
	int n;
	while(scanf("%d",&n),n){
		memset(dp,0,sizeof(dp));
		memset(mask,0,sizeof(mask));
		rep(i,n){
			int m;scanf("%d%d",&m,&l[i]);
			rep(k,m){
				int s,e;scanf("%d%d",&s,&e);s-=6;e-=6;
				for(int j=s;j<e;j++)mask[i]|=1<<j;
			}
		}
		rep(i,n)rep(j,1<<16){
			dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
			if(!(j&mask[i]))dp[i+1][j|mask[i]]=max(dp[i+1][j|mask[i]],dp[i][j]+l[i]);
		}
		int Max=0;
		rep(i,1<<16){
			Max=max(Max,dp[n][i]);
		}
		printf("%d\n",Max);
	}
}

Measured memory_bytes: 29032
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    ll n;cin >> n;
    vl v={2,5,63,20,30};
    if(n<6){
      rep(i,n)cout << v[i] <<" ";
      cout <<endl;
      return 0;
    }
    set<ll> st;
    ll rap=0,count=1;
    while(n--){
        if(count==0)st.ins(6*rap);
        if(count==1)st.ins(6*rap+2);
        if(count==2)st.ins(6*rap+3);
        if(count==3)st.ins(6*rap+4);
        count++;
        if(count==4)count=0,rap++;
    }
    ll sum=0;
    for(auto p:st)sum+=p;
    if(sum%6==2)st.erase(8),st.ins(6*rap+6);
    if(sum%6==3)st.erase(9),st.ins(6*rap+6);
    if(sum%6==5)st.erase(9),st.ins(6*rap+4);
    for(auto p:st)cout << p <<" ";
    cout << endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  string a,b,c;
  cin>>a>>b>>c;
  int la=a.size(),lb=b.size(),lc=c.size();
  if(a[la-1]==b[0] && b[lb-1]==c[0]) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

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

int N;
vector<long long> A(300001);
vector<long long> vec(61);

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;

  cin >> N;
  for (int i = 0; i < N; ++i) {
    long long a;
    cin >> a;
    for(int j = 0; j < 61; ++j){
      if((a & 1) == 1){
        vec.at(j)++;
      }
      a >>= 1;
    }
  }

  long long x = 1;
  long long ans = 0;
  for(int i = 0; i < 61; ++i){
    ans += (vec.at(i) * (N - vec.at(i))) % 1000000007 * x % 1000000007;
    ans %= 1000000007;
    x *= 2;
    x %= 1000000007;
  }
  cout << ans <<endl;
}


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


int main(){
   int n,h,w;
   cin>>n>>h>>w;

   int a,b,ans=0;
   for (int i = 0; i < n; ++i){
      cin>>a>>b;
      if(a>=h && b>=w)
         ans++;
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 256
#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 <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#include <iomanip>
#define rep(i,x) for(ll i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}/*フィボナッチテンプレ
ll memo[50];
ll fibo(ll n) {
    if (memo[n] != 0)return memo[n];
    if (n <= 1)return memo[n] = n;
    else return memo[n] = fibo(n - 1) + fibo(n - 2);
}
*/
bool isp(ll n) {
    bool res = true;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            res = false;
            break;
        }
    }
    return res;
}

int main() {
  ll N;
  cin >> N;
  vector<ll> num(N);
  rep(i,N)cin >> num[i];
  ll a = 0;
  ll b = 0;
  sort(all(num));
  reverse(all(num));
  rep(i,N){
    if(i % 2 == 0)a += num[i];
    else b += num[i];
  }
  cout << a - b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/


string S;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> S;
    int n = S.length();

    string ans = "No";
    rep(i, 0, n - 1) {
        if (S[i] == 'A' && S[i + 1] == 'C') ans = "Yes";
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.BigInteger;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int w = sc.nextInt();
    char[][] box = new char[h][w];
    boolean[] row = new boolean[h];
    boolean[] col = new boolean[w];
    for (int i = 0; i < h; i++) {
      box[i] = sc.next().toCharArray();
    }
    // 行を見る
    for (int i = 0; i < h; i++) {
      boolean isWhite = true;
      for (int j = 0; j < w; j++) {
        if (box[i][j] == '#') {
          isWhite = false;
          break;
        }
      }
      if (isWhite == true) {
        row[i] = true;
      }
    }
    // 列を見る
    for (int i = 0; i < w; i++) {
      boolean isWhite = true;
      for (int j = 0; j < h; j++) {
        if (box[j][i] == '#') {
          isWhite = false;
          break;
        }
      }
      if (isWhite == true) {
        col[i] = true;
      }
    }
    // 出力
    for (int i = 0; i < h; i++) {
      if (row[i] == true) continue;
      for (int j = 0; j < w; j++) {
        if (col[j] == true) continue;
        System.out.print(box[i][j]);
      }
      System.out.println();
    }
  }
}


Measured memory_bytes: 38784
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long

int main() {
	int N, M, X, P = 0;
	string S;
	cin >> N >> M;
	vector<bool> A(N, 0);
	vector<int> B(N, 0);
	for (int i = 0;i < M;i++) {
		cin >> X >> S;
		if (S == "AC") {
			A[X - 1] = 1;
		}
		else {
			if (!A[X - 1])B[X - 1]++;
		}
	}
	X = 0;
	for (int i = 0;i < N;i++) {
		if (A[i]) {
			X++;
			P += B[i];
		}
	}
	cout << X << " " << P << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef vector<int>         vi;
const int mod = 1000000007;






int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,j;
    cin>>n;

    int arr[n];
    for( i =0;i < n;i++){
        cin>>arr[i];
    }
    for( i =n-1;i>=0;i=i-2){
        cout<<arr[i]<<" ";
    }
    if(i==-2){
        j=1;
    }
    else{
        j=0;
    }
    for(;j <n;j=j+2){
        cout<<arr[j]<<" ";
    }





}













































Measured memory_bytes: 3712
#include<stdio.h>
int main(void) {
	int w1, w2, w3, x1, x2, x3, y1, y2, y3, z1, z2, z3;
	scanf("%d %d %d %d %d %d %d %d",&w1,&w2,&x1,&x2,&y1,&y2,&z1,&z2);
	if(w1 == 1)
		w1 = 6000;
	else if(w1 == 2)
		w1 = 4000;
	else if(w1 == 3)
		w1 = 3000;
	else
		w1 = 2000;

	if(x1 == 1)
		x1 = 6000;
	else if(x1 == 2)
		x1 = 4000;
	else if(x1 == 3)
		x1 = 3000;
	else
		x1 = 2000;

	if(y1 == 1)
		y1 = 6000;
	else if(y1 == 2)
		y1 = 4000;
	else if(y1 == 3)
		y1 = 3000;
	else
		y1 = 2000;

	if(z1 == 1)
		z1 = 6000;
	else if(z1 == 2)
		z1 = 4000;
	else if(z1 == 3)
		z1 = 3000;
	else
		z1 = 2000;

	w3 = w1 * w2;
	x3 = x1 * x2;
	y3 = y1 * y2;
	z3 = z1 * z2;
	printf("%d\n%d\n%d\n%d\n",w3,x3,y3,z3);
	
	return 0;
}

Measured memory_bytes: 600
from collections import defaultdict
from functools import lru_cache
import sys
sys.setrecursionlimit(1000000)


N, M = map(int, input().split())
XY = [map(int, input().split()) for _ in range(M)]

dp = [-1 for _ in range(N + 1)]

x_to_y = defaultdict(list)
for x, y in XY:
    x_to_y[x].append(y)


@lru_cache(N)
def depth(n):
    ret = -1
    for y in x_to_y[n]:
        ret = max(ret, depth(y))
    return ret + 1


        
depths = [depth(n) for n in range(1, N + 1)]
print(max(depths))


Measured memory_bytes: 182992
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n;
	cin >> n;
	
	string ans;
	switch (n % 10) {
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		ans = "hon";
		break;
			
	case 0:
	case 1:
	case 6:
	case 8:
		ans = "pon";
		break;
			
	case 3:
		ans = "bon";
		break;
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 3608
// Problem : D - Flat Subsequence
// Contest : AtCoder - ACL Beginner Contest
// URL : https://atcoder.jp/contests/abl/tasks/abl_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// $%U%$
// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll power(ll x,ll y,ll m){if(y==0)return 1;ll p=power(x,y/2,m)%m;p=(p*p)%m;return (y%2==0)?p:(x*p)%m;}
ll nCr(ll n,ll r,ll m){if(r>n)return 0;ll a=1,b=1,i;for(i=0;i<r;i++){a=(a*n)%m;--n;}while(r){b=(b*r)%m;--r;}return (a*power(b,m-2,m))%m;}
#define Test int t;cin>>t;while(t--)
#define endl '\n'
vector<int> tree,v,t;
void update(int l,int r,int index,int cindex)
{
	if(l==r)
	{
		tree[index]=t[l];
		return;
	}
	int mid=(l+r)/2;
	if(cindex<=mid)
	update(l,mid,2*index+1,cindex);
	else
	update(mid+1,r,2*index+2,cindex);
	tree[index]=max(tree[index*2+1],tree[index*2+2]);
}

int find(int l,int r,int tl,int tr,int index)
{
	if(tl>tr)
	{
		return 0;
	}
	if(tl==l && tr==r)
	{
		return tree[index];
	}
	int mid=(l+r)/2;
	int t1=find(l,mid,tl,min(tr,mid),2*index+1);
	int t2=find(mid+1,r,max(tl,mid+1),tr,2*index+2);
	return max(t1,t2);
}

void solve()
{
	int n,k;
	cin >> n >> k;
	v = vector<int>(n);
	t = vector<int>(300001);
	tree = vector<int>(4*(300001));
	for(int i=0;i<n;++i)
	{
		cin >> v[i];
		int temp=find(0,300000,max(v[i]-k,0),min(v[i]+k,300000),0);
		//cout << temp << endl;
		t[v[i]]=temp+1;
		update(0,300000,0,v[i]);
	}
	cout << tree[0] << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//Test
	solve();
	return 0;
}


Measured memory_bytes: 10336
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b;
	int m[100010];
	cin>>a>>b;
	for(int i=0;i<a;i++) cin>>m[i];
	long long s=0;
	sort(m,m+a);
	for(int i=0;i<b;i++) s+=m[i];
	cout<<s;
}

Measured memory_bytes: 3688
#include <iostream>
#include <vector>
#include <cmath>
#include <typeinfo>
#include <set>
#include <bitset>
#include <string>
#include <map>
#include <algorithm>
#include <iomanip>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
  ll a,b,c,k;
  cin >> a >> b >> c >> k;
  ll ans = 0;
  if(a>=k){
    ans = k;
  }else{
    ans = a;
    if(a+b<k){
      ans -= k-(a+b);
    } 
  }
  cout << ans << endl;
} 

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a + b == 15) {
    cout << "+" << endl;
  }
  else if (a*b == 15) {
    cout << "*" << endl;
  }
  else {
    cout << "x" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(b-a == c-b) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256