akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	// n := 人数
	int n;
	while( cin >> n , n ){
		// s[i][j] := j は i さんの個人情報を知っているかどうか.
		int s[101][101] = {0};
		
		for(int i=0 ; i < n ; i++ ){
			int m;
			cin >> m;
			for(int j=0 ; j < m ; j++ ){
				int p;
				cin >> p;
				p--;
				// i さんは p さんの個人情報を知っている.
				s[p][i] = 1;
			}
		}
		// k := 個人情報が漏洩した人数.
		int k;
		cin >> k;
		// L := 個人情報が漏洩した人の番号を保持する配列.
		vector<int> L;
		for(int i=0 ; i < k ; i++ ){
			int l;
			cin >> l;
			l--;
			L.push_back( l );
		}
		// ans := 個人情報を漏らした可能性のある人の番号を保持する配列.
		vector<int> ans;
		
		for(int x=0 ; x < n ; x++ ){
			bool flag = true;
			// foo := x さんが知っている人の番号を保持する配列
			vector<int> foo;
			
			for(int y=0 ; y < n ; y++ ){
				if( s[y][x] ){
					foo.push_back( y );
				}
			}
			for(int i=0 ; i < L.size() ; i++ ){
				// x さんは L[i] さんの情報を漏らした可能性がなければ flag を false にしておく.
				if( count(foo.begin() , foo.end() , L[i] ) == 0 ){
					flag = false;
				}
			}
			// x さん が個人情報を漏らした可能性のある人なら ans に追加.
			
			if( flag ){
				ans.push_back( x );
			}
		}
		
		// 個人情報を漏らした可能性のある人物が一人だけならその番号を出力, そうでなければ -1 を出力.
		if( ans.size() == 1 ){
			cout << (ans[0]+1) << endl;
		}else{
			cout << -1 << endl;
		}
	}
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> C;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

struct Point {
  C p;
  int my, up;
};

bool operator<(const Point &a, const Point &b) {
  return a.p.real() < b.p.real();
}

double cross(const C &a, const C &b) {
  return imag(conj(a) * b);
}

void intersectSS(C p1, C p2, C q1, C q2, vector<Point> &v, int my, int up) {
  if (cross(p2 - p1, q1 - p1) * cross(p2 - p1, q2 - p1) < 0 && cross(q2 - q1, p1 - q1) * cross(q2 - q1, p2 - q1) < 0) {
    C q = q2 - q1;
    double d1 = abs(cross(q, p1 - q1));
    double d2 = abs(cross(q, p2 - q1));
    double t = d1 / (d1 + d2);

    v.pb((Point{p1 + (p2 - p1) * t, my, up}));
  }
}

int main(){
  cin.sync_with_stdio(false);
  int t;
  cin >> t;
  rep(ii, t) {
    int x1, y1, x2, y2, o, l, n;
    cin >> x1 >> y1 >> x2 >> y2;
    C s = C(x1, y1), e = C(x2, y2);

    cin >> n;
    vector<Point> point;
    rep(i, n) {
      cin >> x1 >> y1 >> x2 >> y2 >> o >> l;
      intersectSS(s, e, C(x1, y1), C(x2, y2), point, o, l);
    }

    sort(all(point));
    P p[2] = {P(1, 0), P(0, 0)};
    rep(i, 2) {
      rep(j, point.size()) {
        if (point[j].my) {
          if (p[i].fi != point[j].up) {
            p[i].fi = point[j].up;
            p[i].se++;
          }
        } else {
          if (p[i].fi == point[j].up) {
            p[i].fi = (p[i].fi + 1) % 2;
            p[i].se++;
          }
        }
      }
    }

    cout << min(p[0].se, p[1].se) << endl;
  }

  return 0;
}

Measured memory_bytes: 3112
#include <vector>
#include <algorithm>
#include <cstddef>

struct strongly_connected_component {
	using size_type = std::size_t;
private : 
	std::vector<std::vector<size_type>> g, revg;
	std::vector<size_type> order, index;
	std::vector<bool> seen;

	void dfs (size_type v) {
		seen[v] = true;
		for (const size_type &u : g[v]) {
			if (not seen[u]) dfs(u);
		}
		order.push_back(v);
	}

	void dfs2 (size_type v, const size_type idx) {
		seen[v] = true;
		index[v] = idx;
		for (size_type u : revg[v]) {
			if (not seen[u]) dfs2(u, idx);
		}
	}

public : 
	strongly_connected_component (size_type n)
	: g(n), revg(n), index(n), seen(n) { }

	void add_edge (size_type u, size_type v) noexcept {
		g[u].push_back(v);
		revg[v].push_back(u);
	}

	size_type build() {
		order.clear();
		std::fill(seen.begin(), seen.end(), false);
		for (size_type v = 0; v < g.size(); v++) {
			if (not seen[v]) dfs(v);
		}
		
		size_type idx = 0;
		std::fill(seen.begin(), seen.end(), false);
		std::reverse(order.begin(), order.end());
		for (const size_type &v : order) {
			if (not seen[v]) dfs2(v, idx++);
		}
		return idx;
	}

	size_type operator[] (size_type v) {
		return (index[v]);
	}

};

#include <iostream>
#include <vector>
#include <cstddef>

using usize = std::size_t;

int main() {
	usize n, m;
	std::cin >> n >> m;
	strongly_connected_component g(n);
	for (usize i = 0; i < m; i++) {
		usize a, b;
		std::cin >> a >> b;
		g.add_edge(a, b);
	}
	
	std::vector<std::vector<usize>> ans(g.build());

	for (usize i = 0; i < n; i++) {
		ans[g[i]].push_back(i);
	}
	
	std::cout << ans.size() << '\n';
	for (usize i = 0; i < ans.size(); i++) {
		std::cout << ans[i].size();
		for (usize v : ans[i]) std::cout << ' ' << v;
		std::cout << '\n';
	}

	return 0;
}

Measured memory_bytes: 84788
using System;
class _0027
{
    public static void Main()
    {
        string[] SD = { "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday" };
        int[] days = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30 };
        string str = Console.ReadLine();
        int count, m, d;
        while (str != "0 0")
        {
            count = 0;
            m = int.Parse(str.Split()[0]); d = int.Parse(str.Split()[1]);
            for (int i = 0; i < m - 1; i++) count += days[i];
            for (int i = 0; i < d; i++) count++;
            Console.WriteLine(SD[count % 7]);
            str = Console.ReadLine();
        }
    }
}

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

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


Measured memory_bytes: 3080
A, B, C, X, Y = map(int, input().split())
ans = 0

ans += min(A+B, 2*C) * min(X, Y)
X, Y = X-min(X,Y), Y-min(X,Y)
ans += min(A, 2*C) * X + min(B, 2*C) * Y

print(ans)

Measured memory_bytes: 3060
import math

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

num1 = math.factorial(N) // (math.factorial(N - 2) * math.factorial(2)) if N >= 2 else 0
num2 = math.factorial(M) // (math.factorial(M - 2) * math.factorial(2)) if M >= 2 else 0

print(num1 + num2)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef std::pair<int, int> ii;
typedef tuple<int,int,int> i3;
typedef std::pair<int, ii> iii;
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::vector<ii> vii;
typedef std::vector<iii> viii;
const int INF=10000000;
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define all(x) (x).begin(), (x).end()
const int NMAX=701;
bool adj[NMAX][NMAX];
bool visited[NMAX];
int state[NMAX];
int N,M,a,b;
int ans=NMAX*NMAX;
vector<int> indpt;
ii ANS[NMAX];

ii dfs(int u){  

  if (visited[u]) return {0,0};
  else if (!visited[u]) {
    ii temp={1,0};
    visited[u]=true;
    //cerr<<u<<" | ";
    if (state[u]==-1) {indpt.push_back(u); state[u]=1;}
    vector<int> next;
    for (int i=0; i<N; i++){
      if (!adj[i][u]){
        if (state[i]==state[u]) {ans=-1; break;}
        else {
          state[i]=1-state[u];
          next.pb(i);
          //cerr<<i<<" ";
        }
      }
    }
    //cerr<<endl;
    for (int i: next) {
      ii t=dfs(i);
      temp.first+=t.second;
      temp.second+=t.first;
    }

    return ANS[u]=temp;


  }
}


int memo[NMAX][NMAX];

int dp(int index, int a, int b){
  
  if (memo[index][a]!=-1) return memo[index][a]; 
  else if (index==indpt.size()){
    //cerr<<"hi"<<endl;
    return memo[index][a]=a*(a-1)/2+b*(b-1)/2;
  }
  else{
    int node=indpt[index];
    return memo[index][a]=min(dp(index+1,a+ANS[node].first,b+ANS[node].second),dp(index+1,a+ANS[node].second,b+ANS[node].first));
  }
}



int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  memset(adj,false,sizeof(adj));
  memset(visited,false,sizeof(visited));
  memset(state,-1,sizeof(state));
  memset(memo,-1,sizeof(memo));
  cin >> N >> M;
  for (int i=0; i<M; i++){
    cin >> a >> b;
    a--; b--;
    adj[a][b]=true;
    adj[b][a]=true;
  }
  for (int i=0; i<N; i++){
    adj[i][i]=true;
  }

  // for (int i=0; i<N; i++){
  //   for (int j=0; j<N; j++){
  //     if (adj[i][j]== true) cout<<1<<" ";
  //     else cout<<0<<" ";
  //   }
  //   cout<<endl;
  // }


  for (int i=0; i<N; i++){dfs(i);}



  // for (int i=0; i<N; i++){cout<<state[i]<<" ";}
  // cout<<endl;

  // for (int i: indpt){ cout<< i<<" | "<<ANS[i].first<<" "<<ANS[i].second<<endl;}



  cout<<min(ans,dp(0,0,0))<<endl;



    




  



}


Measured memory_bytes: 3328
from collections import deque
n, x, y = map(int, input().split())

def push(v, d):
    if Dist[v] == -1:   #距離未更新
        Dist[v] = d
        Queue.append(v)
    else:   #距離が更新済み
        pass
    return 0
    
Ans = [0] * n
for i in range(n):
    Queue = deque([i])
    Dist = [-1] * n
    Dist[i] = 0 
    while len(Queue) != 0:
        v = Queue[0]
        d = Dist[v]
        #辺を通して次の頂点へ

        #-方向
        if v-1 >= 0:
            push(v-1, d+1)
        else:
            pass

        #+方向
        if v+1 < n:
            push(v+1, d+1)
        else:
            pass

        #XとYの間
        if v == x-1 :
            push(y-1, d+1)
        elif v == y-1:
            push(x-1, d+1)
        else:
            pass
        Queue.popleft()
    for i in Dist:
        Ans[i] += 1

for i in range(len(Ans)):
    Ans[i] *= 0.5

for i in range(1, n):
    print(int(Ans[i]))




Measured memory_bytes: 51804
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
5 8

output:
390625
"""

import sys


def mod_pow(x, n, _mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * x % _mod
        x = pow(x, 2) % _mod
        n >>= 1
    return res


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    n1, n2 = map(int, _input[0].split())
    M = 1000000007
    # print(pow(n1, n2, M))
    print(mod_pow(n1, n2, M))

Measured memory_bytes: 7720
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"

using namespace std;

//constexpr long long int MOD = 1000000007;
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N >> M;
	vector<vector<int>>v(M + 1);
	for (int i = 0; i < N; i++) {
		cin >> L >> R;
		if (L > M)continue;
		v[M - L].push_back(R);
	}
	multiset<int>ms;
	for (int i = M; i >= 0; i--) {
		for (auto j : v[i])ms.insert(-j);
		if (ms.empty())continue;
		K -= *ms.begin();
		ms.erase(ms.begin());
	}
	cout << K << endl;
}



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


int main() {
    int K, X;

    cin >> K >> X;

    for(int i=X-K+1;i<K+X;i++){
        //if(i<0||100<i)continue;
        cout << i << " ";
    }

    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;

void solve()
{
    int x;
    cin >> x;
    vector<bool> expo(x + 1);
    expo[1] = 1;
    for (int b = 2; b <= x; b++)
    {
        int v = b * b;
        while (v <= x)
        {
            expo[v] = 1;
            v *= b;
        }
    }
    for (int i = x; i >= 1; i--)
    {
        if (expo[i])
        {
            cout << i << endl;
            return;
        }
    }
}
main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    solve();
    return 0;
}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >=0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

typedef long long ll;
#define INF 1e9

int main(){
  int N;
  map<int, int> mp;
  cin >> N;
  vector<int> A(N);
  REP(i, N){
    cin >> A[i];
    auto itr = mp.find(A[i]);
    if(itr == mp.end()){
      mp[A[i]]=1;
    }
    else{
      itr->second++;
    }
  }
  pair<int, int> ans = make_pair(0,0);
  for(auto it = mp.begin(); it != mp.end(); it++){
    if(it->second >= 4){
      ans.first = max(ans.first, it->first);
      ans.second = max(ans.second, it->first);
    }
    else if(it->second >= 2){
      ans.first = max(ans.first, it->first);
    }
    if(ans.first > ans.second){
      int box;
      box = ans.first;
      ans.first = ans.second;
      ans.second = box;
    }
  }
  cout << (ll)ans.first * (ll)ans.second << endl;
 // cout << "first:" << ans.first << " second:" << ans.second << endl;

  return 0;
  
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int n, m, k, ans = INT_MAX;
int b[16][1024];

int get_sum (int x1, int y1, int x2, int y2) {
    return b[x2][y2] - b[x1 - 1][y2] - b[x2][y1 - 1] + b[x1 - 1][y1 - 1];
}

int p[15];


int try_cut (int par) {


    int last_cut = 1;
    int res = 0;

    for (int j = 1 ; j <= m ; ++ j) {
        bool ok = true;
        for (int v = 1 ; v <= par ; ++ v) {
            int huh = get_sum(p[v - 1] + 1, last_cut, p[v], j);
            ok &= (huh <= k);
        }
        if (!ok) {
            if (j == last_cut) return inf;
            ++ res;
            last_cut = j;
            -- j;
        }
    }


    return res;
}

int ct;


void bf (int cur, int par) {
    if (cur == n) {
        ans = min(ans, try_cut(par - 1) + par - 2);
        return ;
    }

    for (int i = 1 ; i + cur <= n ; ++ i) {
        p[par] = cur + i;
        bf(cur + i, par + 1);
    }
}


int main(){

    scanf("%d %d %d", &n, &m, &k);

    for (int i = 1 ; i <= n ; ++ i) {
        for (int j = 1 ; j <= m ; ++ j) {
            scanf("%1d", &b[i][j]);
            b[i][j] += b[i - 1][j];
            b[i][j] += b[i][j - 1];
            b[i][j] -= b[i - 1][j - 1];
        }
    }

    bf(0, 1);

    printf("%d\n", ans);


}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define rever(vec) reverse(all(vec));
#define cend cout << endl;
#define prique(T) priority_queue<T,vector<T>,greater<T>>
struct edge { int to, cost; };
typedef pair<int, int> P;
typedef pair<P, int> PP;
const int mod = 1e9 + 7, inf = 1e16;

int modpow(int x, int n) {
	if (n == 0) return 1;
	if (n % 2) return (x * modpow(x * x % mod, n / 2) % mod + mod) % mod;
	return (modpow(x * x % mod, n / 2) + mod) % mod;
}
int f[114514];
int fact(int n) {
	int ans = 1;
	if (f[n]) return f[n];
	rep(i, n) {
		ans *= (i + 1);
		ans %= mod;
	}
	f[n] = (ans + mod) % mod;
	return (ans + mod) % mod;
}

int comb(int n, int r) {
	if (n < r) swap(n, r);
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod * modpow(fact(r), mod - 2) + mod) % mod;
}

int perm(int n, int r) {
	if (n < r) swap(n, r);
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod + mod) % mod;
}

int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

bool pri(int p) {
	for (int i = 2; i * i <= p; i++) if (p % i == 0) return false;
	return p > 1;
}

int n, k;
signed main() {
	cin >> n >> k;
	for (int i = 1; i <= k; i++) {
		if (i == 1) {
			cout << n - k + 1 << endl;
		}
		else {
			int cnt = 0;
			rep(j, n - k) {
				int r = n - k - j;
				if (r < i - 1) break;
				cnt += (j + 1) * comb(r - 1, i - 2);
				if (mod <= cnt) cnt %= mod;
			}
			cnt *= comb(k - 1, i - 1);
			if (mod <= cnt) cnt %= mod;
			cout << cnt << endl;
		}
	}
}

Measured memory_bytes: 256
from collections import Counter

mod = (10 ** 9 + 7) ** 5
MAX = 2 * 10 ** 5 + 1 # これは変動するので注意

def com_init(MAX, mod):
    fac = [0] * MAX
    finv = [0] * MAX
    inv = [0] * MAX
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod
    return fac, finv

fac, finv = com_init(MAX, mod)

def nCr(n, r):
    if n < r:
        return 0
    elif n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod

n = int(input())
A = list(map(int, input().split()))

counter = Counter(A)

mapping = {}
for k, v in counter.items():
    mapping[k] = nCr(v, 2)

all_sum = 0
for v in mapping.values():
    all_sum += v

memo = {}
for i in range(n):
    num = A[i]
    if num in memo:
        print(memo[num])
    else:
        t = counter[num]
        ans = all_sum - nCr(t, 2) + nCr(t - 1, 2)
        print(ans)
        memo[num] = ans



Measured memory_bytes: 127264
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/
const int MAXN = 120000;

int n;
vector<int> eds[MAXN];
int sz[MAXN];
string cl;

void dfs1(int v, int p) {
	sz[v] = (cl[v] == 'W');
	for (int u: eds[v]) {
		if (u == p)
			continue;
		dfs1(u, v);
		sz[v] += sz[u];
	}
	vector<int> tmp;
	for (int u: eds[v]) {
		if (u == p || sz[u])
			tmp.push_back(u);
	}
	eds[v] = tmp;
}

int fl[MAXN];

int dfs2(int v, int p) {
	int ans = 1;
	fl[v] = 1;
	for (int u: eds[v]) {
		if (u == p)
			continue;
		ans += dfs2(u, v);
	}
	return ans;
}

int cc[MAXN];
int gl = 0;

pair<int, int> dfs3(int v, int p) {
	int x = (cc[v] == 1 ? 1 : -1);
	pair<int, int> now = {0, x};
	for (int u: eds[v]) {
		if (u == p)
			continue;
		pair<int, int> tmp = dfs3(u, v);
		++tmp.first;
		++tmp.second;
		gl = max(gl, now.first + tmp.second);
		gl = max(gl, tmp.first + now.second);
		tmp.first += x;
		tmp.second += x;
		now.first = max(now.first, tmp.first);
		now.second = max(now.second, tmp.second);
	}
	return now;
}

int main() {
#ifdef BZ
	//freopen("in", "r", stdin);
#endif
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n;
	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		cin >> a >> b;
		--a, --b;
		eds[a].push_back(b);
		eds[b].push_back(a);
	}
	cin >> cl;
	for (int i = 0; i < n; ++i) {
		if (cl[i] == 'W')
			cc[i] = 1;
	}
	int st = 0;
	while (st < n && cl[st] == 'B')
		++st;
	if (st == n) {
		cout << 0 << "\n";
		return 0;
	}
	dfs1(st, -1);
	int size = dfs2(st, -1);
	int ans = (size - 1) * 2;
	for (int i = 0; i < n; ++i) {
		if (fl[i]) {
			cc[i] ^= (eds[i].size() % 2);
			if (cc[i])
				ans += 1;
		}
	}
	dfs3(st, -1);
	cout << ans - gl << "\n";
	return 0;
}

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

int main() {
  int a,b,k;
  
  cin >> a>>b>>k;
  int l=k/2;
  int n=k%2;
  while(l--){
    b+=a/2;
    a/=2;
    a+=b/2;
    b/=2;
  }
  while(n--){
    b+=a/2;
    a/=2;
  }
  cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int main() {
    string s;
    cin >> s;
    int len = s.size() - 8;
    string ans = s.substr(0, len);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define PI 3.14159265
#define seive_len 10000001

bool seive[seive_len];
int primeSeive[seive_len];

typedef long long int lli;

lli gcd(lli a, lli b) {
  if(b == 0)
    return a;
  return gcd(b, a%b);
}

lli lcm(lli a, lli b) {
  lli gcd_ = gcd(a, b);
  lli lcm_ = (a*b)/gcd_;
  return lcm_;
}

lli fastPower(lli a, lli b) {
  lli res=1;
  while(b > 0) {
    if(b&1)
      res *= a;
    a *= a;
    b >>= 1;
  }
  return res;
}

lli fastPowerM(lli a, lli b, lli mod) {
  a %= mod;
  lli res = 1;
  while(b) {
    if(b%2 == 1)
      res = (res*a)%mod;
    a = (a*a)%mod;
    b >>= 1;
  }
  return res;
}

void multiply(lli a[][2], lli b[][2], int mod) {
  int res[2][2];
  memset(res, 0, sizeof(res));
  for(int i=0;i<2;i++) {
    for(int j=0;j<2;j++) {
      for(int k=0;k<2;k++) {
        res[i][j] += a[i][k]*b[k][j]%mod;
      }
    }
  }
  for(int i=0;i<2;i++)
    for(int j=0;j<2;j++)
      a[i][j] = res[i][j];
}

void matrixExpo(lli a[][2], lli n, int mod) {
  if(n == 0 || n == 1)
    return;
  lli b[][2] = {{1,1}, {1,0}};
  matrixExpo(a, n/2, mod);
  multiply(a, a, mod);
  if(n%2)
    multiply(a, b, mod);
}

void makeSeive() {
  for(int i=2;i*i<=seive_len;i++) {
    if(seive[i]) {
      for(int j=i*i;j<=seive_len;j+=i)
        seive[j] = false;
    }
  }
}

void makePrimeSeive() {
  for(int i=1;i<seive_len;i++)
    primeSeive[i] = i;
  for(int i=4;i<seive_len;i+=2)
    primeSeive[i] = 2;
  for(int i=3;i*i<seive_len;i++) {
    if(primeSeive[i] == i) {
      for(int j=i*i;j<seive_len;j+=i) {
        if(primeSeive[j] = j)
          primeSeive[j] = i;
      }
    }
  }
}

bool isPrime(lli n) {
  for(int i=2;i<=sqrt(n);i++) {
    if(n%i == 0)
      return false;
  }
  return true;
}

void getInput(vector<lli>& a, int n) {
  lli x;
  for(int i=0;i<n;i++) {
    cin >> x;
    a.push_back(x);
  }
}

lli sumOfFactors(lli n) {
  lli prev = -1, count = 0, res = 1;
  unordered_map<int, int> m;
  while(n != 1) {
    // if(primeSeive[n] != prev) {
    //   // res *= (count+1);
    //
    //   // prev = primeSeive[n];
    //   // count = 1;
    // }
    // else
    //   count++;
    m[primeSeive[n]]++;
    n /= primeSeive[n];
  }
  for(auto i: m)
    res *= (i.second+1);
  // res *= (count+1);
  return res;
}

void testCase() {
  lli i, n;
  cin >> n;
  lli res = 1;
  for(i=2;i<=n;i++)
    res += i*sumOfFactors(i);
  cout << res;
}

int main() {
	int t=1;
	// cin >> t;
  makePrimeSeive();
	while(t--) {
		testCase();
    cout << '\n';
	}
	return 0;
}


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

int main(void) {
	int N;
	int d[110];
	int num=0;
	
	cin >> N;
	for (int i=0; i<N; i++)	cin >> d[i];

	set<int> values;
	for (int i=0; i<N; i++) {
		values.insert(d[i]);
	}

	cout << values.size() << endl;

}


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

using namespace std;

#define pii pair<int,int>
#define ll long long
#define s second
#define f first

const int MAX_N=2*10e5+5;
int n,mn=INT_MAX,a[MAX_N],ans=1;

int main(){
  cin >> n;
  cin >> a[0];
  mn=a[0];
  for(int i=1;i<n;++i){
        cin >> a[i];
        if(a[i]<mn){
            ++ans;
       }
       mn=min(a[i],mn);
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define pb push_back
#define sf scanf
#define pf printf
using namespace std;
#define ll long long
const int N=1e5+9;
const ll mod=1e9+7;
void slv()
{
    ll n;
    ll a=1LL,b=1LL,c=1LL;
    cin >> n;
    for(ll i=0;i<n;i++) {
        a = (a*10LL) % mod;
        b = (b*9LL) % mod;
        c = (c*8LL) % mod;
    }
    ll ans=(a+c-2LL*b)%mod;
    ans=(ans+mod)%mod;
    cout<<ans<<endl;
}
int main()
{
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while (t--)
    {
        slv();
    }
    return 0;
}


Measured memory_bytes: 3628
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int r = sc.nextInt();
    
    if(r<1200) System.out.println("ABC");
    else if(r<2800) System.out.println("ARC");
    else System.out.println("AGC");

  }
}

Measured memory_bytes: 35832
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n,m;
  cin >> n >> m;
  rep(i,n) {
    rep(j,m) {
      string s;
      R s;
      if(s=="snuke") cout << (char)('A'+j) << i+1 << endl;
    }
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int n, m, l;
  cin >> n >> m >> l;
  vector<vi64> dist(n, vi64(n, 1e18));
  rep(i, n) dist[i][i] = 0;
  rep(i, m) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    dist[a][b] = c;
    dist[b][a] = c;
  }
  rep(k, n) rep(i, n) rep(j, n) amin(dist[i][j], dist[i][k] + dist[k][j]);

  vector<vi32> cnt(n, vi32(n, 1e9));
  rep(i, n) cnt[i][i] = 0;
  rep(i, n) rep(j, n) {
    if (i == j) continue;
    if (dist[i][j] <= l) cnt[i][j] = cnt[j][i] = 1;
  }
  rep(k, n) rep(i, n) rep(j, n) amin(cnt[i][j], cnt[i][k] + cnt[k][j]);

  int q;
  cin >> q;
  rep(_, q) {
    int s, t;
    cin >> s >> t;
    s--, t--;
    cout << (cnt[s][t] == 1e9 ? -1 : cnt[s][t] - 1) << endl;
  }
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ll N,a;
  std::priority_queue<double, vector<double>, greater<double> > q;
  cin >> N;
  while(cin >> a) q.push(a);
  while(q.size() > 1) {
    double x = q.top();
    q.pop();
    double y = q.top();
    q.pop();
    q.push((x+y)/2);
  }
  printf("%.10f",q.top());
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

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

#define MAX 100010
#define NIL -1

struct Node{int p,l,r;};
Node T[MAX];
int n,D[MAX];

void print(int u){
  int i,c;
  cout<<"node "<<u<<": parent = ";
  cout<<T[u].p<<", depth = ";
  cout<<D[u]<<", ";
  if(D[u]==0) cout<<"root";
  else if(T[u].l==NIL) cout<<"leaf";
  else cout<<"internal node";
  cout<<", [";
  for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
    if(i) cout<<", ";
    cout<<c;
  }
  cout<<"]"<<endl;
}
  

int rec(int u,int p){
  D[u]=p;
  if(T[u].r!=NIL) rec(T[u].r,p);
  if(T[u].l!=NIL) rec(T[u].l,p+1);
}

int main() {
  int v,d,c,l,r;
  cin>>n;
  
  rep(i,n) T[i].p=T[i].l=T[i].r=NIL;
  
  rep(i,n){    
    cin>>v>>d;
    rep(j,d){
      cin>>c;
      if(j==0) T[v].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=v;
    }
  }
  rep(i,n){
    if(T[i].p==NIL) r=i;
  }
  
  rec(r,0);
  
  rep(i,n) print(i);
  
  return 0;
}


Measured memory_bytes: 7700
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector <pair <int, int> > a(n);
  REP1(i, n) {
	int tmp = i;
	while (tmp >= 10) {
		tmp /= 10;
	  }
	a[i - 1] = make_pair(i % 10, tmp);
  }
  sort(all(a));
  ll ans = 0;
  REP1(i, n) {
	int tmp = i;
	while (tmp >= 10) {
		tmp /= 10;
	  }
	auto it1 = lower_bound(all(a), make_pair(tmp, i % 10));
	auto it2 = upper_bound(all(a), make_pair(tmp, i % 10));
	ans += (ll) (it2 - it1);
  }
  cout << ans << endl;
  return 0;
}


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

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 1e9 + 123;                                          
const int LIM = 52;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
ll n;
ll pw2[66];
ll pw3[66];
unordered_map < int, int > dp[LIM];
unordered_map < int, bool > u[LIM];

inline ll solve (ll s, int b) {
	if (s < 0) return 0;
	if (s == 0 && b == 0) {
	//	cout << "was: 1" << '\n';
		return 1;
	}
	if (2ll * (pw2[b] - 1) <= s) {
	//	cout << "was: 2" << '\n';
		return pw3[b];
	}  

	if (s >= N || b >= LIM) {
		//cout << (b > LIM) << '\n';
		int res = (solve(s, b-1) + solve(s - pw2[b], b-1) + solve(s - pw2[b-1], b-1)) % mod;

		return res;
	}

	int &res = dp[b][s];
	//cout << res << ":\n";
	if (u[b][s]) return res;
	u[b][s] = 1;

	res = (solve(s, b-1) + solve(s - pw2[b], b-1) + solve(s - pw2[b-1], b-1)) % mod;
	return res; 
}

int main () {
	SpeedForce;
	cin >> n;
	pw2[0] = pw3[0] = 1;
	for (int i = 1; i <= 61; i++) {
		pw2[i] = (1ll << i);
		pw3[i] = (pw3[i-1] * 3ll) % mod;
	}

	cout << solve(n, 60) << '\n';

   	return Accepted;
}

// B...a

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
typedef long long ll;
typedef double dd;
#define For(i,j,k) for (int i=(int)j;i<=(int)k;++i)
#define Forr(i,j,k) for (int i=(int)j;i>=(int)k;--i)
#define Set(a,p) memset(a,p,sizeof(a))
using namespace std;

template<typename T>bool chkmax(T &a,T b) { return a<b?a=b,1:0; }
template<typename T>bool chkmin(T &a,T b) { return a>b?a=b,1:0; }

const int maxn=50;
struct node {
	string S1,S2;
	bool operator == (const node &aa) const {
		return S1==aa.S1 && S2==aa.S2;
	}
	bool operator < (const node &aa) const {
		return ((S1<aa.S1) || (S1==aa.S1 && S2<aa.S2));
	}
};
int n;
ll Ans;
char s[maxn],s1[maxn],s2[maxn];
map<node,int>ma;

inline void file() {
	freopen("AGC026C.in","r",stdin);
	freopen("AGC026C.out","w",stdout);
}

int main() {
//	file();
	scanf("%d",&n);
	scanf("%s",s+1);
	For (i,1,n) s1[i]=s[i],s2[i]=s[2*n-i+1];
//	For (i,1,n) printf("%c",s1[i]); puts("");
//	For (i,1,n) printf("%c",s2[i]); puts("");
	For (i,0,(1<<n)-1) {
		string S1="",S2="";
		For (j,1,n) {
			if (i&(1<<(j-1))) S1=S1+s1[j];
			else S2=S2+s1[j];
		}
		node S=(node){S1,S2};
		++ma[S];
	}
	For (i,0,(1<<n)-1) {
		string S1="",S2="";
		For (j,1,n) {
			if (i&(1<<(j-1))) S1=S1+s2[j];
			else S2=S2+s2[j];
		}
		node S=(node){S1,S2};
		Ans+=1ll*ma[S];
	}
	printf("%lld",Ans);
	return 0;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll,ll> ii;

const int mod = 1e9 + 7;
const ll INF = (1LL<<50);
const int N = 1000005;
int main(){
	fastio;
	int n;
	cin >> n;
	vector<ii> v(n);
	for(int i = 0; i < n; i++)
		cin >> v[i].fst >> v[i].snd;
	sort(all(v), [](const ii a, const ii b){
		if(a.fst != b.fst)
			return a.fst < b.fst;
		return a.snd < b.snd;
	});
	ii a = {0,0},b = {mod,mod};
	for(int i = 0; i < n; i++){
		int x = v[i].fst, y = v[i].snd;
		if(x + y > a.fst + a.snd)
			a = v[i];
		if(y <= a.snd){
			if(x + y < b.fst + b.snd)
				b = v[i];
		}
	}
	ll ans = abs((a.fst + a.snd)-(b.fst+b.snd));
	cerr << ans << endl;
	a = {0, mod};
	b = {mod, 0};
	for(int i = 0; i < n; i++){
		ll x = v[i].fst, y = v[i].snd;
		if(x - y > a.fst - a.snd)
			a = v[i];
		if(y >= a.snd){
			if(x - y < b.fst - b.snd)
				b = v[i];
		}
	}
	cerr << a.fst <<" " << a.snd <<" " << b.fst <<" " << b.snd << endl;
	ans = max(ans, abs((a.fst-a.snd)-(b.fst-b.snd)));
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 6344
n=int(input())
l=list(map(int,input().split()))
l=sorted(l)

cnt=0
for i in range(n):
    for j in range(i+1,n):
        if l[i]==l[j]:
            continue
        else:
            for k in range(j+1,n):
                if l[j]==l[k]:
                    continue
                else:
                    if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j]:
                        cnt+=1
print(cnt)

Measured memory_bytes: 9204
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int N,K; cin>>N>>K;
  vector<long> d(N,1e10);
  vector<long> v;
  for(int i=0;i<N;i++){
    long h; cin>>h; v.push_back(h);
  }
  sort(v.begin(), v.end());
  //for(int i=0;i<N;i++){ cout<<v[i]<<" "; } cout<<endl;
  if(K==1){ cout<<0<<endl; }
  else{
    for(int i=0;i<N-K+1;i++){
      d[i] = v[i+K-1]-v[i];
    }
    sort(d.begin(),d.end());
    cout<<d[0]<<endl;
  }
  return 0;
}

Measured memory_bytes: 2168
module ABC134

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public :: task_C

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_C

    ! variables for this <subroutine>
    integer(INT32) :: len_sequence
    integer(INT32) :: maxloc_1st
    integer(INT32) :: maxval_1st
    integer(INT32) :: maxval_2nd
    integer(INT32) :: maxval_answer
    integer(INT32) :: val_sequence

    ! support variables for this <subroutine>
    integer(INT32) :: itr

    ! STEP.01
    ! read out the given data
    ! (the length of the given sequence)
    read(unit=INPUT_UNIT, fmt=*) len_sequence

    ! STEP.02
    ! initialize the variable to calculate the answer of this task
    maxval_1st = 0_INT32
    maxval_2nd = 0_INT32
    
    ! STEP.03
    ! 1. read out the given data (the values of the given sequence)
    ! 2. calculate the answer of this task
    do itr = 1_INT32, len_sequence, 1_INT32

      ! read out the given data (the values of the given sequence)
      read(unit=INPUT_UNIT, fmt=*) val_sequence

      ! calculate the answer of this task
      if (maxval_1st .lt. val_sequence) then
        maxval_2nd = maxval_1st
        maxval_1st = val_sequence
        maxloc_1st = itr
      else if (maxval_2nd .lt. val_sequence) then
        maxval_2nd = val_sequence
      else
        continue
      end if

    end do

    ! STEP.04
    ! output the answer of this task
    do itr = 1_INT32, len_sequence, 1_INT32

      if ( maxloc_1st .eq. itr ) then
        maxval_answer = maxval_2nd
      else
        maxval_answer = maxval_1st
      end if

      write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') maxval_answer

    end do

    ! STEP.END
    return

  end subroutine task_C

end module ABC134


program main

  ! <module>s to import
  use, non_intrinsic :: ABC134

  ! require all variables to be explicitly declared
  implicit none

  call task_C

end program main

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
ll digsum(ll a)
{
    ll s=0;
    while(a>0)
    {
        s+=a%10;
        a/=10;
    }
    return(s);
}
int main()
{
    fastIO;
    ll ans = 1e9+7, n,i,j,k,a,b;
    cin>>n;
    Fo(i,1,n)
    {
        j = digsum(i) + digsum(n-i);
        ans = min(j,ans);
    }
    cout<<ans<<endl;
    return(0);
} 

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();

        int s;
        int m;
        int h;
        s = num % 60;
        m = num / 60 % 60;
        h = num / 60 / 60;
    
        System.out.println(h + ":" + m + ":" + s);
    }
}

Measured memory_bytes: 26312
import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int[] blood = new int[4];
		String[] temp = new String[2];
		while (sc.hasNext()) {
			temp = sc.next().split(",");
			if (temp[1].equals("A")) {blood[0]++;}
			else if (temp[1].equals("B")) {blood[1]++;}
			else if (temp[1].equals("AB")) {blood[2]++;}
			else if (temp[1].equals("O")) {blood[03]++;}
		}
		for (int i=0; i<4; i++) {
			out.println(blood[i]);
		}
	}
}


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

int main() {
	string str;
	bool first = false, second = false, third = false;
	int out = 0, points = 0;
	int n;

	cin >> n;
	for(int i = 0; i < n;) {
		cin >> str;

		if(str == "HIT") {
			if(third == true)
				points++;

			third = second;
			second = first;
			first = true;
		}

		else if(str == "OUT") {
			out++;
			if(out == 3) {
				out = 0;
				first = second = third = false;
				cout << points << endl;
				points = 0;
				i++;
				continue;
			}
		}

		else if(str == "HOMERUN") {
			points++;
			if(first) points++;
			if(second) points++;
			if(third) points++;
			first = second = third = false;
		}
	}
}

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

int h, w;
string s;
long long dp[1005][1005];
long long mod=1e9 + 7;
bool sudah=true;

int main(){
	cin>>h>>w;
	dp[1][1]=1;
	for(int i=1; i<=h; i++){
			cin>>s;
			if(s[0]=='.'&&sudah==true)dp[i][1]=1;
			else sudah=false;
			for(int j=1; j<w; j++){
				if(s[j]=='.')dp[i][j+1]=(dp[i-1][j+1]+dp[i][j])%mod;
			}
	}
	cout<<dp[h][w]<<endl;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
typedef pair<ll, bool> Pb;
typedef pair<ll, vector<ll>> Pd;

const ll INF = 1e18;
const ll fact_table = 3200008;
long double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue <P, vector<P>, greater<P> > pqps;
//small priority queue
//top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
//↓,→,↑,←


#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)();
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

const ll mod = 998244353ll;
// const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll m = mod) {ll x = 1; while (b) {while (!(b & 1)) {(a *= a) %= m; b >>= 1;}(x *= a) %= m; b--;} return x;}
vec readvec(ll read) { vec res(read); for (int i = 0; i < read; i++) { cin >> res[i]; } return res;}
void YES(bool cond) { if (cond) { p("YES");} else { p("NO");} return;}
void Yes(bool cond) { if (cond) { p("Yes");} else { p("No");} return;}
void line() { p("--------------------"); return;}

/*
ll fact[fact_table + 5], rfact[fact_table + 5];

void c3_init() {
    fact[0] = rfact[0] = 1;
    for (ll i = 1; i <= fact_table; i++) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table], mod - 2, mod);
    for (ll i = fact_table; i >= 1; i--) {
        rfact[i - 1] = rfact[i] * i;
        rfact[i - 1] %= mod;
    }
    return;
}
ll c3(ll n, ll r) {
    return (((fact[n] * rfact[r]) % mod ) * rfact[n - r]) % mod;
}
*/



struct Timer {
    int64_t start; const int64_t CYCLES_PER_SEC = 2800000000;
    Timer() { reset(); }
    void reset() { start = getCycle(); }
    inline double get() { return (double)(getCycle() - start) / CYCLES_PER_SEC; }
    inline int64_t getCycle() {
        uint32_t low, high; __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
        return ((int64_t)low) | ((int64_t)high << 32);
    }
};

bool multicase = false;
ll x[500005], y[500005], z[500005];

void solve() {
    string s;
    cin >> s;
    ll n = s.size();
    pu(s);
    if (s[n-1] == 's') {
        p("es");
    } else {
        p('s');
    }
    return;
}

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

    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }

    // solve();
    return 0;
}






Measured memory_bytes: 3668
#include<cmath>
#include<cstdio>
#include<vector>
using namespace std;
struct node
{
	int u,v,w;
	node(int _u,int _v,int _w):u(_u), v(_v), w(_w){}
};
vector<node>ans;
inline int lowbit(int x)
{
	return x&-x;
}
int main()
{
    int L;
    scanf("%d",&L);
    for(int i=19;i>1;i--)
	{
        ans.push_back(node(i,i+1,0));
        ans.push_back(node(i,i+1,(1<<(20-i-1))));
    }
    while(L)
	{
        int p=int(log2(lowbit(L)));
        if(p==19)
		{
            ans.push_back(node(1,2,0));
            ans.push_back(node(1,2,1<<18));
        }else ans.push_back(node(1,20-p,L^lowbit(L)));
        L^=lowbit(L);
    }
    printf("%d %d\n",20,ans.size());
    for(int i=0;i<ans.size();i++)
        printf("%d %d %d\n", ans[i].u,ans[i].v,ans[i].w);
}

Measured memory_bytes: 256
def main():
    L = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    K = int(input())
    print(L[K-1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    vector<int> x(5);
    for (int i = 0; i < 5; i++) {
        cin >> x.at(i);
    }

    cout << find(ALL(x), 0) - x.begin() + 1 << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

int main(){
    int h, w;
    string s[52];
    cin >> h >> w;
    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};
    REP(i, h){
        cin >> s[i];
    }
    REP(i, h){
        REP(j ,w){
            if(s[i][j] == '#'){
                bool flag = false;
                REP(k, 4){
                    if(i + dy[k] == -1 || i + dy[k] == h || j + dx[k] == -1 || j + dx[k] == w)continue;
                    if(s[i + dy[k]][j + dx[k]] == '#'){
                        flag = true;
                        break;
                    }
                }
                if(!flag){
                    print("No");
                    return 0;
                }
            }
        }
    }
    print("Yes");
}


Measured memory_bytes: 256