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

int main(void)
{
    int n; cin >> n;
    string tmp;
    int ans[4];
    ans[0] = 0;
    ans[1] = 0;
    ans[2] = 0;
    ans[3] = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> tmp;
        if (tmp[0] == 'A') ans[0]++;
        else if (tmp[0] == 'W') ans[1]++;
        else if (tmp[0] == 'T') ans[2]++;
        else if (tmp[0] == 'R') ans[3]++;
    }
    cout << "AC x " << ans[0] << endl;
    cout << "WA x " << ans[1] << endl;
    cout << "TLE x " << ans[2] << endl;
    cout << "RE x " << ans[3] << endl;
}


Measured memory_bytes: 3620
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>

#pragma region _define

#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n,option) f(i,0,n)cout<<v[i]<<option;
#define all(a) a.begin(),a.end()
#define size(s) s.size()
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define INF 1<<29

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using si = stack<LL>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using v_pi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b)*b);
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		//ret %= 1000000007;
	}
	return ret;
}

#pragma endregion

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

	int a, b, k;
	cin >> a >> b >> k;
	for (int i = min(a, b); i > 0; i--) {
		if (a%i == 0 && b%i == 0) {
			k--;
		}
		if (k == 0) {
			cout << i;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
 
#define INF (1e8)
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a * b / g;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}

int N,M;
int ans = 0;

int main()
{
	cin >> N>>M;
	vector<int> from0;
	vector<int> toN;
	REP(i,M){
		int a, b;
		cin >> a >> b;
		if(a==1){
			from0.push_back(b);
		}
		if(b==N){
			toN.push_back(a);
		}
	}
	sort(toN.begin(), toN.end());
	REP(i, from0.size())
	{
		int j = from0[i];
		if(binary_search(toN.begin(),toN.end(),j)){
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}

	cout << "IMPOSSIBLE" << endl;

	return 0;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  for (int i=0;i<N;i++){
    string s;
    cin >> s;
    if (s == "Y"){
      cout << "Four" <<endl;
      break;
    }
    else if (i==N-1){
      cout << "Three" <<endl;
    }
  }
}


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

int main() {
  string s;
  cin >> s;
  int n = s.size() / 2;
  int c = 0;
  for (int i = 0;i < n;i++){
    if (s[i] != s[s.size() - 1 - i]){
      c++;
    }
  }
  cout << c << endl;
}

Measured memory_bytes: 3596
def input(f):
    V, E = map(int, f.readline().split())
    s = [None for _ in range(E)]
    t = [None for _ in range(E)]
    for i in range(E):
        s[i], t[i] = map(int, f.readline().split())
    return V, E, s, t

import sys

def solve(V, E, s, t):
    inf = sys.maxint
    dist = [[inf for _ in range(V)] for _ in range(V)]
    
    for i in range(E):
        dist[s[i]][t[i]] = 1
    
    for k in range(V):
        for i in range(V):
            for j in range(V):
                if i != k and k != j and dist[i][k] != inf and dist[k][j] != inf:
                        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
    
    def has_cycle():
        for i in range(V):
            if dist[i][i] != inf:
                return 1
        return 0
    
    print(has_cycle())


with open('/dev/stdin') as f:
    solve(*input(f))


Measured memory_bytes: 4804
package main

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

func main() {
	A := nextInt64()
	B := nextInt64()

	N := gcd(A, B)
	fmt.Println(len(factorize(N)) + 1)
}

func gcd(a, b int64) int64 {
	if b > a {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

// PrimeFactor は素因数と指数
type PrimeFactor struct {
	factor int64
	exp    int
}

func factorize(n int64) []PrimeFactor {
	factors := make([]PrimeFactor, 0)
	if n%2 == 0 {
		f := PrimeFactor{2, 0}
		factors = append(factors, f)

		for n%2 == 0 {
			n /= 2
			f.exp++
		}
	}
	for i := int64(3); i*i <= n; i++ {
		if n%i != 0 {
			continue
		}
		f := PrimeFactor{i, 0}
		factors = append(factors, f)

		for n%i == 0 {
			n /= i
			f.exp++
		}
	}

	if n != 1 {
		factors = append(factors, PrimeFactor{n, 1})
	}
	return factors
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
using namespace std;
using ll = long long;
const ll mod = 1e9+7;
ll x,y,z,k,count=0,sum;
ll a[1000],b[1000],c[1000];
void print(ll x,ll y,ll z){
  cout << a[x]+b[y]+c[z];

}
int main(){
  char b,x;
  cin >> b;
  if(b == 'A'){
    x = 'T';
  }else if(b == 'T'){
    x = 'A';
  }else if(b == 'G'){
    x = 'C';
  }else{
    x = 'G';
  }
  cout << x;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VB=vector<bool>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define print(x) std::cout<<x<<"\n"
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SZ(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

const ll INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
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; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll GCD(VI v){ll a = v[0]; for (ll i = 1; i<SZ(v); i++) {a = gcd(a, v[i]);} return a;}
ll LCM(VI v){ll a = v[0]; for (ll i = 1; i<SZ(v); i++) {a = lcm(a, v[i]);} return a;}
VI Bit2Vector(const ll bit, ll n) {	VI s;	rep(i,n) if (bit & (1 << i)) s.push_back(i); return s;}


void Main()
{
	string res="A";
	char s;
	cin >> s;

	if (isupper(s))
	{
		res="A";
	}
	else
	{
		res="a";
	}

	cout << res << "\n";
	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 3644
#include <stdio.h>
#define INF (1<<28)

int n;
int M[101][101];

int mst() {
	int res, mini, pointer;
	int cost[101], U[101];
	for (int ix = 0; ix < 101; ++ix) {
		cost[ix] = INF;
		U[ix] = 0;
	}
	cost[0] = 0;
	res = 0;
	while(1) {
		mini = INF;
		pointer = -1;
		for (int ix = 0; ix < n; ++ix) {
			if(U[ix]) continue;
			if(cost[ix] < mini) {
				mini = cost[ix];
				pointer = ix;
			}
		}
		if (pointer == -1) break;
		U[pointer] = 1;
		res += cost[pointer];
		for (int ix = 0; ix < n; ++ix) {
			if (U[ix]) continue;
			if ( M[pointer][ix] < cost[ix] ) {
				cost[ix] = M[pointer][ix];
			}
		}
	}
	return res;
}

int main() {
  scanf("%d\n",&n);
  for (int ix = 0; ix < n; ++ix) {
    for (int jx = 0; jx < n; ++jx) {
      scanf("%d",&M[ix][jx]);
      if (M[ix][jx] == -1) M[ix][jx] = INF;
    }
  }
  printf("%d\n", mst());
  return 0;
}


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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, a, b;
vi e[100100];
const ll base[2] = {101119, 101141};
const ll mod[2] = {1000000007, 1000000021};
pll h[100100];

void rec(int v, int p) {
	pll res;
	each(i,e[v]) if (i!=p) {
		rec(i,v);
		(res.fi += h[i].fi) %= mod[0];
		(res.se += h[i].se) %= mod[1];
	}
	(res.fi *= base[0]) %= mod[0];
	(res.se *= base[1]) %= mod[1];
	(res.fi += 1) %= mod[0];
	(res.se += 1) %= mod[1];
	h[v] = res;
}

signed main() {
	cin >> n;
	rep(i,n-1) {
		cin >> a >> b;
		a--, b--;
		e[a].pb(b), e[b].pb(a);
	}
	rec(0,-1);
	map<pll,ll> m;
	rep(i,n) m[h[i]]++;
	ll res = 0;
	each(i,m) res += i.se*(i.se-1)/2;
	cout << res << ln;
}


Measured memory_bytes: 24316
N,M = gets.split.map(&:to_i)
SC = readlines.map {|s| s.split.map(&:to_i) }

ans = nil
num = Array.new(N,-1)
SC.each do |s,c|
  i = s - 1
  if num[i] != -1 && num[i] != c
    ans = -1
    break
  end
  num[i] = c
end
unless ans
  if N == 1 && SC.empty?
    ans = 0
  elsif num.size > 1 && num[0] == 0
    ans = -1
  else
    num[0] = 1 if num[0] < 0
    ans =  num.map {|n| n < 0 ? 0 : n }.join.to_i
  end
end
puts ans

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

const int INF = 1001001001;
int A[200005];
vector<int> E[200005];
int d[200005];
bool visited[200005];
int lis[200005];
int n;

void dfs(int u) {
    visited[u] = true;
    int idx = lower_bound(lis, lis+n+1, A[u]) - lis;
    int old_num = lis[idx];
    lis[idx] = A[u];
    d[u] = (lower_bound(lis, lis+n+1, INF) - lis) - 1;
    for (int v: E[u]) {
        if (visited[v]) continue;
        dfs(v);
    }
    lis[idx] = old_num;
    return;
}

int main() {
    cin >> n;
    rep(i, n) cin >> A[i];
    rep(i, n-1) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        E[u].push_back(v);
        E[v].push_back(u);
    }
    rep(i, 200005) lis[i] = INF;
    lis[0] = 0;
    dfs(0);
    rep(i, n) {
        cout << d[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 28552
#include<bits/stdc++.h>
using namespace std;
typedef long double lld;
typedef pair<lld,lld> pr;
lld const mod = 1e9+7;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  lld L,e,V;
  cin>>L;
  e = L/3.0;
  V = e*e*e;
  // cout<<V<<'\n';
  printf("%0.6Lf\n",V);
}


Measured memory_bytes: 256
N=input()
A=list(map(int,input().split()))
M=max(A)+1
B=[True]*M
S=set()
x=0
for i in A:
  if i not in S:
    S.add(i)
    for j in range(i*2,M,i):
      B[j]=False
  else:
    B[i]=False
for i in A:
  if B[i]==True:
    x+=1
print(x)

Measured memory_bytes: 132724
import java.io.IOException;

public class Main {
	

	public static void main(String[] args) {
		try {
			final int SIZE = 20 + 10 * 8 * ((8 + 4) * 8);// 8桁＋終端　を　8行に＋空行を10回
			byte[] buf = new byte[SIZE];// 入力データをすべて格納する
			int count = 0;// 文字の先頭からの順番
			int limit = System.in.read(buf, 0, SIZE);

			while (count < limit) {
				int box[] = new int[4];
				int i = 0;
				int head = 0;
				int[] x = new int[4];
				while (count < limit) {
					if (buf[count] == '1') {
						box[i] = count;
						x[i] = head;
						i++;
						
					}
					if (buf[count] != '0' && buf[count] != '1')
						head = 0;
					else
						head++;
					count++;
					if(i > 3) break;
				}
				
				if(i != 4 ) break;
				
				if (box[0] == box[1] - 1) {
					// ACEG
					switch (x[2] - x[0]) {
					case -1:
						System.out.println("G");
						break;
					case 0:
						System.out.println("A");
						break;
					case 1:
						System.out.println("E");
						break;
					case 2:
						System.out.println("C");
						break;
					}
				} else {
					// BDF
					switch (x[3] - x[0]) {
					case -1:
						System.out.println("D");
						break;
					case 0:
						System.out.println("B");
						break;
					case 1:
						System.out.println("F");
						break;
					}
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}

Measured memory_bytes: 16844
s = gets.chomp
s.gsub!("egg", "0")
while s.gsub!("00", "0,0")
end
s.gsub!("chicken", "1")
while s.gsub!("11", "1,1")
end
s = s.split(",")
arr = []
s.each_with_index{|x, i| arr << [x, i]}
arr.sort_by!{|a, b| [-a.length, b]}
puts (arr[0][0][-1] == "0" ? "egg" : "chicken")



Measured memory_bytes: 6928
import numpy as np
a,b=map(int,input().split())
def sn(x):
  if x==".":
    return 0
  else:
    return 1
c=np.array([list(map(sn,list(input()))) for i in range(a)])
d=np.array([list(map(sn,list(input()))) for i in range(b)])

for i in range(a-b+1):
  for j in range(a-b+1):
    if np.allclose(c[i:b+i,j:b+j],d):
      print("Yes")
      exit()
else:
  print("No")

Measured memory_bytes: 12404
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<unsigned P> struct ModInt {
  using M = ModInt;
  unsigned v;
  ModInt() : v(0) {}
  ModInt(auto x) : v(x >= 0 ? x % P : (P - -x % P) % P) {}
  constexpr ModInt(unsigned v, int) : v(v) {}
  static constexpr unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool)*this; }
  M operator*(M r) const { return M(*this) *= r; }
  M operator/(M r) const { return M(*this) /= r; }
  M operator+(M r) const { return M(*this) += r; }
  M operator-(M r) const { return M(*this) -= r; }
  bool operator==(M r) const { return v == r.v; }
  bool operator!=(M r) const { return !(*this == r); }
  M& operator*=(M r) { v = (uint64_t)v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; }
  M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  M pow(auto n) const {
    if (n < 0) return pow(-n).inv();
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
  friend M operator*(auto l, M r) { return M(l) *= r; }
  friend M operator/(auto l, M r) { return M(l) /= r; }
  friend M operator+(auto l, M r) { return M(l) += r; }
  friend M operator-(auto l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend istream& operator>>(istream& is, M& r) { lint x; is >> x; r = x; return is; }
  friend bool operator==(auto l, M r) { return M(l) == r; }
  friend bool operator!=(auto l, M r) { return !(l == r); }
};
using Mint = ModInt<998244353>;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, k; cin >> n >> k;
  VV<> g(n);
  for (int _ = 0; _ < n - 1; ++_) {
    int u, v; cin >> u >> v, --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }

  V<> sz(n);
  VV<Mint> dp0(n, V<Mint>(k + 1)), dp1(n, V<Mint>(k + 1));
  auto dfs = [&](const auto& dfs, int v, int p) -> void {
    sz[v] = 1;
    dp0[v][0] = 1;
    dp1[v][1] = 1;
    for (int w : g[v]) if (w != p) {
      dfs(dfs, w, v);
      V<Mint> ndp0(k + 1), ndp1(k + 1);
      for (int i = 0; i <= min(sz[v], k); ++i) {
        for (int j = 0; j <= min(sz[w], k); ++j) {
          if (i + j <= k) ndp0[i + j] += dp0[v][i] * (dp0[w][j] + dp1[w][j]);
          if (i + j <= k) ndp1[i + j] += dp1[v][i] * (dp0[w][j] + dp1[w][j]);
          if (i + j and i + j - 1 <= k) ndp1[i + j - 1] += dp1[v][i] * dp1[w][j];
        }
      }
      sz[v] += sz[w];
      swap(dp0[v], ndp0);
      swap(dp1[v], ndp1);
    }
  };
  dfs(dfs, 0, -1);
  Mint res = dp0[0][k] + dp1[0][k];
  cout << res << '\n';
}


Measured memory_bytes: 265772
#include <iostream>
#include <queue>
#include <vector>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <algorithm>
#include <set>
#include <string>
#include <utility>
#include <cmath>
#include <cstring>
#include <limits>
#include <iomanip>

typedef long long ll;
typedef unsigned long long ull;
#define sq(x) (x) * (x)
#define cube(x) (x) * (x) * (x)
#define reps(i, j, k) for(auto i = j; i < k; ++i)
#define rep(i, j) reps(i, 0, j)
#define decs(i, j, k) for(auto i = j; i >= k; --i)
#define dec(i, j) decs(i, j, 0)
#define iter(i, j) for(auto i = j.begin(); i != j.end(); ++i)
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int, int>
#define F first
#define S second
#define mp make_pair
#define um unordered_map
#define all(x) (x).begin(), (x).end()  
#define fast_io ios::sync_with_stdio(0); cin.tie(0);
#define file_io freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define IMAX std::numeric_limits<int>::max()
#define IMIN std::numeric_limits<int>::min()
using namespace std;
template <class T> T count_multiples_of(T x, T upper_bound, T lower_bound)
{
    T ans = upper_bound / x - lower_bound / x;
    if(lower_bound % x == 0) return ans + 1;
    else return ans;
}
ll C(ll n, ll k) 
{ 
    ll C[n + 1][k + 1]; 
    ll i, j; 
    for(i = 0; i <= n; i++) 
    { 
        for(j = 0; j <= min(i, k); j++) 
        { 
            if (j == 0 || j == i) 
                C[i][j] = 1; 
            else
                C[i][j] = C[i - 1][j - 1] + 
                          C[i - 1][j]; 
        } 
    } 
    return C[n][k]; 
}
template <class T> void display_1D_vector(vector<T> v)
{
    ll n = v.size();
    rep(i, n) cout << v[i] << " ";
    cout << endl;
}

template <class T> void display_2D_vector(vector< vector<T> > v)
{
    ll n = v.size(), m = v[0].size();
    rep(i, n)
    {   
        rep(j, m) cout << v[i][j] << " ";
        cout << endl;
    }
}
int fast_exp(int a, int b)
{
    int res = 1;
    while(b)
    {
        if(b & 1)
            res *= a;
        a *= a;
        b >>= 1;
    }
    return res;
}

int main()
{
    fast_io
    //file_io
    int h, a; cin >> h >> a;
    cout << int(ceil(float(h) / float(a)));
    return 0;
}

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

int main() {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    if (a[0] == 5 && a[1] == 5 && a[2] == 7) {
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import numpy as np
import math

A, B = input().split()
A = int(A)
B_float = float(B)
B_int = int(B[0]+B[2:])
if B_float < 1:
    B_float = B_float*100
    C = A*B_float/100
    #C_str = str(C)
    print("{}".format(int(C)))
elif not A==0:
    C = A*B_int
    C_str = str(C)
    #iti = C_str.find('.')
    print("{}".format(int(C_str[:-2])))
elif A==0:
    print("{}".format(0))


Measured memory_bytes: 27188
#include <iostream>
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
int n,m,a[100],b[10],ok;
int main(void){
    while(1){
    cin>>n>>m;
    //cout<<n<<" "<<m<<endl;
    if(n==0&&m==0)return 0;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<m;i++)cin>>b[i];
    map<int,int> mp;
    set<int> se;
    vector<int> v,u;
    mp[0]=1;
    ok=0;
    for(int i=0;i<m;i++){
        v={};
        for(auto x:mp)v.push_back(x.F);
        for(auto x:v){
            if(x-b[i]>0)mp[x-b[i]]=1;
            if(b[i]-x>0)mp[b[i]-x]=1;
            if(b[i]+x)mp[b[i]+x]=1;
        }
    }
    for(auto x:mp)u.push_back(x.F);
    for(int i=0;i<n;i++){
        if(mp[a[i]]==1)continue;
        //for(auto x:u)cout<<x;
        //cout<<endl;
        if(se.empty()&&ok==0){
            ok=1;
            for(auto x:u){
                if(x-a[i]>0)se.insert(x-a[i]);
                if(a[i]-x>0)se.insert(a[i]-x);
                if(a[i]+x)se.insert(a[i]+x);
            }
        }
        else{
            set<int> se1;
            for(auto x:u){
                if(x-a[i]>0&&se.count(x-a[i])){se1.insert(x-a[i]);}
                if(a[i]-x>0&&se.count(a[i]-x)){se1.insert(a[i]-x);}
                if(a[i]+x&&se.count(a[i]+x)){se1.insert(a[i]+x);}
            }
            //cout<<endl;
            se.clear();
            se=se1;
        }
    }
    if(ok==0){cout<<0<<endl;}
    else if(se.empty()){cout<<-1<<endl;}
    else{
        auto itr=se.begin();
    //itr--;
    cout<<*itr<<endl;}
    }
}



Measured memory_bytes: 7452
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int R;
  cin>>R;
  if(R<1200)
  cout<<"ABC"<<endl;
  else if(R<2800)
  cout<<"ARC"<<endl;
  else{
    cout<<"AGC"<<endl;
  }
  
}
    

   
  
   


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

int main(void) {
    
    int A = 5;
    int B = 7;
    int C = 5;

    int a, b, c;

    cin >> a >> b >> c;

    if (a == A && b == B && c == C){
        cout << "YES" << endl;
    } else if (a == B && b == C && c == A){
        cout << "YES" << endl;
     } else if (a == C && b == A && c == B){
         cout << "YES" << endl;
     } else {
         cout << "NO" << endl;     
         }

    return 0;
}

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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key
#define mark(x) cout<<"Here -- "<<x<<endl;
#define pv(v)   {rep(i,v.size()) cout<<v[i]<<" "; cout<<endl;}


ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    string s;
    cin>>s;
    int q;
    cin>>q;
    int cp = 0;
    while(q--){
        int t ; cin>>t;
        if(t==1){
            cp^=1;
        }
        else{
            int f;char c;
            cin>>f>>c;
            if(f==1&&cp==0||f==2&&cp==1){
                s.insert(s.begin(),c);
            }
            else if(f==2&&cp==0||f==1&&cp==1){
                s.insert(s.end(),c);
            }
        }
    }
    if(cp==1){
        reverse(s.begin(),s.end());
    }
    cout<<s;

    return 0;
} 

Measured memory_bytes: 912
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

   string ws[]={"SUN", "MON" ,"TUE", "WED", "THU", "FRI", "SAT"};
   int wd;
   rep(i, 7) if(s==ws[i]) wd=i;
   int ans=7-wd;

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


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

using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  vector<char> a(s.begin(), s.end());
  vector<char> b(t.begin(), t.end());
  sort(a.begin(), a.end());
  sort(b.begin(), b.end(), greater<char>());
  cout << (a < b ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin>>N;
  vector<int64_t> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec[i];
  }
  
  int zero=0;
  for(int i=0;i<N;i++){
    if(vec[i]==0)
      zero++;
    if(zero>0){
      cout<<0<<endl;
      return 0;
    }
  }
  
  int64_t s=1;
  for(int i=0;i<N;i++){
    if(vec[i]>1000000000000000000/s){
      s=-1;
      break;
    }
    s*=vec[i];
  }
  cout<<s<<endl;
}

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

class Dice{
public:
    long r[6];
    Dice(){};
    void roll(long a, long b, long c, long d){
        swap(r[a], r[b]);swap(r[b], r[c]);swap(r[c], r[d]);
    }
    void spinW(){roll(0, 2, 5, 3);}
    void spinN(){roll(0, 1, 5, 4);}
    void spin(char c){
        if (c == 'W') roll(0, 2, 5, 3);
        else roll(0, 1, 5, 4);
    }
};

long check(Dice d1, Dice d2){
    for (long i = 0; i < 6; i++) if (d1.r[i] != d2.r[i]) return 0;
    return 1;
}

int main() {
    bool ans = 0;
    int n;
    cin >> n;
    vector<Dice> D(n);
    for (int i = 0; i < n ; i++) {
        for (int j = 0; j < 6; j++) cin >> D[i].r[j];
    }
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            char SWS[8]={"NNNWNNN"};
            for (int k = 0; k < 8; k++){
                if (D[i].r[1] == D[j].r[1]) break;
                D[j].spin(SWS[k]);
            }
            for (int k = 0; k < 4; k++){
                if (D[i].r[0] == D[j].r[0]){
                    if (D[i].r[1] == D[j].r[1] && D[i].r[2] == D[j].r[2] && D[i].r[3]==D[j].r[3] && D[i].r[4] == D[j].r[4] && D[i].r[5] == D[j].r[5])
                        ans = 1;
                }
                D[j].spinW();
            }
        }
    }
    if (ans == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
	ll cost;
};
using Graph = vector<vector<Edge>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 2.0 * asin(1.0);
const ll INF = 1L<<60;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ll MAX = 10000000;
/****** define constant end ********/
/****** define variable start ******/
string s;
/******* define variable end *******/
int solve() {
	cin >> s;
	cout << s.substr(0, 3) << endl;
	return 0;
}

int main() {
	//clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


Measured memory_bytes: 3592
#include <stdio.h>
#include <string.h>


int main(void)
{
	
	int n;
	int ans = 0;
	int v[20];
	int c[20];
	int i;
	
	
	scanf("%d", &n);
	
	for(i = 0; i < n; i++) {
		scanf("%d", &v[i]);
	}
	
	for(i = 0; i < n; i++) {
		scanf("%d", &c[i]);
		if(v[i] > c[i]) {
			ans += v[i] - c[i];
		}
	}
	
	printf("%d", ans);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
	string str;
	while(cin>>str,str!="#"){
		int ans=-1;
		for(int i=0,now=2,num=0;i<str.size();i++){
			if(str[i]-'a'>'g'-'a'&&str[i]-'a'<'q'-'a'||str[i]=='u'||str[i]=='y')num=1;
			else num=0;
			if(now!=1&&num==1){
				ans++;
				now=1;
			}
			else if(now!=0&&num==0){
				ans++;
				now=0;
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1184
#include <stdio.h>
int main (void){
  int a,b,c,min;
  scanf("%d %d %d",&a,&b,&c);
  min = a + b;
  if (a + c < min)
    min = a + c;
  if (b + c < min)
    min = b + c;
  printf("%d\n",min);
  return (0);
}


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

ll s;
const int x2 = 1000000000;

int main() {
  scanf("%lld", &s);
  int x = (x2 - s % x2) % x2;
  int y = (s + x) / x2;
  printf("0 0 1000000000 1 %d %d\n", x, y);

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<sstream>

using namespace std;

struct data{
  int num[4];
};

int info[9][4];

bool isJoint(string s){
  int p = 0;
 
  for(int i = 0; i < s.length(); i++)
    if(s[i] == '(' || s[i] == ')') p++;
 
  return p==2;
}


data mul(int n1,int n2){
  data d;

  for(int i = 0; i < 4; i++)
    d.num[i] = (info[n1][i] && info[n2][i]);

  return d;
}

data add(int n1,int n2){
  data d;
  
  for(int i = 0; i < 4; i++)
    d.num[i] = (info[n1][i] || info[n2][i]);

  return d;
}


data opp(int n1,int n2){
  data d;

  for(int i = 0; i < 4; i++)
    d.num[i] = (info[n1][i] != info[n2][i]);

  return d;
}

vector<data> getVV(vector<data> V1, vector<data> V2){
  vector<data> V;

  for(int i = 0; i < V1.size(); i++)
    for(int j = 0; j < V2.size(); j++){
      data d;

      for(int k = 0; k < 4; k++)
	d.num[k] = (V1[i].num[k]&&V2[j].num[k]);
      V.push_back(d);

      for(int k = 0; k < 4; k++)
	d.num[k] = (V1[i].num[k]||V2[j].num[k]);
      V.push_back(d);


      for(int k = 0; k < 4; k++)
	d.num[k] = (V1[i].num[k]!=V2[j].num[k]);
      V.push_back(d);
    }

  return V;
}

vector<data> getV(int n1, int n2){
  data d[3];

  vector<data> V;
  d[0] = mul(n1,n2);
  d[1] = add(n1,n2);
  d[2] = opp(n1,n2);

  for(int i = 0; i < 3; i++)
    V.push_back(d[i]);
  return V;
}

bool isnum(string s){

  for(int i = 0; i < s.length(); i++)
    if(s[i] == '(' || s[i] == ')') return false;

  return true;
}

vector<data> make(string s){

  //cout << "s " << s << endl;

  if(isnum(s)){

    vector<data> V;

    stringstream ss(s);
    int a;
    ss >> a;
    data d;

    for(int i = 0; i < 4; i++)
      d.num[i] = info[a][i];
    V.push_back(d);
    return V;

  }else if(isJoint(s)){
    int n1 = 0,n2 = 0;
    int pos = 1;

    while(s[pos] != ' '){
      n1 *= 10;
      n1 += s[pos]-'0';
      pos++;
    } 
    pos++;

    while(s[pos] != ')'){
      n2 *= 10;
      n2 += s[pos]-'0';
      pos++;
    }
    
    vector<data> V = getV(n1,n2);

    return V;
  }else{
    int p = 0;
    string s1 = "",s2 = "";
    int pos;

    for(int i = 1; i < s.length()-1; i++){
      if(s[i] == '(') p++;
      if(s[i] == ')') p--;
      if(s[i] == ' ' && p == 0){
	pos = i;
	break;
      }
      s1+=s[i];
    }

    for(int i = pos+1; i < s.length()-1; i++)
      s2+=s[i];

    return getVV(make(s1),make(s2));
  }

}

int main(){


  string s;
  while(getline(cin,s) && s != "END"){
    int num;
    cin >> num;

    for(int i = 1; i <= num; i++)
      for(int j = 0; j < 4; j++)
	cin >> info[i][j];

    vector<data> V = make(s);
    
    int ans = 0;

    for(int i = 0; i < V.size(); i++)
      if(V[i].num[0] == 1 && V[i].num[1] == 1 && 
	 V[i].num[2] == 1 && V[i].num[3] == 1) ans++;


    cout << ans << endl;
    getline(cin,s);
 
  }

  
  return 0;
}

Measured memory_bytes: 1384
def MAP(): return map(int,input().split())

n = int(input())
*h, = MAP()
ans=1
for i in range(1,n):
    flag = True
    for j in range(i-1,-1,-1):
        if h[j]>h[i]:
            flag=False
            break
    if flag:
        ans+=1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define LLINF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

ll dp[100010][2];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string L;
    cin >> L;
    dp[0][0] = 1;
    for (int i = 0; i < (int)L.size(); i++)
    {
        if (L[i] == '0')
        {
            // a+b=0
            dp[i + 1][0] += dp[i][0];
            dp[i + 1][1] += dp[i][1];
            // a+b=1
            dp[i + 1][1] += dp[i][1] * 2 % MOD;
        }
        else
        {
            // a+b=0
            dp[i + 1][1] += (dp[i][0] + dp[i][1]) % MOD;
            dp[i + 1][0] += dp[i][0] * 2 % MOD;
            // a+b=1
            dp[i + 1][1] += dp[i][1] * 2 % MOD;
        }
    }
    ll ans = (dp[(int)L.size()][0] + dp[(int)L.size()][1]) % MOD;
    cout << ans << endl;
}

Measured memory_bytes: 2000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
int main() {
    int n;
    string s;
    ll ans = 0;
    cin >> s;
    if (s == "SSS") {
        ans = 0;
    }else if  (s == "SSR") {
       ans = 1;
   }else if  (s == "SRS") {
       ans = 1;
   }else if  (s == "SRR") {
       ans = 2;
   }else if  (s == "RSS") {
       ans = 1;
   }else if  (s == "RSR") {
       ans = 1;
   }else if  (s == "RRS") {
       ans = 2;
   }else if  (s == "RRR") {
       ans = 3;
   }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
a = list(map(int, input().split()))
if ((a[0] == a[1]) or (a[0] == a[2]) or (a[2] == a[1])):
  if ((a[0] == a[1]) and (a[2] == a[1])):
    print("No")
  else:
    print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T& a, const T& b)
{
        if (a < b) {
                    a = b;
                            return 1;
                                }
            return 0;
}
template <class T>
bool chmin(T& a, const T& b)
{
        if (b < a) {
                    a = b;
                            return 1;
                                }
            return 0;
}

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define F first
#define S second

typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1000000;
const int minf = -1000000;
const ll lnf = 1e12;
const ll mlnf = -1e12;
const double e = 1e-10;

void debug_vector(vector<int>& v)
{
    int n = v.size();
    for (int i = 0; i < n; i++) {
        cout << v[i] << " ";
    }
    cout << endl;
}


//////////////////////
//// coding start ////
//////////////////////

// global variet


int gcd_triple(int a, int b, int c);
void solve();

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

int gcd_triple(int a, int b, int c){
    int tmp, ans;
    tmp = __gcd(a, b);
    ans = __gcd(tmp, c);
    return ans;
}


void solve(){
    int K; cin >> K;
    long long ans = 0;
    for (int a = 1; a <= K; a++){
        for (int b = 1; b <= K; b++){
            for (int c = 1; c <= K; c++){
                ans += gcd_triple(a, b, c);
            }
        }
    }
    printf("%lld\n", ans);
}



Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N;
	cin >> N;
	vector<ll> A(3 * N);
	REP(i, 3 * N) scanf("%lld", &A[i]);
	sort(ALL(A));
	
	ll ans = 0;
	for (int i = N; i < 3 * N; i += 2) ans += A[i];
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

ll dfs(const vector<ll>& As, ll N, ll P, ll index, ll parity)
{
    if (index == N) {
        return parity == P;
    }

    static array<vector<ll>, 2> memo = { vector<ll>(N, -1), vector<ll>(N, -1) };
    auto& memo_a = memo[parity][index];
    if (memo_a != -1) {
        return memo_a;
    }

    auto c1 = dfs(As, N, P, index + 1, (parity + As[index]) % 2);
    auto c2 = dfs(As, N, P, index + 1, parity);

    memo_a = c1 + c2;

    return c1 + c2;
}

void main_()
{
    ll N, P;
    cin >> N >> P;
    vector<ll> As;
    copy_n(istream_iterator<ll>(cin), N, back_inserter(As));

    auto ans = dfs(As, N, P, 0, 0);

    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		if (a == 1) {
			System.out.println("Hello World");
		} else {
			int b = sc.nextInt();
			int c = sc.nextInt();
			System.out.println(b + c);
		}
	}
}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pi M_PI
#define inf 1<<30
#define eps (1e-11)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;

class Point{
public:
  double x,y;
  Point(double x=0,double y=0):x(x),y(y){}

  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ return (x!=p.x ? x<p.x : y<p.y);}
  bool operator==(Point p)const{ return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}

  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;

class Circle{
public:
  Point c;
  double r;
  Circle(Point c=Point(),double r=0.0):c(c),r(r){}
};

double norm(Vector a){ return (a.x*a.x+a.y*a.y);}
double abs(Vector a){ return sqrt(norm(a));}

int intersect(Circle a,Circle b){
  double dis=abs(a.c-b.c),sumr=a.r+b.r,minr=min(a.r,b.r),maxr=max(a.r,b.r);
  if((sumr-dis)<-eps)return 4;
  if(equals(sumr,dis))return 3;
  if((maxr-(dis+minr))<-eps)return 2;
  if(equals(dis+minr,maxr))return 1;
  return 0;
}

int main()
{
  Circle c1,c2;

  cin>>c1.c.x>>c1.c.y>>c1.r;
  cin>>c2.c.x>>c2.c.y>>c2.r;

  cout<<intersect(c1,c2)<<endl;
  return 0;
}

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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (s); i <= (t); ++i)
#define repD(i,t,s) for(int i = (t); i >= (s); --i)
#define rep(i,n) repU(i,0,n - 1)
#define rep1(i,n) repU(i,1,n)
#define all(v) begin(v),end(v)
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define q_ceil(n,d) ((n - 1) / (d) + 1)
#define parity(a,b) (((a)^(b)) & 1 ^ 1)

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;

const pair<int,int> DIR[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF_32 = (1 << 30) - 1;
const ll INF_64 = (1LL << 62) - 1;
const int MOD = 1e9 + 7;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	ll k;
	pii p[100010];
	cin >> n >> k; 
	rep(i,n){
		int a,b;
		cin >> a >> b;
		p[i] = {a,b};
	}
	sort(p,p + n);
	int i = 0,cur;
	while(k > 0){
		 auto t = p[i++];
		 cur = t.fir;
		 k -= t.sec;
	}
	cout << cur << endl;
}





Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/

int main(){
  int n,a[205],ans=0;
  cin>>n;
  rep(i,n){
    cin>>a[i];
  }
  while(1){
    bool ok=true;
    rep(i,n){
      if(a[i]%2!=0){
	ok=false;
	break;
      }else{
	a[i]/=2;
      }
    }
    if(!ok)break;
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
H, W, M = map(int, input().split())

h_cnt = [0] * H
w_cnt = [0] * W
hw = [tuple(map(lambda x: int(x)-1, input().split())) for _ in range(M)]
for h, w in hw:
    h_cnt[h] += 1
    w_cnt[w] += 1

max_h = max(h_cnt)
max_w = max(w_cnt)
hs = [i for i in range(H) if h_cnt[i]==max_h]
ws = [i for i in range(W) if w_cnt[i]==max_w]

ans = max_h+max_w-1
hw = set(hw)
for h in hs:
    for w in ws:
        if (h, w) not in hw:
            print(max_h+max_w)
            exit()
print(max_h+max_w-1)



Measured memory_bytes: 169444
#include <iostream>
using namespace std;
int main()
{
    char a,b;
    cin>>a; cin>>b;
    
    if(a=='H'&&b=='H')
        cout<<'H';
    else if(a=='H'&&b=='D')
        cout<<'D';
    else if (a=='D'&&b=='H')
        cout<<'D';
    else
        cout<<'H';
    
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(),m = sc.nextInt();
    int a[] = new int[m],b[] = new int[m];
    for(int i = 0;i<m;i++){
      a[i] = sc.nextInt();
      b[i] = sc.nextInt();
    }
    int count[] = new int[n];
    int num = 0;
    for(int i = 0;i<m;i++){
      num = a[i] - 1;
      count[num]++;
      num = b[i] - 1;
      count[num]++;
    }
    for(int i = 0;i<n;i++){
      System.out.println(count[i]);
    }
  }
}


Measured memory_bytes: 23636