akhauriyash/Code-Regression huggingface dataset:
import copy

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

ans = 0

N = 2 ** H
M = 2 ** W

for i in range(N):
  for j in range(M):
    cp = copy.deepcopy(c)
    for k in range(H):
      if (i >> k) & 1:
        for n in range(W):
          cp[k][n] = "."
    for k in range(W):
      if (j >> k) & 1:
        for n in range(H):
          cp[n][k] = "."
    cnt = 0
    for n in range(H):
      for m in range(W):
        if cp[n][m] == "#":
          cnt += 1
    if cnt == K:
      ans += 1

print(ans)

Measured memory_bytes: 71752
#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) ((int)(a).size())
#define PB(a) push_back(a)
#define EB(...) emplace_back(__VA_ARGS__)
#define MP(a, b) make_pair(a, b)
#define MT(...) make_tuple(__VA_ARGS__)
using namespace std;
using pii = pair<int, int>;
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
const int MOD = 1000000007;
const int INF = 1LL << 60;
const double EPS = 1e-10;

int N;
int a[3010];
int used[2][3010][3010];
int memo[2][3010][3010];

int dfs(int t, int L, int R) {
  if (L > R) return 0;
  if (used[t][L][R]) return memo[t][L][R];
  used[t][L][R] = 1;
  if (t == 0) return memo[t][L][R] = max(dfs(t^1,L+1,R)+a[L], dfs(t^1,L,R-1)+a[R]);
  else return memo[t][L][R] = min(dfs(t^1,L+1,R)-a[L], dfs(t^1,L,R-1)-a[R]);
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  REP(i, N) cin >> a[i];
  cout << dfs(0, 0, N-1) << endl;

  return 0;
}

Measured memory_bytes: 283136
#include <iostream>
#include <vector>
#include <algorithm>
#include <ios>
#include <iomanip>

using namespace std;
typedef long long ll;

int main()
{
    int N, K;
    cin >> N >> K;
    int maxnum;
    if (N%2 == 0){
        maxnum = N/2;
    }
    else{
        maxnum = (N+1)/2;
    }
    if ( maxnum >= K){
        cout << "YES";
    }
    else{
        cout << "NO";
    }
    // system("pause");
    return 0;
}

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

typedef long long ll;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < vl > vvl;
typedef vector < vi > vvi;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < pll > vpll;
typedef vector < pii > vpii;
typedef vector < vpll > vvpll;
typedef vector < vpii > vvpii;

#define pb push_back
#define pf push_front
#define all(c) (c).begin(), (c).end()
#define ff first
#define ss second
#define mp(x,y) make_pair((x), (y))
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)



ll solve(){
    
    ll n; cin >> n;
    map <ll, ll> m;
    if(n % 2 == 0){
        int cnt = 0;
        while(n % 2 == 0){
            cnt++;
            n /= 2;
        }
        m[2] = cnt;
    }
    for(ll i = 3; i * i <= n; i += 2){
        if(n % i == 0){
            int cnt = 0;
            while(n % i == 0){
                cnt++;
                n /= i;
            }
            m[i] = cnt;
        }
    }
    if(n > 2)
        m[n] = 1;
    ll sum = 0;
    for(auto u: m){
        // cout << u.second << '\n';
        ll candidate = (ll)sqrt(2 * u.second);
        if(candidate * (candidate + 1) > 2 * u.second)
            candidate--;
        sum += candidate;
        candidate++;
        if(candidate * (candidate + 1) <= 2 * u.second)
            sum++;
    }
    return sum;
}


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

Measured memory_bytes: 3660
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    B = [iss() for _ in range(N)]
    M = ii()
    R = [iss() for _ in range(M)]
    ret = 0
    for b in B:
        ret = max(ret, B.count(b) - R.count(b))

    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
<?php
    /*
        Problem URL : http://abc014.contest.atcoder.jp/tasks/abc014_3

        Score  :
        Result :
        Time   : ms
        Memory : KB
     */

    ini_set('error_reporting', E_ALL & ~E_NOTICE);

    define('DEBUG', false);

    $T = array();

    fscanf(STDIN, "%d %d %d\n", $N, $C, $K);
    for ($i = 0; $i < $N; $i++) {
        fscanf(STDIN, "%d\n", $T[]);
    }

    sort($T);

    if (DEBUG) var_dump($T);

    if (DEBUG) echo "K:{$K}\n";

    $p = 0;
    $ans = 0;
    foreach ($T as $val) {
        if ($p == 0) {
            $p1 = $val;
            $p = 1;
            $ans++;
        } else {
            if ($val <= $p1 + $K) {
                if (DEBUG) echo "{$val} <= {$p1} + {$K}\n";
                $p++;
            } else {
                $p1 = $val;
                $p = 1;
                $ans++;
            }
        }
        if (DEBUG) printf ("val:%d p1:%d p:%d ans:%d\n", $val, $p1, $p, $ans);
        if ($p >= $C) {
            $p = 0;
        }
    }

    echo $ans . PHP_EOL;

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

int main() {
  int K;
  cin >> K;
  int now = 0;
  for (int i = 1; i < 100000000; i++) {
    now = (now * 10 + 7) % K;
    if (now == 0) return cout << i << "\n", 0;
  }
  cout << -1 << "\n";
}

Measured memory_bytes: 3636
#include<cstdio>
char c[110][110];
int main()
{
    int h,w;
    scanf("%d%d",&h,&w);
    for(int i=1;i<=h;i++)
        scanf("%s",c[i]+1);
    for(int i=1;i<=2*h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            printf("%c",c[(i+1)/2][j]);
        }
        printf("\n");
    }
    return 0;
}


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

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
// #include <algorithm>
using namespace std;

#define f first
#define s second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back

#define all(v) (v).begin(), (v).end()
#define sz(v) ((int)(v).size())
#define sqr(x) ((x) * (x))

#define ADD_OPERATORS_IN(T, COMP) \
    bool operator < (const T& ot) const { return COMP(ot) == -1; } \
    bool operator > (const T& ot) const { return COMP(ot) == 1; } \
    bool operator == (const T& ot) const { return COMP(ot) == 0; } \
    bool operator != (const T& ot) const { return COMP(ot) != 0; }

#define ADD_OPERATORS_OUT(T, COMP) \
    bool operator < (const T& a, const T& b) const { return COMP(a, b) == -1; } \
    bool operator > (const T& a, const T& b) const { return COMP(a, b) == 1; } \
    bool operator == (const T& a, const T&b) const { return COMP(a, b) == 0; } \
    bool operator != (const T& a, const T&b) const { return COMP(a, b) != 0; }


typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;

mt19937_64 mt_rand(chrono::system_clock::now().time_since_epoch().count());

template<typename T1, typename T2> inline bool upmax(T1& a, T2 b) { return (a < b ? (a = b, true) : false); }
template<typename T1, typename T2> inline bool upmin(T1& a, T2 b) { return (b < a ? (a = b, true) : false); }

const int maxn = (int) 3e5 + 20;
const int maxlog = 21;
const int base = (int) 1e9 + 7;
const ld eps = (ld) 1e-7;
const ld PI = acos(-1.);
//const int pp = 41;
const int inf = 2e9;

enum state {
    OPEN,
    CLOSE
};

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

    int cnt = 0;
    vector<int> tp(2 * n);
    for (int i = 0; i < 2 * n; i++) {
        int c = s[i] == 'B';
        if ((c ^ (cnt % 2)) == 1) {
            tp[i] = OPEN;
            cnt++;
        } else {
            tp[i] = CLOSE;
            cnt--;
            if (cnt < 0) {
                cout << "0";
                return 0;
            }
        }
    }

    if (cnt != 0) {
        cout << "0";
        return 0;
    }

    int res = 1;
    for (int i = 1; i <= n; i++) {
        res = 1ll * res * i % base;
    }
    for (int i = 0; i < 2 * n; i++) {
        if (tp[i] == 0) cnt++;
        else
            res = 1ll * res * cnt % base, cnt--;
    }
    cout << res << endl;
    return 0;
}

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

int main() {
	string s, t = "";
	cin >> s;
	int n = s.size();
	for (int i = 0; i < n; i++) {
		t += s[i];
		if (t == "erase") {
			if (i + 1 < n && s[i + 1] == 'r') {
				i += 1;
			}
			t = "";
		}
		else if (t == "dream") {
			if (i + 2 < n && s[i + 1] == 'e' && s[i + 2] == 'r') {
				if (i + 3 < n && s[i + 3] == 'a') {
					t = "era";
					i += 3;
				}
				else {
					t = "";
					i += 2;
				}
			}
			else {
				t = "";
			}
		}
	}
	if (t == "") {
		cout << "YES";
	}
	else {
		cout << "NO";
	}
	return 0;
}

Measured memory_bytes: 3748
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class B
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		long[] A = GetLongs(N);

		long[] csum = new long[N + 1];
		for(int i = 0; i < N; i++)
			csum[i + 1] = csum[i] + A[i];

		long ans = long.MaxValue;
		for(int i = 0; i < N - 1; i++)
		{
			long left = csum[i + 1];
			long right = csum[N] - csum[i + 1];
			chmin(ref ans, Abs(left - right));
		}
		WriteLine(ans);
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 41168
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
#define pb      push_back
#define all(v)  v.begin(),v.end()
#define see(x)  cout<<#x<<" : "<<(x)<<endl;
#define ya      cout<<"YES"<<endl;
#define no      cout<<"NO"<<endl;
#define ff      first
#define sc      second
typedef long long ll;
typedef pair<ll,ll>  pii;

const ll B=10000000000;

int main()
{

    ll n,i,j,k,ans=0;
    cin>>n;
    vector< long double >v(n);

    map<pii,ll> cnt;

    for(i=0; i<n; i++)
    {
        cin>>v[i];
        ll ii = llround(v[i]*1e9);
        ll two = 0, five = 0;
        while(ii % 2 == 0)
        {
            two++;
            ii /= 2;
        }
        while(ii % 5 == 0)
        {
            five++;
            ii /= 5;
        }
//        see(two)
//        see(five)
        ++cnt[ {two,five}];
    }
    ans = 0;
    for(auto p1 : cnt)
    {
        for(auto p2 : cnt)
        {
            if(p1.first.first+p2.first.first >= 18 && p1.first.second+p2.first.second >= 18)
            {
                if(p1 < p2)
                {
                    ans += (ll) p1.second * p2.second;
                }
                else if(p1 == p2)
                {
                    ans += (ll) p1.second * (p1.second - 1) / 2;
                }
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}


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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int N, M;
vector< vector< int > > adj;
vector< bool > vis;

int dfs(int v) {
	vis[v] = true;
	
	int res = 0;
	
	for (int u : adj[v]) {
		if (vis[u]) ++res;
		else res += dfs(u);
	}
	
	return res;
}

int solve() {
	vis.assign(N, false);
	
	int res = 0;
	
	for_(v,0,N) {
		if (vis[v]) continue;
		res += dfs(v);
	}
	
	return res;
}

int main() {
	cin >> N >> M;
	
	adj.assign(N, vector< int >());
	
	for_(i,0,M) {
		int s, t;
		cin >> s >> t;
		--s; --t;
		adj[s].push_back(t);
	}
	
	cout << solve() << endl;
}

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

int main() {
  int K;
  cin >> K;
  vector<int64_t> numbers(9);
  iota(numbers.begin(), numbers.end(), 1);
  auto numlen = [](int64_t n) {
    return to_string(n).size();
  };
  auto dsum = [](int64_t n) {
    int64_t sum = 0;
    while (n > 0) {
      sum += n % 10;
      n /= 10;
    }
    return sum;
  };
  while ((int)numbers.size() < K) {
    int64_t last = numbers.back();
    int64_t bound = last + 1;
    int64_t cans = bound;
    for (int replace = 1; replace < numlen(bound); ++replace) {
      int64_t k = bound;
      for (int d = 0; d < replace; ++d) {
        k /= 10;
      }
      k = max(k, (int64_t)1);
      for (int d = 0; d < replace; ++d) {
        k = k * 10 + 9;
      }
      if (k * dsum(cans) < cans * dsum(k)) {
        cans = k;
      }
    }
    numbers.push_back(cans);
  }
  for (int64_t n : numbers) {
    cout << n << '\n';
  }
  return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>

typedef long long ll;
using namespace std;

int main(){
  int n;
  cin >> n;
  if(n==17||n==13||n==10||n==9||n==6||n==5||n<=3){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
  return 0;
}



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

int main(){
    int X,N;
    cin >> X >> N;
    vector<int> vec(N);
    for (int i = 0; i < N; i++) {
        cin >> vec.at(i);
    }
    int j=0;
    int target=X;
    while (true) {
        int flag=1;
        for (int i = 0; i < N; i++) {
            if (vec.at(i)==target){
               flag=0;
               break;
            }
        }
        if (flag==1){
            cout << target;
            break;
        }
        j++;
        if(j%2!=0){
            target-=j;
        }
        else{
            target+=j; 
        }
    }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

struct STX {
    ll s, t, x;
    
    bool operator<(const STX &b) const {
        if (x == b.x) return s < b.s;
        return x < b.x;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    ll n, q;
    cin >> n >> q;
    vector<STX> stx(n);
    rep(i, n) cin >> stx[i].s >> stx[i].t >> stx[i].x;
    set<pair<ll, ll>> d;
    rep(i, q) {
        ll tmp;
        cin >> tmp;
        d.emplace(tmp, i);
    }
    sort(all(stx));
    vector<ll> ans(q, -1);
    rep(i, n) {
        ll l = stx[i].s - stx[i].x;
        ll r = stx[i].t - stx[i].x;
        auto it = d.lower_bound(make_pair(l, -1));
        if (it == d.end()) continue;
        while(it != d.end()) {
            if (it->first >= r) break;
            ans[it->second] = stx[i].x;
            d.erase(it++);
        }
    }
    rep(i, q) cout << ans[i] << endl;
    return 0;
}


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

int n;
void solve(string s, string t){
	int n = 0;
	for(int i=0; i<s.size(); ++i){
		int a = 1, b = 0;
		if(s[i] == 'm') b = 1000;
		else if(s[i] == 'c') b = 100;
		else if(s[i] == 'x') b = 10;
		else if(s[i] == 'i') b = 1;
		if(0<=i-1 && '2'<=s[i-1] && s[i-1]<='9')
			a = s[i-1] - '0';
		n += a * b;
	}
	for(int i=0; i<t.size(); ++i){
		int a = 1, b = 0;
		if(t[i] == 'm') b = 1000;
		else if(t[i] == 'c') b = 100;
		else if(t[i] == 'x') b = 10;
		else if(t[i] == 'i') b = 1;
		if(0<=i-1 && '2'<=t[i-1] && t[i-1]<='9')
			a = t[i-1] - '0';
		n += a * b;
	}
	string res;
	if(n >= 1000){
		if(n / 1000 >= 2) res += '0' + n / 1000;
		res += 'm';
		n %= 1000;
	}
	if(n >= 100){
		if(n / 100 >= 2) res += '0' + n / 100;
		res += 'c';
		n %= 100;
	}
	if(n >= 10){
		if(n / 10 >= 2) res += '0' + n / 10;
		res += 'x';
		n %= 10;
	}
	if(n >= 1){
		if(n >= 2) res += '0' + n;
		res += 'i';
	}
	cout << res << "\n";
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=0; i<n; ++i){
		string s, t;
		cin >> s >> t;
		solve(s, t);
	}
}


Measured memory_bytes: 2936
# A - 9x9
# 九九の計算
# 九九以外は -1 を返す

# 整数 a b を入力
a, b = map(int, input().split())

# print(a, b)

# a b が9以下の数字か判定
if a <= 9:
    if b <= 9:
        answer = a * b
    else:
        answer = -1
else:
    answer = -1

# 結果の表示
print(answer)


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

#define ll long long
#define pb push_back
#define mp make_pair
#define modqq (ll)1e9+7
#define pll pair<long,long>

int main()
{
  ll a;
  cin>>a;
  ll sum=0;
  for(ll i=1;i<=a;i++)
  {
    for(ll j=1;j<=a;j++)
    {
      for(ll k=1;k<=a;k++)
      {
        sum+=__gcd(__gcd(i,j),k);
      }
    }
  }
  cout<<sum<<endl;
}


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

int main()
{
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  double ret = 0;
  loop(n)
  {
    double a; std::cin >> a;
    ret += 1 / a;
  }
  ret = 1 / ret;
  std::cout << ret << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    int N;
    cin >> N;
    valarray<i64> A(N);
    rep(i, N) cin >> A[i];
    int X = A.sum() - valarray<i64>(A[slice(1, N/2, 2)]).sum() * 2;
    for(auto& a : A){
        cout << X << " ";
        X = 2*a - X;
    }
}


Measured memory_bytes: 2040
def check_bingo(board)
  board.each do |l|
    stone = l.first
    return stone if l.all?{ |x| x == stone } && stone != '+'
  end

  return false
end

def choose_winner(board)
  diagonal_board = [[0,1,2].map{|x| board[x][x]}, [0,1,2].map{|x| board[x][2-x]}]
  [board, board.transpose, diagonal_board].each do |b|
    stone = check_bingo(b)
    return stone if stone
  end

  return "NA"
end

loop do
  board = [gets.chomp.chars]
  break if board[0] == ['0']
  board[1,2] = [nil, nil].map!{ gets.chomp.chars }
  
  puts choose_winner(board)
end

Measured memory_bytes: 6096
#include <iostream>
#include <vector>
#include <string>
#include <memory.h>
#include <cstring>
#include <set>
#include <algorithm>
using namespace std;

string str = "CODEFESTIVAL2016";

int main()
{
	string s;
	while(cin>>s)
	{
		int ans = 0;
		for(int i=0; i<s.size(); i++) if(s[i] != str[i]) ans++;
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string w;
  cin>>w;
  int cnt[26]={};
  for(char i='a';i<='z';i++){
    for(char j:w){
      if(j==i) cnt[i-'a']++;
    }
  }
  
  bool flag=true;
  for(int i=0;i<26;i++){
    if(cnt[i]%2!=0){
      flag=false;
      break;
    }
  }
  cout<<( flag? "Yes":"No");
}

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

namespace ConsoleApp5
{
    class Program
    {

        static void Main(string[] args)
        {
            String S = Console.ReadLine();
            String[] line = S.Split(' ');

            int a = int.Parse(line[0]);
            int b = int.Parse(line[1]);

            long ans = 0;

            if(a < b)
            {
                for(int i = 0; i < b; i++)
                {
                    Console.Write(a);
                }
            }
            else
            {
                for (int i = 0; i < a; i++)
                {
                    Console.Write(b);
                }
            }

            Console.WriteLine();
       



        }
    }
}

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

int main() {
	int n;
	while (cin >> n, n) {
		int cnt = 0;
		while (n != 1) {
			if (n & 1) {
				n = n * 3 + 1;
			}
			else {
				n /= 2;
			}
			cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#define ll long long
#define ull unsigned long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define PI acos(-1)
#define fi first
#define se second
#define lowbit(x) (x&(-x))
#define mp make_pair
#define pb push_back
#define ins insert
#define eps 1e-8
#define si size()
#define E exp(1.0)
#define fixed cout.setf(ios::fixed)
#define fixeds(x) setprecision(x)
#pragma GCC optimize(2)
using namespace std;
inline ll read(){ll s=0,w=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();return s*w;}
void put1(){ puts("Yes") ;}void put2(){ puts("No") ;}void put3(){ puts("-1"); }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a =
(a*a)%p;b >>= 1;}return ans%p;}
const ull base=2333; const ull pp=19260811; const ull ppp=999998639;

 const int maxn=2e5+10;
 map<ll,ll> m;
 ll a[maxn];
 int main()
 {
 	int n;
 	ll ans=0,ret;
 	scanf("%d",&n);
 	for(int i=1;i<=n;i++){
 		scanf("%lld",&a[i]);
 		m[a[i]]++;
	 }
	for(map<ll,ll> ::iterator it=m.begin();it!=m.end();it++){
		ll se=it->second;
		ans+=(se-1)*se/2;
	}
	for(int i=1;i<=n;i++){
		ll num=m[a[i]];
		ret=ans+(num-1)*(num-2)/2-num*(num-1)/2;
		cout<<ret<<endl;
	}
	return 0;
 }


Measured memory_bytes: 12800
#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>;

int main()
{
    ll x, n, i;
    cin >> x;
    for (i = 0; x >= 500; i++)
    {
        x = x - 500;
    }
    for (n = 0; x >= 5; n++)
    {
        x = x - 5;
    }
    cout << 1000 * i + 5 * n << endl;

    return 0;
}

Measured memory_bytes: 256
n=int(input())
arr=list(map(int,input().split()))
tt=[0]*(n+7)

total=0

for a in arr:
  tt[a]+=1

for t in tt:
  total += (t*(t-1)//2)

for i in range(n):
  n = tt[arr[i]]
  d = (n*(n-1)//2) - ((n-1)*(n-2)//2)
  print(total-d)
# x * x-1 // 2


Measured memory_bytes: 32160
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int n,y;
  cin>>n>>y;
  
  for(int i = 0; i <= n; i++)
  {
    for(int j = 0; j <= n - i; j++)
    {
      int k = n - i - j;
      if(i * 10000 + j * 5000 + k * 1000 == y) {
        cout << i << " " << j << " " << k << endl;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
  

  return 0;
}


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

int main() {
  string S;
  int x = 700;
  cin >> S;
  if (S[0] == 'o') x += 100;
  if (S[1] == 'o') x += 100;
  if (S[2] == 'o') x += 100;
  cout << x << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static int[] ans;
//	 static int mod = 998244353;
   public static void main(String[] args) {
	          
	   Scanner sc = new Scanner(System.in);
       long  N = sc.nextLong();
       long  A = sc.nextLong();
       long  B = sc.nextLong();
       long ans1=0;
       long ans2=0;
       
       ans1=A*(N/(A+B));
       ans2=B*(N/(A+B));
       if(N%(A+B)<A) {
    	   ans1=ans1+N%(A+B);
       } else {
    	   ans1=ans1+A;
    	   ans2=ans2+N%(A+B)-A;
       }
       
       
       System.out.println(ans1); 
       return;
   }

}


Measured memory_bytes: 23636
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let a = v[0];
	let b = v[1];
	let c = v[2];
	if c >= a && c <= b {
		println!("Yes");
	}else{
		println!("No");
	}
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
 
const ll mod=1000000007;
 
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
 
int test = 1;
const int N = 2e5+10;
 
long long int maxi[N];
vector<ll> size(N,1);
ll comp[N];
vector<ll> adj[N];
vector<int> vis(N);
 
void solve(){
 	ll 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++){
 				sum += gcd(i,gcd(j,k));
 			}
 		}
 	}
 	cout << sum << endl;
}
 
 
int main() {
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt","r",stdin);
	// 	freopen("output.txt","w",stdout);
 
	// #endif
	// int t;cin >> t;while(t--)
	solve();
	
	}

Measured memory_bytes: 10244
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	map<int, int> mp;
	rep(i,n) mp[a[i]]++;

	vector<int> v(1000001);
	ll ans = 0;
	for (auto p: mp) {
		int x = p.first;
		if (p.second > 1) v[x] = 1;
		for (int j = 2 * x; j <= 1000000; j += x) {
			v[j]++;
		}
		if (v[x] == 0) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 17228
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define NUM 5

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int L, ans = INF;
	vector<int> A, dp[NUM];
	
	cin>>L;
	
	A.resize(L+10);
	
	for(int i = 0; i < NUM; i++){
		dp[i].resize(L+10);
	}
	
	for(int i = 0; i < L; i++){
		cin>>A[i];
		for(int j = 0; j < NUM; j++){
			dp[j][i] = dp[j][i+1] = INF;
		}
	}
	
	dp[0][0] = 0;
	
	for(int i = 0; i < L; i++){
		dp[0][i+1] = dp[0][i] + A[i];
		dp[1][i+1] = min(dp[0][i],dp[1][i]) + (A[i]?A[i]%2:2);
		dp[2][i+1] = min(dp[0][i],min(dp[1][i],dp[2][i])) + (A[i]+1)%2;
		dp[3][i+1] = min(min(dp[0][i],dp[1][i]),min(dp[2][i],dp[3][i])) + (A[i]?A[i]%2:2);
		dp[4][i+1] = min(dp[0][i],min(min(dp[1][i],dp[2][i]),min(dp[3][i],dp[4][i])))+ A[i];
	}
	
	for(int i = 0; i < NUM; i++){
		ans = min(ans, dp[i][L]);
	}
	
	cout<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 9600
#include <iostream>

using namespace std;

int main(void) {
  int x, y;
  while(cin >> x >> y && (x != 0 || y != 0)) {
    if(x > y) {
      int t = x;
      x = y;
      y = t;
    }
    cout << x << " " << y << endl;
  }
  return 0;
}

Measured memory_bytes: 2980
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main() {
  int n,W,w[110],v[110];cin>>n>>W;rep(i,n)cin>>w[i]>>v[i];int dp[110][110000];
  repd(i,w[0],W+1)dp[0][i] = v[0];
  repd(i,1,n){
    rep(j,W+1)dp[i][j] = (j-w[i]>=0 ?max(dp[i-1][j], v[i] + dp[i-1][j-w[i]]):dp[i-1][j]);
  }
  int ans = 0;
  rep(i,W+1)ans = max(ans, dp[n-1][i]);
  cout << ans << endl;
}

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


int main() {
    ll a; double b;
    cin >> a >> b;

    ll bb = b*100+0.5;
    ll ans = a*bb/100;
    cout << ans << endl;
}


Measured memory_bytes: 3700
//	@Author : Gaurang_Kothiya

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>
 
using namespace std;
using namespace __gnu_pbds;  

#define data_set(type) tree<type,null_type,less<type>,rb_tree_tag,tree_order_statistics_node_update>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define ld long double
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(int i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define ook(num) order_of_key(num)
#define fbo(num) find_by_order(num)
#define gcd(a,b) __gcd(a,b)
#define bits(n) __builtin_popcountll(n)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define RE rend()
#define RB rbegin()
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846

const int inf= 1e9 +1;
const int inf64= 1e18 -1;
const int MOD= 1e9 +7;
const int MOD2= 998244353;

const int N= 2e5 +7;
s(int) g[N];
int n,m;
m(int,bool) vis;
int res=0;

void dfs(int node)
{
	vis[node]=true;
	res++;
	fe(x,g[node])
	{
		if(!vis[x]) dfs(x);
	}
}

void Solve()
{
	cin>>n>>m;
	f(i,1,m)
	{
		int x,y;
		cin>>x>>y;
		g[x].insert(y);
		g[y].insert(x);
	}
	int ans=0;
	f(i,1,n)
	{
		if(!vis[i])
		{
			res=0;
			dfs(i);
			ans=max(ans,res);
		}
	}
	cout<<ans;
}
 
signed main() 
{
	//speed		

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);	

	int q=1;
	//cin>>q;
	
	while(q--)
	Solve();
		
	return 0;
} 

Measured memory_bytes: 62780
import java.util.*;
import java.io.*;

public class Main {
	
	static boolean[] isPrime;
	static int[] numDiv;
	public static void sieve(int n) {
		isPrime = new boolean[n + 1];
		numDiv = new int[n + 1];
		Arrays.fill(isPrime, true);
		isPrime[0] = isPrime[1] = false;
		Arrays.fill(numDiv, 1);
		numDiv[0] = 0;
		
		for(int i = 2; i <= n; i++)
			if(isPrime[i]) {
				for(int j = 2 * i; j <= n; j += i) {
					isPrime[j] = false;
					int k = j;
					int cnt = 0;
					while(k % i == 0) {
						k /= i;
						cnt++;
					}
					numDiv[j] *= cnt + 1;
				}
				numDiv[i] = 2;
			}
	}
	
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		sieve(n);
		long cnt = 0;
		for(int i = 0; i < n; i++)
			cnt += numDiv[i];
		
		pw.println(cnt);
		pw.flush();
	}

	public static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();
			return array;
		}

		public Integer[] nextIntegerArray(int n) throws IOException {
			Integer[] array = new Integer[n];
			for (int i = 0; i < n; i++)
				array[i] = new Integer(nextInt());
			return array;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();
			return array;
		}

		public double[] nextDoubleArray(int n) throws IOException {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();
			return array;
		}

		public static int[] shuffle(int[] a) {
			int n = a.length;
			Random rand = new Random();
			for (int i = 0; i < n; i++) {
				int tmpIdx = rand.nextInt(n);
				int tmp = a[i];
				a[i] = a[tmpIdx];
				a[tmpIdx] = tmp;
			}
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
const ll MOD = 1e9 + 7;
const int maxn = 1e6 + 10;

int cnt(int index, const vi& nums, const vector<vi>& D, int n) {
    int ret = 0;
    for (int i = 1; i <= n; ++i) {
        if (i == index) continue;
        ret += nums[i] * D[i][index];
    }
    return ret;
}

int main() {
    int n, c;
    cin >> n >> c;
    vector<vi> D(c + 1, vi(c + 1));
    vector<vi> colors(n + 1, vi(n + 1));
    vector<vi> nums(3, vi(c + 1, 0));
    for (int i = 1; i <= c; ++i) {
        for (int j = 1; j <= c; ++j) {
            cin >> D[i][j];
        }
    }
    int index = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            cin >> colors[i][j];
            index = (i + j) % 3;
            nums[index][colors[i][j]]++;
        }
    }
    ll ans = 1e9;
    ll cur1 = 0;
    ll cur2 = 0;
    ll cur3 = 0;
    for (int i = 1; i <= c; ++i) {
        cur1 = cnt(i, nums[0], D, c);
        for (int j = 1; j <= c; ++j) {
            if (j == i) continue;
            cur2 = cnt(j, nums[1], D, c);
            for (int k = 1; k <= c; ++k) {
                if (k == i || k == j) continue;
                cur3 = cnt(k, nums[2], D, c);
                ans = min(cur1 + cur2 + cur3, ans);
            }
        }
    }
    if (ans == 1e9) cout << 0 << endl;
    else cout << ans << endl;
    return 0;
}

static int speedUp = []() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define rep(i,e) for(int i= 0; i< (int)(e); i++)
#define reps(i,s,e) for(int i = s; i < (int)(e); i++)
#define repr(i,s,e) for(int i = s; i > (int)(e); i--)
# define pb push_back
typedef long long ll;
const ll INF = 1LL << 60;

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


int main(){
    string s;
    cin >> s;
    int l = s.size();
    int ans = 0;
    vector<vector<int>> dp(3,vector<int>(l+5));
    dp[0][0] = 1;
    dp[1][1] = 1;
    dp[2][2] = 1;
    rep(j,l-1){
        if(s[j] != s[j+1]){
            chmax(dp[0][j+1],dp[0][j]+1);
        }
        chmax(dp[1][j+2],dp[0][j]+1);
        chmax(dp[2][j+3],dp[0][j]+1);
        if(j>=1){
            chmax(dp[0][j+1],dp[1][j]+1);
            if(!(s[j]==s[j+2] && s[j-1]==s[j+1])){
                chmax(dp[1][j+2],dp[1][j]+1);
            }
            chmax(dp[2][j+3],dp[1][j]+1);
        }
        if(j>=2){
            chmax(dp[0][j+1],dp[2][j]+1);
            chmax(dp[1][j+2],dp[2][j]+1);
            if(!(s[j]==s[j+3] && s[j-1]==s[j+2] && s[j-2]==s[j+1])){
                chmax(dp[2][j+3],dp[2][j]+1);
            }
        }
        ans = dp[0][l-1];
        if(ans < dp[1][l-1]){
            ans = dp[1][l-1];
        }
        if(ans < dp[2][l-1]){
            ans = dp[2][l-1];
        }
    }
    cout << ans;
}

Measured memory_bytes: 3716
#include <stdio.h>
#include <string.h>
 
int main(void){
    long long n,a[1000000],count[1000000],sum=0;
    scanf("%lld",&n);
    for(long long i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        count[a[i]]++;
    }
    for (long long j=1;j<=n;j++){
        sum += count[j] * (count[j] - 1) / 2;
    }
    for (long long k=1;k<=n;k++){
        printf("%lld\n",sum-count[a[k]]+1);
    }
    
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
ll a,b;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>a>>b;
    if(a*b<=0) cout <<"Zero"<<"\n";
    else{
        if(a<0) cout <<((b-a)%2?"Positive":"Negative")<<"\n";
        else cout <<"Positive"<<"\n";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

template <typename T> inline void voutput(T &v){
    rep(i, v.size()){
        if (i) cout << " " << v[i];
        else cout << v[i];
    }
    cout << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    
    ll K;
    cin >> K;
    vector<ll> A(51);
    
    ll a = K / 50, b = K % 50;
    
    rep(i, 51){
        A[i] = a + i;
    }
    
    A.erase(A.begin() + 50 - b);
    output(50);
    voutput(A);
    
    return 0;
}

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

int main()
{
    int n;
    scanf("%d",&n);
    if(n>=22&&n<=25)
    {

        if(n==25)
            printf("Christmas");
        if(n==24)
            printf("Christmas Eve");
        if(n==23)
            printf("Christmas Eve Eve");
        if(n==22)
            printf("Christmas Eve Eve Eve");
    }
    return 0;

}


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

int main(void) {
    int a, b;
    cin >> a >> b;
    int ans = 0;
    for (int i = a; i <= b; i++) {
        string s = to_string(i);
        string rs = s;
        reverse(rs.begin(), rs.end());
        if (rs == s) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e9) + 1;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
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; }

int main()
{
  int n;
  cin >> n;

  ll ans = 0;
  for (ll i = 1; i <= n; ++i) {
    if (i % 3 == 0) continue;
    if (i % 5 == 0) continue;
    ans += i;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int MAXN=100001;
struct edge
{
	int a,b;
}con[MAXN];
inline bool cmp1(const edge &x,const edge &y)
{
	return x.b>y.b;
}
int main()
{
	int n,total,tot=0,ans=0,maxa=0;
	scanf("%d%d",&n,&total);
	for(int i=1;i<=n;++i)
	{
		scanf("%d%d",&con[i].a,&con[i].b);
		maxa=max(maxa,con[i].a);
	}
	sort(con+1,con+n+1,cmp1);
	for(int i=n;i>=1;--i)
		if(con[i].b<=maxa) --n;
		else break;
	for(int i=1;i<=n;++i)
	{
		tot+=con[i].b;++ans;
		if(tot>=total) break;
	}
	if(tot>=total) printf("%d",ans);
	else
	{
		int k=total-tot;
		if(k%maxa==0) ans+=k/maxa;
		else ans+=(k/maxa+1);
		printf("%d",ans);
	}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b)
{
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/

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

    ll N, K;
    cin >> N >> K;

    vector<ll> a(N);
    rep(i, N)
    {
        cin >> a[i];
        --a[i];
    }

    map<ll, ll> mp;
    //mp[0] = -1;

    vector<ll> loop;
    vector<ll> tmp;

    ll st = 0;
    ll siz = 0;
    ll now = 0;

    for (int i = 0; i < 2 * N; i++) {
        if (mp[a[now]]) {
            st = mp[a[now]] - 1;
            siz = i - st;
            //cout << st << siz << endl;
            break;
        } else {
            tmp.PB(a[now]);
            mp[a[now]] = i + 1;
            now = a[now];
            //cout << now << endl;
        }
    }
    for (int i = st; i < st + siz; i++) {
        loop.PB(tmp[i]);
    }

    cout << 1 + ((K > st ? (loop[(K - st - 1) % siz]) : tmp[K - 1])) << endl;
}


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

using namespace std;
#define ll long long
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(vr) vr.begin(),vr.end()
const int N=1e5+10,inf=3e6;
string s,t;
int ps1[N],ps2[N],q,n,m;
int main()
{
    //freopen("ss.inp","r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>s>>t;
    n=s.length();
    m=t.length();
    for (int i=1;i<=n;i++)
        if (s[i-1]=='A') ps1[i]=ps1[i-1]+1;
        else ps1[i]=ps1[i-1]-1;
    for (int i=1;i<=m;i++)
        if (t[i-1]=='A') ps2[i]=ps2[i-1]+1;
        else ps2[i]=ps2[i-1]-1;
    cin>>q;
    for (int i=1,u,v,l,r;i<=q;i++)
    {
        cin>>l>>r>>u>>v;
        if ((ps1[r]-ps1[l-1]+inf)%3==(ps2[v]-ps2[u-1]+inf)%3) cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}


Measured memory_bytes: 1744
n, m, d = map(int, input().split())

if n%2 == 0:
    if d >= n//2 or d == 0:
        p = n
    else:
        p = 2*d + 2*((n-d)-d)
else:
    if d >= -(-n//2) or d == 0:
        p = n
    elif d == n//2:
        p = 2*d + 2
    else:
        p = 2*d + 2*((n-d)-d)

p /= n**2

print((m-1) * p)

Measured memory_bytes: 9200
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
using ll = long long;

int main(){
  int N, D;
  cin >> N >> D;
  vector<vector<int>> X(N, vector<int>(D));
  for( int i=0; i<N; i++ ){
    for( int j=0; j<D; j++){
      cin >> X.at(i).at(j);
    }
  }
  
  int sum;
  int ans = 0;
  for( int i=0; i<N; i++ ){
    for( int j=i+1; j<N; j++ ){
      sum = 0;
      for( int k=0; k<D; k++ ){
        sum += pow( ( X.at(i).at(k) - X.at(j).at(k) ), 2 );
      }
      if( ( sqrt( (double)sum ) - (int)sqrt( (double)sum ) ) == 0 ) ans++;
    }
  }
  
  cout << ans;
  return 0;
}


Measured memory_bytes: 256