akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <utility>
 
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define ALL(a) begin(a), end(a)
 
using ll = long long;
using namespace std;
 
constexpr int INF = 2147483647; // 2 * 1e9
constexpr ll LLINF = 9223372036854775807; // 9 * 1e18
 
struct edge { int to, cost; };
using P = pair<int, int>;
 
int n, q, k;
vector<edge> G[100000];
vector<ll> d;
 
void dfs(int v, int p, ll c) {
	d[v] = c;
	for (const auto &e : G[v]) {
		if (e.to == p) continue;
		dfs(e.to, v, c + e.cost);
	}
}
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	REP(i, n - 1) {
		int a, b, c;
		cin >> a >> b >> c;
		--a, --b;
		G[a].push_back(edge{ b, c });
		G[b].push_back(edge{ a, c });
	}
	d = vector<ll>(n);
	cin >> q >> k;
	dfs(k - 1, -1, 0);
	REP(i, q) {
		int x, y;
		cin >> x >> y;
		cout << d[--x] + d[--y] << "\n";
	}
 
	return 0;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define rep(i,n)  for(int i = 0; i < n; i++)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define unique(a)       sort((a).begin(), a.end()), (a).erase(unique((a).begin(), (a).end()),(a).end())
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"

using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;

LL gcd(LL a, LL b)
{
	if (!a)return b; return gcd(b%a, a);
}
double intlog(double base, double x) {
	return (double)((double)log(x) / (double)log(base));
}

int main()
{
	string s1, s2;
	cin >> s1 >> s2;
	int count = 0;
	rep(i, 3)
	{
		if (s1[i] == s2[i])count++;
	}
	cout << count << endl;
	
}













Measured memory_bytes: 256
while True:
    N = int(input())
    if N == 0:
        break
    air = [input() for _ in range(N)]
    codes = [''.join(x for i, x in enumerate(s) if i == 0 or s[i-1] in 'aiueo') for s in air]
    max_len = max(len(x) for x in codes)
    for k in range(1, max_len + 1):
        if len(set(x[:k] for x in codes)) == N:
            print(k)
            break
    else:
        print(-1)

Measured memory_bytes: 7624
function Main(input){
    input = input.split("\n");
    var n = parseInt(input[0],10);
    var q = parseInt(input[2],10);
    input[1] = input[1].split(" ");
    input[3] = input[3].split(" ");
    var s = Array(n),t = Array(q);
    for(var i = 0;i < n;i++){
        s[i] = parseInt(input[1][i],10);
    }
    for(var i = 0;i < q;i++){
        t[i] = parseInt(input[3][i],10);
    }
    var count = 0;

    for(var i = 0;i < q;i++){
        var j;
        for(j = 0;j < n;j++){
           if(s[j] == t[i])
                break;
        }
        if(j < n)
            count++;
    }
    console.log(count);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

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

using namespace std;

using node=struct{int to;};
using G=vector<vector<node>>;

tuple<vector<int>,G> scc(const G &graph){
	int n=graph.size(),k=0,m=0;
	vector<int> ord(n,-1),low(n),comp(n,-1),par(n);
	stack<int>s;

	function<void(int,int,int&,int&)> dfs=[&](int v,int p,int &k,int &m){
		ord[v]=k++,low[v]=ord[v],par[v]=p;
		s.push(v);

		for(auto &e:graph[v]){
			if(ord[e.to]==-1){
				dfs(e.to,v,k,m);
				chmin(low[v],low[e.to]);
			}else if(comp[e.to]==-1){
				chmin(low[v],ord[e.to]);
			}
		}

		if(ord[v]==low[v]){
			while(1){
				int u=s.top();s.pop();
				comp[u]=m;
				if(u==v) break;
			}
			m++;
		}
	};

	rep(v,n) if(ord[v]==-1) dfs(v,-1,k,m);
	G dag(m);
	rep(v,n) for(auto &e:graph[v]) if(comp[v]!=comp[e.to]) dag[comp[v]].push_back({comp[e.to]});
	return make_tuple(comp,dag);
}

vector<int> topological_sort(const G &graph) {
	int n=graph.size();
	vector<int> order,used(n,false);
	
	function<void(int)> dfs=[&](int v){
		used[v]=true;
		for(auto &e:graph[v]){
			if(!used[e.to])
				dfs(e.to);
		}
		order.push_back(v);
	};

	rep(v,n) if(!used[v]) dfs(v);
	reverse(_all(order));
	return order;
}

using ll=long long;
const ll mod=1000000007LL;

inline ll ADD(const ll &a, const ll &b,const ll &mod) { return a+b<mod?a+b:a+b-mod;}
inline ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}

ll dp[1010][2];

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

	G graph(n);
	rep(loop,m){
		int a,b;
		cin >> a >> b;
		graph[a-1].push_back({b-1});
	}

	G dag;
	vector<int> comp,order;
	tie(comp,dag)=scc(graph);
	order=topological_sort(dag);
	
	rep(v,n) dp[v][0]=dp[v][1]=1LL;
	ll ans=1LL;

	for(auto &v:order){
		vector<int> already(dag.size(),false);
		for(auto &e:dag[v]){
			if(already[e.to]) continue;
			already[e.to]=true;
			dp[e.to][0]=MUL(dp[e.to][0],dp[v][0],mod);
			dp[e.to][1]=MUL(dp[e.to][1],ADD(dp[v][0],dp[v][1],mod),mod);
		}
		if(dag[v].empty()){
			ll cur=ADD(dp[v][0],dp[v][1],mod);
			ans=MUL(ans,cur,mod);
		}
	}

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

Measured memory_bytes: 3312
#include<stdio.h>
int main()
{
    int a,b,c,can_hold,bottle2_remain;
    scanf("%d%d%d",&a,&b,&c);
    can_hold=a-b;
    bottle2_remain=c-can_hold;
    if(bottle2_remain<1)
        printf("0\n");
    else
        printf("%d\n",bottle2_remain);
    return 0;
}


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

using namespace std;

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

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

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

  ll x;
  cin >> x;

  vll plus(10000);
  REP(i, 2000) {
    plus[i] = i * i * i * i * i;
  }

  rep(i, 2000) {
    rep(j, i + 1) {
      if (plus[i] + plus[j] == x) {
        cout << i << " " << -j << endl;
        return 0;
      } else if (plus[i] - plus[j] == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3736
import copy

H, W, K = map(int, input().split())
S = [list(input()) for _ in range(H)]

ans = 0
for i in range(2**H):
  #print(i)
  tmp = copy.deepcopy(S)      
  #print(tmp)
  keta_i = 0
  ii = i
  while ii > 0:
    if ii & 1:
      #print(tmp)
      for k in range(W):
        tmp[keta_i][k] = "."
    keta_i += 1
    ii = ii >> 1
  #if i == 1:
    #print(tmp)
  for j in range(2**W):
    tmp2 = copy.deepcopy(tmp)
    keta_j = 0
    jj = j
    while jj > 0:
      if jj & 1:
        for l in range(H):
          #print(i,j,k,l,keta_i,keta_j)
          #print(tmp2)
          tmp2[l][keta_j] = "."
      keta_j += 1
      jj = jj >> 1
      #print(j)
    
    count = 0
    for l in range(H):
      for k in range(W):
        if tmp2[l][k] == "#":
          count += 1
    
    if count == K:
      ans += 1
      #print(i,j)
      
print(ans)    

Measured memory_bytes: 9356
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

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

	for(int n; cin >> n, n;) {
		string message;
		cin >> message;

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

		for(int i = n - 1; i >= 0; --i) {
			swap(message[a[i]], message[b[i]]);
			message[a[i]] = (message[a[i]] - 'a' + (b[i] - a[i]) + 26) % 26 + 'a';
			message[b[i]] = (message[b[i]] - 'a' + (b[i] - a[i]) + 26) % 26 + 'a';
		}

		cout << message << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
#define FOR(i, m, n) for (ll i = m; i < (n); i++)
#define RFOR(i, m, n) for (ll i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
//#define print(ele) cout << (ele) << "\n"
#define print10(ele) cout << fixed << setprecision(10) << (ele) << "\n"

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}

int n, m, q;
ivec a, b, c, d;
int ans;

void dfs(ivec A) {
  if (A.size() == n + 1) {
    int now = 0;
    REP(i, q) {
      if (A[b[i]] - A[a[i]] == c[i]) now += d[i];
    }
    ans = max(ans, now);
    return;
  }

  A.push_back(A.back());
  while (A.back() <= m) {
    dfs(A);
    A.back()++;
  }
}

int main() {
  cin >> n >> m >> q;
  a = b = c = d = ivec(q);
  REP(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i];
  dfs(ivec(1, 1));
  print(ans);
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnt[26] = {};
    for (int i = 0; i < n; i++) {
        cnt[s[i] - 'a']++;
    }
    int ans = 1;
    for (int i = 0; i < 26; i++) {
        ans = (1ll * ans * (cnt[i] + 1)) % MOD;
    }
    cout << (ans - 1 + MOD) % MOD << endl;
}

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

using namespace std;
#define ll long long

const int N = 2e5 + 5, mod = 1e9 + 7;
vector<int> g[N];
int sz[N];
int n;

int fp(int a, int p) {
    if (!p) return 1;
    int t = fp(a, p >> 1);
    t = (t * 1LL * t) % mod;
    if (p & 1) t = (t * 1LL * a) % mod;
    return t;
}

int ans = 0;

void dfs(int node, int par) {
    sz[node] = 1;
    for (auto child:g[node]) {
        if (child == par)continue;
        dfs(child, node);
        sz[node] += sz[child];
    }
    int prop = fp(fp(2, n - 1), mod - 2);
    for (auto child:g[node]) {
        if (child == par)continue;
        int x = sz[child];
        //2^x - 1 / 2 ^ n
        prop = (prop + ((fp(2, x) - 1 + mod) % mod * 1LL * fp(fp(2, n - 1), mod - 2)) % mod) % mod;
    }
    int x = n - sz[node];
    prop = (prop + ((fp(2, x) - 1 + mod) % mod * 1LL * fp(fp(2, n - 1), mod - 2)) % mod) % mod;
    prop = (1 - prop + mod) % mod;
    prop = (prop * 1LL * fp(2, mod - 2)) % mod;
    ans = (ans + prop) % mod;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i + 1 < n; i++) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(1, 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 25344
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
#print(l)
def count(first,second):
    ok = second
    ng = n
    while ng-ok>1:
        mid = (ng+ok)//2
        if l[first]+l[second] > l[mid]:
            ok = mid
        else:
            ng = mid
    return ok - second

for first in range(n):
    for second in range(first+1,n):
        # thirdはfirst + second > third
        ans += count(first,second)

print(ans)

Measured memory_bytes: 44252
#include<stdio.h>
#include<stdlib.h>

int less(const void* a, const void* b){
  return *(int*)a - *(int*)b;
}

int is_no_need(int i, const int* a, int K, int N){
  int dp[K];
  dp[0] = 1;
  for(int k = 1; k < K; k++) dp[k] = 0;
  
  for(int j = 1; j <= N; j++){
    if(j == i) continue;
    
    for(int k = K - 1; k >= a[j]; k--){
      dp[k] |= dp[k - a[j]];
    }
  }
  
  for(int k = K - 1; k >= 0; k--){
    if(dp[k]) return k + a[i] < K;
  }
}

int count_no_need(const int* a, int K, int N){
  //不必要でないカードのうち, 書かれた数が最小であるもの
  int need = N + 1;
  //不必要であるカードのうち, 書かれた数が最大であるもの
  int no_need = 0;
  
  while(need - no_need > 1){
    int i = (need + no_need) / 2;
    
    if(is_no_need(i, a, K, N)) no_need = i;
    else need = i;
  }
  
  return no_need;
}

int main(){
  int N, K;
  scanf(" %d %d ", &N, &K);
  
  int a[N + 1];
  a[0] = 0;
  for(int i = 1; i <= N; i++) scanf(" %d ", a + i);
  qsort(a, N + 1, sizeof(int), less);
  
  printf("%d\n", count_no_need(a, K, N));
  
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_a() {
	ll x, y, n, k, a, b;
	string s, t;
	// ans = 0;
	string ans = "NG";

	cin >> n;

	if ((n % 10) == 2 ||
		(n % 10) == 4 ||
		(n % 10) == 5 ||
		(n % 10) == 7 ||
		(n % 10) == 9) {
		ans = "hon";
	}
	else if ((n % 10) == 0 ||
		(n % 10) == 1 ||
		(n % 10) == 6 ||
		(n % 10) == 8) {
		ans = "pon";
	}
	else if ((n % 10) == 3) {
		ans = "bon";
	}

	cout << ans << "\n";

	return;
}


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

	solve_abc_a();

	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long ll;

ll n, p, ans=1;
int main() {
	cin >> n >> p;
	if(n==1) {return printf("%lld", p)*0;}
	for(ll i=1; pow(i,n)<=p; i++) {
		if(p % (ll)pow(i,n) == 0) ans = i;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 512
from collections import Counter
N = int(input())
answer = []
answer2 = []
lis = []
lis2 = []
for i in range(N):
    x, y = map(int, input().split())
    lis.append([x, y])
    lis2.append([y, x])
sort_lis = sorted(lis)
sort_lis2 = sorted(lis2)

if N == 1:
    print(1)
    exit()

for i in range(N-1):
    for j in range(i+1,N):
        answer.append([sort_lis[i][0] -sort_lis[j][0],sort_lis[i][1]-sort_lis[j][1]])
ans = list(map(tuple,answer))

a = Counter(ans).most_common()

print(len(lis)-a[0][1])


Measured memory_bytes: 3692
from heapq import heapify, heappop, heappush
from collections import defaultdict

n,m,s,t = map(int,input().split())
s-=1
t-=1
edge_a = defaultdict(set)
edge_b = defaultdict(set)
for i in range(m):
    u,v,a,b = map(int, input().split())
    u -= 1
    v -= 1
    edge_a[u].add((v, a))
    edge_a[v].add((u, a))
    edge_b[u].add((v, b))
    edge_b[v].add((u, b))

def djikstra(s,edges):
    n = len(edges)
    visited = {}
    q = []
    while len(visited) != n:
        if len(visited) == 0:
            next_p = s
            visited[s] = 0
        else:
            while q:
                cost, to_ = heappop(q)
                if to_ not in visited:
                    visited[to_] = cost
                    next_p = to_
                    break

        for to_, cost in edges[next_p]:
            if cost >= 0 and to_ not in visited:
                heappush(q, (visited[next_p] + cost, to_))
    return visited

cost_a = djikstra(s,edge_a)
cost_b = djikstra(t, edge_b)

ans = []
for i in range(n)[::-1]:
    nokori = 10**15 - cost_a[i] - cost_b[i]
    if len(ans) == 0:
        ans.append(nokori)
    else:
        ans.append(max(nokori, ans[-1]))
print(*ans[::-1], sep="\n")

Measured memory_bytes: 127420
#include<stdio.h>
int b[4][2],c,d[16]={0};
void f(int a){
  if(a==16){
    c++;
    return ;
  }
  if(d[a]){
    f(a+1);
    return ;
  }
  int i;
  for(i=0;i<4;i++){
    int y=(a/4)+b[i][1],x=(a%4)+b[i][0];
    if(y<0||3<y||x<0||3<x)continue;
    if(d[y*4+x])continue;
    d[a]=d[y*4+x]=1;
    f(a+1);
    d[a]=d[y*4+x]=0;
  }
  return ;
}
int main(){
  int i;
  while(scanf("%d",&b[0][0]),b[0][0]<5){
    scanf("%d",&b[0][1]);
    for(i=1;i<4;i++)scanf("%d %d",&b[i][0],&b[i][1]);
    f(c=0);
    printf("%d\n",c);
  }
  return 0;
}

Measured memory_bytes: 600
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
          Copyright                    */
#include<bits/stdc++.h>
using namespace std;
/// Pragmas:
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2") //Enable AVX
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
#define vi vector<int>
#define sz(a) int((a).size())
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,n) for(int i=(1);i<=(n);i++)
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 200005;
const int mod = 1000000007;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 2000000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Test.insert(x)late ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b % mod;
    int pwur = qpow(b,e>>1);
    return (pwur * pwur) % mod;
}
int modinv(int x){
    return qpow(x,mod-2);
}

/// My Code -------------------------------------------------

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));
    //freopen("a.in","r",stdin);
    //freopen("a.in","w",stdout);
    string s;
    cin>>s;
    vi freq(26,0);
    for(char ch:s){
        freq[ch-'a']=true;
    }
    rep(i,26){
       if(freq[i]==0){
          cout<<char(i+'a');
          return 0;
       }
    }
    cout<<"None";
    return 0;
}


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

int n,m;
vector<int> to[200005];
vector<int> ans;
vector<bool> seen;

int main(){
	cin >> n >> m;
	ans.resize(n+1,0);
	seen.resize(n+1,false);
	rep(i,m){
		int a,b;
		cin >> a >> b;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	queue<int> que;
	que.push(1);
	while(!que.empty()){
		int v = que.front();
		que.pop();
		seen[v] = true;
		for(auto next: to[v]){
			if(ans[next] != 0) continue;
			ans[next] = v;
			que.push(next);
		}
	}
	cout << "Yes" << endl;
	REP(i,n){
		if(i == 1) continue;
		cout << ans[i] << endl;
	}
	
    return 0;
}



Measured memory_bytes: 12528
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
const int maxn=100010;
typedef long long ll;
int main()
{
    ll s;
    cin >> s;
	ll a=0,b=0,c=0,d=0;
    a=d=sqrt(s);
    //cout << a << d << endl;
	while(s>a*d)
    {
		if(a < d) a++;
		else d++;
	}
	ll k=a*d-s;
	for(int i=1;i<=sqrt(k);i++)
    {
		if(!(k%i))
        {
			if(i<=1e9&&k/i<=1e9)
            {
				b=i;
				c=k/i;
				break;
			}
		}
	}
	cout << 0 << " " << 0 << " " << a << " " << b << " " << c << " " << d <<endl;
    return 0;
}

Measured memory_bytes: 3644
import bisect

N = int(input())
L = map(int, input().split())

SL = sorted(L)
ans = 0
for i in range(N):
  if i+1 == N-1:
    break
  a = SL[i]
  for j in range(i+1, N):
    b = SL[j]
    c_max = bisect.bisect_left(SL, a+b)
    ans += c_max - (j+1)

print(ans)

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
#include <bitset>
#include <queue>
using namespace std;

int main(){
    long long n, m;
    cin >> n >> m;
    long long ans = 0;
    if(n >= m/2){
        cout << m/2 << endl;
    }else{
        ans += n;
        m -= n*2;
        ans += m/4;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import           Control.Monad
import           Data.Array
import qualified Data.ByteString.Char8 as BS
import           Data.List
import           Data.Maybe
import           Data.Ord

readInts :: IO [Int]
readInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

main = do
  a <- read <$> getLine
  b <- read <$> getLine
  print $ 6 - a - b


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

using namespace std;
 
#define int1(a) scanf("%d",&a)
#define int2(a,b) scanf("%d %d",&a,&b)
#define int3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define int4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)
 
#define lint1(a) scanf("%lld",&a)
#define lint2(a,b) scanf("%lld %lld",&a,&b)
#define lint3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define lint4(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define lli long long int
 
#define pint(x) printf("%d",x)
#define plint(x) printf("%lld",x)
#define endl '\n'
#define nl printf("\n");
#define ps printf(" "); 
 
#define all(x) x.begin(),x.end()
#define pb push_back
#define Set(a, s) memset(a, s, sizeof (a))
#define mod1 (lli)(1e9 + 7)
#define mod2 (lli)(1e9 + 9)
#define EPS 1e-9

#define fore(i,n) for(int i=n; i>=0; i--)
#define fors(i,a,n) for(int i=a; i<n; i++)
#define fora(i,ele) for(auto i: ele)
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<lli> vli;
 
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
 
double tick(){static clock_t oldt,newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt=newt;return diff;}
float roundoff(float val, float p){ return floor(val*pow(10.0,p)+0.5)/pow(10.0,p);}
lli power(lli a, lli b, lli mod){lli x=1,y=a; while(b > 0){if(b&1){x=(x*y)%mod;}y = (y*y)%mod; b /= 2;}return x;}
 
const int INF = 0x3f3f3f3f;
const float pi = 3.14159265;
 
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};
//int dx[]={1,-1,0,0}; int dy[]={0,0,1,-1};
 
 vi dp;
 vector<vi> graph;
 int dfs(int u, int p){
	 //trace1(u);
	 int maxm = -1;
	 if(dp[u]!=-1) return dp[u];
	 for(auto v: graph[u]){
		 //trace2(u,v);
		 if(dp[v] != -1) maxm = max(dp[v],maxm); 
		 else{
			 maxm = max(maxm,dfs(v,u));
		 }
		 //trace1(maxm);
	 }
	 if(maxm != -1)
	 return dp[u] = maxm+1;
	 else return dp[u] = 0;
 }
 
int main(void) {
    ios_base::sync_with_stdio(true);
    cin.tie(NULL);
    cout.tie(NULL);
	//srand (time(NULL));
	/*
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	*/
    // cout<<"Execution time : "<<tick()<<"\n";
    
    int n,m;
    int2(n,m);
    
    dp.resize(n,-1);
    
    graph.resize(n);
    
    fors(i,0,m){
		int a,b;
		int2(a,b);
		a--,b--;
		
		graph[a].pb(b);
	}
	int maxm = 0;
	fors(i,0,n)
		maxm = max(maxm,dfs(i,-1));
    cout<<maxm;
    return 0;
}


Measured memory_bytes: 9472
import Control.Monad
import Data.List

solve :: [[Int]] -> [Int]
solve [] = []
solve ((k:as):ass) = as ++ solve ass

main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine
  as <- replicateM n $ map read . words <$> getLine
  print . length . filter (==n) . map length . group . sort $ solve as

Measured memory_bytes: 1148
// C.

#include <iostream>
#include <sstream>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <vector>

using namespace std;

typedef long long LL;

int n, m, q;
vector<tuple<int, int, int, int>> v;
LL ans;

void dfs(vector<int> seq) {
	if (seq.size() < n) {
		for (int i = seq.back(); i <= m; ++i) {
			vector<int> next = seq;
			next.emplace_back(i);
			dfs(next);
		}
	} else {
		LL score = 0;
		for (int i = 0; i < q; ++i) {
			if (seq[get<1>(v[i])] - seq[get<0>(v[i])] == get<2>(v[i])) {
				score += get<3>(v[i]);
			}
		}
		ans = max(ans, score);
	}
}

int main(int argc, char* argv[]) {
	cin >> n >> m >> q;
	for (int i = 0; i < q; ++i) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		v.emplace_back(a - 1, b - 1, c, d);
	}
	for (int i = 1; i <= m; ++i) {
		dfs({ i });
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
  int n;
  cin >>n;
  vector<int> a(n);
  rep(i,n) cin >>a[i];
  sort(a.begin(), a.end());
  int ans = a[a.size()/2]-a[a.size()/2-1];
  cout << ans << endl;
  return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)

const char sp = ' ';
const char cmm = ',';
const int MOD = 1000000007;

using ll = long long;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}



int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

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

    vector<int> x;
    for(int i = 1; i <= 100; ++i){
        if(a%i == 0 and b%i == 0){
            x.push_back(i);
        }
    }

    sort(x.rbegin(), x.rend());
    ppp(x[k-1]);





    return 0;
}


Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    flg=1
    n=INT()
    w=[]
    for i in range(n):
        w.append(STR())
    ws=set(w)
    if len(ws)!=len(w):
        flg=0
    for i in range(n-1):
        if w[i][-1]!=w[i+1][0]:
            flg=0
    if flg==1:
        print('Yes')
    else:
        print('No')
    
if __name__ == '__main__':
    do()

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

vector<int> preorder, inorder;
bool f = false;
void recover(int fp, int lp, int fi, int li){
        int root;
        for(int i = fi; i < li; i++){
                if(preorder[fp] == inorder[i]){
                        root = i;
                        break;
                }
        }
        if(fi < root) recover(fp + 1, fp + root - fi + 1, fi, root);//左側を表示
        if(root < li - 1) recover(fp + root - fi + 1, lp, root + 1, li);//右側を表示
        if(f == true) cout << ' ';
        cout << inorder[root];
        f = 1;
}

int main(){
        int n, tmp;
        cin >> n;
        for(int i = 0; i < n; i++){
                cin >> tmp;
                preorder.push_back(tmp);
        }
        for(int i = 0; i < n; i++){
                cin >> tmp;
                inorder.push_back(tmp);
        }
        recover(0, preorder.size(), 0, inorder.size());
        cout << endl;
        return 0;
}



Measured memory_bytes: 3144
/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_A&lang=jp
 */
import java.util.*;
public class Main {
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int[] t = new int[q];
		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}
		int cnt = 0;
		for (int i = 0; i < q; i++) {
			for (int j = 0; j < n; j++) {
				if (s[j] == t[i]) {
					cnt++;
					break;
				}
			}
		}
		System.out.println(cnt);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}



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

int main(){
    int n;
    cin >> n;
    vector<pair<int,int>> red,blue;
    for(int i=0; i<n; i++){
        int a,b;
        cin >> a >> b;
        red.push_back(make_pair(a,b));
    }
    for(int i=0; i<n; i++){
        int a,b;
        cin >> a >> b;
        blue.push_back(make_pair(a,b));
    }
    sort(blue.begin(),blue.end());
    int ans = 0;
    for(int i=0; i<n; i++){
        auto d = red.end();
        for(auto p = red.end(); p >= red.begin(); p--){
            if((*p).first < blue[i].first && 
                    (*p).second < blue[i].second){
                if(d == red.end()) d=p;
                else {
                    if((*d).second < (*p).second) d=p;
                }
            }
        }
        if(d != red.end()){
            ans++;
            red.erase(d);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
i=1
while i<=n:
    if i%3==0:
        print(" " + str(i),end='')
    else:
        x=i
        while x>0:
            if x%10==3:
                print(" " + str(i),end='')
                break
            x//=10
    i+=1
print()


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

bool solve(vector<int> nums, int conb)
{
	//if(conb==4) return true;
	int now=0;
	while(nums[now]==0&&now<9) now++;

	if(now==9) return true;
	if(nums[now]>2) //刻子にする場合
	{
		nums[now]-=3;
		if(solve(nums,conb+1)) return true;
		nums[now]+=3;
	}

	if(now<7&&nums[now]&&nums[now+1]&&nums[now+2]) //順子にする場合
	{
		nums[now]-=1;	
		nums[now+1]-=1;	
		nums[now+2]-=1;	
		if(solve(nums,conb+1)) return true;
		nums[now]+=1;	
		nums[now+1]+=1;	
		nums[now+2]+=1;	
	}
	
	return false;

}


int main()
{
	string in;
	while (cin>>in) 
	{
		bool ans[9];
		fill(ans,ans+9,false);
		vector<int> nums(9,0);
		for(int i = 0; i < 13; ++i)
		{
			nums[in[i]-'1']++;
		}
		/*for(int i = 0; i < 9; ++i)
		{
			cout<<i+1<<"="<<nums[i]<<endl;
		}*/
		vector<int> cp=nums;
		for(int i = 1; i < 10; ++i)
		{
			if(cp[i-1]==4) continue;
			cp[i-1]++;
			for(int j = 1; j < 10; ++j)
			{
				if(cp[j-1]<1) continue;
				cp[j-1]-=2;
				if(solve(cp,0)) ans[i-1]=true;
				cp[j-1]+=2;
			}
			cp[i-1]--;	
		}
	
		int cnt=0;
		for(int i = 0; i < 9; ++i)
		{
			if(ans[i])
			{
				if(cnt!=0) cout<<" "<<i+1;
				else cout<<i+1;
				cnt++;
			}
		}
		if(cnt==0) cout<<0;
		cout<<endl;
	}
  return 0;
}

Measured memory_bytes: 1204
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		int n = 0;
		int score = 0;
		String query = "";

		int north[] = {0,2,6,3,4,1,5};
		int east[] = {0,4,2,1,6,5,3};
		int west[] = {0,3,2,6,1,5,4};
		int south[] = {0,5,1,3,4,6,2};
		int right[] = {0,1,3,5,2,4,6};
		int left[] = {0,1,4,2,5,3,6};

		int dice[] = {0,1,2,3,4,5,6};
		int newdice[] = {0,1,2,3,4,5,6};

		while (true){
			//initialize
			score = 1;
			n = Integer.parseInt(std.next());
			if (n==0){break;}
			for (int i=1; i<7; i++){
				dice[i] = i;
				newdice[i] = i;
			}

			for (int i=0; i<n; i++){
				query = std.next();
				if (query.equals("North")){
					for (int j=1; j<7; j++){newdice[j] = dice[north[j]];}
				}else if (query.equals("East")){
					for (int j=1; j<7; j++){newdice[j] = dice[east[j]];}
				}else if (query.equals("West")){
					for (int j=1; j<7; j++){newdice[j] = dice[west[j]];}
				}else if (query.equals("South")){
					for (int j=1; j<7; j++){newdice[j] = dice[south[j]];}
				}else if (query.equals("Right")){
					for (int j=1; j<7; j++){newdice[j] = dice[right[j]];}
				}else if (query.equals("Left")){
					for (int j=1; j<7; j++){newdice[j] = dice[left[j]];}
				}

				score += newdice[1];
				for (int j=1; j<7;j++){
					dice[j] = newdice[j];
				}

			}

			System.out.println(score);
		}
	}
}

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

int main(){
  int h,m,s,h2,m2,s2,ans;
  for(int i=0;i<3;i++){
    cin>>h>>m>>s>>h2>>m2>>s2;
    ans=0;
    while(1){
      if(h==h2&&m==m2&&s==s2)break;
      if(m==60)m=s=0,h++;
      else if(s==60)s=0,m++;
      else s++,ans++;
    }
    cout<<ans/(60*60)<<' ';
    ans%=(60*60);
    cout<<ans/60<<' ';
    ans%=60;
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
#define MAXN 200001

inline void read(int &T) {
	int x=0;bool f=0;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=!f;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	T=f?-x:x;
}

int n,a[MAXN];
std::map<int,int> m;

int main() {
	read(n);
	for(int i=1;i<=n;++i) {
		read(a[i]);
		++m[a[i]+i];
	}
	long long ans=0;
	for(int i=1;i<=n;++i) {
		if(i>a[i]) ans+=m[i-a[i]];
	}
	std::cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 14600
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		
		String S = stdin.next();
		
		if(S.equals("Sunny")) {
			System.out.print("Cloudy");
		}
		else if(S.equals("Cloudy")) {
			System.out.print("Rainy");
		}
		else {
			System.out.print("Sunny");
		}
	}
}

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

int main() {
	int N, K, min = 512;
  	cin >> N;
  
		for (int i = 0; i < N; i++) {
          int A;
          cin >> A;
          K = 0;
          
          while (A%2 == 0) {
              K++;
              A /= 2;
          }
          
          if (K <= min) min = K;
        }
  
  cout << min << endl;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;
using System.Numerics;

namespace abc142
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_abc142A();
        }

        public static void solve_abc142A()
        {
            int n = Convert.ToInt32(Console.ReadLine());

            double res = n % 2 == 0 ? (double)(n / 2) / n : ((double)(n / 2) + 1) / n;

            Console.WriteLine("{0:F16}", res);
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
//typedef pair<int, int> P;

int main() {

	int N;
	cin >> N;

	string s;
	cin >> s;
	int len = s.size();

	vector<char>abc = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };

	for (int i = 0; i < len; i++) {
		for (int j = 0; j < abc.size(); j++) {
			if (s[i] == abc[j]) {
				cout << abc[(j + N) % abc.size()];
				break;
			}
		}
	}

	return 0;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int n[6], count=0, coin[] = { 500,100,50,10,5 };

    for (int i=0; i<6; i++) 
{
cin >> n[i];
if(!n[i])break;
}

    for (int i=0;i<6;i++) {
	if(n[i] == 0) break;

	int s=1000 - n[i];

	for (int j=0;j<5;j++) {
	   int m = s / coin[j];
	   count += m;
	   s -= m * coin[j];
	}

	count += s;
	cout << count << endl;
count = 0;
    }
    return 0;
}

Measured memory_bytes: 3092
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
ll sum[200000];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> sum[i];
		if (i > 0) sum[i] += sum[i - 1];
	}
	ll ans = INF;
	for (int i = 0; i + 1 < N; i++) {
		ll A = sum[i];
		ll B = sum[N - 1] - sum[i];
		ans = min(ans, abs(A - B));
	}
	cout << ans << endl;
 }

Measured memory_bytes: 1792
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

int main(void) {
	size_t A, B, C, X;

	scanf("%zu\n%zu\n%zu\n%zu", &A, &B, &C, &X);

	size_t matchCount = 0;
	for (size_t aCount = 0; aCount <= A; aCount++) {
		for (size_t bCount = 0; bCount <= B; bCount++) {
			for (size_t cCount = 0; cCount <= C; cCount++) {
				if (aCount * 500 + bCount * 100 + cCount * 50 == X) {
					matchCount++;
				}
			}
		}
	}

	printf("%zu\n", matchCount);

	return 0;
}


Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"strconv"
)

func main() {
	x := readInt() / 200

	fmt.Println(10 - x)
}

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readInt() int {
	return int(readInt64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

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

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

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

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 1776
import itertools
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
for i, x in enumerate(itertools.permutations(range(1, N+1))):
    if x == P:
        p_idx = i
    if x == Q:
        q_idx = i
print(abs(p_idx - q_idx))



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
    int n;
    cin >> n ;
    vector <string> s(n); 
    for (int i = 0; i < n; i++) 
        cin >> s[i];
        
    int m;
    cin >> m;
    vector <string> t(m);
    for (int i = 0; i < m; i++)
        cin >> t[i];

    int temp, max=-1;
    for (int i = 0; i < n; i++) {
        temp = 1;
        for (int j = i + 1; j < n;j++) {
            if (s[i] == s[j])temp++;
        }
        for (int k = 0; k < m; k++) {
            if (s[i] == t[k])temp--;
        }
        if (max < temp)max = temp;
    }
    if (max >= 0)
        cout << max << endl;
    else
        cout << 0 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
int int_max = 2147483647;
int max_n = 1e5;


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

    std::vector<int> as(m,0);
    int sum{0};
    for (int i=0; i<m; ++i) {
        cin >> as[i];
        sum+=as[i];
    }

    if (sum > n) {
        cout << -1 << endl;
    } else {
        cout << (n-sum) << endl;
    }

    return 0;
}

Measured memory_bytes: 3660
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		long a = sc.nextLong();
		long b = sc.nextLong();

		if(a > b){
			long tmp = a;
			a = b;
			b = tmp;
		}

		if((b - a)%2 == 0){
			System.out.println(((b - a) + 1)/2);
		}
		else {
			if(a - 1 <= n - b){
				System.out.println((b + a)/2);
			}
			else {
				System.out.println((2*n - a - b + 1)/2);
			}
		}
	}

}


Measured memory_bytes: 27016
N = int(input())
num = [[0] * 9 for _ in range(9)]
for i in range(9):
    for j in range(9):
        for n in range(N + 1):
            n = str(n)
            if str(i + 1) == n[0] and str(j + 1) == n[-1]:
                num[i][j] += 1
s = 0
for i in range(9):
    for j in range(9):
        s += num[i][j] * num[j][i]
print(s)


Measured memory_bytes: 42092
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second   
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ; 
#define int ll
using namespace std;

const int N = 3e5 + 5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const long double eps = 1e-9 ;

using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef pair<int, int> pii; 
typedef pair<int , pii> ipii ;
typedef pair<pii , int> piii ; 
typedef unsigned long long ull ;
typedef long double ld;

ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

void solve()
{
    pii ans = {inf , inf};
    int x , n ;
    cin >> x >> n ;
    int vis[105] = {}; 
    rep(i , n){
        int y;
        cin >> y;
        vis[y]=true;
    }
    rep(i , 105){
        if(!vis[i])ans = min(ans , {abs(i - x) , i});
    }
    cout << ans.ss;
}
     
int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

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

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
   int a,b,c;
    cin >> a >> b >> c;
    
   if((a+b) >= c)
   {
       cout << "No\n";
       return;
   }
    
   int left = (c-a-b)*(c-a-b);
   int right = 4*a*b;
    
    if(left > right) cout <<"Yes\n";
    else cout <<"No";
    
    
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

Measured memory_bytes: 256
/*tenki*/
#include<stdio.h>
int main(void)
{
    char s[3];
    scanf("%s",&s);
    char t[3];
    scanf("%s",&t);
    int ans=0;
    if(s[0]==t[0]){
       ans++;
    }
    if(s[1]==t[1]){
        ans++;
    }
    if(s[2]==t[2]){
        ans++;
    }
    printf("%d \n",ans);
    return 0;
}

Measured memory_bytes: 128
N = int(input())
f = {}

for x in range(1, 110):
	for y in range(1, 110):
		for z in range(1, 110):
			t = x*x+y*y+z*z+x*y+y*z+z*x
			f[t] = (f[t]+1 if t in f.keys() else 1)

for i in range(1,N+1):
    print(f[i] if i in f.keys() else 0)

Measured memory_bytes: 79516
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}

int main() {
    int h,w;
    cin >> h >> w;
    vector<string> hoge(h);
    rep(i,h) {
        cin >> hoge[i];
    }
    vector<vector<char>> A(h+2,vector<char>(w+2,'#'));
    rep(i,h) {
        string ho = hoge[i];
        rep(j,w) {
            A[i+1][j+1]= ho[j];
        }
    }
    rep(i,h+2) {
        rep(j,w+2) {
            if (j==w+1) {
                cout << A[i][j] << "\n";
            } else {
                cout << A[i][j];
            }
        }
    }
}

Measured memory_bytes: 256