akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    vector<ll> b;

    b.push_back(1);

    for(ll i = 1; i < 7; i++) {
        b.push_back(pow(6, i));
        b.push_back(pow(9, i));
    }

    vector<ll> dp(N + 1, 1000000);

    dp[0] = 0;

    for(ll i = 1; i <= N; i++) {
        for(ll j = 0; j < b.size(); j++) {
            if(i - b[j] >= 0) {
                dp[i] = min(dp[i], dp[i - b[j]] + 1LL);
            }
        }
    }

    cout << dp[N] << endl;
}

Measured memory_bytes: 1024
until (n = gets.to_i).zero?
  h = Hash.new(0)
  
  n.times do
    arr = gets.split.map(&:to_i)
    h[arr[0]] += arr[1] * arr[2]
  end
  
  h = h.select{ |k, v| v >= 1_000_000 }
  
  puts h.empty? ? "NA" : h.keys
end

Measured memory_bytes: 8828
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const S = args[0][0]
	if (S[0] !== S[1] && S[1] !== S[2] && S[2] !== S[0]) console.log('Yes')
	else console.log('No')
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }

    long long res = 0;
    int max_num = 0;
    for(int i = 0; i < N; i++) {
        max_num = max(max_num, A[i]);
        res += max_num - A[i];
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 4056
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

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

	int q; cin >> q;
	rep(loop, q) {
		int m; cin >> m;

		vector<VB> dp(29, VB(2999));
		dp[0][0] = true;
		rep(i, n) {
			rep(j, m + 1) {
				if (j >= a[i])if (dp[i][j - a[i]])dp[i + 1][j] = true;
				if (dp[i][j])dp[i + 1][j] = true;
			}
		}

		puts(dp[n][m] ? "yes" : "no");
	}
}


Measured memory_bytes: 3112
ab = [0 for _ in range(4)]
for _ in range(3):
    a, b = map(int, input().split())
    ab[a - 1] += 1
    ab[b - 1] += 1
if ab.count(1) == 2 and ab.count(2) == 2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9032
#include <iostream>
#include <cmath>
#include <climits>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <stack>
#include <algorithm>
#include <map>
#include <numeric>
#include <set>
using namespace std;
// scanf
#pragma warning(disable: 4996)
// v:vector  type:型  order:greater or less
#define _sort(v,type,order) do { sort(v.begin(),v.end(),order<type>()); } while(0)
// vector 要素の総和算出
// v:vector  default_value:初期値
#define _sum(v,default_value) accumulate(v.begin(),v.end(),default_value )
// vector 最大値( return ite )
#define _max_element(v) max_element(v.begin(),v.end())
// vector 最大値が格納されている要素値
#define _max_element_number(v) distance(v.begin(),max_element(v.begin(),v.end()))

//set<uint32_t> member;	// 重複するデータを保持する事はできない member.insert(2) member.insert(2) ⇒ member.count(2)は1
//multiset<uint32_t> v;	// 重複するデータも保持する事はできる   member.insert(2) member.insert(2) ⇒ member.count(2)は2

// 丸め
#define _round(v) round(v)
// 2乗 / 3乗
#define _square(v) pow(v,2)
#define _cube(v)   pow(v,3)
// 大小判定
#define _max(x,y) max(x,y)-
#define _min(x,y) min(x,y)
// string ⇒ int
#define _stringtoi(s) stoi(s)
// double 平方根
#define _sqrt(x) sqrt(x)
// double 引数 x 以上で最小の整数値 ex) 3.30303 ⇒ 4
#define _ceil(x) ceil(x)
// 指定された要素以上の値が現れる最初の位置のイテレータを取得する
#define _lower_bound(v,min) lower_bound(v.begin(), v.end(), min)
// 指定された要素より大きい値が現れる最初の位置のイテレータを取得する
#define _upper_bound(v,min) upper_bound(v.begin(), v.end(), min)

// 順列 n個の数が与えられる
// 0,1,2,...,n-1
// 全ての並べ方を1行ごとに出力する
// ex 0 1 2 / 0 2 1 / 1 0 2 / 1 2 0 / 2 0 1 / 2 1 0
#define _next_permutation(v) do {   \
	for (auto num : v) {            \
		printf("%d ", num);         \
	}                               \
	printf("\n");                   \
} while (next_permutation(v.begin(), v.end()))

// 絶対値
static int32_t _abs(const int32_t x) { return  (x > 0 ? x : -x); }
// 最大公約数
static int gcd(int a, int b)
{
	if (a < b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}
	return b ? gcd(b, a % b) : a;
}
// 最小公倍数
static int lcm(int a, int b) { return a * b / gcd(a, b); }
// 多次元 std::vector 生成
template<class T>
vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
// ex) auto dp = make_vec<uint64_t>(SIZE + 1, 2, 2);



// 169 C
// https://atcoder.jp/contests/abc169/tasks/abc169_c
int main()
{
	uint64_t a;
	string s;
	cin >> a >> s;

	uint64_t b = ((s[0] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0'));

	printf("%llu\n", a*b / 100);
	return 0;
}


Measured memory_bytes: 3736
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define MOD 1000000007
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    int N, M;
    cin >> N >> M;
    vector<vector<char>> A(N, vector<char>(N));
    vector<vector<char>> B(M, vector<char>(M));
    for(int i =0; i < N; i++) for(int j = 0; j < N; j++) cin >> A[i][j];
    for(int i =0; i < M; i++) for(int j = 0; j < M; j++) cin >> B[i][j];

    vector<vector<vector<char>>> A_sub;
    for(int i = 0; i <= N - M; i++){
        for(int j = 0; j <= N - M; j++){
            vector<vector<char>> A_app(M, vector<char>(M));
            for(int k = 0; k < M; k++){
                for(int l = 0; l < M; l++){
                    A_app[k][l] = A[i+k][j+l];
                }
            }
            A_sub.push_back(A_app);
        }
    }
    for(auto v : A_sub){
        if(v == B){
            puts("Yes");
            return 0;
        }
    }
    puts("No");
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  vector<int> v(3); for(auto&e:v)cin >> e;
  sort(v.begin(), v.end());
  cout << v[2]-v[1]+v[1]-v[0] << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using System.Threading.Tasks;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            if (input[0] == 1 && input[1] != 1) Console.WriteLine("Alice");
            else if (input[0] != 1 && input[1] == 1) Console.WriteLine("Bob");
            else if (input[0] > input[1]) Console.WriteLine("Alice");
            else if (input[0] < input[1]) Console.WriteLine("Bob");
            else Console.WriteLine("Draw");
        }
    }
}


Measured memory_bytes: 13268
//  LINK ZADATKA: http://abc073.contest.atcoder.jp/tasks/abc073_a

#include <queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <fstream>
#include <cstring>
#include <string>
#include <climits>

using namespace std;

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;


#define FOR(k,a,b) for(int k=(a); k<=(b); ++k)
#define REP(k,a) for(int k=0; k<(a);++k)
#define SZ(a) int((a).size())
#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define INF 999999999
#define INFLONG 1000000000000000000
#define MOD 1000000007
#define MAX 100
#define ITERS 100
#define MAXM 200000
#define MAXN 1000000
#define _gcd __gcd
#define eps 1e-9

int main(){
	int n;
	scanf("%d", &n);
	
	if(n % 10 == 9 || n / 10 == 9) printf("Yes\n");
	else printf("No\n");
	
	return 0;
}

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

int main()
{
    ll a,b;
    cin >> a >> b;
    ll left = 0,right = 0;
    if(a&1)
    {left = a;
     a++;
    }
    if((b&1)==false)
    {
        right = b;
        b--;
    }
    ll tot = (b-a+1)/2;
    //cout << left << " "<< right << " ";
    ll ans = 0;
    if(tot%2==0)
    {
        ans^=left;
        ans^=right;
    }
    else
    {
        ans^=left;
        ans^= 1;
        ans^=right;
    }
    
    cout << ans;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main {
    static class Scan {
        private byte[] buf=new byte[1024];
        private int index;
        private InputStream in;
        private int total;
        public Scan()
        {
            in=System.in;
        }
        public int scan()throws IOException
        {
            if(total<0)
            throw new InputMismatchException();
            if(index>=total)
            {
                index=0;
                total=in.read(buf);
                if(total<=0)
                return -1;
            }
            return buf[index++];
        }
        public int scanInt()throws IOException
        {
            int integer=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    integer*=10;
                    integer+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }
        public double scanDouble()throws IOException
        {
            double doub=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n)&&n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    doub*=10;
                    doub+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                double temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }
        public String scanString()throws IOException
        {
            StringBuilder sb=new StringBuilder();
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            while(!isWhiteSpace(n))
            {
                sb.append((char)n);
                n=scan();
            }
            return sb.toString();
        }
        private boolean isWhiteSpace(int n)
        {
            if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
            return true;
            return false;
        }
    }
    public static void main(String args[]) throws IOException {
        Scan input=new Scan();
        int n=input.scanInt();
        n%=1000;
        if(n==0) {
            System.out.println(0);
        }
        else {
            System.out.println(1000-n);
        }
    }
}


Measured memory_bytes: 32328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int N, A, B;
bool f[100000];
ll x[100000], y[100000], d, c[100000], res;
map<int, set<pair<ll, int>>>Hs, Ws;
map<int, vector<ll>>Hv, Wv;


int main() {
	cin >> N >> A >> B;
	A--;
	B--;
	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		x[i] = a + b;
		y[i] = a - b;
		Hv[x[i]].push_back(y[i]);
		Wv[y[i]].push_back(x[i]);
		Hs[x[i]].insert({ y[i],i });
		Ws[y[i]].insert({ x[i],i });
	}
	d = max(abs(x[A] - x[B]), abs(y[A] - y[B]));
	for (auto &a : Hv) {
		sort(a.second.begin(), a.second.end());
	}
	for (auto &a : Wv) {
		sort(a.second.begin(), a.second.end());
	}
	for (int i = 0; i < N; i++) {
		{
			auto it = Hv.find(x[i] - d);
			if (it != Hv.end()) {
				c[i] += upper_bound(it->second.begin(), it->second.end(), y[i] + d) - upper_bound(it->second.begin(), it->second.end(), y[i] - d);
			}
		}
		{
			auto it = Wv.find(y[i] + d);
			if (it != Wv.end()) {
				c[i] += upper_bound(it->second.begin(), it->second.end(), x[i] + d) - upper_bound(it->second.begin(), it->second.end(), x[i] - d);
			}
		}
		{
			auto it = Hv.find(x[i] + d);
			if (it != Hv.end()) {
				c[i] += lower_bound(it->second.begin(), it->second.end(), y[i] + d) - lower_bound(it->second.begin(), it->second.end(), y[i] - d);
			}
		}
		{
			auto it = Wv.find(y[i] - d);
			if (it != Wv.end()) {
				c[i] += lower_bound(it->second.begin(), it->second.end(), x[i] + d) - lower_bound(it->second.begin(), it->second.end(), x[i] - d);
			}
		}
	}
	queue<int>q;
	q.push(A);
	while (!q.empty()) {
		int i = q.front();
		q.pop();
		if (f[i])continue;
		f[i] = true;
		res += c[i];
		{
			auto it = Hs.find(x[i] - d);
			if (it != Hs.end()) {
				auto it2 = it->second.lower_bound({ y[i] - d,-1 });
				while (it2 != it->second.end() && it2->first <= y[i] + d) {
					int t = it2->second;
					q.push(t);
					it2++;
					Hs[x[t]].erase({ y[t],t });
					Ws[y[t]].erase({ x[t],t });
				}
			}
		}
		{
			auto it = Hs.find(x[i] + d);
			if (it != Hs.end()) {
				auto it2 = it->second.lower_bound({ y[i] - d,-1 });
				while (it2 != it->second.end() && it2->first <= y[i] + d) {
					int t = it2->second;
					q.push(t);
					it2++;
					Hs[x[t]].erase({ y[t],t });
					Ws[y[t]].erase({ x[t],t });
				}
			}
		}
		{
			auto it = Ws.find(y[i] - d);
			if (it != Ws.end()) {
				auto it2 = it->second.lower_bound({ x[i] - d,-1 });
				while (it2 != it->second.end() && it2->first <= x[i] + d) {
					int t = it2->second;
					q.push(t);
					it2++;
					Hs[x[t]].erase({ y[t],t });
					Ws[y[t]].erase({ x[t],t });
				}
			}
		}
		{
			auto it = Ws.find(y[i] + d);
			if (it != Ws.end()) {
				auto it2 = it->second.lower_bound({ x[i] - d,-1 });
				while (it2 != it->second.end() && it2->first <= x[i] + d) {
					int t = it2->second;
					q.push(t);
					it2++;
					Hs[x[t]].erase({ y[t],t });
					Ws[y[t]].erase({ x[t],t });
				}
			}
		}
	}
	cout << res / 2 << endl;
}

Measured memory_bytes: 51328
#include <bits/stdc++.h>
using namespace std;
#pragma region
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << (#x) << "] = [", _print(x)
#else
#define debug(x...)
#endif
#pragma endregion
typedef long long ll;
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(v) int((v).size())
#define int ll
#pragma region
#define f first
#define s second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#pragma endregion

int n, m;
int can[1000];
int r[1000];
int cst[1000];
int dp[4100];
int f(int bit)
{
    if (dp[bit]!= -1) return dp[bit];
    int& ret = dp[bit];
    ret = 1e9;
    forn(i, m)
    {
        int rem = (bit & r[i]);
        if (rem == bit) continue;
        ret = min(ret, f(rem) + cst[i]);
    }
    return ret;
}
void solve()
{
    memset(dp, -1, sizeof dp);
    dp[0] = 0;

    cin>>n>>m;
    forn(i, m)
    {
        int b; cin>>cst[i]>>b;
        forn(_, b)
        {
            int c; cin>>c;
            --c;
            can[i] |= (1<<c);
        }
    }
    forn(i, m)
    {
        forn(j, n) r[i] |=  (!( (can[i]>>j) & 1 ))<<j ;
    }
    int now = 0;
    forn(i, n) now |= (1<<i);
    int ans = f(now);
    if (ans >= 1e9) cout << "-1\n";
    else cout << ans << '\n';
}


signed main()
{
    int T = 1;
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << fixed << setprecision(22);
    // cin >> T;
    for(int i=1;i<=T;++i)
    {
        //cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

int a,b;
cin >> a >> b;
if( (a * b) % 2 == 1 ) cout << "Yes" << endl;
else cout << "No" << endl;

return 0;
}

Measured memory_bytes: 256
/*

*/


#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    int N;
    cin >> N;
    long A[N];
    for (int i=0; i<N; ++i) cin >> A[i];
    
    int odds = 0;
    for (int i=0; i<N; ++i){
    	if (A[i]%2==1) ++odds;
    }

	if (odds%2==0) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 1024
A = int(input())
B = list(map(int, input().split()))  

dai=[0 for _ in range(A)]

for i, l in enumerate(B):
  if i==0:
    continue
  if B[i-1]-B[i]>0:
    dai[i]=B[i-1]-B[i]
    B[i]+=B[i-1]-B[i]

print(sum(dai))
  

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  bool b = false;
  if (s[0] != 'A') {
    cout << "WA\n";
    return 0;
  }
  for (int i = 1; i < s.length(); i++) {
    if (s[i] <= 90) {
      if (!b && s[i] == 'C' && i != 1 && i != s.length() - 1) {
        b = true;
      } else {
        cout << "WA\n";
        return 0;
      }
    }
  }
  cout << (b ? "AC\n" : "WA\n");
  return 0;
}


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

vector<ll> enum_div(ll n)
{
  vector<ll> ret;
  for (ll i = 1; i * i <= n; ++i)
  {
    if (n % i == 0)
    {
      ret.push_back(i);
      if (i * i != n)
      {
        ret.push_back(n / i);
      }
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}

//実行部
void Main()
{
  ll ans = 0;
  str s; cin >> s;
  for(ll i = 0;i < s.size();i++)
  {
    if(s[i] == '+') ans++;
    else ans--;
  }
  fin(ans)
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
sx,sy,tx,ty=gets.split.map(&:to_i)
dx,dy=tx-sx,ty-sy
Udy,Ddy,Ldx,Rdx="U"*dy,"D"*dy,"L"*dx,"R"*dx
puts ("LU"+Udy+Rdx+"RD")+(Ldx+Ddy)+("DR"+Rdx+Udy+"UL")+(Ddy+Ldx)

Measured memory_bytes: 1788
#include <iostream>
#define ll long long
using namespace std;

ll arr[100005];
int main() {
  int n;
  cin >> n;

  int odd = 0;
  for (int i = 1; i <= n; i++){
    cin >> arr[i];
    ll f = arr[i];
    if (f%2 == 1){
      odd++;
    }
  }

  if (odd%2 == 1){
    cout << "NO" << endl;
  }
  else{
    cout << "YES" << endl;
  }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SORT(i) sort((i).begin(),(i).end())
constexpr int INF = 2000000000;
constexpr int mod = 1000000007;

int main() {
	char a, b; cin >> a >> b;
	if (a == 'H') cout << b << "\n";
	else {
		if (b == 'H')cout << 'D' << "\n";
		else cout << 'H' << "\n";
	}

	return 0;
}

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

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

int main() {
    int N;
    cin >> N;
    map<string,int> count;
    for(int i = 0; i < N; i++){
        ll A;
        cin >> A;
        if(A % 2 != 0) count["odd"]++;
    }
    if(count["odd"] % 2 == 0) puts("YES");
    else puts("NO");
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main{
  public static void main(String[] args) throws IOException{
    //Scanner sc = new Scanner(System.in);
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s = br.readLine();
    char[] arr = s.toCharArray();
    int[] vec = new int[2019];
    int[] temp;
    vec[arr[0]-'0']=1;
    int count =0;
    //System.out.println("anuj"+vec[1]);
    for(int i=1;i<s.length();i++){
      temp = new int[2019];
      for(int j=0;j<2019;j++){
        if(vec[j]>0){
          //System.out.println("j "+j);
          int num = (j*10+arr[i]-'0')%2019;
          //System.out.println(num);
          temp[num]=vec[j];
        }
      }
      temp[arr[i]-'0']++;
      vec=temp;
      count+=vec[0];
    }
    System.out.println(count);
  }
}

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

int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>> table(H,vector<char>(W));
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> table.at(i).at(j);
    }
  }
//1.
  int Hc=0;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(Hc==0){
        if(table.at(i).at(j)=='#'){
          break;}
        if(j==W-1){
          Hc++;
        }
      }
      else{
        if(table.at(i).at(j)=='#'){
          for(int j=0; j<W; j++){
            table.at(i-Hc).at(j)=table.at(i).at(j);
            table.at(i).at(j)='.';
          }
          break;
        }
        else if(j==W-1){
          Hc++;
        }
      }
    }
  }
  //2.列整理
  int Wc=0;
  for(int i=0; i<W; i++){
    for(int j=0; j<H-Hc; j++){
      if(Wc==0){
        if(table.at(j).at(i)=='#'){
          break;}
        if(j==H-1-Hc){
          Wc++;
        }
      }
      else{
        if(table.at(j).at(i)=='#'){
          for(int j=0; j<H-Hc; j++){
            table.at(j).at(i-Wc)=table.at(j).at(i);
            table.at(j).at(i)='.';
          }
          break;
        }
        else if(j==H-1-Hc){
          Wc++;
        }
      }
    }
  }
//出力
  for(int i=0; i<H-Hc; i++){
    for(int j=0; j<W-Wc; j++){
        cout << table.at(i).at(j);
        if(j==W-1-Wc){
          cout << endl;
        }
    }
  }
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int ans = Math.abs(Math.max(Math.max(a,b),c)-Math.min(Math.min(a,b),c));

        System.out.println(ans);
    }
}

Measured memory_bytes: 23124
Scanf.scanf "%d" (fun n ->
    let ab = Array.init n (fun _ -> Scanf.scanf " %d %d" (fun a b -> a, b)) in

    let rec loop i sum minb =
        if i = n then (if minb = max_int then 0 else sum - minb) else
            let a, b = ab.(i) in
            loop (i + 1) (sum + a) (if a > b then min b minb else minb)
    in
    loop 0 0 max_int |> Printf.printf "%d\n"
)

Measured memory_bytes: 5504
//============================================================================
// Name        : template.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
#include <string.h> // for memset in CF judge.
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers

int main() {
    int N;
    cin >> N;
    ll sum = 0;
    for(int i = 1; i<= N; i++) {
        for(int j = 1; j<= N; j++) {
            for(int k = 1; k <= N; k++) {
                  ll ans = __algo_gcd(__algo_gcd(j, k), __algo_gcd(j,i));
                  sum += ans;
            }
        }
    }
    cout << sum;
return 0;
}


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

vector<vector<bool>> a(3,vector<bool>(3,false));

bool check(vector<vector<bool>>){
    for(int i=0;i<3;i++)
        if(a[i][0]+a[i][1]+a[i][2] == 3) return true;

    for(int j=0;j<3;j++)
        if(a[0][j]+a[1][j]+a[2][j] == 3) return true;

    if(a[0][0]+a[1][1]+a[2][2] == 3  || a[0][2]+a[1][1]+a[2][0] == 3) return true;

    return false;
}

int main(){
    vector<vector<int>> A(3,vector<int>(3));
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)
            cin >> A[i][j];

    int N;
    cin >> N;
    int b;
    for(int i=0;i<N;i++){
        cin >> b;
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(A[j][k] == b){
                    a[j][k] = true;
                }
            }
        }
    }

    if(check(a)) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <cctype>
#include <cstdlib>
#include <typeinfo>

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

using namespace std;

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

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

using ll = long long;
using P = pair<int, int>;

const unsigned long long INF = 1LL << 60;

////////////////////////////////////////////////////////////

string S;

int main() {
    while (true) {
        cin >> S;
        if (S == "0") break;

        int sum = 0;
        for (int i = 0; i < S.length(); ++i) {
            sum += (int) (S[i] - '0');
        }
        cout << sum << endl;
    }
}



Measured memory_bytes: 3180
#include <cassert>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;


template<typename T>
struct BIT {
  vector<T> data;
  BIT() {}
  BIT(int n) : data(n+1, 0) {}
  void init(int n) { data.assign(n+1, 0); }
  T sum(int ed) const {
    for(T res(0); ; ed &= ed-1) if(ed) res += data[ed]; else return res;
  }
  T total(void) const { return sum(data.size()-1); }
  void add(int i, const T& x) {
    for(++i; i < (int)data.size(); i += i&-i) data[i] += x;
  }
};

int n, k;
vector<int> vs;
int main(void) {
  scanf("%d%d", &n, &k);
  REP(i, n) {
    int v;
    scanf("%d", &v);
    vs.push_back(v);
  }
  REP(i, k) {
    // cerr << "> " << i << " " << vs[i] << endl;
    BIT<int> bit(n);
    REP(i, n) {
      int lb = max(i-vs[i], 0);
      int ub = min(i + vs[i], n-1) + 1;
      bit.add(lb, 1);
      bit.add(ub, -1);
    }
    bool allN = true;
    REP(i, n) {
      vs[i] = bit.sum(i+1);
      if(vs[i] != n) {
        allN = false;
      }
    }
    if(allN) {
      break;
    }
  }
  REP(i, n) {
    printf("%d%c", vs[i], i == n-1 ? '\n' : ' ');
  }
  
  return 0;
}


Measured memory_bytes: 4468
N=int(input())
X=[int(i) for i in input().split()]

minP=float('inf')

for p in range(min(X),max(X)+1):
    P=0
    for x in X:
        P+=(x-p)**2
        if minP<P:
            break
    if P<minP:
        minP=P

print(minP)


Measured memory_bytes: 9184
n, q = map(int, input().split())
s = input()
lr = [0] * q

def inp(l: list) -> list:
    return [int(l[0]) - 1, int(l[1]) - 1]

for i in range(q):
    lr[i] = tuple(inp(input().split()))

count = [0]*n
for i in range(1, n):
    if s[i-1] == 'A' and s[i] == 'C':
        count[i] = count[i-1] + 1
    else:
        count[i] = count[i-1]

# print(count)

for l, r in lr:
    print(count[r] - count[l])


Measured memory_bytes: 19724
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
    int n, t, answer = 0;
    cin >> n;
    vector<int> a;
    while(n--){
        cin >> t;
        a.push_back(t);
    }
    sort(a.rbegin(), a.rend());
    for(int i=0; i < a.size(); i++){
        if(i%2 == 0)
            answer += a[i];
        else
            answer -= a[i];
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        a:i64,
    }
    println!("{}", 3 * a * a);
}


Measured memory_bytes: 2152
import sys

s = int(input())
#print(s)

N=1000
d=[0]*N


for i in range(N):
  d[i]=i**5
  
for i in range(N):
  for j in range(i,N):
    if (d[i] + d[j] == s) :
      print(i,-j)
      sys.exit
    elif (d[i] - d[j] == s):
      print(i,j)
      sys.exit
    elif (d[j] + d[i] == s):
      print(j,-i)
      sys.exit
    elif (d[j] - d[i] == s):
      print(j,i)
      sys.exit

Measured memory_bytes: 65404
#include <iostream>
#include <algorithm>

int main(void) {
  std::string s, t;
  std::cin >> s;
  std::cin >> t;

  std::sort(s.begin(), s.end());
  std::sort(t.rbegin(), t.rend());

  if (s < t) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }

  return 0;
}

Measured memory_bytes: 256
import bisect

while True:
    n, m = map(int, input().split())
    if n == 0:
        break
    a = sorted(map(int, input().split()))
    index = bisect.bisect_left(a, m) - 1
    if index <= 0:
        print("NONE")
        continue
    ans = 0
    for i in range(index, 0, -1):
        for j in range(i-1, -1, -1):
            if a[i] + a[j] <= m:
                ans = max(ans, a[i] + a[j])
    if ans:
        print(ans)
    else:
        print("NONE")



Measured memory_bytes: 5664
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void){
  char s[10];
  char year[4];
  int y;
  
  scanf("%s", s);
  if(strcmp(&s, "2019/04/30") <= 0){
    printf("Heisei");
  }else{
    printf("TBD");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    if(a>b)
    { for(int i=0;i<a;i++)
        cout<<b;
    }
    else
    { for(int i=0;i<b;i++)
        cout<<a;
    }

    return 0;
}


Measured memory_bytes: 256
S = input()

def getHi(S):
    if len(S) % 2 == 1:
        return "No"
    for i in range(len(S)-1):
        if i % 2 == 0:
            if S[i] + S[i+1] != "hi":
                return"No"
        else:
            if S[i] + S[i+1] != "ih":
                return"No"
    return "Yes"

print(getHi(S))

Measured memory_bytes: 38256
include Math
define_method :max, -> (a,b) { a > b ? a : b }
define_method :min, -> (a,b) { a < b ?  a : b }
define_method :swap, -> (a,b) { a, b = b, a }
define_method :rep, -> (num, &block) { num.times do |i| block.call(i) end }
define_method :repl, -> (st,en, &block) { st.upto en-1 do |i| block.call(i) end }
define_method :array, -> (size,init = nil) { Array.new(size){init} }
define_method :darray, -> (size1, size2, init = nil) { Array.new(size1){Array.new(size2){init}} }
define_method :gi, -> () { gets.split.map(&:to_i) }
define_method :gs, -> () { gets.chomp }
define_method :putall, -> (obj) { obj.each do |o| puts o end }
define_method :fi, ->() {first}


str = gs.split("")
st = nil
en = nil
rep str.size do |i|
	if st == nil && str[i] == "A"
		st = i
	elsif str[i] == "Z"
		en = i
	end
end

puts en - st + 1

Measured memory_bytes: 16764
#include <iostream>

using namespace std;

int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	int d[3] = {a,b,c};
	
	for (int i = 0; i < 2; i++)
	{
		for (int j = i + 1; j < 3; j++)
		{
			if (d[i] > d[j])
			{
				int temp = d[i];
				d[i ] =  d[j];
				d[j] = temp;
			}
		}
	}
	cout<<d[0]<<" " << d[1] << " " << d[2 ] <<endl;
	return 0;
}

Measured memory_bytes: 3064
def resolve():
    '''
    code here
    '''
    import math
    N, K = [int(item) for item in input().split()]

    res = 0

    for i in range(1,N+1):
        for n in range(int(math.log2(K))+3):
            if i * 2 ** n >= K:
                res += 1/N * 2 ** (-1 * n)
                break

        # print(i, n, res)
    print(res)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3316
/**
*   @Author : MeGaCrazy
*   @InitTime : Thu Jul 18 03:14:33 2019
*   @Idea :
*
*
*
*
*
*  Happy Solving :)
**/
#include <bits/stdc++.h>
using namespace std;
int main(){
#ifndef ONLINE_JUDGE
   //freopen("in","r",stdin);
   //freopen("out","w",stdout);
#endif
     int n,k;
     cin>>n>>k;
     for(int i=0;i<n;i++){
     	int a;
     	cin>>a;
     }
     int sol=1;
     n-=k;
     k-=1;
     sol+=(n+k-1)/k;
     cout<<sol<<endl;




}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	var a, z int
	var A bool
	for i := 0; i < len(s); i++ {
		if s[i] == 'A' && !A {
			a = i
			A = true
		}
		if s[i] == 'Z' {
			z = i
		}

	}
	fmt.Println(z - a + 1)

}

Measured memory_bytes: 3188
#!/usr/bin/env python3
# -*- coding: utf-8 -*-



def main():
    S = input()
    Y, M, D = map(int, S.split("/"))

    heisei = False
    if Y < 2019:
        heisei = True
    elif Y == 2019 and M < 5:
        heisei = True

    print("Heisei" if heisei else "TBD")

if __name__ == "__main__": main()


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

S = []


def push(x):
    S.append(x)


def pop():
    return S.pop()


if __name__ == '__main__':
    for c in raw_input().split():
        if c == '+':
            push(pop() + pop())
        elif c == '-':
            b = pop()
            a = pop()
            push(a - b)
        elif c == '*':
            push(pop() * pop())
        else:
            push(int(c))
    print pop()


Measured memory_bytes: 4652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int t;
bool ok[32][32];
string f[4];
int dp[(1<<16)];
int dfs(int mask){
	if(dp[mask] < 1e8) return dp[mask];
	if(mask == (1<<16)-1) return 0;
	for(int i=-3;i<4;i++){
		for(int ii=i;ii<7;ii++){
			for(int j=-3;j<4;j++){
				for(int jj=j;jj<7;jj++){
					if(!ok[ii-i+1][jj-j+1]) continue;
					int check = 0;
					int go = 0;
					for(int a=i;a<=ii;a++) for(int b=j;b<=jj;b++){
					    if(0<=a&&a<4&&0<=b&&b<4);else continue;
						int c = a*4+b;
						if(((mask>>c) & 1) == 0){
							if(f[a][b] == 'R') check|=1,go+=(1<<c);
							if(f[a][b] == 'G') check|=2,go+=(1<<c);
							if(f[a][b] == 'B') check|=4,go+=(1<<c);
						}
					}
					if(__builtin_popcount(check) == 1) dp[mask] = min(dp[mask],dfs(mask+go)+1);
				}
			}
		}
	}
	return dp[mask];
}
int main(){
	cin>>t;
	rep(i,t){
		int a,b; cin>>a>>b;
		ok[a][b] = 1;
	}
	rep(i,4) cin>>f[i];
	fill(dp,dp+(1<<16),INF);
	cout << dfs(0) << endl;
}


Measured memory_bytes: 3468
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;

vector<string> split(const string& s, char c) {
    vector<string> v; stringstream ss(s); string x;
    while (getline(ss, x, c)) v.push_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
    stringstream s; s << "[";
    for(int i = 0; i < n - 1; i++) s << arr[i] << ",";
    s << arr[n - 1] << "]";
    return s.str();
}
#define EVARS(args...) {__evars_begin(__LINE__); __evars(split(#args, ',').begin(), args);}
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
template<typename T> inline void __evars_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
template<typename T> inline void __evars_out_var(T* val) { cerr << arrStr(val, 10); }
template<typename T> inline void __evars_out_var(T val) { cerr << val; }
inline void __evars(vector<string>::iterator it) { cerr << endl; }
template<typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
    cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
    __evars_out_var(a);
    cerr << "; ";
    __evars(++it, args...);
}
const int N = 1e6 + 5;

ll prnt[N], val[N];
ll root(ll x)
{
    if(x != prnt[x])
        return prnt[x] = root(prnt[x]);
    return x;
}
bool unify(ll x, ll y)
{
    ll px = root(prnt[x]), py = root(prnt[y]);
    if(px == py)
        return false;
    if(val[px] < val[py])
        swap(px, py);
    val[px] += val[py];
    prnt[py] = prnt[px];
    return true;
}

int main()
{
	sync;
    ll n, m;
    cin >> n >> m;
    for(ll i = 1; i <= n; i++)
    {
        prnt[i] = i;
        val[i] = 1;
    }
    while(m--)
    {
        ll x, y;
        cin >> x >> y;
        unify(x, y);
    }
    ll ans = 0;
    for(ll i = 1; i <= n; i++)
        ans =  max(ans, val[root(i)]);
    cout << ans;
}

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

using namespace std;
using p=pair<int,int>;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<ll>l(n);
  rep(i,n){
    cin >> l[i];
  }
  int c=0;
  rep(i,n){
    rep(j,n){
      rep(k,n){
        if(l[i]!=l[j]&&l[j]!=l[k]&&l[i]!=l[k]){
          if(l[i]+l[j]>l[k]&&l[k]+l[j]>l[i]&&l[i]+l[k]>l[j]){
             c++;
          }
        }
      }
    }
  }
  cout << c/6 << endl;
  return 0;

}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define INF_MAX INT_MAX
#define INF_MIN ((int)1<<31)-1
using namespace std;
class Segtree{
    vector<int> tree;
    int n=1,m,Inf;
    void Set(vector<int> vec){
        rep(i,n*2-2)tree[i+1]=Inf;
        rep(i,vec.size())tree[i+n]=vec.at(i);
        update(0,n-1);
    }
    int sum(int a,int b){
        if(m==0)return max(a,b);
        else if(m==1)return min(a,b);
        else if(m==2)return a+b;
        else return a*b;
    }
    int query(int a,int b,int x,int l,int r){
        if(r<a||b<l)return Inf;
        if(a<=l&&b>=r)return tree[x];
        return sum(query(a,b,x*2,l,(l+r)/2),query(a,b,x*2+1,(l+r)/2+1,r));
    }
    void update(int l,int r){
        l+=n,r+=n;
        l/=2,r/=2;
        while(1){
            if(l==0)break;
            int xl=l;
            for(;xl<=r;xl+=2){
                tree[xl]=sum(tree[xl*2],tree[xl*2+1]);
            }
            l/=2,r/=2;
        }
    }
public:
    void Max(vector<int> vec){
        m=0;
        Inf=INF_MAX;
        Set(vec);
    }
    void Min(vector<int> vec){
        m=1;
        Inf=INF_MIN;
        Set(vec);
    }
    void Add(vector<int> vec){
        m=2;
        Inf=0;
        Set(vec);
    }
    void Multiply(vector<int> vec){
        m=3;
        Inf=1;
        Set(vec);
    }
    Segtree(int in){
        for(;in>n;n*=2);
        tree.resize(n*2);
    }
    void Set(int a,int b){
        tree[a+n]=b;
        update(a,a);
    }
    int query(int a,int b){
        return query(a,b,1,0,n-1);
    }
};
class Union_Find{
private:
    vector<int> t,s;
public:
    Union_Find(int max_length){
        rep(i,max_length+1){
            t.push_back(i);
            s.push_back(1);
        }
    }
    void Union(int x,int y){
        if(same(x,y))return;
        int tx=Find(x),ty=Find(y);
        if(s[tx]<s[ty]){
            s[ty]+=s[tx];
            t[tx]=ty;
        }
        else if(s[tx]>s[ty]){
            s[tx]+=s[ty];
            t[ty]=tx;
        }
        else if(tx>ty){
            t[tx]=ty;
            s[ty]+=s[tx];
        }
        else{
            t[ty]=tx;
            s[tx]+=s[ty];
        }
    }
    int Find(int n){
        if(t[n]==n)return n;
        else return t[n]=Find(t[n]);
    }
    bool same(int x,int y){
        return Find(x)==Find(y);
    }
};
signed main(){
    int n,a[10],cnt=0;
    cin>>n;
    rep(i,n)cin>>a[i];
    sort(a,a+n);
    rep(i,n-1)cnt+=a[i];
    if(cnt>a[n-1])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

int gcd(int x,int y){
    if(y == 0){
        return x;
    }
    return gcd(y, x % y);
}

int main() {
    int N;
    cin >> N;
    int sum = 0;
    for(int a = 1; a <= N; a++){
        for(int b = 1; b <= N; b++){
            for(int c = 1; c <= N; c++){
                sum += gcd(a,gcd(b,c));
                // cout << gcd(a,gcd(b,c)) << endl;
            }
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 3636
#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 ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

#define PT pair<double, int>

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



	ll X[1002] = {}, Y[1002] = {}, R[1002] = {};
	int xt, yt;
	cin >> X[0] >> Y[0] >> xt >> yt;
	int N;
	cin >> N;
	X[N + 1] = xt;
	Y[N + 1] = yt;
	rep1(i, N) {
		cin >> X[i] >> Y[i] >> R[i];
	}

	double E[1002][1002] = {};

	rep(i, N + 2) {
		for (int j = i + 1; j < N + 2; j++) {
			double k = max(0.0, sqrt((X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j])) - R[i] - R[j]);
			E[i][j] = k;
			E[j][i] = k;
		}
	}

	double D[1002];
	rep(i, N + 2) D[i] = 1e18;
	D[0] = 0;

	priority_queue<PT, vector<PT>, greater<PT>> que;

	que.push(mp(0.0, 0));
	while (que.size()) {
		PT p = que.top();
		que.pop();
		int i = p.second;
		if (D[i] != p.first) continue;
		rep(j, N + 2) {
			double d = D[i] + E[i][j];
			if (D[j] > d) {
				D[j] = d;
				que.push(mp(d, j));
			}
		}
	}

	cout << fixed << setprecision(12) << D[N + 1];

	Would you please return 0;
}

Measured memory_bytes: 13296