akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int A, B, C;
    io.read(A, B, C);
    int m = A;
    m = max(m, B);
    m = max(m, C);
    int ans = A + B + C;
    ans -= m;
    ans += 10 * m;
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	char s[20];
	while(~scanf("%s",s))
	{
//		for(int i = 1; i < 19; i++)
//		{
//			scanf("%c",&s[i]);
//		}
		for(int i = 0; i < 19; i++)
		{
			if(s[i]==',')
			printf(" ");
			else
			printf("%c",s[i]);
		}
		printf("\n");
//		for(int i = 0; i < 19; i++)
//		printf("%c",s[i]);
//		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))


def judge(A):
    for a in A:
        if (a % 2 != 0):
            continue
        if ((a % 3 == 0) or (a % 5 == 0)):
            continue
        else:
            return 'DENIED'
    return 'APPROVED'


print(judge(A))


Measured memory_bytes: 38256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int main(){
    int n;cin>>n;
    int d[n+50][n+50];
    rep(i,n)rep(j,n)d[i][j] = INF;
    Graph G(n+1);
    rep(i,n){
        G[i].push_back(i+1);
        G[i+1].push_back(i);
    }
    int x,y;cin>>x>>y;
    x--;y--;
    G[x].push_back(y);
    G[y].push_back(x);

    queue<int>que;
    rep(i,n-1){
        d[i][i] = 0;
        que.push(i);
        while(!que.empty()){
            int v = que.front();que.pop();
            for(auto nv : G[v]){
                //if(nv<i)continue;
                if(d[i][nv]!=INF)continue;
                d[i][nv] = min(d[i][nv],d[i][v]+1);
                que.push(nv);
            }
        }
    }
    vector<int>v(n,0);
    rep(i,n){
        for(int j=i+1;j<n;j++){
            if(d[i][j]==INF)continue;
            v[d[i][j]]++;
        }
    }
    rep(i,n-1)cout<<v[i+1]<<endl;
}



Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;
int read();

int fa[200005], ch[200005][2], w[200005][2], c[200005];
struct P {
    long long l, r;
};
vector<P> p[200005], tmp;

void ins(int u, long long l, long long r) {
    if (!p[u].size() || r < (--p[u].end())->r) p[u].push_back((P){l, r});
}

bool dfs(int u, long long x) {
    if (!c[u]) return p[u].clear(), p[u].push_back((P){0, 0}), 1;
    int L, R, Wl = w[u][0], Wr = w[u][1];
    if (!dfs(L = ch[u][0], x) || !dfs(R = ch[u][1], x)) return 0;
    if (p[L].size() > p[R].size()) swap(L, R), swap(Wl, Wr);
    tmp.clear(), p[u].clear();
    int i, j;
    // cerr << u << ' ' << L << ' ' << R << endl;
    for (i = 0, j = -1; i < p[L].size(); ++i) {
        long long tl = p[L][i].l + Wl, tr = x - p[L][i].r - (Wl + Wr);
        while (j + 1 < p[R].size() && p[R][j + 1].l <= tr) ++j;
        // cerr << j << endl;
        if (j < 0) continue;
        if (!tmp.size() || p[R][j].r + Wr < (--tmp.end())->r)
            tmp.push_back((P){tl, p[R][j].r + Wr});
    }
    // cerr << "#" << u << ' ' << tmp.size() << endl;
    for (i = 0, j = tmp.size() - 1; i < tmp.size() && j >= 0;) {
        if (tmp[i].l < tmp[j].r)
            ins(u, tmp[i].l, tmp[i].r), ++i;
        else if (tmp[i].l > tmp[j].r)
            ins(u, tmp[j].r, tmp[j].l), --j;
        else {
            tmp[i].r <= tmp[j].l ? ins(u, tmp[i].l, tmp[i].r)
                                 : ins(u, tmp[j].r, tmp[j].l);
            ++i, --j;
        }
    }
    while (j >= 0) ins(u, tmp[j].r, tmp[j].l), --j;
    while (i < tmp.size()) ins(u, tmp[i].l, tmp[i].r), ++i;
    return p[u].size();
}
int main() {
    int n = read();
    for (int i = 2; i <= n; ++i)
        fa[i] = read(), ch[fa[i]][c[fa[i]]] = i, w[fa[i]][c[fa[i]]++] = read();
    long long l = 0, r = 40000000000, rs = r, m;
    // cerr << dfs(1, 1) << endl;
    while (l <= r) dfs(1, m = l + r >> 1) ? r = m - 1, rs = m : l = m + 1;

    printf("%lld\n", rs);
    return 0;
}

int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') f = (c == '-') ? -1 : f, c = getchar();
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}


Measured memory_bytes: 31980
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;
/*

bool prime[300100];
vint vv;
vint v;

int main(){
	ll n;
	vv.PB(6);
	for(ll i=14;i<300100;i+=7){
		vv.PB(i-1);
		vv.PB(i-6);
	}
	
	rep(i,300100) prime[i]=false;
	
	rep(i,300100){
		if(i%7==1||i%7==6) prime[i]=true;
	}
	rep(i,6){
		prime[i]=false;
	}
	for(ll i=2;i*i<300100;i++){
		if(prime[i]){//&&(i%7==1||i%7==6)){
			rep(j,vv.size()){
				if(i*vv[j]>300010) break;
				if(i>vv[j]) continue;
				prime[i*vv[j]]=false;
			}
		}
		else prime[i]=false;
	}
	
	while(cin>>n,n!=1){
		cout<<n<<":";
		for(ll i=6;i<n+1;i++){
			if(prime[i]&&n%i==0) cout<<" "<<i;
		}
		cout<<endl;
	}
	
	return 0;
}
*/


bool jud(int n){
	for(int i=6;i*i<n+1;i+=(i%7==6?2:5)){
		if(n%i==0){
			return false;
		}
	}
	return true;
}

vint foo(int n){
	vint ret;
	for(int i=6;i*i<n+1;i+=(i%7==6?2:5)){
		if(n%i==0){
			if(jud(i)) ret.PB(i);
			if(i!=n/i&&jud(n/i)) ret.PB(n/i);
		}
	}
	if(jud(n)) ret.PB(n);
	return ret;
}


int main(){
	int n;
	while(cin>>n,n!=1){
		vint t=foo(n);
		sort(ALL(t));
		cout<<n<<":";
		rep(i,t.size()){
			cout<<" "<<t[i];
		}
		cout<<endl;
	}
	return 0;
}
	

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

#define ff              first
#define fo(i,n)         for(i=0;i<n;i++)
#define Fo(i,k,n)       for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x, y)      cout << #x << "=" << x << "," << #y << "=" << y << endl
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

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

const int N = 3e5, M = N;
//=======================

vi g[N];

void solve() {
	int i, j, n, m;
	cin >> n >> m;
	int b; cin >> b;
	int row[n ], col[m ];
	fo(i, n) {
		row[i] = 0;
		// deb(row[i]);
	}
	fo(i, m) col[i] = 0;
	set<pii> points;
	int u, v;
	fo(i, b) {
		cin >> u >> v;
		u--;
		v--;
		row[u]++; col[v]++;
		points.insert({u, v});
	}
	vi max_rows;
	vi max_cols;
	int mx = INT_MIN;
	fo(i, n) {
		// deb2(i, row[i]);
		if (row[i] > mx) {
			max_rows.clear();
			max_rows.pb(i);
			mx = row[i];
		}
		else if (row[i] == mx) {
			max_rows.pb(i);
		}
	}
	int ans = mx;
	mx = INT_MIN;
	fo(i, m) {
		// deb2(i, col[i]);
		if (col[i] > mx) {
			max_cols.clear();
			max_cols.pb(i);
			mx = col[i];
		}
		else if (col[i] == mx) {
			max_cols.pb(i);
		}
	}
	ans += mx;
	// deb2(max_rows.size(), max_cols.size());
	for (int r : max_rows) {
		for (int c : max_cols) {
			if (points.find({r, c}) == points.end()) {
				cout << ans << "\n";
				return;
			}
		}
	}
	cout << ans - 1 << "\n";
}

int32_t main()
{
	FIO;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
	return 0;
}

void ipgraph(int n, int m) {
	int i, u, v;
	while (m--) {
		cin >> u >> v;
		u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par) {
	for (int v : g[u]) {
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 42080
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N = INT()

a = LIST()
C = Counter(a)
A = sorted(set(a))

if N%3 == 0:
	if len(A) == 3 and A[0]^A[1] == A[2] and len(set(C.values())) == 1:
		print("Yes")
	elif len(A) == 2 and A[0] == 0 and C[0] == N//3:
		print("Yes")
	elif len(A) == 1 and A[0] == 0:
		print("Yes")
	else:
		print("No")

elif len(A) == 1 and 0 in a:
	print("Yes")
else:
	print("No")
	


Measured memory_bytes: 22136
A, B, C, D = map(int, input().split())
ans=0

def gcd(m, n):
    x=max(m, n)
    y=min(m, n)
    if x%y == 0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z

def lcm(x, y):
    return (x * y) // gcd(x, y)

lcmCD=lcm(C, D)
ans=B-A+1
ans-=((B//C) - ((A-1)//C))
ans-=((B//D) - ((A-1)//D))
ans+=((B//lcmCD) - ((A-1)//lcmCD))
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define pb push_back
#define FAST ios::sync_with_stdio(false);cin.tie(NULL),cout.tie(NULL);
typedef long long ll;
#define pi acos(-1.0)
using namespace std;

int main()
{
    long double r;
    cin>>r;
    cout<<2*pi*r<<fixed<<setprecision(12)<<endl;
    return 0;
}


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

/**
 * @struct Union-Find tree
 * @fn UnionFind(N) コンストラクタ 0~Nまで自身が親の木を作成
 * @fn root(x) xの属する木の根を返却
 * @fn unite(x, y) xとyの属する木を結合(同じ木に属する場合は何もしない)
 * @fn size(x) xの属する木の要素数返却
 * @fn same(x, y) xとyが同じ木に属するかどうかのbool値返却
 * @usage 適宜コンストラクタを変更
 */ 
struct UnionFind {
  vector<int> par;
  vector<int> siz;

  UnionFind(int N) : par(N), siz(N, 1) {
    for ( int i = 0; i < N; i++ ) { par[i] = i; }
  }

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

  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if ( rx == ry ) { return; }
    if ( siz[rx] < siz[ry] ) { swap(rx, ry); }
    par[ry] = rx;
    siz[rx] += siz[ry];
  }

  int size(int x) {
    return siz[root(x)];
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  UnionFind tree(n+1);
  vector<int> cant_fre(n+1, 1);
  for ( int i = 0; i < m; i++ ) {
    int a, b;
    cin >> a >> b;
    tree.unite(a, b);
    cant_fre[a]++;
    cant_fre[b]++;
  }
  for ( int i = 0; i < k; i++ ) {
    int c, d;
    cin >> c >> d;
    if ( tree.same(c, d) ) {
      cant_fre[c]++;
      cant_fre[d]++;
    }
  }

  for ( int i = 1; i <= n; i++ ) {
    cout << tree.size(i)-cant_fre[i] << ' ';
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 4296
N=int(input())
t=list(map(int,input().split()))
v=list(map(int,input().split()))

T=sum(t)
ans=[0]

for i in range(N):
  ans[-1]=min(ans[-1],v[i])
  for j in range(t[i]*2):
    ans.append(v[i])

ans[-1]=0

for i in range(2*T):
  ans[i+1]=min(ans[i]+0.5,ans[i+1])

for i in range(2*T,0,-1):
  ans[i-1]=min(ans[i]+0.5,ans[i-1])

print(sum(ans)/2)

Measured memory_bytes: 9348
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
typedef long long ll;

using namespace std;

int main() {
  double r;
  double area, circumference;
  const double pi = acos(-1);

  cin >> r;

  area = r * r * pi;
  circumference = 2 * r * pi;

  cout << fixed << setprecision(6) << area << " " << fixed << setprecision(6) << circumference << "\n";
}


Measured memory_bytes: 3284
N, Q = map(int, input().split())
S = input()
li = [list(map(int, input().split())) for n in range(Q)]

t = [0] * len(S)

for index, s in enumerate(S):
  if index+1 > len(S)-1:
    break

  if s == 'A' and S[index+1] == 'C':
    t[index+1] = t[index] + 1
    
  else:
    t[index+1] = t[index]

for i in li:
  print(t[i[1]-1] - t[i[0] - 1])

Measured memory_bytes: 30668
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll mod=1e9+7;
#define endl '\n'
#define SIGMA 128
const ld PI=3.14159265358979;
#define fr(i,n) for(i=1;i<=n;i++)
#define rep(i,k,n) for(i=k;i<=n;i++)
#define w(x) int x;cin>>x;while(x--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define ps(x,y) cout<<fixed<<setprecision(y)<<x<<endl
#define pb push_back
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vll vector<ll>
#define vvl vector<vll>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define F first
#define S second 
#define LB lower_bound
#define UB upper_bound
#define mset multiset
#define uset unordered_set
#define umap unordered_map
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll binpow(ll x, ll y, ll p){  ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)  { if (y & 1) res = (res*x) % p; y = y>>1;x = (x*x) % p;}return res;}  
ll gcd(ll a, ll b){ if (b == 0) return a; return gcd(b, a % b); } 
bool parity(ll x,ll y){ bool f = ((x ^ y) < 0);return !f;}

ll dp[500][500];
int main()
{
    IOS

    ll n,i;
    cin>>n;
    vll v(n+1);
    vll pref(n+1,0);
    fr(i,n)
    {
        cin>>v[i];
        pref[i]=pref[i-1]+v[i];
    }

    fr(i,n)
    {
        for(int st=1;st+i-1<=n;st++)
        {
            int last=st+i-1;
            if(st==last)
            {
                dp[st][last]=0;
                continue;
            }
            dp[st][last]=mod*mod;
            for(int k=st;k<last;k++)
            {
                dp[st][last]=min(dp[st][last],dp[st][k]+dp[k+1][last]+pref[last]-pref[st-1]);
            }

        }
    }
    cout<<dp[1][n]<<endl;

    return 0;  
}



Measured memory_bytes: 5176
package main

import (
	"fmt"
)

func main() {
	var x, y int
	fmt.Scanf("%x %x", &x, &y)
	switch {
	case x > y:
		fmt.Println(">")
	case x < y:
		fmt.Println("<")
	default:
		fmt.Println("=")
	}
}


Measured memory_bytes: 512
from math import gcd

mod = 10 ** 9 + 7
n = int(input())
iwashi = dict()
origin_iwashi = 0
for _ in range(n):
  a, b = map(int, input().split())
  if a == b == 0:
    origin_iwashi += 1
  elif a == 0:
    if (1, 0) in iwashi:
      iwashi[(1, 0)][1] += 1
    else:
      iwashi[(1, 0)] = [0, 1]
  elif b == 0:
    if (1, 0) in iwashi:
      iwashi[(1, 0)][0] += 1
    else:
      iwashi[(1, 0)] = [1, 0]
  else:
    if b < 0:
      a, b = -a, -b
    g = gcd(a, b)
    a //= g
    b //= g
    if a > 0:
      if (a, b) in iwashi:
        iwashi[(a, b)][0] += 1
      else:
        iwashi[(a, b)] = [1, 0]
    else:
      if (b, -a) in iwashi:
        iwashi[(b, -a)][1] += 1
      else:
        iwashi[(b, -a)] = [0, 1]
count = 1
for i, j in iwashi.values():
  tmp = pow(2, i, mod) + pow(2, j, mod) - 1
  count = count * tmp % mod
count = (count + origin_iwashi - 1) % mod
print(count)

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

int main() {
    ll N;
    Pl dat[100005];
    cin >> N;
    for (int i = 0; i < N; i++) {
        ll X, L;
        cin >> X >> L;
        ll l = X - L, r = X + L;
        dat[i] = Pl(r, l);
    }
    sort(dat, dat + N);

    ll maxr = -LLINF;
    ll cnt = 0;
    for (int i = 0; i < N; i++) {
        if (maxr <= dat[i].second) {
            cnt++;
            maxr = max(maxr, dat[i].first);
        }
    }
    
    cout << cnt << endl;
    return (0);
}

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

using namespace std;

void load(void);
void calc(void);
void output(void);

unsigned int N, countt = 1;
vector<string> str(200000, "");

int main(){
	load();
	calc();
	output();
	return 0;
}

void load(void){
	cin >> N;
	for(unsigned int i = 0;i < N;i++){
		cin >> str.at(i);
	}
	sort(str.begin(), str.begin() + N);
}

void calc(void){
	unsigned int i;
	for(i = 0;i < N - 1;i++){
		if(str.at(i) != str.at(i + 1)){
			countt++;
		}
	}
}

void output(void){
	cout << countt;
}

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

int main() {
  char a,b;
  cin>>a>>b;
  if (a=='H' && b=='H') cout<< 'H' <<endl;
  else if(a=='H' && b=='D') cout << 'D' <<endl;
  else if(a=='D' && b=='H') cout << 'D' <<endl;
  else cout<< 'H' <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {

    int a,b;
    cin>>a>>b;
    a--;b--;
    vvc v(100,vc(100,'#'));
    rep(i,100){
        rep(j,50){
            v[i][j]='.';
        }
    }
    for(int i=0;i<100;i+=2){
        for(int j=0;j<50;j+=2){
            if(b>0){
                v[i][j]='#';
                b--;
            }
        }
    }
    for(int i=0;i<100;i+=2){
        for(int j=99;j>50;j-=2){
            if(a>0){
                v[i][j]='.';
                a--;
            }
        }
    }
    cout << "100 100"<<endl;
    rep(i,100){
        rep(j,100)cout<<v[i][j];
        cout<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
char S[100002];
int main(){
  int i, j, t0, t1;
  N = rd(S);
  for(i=0;i<N;i++){
    S[i] -= '0';
  }
  for(i=0;i<N;i+=2){
    S[i] = 1 - S[i];
  }
  t0 = t1 = 0;
  for(i=0;i<N;i++){
    if(S[i]){
      t1++;
    }
    else{
      t0++;
    }
  }
  wt_L(min_L(t0, t1));
  wt_L('\n');
  return 0;
}
// cLay varsion 20190608-2

// --- original code ---
// int N; char S[100002];
// {
//   int i, j, t0, t1;
// 
//   rd(S@N);
//   rep(i,N) S[i] -= '0';
//   for(i=0;i<N;i+=2) S[i] = 1 - S[i];
// 
//   t0 = t1 = 0;
//   rep(i,N) if[S[i], t1, t0]++;
//   wt(min(t0,t1));
// }


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define db(x) cerr<<#x<<" = "<<x<<endl;
using namespace std;
int sav[205][205];
int dis[205];
int n;
int solve(int s){
	memset(dis,0x3f,sizeof(dis));
	queue<int> q;
	q.push(s);
	int ret=-1;
	dis[s]=1;
	while(!q.empty()){
		int now=q.front();
		q.pop();
		ret=max(ret,dis[now]);
		for(int i=1;i<=n;++i){
			if(sav[now][i]){
				if(dis[i]==0x3f3f3f3f){
					dis[i]=dis[now]+1;
					q.push(i);
				}else if(abs(dis[now]-dis[i])%2==0){
					return -1;
				}
			}
		}
	}
	return ret;
}
int main() {
	cin>>n;
	for(int i=1; i<=n; ++i) {
		for(int j=1; j<=n; ++j) {
			scanf("%1d",&sav[i][j]);
		}
	}
	int ans=-1;
	for(int i=1;i<=n;++i){
		ans=max(ans,solve(i));
	}
	cout<<ans;
	return 0;
}



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

int main(){

    vector<int> v(3);

    cin>>v[0]>>v[1]>>v[2];

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

    if(v[0]== 5 and v[1]==5 and v[2]==7)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#define INF 1e9
using namespace std;

int main() {
  while(1){
    int T,cir[31];
    cin >> T;
    if(!T)break;
    for(int i=0;i<T;i++) cin>>cir[i];
 
    int n,d,h,job[102],dp[102][102];
    for(int i=0;i<102;i++)
      for(int j=0;j<102;j++)dp[i][j]=job[i]=INF;

    cin>>n;
    for(int i=0;i<n;i++)cin>>d>>h, job[d]=min(job[d],h);
    dp[0][0]=0;
    for(int i=0;i<=100;i++)
      for(int j=0;j<T;j++){
	dp[i+1][1]=min(dp[i+1][1],dp[i][j]+1);
	if(cir[j]<=job[i+1])dp[i+1][(j+1)%T]=min(dp[i+1][(j+1)%T],dp[i][j]);
      }
    
    int ans=INF;
    for(int i=0;i<T;i++)ans=min(ans,dp[101][i]);
    cout <<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    deque<int> dq;
    string s;
    bool maki = 0;
    int q,t,a;
    char b;
    cin >> s >> q;
    int n = s.length();
    for(int i=0;i<n;i++){
    	dq.push_back(s[i] - 'a');
    }
    while(q--){
    	cin >> t;
    	if(t == 1) maki ^= 1;
    	else {
    		cin >> a >> b;
    		if((a == 1) ^ maki){
    			dq.push_front((b - 'a'));
    		}else{
    			dq.push_back((b - 'a'));
    		}
    	}
    }
    if(maki){
    	while(!dq.empty()){
    		cout << char('a' + dq.back());
    		dq.pop_back();
    	}
    }else{
    	while(!dq.empty()){
    		cout << char('a' + dq.front());
    		dq.pop_front();
    	}
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1872
#include <stdio.h>

int main (){
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);

  if(a == b && a != c){
    printf("Yes\n");
  }
  else if(a != c && a == b){
    printf("Yes\n");
  }
  else if(a != b && b == c){
    printf("Yes\n");
  }
  else if(a == c && c != b){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
const int mod=1e9+7;
const int maxn=1e5;
using namespace std;
string s1,s2,s3;

bool ab[maxn],ac[maxn],bc[maxn];

bool match(char c1,char c2)
{
    return (c1=='?'||c2=='?'||c1==c2);
}
int main()
{
    //freopen("input.txt","r",stdin);
    ios::sync_with_stdio(false);
    cin>>s1>>s2>>s3;

    int A=s1.size();
    int B=s2.size();
    int C=s3.size();
    for(int i=0; i<A; i++)
        for(int j=0; j<B; j++)
            if(!match(s1[i],s2[j]))
            {
                ab[i-j+50000]=true;
                //cout<<i-j<<endl;
            }
            //cout<<endl;
    for(int i=0; i<B; i++)
        for(int j=0; j<C; j++)
            if(!match(s2[i],s3[j]))
            {
                bc[i-j+50000]=true;
                //cout<<i-j<<endl;
            }
            //cout<<endl;

    for(int i=0; i<A; i++)
        for(int j=0; j<C; j++)
            if(!match(s1[i],s3[j]))
            {
                ac[i-j+50000]=true;
                //cout<<i-j<<endl;
            }


    int ans=6000;
    for(int i=-4000; i<=4000; i++)
        for(int j=-4000; j<=4000; j++)
            if(!ab[i+50000]&&!bc[j-i+50000]&&!ac[j+50000])
            {
                int L=min(0,min(i,j));
                int R=max(A,max(B+i,C+j));
                ans=min(ans,R-L);
                //cout<<ans;
            }
    cout<<ans<<endl;

}



Measured memory_bytes: 384
import sys
import heapq

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    def dijkstra_heap(s):
        # 始点sから各頂点への最短距離
        d = [f_inf] * n
        used = [True] * n  # True:未確定
        d[s] = 0
        used[s] = False
        edgelist = []
        for e in edge[s]:
            heapq.heappush(edgelist, e)
        while len(edgelist):
            minedge = heapq.heappop(edgelist)
            # まだ使われてない頂点の中から最小の距離のものを探す
            if not used[minedge[1]]:
                continue
            v = minedge[1]
            d[v] = minedge[0]
            used[v] = False
            for e in edge[v]:
                if used[e[1]]:
                    heapq.heappush(edgelist, [e[0] + d[v], e[1]])
        return d

    n, m, r = map(int, input().split())
    edge = [[] for _ in range(n)]
    for _ in range(m):
        s, t, d = map(int, input().split())
        edge[s].append([d, t])

    dist = dijkstra_heap(r)
    for res in dist:
        print("INF" if res == f_inf else res)


if __name__ == '__main__':
    resolve()



Measured memory_bytes: 106804
def Prime_factor_set(n, add_1=False):
    ret = set()
    if add_1:
        ret.add(1)

    x = n

    divisor = 2
    while x % divisor == 0:
        x //= divisor
        ret.add(divisor)

    divisor = 3
    while divisor * divisor <= n:
        while x % divisor == 0:
            x //= divisor
            ret.add(divisor)
        divisor += 2

    if x > 1:
        ret.add(x)

    return ret


def main():
    from functools import reduce
    from operator import mul

    n, k, s = map(int, input().split())

    pd = Prime_factor_set(s, add_1=True)
    m = reduce(mul, pd) + 1  # 互いに素
    # コンテスト中の提出は、lcm(pd)-1にしたが、k=2,m=1で落ちるので、嘘解法でした

    ret = [s] * k + [m] * (n - k)
    # [ssssmmmm], sと互いに素な値mで埋める
    # コーナーケース
    # m=1: s=pmを満たすpが存在する恐れ
    # s=10**9: 単純にm=s+1とした場合、定義域を超える
    print(*ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 7124
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define REP_IN(i, n, x) for (ll i = 0; i < n; i++)in>>x;
#define REP_OUT(i, n, x) for (ll i = 0; i < n; i++)out<<x<<endl;
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
#define endl '\n'
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 end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    vector<ll> X(9);
    REP(i,9){
        in >> X[i];
    }
    ll N;
    in >> N;
    vector<ll> b(N);
    REP(i,N){
        in >> b[i];
        REP(j,9){
            if(X[j] == b[i])X[j] = 0;
        }
    }
    ll flag = 0;
    if(X[0]==X[1] && X[1]==X[2] && X[2]==0){
        flag = 1;
    }else if(X[3]==X[4] && X[4]==X[5] && X[5]==0){
        flag = 1;
    }else if(X[6]==X[7] && X[7]==X[8] && X[8]==0){
        flag = 1;
    }else if(X[0]==X[3] && X[3]==X[6] && X[6]==0){
        flag = 1;
    }else if(X[1]==X[4] && X[4]==X[7] && X[7]==0){
        flag = 1;
    }else if(X[2]==X[5] && X[5]==X[8] && X[8]==0){
        flag = 1;
    }else if(X[0]==X[4] && X[4]==X[8] && X[8]==0){
        flag = 1;
    }else if(X[2]==X[4] && X[4]==X[6] && X[6]==0){
        flag = 1;
    }

    if(flag==1){
        out << "Yes" <<endl;
    }else{
        out << "No" << endl;
    }



}

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

#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define vi vector<int>
#define pi pair<int, int>
#define mem(a,b) memset(a,b,sizeof(a))
#define mp make_pair
const int mod = (int)1e9+7;
typedef long long int ll;

#define TRACE

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	string s,t;
	cin>>s>>t;
	int n=s.size(),m=t.size();
	int dp[n+5][m+5];
	string ans="";
	for(int i=0;i<=n;i++)
		for(int j=0;j<=m;j++){
			if(i==0 or j==0)
				dp[i][j]=0;
			else if(s[i-1]==t[j-1])
				dp[i][j] = dp[i-1][j-1]+1;
			else 
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
		}
	int ptr1=n,ptr2=m;
	while(ptr1>0 and ptr2>0){
		if(s[ptr1-1]==t[ptr2-1]){
			ans = s[ptr1-1] + ans;
			ptr1--;
			ptr2--;
		}
		else if(dp[ptr1-1][ptr2]>dp[ptr1][ptr2-1])
			ptr1--;
		else 
			ptr2--;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 35456
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int n;
    cin >> n;

    map <string, bool> mp;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        mp[s] = true;
    }

    cout << mp.size() << "\n";
    return 0;
}

Measured memory_bytes: 19212
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

vector<P> v;
bool comp(P a, P b) {
	if (a.second != b.second)return a.second < b.second;
	return a.first < b.first;
}
int n, w, h;
bool inc(int id, int s) {
	int le = v[id].first, ri = v[id].second;
	for (int i = -2; i <= 2; i++) {
		int ss = s + i * 2 * (w + h);
		if (le <= ss && ss <= ri)return true;
	}
	return false;
}
void solve() {
	cin >> n >> w >> h;
	rep(i, n) {
		int x, y; char t; cin >> x >> y >> t; y = h - y;
		swap(x, y);
		int le, ri;
		if (t == 'N') {
			le = y - x;
			ri = y + x;
		}
		else if (t == 'S') {
			le = h + w + w - y - (h - x);
			ri = h + w + w - y + h - x;
		}
		else if (t == 'E') {
			le = w + x - (w - y);
			ri = w + x + w - y;
		}
		else {
			le = w + h + w + h-x - y;
			ri = w + h + w + h-x + y;
		}
		v.push_back({ le,ri });
		//cout << le << " " << ri << endl;
	}
	int ans = 2 * n;
	rep(i, n) {
		int s = v[i].second;
		vector<P> u;
		rep(j, n) {
			if (inc(j, s))continue;
			int le = v[j].first - s;
			int ri = v[j].second - s;
			while (le < 0) {
				le += 2 * (w + h);
				ri += 2 * (w + h);
			}
			u.push_back({ le,ri });
		}
		sort(u.begin(), u.end(), comp);
		int cnt = 1, loc = 0;
		rep(j, u.size()) {
			if (loc < u[j].first) {
				cnt++; loc = u[j].second;
			}
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}



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

using namespace std;

int main(){
    long long a, b, c, k;
    cin >> a >> b >> c >> k;
    long long positivos = k - a;
    if(positivos <= 0){
        if(a >= k)
            cout << k << '\n';
        else
            cout << a << '\n';
    }else{
        if(a + b >= k){
            cout << a << '\n';
        }else{
            long long neg = k - a - b;
            if(c > neg){
                cout << a - neg << '\n';
            }else{
                cout << a - c  << '\n';
            }
        } 
    }
}

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
// #define for(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9

int main() {
    ll N;
    ll ans;
    ll tmp_ans;
    ans = pow(10, 12);
    cin >> N;

    for (int i = 1; i<=sqrt(N); i++) {
        if (N % i == 0) {
            tmp_ans = (i + (N / i)) - 2;
            if (tmp_ans < ans) {
                ans = tmp_ans;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int n;
    cin>>n;
    vector<int> a(n);
    int ans=0;
    bool one=true;
    int count=0;
    rep(i,n){
        cin>>a[i];
        if(a[i]==1 && one){
            ans+=i;
            count=i;
            one=false;
        }else if(a[count]+1==a[i] && !(one)){
            ans=ans+i-count-1;
            count=i;
        }
    }
    if(one) cout<<-1<<endl;
    else cout<<ans+n-1-count<<endl;
}

Measured memory_bytes: 3968
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int H,W;
        for (;;) { 
        H = sc.nextInt();
        W = sc.nextInt();
          if(H==0)
       break;
          
        	   
          
             
            for(int i=0; i<H; i++){
                for(int j=0; j<W; j++){
                	if(i==0||j==0||i==H-1||j==W-1){
                		System.out.print('#');
                }else{
                	System.out.print('.');
                }
                }
                System.out.println();
            }
            System.out.println();
        }
           sc.close();
        }
    

}



Measured memory_bytes: 35940
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		int R =nextInt();
		int G =nextInt();
		int B =nextInt();
		int N =nextInt();

		long ans =0;
		for(int r=0;r<=(N/R)+1;r++){
			for(int g=0;g<=(N/G)+1;g++){
				int rem=N-(R*r+G*g);
				if(rem >=0&&rem%B==0){
					ans++;
				}
			}
		}
		System.out.println(ans);


	}


	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21204
using System;
using System.IO;
 
namespace Ex160506_1{
    public class Program{
        public static void Main(string[] args){
            var sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
 
            while(true){
                var input = Console.ReadLine().Split(' ');
                var h = int.Parse(input[0]);
                var w = int.Parse(input[1]);
 
                if(h == 0) break;
                for(var i = 1; i <= h; i++){
                    for(var j = 1; j <= w; j++){
                        if(i == 1 || i == h || j == 1 || j == w){
                            sw.Write('#');
                        } else{
                            sw.Write('.');
                        }
                    }
                    sw.WriteLine();
                }
                sw.WriteLine();
            }
            sw.Flush();
        }
    }
}
 

Measured memory_bytes: 8968
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define REPN(i, m, n) for(ll i = (m); i <= (n); ++i)
#define REPR(i, m, n) for(ll i = (m)-1; i >= (n); --i)
#define REPNR(i, m, n) for(ll i = (m); i >= (n); --i)
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
// constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll n;
	cin >> n;
	Vec a(n);
	rep(i, n) cin >> a[i];
	ll sum = 0;
	rep(i, n) sum += a[i];

	unordered_map<ll, ll> ump;
	rep(i, n) ump[a[i]]++;

	ll q;
	cin >> q;
	rep(i, q){
		ll b, c;
		cin >> b >> c;
		sum += ump[b] * (c - b);
		ump[c] += ump[b];
		ump.erase(b);
		co(sum);
	}

	return 0;
}


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

const int maxn=1e5+7;
const int mod=1e9+7;
const double pi=acos(-1);
int main(){
    int n,a,b;
    cin>>n>>a>>b;
    cout<<min(n*a,b)<<endl;
    return 0;
}


Measured memory_bytes: 256
x=[]
y=[]
n=int(input())
a=list(map(int,input().split()))
for i in range(10**5+1):
	x.append([i,0])
	y.append([i,0])
for i in range(n//2):
	x[a[i*2]][1]+=1
	y[a[i*2+1]][1]+=1
x.sort(key=lambda x:-x[1])
y.sort(key=lambda x:-x[1])
if x[0][0]!=y[0][0]:
	print(n-x[0][1]-y[0][1])
else:
	print(n-max(x[0][1]+y[1][1],
		x[1][1]+y[0][1]))


Measured memory_bytes: 32656
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >;
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
using namespace std;
string s,t;
int main(){
	cin>>s>>t;
	int ans=0;
	for(int i=0;i<3;i++)
	if(s[i]==t[i])
	ans++;
	cout<<ans;
	re 0;
}


Measured memory_bytes: 256
from bisect import bisect_left
try:
    from math import inf
except:
    inf = float("inf")


def way(a, b, c):
    return abs(a - b) + abs(b - c)


A, B, Q = map(int, input().split())
s = []
t = []
x = []
for _ in range(A):
    s.append(int(input()))
for _ in range(B):
    t.append(int(input()))
for _ in range(Q):
    x.append(int(input()))

for xi in x:
    isr = bisect_left(s, xi)
    itr = bisect_left(t, xi)
    isl = isr - 1
    itl = itr - 1
    cand = []
    if 0 <= isl < A and 0 <= itl < B:
        cand.append((s[isl], t[itl]))
    if 0 <= isl < A and 0 <= itr < B:
        cand.append((s[isl], t[itr]))
    if 0 <= isr < A and 0 <= itl < B:
        cand.append((s[isr], t[itl]))
    if 0 <= isr < A and 0 <= itr < B:
        cand.append((s[isr], t[itr]))
    ans = inf
    for a, b in cand:
        ans = min(ans, way(xi, a, b), way(xi, b, a))
    print(ans)


Measured memory_bytes: 90840
s = input().split()
s = list(s)
s2 = input().split()
s2 = list(s2)
count=1
X = int(s[1])
count = 1
for i in s2:
    if i == ' ':
        continue
    X = X-int(i)
    if X < 0:
        break
    count += 1
print(count)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
#define all(v) v.begin(),v.end()


ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}

int main(){
  ll ans=0;
  double now=100;
  double x;
  cin >> x;
  while(1){
    now=floor(now*1.01);
    ans++;
    if(now>=x){
      cout << ans << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3724
$<.readlines.map(&:chomp).map {|l| l.split(/\+|=/)}.each do |given|
  catch(:jump) do
    10.times do |i|
      d = given.map {|a| a.gsub("X", i.to_s)}
      next unless d.select {|s| s.length >= 2 and s[0] == "0"}.empty?
      next unless d[0].to_i + d[1].to_i == d[2].to_i
      puts i
      throw(:jump)
    end
    puts "NA"
  end
end


Measured memory_bytes: 6964
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] H = new int[N];
		int ans = 0;
		int max = 0;
		for(int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
			if(H[i] >= max) {
				max = H[i];
				ans += 1;
			}
		}
		System.out.println(ans);

	}

}

Measured memory_bytes: 23124