akhauriyash/Code-Regression huggingface dataset:
from operator import itemgetter

n = int(input())
red = []
blue = []
for i in range(n):
    a, b = map(int, input().split())
    red.append([a, b, min(a, b)])
for i in range(n):
    c, d = map(int, input().split())
    blue.append([c, d, min(c, d)])
red = sorted(red, key=itemgetter(2))
blue = sorted(blue, key=itemgetter(2))
red_x = set()
red_y = set()
blue_x = set()
blue_y = set()
for i in red:
    red_x.add(i[0])
    red_y.add(i[1])
for i in blue:
    blue_x.add(i[0])
    blue_y.add(i[1])
red_kouho = []
blue_kouho = []
for i in red:
    rx = i[0]
    ry = i[1]
    kouho = []
    for j in blue:
        bx = j[0]
        by = j[1]
        if rx < bx and ry < by:
            kouho.append((bx, by))
    red_kouho.append([kouho, len(kouho)])
red_kouho = sorted(red_kouho, key=itemgetter(1))
count = 0
for i in red_kouho:
    for j in i[0]:
        if j[0] in blue_x and j[1] in blue_y:
            blue_x.discard(j[0])
            blue_y.discard(j[1])
            count += 1
            break
print(count)

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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
constexpr int MOD = 1e9 + 7;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}
// -------------------------------------------------------------------

using P = pair<int, int>;

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n, a, b, c;
    cin >> n >> a >> b >> c;
    vector<int> l(n);
    rep (i, n)
        cin >> l[i];

    int lim = pow(4, n);
    int ans = INF;
    rep (i, lim) {
        int ar = a, br = b, cr = c;
        bool af = true, bf = true, cf = true;
        int pt = 0;
        rep (j, n) {
            int id = (i >> 2 * j) & 3;
            switch (id) {
                case 1:
                    ar -= l[j];
                    if (af)
                        af = false;
                    else
                        pt += 10;
                    break;
                case 2:
                    br -= l[j];
                    if (bf)
                        bf = false;
                    else
                        pt += 10;
                    break;
                case 3:
                    cr -= l[j];
                    if (cf)
                        cf = false;
                    else
                        pt += 10;
                    break;
            }
        }
        pt += abs(ar) + abs(br) + abs(cr);
        if (af or bf or cf) continue;

        if (pt < ans) ans = pt;
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 384
N,K = map(int, input().split())
h = []
for i in range(N):
    h.append(int(input()))
h.sort()
res = 10**9
for i in range(N-K+1):
    if res > h[i+K-1]-h[i]:
        res = h[i+K-1]-h[i]
print(res)

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;


const int mod = 1000000000 + 7;
// 以下コピー
const int MAX_FACT = 2000000;

ll fact[MAX_FACT];

ll pow_mod(ll a,ll n){
  ll cur=1;
  ll mul=a;
  while(n){
    if(n%2)cur=(cur*mul)%mod;
    mul=(mul*mul)%mod;
    n/=2;
  }
  return cur;
}

ll div_mod(int a){
  return pow_mod(a,mod-2);
}

// factを前計算
void calcFact(){
  fact[0]=1;
  for(int i=1;i<MAX_FACT;i++)
    fact[i]=(fact[i-1]*i)%mod;
}

// [a, a +1, a +2, .., b] の和
ll sums(ll a, ll b){
    if(a > b) return 0;
    else if(a == b) return a;
    ll ans = 0;
    ans += b * (b + 1) /2;
    ans -= (a - 1) * a / 2;
    return ans;
}

// aCbのmodを計算
// 計算量はO(log(fact[a])+log(fact[a-b]))程度
ll comb(ll a,ll b){
  if(a<0||b<0)return 0;
  else if(a<b)return 0;
  else if(b==0)return 1;
  else if(a == 0)return 1;
  ll res=fact[a];
  res=(res*div_mod(fact[b]))%mod;
  res=(res*div_mod(fact[a-b]))%mod;
  return res;
}

// aCbを計算
// aとbがおおきくても、a%modとb%modが小さければ計算できる
// a%modとb%modはfact tableに前計算しておく必要あり
ll comb_large(ll a, ll b){
  ll res = 1;
  ll tmp_a = a;
  ll tmp_b = b;
  while(!(tmp_a==0&&tmp_b==0)){
    const ll aa = tmp_a % mod;
    const ll bb = tmp_b % mod;
    res = (res * comb(aa,bb)) %mod;
    tmp_a /= mod;
    tmp_b /= mod;
  }
  return res;
}


ll H, W, K;


int main(){

    calcFact();
    cin >> H >> W >> K;
    ll ans = 0;
    ll cons = comb(H * W - 2, K - 2);

    for(int i = 0; i < W; i++){
        // [1, i] までがx2
        // のこりが普通に足すだけ
        ll tmp = (sums(1, min((ll)i, W - i - 1)) * 2 + sums(min((ll)i, W - i - 1) + 1, max((ll)i, W - i - 1))) % mod;
        (tmp *= H) %= mod;
        (tmp *= H) %= mod;
        (ans += (tmp) % mod) %= mod;
    }

    // cout << ans << endl;

    for(int i = 0; i < H; i++){
        // [1, i] までがx2
        // のこりが普通に足すだけ
        ll tmp = (sums(1, min((ll)i, H - i - 1)) * 2 + sums(min((ll)i, H - i - 1) + 1, max((ll)i, H - i - 1))) % mod;
        // ll tmp = (sums(1, min((ll)i, H - i - 1)) * 2 + sums(i + 1, max((ll)i, H - i - 1))) % mod;
        (tmp *= W) %= mod;
        (tmp *= W) %= mod;
        (ans += (tmp) % mod) %= mod;
        // (ans += (tmp * W) % mod) %= mod;
    }

    // cout << ans << endl;

    
    (ans *= cons) %= mod;
    (ans *= div_mod(2)) %= mod;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 15872
#include <iostream>
#include <algorithm>
 
using namespace std;
 
int main()
{
    int N,M;
 
    cin >> N >> M;
 
    int A[N];
    int total = 0;
 
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        total += A[i];
    }
 
    sort(A,A+N);
    
    if((double)A[N-M] < (double)total/4/M)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
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 (a>b) { a=b; return 1; } return 0; }

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

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

Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)

	N, H, W := getInt(), getInt(), getInt()
	a := make([]int, N)
	b := make([]int, N)
	for i := 0; i < N; i++ {
		a[i], b[i] = getInt(), getInt()
	}
	ans := 0
	for i := 0; i < N; i++ {
		if H <= a[i] && W <= b[i] {
			ans++
		}
	}
	out(ans)
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <queue>
#include<string>
#include<cstring>
#include<complex>
#include<cmath>
using namespace std;
#define rep(i, n)   for(int i = 0; i < (int)(n); i++)
#define rrp(i, n)   for(int i = ((int)(n)); i >=0; i--)
#define mpp(i,j,k)  make_pair((int)(i),make_pair((int)(j),(int)(k)))
typedef pair<int,pair<int,int > > ppp;
typedef pair<int,int> pp;
typedef vector<int> vi;
typedef vector<vi>  vvi;
long long x[1002],y[1002],r[1002];
double d[1002];

long long xs,ys,xt,yt,n;
void bfs(){
d[0]=0;
priority_queue<pair<long double,long>,vector<pair<long double,long> >,greater<pair<long double,long> > > q;
q.push(make_pair(0.0,0));
while(q.size()){
long double co=q.top().first;
int po=q.top().second;


q.pop();
if(co!=d[po]) continue;
rep(i,n+2){

long double f=max(sqrt((x[po]-x[i])*(x[po]-x[i])+(y[po]-y[i])*(y[po]-y[i]))-r[po]-r[i],0.0)+d[po];
if(d[i]>f)d[i]=f,q.push(make_pair(f,i));
}
}

}
int main(){
 rep(i,1002)d[i]=10000000000;
 cin>>xs>>ys>>xt>>yt>>n;
 x[0]=xs;y[0]=ys;r[0]=0;
 rep(i,n)cin>>x[i+1]>>y[i+1]>>r[i+1];
 x[n+1]=xt;y[n+1]=yt;r[n+1]=0;
bfs();

printf("%.10lf\n",d[n+1]);
  return 0;}




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

#define int long long
#define endl "\n"
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);


main(){
	FIO
	int t;
	t=1;
	while(t--){
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		cout<<max(a*c,max(a*d,max(b*c,b*d)))<<endl;
	}
}


Measured memory_bytes: 3648
#include <algorithm>
#include <fstream>
#include <iostream>
#include <list>
#include <math.h>
#include <memory>
#include <regex>
#include <string>
#include <unordered_map>
#include <vector>
#include <iomanip>

using namespace std;

int main(int argc, char const *argv[]) {
  string n_str;
  getline(cin, n_str);
  int n = atoi(n_str.c_str());

  string s, tmp;
  getline(cin, s);
  stringstream ss(s);
  vector<int> items;

  while(getline(ss, tmp, ' ')){
    items.push_back(atoi(tmp.c_str()));
  }

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

  double v = items.front();
  for(auto i = items.begin() + 1; i < items.end(); i++) {
    v = (v + *i) / 2;
  }

  cout << v << endl;

  /* code */
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <climits>

using namespace std;

int calc(int val, int a) {
  int cur = a;
  while (cur <= val) {
    cur *= a;
  }

  return cur / a;
}

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

  int dp[n + 1];
  dp[0] = 0;
  for (int i = 1; i < n + 1; i++) {
    dp[i] = INT_MAX;
  }

  for (int i = 1; i < n + 1; i++) {
    int a = calc(i, 6);
    int b = calc(i, 9);
    if (i < 6) {
      a = 0;
    }
    else if (6 <= i && i < 9) {
      b = 0;
    }

    int minVal = dp[i - a];
    minVal = min(minVal, dp[i - b]);
    minVal = min(minVal, dp[i - 1]);

    // cout << "i : " << i << ", " << minVal + 1 << endl;

    dp[i] = minVal + 1;
  }

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

Measured memory_bytes: 640
#include <iostream>

int main(int argc, char** argv)
{
	int n;
	std::cin >> n;

	int house[4][3][10] = { 0 };

	for (int i = 0; i < n; ++i)
	{
		int b, f, r, v;
		std::cin >> b >> f >> r >> v;

		house[b - 1][f - 1][r - 1] += v;
	}

	for (int b = 0; b < 4; ++b)
	{
		for (int f = 0; f < 3; ++f)
		{
			for (int r = 0; r < 10; ++r)
			{
				std::cout << " ";
				std::cout << house[b][f][r];
			}
			std::cout << std::endl;
		}

		if (b < (4 - 1))
		{
			for (int i = 0; i < 20; ++i)
			{
				std::cout << "#";
			}
			std::cout << std::endl;
		}
	}
}


Measured memory_bytes: 3088
#include <stdio.h>

int main(void){
  int i,x,y;
  int max,n;

  while(1){
    max = 0;
    for(i=0;i<5;i++){
      scanf("%d%d",&x,&y);
      if(!x && !y) return 0;
      if(x+y > max){
	max = x+y;
	n = i;
      }
    }
    printf("%c %d\n",n+'A',max);
  }
}

Measured memory_bytes: 0
"""
ALDS1_9_C
優先度つきキューを実装する
"""
import heapq

List = []
while True:
    order = input().split()
    if order[0][0] == 'i':
        x = int(order[1])
        heapq.heappush(List, -x)
    elif order[0][1] == 'x':
        ans = heapq.heappop(List)
        print(-ans)
    else:
        break



Measured memory_bytes: 45308
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

int main(){
  int N,K;
  cin >> N >> K;
  if(K%2){
    ll ans=0;
    FOR(i,1,N+1){
      if(i%K == 0)ans++;
    }
    cout << ans*ans*ans << endl;
    return 0;
  }
  else{
    ll ans1 = 0,ans2 = 0;
    FOR(i,1,N+1){
      if(i%K == 0)ans1++;
      if(i%K == K/2)ans2++;
    }
    cout << ans1*ans1*ans1 + ans2*ans2*ans2 << endl;
  }
}


Measured memory_bytes: 384
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B, C, K = map(int, read().split())

    ans = 0
    while A >= B:
        B *= 2
        ans += 1
    while B >= C:
        C *= 2
        ans += 1

    if ans <= K:
        print('Yes')
    else:
        print('No')

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 61692
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll isPrime(int n) 
{ 
	// Corner cases 
	if (n <= 1) 
		return 1; 
	if (n <= 3) 
		return 2; 

	// This is checked so that we can skip 
	// middle five numbers in below loop 
	if (n % 2 == 0 || n % 3 == 0) 
		return 1; 

	for (int i = 5; i * i <= n; i = i + 6) 
		if (n % i == 0 || n % (i + 2) == 0) 
			return 1; 

	return 2; 
} 

ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i,res%=1000000007; 
    return res; } 
 
 int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
  
 
ll findlcm(ll arr[], int n) 
{ 
   
    ll ans = arr[0]; 
  
    
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
  
    return ans; 
} 
bool sortbysec(const pair<pair<string,int>,int> &a, 
              const pair<pair<string,int>,int> &b) 
{ 
	if(a.first.first==b.first.first)
		return a.first.second > b.first.second;
    return (a.first.first < b.first.first); 
} 
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n,sum=0;
        cin>>n;
        vector<ll>A(n),B(n),C(n);
        for(ll i=0;i<n;i++)
        {
            cin>>A[i];
        }
        for(ll i=0;i<n;i++)
        {
            cin>>B[i];
            if(A[i]-B[i]>0)
            {
                sum=sum+(A[i]-B[i]);
            }
        }
        cout<<sum;
    } 
    return 0;
}


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


int a[3], b[3], c[3][3];


void chk() {
    for(int i = 0; i < 3; ++i) 
        for(int j = 0; j < 3; ++j) {
            if(a[i] + b[j] != c[i][j]) return;
        }
    puts("Yes");
    exit(0);
}

int main() {
    for (int i = 0; i < 3; ++i) for (int j = 0; j < 3; ++j) cin >> c[i][j];
    for(int i = 0; i <= c[0][0]; i++)
        for(int j = 0; j <= c[1][1]; j++)
            for(int k = 0; k <= c[2][2]; k++) {
                a[0] = i, a[1] = j, a[2] = k;
                b[0] = c[0][0] - i;
                b[1] = c[1][1] - j;
                b[2] = c[2][2] - k;
                chk();
            }

    puts("No");
}

Measured memory_bytes: 256
#include <iostream>
     
    using namespace std;
    using ll = long long;
     
    int main()
    {
      ll A, B;
      cin >> A >>B;
      int ans = 0;
      for(;B >= A;ans++){
      	A *= 2LL;
      }
      cout << ans << endl;
    return 0;
    }

Measured memory_bytes: 256
x,n=[int(_) for _ in input().split()]
p=[int(_) for _ in input().split()]
p.sort()

pinv=[True for i in range(102)]

for i in p:
    pinv[i]=False

ab=1000
ans=-1
for i in range(102):
    if (i<0 or pinv[i]) and abs(x-i)<ab:
        ab=abs(x-i)
        ans=i

print(ans)

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

int main(){
	int a,b,c; cin>>a>>b>>c;
	int m=b/a;
	if(m>=c) cout << c << endl;
	else cout << m << endl;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val a = sc.nextInt()
    val b = sc.nextInt()
    if (a == b) println("a == b")
    else
      if (a < b) println("a < b")
    else
      if (a > b) println("a > b")
  }
}



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

const int mx=200010;
const ll mod=1e9+7;


int main(){
  ll n; 
  cin >> n;
  if(n%2){ cout << 0 <<endl; return 0;}
  ll ans=0;
  ll k=5;
  n /= 2;
  while(n>=k){
    ans += n/k;
    k *= 5;
  }
  cout << ans <<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
struct Node
{
    double x, y;
    Node(double xx = 0, double yy = 0){
        x = xx; y = yy;
    }

    Node operator + (Node b){
        return Node(x+b.x, y+b.y);
    }
    Node operator - (Node b){
        return Node(x-b.x, y-b.y);
    }
    Node operator * (double a){
        return Node(a*x, a*y);
    }
    Node operator / (double a){
        return Node(x/a, y/a);
    }

    double norm(){return x*x+y*y;}
    double len(){
        return sqrt(norm());
    }

    bool operator < (const Node &p) const{
        return x!=p.x ? x<p.x : y<p.y;
    }

    bool operator == (const Node &p) const {
        return fabs(x-p.x)<eps && fabs(y-p.y)<eps;
    }
};

typedef Node vtr;

struct line{
    Node a, b;
    line(Node x, Node y){
        a = x, b = y;
    }
};

//向量点积
double dot(vtr a, vtr b){
    return a.x*b.x+a.y*b.y;
}

//向量叉积
double cross(vtr a, vtr b){
    return a.x*b.y-a.y*b.x;
}

//投影 求垂足坐标
//点p在直线p1p2上的投影
Node project(line s, Node p)
{
    vtr base = s.b-s.a;
    double r = dot(p-s.a, base)/base.norm();
    return s.a+base*r;
}

//印象 求p以s为对称轴的对称点
Node reflect(line s, Node p){
    return p+(project(s, p)-p)*2.0;
}

int main()
{
    Node p1, p2, p;
    cin >> p1.x >> p1.y >> p2.x >> p2.y;
    line t = line(p1, p2);
    int q; scanf("%d", &q);
    while(q--)
    {
        cin >> p.x >> p.y;
        p = reflect(t, p);
        printf("%.10f %.10f\n", p.x, p.y);
    }
    return 0;
}



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

int main(){
	int n;
	cin>>n;
	int arr1[n],arr2[n];
	for(int i=0;i<n;i++){
		cin>>arr1[i]>>arr2[i];
	}
	int num=0;
	for(int i=0;i<n;i++){
		if(num>=3)break;
		if(arr1[i]==arr2[i])num++;
		else num=0;
	}
	if(num>=3)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 3568
if __name__ == '__main__':
    N, Y = list(map(int, input().split()))

    for a in range(N+1):
        for b in range(N+1):
            if N-a-b < 0:
                break
            if 10000*a + 5000*b + 1000*(N-a-b) == Y:
                print(a, b, N-a-b)
                exit()
    print(-1, -1, -1)


Measured memory_bytes: 3064
function main(input) {
  input=input.trim();
  const s1 = input.split(" ")[0];
  const s2 = input.split(" ")[1];
  const s3 = input.split(" ")[2];
  console.log(s1.substr(0,1).toUpperCase()+s2.substr(0,1).toUpperCase()+s3.substr(0,1).toUpperCase());
}



main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 1e5;

int a, b;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> a >> b;
    cout << (1 ^ 2 ^ 3 ^ a ^ b);
    return 0;
}


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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long long int s;
	cin>>s;
	const int mod = 1e9;
	long long int r = s%mod;
	if(r)	r=mod-r;
	long long int q = (s+r)/mod;
	cout<<0<<' '<<0<<' '<<mod<<' '<<1<<' '<<r<<' '<<q<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    long long n;
    cin>>n;
    vector<string> s(n);
    
    for(int i=0;i<n;i++){
        cin>>s[i];
        sort(s[i].begin(),s[i].end());
    }
    
    sort(s.begin(),s.end());
    
    vector<long long> count(n,0);
    long long point=0;
    
    for(int i=0;i<n;i++){
        if(i!=0 && s[i]!=s[i-1]) point++;
        count[point]++;
    }
    
    sort(count.begin(),count.end());
    reverse(count.begin(),count.end());
    
    long long ans=0;
    for(auto a:count){
        if(a<=1) break;
        for(long long i=a;i>1;i--){
            ans+=i-1;
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}

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

using namespace std;
using ll=int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi=vector<int>;
using vii=vector<vi>;
using vl=vector<ll>;
using vll=vector<vl>;
using tpi=tuple<int, int, int>;

int main() {
    int N, M;
    cin >> N >> M;
    string S;
    cin >> S;

    vi ans;
    auto pos = N;
    auto miss = 0;
    while (pos != 0) {
        auto max_d = pos - M >= 0 ? M : pos;
        bool can_back = false;
        for (auto i = 0; i < max_d - miss; i++) {
            if (S[pos - (max_d - i)] == '0') {
                pos -= max_d - i;
                ans.push_back(max_d - i);
                miss = i;
                can_back = true;
                break;
            }
        }
        if (!can_back) {
            cout << -1 << endl;
            return 0;
        }
    }

    for (auto i = ans.crbegin(); i!=ans.crend(); i++) {
        cout << *i << " ";
    }
    cout << endl;
    return 0;
}


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

int day[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
string dateString[7] = {
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday"
};

int main() {
    int date[12][31];
    int cnt = 1;
    for (int i=0; i<12; ++i) {
        for (int j=0; j<day[i]; ++j) {
            if (i == 0 && j == 0) {
                date[i][j] = 3;
            } else if (j == 0) {
                date[i][j] = (date[i-1][day[i-1] - 1] + 1) % 7;
            } else {
                date[i][j] = (date[i][j-1] + 1) % 7;
            }
            cnt ++;
        }
    }

    int m, d;
    while (cin >> m >> d, m && d) {
        cout << dateString[date[m-1][d-1]] << endl;
    }
    return 0;
}

Measured memory_bytes: 1200
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''
N = int(input())
a = list(map(int, input().split()))
dp = [[0] * N for _ in range(N)]
#dp[n][i]...n+1:残った要素の個数、i:左端の要素が初期状態のi番目の要素、dp:X-Y

for n in range(N):
	for i in range(N - n):
		if n == 0:
			dp[n][i] = a[i]
		else:
			dp[n][i] = max(a[i] - dp[n - 1][i + 1], a[i + n] - dp[n - 1][i])
			
print(dp[N - 1][0])


Measured memory_bytes: 111836
#include<bits/stdc++.h>
typedef long long ll ;
typedef double db;
typedef unsigned long long ull ;
const double PI = acos(-1) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define for0(i,n)          for(int i=0;i<n;i++)
#define for1(i,n)          for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
//#define gcd(a, b)     __gcd(a, b)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
//#define abs(x)		fabs(x)
#define pcase(z,x)     cout<<"Case "<<z<<": "<<x<<"\n"
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)


using namespace std;
ll lala(ll n)
{
	ll res=(n/3)*2;
	if(n%3==2) res++;
	return res;
}

int main()
{
    CIN;
    int n,m;
    ll l;
    cin>>n>>m;l=n*m;
    cout<<l<<nw;
    return 0;
}

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

int main(){
    int n;
    cin >> n ;
    vector <int> a(n);
    rep(i,n){
        cin >> a[i] ;
    }
    int k;
    k=0;
    rep(i,n){
        if (a[i]%2==0){
            if (a[i]%3!=0 and a[i]%5!=0){
                k=1;
            }
        }
    }
    if (k==0){
        cout << "APPROVED" << endl;
    }
    else{
        cout << "DENIED" << endl;
    }

    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int k = 1;
    for(; k < 1000; k++) if(k * (k + 1) == n * 2) break;
    if(k == 1000){
        cout << "No" << endl;
        return 0;
    }
    int s[1002][1002];
    int now = 1;
    for(int i = 0; i <= k; i++){
        for(int j = 0; j < k; j++){
            if(j < i) s[i][j] = s[j][i - 1];
            else{
                s[i][j] = now;
                now++;
            }
        }
    }
    cout << "Yes" << endl;
    cout << k + 1 << endl;
    for(int i = 0; i <= k; i++){
        cout << k << " ";
        for(int j = 0; j < k; j++) cout << s[i][j] << " ";
        cout << endl;
    }
}

Measured memory_bytes: 4608
#include <stdio.h>
#include <string.h>
char g[50];
char* sign(char *x,char *y,int c){
	g[0]='\0';
	strcpy(g,"(");
	if(c<3)strcat(g,x); else strcat(g,y);
	switch(c%3){
	case 0: strcat(g," - "); break;
	case 1: strcat(g," + "); break;
	case 2: strcat(g," * "); break;
	}
	if(c<3)strcat(g,y); else strcat(g,x);
	strcat(g,")");
	return g;
}
int calc(int x,int y,int c){
	switch(c){
	case 0:if(x-y>=0) return x-y; else return 99;
	case 1:return x+y;
	case 2:return x*y;
	case 3:if(y-x>=0) return y-x; else return 99;
	}
	return 0;
}
int check(int a,int b,int c,int d,int o){
	int i,j,k;
	char p[50],q[50],r[50],s[50];
	sprintf(p,"%d",a);
	sprintf(q,"%d",b);
	sprintf(r,"%d",c);
	sprintf(s,"%d",d);

	for(i=0;i<4;i++){
		for(j=0;j<4;j++){
			for(k=0;k<4;k++){
				if(o){
					if(calc(calc(a,b,i),calc(c,d,j),k)==10){
						strcpy(p,sign(p,q,i));
						strcpy(r,sign(r,s,j));
						strcpy(p,sign(p,r,k));
						printf("%s\n",p);return 1;}
				}

				if(calc(calc(calc(a,b,i),c,j),d,k)==10){
					strcpy(p,sign(p,q,i));
					strcpy(p,sign(p,r,j));
					strcpy(p,sign(p,s,k));
					printf("%s\n",p);return 1;}
			}
		}
	}
	return 0;
}
int main(void){
	int a,b,c,d;
	while(scanf("%d %d %d %d",&a,&b,&c,&d)!=EOF){
		if(a==0 && b==0 && c==0 && d==0)break;
		if(check(a,b,c,d,1))continue;
		if(check(a,c,b,d,1))continue;
		if(check(a,d,c,b,1))continue;
		if(check(c,d,a,b,0))continue;
		if(check(b,d,a,c,0))continue;
		if(check(b,c,a,d,0))continue;
		if(check(a,b,d,c,0))continue;
		if(check(a,c,d,b,0))continue;
		if(check(a,d,b,c,0))continue;
		if(check(c,d,b,a,0))continue;
		if(check(b,d,c,a,0))continue;
		if(check(b,c,d,a,0))continue;
		printf("0\n");
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;


const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

ll n;
vl a;

int main(){
  cin >> n;
  a = vl(n);
  for(ll i = 0;i < n;i++) cin >> a[i];
  ll max_val = *max_element(a.begin(),a.end());
  if(count(a.begin(),a.end(), max_val) == 1){
    for(ll i = 0;i < n;i++){
      if(a.at(i) == max_val){
        ll semi_max_val = 0;
        for(ll j = 0;j < n;j++){
          if(i == j) continue;
          semi_max_val = max(semi_max_val, a.at(j));
        }
        cout << semi_max_val << endl;
      }else{
        cout << max_val << endl;
      }
    }
  }else{
    for(ll i = 0;i < n;i++) cout << max_val << endl;
  }
}


Measured memory_bytes: 3200
S = input()
S = S[::-1]
mod = 10 ** 9 + 7
N = len(S)
table = [[0] * 13 for _ in range(N + 1)]
table[0][0] = 1

dd = 1

for i in range(N):
    if S[i] == '?':
        for k in range(10):
            for j in range(13):
                table[i+1][(j + dd * k)  % 13] += table[i][j]
                table[i+1][(j + dd * k)  % 13] %= mod
    else:
        num = int(S[i])
        for j in range(13):
            table[i+1][(j + dd * num)  % 13] += table[i][j]
            table[i+1][(j + dd * num)  % 13] %= mod

    dd = (dd * 10) % 13

print(table[N][5])


Measured memory_bytes: 61916
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<climits>
#include<cstdlib>
#include<map>
#include<math.h>
#include<utility>
using namespace std;
typedef long long ll;

int main(){
  int n;
  int x[100002], y[100002], t[100002];
  cin >> n;
  x[0] = 0;
  y[0] = 0;
  t[0] = 0;

  for(int i=0; i<n; i++) cin >> t[i+1] >> x[i+1] >> y[i+1];

  bool flag = true;
  for(int i=0; i<n; i++){
    int time = t[i+1] - t[i];
    int distance = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]);
    int diff = time - distance;
    if(diff<0) flag = false;
    else if(diff%2 != 0) flag = false;
    else flag = true;
  }

  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}



Measured memory_bytes: 1408
#include <iostream>
#include <set>
#include <math.h>
#include <vector>
using namespace std;

int main(){
	int n;
	int Id;
	double cm,kg;
	while(cin >> n && n){
		double mi   = 1000000.0;
		int miId = -1;
		for(int i=0;i<n;i++){
			cin >> Id >> cm >> kg;
			if(fabs(22.0 - kg/(cm/100)/(cm/100))<mi){
				mi = fabs(22.0 - kg/(cm/100)/(cm/100));
				miId = Id;
			}
		}
		cout << miId << endl;
			
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define N 200

using namespace std;

char str[N];

int main(){
	int a;
	scanf("%d", &a);
	scanf("%s", str);
	if(a>=3200){
		printf("%s\n", str);
	}
	else printf("red\n");
	return 0;
}

Measured memory_bytes: 256
n, t = map(int, input().split())
ct = [list(map(int,input().split())) for _ in range(n)]

li = []
for i in range(n):
  if ct[i][1] <= t:
    li.append(ct[i])
  else:
    continue

if len(li) > 0:
  li2 = []
  for i in range(len(li)):
    li2.append(li[i][0])
  print(min(li2))
else:
  print("TLE")

Measured memory_bytes: 3064
from itertools import product
S = input()
for x in product(("+","-"),repeat=3):
    if eval(S[0]+x[0]+S[1]+x[1]+S[2]+x[2]+S[3])==7:
        print(S[0]+x[0]+S[1]+x[1]+S[2]+x[2]+S[3]+"=7")
        break

Measured memory_bytes: 38384
#include<stdio.h>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long  n,k,s,p;
   cin>>n>>k;

s=n%k;
p=abs(s-k);
if(p>s)
{
printf("%lld\n",s);
}
else
{
printf("%lld\n",p);
}


}

Measured memory_bytes: 3748
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

int64 large = 1e9;

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

  int64 s; cin >> s;
  int64 x1 = 0, y1 = 0;
  int64 x2 = large, y2 = 1;

  if (s % large == 0) {
    int64 y3 = s / large;
    int64 x3 = 0;
    cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << '\n';
  } else {
    int64 y3 = s / large + 1;
    int64 x3 = large - s % large;
    cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << '\n';    
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#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 ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];
int dp[300000];
int solve(int a[],int i,int n){
if(i>=n-1)return 0;
if(dp[i]!=-1)return dp[i];
if(i<n-2){
    return dp[i]=min(solve(a,i+1,n)+abs(a[i]-a[i+1]),solve(a,i+2,n)+abs(a[i]-a[i+2]));
}
else return dp[i]=solve(a,i+1,n)+abs(a[i]-a[i+1]);
}
int main() {
    ios_base::sync_with_stdio(0);
   ll int t, i, j, k, p, q, r, x, y, u, v, n, m;
    //cin>>t;
   t=1; 
   memset(dp,-1,sizeof dp);
   while(t--){
    cin>>n;
    int a[n];
    fo(i,n)cin>>a[i];
    cout<<solve(a,0,n);


    }
    return 0;
}



Measured memory_bytes: 16068
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, M;
	vector<int> A, temp;
	vector<pair<int,int>> BC;
	int sum = 0;
	
	cin>>N>>M;
	
	A.resize(N);
	BC.resize(M+1);
	
	for(int i = 0; i < N; i++){
		cin>>A[i];
	}
	
	for(int i = 0; i < M; i++){
		cin>>BC[i].second>>BC[i].first;
	}
	
	sort(BC.begin(), BC.end(), greater<pair<int,int>>());
	sort(A.begin(), A.end());
	
	for(int i = 0, con = 0; i < M; i++){
		for(int j = 0; j < BC[i].second; j++){
			temp.push_back(BC[i].first);
			con++;
			if(con > N) break;
		}
		if(con > N) break;
	}
	for(int i = 0; i < N; i++){
		
		if(temp.size() >= i+1)sum += max(temp[i], A[i]);
		else sum += A[i];
		// cout<<temp[i]<<" <><> "<<A[i]<<endl;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3832
/*
 * RD
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#ifndef rd
#define endl '\n'
#endif
#define deb cout<<"Line: "<<__LINE__<<" plz "
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
#define pii pair<int,int>
#define sz(x) ((int)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define all(con) con.begin(),con.end()
const ll inf=1e18;
const int mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//12367769,266916112,123798211
ll powm(ll a, ll b, ll m);

int n,m;
int a[1005];
int b[1005];
int row[1000005];
int col[1000005];
void solve()
{
	cin>>n>>m;
	for(int i=1; i<=n; i++)
	{
		cin>>a[i];
		if(row[a[i]])
		{
			cout<<0<<endl;
			return;
		}
		row[a[i]]=i;
	}
	for(int i=1; i<=m; i++)
	{
		cin>>b[i];
		if(col[b[i]])
		{
			cout<<0<<endl;
			return;
		}
		col[b[i]]=i;
	}
	vector<int> tola;
	tola.pb(0);
	for(int i=1; i<=n; i++)
		for(int j=1; j<=m; j++)
			tola.pb(min(a[i],b[j]));
	sort(all(tola));
	tola.pb(n*m+1);
	ll ans=1;
	for(int i=1,j=0; i<=n*m; i++)
	{
		if((!row[i])&&(!col[i]))
		{
			while(tola[j+1]<i)
				j++;
			ans=(ans*(i-j))%mod;
		}
		else if(row[i]&&col[i])
		{

		}
		else if(row[i])
		{
			int te=0;
			for(int k=1; k<=m; k++)
				if(b[k]>=i)
					te++;
			ans=(ans*te)%mod;
		}
		else
		{
			int te=0;
			for(int k=1; k<=n; k++)
				if(a[k]>=i)
					te++;
			ans=(ans*te)%mod;
		}
	}
	cout<<ans<<endl;
}
signed main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::steady_clock::now().time_since_epoch().count());
	auto clk=clock();
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}
ll powm(ll a,ll b, ll m) {
	ll te=1;
	while(b) {
		if(b&1) te=(te*a)%m;
		a=(a*a)%m;
		b>>=1;
	}
	return te;
}


Measured memory_bytes: 14444
#include <iostream>
#include <unordered_map>
#include <string>

using namespace std;
int main()
{
    unordered_map<string, int> mp;
    long long* arr = new long long[10];
    
    long long H, W, N;
    cin >> H >> W >> N;
    
    for (int i = 0; i < N; i++) {
        long long a, b;
        cin >> a >> b;
        
        for (int x = -1; x <= 1; x++) {
            if (b+x <= 1 || W - 1 < b+x) continue;
            
            for (int y = -1; y <= 1; y++) {
                if (a+y <= 1 || H - 1 < a+y) continue;
                
                mp[to_string(a+y)+","+to_string(b+x)] += 1;
            }
        }
    }
    
    arr[0] = ((H-2) * (W-2));
    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        arr[itr->second]++;
        arr[0]--;
    }
    
    for (int i = 0; i < 10; i++) {
        cout << arr[i] << endl;
    }
    delete[] arr;
}

Measured memory_bytes: 119056
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>

using namespace std;

long long MOD = 1e9 + 7;

unique_ptr<set<unsigned long long>> makeDivisors(unsigned long long n) {
    set<unsigned long long> res;
    for (unsigned long long i = 1; i < sqrt(n) + 1; i++)
    {
        if (n % i == 0) {
            res.insert(i);
            if (i != n / i) {
                res.insert(n / i);
            }
        }
    }
    return make_unique<set<unsigned long long>>(res);
}

unsigned long long gcd(unsigned long long a, unsigned long long b) {
    unsigned long long c = 1;
    while (c != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}


template <typename T>
class SieveOfEratosthenes {
public:
    constexpr explicit SieveOfEratosthenes();
    constexpr explicit SieveOfEratosthenes(T targetValue);
    ~SieveOfEratosthenes();
    explicit SieveOfEratosthenes(SieveOfEratosthenes& other);
    explicit SieveOfEratosthenes(const SieveOfEratosthenes& other);
    explicit SieveOfEratosthenes(const SieveOfEratosthenes&& rhs);
    SieveOfEratosthenes& operator =(const SieveOfEratosthenes& other);
    SieveOfEratosthenes& operator =(const SieveOfEratosthenes&& rhs);
    std::vector<std::pair<T, T>> decompose();
private:
    T _v;

};

template<typename T>
inline constexpr SieveOfEratosthenes<T>::SieveOfEratosthenes()
{
}

template<typename T>
inline constexpr SieveOfEratosthenes<T>::SieveOfEratosthenes(T targetValue)
    :_v(targetValue)
{
}

template<typename T>
inline SieveOfEratosthenes<T>::~SieveOfEratosthenes()
{
}

template<typename T>
inline SieveOfEratosthenes<T>::SieveOfEratosthenes(const SieveOfEratosthenes & other)
{
}

template<typename T>
inline SieveOfEratosthenes<T>::SieveOfEratosthenes(const SieveOfEratosthenes && rhs)
{
}


template<typename T>
inline std::vector<std::pair<T, T>> SieveOfEratosthenes<T>::decompose()
{
    std::vector<std::pair<T, T>> factorizedPrimesAndNum;
    T n = _v;
    for (T i = 2; i * i <= _v; i++)
    {
        if (n % i != 0) {
            continue;
        }
        int num = 0;
        while (n % i == 0) {
            ++num;
            n /= i;
        }
        factorizedPrimesAndNum.emplace_back(std::make_pair(i, num));
    }
    // add n (it n != 1)
    if (n != 1) {
        factorizedPrimesAndNum.emplace_back(std::make_pair(n, 1));
    }
    return factorizedPrimesAndNum;
}


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

    unsigned long long a, b;
    cin >> a >> b;

    unsigned long long gcdValue = gcd(a, b);
    SieveOfEratosthenes<unsigned long long> factorizer(gcdValue);
    auto res = std::move(factorizer.decompose());

    cout << res.size() + 1 << endl;

    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<stack>
#include<string>
#include<sstream>
#include<iomanip>
using namespace std;

int main()
{
	string str;
	while (getline(cin, str))
	{
		stack<double> stf;
		stringstream ss(str);
		string str0;	
		while (ss >> str0)
		{
			double a, b;
			if (str0 == "+")
			{
				b = stf.top();
				stf.pop();
				a = stf.top();
				stf.pop();
				stf.push(a + b);
			}
			else if (str0 == "-")
			{
				b = stf.top();
				stf.pop();
				a = stf.top();
				stf.pop();
				stf.push(a - b);
			}
			else if (str0 == "*")
			{
				b = stf.top();
				stf.pop();
				a = stf.top();
				stf.pop();
				stf.push(a * b);
			}
			else if (str0 == "/")
			{
				b = stf.top();
				stf.pop();
				a = stf.top();
				stf.pop();
				stf.push(a / b);
			}
			else
			{
				stf.push(stod(str0));
			}
		}
		cout << fixed << setprecision(6) << stf.top() << endl;
		stf.pop();
	}
	return 0;
}

Measured memory_bytes: 3176
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public void slove()
    {
        var inputs = Console.ReadLine().Split();
        int a = int.Parse(inputs[0]);
        int b = int.Parse(inputs[1]);
        if(b % a == 0)
            Console.WriteLine(a + b);
        else
        {
            Console.WriteLine(b - a);
        }
    }
    
    static void Main(string[] args)
    {
        new Program().slove();
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <map>


using namespace std;

int main() {
    int t;
    int tmp;
    cin>>t;
    for (int i = 0; i < t; ++i) {
        cin>>tmp;
        if(tmp&1)continue;
        if(tmp%3&&tmp%5) {
            cout <<"DENIED\n";
            return 0;
        }
    }
    cout<<"APPROVED\n";
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define endl "\n"
    #define ll long long int
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define f first
    #define s second
    
    using namespace std;
    void add_self(ll& a,ll b)
    {
        a+=b;
        if(a>=mod)
            a-=mod;
        return;
    }
    void sub_self(ll& a,ll b)
    {
        a-=b;
        if(a<0)
            a+=mod;
        return;
    }
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T=1;
        //cin>>T;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll n,k;
            cin>>n>>k;
            ll dp[k+1]={0};
            dp[0]=1;
            ll upto;
            for(ll child=0;child<n;child++)
            {
                cin>>upto;
                ll pre[k+1]={0};
                for(ll used=k;used>=0;used--)
                {
                    ll l=used+1;
                    ll r=used+min(upto,k-used);
                    if(l<=r)
                    {
                        add_self(pre[l],dp[used]);
                        if(r+1<=k)
                            sub_self(pre[r+1],dp[used]);
                    }   
                }
                ll pref=0;
                for(ll i=0;i<=k;i++)
                {
                    add_self(pref,pre[i]);
                    add_self(dp[i],pref);
                }
            }
            cout<<dp[k];
        }
        return 0;
    }


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; i++)

using namespace std;
int main(){
    string X;
    cin >> X;
    if (X=="ABC")cout << "ARC" << endl;
    else cout << "ABC" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define pb push_back
#define lp(j, n)  for(int j=0; j<(int)(n); ++j)
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define sz(v)    ( (int)((v).size()) )
#define F first
#define S second
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int,string> > vpii;
typedef map<int, int> mii;
const ll N=1e5+5;
ll arr[N],A[N]  ;
bool visited[N]={};
int cnt[N]={};
bool f;
int main()
{
    int n,m,x,c1=0,c2=0;
    cin>>n>>m>>x;
    for(int i=0;i<m&&cin>>arr[i];i++)
    {
        visited[arr[i]]=1;
    }
    for(int i=0 ; i<=x ; i++ )
    {
        if(visited[i])
            c1++;
    }
     for(int i=x ; i<=n ; i++ )
    {
        if(visited[i])
            c2++;
    }
    cout<<min(c1,c2);
go;
}


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

int main() {
  int N,M;
  
  cin >> N >> M ;

  vector<int> k(M);

  vector<vector<int>> s(10, vector<int>(10,0));

  vector<int> p(M);

  for (int i = 0; i < M; i++){
    cin >> k.at(i);
    for(int j=0;j<k.at(i);j++) cin >> s.at(i).at(j);
  }

  for (int i = 0; i < M; i++) cin >> p.at(i);//入力終了

  int ans = 0;

  for(int bit=0;bit<(1<<N);bit++){//bit全探索
    vector<bool> sw(N,false);//スイッチが付いているか
    vector<bool> light(M,false);//ライトが付いているか    

    for(int i=0;i<N;i++){//スイッチのon/off
      if(bit&(1<<i))sw.at(i)=true;  
    }

    for(int i=0;i<M;i++){//それぞれのライトが付いているかの確認
      int on=0;//onのスイッチの数
      for(int j=0;j<k.at(i);j++){//sで指定されたスイッチのうち、onのものを数え上げ
        int n=s.at(i).at(j);
        if(sw.at(n-1)) on++;
      }
      if(on%2==p.at(i)) light.at(i)=true;
    }
    
    bool all=true;//全部付いているか

    for(int i=0;i<M;i++){
      all=all&&light.at(i);
    }
    
    if(all) ans++;

  }

  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256