akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main() {
  int N;
  cin >> N;
  unordered_map<string, int> M;
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    M[S]++;
  }

  int max_count = 0;
  for (const auto& it : M) {
    max_count = max(max_count, it.second);
  }

  vector<string> V;
  for (const auto& it : M) {
    if (it.second == max_count) {
      V.push_back(it.first);
    }
  }
  sort(V.begin(), V.end());

  for (const auto& S : V) {
    cout << S << endl;
  }

  return 0;
}


Measured memory_bytes: 26692
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define Would
#define you
#define please

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

	int C[3][3];
	rep(i, 3) cin >> C[i][0] >> C[i][1] >> C[i][2];

	int OK = 1;

	if (C[0][0] - C[0][1] != C[1][0] - C[1][1]) OK = 0;
	if (C[2][0] - C[2][1] != C[1][0] - C[1][1]) OK = 0;

	if (C[0][2] - C[0][1] != C[1][2] - C[1][1]) OK = 0;
	if (C[2][2] - C[2][1] != C[1][2] - C[1][1]) OK = 0;

	if (C[0][0] - C[1][0] != C[0][1] - C[1][1]) OK = 0;
	if (C[0][2] - C[1][2] != C[0][1] - C[1][1]) OK = 0;

	if (C[2][0] - C[1][0] != C[2][1] - C[1][1]) OK = 0;
	if (C[2][2] - C[1][2] != C[2][1] - C[1][1]) OK = 0;

	if (OK) co("Yes");
	else co("No");

	Would you please return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <stack>
#include <list>

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,b,n) for(int i=b;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

const float PI = 3.1415926;
static const int INFTY = (1<<30);

using namespace std;

typedef long long ll;
typedef long double ld;

int main() {
  int W,H,N;
  cin >> W >> H >> N;
  int sx, sy, ex, ey;
  sx = 0;
  sy = 0;
  ex = W;
  ey = H;
  int x, y, a;
  rep(i, N) {
    cin >> x >> y >> a;
    if(a == 1 && sx < x)
      sx = x;
    if(a == 2 && ex > x)
      ex = x;
    if(a == 3 && sy < y)
      sy = y;
    if(a == 4 && ey > y)
      ey = y;
  }

  int tmp = (ex - sx) * (ey - sy);
  bool ttt = (ex - sx) > 0 && (ey -sy) > 0;
  if (ttt)
    cout << tmp << endl;
  else
    cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
S = input()
K = int(input())

last_changed = False
x = 0
for a,b in zip(S,S[1:]):
    if a == b and not last_changed:
        x += 1
        last_changed = True
    else:
        last_changed = False

if last_changed or S[0] != S[-1]:
    print(x*K)
    exit()

last_changed = True
y = 1
for a,b in zip(S,S[1:]):
    if a == b and not last_changed:
        y += 1
        last_changed = True
    else:
        last_changed = False

if last_changed:
    m = K//2
    print(y*m + x*(m+K%2))
else:
    print(x + y*(K-1))

Measured memory_bytes: 3064
#!/usr/bin/env pypy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    K=I()
    ans=1
    for i in range(N):
        if ans<K:
            ans*=2
        else:
            ans+=K
    print(ans)
        

main()


Measured memory_bytes: 38256
#[allow(unused_imports)]
use std::collections::HashSet;
use proconio::input;
 
type Work = (i64, i64); // A, B

fn main() {
    input! {
        n : usize,
        mut ab : [(i64, i64); n],

    }

    let answer = solve(&mut ab);
    let msg = if answer {
        "Yes"
    } else {
        "No"
    };
    println!("{}", msg);
}

fn solve(works: &mut [Work]) -> bool {
    // 1. Sort
    works.sort_by_key(|w|w.1);

    // 2. Check
    let mut total : i64 = 0;
    for w in works {
        total += w.0;
        if total > w.1 {
            return false;
        }
    }
    return true;
}


Measured memory_bytes: 9064
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

const int MAX_N = 1e4+10;
const int MAX_D = 110;
ll dp[MAX_N][MAX_D][2];

int main(){
    string s;
    int d;
    cin >> s >> d;
    int n = s.size();
    {
        int c = s[0] - '0';
        rep(j, c) {
            dp[0][j%d][0]++;
        }
        dp[0][c%d][1]++;
    }
    REP(i, 0, n-1) {
        int c = s[i+1] - '0';
        rep(j, d) {
            rep(k, 10) {
                (dp[i+1][(j+k)%d][0] += dp[i][j][0]) %= MOD;
                if(k < c) (dp[i+1][(j+k)%d][0] += dp[i][j][1]) %=MOD;
                if(k == c) (dp[i+1][(j+k)%d][1] += dp[i][j][1]) %= MOD;
            }
        }
    }
    cout << (dp[n-1][0][0] + dp[n-1][0][1] - 1 + MOD) % MOD << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n, k;
  ll h[252521];
  cin>>n>>k;
  REP(i, n){
    cin>>h[i];
  }
  sort(h, h+n);
  ll ans=0;
  REP(i, n-k){
    ans+=h[i];
  }
  cout<<ans<<'\n';
  return 0;
}


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

using namespace std;

int a, b;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> a >> b;
	if (a > 9 || b > 9) cout << -1 << endl;
	else cout << a*b << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        
        double r = Double.parseDouble(line);
        
        System.out.printf("%.6f %.6f", r * r * Math.PI, 2 * r  * Math.PI);
        System.out.println("");
    }
}

Measured memory_bytes: 24460
{-
ITP1_5-B
Structured Program I - Print a Frame
Time Limit : 1 sec, Memory Limit : 65536 KB
?????¬???????????????

??\????????????????????????H cm ?????? W cm ???????????????????????°?????????????????????????????????

##########
#........#
#........#
#........#
#........#
##########

?????????????????? 6 cm ?????? 10 cm ???????????¨??????????????????
Input

??\???????????°????????????????????????????§???????????????????????????????????????????????????¢????????\????????¨????????§??????

H W

H, W ?????¨?????? 0 ?????¨????????\?????????????????¨????????????

????????????????????¨??????????????\???????????¶??????3 ??? H, W ??? 100 ??§??????
Output

?????????????????????????????????????????? H cm ?????? W cm ?????????????????????????????????

?????????????????????????????????????????????????????\??????????????????
Constraints

H, W ??? 300
Sample Input

3 4
5 6
3 3
0 0

Sample Output

####
#..#
####

######
#....#
#....#
#....#
######

###
#.#
###
-}
import Data.List.Split
import Text.Printf

main = do
  s <- getLine
  let [h,w] = map (\x-> read x::Int) $ splitOn " " s
  if h==0 && w==0 then return()
    else do
      mapM_ (\x->putStrLn $ if x==1 || x==h then aux 1 w
                            else aux 0 w) [1..h]
      printf "\n"
      main

aux :: Int -> Int -> String
aux h w = if h==1 then foldr (\x acc-> "#" ++ acc) "" [1..w]
          else "#" ++ (foldr (\x acc-> "." ++ acc) "#" [1..(w-2)])

Measured memory_bytes: 4168
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#include<random>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (int)(Y);++(X))
#define reps(X,S,Y) for (int (X) = (int)(S);(X) < (int)(Y);++(X))
#define rrep(X,Y) for (int (X) = (int)(Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (int)(Y)-1;(X) >= (int)(S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl
#define NL <<"\n"
#define cauto const auto

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "benri.h"
#else
#define out(args...)
#endif
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
template<class A,class B> pair<A,B> operator+(const pair<A,B> &p,const pair<A,B> &q){ return {p.X+q.X,p.Y+q.Y};}
template<class A,class B,class C,class D> pair<A,B>& operator+=(pair<A,B> &p,const pair<C,D> &q){ p.X+=q.X; p.Y+=q.Y; return p;}
template<class A,class B> pair<A,B> operator-(const pair<A,B> &p,const pair<A,B> &q){ return {p.X-q.X,p.Y-q.Y};}
template<class A,class B,class C,class D> pair<A,B>& operator-=(pair<A,B> &p,const pair<C,D> &q){ p.X-=q.X; p.Y-=q.Y; return p;}
template<class A,class B> istream& operator>>(istream &is, pair<A,B> &p){ is>>p.X>>p.Y; return is;}
template<class T=ll> T read(){ T re; cin>>re; return move(re);}
template<class T=ll> T read(const T &dec){ T re; cin>>re; return re-dec;}
template<class T=ll> vector<T> readV(const int sz){ vector<T> re(sz); for(auto &x:re) x=read<T>(); return move(re);}
template<class T=ll> vector<T> readV(const int sz, const T &dec){ vector<T> re(sz); for(auto &x:re) x=read<T>(dec); return move(re);}
vv<int> readG(const int &n,const int &m){ vv<int> g(n); rep(_,m){ cauto a=read<int>(1),b=read<int>(1); g[a].pb(b); g[b].pb(a);} return move(g);}
vv<int> readG(const int &n){ return readG(n,n-1);}
const ll MOD=1e9+7; //998244353

#include <atcoder/all>
using namespace atcoder;

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout<<fixed<<setprecision(0);
	cauto n=read();
	cauto q=read();
	dsu uf(n);
	rep(_,q){
		cauto t=read();
		cauto u=read();
		cauto v=read();
		if(t){
			cout<<uf.same(u,v) NL;
		}else{
			uf.merge(u,v);
		}
	}
  return 0;
}


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

int main()
{
    string s;
    cin >> s;

    set<char> S;

    for (int i = 0; i < s.size(); i++)
    {
        S.insert(s[i]);
    }

    if (s.size() == S.size())
    {
        cout << "yes" << endl;
    }
    else
    {
        cout << "no" << endl;
    }
}

Measured memory_bytes: 256
from math import log2, ceil


class SegTree:
    #####単位元######
    ide_ele = 0

    def __init__(self, init_val):
        n = len(init_val)
        self.num = 2**ceil(log2(n))
        self.seg = [self.ide_ele] * (2 * self.num - 1)

        for i in range(n):
            self.seg[i + self.num - 1] = init_val[i]

        # built
        for i in range(self.num - 2, -1, -1):
            self.seg[i] = self.segfunc(self.seg[2 * i + 1], self.seg[2 * i + 2])

    #####segfunc######
    def segfunc(self, x, y):
        return x|y

    def update(self, k, x):
        k += self.num - 1
        self.seg[k] = x
        while k:
            k = (k - 1) // 2
            self.seg[k] = self.segfunc(self.seg[k * 2 + 1], self.seg[k * 2 + 2])

    def query(self, a, b, k, l, r):
        if r <= a or b <= l:
            return self.ide_ele
        if a <= l and r <= b:
            return self.seg[k]
        else:
            vl = self.query(a, b, k*2+1, l, (l+r)//2)
            vr = self.query(a, b, k*2+2, (l+r)//2, r)
            return self.segfunc(vl, vr)


N = int(input())
S = input()
Q = int(input())

li = [1 << (ord(s) - ord('a')) for s in S]
seg_tree = SegTree(li)
ans = []
for _ in range(Q):
    i, l, r = input().split()
    i = int(i)
    l = int(l)
    if i == 1:
        seg_tree.update(l-1, 1 << (ord(r) - ord('a')))
    else:
        r = int(r)
        num = seg_tree.query(l-1, r, 0, 0, seg_tree.num)
        ans.append(bin(num).count('1'))

for a in ans:
    print(a)


Measured memory_bytes: 49040
#include <cstdio>
#include <cstring>

struct dlist {
  int key;
  dlist *prev, *next;
  dlist(int key, dlist *prev, dlist *next) : key(key), prev(prev), next(next) {};
  ~dlist() {
    this->next->prev = this->prev;
    this->prev->next = this->next;
  }
};

int main() {
  size_t n;
  scanf("%zu", &n);
  dlist sentinel(0, nullptr, nullptr);
  sentinel.prev = sentinel.next = &sentinel;
  for (size_t i = 0; i < n; i++) {
    char c[16];
    int key;
    scanf("%s", c);
    if (strcmp(c, "insert") == 0) {
      scanf("%d", &key);
      auto l = new dlist(key, &sentinel, sentinel.next);
      l->next->prev = l;
      l->prev->next = l;
    } else if (strcmp(c, "delete") == 0) {
      scanf("%d", &key);
      for (auto l = sentinel.next; l != &sentinel; l = l->next)
        if (l->key == key) {
          delete l;
          break;
        }
    } else if (strcmp(c, "deleteFirst") == 0)
      delete sentinel.next;
    else
      delete sentinel.prev;
  }
  if (sentinel.next != &sentinel) {
    printf("%d", sentinel.next->key);
    for (auto l = sentinel.next->next; l != &sentinel; l = l->next)
      printf(" %d", l->key);
    puts("");
  }
  return 0;
}

Measured memory_bytes: 33812
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=998244353;

int main(void){
    int n,d;
    cin>>n>>d;
    int ans=(n+2*d)/(2*d+1);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
NUM = 20005
 
table = [""]*NUM
 
 
while True:
 
    T = str(input())
    if T == '-':
        break
 
    left = 0
    right = 0
    for i in range(len(T)):
        table[left+right] = T[right]
        right += 1
 
    num_suffle = int(input())
 
    for loop in range(num_suffle):
        pick_num = int(input())
        for i in range(pick_num):
            table[right+i] = table[left+i]
        left += pick_num
        right += pick_num
 
    for i in range(left,right):
        print("%s"%(table[i]),end = "")
    print()


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

n = int(raw_input())
cnt = 0
while n!=0:
    if cnt > 0:
        print
    (c10, c50, c100, c500) = map(int, raw_input().split())
    Sum = 10*c10+50*c50+100*c100+500*c500
    while Sum-500 >= n:
        Sum -= 500
        c500 -= 1
    while Sum-100 >= n:
        Sum -= 100
        c100 -= 1
    while Sum-50 >= n:
        Sum -= 50
        c50 -= 1
    while Sum-10 >= n:
        Sum -= 10
        c10 -= 1

    if c10 > 0:
        print 10, c10
    if c50 > 0:
        print 50, c50
    if c100 > 0:
        print 100, c100
    if c500 > 0:
        print 500, c500

    n = int(raw_input())
    cnt += 1

Measured memory_bytes: 4240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

void mainsolve(){

	ll a,b;
	cin >> a >> b;


	rep(i,100000){
		if(i*8/100 == a && i*10/100 == b){
			cout << i << endl;
			return;
		}
	}
	cout << -1 << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))

d = {}
for ai in a:
  if ai in d:
    d[ai] += 1
  else:
    d[ai] = 1
ans = 0
for v in d.values():
  if v%2 == 1:
    ans += 1
print(ans)

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

int n, m;

int main(){
  cin >> n >> m;
  set<int> p, q;
  rep(i, m){
    int a, b;
    cin >> a >> b;
    if(a > b){
      swap(a, b);
    }
    if(a == 1 && b != 1){
      p.insert(b);
    }
    if(a != n && b == n){
      q.insert(a);
    }
  }
  bool flag = false;
  for(int i = 2; i < n; i++){
    if(p.find(i) != p.end() && q.find(i) != q.end()){
      flag = true;
    }
  }
  if(flag){
    cout << "POSSIBLE" << endl;
  }else{ 
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}


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

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n; cin>>n;
	int cnt2 = 0, cnt4 = 0;
	for(int i = 0; i < n; i++){
		int x; cin>>x;
		if(x%4 == 0)cnt4++;
		else if(x%2 == 0)cnt2++;
	}
	int cnt1 = n - cnt2 - cnt4;
	if(cnt1 <= cnt4){
		cout<<"Yes"<<endl;
	}else if(cnt1 == cnt4 + 1 && cnt2 == 0){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(){
  int R;
  scanf("%d",&R);
  if(R < 1200) printf("ABC\n");
  else if(1200 <= R & R < 2800) printf("ARC\n");
  else printf("AGC");
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

class UnionFind
{
public:
	UnionFind(int min, int max)
		: elems_(max - min + 1)
		, min_(min)
	{
		for (int i = min; i <= max; i++) {
			Elem& elem = this->elems_[i - min];
			elem.i = i;
			elem.num = 1;
		}
	}

	int find(int i) {
		int idx = i - this->min_;
		if (this->elems_[idx].i == i) return i;

		int root = this->find(this->elems_[idx].i);
		this->elems_[idx].i = root; // 簡略化
		return root;
	}

	int size(int i) {
		int root = this->find(i);
		int idx = root - this->min_;
		return this->elems_[idx].num;
	}

	void merge(int i, int j) {
		int i_root = this->find(i);
		int j_root = this->find(j);
		if (i_root == j_root) return;

		int i_idx = i_root - this->min_;
		int j_idx = j_root - this->min_;

		int i_size = this->elems_[i_idx].num;
		int j_size = this->elems_[j_idx].num;

		if (i_size < j_size) {
			this->elems_[i_idx].i = j_root;
			this->elems_[j_idx].num += this->elems_[i_idx].num;
		}
		else {
			this->elems_[j_idx].i = i_root;
			this->elems_[i_idx].num += this->elems_[j_idx].num;

		}
	}

private:
	struct Elem {
		int i;
		int num; // root 以外は無効
	};

	vector<Elem> elems_;
	int          min_;
};


using namespace std;

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

	int n, m; cin >> n >> m;

	auto uf = UnionFind(1, n);
	FOR_LT(i, 0, m) {
		int x, y, z;  cin >> x >> y >> z;

		if (uf.find(x) != uf.find(y)) {
			uf.merge(uf.find(x), uf.find(y));
		}
	}

	set<int> ans;
	FOR_LE(i, 1, n) {
		ans.insert(uf.find(i));
	}

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

	return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    int d = B-A;
    if(d%2 == 1) cout << "Borys" << endl;
    else cout << "Alice" << endl;
}

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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type / Class / Struct Definitions:
using ll = long long;
using ull = unsigned long long;

//Constants:
const int INF = (1ll << 30) - 1;  //nearly 1.07e9
const ll INFLL = 1ll << 60;       //nearly 1.15e18
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

//================ Main Loop ================
int main() {
    ll h, w;
    cin >> h >> w;
    //setpre(20);
    if(h != 1 && w != 1)
        cout << (ll)(h * w / 2) + h * w % 2 << endl;
    else
        cout << 1 << endl;
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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

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


Measured memory_bytes: 256
/* 
****	
	AUTHOR :- @soham01 
****
*/
#include "bits/stdc++.h"
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	char c;
	cin>>c;
	cout<<char(int(c)+1)<<endl;
	return 0;
}


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

long long cnt;
int i;
int A[1000000];
int n;
vector<int> G;

void insertionSort(int A[], int N, int g)
{
	for(int i = g; i < N; i++){
		int v = A[i];
		int j = i - g;
		while(j >= 0 && A[j] > v){
			A[j+g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
	}
}


void shellSort(int A[], int N)
{
	for(int h = 1; ; ){
		if(h > n) break;
		G.push_back(h);
		h = 3 * h + 1;
	}
	for(int i = G.size() - 1; i >= 0; i--)
	{
		insertionSort(A, N, G[i]);
	}
}

int main() {
	cin >> n;
	for(int i = 0; i < n; i++) scanf("%d", &A[i]);
	cnt = 0;
	shellSort(A, n);
	
	cout << G.size() << endl;
	for(int i = G.size() - 1; i >= 0; i-- ){
		printf("%d", G[i]);
		if(i) printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for(int i = 0; i < n; i++) printf("%d\n", A[i]);
	
	return 0;
	
}


Measured memory_bytes: 7128
#include <stdio.h>

int main( void )
{
	int a,b;
	scanf("%d %d", &a, &b);
	
	if(a == b)
	{
		printf("a == b\n");}
		else{
			if(a > b)
			{printf("a > b\n");}
				else{
					printf("a < b\n");
				}
		}
		return 0;
}
	
	


Measured memory_bytes: 2048
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    int n, k;
    cin >> n >> k;
    if(n&1)n++;
    if(k>(n/2))cout << "NO";
    else cout << "YES";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
using namespace std;
int mod=1e15;


int32_t main() {
    int T;
    T=1;
    //cin>>T;
    while(T--){
        int n,W;
        cin>>n>>W;
        int w[n], v[n];
        for(int i=0;i<n;i++){
            cin>>w[i]>>v[i];
        }
        int dp[n][100005], ans=v[0];
        for(int i=0;i<n;i++){
            for(int j=0;j<=100000;j++){
                dp[i][j]=mod;
            }
        }
        dp[0][v[0]]=w[0];
        for(int i=1;i<n;i++){
            dp[i][v[i]]=w[i];
            for(int j=0;j<=100000;j++){
                dp[i][j]=min(dp[i][j],dp[i-1][j]);
                if(j-v[i]>=0){
                    dp[i][j]=min(dp[i][j], w[i] + dp[i-1][j-v[i]]);
                }
                if(i==n-1 && dp[i][j]<=W)ans=j;
            }
        }
        // for(int i=0;i<n;i++){
        //     for(int j=0;j<=10;j++){
        //         cout<<dp[i][j]<<" ";
        //     }cout<<endl;
        // }
        
        cout<<ans;
        cout<<'\n';
    }
	return 0;
}

Measured memory_bytes: 78336
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<'\n';
#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 int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ");
//#define double long double

using namespace std;

template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }

const int MOD = 998244353;
const ll INF = 1e17;
const int INT_INF = 1e9;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;

vector<int>G[202];
string A[202];
int N;
int ans = -1;
void calc(int n) {
	vector<bool>used(N);
	used[n] = true;
	vector<int>now; now.pb(n);
	bool found = true;
	int ret = 1;
	//cout << "leaf:" << n+1 << endl;
	while (found) {
		found = false;
		set<int>nxt;
		for (auto v : now) {
			for (auto u : G[v]) {
				if (used[u])continue;
				nxt.insert(u);
				found = true;
			}
		}
		if (!found)break;
		now.clear();
		for (auto v : nxt) {
			now.pb(v);
			//pe(v+1);
			used[v] = true;
		}//cout << endl;

		REP(i, now.size()-1) {
			FOR(j, i + 1, now.size()) {
				if (A[now[i]][now[j]] == '1')return;
			}
		}
		ret++;
	}
	ans = max(ans, ret);
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N;
	REP(i, N) {
		cin >> A[i];
	}
	REP(i, N) {
		REP(j, N) {
			if (A[i][j] == '1') {
				G[i].pb(j);
			}
		}
	}
	vector<int>leaves;
	REP(i, N) {
		if (G[i].size() == 1)leaves.pb(i);
	}
	/*for (auto v : leaves) {
		calc(v);
	}*/
	REP(i, N) {
		calc(i);
	}
	print(ans);
}



Measured memory_bytes: 768
ans = [1, 9, 30, 76, 141, 267, 400, 624, 885, 1249, 1590, 2208, 2689, 3411, 4248, 5248, 6081, 7485, 8530, 10248, 11889, 13687, 15228, 17988, 20053, 22569, 25242, 28588, 31053, 35463, 38284, 42540, 46581, 50893, 55362, 61824, 65857, 71247, 76884, 84388, 89349, 97881, 103342, 111528, 120141, 128047, 134580, 146316, 154177, 164817, 174438, 185836, 194157, 207927, 218812, 233268, 245277, 257857, 268182, 288216, 299257, 313635, 330204, 347836, 362973, 383709, 397042, 416448, 434025, 456967, 471948, 499740, 515581, 536073, 559758, 583960, 604833, 633651, 652216, 683712, 709065, 734233, 754734, 793188, 818917, 846603, 874512, 909496, 933081, 977145, 1006126, 1041504, 1073385, 1106467, 1138536, 1187112, 1215145, 1255101, 1295142, 1342852, 1373253, 1422195, 1453816, 1502376, 1553361, 1595437, 1629570, 1691292, 1726717, 1782111, 1827492, 1887772, 1925853, 1986837, 2033674, 2089776, 2145333, 2197483, 2246640, 2332104, 2379085, 2434833, 2490534, 2554600, 2609625, 2693919, 2742052, 2813988, 2875245, 2952085, 3003306, 3096024, 3157249, 3224511, 3306240, 3388576, 3444609, 3533637, 3591322, 3693924, 3767085, 3842623, 3912324, 4027884, 4102093, 4181949, 4270422, 4361548, 4427853, 4548003, 4616104, 4718640, 4812789, 4918561, 5003286, 5131848, 5205481, 5299011, 5392008, 5521384, 5610705, 5739009, 5818390, 5930196, 6052893, 6156139, 6239472, 6402720, 6493681, 6623853, 6741078, 6864016, 6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897, 8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813, 10493367, 10611772, 10813692]
n = int(input())

print(ans[n - 1])

Measured memory_bytes: 9388
#include<cstdio>
const int MN=20005;
int n,a[MN];
int main(){
	scanf("%d",&n);
	for(int i=1,x;i<=n;i++)scanf("%d",&x),a[x]=i;
	for(int i=1;i<=n;i++)printf("%d%c",a[i]+i*MN,i<n?' ':'\n');
	for(int i=1;i<=n;i++)printf("%d ",(n-i+1)*MN);
    return 0;
}

Measured memory_bytes: 640
#include <iostream>

int main(int argc, char *argv[]) {
  int max = -1, sum = 0;
  for (int i = 0; i < 3; ++i) {
    int n;
    std::cin >> n;
    max = std::max(max, n);
    sum += n;
  }

  if ((sum % 2) != (3 * max % 2))
    ++max;
  std::cout << (3 * max - sum) / 2 << std::endl;
}


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

int main(void)
{
	string S;
	cin >> S;

	string rs(S);
	reverse(rs.begin(), rs.end());

	int ret;
	for(int i=(S.size()%2==0 ? 2 : 1); i<S.size(); i+=2)
	{
		string l, r;
		int length = (S.size() - i) / 2;
		int size = length / 2;
		l = rs.substr(i, length);
		r = rs.substr(i+length, length);

		if(l == r)
		{
			ret = length * 2;
			break;
		}
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod=1e9+7;
const int MAXN=1e5+9;
const double eps=1e-8;
const long double pi=3.1415926535897932384626433832795;
const long double e=2.71828182845904523536028747135266;
double a[MAXN];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int t=1;
    while(t--){
        ll a,b,c;
        cin >> a >> b >> c;
        if(a%2==0||b%2==0||c%2==0) cout << 0 << endl;
        else cout << min(a*b,min(b*c,a*c)) << endl;
    } 
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
using namespace std;
const int mod=1e9+7;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,w[100],sum=0;cin >> n;
    rep(i,0,n){
      cin >> w[i];
      sum+=w[i];
    }
    int sump=0,ans=sum;
    rep(i,0,n){
      sump+=w[i];
      ans=min(ans,abs(2*sump-sum));
    }
    cout << ans << endl;
 }    


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

ll extGCD(ll a, ll b, ll &x, ll &y){
    if(b == 0){
        x = 1;
        y = 0;
        return a;
    }
    ll g = extGCD(b, a%b, y, x);
    y -= a/b * x;
    return g;
}

ll MOD = 1000000007;

vector<ll> mfact(1,1);

ll minv(ll a){
    ll x;ll y;
    extGCD(a, MOD, x, y);
    if(x<0)x+=MOD;
    return x;
}
ll mod(ll val, ll m) {
  ll res = val % m;
  if (res < 0) res += m;
  return res;
}


ll mpow(ll a,ll b){
    ll res = 1;
    while(b >= 1){
        if(b%2==1)res=(res*a)%MOD;
        b/=2;
        a = (a*a)%MOD;
    }
    return res;
}

ll mfactorial(ll a){
    if(mfact.size()-1 >= a)return mfact[a];
    for(ll i = mfact.size();i<=a;i++){
        mfact.push_back((i * mfact[i-1])%MOD);
    }
    return mfact[a];
}

ll mcomb(ll n, ll r){
    return (((mfactorial(n) * minv(mfactorial(r)))%MOD) * minv(mfactorial(n-r)))%MOD;
}

ll mcomb__(ll n, ll r){
    ll upper = 1;
    for(ll i = n;i >= n - r +1;i--){
        upper = (upper * i) % MOD;
    }
    ll bottom = mfactorial(r);
    ll res = (upper * minv(bottom)) % MOD;
    return res;
}

int main(){
    ll n, a, b;
    cin>>n>>a>>b;
    ll A = mpow(2,n)-1;
    ll B = (mcomb__(n,a) + mcomb__(n,b)) % MOD;
    ll ans = (A - B + MOD)%MOD;
    cout<<ans<<endl;
}

Measured memory_bytes: 2420
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int m;
  cin >> m;
  cout << 24 + 24 - m;



  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			m = scanner.nextInt();
			n = scanner.nextInt();
			if ((m | n) == 0)
				break;
			M = new HashMap<Integer, Integer>();
			h = 1;
			a = new int[n][m];
			Y = new int[24];
			X = new int[24];
			for (int i = 0; i < n; i++)
				for (int j = 0; j < m; j++) {
					int t = scanner.nextInt();
					if (t == 0) {
						a[i][j] = -1;
					} else if (t == 1) {
						Y[h] = i;
						X[h] = j;
						a[i][j] = h++;
					} else {
						Y[0] = i;
						X[0] = j;
						a[i][j] = 0;
					}
				}
			System.out.println(slove(0, 1));
		}
	}

	private int slove(int cur, int bit) {
		int k = cur << 24 | bit;
		if (M.containsKey(k))
			return M.get(k);
		int res = 0;
		for (int[] mo : move) {
			int y = Y[cur];
			int x = X[cur];
			while (true) {
				y += mo[0];
				x += mo[1];
				if (!isOK(y, x))
					break;
				if (a[y][x] == 0)
					if (Integer.bitCount(bit)==h)
						res++;
				if (a[y][x] >= 1) {
					if ((bit >> a[y][x] & 1) == 1)
						continue;
					res += slove(a[y][x], bit | 1 << a[y][x]);
					break;
				}
			}
		}
		M.put(cur << 24 | bit, res);
		return res;
	}

	private boolean isOK(int y, int x) {
		if (0 <= y && y < n && 0 <= x && x < m)
			return true;
		return false;
	}

	int m, n, h;
	int[] Y, X;
	int[][] a;
	int[][] move = { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };
	Map<Integer, Integer> M;
}

Measured memory_bytes: 188968
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod = 1e9 + 7;
int main() {

    int x;
    cin >> x;

    int time = 1;
    int ans = 0;
    while(ans < x){
        ans += time;
        time++;
    }
    cout << --time << endl; 

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n);
    vector<pair<int,int>> v;
    for(int i=0;i<n;i++){
        cin >> a[i];
        v.push_back(make_pair(a[i],i));
    }
    sort(v.begin(),v.end());
    vector<ll> res(n,0);
    int mi=n;
    for(int i=n-1;i>=0;i--){
        mi=min(mi,v[i].second);
        res[mi]+=1LL*(v[i].first-(i?v[i-1].first:0))*(n-i);
    }
    for(int i=0;i<n;i++){
        cout << res[i] << endl;
    }
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll,ll>;
using pi = pair<int,int>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;


template<int MOD> struct Fp {  
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
using mint = Fp<MOD>;

mint f(ll a, ll b){
	if(b == 0)return 1;
	if(b % 2 == 0){
		mint t = f(a , b/2);
		return t*t;
	}
	mint ret = a;
	ret *= f(a , b-1);
	return ret;
}


signed main(){
	//cout << fixed << setprecision(10);
    ll n; cin >> n;
	mint ans = f((ll)10 , n);
	ans -= f((ll)8 , n);
	mint a = f(9,n) - f(8,n);
	a *= 2;
	ans -= a;
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=1000005;
#define M 1000000007
#define double long double
#define BINF 1000000000000001
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 15000001
const int LG = 22;



#undef int 
int main() { 
#define int long long int 
 
ios_base::sync_with_stdio(false); 
cin.tie(0); 
cout.tie(0); 
	
	set<char>S,D;
	string s;
	cin >> s;
	
	sort(s.begin(),s.end());
	if(s[0] == s[1] && s[2] == s[3] && s[2] != s[1]) cout <<"Yes";
	else cout << "No";

	
	

	
return 0;
}


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

int main(){
  int n,k;
  cin>>n>>k;
  vector<int>p(n);
  rep(i,n){
    cin>>p[i];
    p[i]++;
  }
  
  double max=0.0;
  vector<vector<int>> judge(n-k+1, vector<int>(2,0));  
  rep(i,n-k){
    judge[i][1]=i;
    judge[i+1][0]=judge[i][0]+p[i+k]-p[i];
  }
    judge[n-k][1]=n-k;

  
  sort(judge.begin(),judge.end(),[](const vector<int> &alpha,const vector<int> &beta){return alpha[0] < beta[0];});
  

  int start=judge[n-k][1];
  for(int i=start;i<start+k;i++){
    max+=p[i];
  }
  double ans=double(max/2);
  cout << fixed << setprecision(6) << ans << endl; ;
  //cout<<max/2<<endl;

  
  
}

Measured memory_bytes: 11904
def main():
    n = int(input())
    if n%2 == 1:
        print(0)
        return
    
    five_cnt = 0
    for i in range(1,25+1):
        base = 2*(5**i)
        five_cnt += n//base

    print(five_cnt)

if __name__ == "__main__":
    main()

Measured memory_bytes: 2940
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <map>      // map
#include <math.h>
#include <numeric>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define _GLIBCXX_DEBUG
#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++)
const int INF = 1001001001;
const int BG = 1000000007;

int main()
{
    char c;
    cin >> c;

    if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
    {
        cout << "vowel" << endl;
    }
    else
    {
        cout << "consonant" << endl;
    }
}


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n, k, c;
	cin >> n >> k >> c;
	string s;
	cin >> s;
	
	vector<int> L, R;
	int t = 1e9;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'o' && t >= c) {
			L.push_back(i);
			t = 0;
		}
		else t++;
		if (L.size() == k) break;
	}
	
	t = 1e9;
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == 'o' && t >= c) {
			R.push_back(i);
			t = 0;
		}
		else t++;
		if (R.size() == k) break;
	}
	
	reverse(R.begin(), R.end());
	for (int i = 0; i < k; i++) {
		if (L[i] == R[i]) cout << L[i] + 1 << '\n';
	}
	
	return 0;
}

Measured memory_bytes: 3468
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数
static FILE *szpFpI;											// 入力

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 最大公約数 - 取得
long long
fGetGcd(
	long long plVal1			// <I> 値１
	, long long plVal2			// <I> 値２
)
{
	long long llWork;

	// ユークリッドの互除法
	if (plVal1 < plVal2) {
		llWork = plVal1;
		plVal1 = plVal2;
		plVal2 = llWork;
	}
	while (plVal2 > 0) {
		llWork = plVal1 % plVal2;
		plVal1 = plVal2;
		plVal2 = llWork;
	}

	return plVal1;
}

// 最小公倍数 - 取得
long long
fGetLcm(
	long long plVal1			// <I> 値１
	, long long plVal2			// <I> 値２
)
{
	// 最大公約数 - 取得
	long long llGcd = fGetGcd(plVal1, plVal2);

	// 約数
	long long llVal1 = plVal1 / llGcd;
	long long llVal2 = plVal2 / llGcd;

	return llVal1 * llVal2 * llGcd;
}

// 実行メイン
long long
fMain(
)
{
	char lc1Buf[1024];

	// A, B - 取得
	int liA, liB;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d", &liA, &liB);

	// 最小公倍数 - 取得
	long long llLcm = fGetLcm(liA, liB);

	return llLcm;
}

// １回実行
int
fOne(
)
{
	long long llRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	llRet = fMain();

	// 出力
	sprintf(lc1Buf, "%lld\n", llRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <deque>
#include <algorithm>

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

using namespace std;

typedef long long ll;

const ll inf = 1e13;

int n;
ll x;
int a[2000];
deque<int> p;

int main(){
	cin >> n >> x;
	rep(i, n){
		cin >> a[i];
	}

	p.insert(p.end(), a, a + n);
	
	ll ans = inf;
	rep(i, n){
		ll s = x * i;
		rep(j, n){
			if(p[j] > a[j]){
				p[j] = a[j];
			}
			s += p[j];
		}
		ans = min(ans, s);

		p.push_front(p.back());
		p.pop_back();
	}
	cout << ans << endl;
	return 0;
}

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

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

    int N;
    cin >> N;

    vector<int> A;

    for(int i = 11; A.size() != N; i += 10) {
        bool checker = false;
        for(int j = 2; j * j <= i; j++) {
            if(i % j == 0) {
                checker = true;
                break;
            }
        }
        if(checker) continue;
        A.push_back(i);
    }

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

    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long int

using namespace std;

int main(void){
    cin.sync_with_stdio(false);
    ll N; cin>>N;
    ll h,n;
    for(h = 1; h <= 3500; h++){
        for(n = 1; n <= 3500; n++){
            ll a = N*h*n, b = 4*h*n-N*(h+n);
            if(b<=0) continue;
            if(a>b && a%b==0){
                cout<<h<<" "<<n<<" "<<a/b<<endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
a=Array.new(gets.to_i, Float::INFINITY)
b=gets.split.map(&:to_i)
b.each.with_index do |b_i, ix|
a[ix]=[a[ix],  b_i].min
a[ix.succ]=[a[ix.succ],  b_i].min
end
puts a.reduce(:+)

Measured memory_bytes: 1788
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N;
	scanf("%d",&N);

	if(N%2 == 0){

		printf("%.10lf\n",1.0/2.0);

	}else{

		printf("%.10lf\n",(double)(N/2+1)/(double)N);
	}

	return 0;
}


Measured memory_bytes: 256