akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <bitset>
#include <queue>
#include <random>

using namespace std;
using ll = long long;
using ld = long double;

const int N = 1005;
const int mod = 1e9 + 7;

ll dp[2][N];
ll lul[N][N];
ll f[N], fr[N];

ll binpow(ll a, int p) {
    ll res = 1;
    while (p) {
        if (p & 1) {
            (res *= a) %= mod;
        }
        p >>= 1;
        (a *= a) %= mod;
    }
    return res;
}

ll cnk(int n, int k) {
    return f[n] * fr[k] % mod * fr[n - k] % mod;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    f[0] = fr[0] = 1;
    for (int i = 1; i <= n; i++) {
        f[i] = f[i - 1] * i % mod;
        fr[i] = binpow(f[i], mod - 2);
    }
    for (int j = 1; j <= n; j++) {
        lul[0][j] = 1;
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= i; j++) {
            if (i % j) {
                continue;
            }
            lul[i][j] = lul[i - j][j] * f[(i - j) / j] % mod * cnk(i, j) % mod * fr[i / j] % mod;
        }
    }
    dp[0][0] = 1;
    for (int i = a; i <= b; i++) {
        int u = (i - a) & 1;
        int v = u ^ 1;
        copy(dp[u], dp[u] + n + 1, dp[v]);
        for (int w = 0; w < n; w++) {
            for (int k = c; k <= d && w + k * i <= n; k++) {
                dp[v][w + k * i] += dp[u][w] * cnk(n - w, k * i) % mod * lul[k * i][i];
                dp[v][w + k * i] %= mod;
            }
        }
    }
    cout << dp[(b - a + 1) & 1][n] << endl;
    return 0;
}

Measured memory_bytes: 7296
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    ans = 0
    for i in range(1,n+1):
        ans += i*(n+1-i)
    for i in range(n-1):
        u,v = map(int,ipt().split())
        if u > v:
            ints = v
            v = u
            u = ints
        ans -= u*(n+1-v)
    print(ans)
    return None

if __name__ == '__main__':
    main()


Measured memory_bytes: 75888
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <math.h> // sqrt
using namespace std;
typedef long long ll;

int main() {
    ll D;
    cin >> D;
    vector<ll> c(26);
    for (int i = 0; i < 26; i++) {
        cin >> c.at(i);
    }
    vector<vector<ll>> s(D, vector<ll>(26));
    for (int i = 0; i < D; i++) {
        for (int j = 0; j < 26; j++) {
            cin >> s.at(i).at(j);
        }
    }
    vector<ll> v(26, 0);
    ll vd = 0;
    ll td = 0;
    for (ll i = 0; i < D; i++) {
        ll sumc = 0;
        for (int j = 0; j < 26; j++) {
            ll sumca = c.at(j) * (i + 6 - v.at(j));
            if (sumc < sumca) {
                vd = j;
            }
            sumc = max(sumc, sumca);
        }
        v.at(vd) = i + 1;
        td = vd + 1;
        cout << td << endl;
    }
}


Measured memory_bytes: 3736
#include<bits/stdc++.h>
using namespace std;
int main() {
	string a,b,c,d;
	cin>>a;
	b=a.substr(0,5);
	c=a.substr(6,7);
	d=a.substr(14,5);
	cout<<b<<" "<<c<<" "<<d;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
using namespace std;

#define INF 1e18
#define int long long

template<class T> inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

signed main() {
    int n; cin >> n;
    vector<vector<int>> abc(n + 1, vector<int> (3, 0));
    for(int i = 0; i < n; i++) {
        cin >> abc[i][0] >> abc[i][1] >> abc[i][2];
    }

    vector<vector<int>> dp(n + 1, vector<int> (3, 0));

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < 3; j++) {
            for(int k = 0; k < 3; k++) {
                if(j != k) {
                    chmax(dp[i + 1][k], dp[i][j] + abc[i][k]);
                }
            }
        }
    }

    int ans = 0;
    for(int i = 0; i < 3; i++) {
        chmax(ans, dp[n][i]);
    }

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


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

int bubbleSort(int A[], int N) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = N - 1; j >= i + 1; j--) {
			if (A[j] < A[j - 1]) {
				swap(A[j], A[j - 1]);
				flag = 1;
				sw++;
			}
		}
	}
	return sw;
}

int main() {
	int A[100], N, sw;
	cin >> N;
	for (int i = 0; i < N; i++)cin >> A[i];

	sw = bubbleSort(A, N);

	for (int i = 0; i < N; i++) {
		if (i)cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << sw << endl;

	return 0;
}

Measured memory_bytes: 3084
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())

lis = [-1]*N
for i in range(N):
    a = As[i]
    lis[a-1] = str(i+1)
print(' '.join(lis))


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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

using namespace std;
using P = pair<int, int>;

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; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int N, Z, W; cin >> N >> Z >> W;
    vector<int> a( N );
    REP( i, N ) cin >> a[i];

    if( N == 1 ) cout << abs( a[0] - W ) << endl;
    else cout << max( abs( a[N - 1] - a[N - 2] ), abs( a[N - 1] - W ) ) << endl;;
}


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

int main() {
  string s, ans; cin >> s;
  for(int i=0;i<s.size();i++) {
    if(s[i]!='B') ans += s[i];
	else if(ans.size()!=0) ans.erase(--ans.end());
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
using System;

namespace AtCoder_20190218
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');


            int N = int.Parse(str[0]);
            int A = int.Parse(str[1]);
            int B = int.Parse(str[2]);

            int Result = 0;

            for (int i = 1; i <= N; i++)
            {
                int keta1 = i % 10;
                int keta2 = (i / 10) % 10;
                int keta3 = (i / 100) % 10;
                int keta4 = (i / 1000) % 10;
                int keta5 = (i / 10000) % 10;

                int total = keta1 + keta2 + keta3 + keta4 + keta5;

                if(A<=total&&total<=B)
                {
                    Result += i;
                }
            }

            Console.WriteLine(Result);
        }
    }
}


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

struct Dijkstra {
  Dijkstra () {}
  Dijkstra (int n) { init(n); }

  struct edge {
    edge () {}
    edge (int to, long long cost) : to(to), cost(cost) {}

    int to;
    long long cost;
  };

  const long long linf = 1001001001001001001ll;

  vector<vector<edge>> G;
  vector<long long> d;

  void init(int n) {
    G.resize(n);
  }

  void add(int u, int v, long long c) {
    G[u].push_back(edge(v, c));
  }

  void dijkstra(int s) {
    d = vector<long long>(G.size(), linf);
    priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> q;

    d[s] = 0;
    q.push(make_pair(0, s));

    while (!q.empty()) {
      pair<long long, int> p = q.top();
      q.pop();

      int v = p.second;
      if (d[v] < p.first) continue;
      for (auto &e : G[v]) {
        if (d[e.to] > p.first + e.cost) {
          d[e.to] = p.first + e.cost;
          q.push(make_pair(d[e.to], e.to));
        }
      }
    }
  }

  void dijkstra() { dijkstra(0); }
};

int main() {
  int n, m, r;
  cin >> n >> m >> r;

  Dijkstra g(n);
  // vector<vector<edge>> G(n);
  for (int i = 0; i < m; ++i) {
    int u, v, c;
    cin >> u >> v >> c;

    g.add(u, v, c);
    // G[u].push_back(edge(v, c));
    // G[v].push_back(edge(u, c));
  }

  g.dijkstra(r);
  // vector<long long> &d = Dijkstra(r, G);
  for (int i = 0; i < g.d.size(); ++i) {
    if (g.d[i] == 1001001001001001001ll) cout << "INF" << endl;
    else cout << g.d[i] << endl;
  }
}

Measured memory_bytes: 19320
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
using namespace std;
int mod = 1e9+7;

int main() {

  int n, m;
  cin >> n >> m;
  vector< pair<int, int> > p(m);
  for(int i=0; i<m; i++) {
    cin >> p[i].second >> p[i].first;
  }
  sort(p.begin(), p.end());

  int cnt = 0;
  int pos = 0;
  for(int i=0; i<m; i++){
    if( p[i].second <= pos && pos < p[i].first ) {
      continue;
    } else {
      cnt++;
      pos = p[i].first - 1;
    }
  }
  cout << cnt << endl;
  return 0;
}

//


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

struct wakasagi {
    int a, v;
    wakasagi(int A, int V) : a(A), v(V) {};
};

bool operator <(wakasagi A, wakasagi B) {
    if (A.v != B.v) return A.v < B.v;
    else return A.a > B.a;
}

int main()
{
    int n, a, v;
    cin >> n;
    vector<wakasagi> vec;
    for (int i = 0; i < n; ++i) {
        cin >> a >> v;
        vec.push_back(wakasagi(a, v));
    }
    vector<wakasagi>::iterator top =
        max_element(vec.begin(), vec.end());
    cout << top->a << " " << top->v << endl;
}

Measured memory_bytes: 1200
def main():
    n = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        ans *= a
        if ans > 10 ** 18:
            print(-1)
            break
    else:
        print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 21568
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,n,m;
  
  cin >> a >> b;
  
  n = min(a,b);
  m = max(a,b);
  vector<int> ans(m);
  
  for(int i = 0;i<m;i++){
    cout << n;
  }
  cout << endl;
}

Measured memory_bytes: 256
import math
a, b = [int(i) for i in input().split()]
# int(0.08x)=a
# int(0.1x) = b
first = [math.ceil(12.5*a), math.floor(12.5*a+12.5)]
second = [10*b, 10*b+9]
if second[0] < first[1] and first[0] < second[1]:
    print(max(second[0], first[0]))
else:
    print(-1)

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

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

    vector<int> A(n);
    rep(i, n) {
        cin >> A[i];
    }

    vector<int> B(n + 1);
    for (int i = 0; i < n; i++) {
        B[i + 1] += (B[i] + A[i]);
        B[i + 1] %= m;
    }

    map<int, int> M;
    ll cnt = 0;
    for (int i = 0; i < n + 1; i++) {
        cnt += M[B[i]];
        M[B[i]]++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 6788
n, m, x, y = map(int, input().split())

jpn = sorted(list(map(int, input().split())))
usa = sorted(list(map(int, input().split())))

a = list(range(jpn[-1]+1, usa[0]+1))

if not a:
    print('War')
    exit()

for i in a:
    if x < i <= y:
        print('No War')
        exit()

print('War')


Measured memory_bytes: 3060
#include <iostream>

using namespace std;
#include <atcoder/lazysegtree>
#include <atcoder/modint>
#include <cstdio>

using namespace atcoder;

using mint = modint998244353;

struct S{
    mint value;
    mint size;
};
using F = long long;

const F ID = 998244354;

S op(S a, S b){ return {a.value+b.value, a.size+b.size}; }
S e(){ return {0, 0}; }
S mapping(F f, S x){
    if(f != ID) x.value = f*x.size;
    return x;
}
F composition(F f, F g){ return (f == ID ? g : f); }
F id(){ return ID; }

using seg_t = lazy_segtree<S, op, e, F, mapping, composition, id>;
int main() {
    int n, q;
    cin >> n >> q;

    vector<S> a(n), b(n);
    mint p = 1;
    for (int i = n-1; i >= 0; i--) {
        a[i] = S{1, p};
        p *= 10;
    }

    seg_t seg(a);
    seg.apply(0,n,1);

    for (int i = 0; i < q; ++i) {
        int l, r, d; cin >> l >> r >> d;
        seg.apply(l-1,r,d);
        mint ans = seg.all_prod().value.val();
        cout << ans.val() << endl;
    }
}


Measured memory_bytes: 12504
package main

import (
        "fmt"
)

func d(n int) int{
        sum := 0
        for n > 0{
                sum += n % 10
                n = n / 10
        }
        return sum
}

func main(){
        var n int
        fmt.Scan(&n)

        s := d(n)

        if n % s == 0{
                fmt.Println("Yes")
        }else{
                fmt.Println("No")
        }
}

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

int main() {
  int N;
  std::cin >> N;

  std::vector<int> X(N);

  for (int i=0; i<N; i++) {
    std::cin >> X[i];
  }

  int ans = 1000000000;

  for (int P=1; P<101; P++) {
    int sum = 0;
    for (auto x : X) {
      sum += (x - P) * (x - P);
    }
    ans = std::min(ans, sum);
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

const int M = 13;

string s;
ll t = 1, ans;
ll dp[2][13];
int ho = 0, ge = 1;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    dp[ho][0] = 1;
    for (int i = (int)s.size()-1; i >= 0; i--) {
        rep(j,M) dp[ge][j] = 0;
        if (s[i] != '?') {
            int x = s[i]-'0';
            rep(j,M) dp[ge][(t*x+j)%M] = dp[ho][j];
        } else {
            rep(j,10) {
                rep(k,M) dp[ge][(t*j+k)%M] += dp[ho][k];
            }
            rep(j,M) dp[ge][j] %= MOD;
        }
        t = t * 10 % M;
        swap(ho,ge);
    }
    cout << dp[ho][5] << endl;
}


Measured memory_bytes: 512
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int maxh = 1e3+5, mod = 1e9+7;
int H,W, dp[maxh][maxh], g[maxh][maxh];

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>H>>W;
    char c;
    for(int i = 0; i< H; i++){
        for(int j = 0; j< W; j++){
            cin>>c;
            if(c == '.')g[i][j] = 0;
            else g[i][j] = 1;
        }
    }
    
    dp[0][0] = 1;
    for(int i = 0; i<H; i++){
        for(int j = 0 ; j< W; j++){
            if(g[i][j]==1){
                dp[i][j] = 0;
                continue;
            }
            if(j-1>=0)dp[i][j] = (dp[i][j] + (dp[i][j-1]%mod))%mod;
            if(i-1>=0)dp[i][j] = (dp[i][j] + (dp[i-1][j]%mod))%mod;
        }
    }
    cout<<dp[H-1][W-1]<<endl;
    return 0;
}





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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

typedef vector<ll> Array;
typedef vector<Array> Graph;

pll dfs(ll now, ll par, Graph &G){
	pll res = {0, now};
	REP(i, G[now].size()){
		ll next = G[now][i];
		if(next == par) continue;
		auto cost = dfs(next, now, G);
		cost.first += 1;
		res = max(res, cost);
	}
	return res;
}

ll tree_diameter(Graph &G){
	pll res1 = dfs(0, -1, G);
	pll res2 = dfs(res1.second, -1, G);
	return res2.first;
}

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

    ll N;
    cin >> N;
    Graph G(N);
    REP(i, N-1){
    	ll a, b;
    	cin >> a >> b;
    	a--;b--;
    	G[a].push_back(b);
    	G[b].push_back(a);
    }
    ll diam = tree_diameter(G);
    //dump(diam)
    cout << (diam%3 == 1 ? "Second" : "First") << endl;
    return 0;
}

Measured memory_bytes: 26880
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int t = sc.nextInt();
        int result = (t / a) * b;
        System.out.println(result);
        sc.close();
    }
}

Measured memory_bytes: 23764
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from heapq import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def Sieve(x):
	checkPrime = [1 for i in range(x+1)]
	zz = 2
	L = []
	while(zz**2 <= x):
		if(checkPrime[zz] == 1):
			for i in range(zz*2,x+1,zz):
				checkPrime[i] = 0
		zz += 1
	for i in range(2,x):
		if(checkPrime[i] == 1):
			L.append(i)
	return checkPrime

primes = Sieve(200)

def solve(x):
	ans = 0
	z = 0
	# x = 200
	d = defaultdict(int)
	# dp = [0]*3
	ans = 0
	# x = 3
	for i in range(1,x+1):
		for j in range(1,x+1):
			for k in range(1,x+1):
				# z += 1
				g = gcd(gcd(i,j),k)
				# d[g] += 1
				# print(i,j,k,'-->',g)
				ans += g
				# if(i == j == k):
				# 	dp[i-1] = ans
				# 	print('------'*4)
	# print(d)
	# print(dp)
	# ans = 
	# ans += 1
	# ans = 0
	# for i in range(1,x+1):
	# 	for j in range(i+1,x+1):
	# 		for k in range(j+1,x+1):
	# 			ans += 1
	return ans

N = int(stdin.readline())
ans = solve(N)
print(ans)


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

int n;
lld p[111],q[111],r[111],t[111];
lld dp[111];

lld lcm(int a,int b){
  return a / __gcd(a,b)*b;
}

lld solve(int n){
  if(dp[n] != -1) return dp[n];
  lld left = 1,right = 1;
  if(r[n] != -1) left = solve(r[n]);
  if(t[n] != -1) right = solve(t[n]);
  lld ret = lcm(left * p[n],right * q[n]);
  return dp[n] = ret / p[n] + ret / q[n];
}

int main(){
  while(cin >> n ,n){
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++){
      cin >> p[i] >> q[i] >> r[i] >> t[i];
      r[i]--; t[i]--;
    }
    lld ret = 0;
    for(int i=0;i<n;i++){
      ret = max(ret,solve(i));
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 1168
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <list>
#include <iomanip>
#include <numeric>

using namespace std;
typedef long long ll;
ll mod = 1000000007;

template<class Type>
Type modpow(Type a, Type n, Type mod)
{
	Type res = 1;
	while (0 < n) {
		if (n & 1) {
			res = res * a % mod;
		}
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	for (int i = 0; i < n; i++) cin >> h[i];
	sort(h.begin(), h.end());
	reverse(h.begin(), h.end());
	ll ans = 0;
	for (int i = k; i < n; i++) ans += h[i];
	cout << ans << endl;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var S = Read();
            if (S == "Sunny")
            {
                Println("Cloudy");
            }
            else if (S == "Cloudy")
            {
                Println("Rainy");

            }
            else if (S == "Rainy")
            {
                Println("Sunny");
            }
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}



Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<ll> x(N),y(N),h(N);
  for(int i=0;i<N;i++){
    cin>>x[i]>>y[i]>>h[i];
  }
  int H;
  for(int cx=0;cx<=100;cx++){
    for(int cy=0;cy<=100;cy++){
      //Hの特定
      for(int i=0;i<N;i++){
        if(h[i]==0) continue;
        H=h[i]+abs(x[i]-cx)+abs(y[i]-cy);
        break;
      }

      //整合性
      bool flag=true;
      for(int i=0;i<N;i++){
        if(max(H-abs(x[i]-cx)-abs(y[i]-cy),0LL)!=h[i]){
          flag=false;
          break;
        }
      }
      if(flag){
        cout<<cx<<" "<<cy<<" "<<H<<endl;
        return 0;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 256
def isPrime(x):
    if x == 2:
        return True
    
    if x<2 or x%2==0:
        return False
    
    i = 3
    while i <= x**0.5:
        if  x % i == 0:
            return False
        i += 2
    
    return True

n = int(input())
count = 0
for i in range(n):
    if isPrime(int(input())):
        count += 1

print(count)


Measured memory_bytes: 5672
#include <cstdio>
#include <cstring>
using namespace std;

typedef unsigned int U;
#define L 1<<21
bool HA[L];
char T[256];

int main() {
    U n, s, t;
    char c;
    T['A'] = (char)1, T['C'] = (char)2, T['G'] = (char)3, T['T'] = (char)4;
    scanf("%d", &n);
    while ( getchar() != '\n' );
    for ( register U i = 0; i++ < n; ) {
        s = 0;
        t = 1;
        bool flag = ( c = getchar() ) == 'i';
        while ( ( c = getchar() ) != ' ' );
        while ( ( c = T[getchar()] ) != 0 ) {
            s += c * t;
            t *= 4;
        }
        if ( flag ) {
            HA[s] = true;
        } else {
            puts( HA[s] ? "yes" : "no" );
        }
    }
    return 0;
}

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

string str;
int i, ok1;
int main()
{
    cin>>str;
    for (i=0;i<str.size();i++)
    {
        if (str[i]=='C') ok1=1;
        if (str[i]=='F' && ok1==1) {cout<<"Yes\n";return 0;}
    }
    cout<<"No\n";
    return 0;
}


Measured memory_bytes: 888
from collections import OrderedDict
import numpy as np

N = int(input())
a = np.array([int(i) for i in input().split()])

scores = OrderedDict()
scores[1] = 0
scores[400] = 0
scores[800] = 0
scores[1200] = 0
scores[1600] = 0
scores[2000] = 0
scores[2400] = 0
scores[2800] = 0
scores[3200] = 0

for record in a:
  for s in list(scores.keys())[::-1]:
    if record>=s:
      scores[s] += 1
      break
      
colors = np.sum([
  int(v>0) for k, v in scores.items() if k<3200])

if scores[3200]>0 and colors==0:
  min_colors = 1
else: 
  min_colors = colors
max_colors = colors + scores[3200]

print(min_colors, max_colors)

Measured memory_bytes: 12428
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

int main() {
    int X; cin >> X;
    vector<int> R = {400,600,800,1000,1200,1400,1600,1800,2000};
    rep(i,9) {
        if (X < R[i]) {
            cout << 9 - i << '\n';
            return 0;
        }
    }
    return 0;
}

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}
ll LCM(int a, int b){
    return a*b/gcd(a,b);
}

int main(void){
    int ans=0;
    vector<int> a(3);
    cin>>a[0]>>a[1]>>a[2];
    while(a[0]!=a[1]||a[1]!=a[2]){
        sort(a.begin(),a.end());
        if(a[2]-a[0]>1)a[0]+=2;
        else if(a[2]-a[0]>0 && a[2]-a[0]>0){
            a[0]++;
            a[1]++;
        }
        //cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
        ans++;
    }
    cout<<ans<<endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MD 1000000007
using namespace std;
typedef long long ll;
ll dp[3010][3010];
bitset<3010> bs;
int n;
void ds(int id) {
	ll tot =0;
	if(bs[id]) {
		for(int i=0;i<=id;i++) {
			tot += dp[id][i];
			tot %= MD;
			dp[id+1][i+1] = tot;
		}
	} else {
		for(int i=id;i>=0;i--) {
			tot += dp[id][i];
			tot %= MD;
			dp[id+1][i] = tot;

		}
	}
}

int main() {
	scanf("%d ",&n);
	memset(dp,0,sizeof(dp));
	bs.reset();
	for(int i=0;i<n-1;i++) {
		char c;
		scanf("%c ",&c);
		if(c == '<') bs.set(i);
	}
	for(int i=0;i<n;i++) {dp[0][i] = 1;}
	for(int i=0;i<n;i++) {
		ds(i);
	}
	ll val = dp[n][0];
	/*
	for(int i=0;i<=n;i++) {
		for(int j=0;j<=n;j++) {
			printf("%lld\t",dp[j][n-i]);
		}
		printf("\n");
	}
	*/
	val %= MD;
	printf("%lld\n",val);
}


Measured memory_bytes: 71040
import java.io.*;

class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));// ??\????????????????????????
            String line = br.readLine();
            int x = Integer.parseInt(line);
            
            int a = x*x*x;
            System.out.println(a);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 24204
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

#define INF 1000000007

int main(){
  long long h, n;
  cin >> h >> n;
  vector<long long> a(n);
  vector<long long> b(n);
  vector<long long> dp(h+1, INF);
  dp[0] = 0;
  for(long long i = 0; i < n; i++){
    cin >> a[i] >> b[i];
  }
  for(long long i = 1 ; i <= n ; i++){
    for(long long j = 0; j <= h; j++){
      dp[min(h, j + a[i-1])] = min(dp[min(h, j + a[i-1])], dp[j] + b[i-1]);
    }
  }
  cout << dp[h] << endl;
}


Measured memory_bytes: 512
N = int(input())
s = [0]*N
l = [0]*N
for i in range(N):
    a, b = map(int, input().split())
    s[i] = (a, b)
 
for i in range(N):
    c, d = map(int, input().split())
    l[i] = (c, d)




V = N*2 # 頂点数
MAX_V = V
G = [0]*MAX_V # グラフの隣接リスト表現
for i in range(MAX_V):
    G[i] = []
match = [0]*MAX_V # マッチングのペア
used = [False]*MAX_V # DFSで既に調べたかのフラグ

# uとvを結ぶ辺をグラフに追加する
def addEdge(u, v):
    G[u].append(v)
    G[v].append(u)

##
for a in range(N):
    (rx, ry) = s[a]
    for b in range(N):
        (bx, by) = l[b]
        if rx < bx and ry < by:
            addEdge(a, b+N)


# 増加パスをDFSで探す
def dfs(v):
    used[v] = True
    for i in range(len(G[v])):
        u = G[v][i]
        w = match[u]
        if w < 0 or (not used[w]) and dfs(w):
            match[v] = u
            match[u] = v
            return True
    return False

# 二部グラフの最大マッチングを求める
def bipartiteMatching():
    res = 0
    for i in range(len(match)):
        match[i] = -1
    for v in range(V):
        if match[v] < 0:
            for i in range(len(used)):
                used[i] = False
            if dfs(v):
                res += 1
    return res


#print(G)
#print(match)
print(bipartiteMatching())



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

#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; while(t--)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef vector<LL> vi;

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep = ""; for(const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << "\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

const int mod = 1e9+7;
const int N = 1e3+5;

char grid[N][N];
LL dp[N][N];

void solve(){
    int h, w;
    cin >> h >> w;
    for(int i = 1; i <= h; ++i)
        for(int j = 1; j <= w; ++j)
            cin >> grid[i][j];

    memset(dp, 0, sizeof dp);
    dp[1][1] = 1;
    for(int i = 1; i <= h; ++i){
        for(int j = 1; j <= w; ++j){
            if(grid[i][j] == '.'){
                dp[i][j] = (dp[i][j] + dp[i-1][j] + dp[i][j-1]) % mod;
            }
            else{
                dp[i][j] = 0;
            }
        }
    }


    cout << dp[h][w] << "\n";
}

int main()
{
    Fast;
    //louisfghbvc{
        solve();
    //}
    return 0;
}


Measured memory_bytes: 12492
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using Tup = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fl cout<<flush;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl '\n'
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld pi=3.141592653589793238;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    string S;
    cin >> S;
    prt(S.substr(0,3))

    return 0;
}


Measured memory_bytes: 3648
def func(x):
    cnt = 0
    while True:
        if x % 2 == 0:
            cnt += 1
            x = x // 2
        else:
            return cnt


N = int(input())
a = list(map(int, input().split()))

cnt = 0
for i in range(N):
    cnt += func(a[i])

print(cnt)


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

int main(){
    int H,W;
    int count_w=0;
    int dp[100][100]={};
    char temps;

    cin >> H >> W;
    for(int i=1;i<=H;i++){
        for(int j=1;j<=W;j++){
            cin >> temps;
            if(temps=='.'){
                dp[i][j]=5000; //白マス初期化
                count_w++;
            }
            else{
                dp[i][j]=-1; //黒マス初期化   
            }
        }
    }

    dp[1][1]=1;
    int flag=1;
    while(flag){
        flag=0;
        for(int i=1;i<=H;i++){
            for(int j=1;j<=W;j++){
                if(dp[i][j]!=-1){
                    int tempij=dp[i][j]+1;
                    if(tempij<dp[i][j-1]){
                        dp[i][j-1] = tempij;
                        flag = 1;
                    }
                    if(tempij<dp[i-1][j]){
                        dp[i-1][j] = tempij;
                        flag = 1;
                    }
                    if(tempij<dp[i][j+1]){
                        dp[i][j+1] = tempij;
                        flag = 1;
                    }
                    if(tempij<dp[i+1][j]){
                        dp[i+1][j] = tempij;
                        flag = 1;
                    }
                }
            }
        }
    }

    if(dp[H][W] == 5000){
        cout << -1 << "\n";
    }
    else{
        cout << count_w - dp[H][W] << "\n";
    }

    return 0;
}


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

using namespace std;

typedef short sho;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str; 
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll; 
typedef pair<ld,ld> pld;
 
typedef vector<int> vi; 
typedef vector<ll> vl; 
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pld> vpd;

#define mp make_pair 
#define FF first
#define SS second
#define sz(x) (int)x.size()
#define begin(x) (x).begin() 
#define end(x) (x).end()
#define rbegin(x) (x).rbegin()
#define rend(x) (x).rend()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front 
#define pb push_back
#define pp push
#define lb lower_bound 
#define ub upper_bound

inline void checkmin(int &x,int y){x=min(x,y);}
inline void checkmax(int &x,int y){x=max(x,y);}

int n,m;
int s[10],c[10];

map<int,int> mm;
int ans[5];

int main() {
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /* start code */
    cin>>n>>m;
    if(n==1&&m==0)
    {
		cout<<0<<endl;
		return 0;
	}
    for(int i=0;i<m;i++)
    {
    	cin>>s[i]>>c[i];
    	if(mm.count(s[i]))
    	{
    		if(mm[s[i]]!=c[i])
    		{
    			cout<<-1<<endl;
    			return 0;
			}
		}
		else
		{
			mm[s[i]]=c[i];
		}
	}
	int mn=1e9;
	for(auto it : mm)
	{
		mn=min(mn,it.first);
		ans[it.first]=it.second;
		if(it.first==1&&it.second==0&&n!=1)
		{
			cout<<-1<<endl;
			return 0;
		}
	}
	
	if(mn>1)
	{
		ans[1]=1;
	}
	for(int i=1;i<=n;i++)
	{
		cout<<ans[i];
	}
	cout<<endl;
    /* end code */
	return 0;
}

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

#define int long long

int dev(int a){
    int cnt = 0;
    while(a % 2 == 0){
        ++cnt;
        a /= 2;
    }
    return cnt;
}

signed main() {
    int N;
    cin >> N;
    
    int a;
    int cnt = 0;
    
    for(int i = 0; i < N; ++i){
        cin >> a;
        cnt += dev(a);
    }
    
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)	

int max(int a, int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


int main(){
	string n;
	cin >> n;
	bool f = false;
	rep(i, 3) {
		if (n.at(i) == '7')f = true;
	}
	if (f)cout << "Yes" << endl;
	else cout << "No" <<endl;
} 

Measured memory_bytes: 3028
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll> P;
typedef vector<vector<int> > Graph;
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; }



int main(){
    int n;
    cin >> n;
    vector<ll>a(n);
    ll ans = 0;
    int minus=0;
    rep(i,n){
        cin >> a[i];
        if(a[i]<0)minus++;
        a[i]=abs(a[i]);
        ans += abs(a[i]);
    }
    sort(a.begin(),a.end());
    if(minus%2==0)cout<<ans<<endl;
    else{
        ans-=a[0]*2;
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdlib>
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
int A,B,C;

int main(int argc, char const *argv[])
{
    cin>>A>>B>>C;
    if(A==B){
        cout<<C<<endl;
    }else if(B==C){
        cout<<A<<endl;
    }else{
        cout<<B<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
# APC001D
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))


from collections import defaultdict
import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
ns = defaultdict(set)
for _ in range(m):
    u,v = map(int, input().split())
    ns[u].add(v)
    ns[v].add(u)

score = 0
count = 0
others = []
seen = [False] * n
for start in range(n):
    if seen[start]:
        continue
    count += 1
    q = [start]
    s = [a[start]]
    seen[start] = True
    while q:
        u = q.pop()
        for v in ns[u]:
            if not seen[v]:
                heapq.heappush(s, a[v])
                q.append(v)
                seen[v] = True
    score += heapq.heappop(s)
    for item in s:
        heapq.heappush(others, item)

if n<2*(count-1):
    print("Impossible")
elif count==1:
    print(0)
else:
    for _ in range(2*(count-1)-count):
        score += heapq.heappop(others)
    else:
        print(score)

Measured memory_bytes: 106724
#include <stdio.h>

int main() {
	int n,S[14],H[14],C[14],D[14];
	char alp[2];
	int num = 0;
	rewind(stdin);
	for (int i = 0; i < 14; i++) {
		S[i] = H[i] = C[i] = D[i] =0;
	}
	scanf("%d", &n);

	for (int i = 0; i <n; i++) {
		scanf("%s %d",alp,&num);
		if (alp[0] == 'S') {
			S[num] = 1;
		}else if (alp[0] == 'H') {
			H[num] = 1;
		}else if (alp[0] == 'C') {
			C[num] = 1;
		}else if (alp[0] == 'D') {
			D[num] = 1;
		}
	}
	
	for (int i = 1; i < 14; i++) {
		if (S[i] == 0) {
			printf("%c %d\n", 'S', i);
		}
	}
	for (int i = 1; i < 14; i++) {
		if (H[i] == 0) {
			printf("%c %d\n", 'H', i);
		}
	}
	for (int i = 1; i < 14; i++) {
		if (C[i] == 0) {
			printf("%c %d\n", 'C', i);
		}
	}
	for (int i = 1; i < 14; i++) {
		if (D[i] == 0) {
			printf("%c %d\n", 'D', i);
		}
	}
}



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

using namespace std;
typedef long long ll;
const int INF = 1e9;

int main(){
	ll T = 1;
	//cin >> T;
	while (T--){
     int n;
     cin >> n;
     int x = n % 10;
     if (x == 2 || x == 4 || x == 5 || x == 7 || x == 9) {
		 cout << "hon" << endl;
	 } else if (x == 0 || x == 1 || x == 6 || x == 8) { 
		 cout << "pon" << endl;
	 } else if (x == 3) { 
		 cout << "bon" << endl;
	 }
	 
	}
}
	



Measured memory_bytes: 3568
/*=============================================================================================================================/*
                                               Bismillahir Rahmanir Rahim

      _     ____  ___  ____   _   _  _         ___  ____   _         _     __  __
     / \   / ___||_ _|| __ ) | | | || |       |_ _|/ ___| | |       / \   |  \/  |
    / _ \  \___ \ | | |  _ \ | | | || |        | | \___ \ | |      / _ \  | |\/| |
   / ___ \  ___) || | | |_) || |_| || |___     | |  ___) || |___  / ___ \ | |  | |
  /_/   \_\|____/|___||____/  \___/ |_____|   |___||____/ |_____|/_/   \_\|_|  |_|

   _   __           __  __  __
  |_) (_  _  o__   /   (_  |_
  |_)o__)(_  || |  \__ __) |__

    ___                    _   _      _                _ _               __   ___                 _         _        _
   / __|_ _ ___ ___ _ _   | | | |_ _ (_)_ _____ _ _ __(_) |_ _  _   ___ / _| | _ ) __ _ _ _  __ _| |__ _ __| |___ __| |_
  | (_ | '_/ -_) -_) ' \  | |_| | ' \| \ V / -_) '_(_-< |  _| || | / _ \  _| | _ \/ _` | ' \/ _` | / _` / _` / -_|_-< ' \
   \___|_| \___\___|_||_|  \___/|_||_|_|\_/\___|_| /__/_|\__|\_, | \___/_|   |___/\__,_|_||_\__, |_\__,_\__,_\___/__/_||_|
                                                            |__/                           |___/


   FB: https://facebook.com/SIAsibul
   Gmail: asibulislam8@gmail.com

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

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vii;
typedef vector<pil> vil;
typedef vector<pli> vli;
typedef vector<pll> vll;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,n) for(int i=0;i<(n);i++)
#define f1(i,n) for(int i=1;i<=(n);i++)
#define f2(i,a,n) for(int i=(a);i<=(n);i++)
#define fr(i,n,a) for(int i=(n);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
#define nl "\n"


const int INF = 1e9 + 5;
const int MXN = 2e5 + 5;


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

    string s;
    cin >> s;

    f0(i, s.size())
        s[i] = (s[i] - 'A' + n) % 26 + 'A';

    cout << s << nl;
    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <string>


using namespace std;

int main()
{
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}

	vector<vector<long long>> dp(h + 1, vector<long long>(w + 1));
	dp[0][1] = 1;
	int mod = 1000000007;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') {
				dp[i + 1][j + 1] = 0;
			}
			else {
				dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1];
				dp[i + 1][j + 1] %= mod;
			}
		}
	}
	cout << dp[h][w] << endl;

	return 0;
}

Measured memory_bytes: 9216
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int,int> pii;
int n,m;
vector<pii> E[101010];
int vis[101010];
const int inf = 2100000000;
int x[101010];
void dfs(int v){
    if (x[v] == inf)x[v]=0;
    vis[v] = 1;
    for(auto e : E[v]){
        x[e.first] = x[v] + e.second;
        if (vis[e.first] == 0)dfs(e.first);
    }
}
int main(){
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++){
        int l,r,d;
        scanf("%d%d%d",&l,&r,&d);
        E[l].emplace_back(r,d);
        E[r].emplace_back(l,-d);
    }

    for(int i=1;i<=n;i++){
        if(vis[i] == 0){
            dfs(i);
        }
    }
    int fail = 0;
    for(int i=1;i<=n;i++){
        for(auto e :E[i]){
            if (x[e.first] - x[i] != e.second){
                fail = 1;
                break;
            }
        }
        if(fail)break;
    }
    printf("%s\n", fail?"No":"Yes");
}

Measured memory_bytes: 11520
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        char[] sca = S.toCharArray();
        List<BIT> cnts = new ArrayList<>();
        for(int i=0;i<26;i++){
            cnts.add(new BIT(N+10));
        }
        for(int i=0;i<N;i++){
            int ind = S.charAt(i)-'a';
            cnts.get(ind).addTo(i + 1, 1);
        }
        int Q = sc.nextInt();
        for(int i=0;i<Q;i++){
            int qt = sc.nextInt();
            if(qt == 1){
                int iq=sc.nextInt()-1;
                String cq=sc.next();
                int toc=cq.charAt(0)-'a';
                int fromc = sca[iq]-'a';
                if(fromc != toc) {
                    cnts.get(fromc).addTo(iq + 1, -1);
                    sca[iq] = cq.charAt(0);
                    cnts.get(toc).addTo(iq + 1, 1);
                }
            }else{
                int lq=sc.nextInt();
                int rq=sc.nextInt();
                long res = cnts.stream().filter(bit->
                        bit.sumTo(rq)-bit.sumTo(lq-1)>0
                ).count();
                System.out.println(res);
            }
        }


    }
    private static class BIT{
        int[] vals;
        int len;
        BIT(int n){
            len = n;
            vals = new int[len+1];
            Arrays.fill(vals, 0);
        }
        public void addTo(int ind, int val){
            while(ind <= len){
                vals[ind] += val;
                ind += btmBit(ind);
            }
        }

        public int sumTo(int ind){
            int sum = 0;
            while(ind > 0){
                sum += vals[ind];
                ind -= btmBit(ind);
            }
            return sum;
        }

        private static int btmBit(int a){
            return a&(-a);
        }

        @Override
        public String toString(){
            StringBuilder bld = new StringBuilder();
            for(int i=0;i<len+1;i++){
                bld.append(sumTo(i));
            }
            return bld.toString();
        }
    }
}


Measured memory_bytes: 128924