akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const ll INF=1ll<<50;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

int n,m;
vi a;

int main(){
	cin>>n>>m;
	a=vi(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=1;i<=m;i++) for(int j=0;j<n-1;j++){
		if(a[j]%i>a[j+1]%i) swap(a[j],a[j+1]);
	}
	for(int i=0;i<n;i++) cout<<a[i]<<endl;
}

Measured memory_bytes: 3132
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long ll;

 int main(){
     int a,b,c;cin>>a>>b>>c;
     if(a==b&&a!=c)cout<<"Yes";
     else  if(c==b&&a!=c)cout<<"Yes";
     else  if(a==c&&b!=c)cout<<"Yes";
     else cout<<"No";
     

 }

Measured memory_bytes: 256
#include <iostream>
#include <vector>
 
using namespace std;
 
const int N = 1000000;
bool flag[N];
int num[N];
 
int main(){
	for(int i=2;i<N;i++) flag[i] = true;
	for(int i=2;i*i<N;i++){
		if(not flag[i]) continue;
		for(int j=i*i;j<N;j+=i){
			flag[j] = false;
		}
    }
    num[0] = 0;
    for(int i=1;i<N;i++){
        if(flag[i]){
            num[i] = num[i-1] + 1;
        }else{
            num[i] = num[i-1];
        }
    }
    int n;
    while(cin >> n){
        cout << num[n] << endl;
    }
    return 0;
}

Measured memory_bytes: 6044
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>

using namespace std;

int main()
{
	int n;
	int a[100000] = {0};

	cin >> n;
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	int sum = 0;

	for(int i = 0; i < n; i++)
	{
		sum += a[i];
	}

	if (sum % 2 == 0)
	{
		printf("YES\n");
	}else
	{
		printf("NO\n");
	}

	return 0;
}
	

Measured memory_bytes: 640
import math
import collections
import itertools
import copy

def YesNo(Bool):
    if(Bool):
        print("YES")
    else:
        print("NO")
    return

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def resolve():
    K=int(input())

    ans="ACL"*K

    print(ans)
    
resolve()


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

using namespace std;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD 1e9 + 7
#define PAI  3.1415
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b == 0) return b;
  else gcd(b, a%b);
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a/gcd(a , b))*b;
}

struct UnionFind {
  vi par; //par[i] : iの親番号（例）par[3] = 2 : 3の親は2

  UnionFind(int N) : par(N) { //最初は全てが根として初期化
    rep(i,N) par[i] = i;
  }

  int root(int x){ //データxが属する木の根を再帰で得る : root(x) = {xの木の根}
    if(par[x] == x)return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y){ //xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if(rx == ry)return; //xとyの根が同じ
    par[rx] = ry; //xとyの根が同じでない時、xの根rxをyの根にryにつける。
  }

  bool same(int x, int y){//2つのデータx，yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};


int main(){

  int n; cin >> n;
  ll ans = 0;
  rep(i,n){
    int a; cin >> a;
    while(1){
      if(a % 2 != 0)break;
      ans ++;
      a /= 2;
    }
  }
  cout << ans << endl;


  return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>

#define REP(i,x,y) for(int i=(int)(x);i<(int)(y);i++)
#define RREP(i,x,y) for(int i=(int)(x);i>(int)(y);i--)
#define all(x) (x).begin(),(x).end()

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

typedef long long ll;

using namespace std;

const int MAX_N = 200000;
int N;
int X[MAX_N];
int Y[MAX_N];

void solve() {
    sort(Y, Y + N);

    int small_median = Y[N / 2 - 1];
    int large_median = Y[N / 2];

    REP(i, 0, N) {
        if (X[i] <= small_median) printf("%d\n", large_median);
        else printf("%d\n", small_median);
    }
}

int main() {
    // to shorten execution time for iostream
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N;
    REP(i, 0, N){
        cin >> X[i];
        Y[i] = X[i];
    }
    solve();
    return 0;
}


Measured memory_bytes: 3840
from itertools import product
N = int(input())
STR_N = str(N)
all_pat =[]
for i in range(3,len(STR_N)+1):
    pattern = list(product(["7","5","3"],repeat=i))
    for p in pattern:
        if len(set(p))==3:
            all_pat.append(int(''.join(p)))
all_pat = list(set(all_pat))
all_pat.sort()
cnt = 0
for a in all_pat:
    if a<=N:
        cnt+=1
print(cnt)

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

#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)

using ll = long long;
using namespace std;


void solve();

int main() {

   solve();
   return 0;

}

void solve() {

   string n;
   cin >> n;
   cout << "ABC" << n << endl;
}

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

int f(int a) {
    int c = a;
    int r = 0;
    
    while(c) {
        r += c % 10;
        c /= 10;
    }
    
    return r;
}

int main() {
    int n;
    cin >> n;
    cout << ((n % f(n) == 0) ? "Yes" : "No") << endl;
    return 0;
}

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

#define mod 1000000007
#define pb push_back
#define bs binary_search
#define bp __builtin_popcountll

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll a,b,c,k,s;
    cin>>a>>b>>c>>k;
    
    if(a>k)
    {
        cout<<k<<endl;
        return 0;
    }
    else
    {
        s=s+a;
        k=k-a;
        k=k-b;
        if(k>0)
        s=s-k;
        cout<<s;
        return 0;
    }

return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <memory>

//#define int long long

using namespace std;

void Main()
{
	int p, q, r;
	cin >> p >> q >> r;
	cout << min(min(p + q, q + r), p + r) << endl;
}

int32_t main()
{
	Main();
	return 0;
}



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

int main(){
    int n,m,ans=0;
    cin >> n >> m;
    map<int,int> mp;
    for(int i = 0;i < n;i ++){
        int k;
        cin >> k;
        for(int j = 0;j < k;j ++){
            int a;
            cin >> a;
            mp[a] ++;
        }
    }
    for(auto ite = mp.begin();ite != mp.end();++ite){
        if(ite->second==n) ans ++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#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 long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    int n, m, c;
    cin >> n >> m >> c;
    vector<int> b(m);
    for (int i = 0; i < m; i++) cin >> b[i];
    vector<vector<int>> a(n);
    int k;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            cin >> k;
            a[i].push_back(k);
        }
    }


    ll s;
    int ans = 0;
    for (int i = 0; i < n; i++){
        s = 0;
        for (int j = 0; j < m; j++){
            s += a[i][j]*b[j];
        }
        if (s+c > 0) ans++;
    }
    cout << ans << '\n';
}

int main(void){ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    //int t; cin >> t; while (t--)
        solve();
}

Measured memory_bytes: 3664
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
vector<int>pat[1000];
vector<int>ko[1000];
bool flag[1000];
int dist[1000];
int par[1000];
bool cent[1000];
void dfs(int node, int d)
{
	flag[node] = true;
	dist[node] = d;
	for (int i = 0; i < pat[node].size(); i++)
	{
		if (!flag[pat[node][i]])
		{
			dfs(pat[node][i], d + 1);
			par[pat[node][i]] = node;
			ko[node].push_back(pat[node][i]);
		}
	}
}
typedef pair<int, int>pii;
typedef pair<int, pii>pi3;
map<pi3, ll>ma;
ll calc(int node, int u, int d)
{
	if (u < 0 || d < 0)return 0;
	pi3 zz = make_pair(node, make_pair(u, d));
	if (ma.count(zz))return ma[zz];
	ll ans = 1;
	for (int i = 0; i < ko[node].size(); i++)
	{
		if (!cent[ko[node][i]])
		{
			ans *= calc(ko[node][i], u - 1, d) + calc(ko[node][i], u, d - 1);
			ans %= mod;
		}
	}
	return ma[zz] = ans;
}
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < num - 1; i++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		za--, zb--;
		pat[za].push_back(zb);
		pat[zb].push_back(za);
	}
	dfs(0, 0);
	int maxi = 0, rr = -1;
	for (int i = 0; i < num; i++)if (maxi < dist[i])maxi = dist[i], rr = i;
	fill(flag, flag + num, false);
	dfs(rr, 0);
	maxi = 0;
	for (int i = 0; i < num; i++)if (maxi < dist[i])maxi = dist[i], rr = i;
	if (maxi % 2 == 0)
	{
		for (int i = 0; i < maxi / 2; i++)rr = par[rr];
		cent[rr] = true;
		fill(flag, flag + num, false);
		for (int i = 0; i < num; i++)ko[i].clear();
		dfs(rr, 0);
		ll r = 0;
		for (int i = 0; i <= maxi / 2; i++)r += calc(rr, i, maxi / 2 - i);
		printf("%lld\n", r%mod);
	}
	else
	{
		for (int i = 0; i < maxi / 2; i++)rr = par[rr];
		cent[rr] = true;
		cent[par[rr]] = true;
		fill(flag, flag + num, false);
		for (int i = 0; i < num; i++)ko[i].clear();
		dfs(par[rr], 0);
		ll r = 0;
		int l = (maxi + 1) / 2;
		//printf("%d %d %d\n", rr + 1, par[rr] + 1, l);
		for (int i = 0; i <= (maxi + 1) / 2; i++)
		{
			ll s = (mod + mod + calc(rr, i, l - i) - calc(rr, i - 1, l - i) - calc(rr, i, l - i - 1)) % mod;
			ll t = calc(par[rr], i, l - i - 1);
			ll u = calc(rr, i, l - i - 1);
			ll v = calc(par[rr], i + 1, l - i - 1);
			//printf("%lld %lld %lld %lld\n", s, t, u, v);
			r += s*t + u*v;
			r %= mod;
		}
		printf("%lld\n", r * 2 % mod);
	}
}

Measured memory_bytes: 31872
#include<iostream>
#include<vector>
#include<cmath> 
#include<algorithm>

using namespace std;

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

    vector<int> h(N), dp(N);

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

    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);

    for (int i = 2; i < N; i++) {
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
    }

    cout << dp[N - 1];
    return 0;
} 


Measured memory_bytes: 1024
#include <iostream>

using namespace std;



int main(){
        int n,m;
        cin >> n >> m;
        int a[n];
        for(int i = 0; i < n; i++) cin >> a[i];
        bool b[n];
        for(int i = 0; i < n; i++) b[i] = true;
        while(m--) {
                int x,y;
                cin >> x >> y;
                x--;
                y--;
                if(a[x] < a[y]) b[x] = false;
                else if(a[x] > a[y]) b[y] = false;
                else {b[y] = false; b[x] = false;}
        }
        int count = 0;
        for(int i = 0; i < n; i++) {
                if(b[i] == true) count++;
        }
        cout << count << endl;

}


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    
    int cnt = 0;
    rep(i, n-1) {
        if(s[i] == s[i+1]) {
            cnt++;
        }
    }

    int ans = min(n-1, cnt + 2*k);

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

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

namespace ABC115
{
    class Program
    {
        static void Main(string[] args)
        {
            //A
            /*
            int D = int.Parse(Console.ReadLine());
            string ans = "";
            switch (D)
            {
                case 22:ans = "Christmas Eve Eve Eve";break;
                case 23:ans = "Christmas Eve Eve";break;
                case 24:
                    ans = "Christmas Eve"; break;
                default:
                    ans = "Christmas";
                    break;
            }
            Console.WriteLine(ans);
            */
            //B
            int N = int.Parse(Console.ReadLine());
            int[] p = new int[N];
            for (int i = 0; i < N; i++)
            {
                p[i]= int.Parse(Console.ReadLine());
            }
            Array.Sort(p);
            int ans = 0;
            for (int i = 0; i < N-1; i++)
            {
                ans += p[i];
            }
            ans += (p[N - 1] / 2);
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i,n) for(int i=1;i<n;i++)
using namespace std;
using ll=long long;
using P = pair<int,int>;
int main(){
    int N;
    cin >> N;
    if(N<=999)cout <<"ABC" << endl;
    else cout << "ABD" << endl;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

long solve(long h)
{
  if (h == 1) return 1;
  auto hh = h / 2;
  return 2 * solve(hh) + 1;
}

int main()
{
  long h;
  std::cin >> h;

  std::cout << solve(h) << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;
ll N, K, S, T;
vector<ll> A;
ll ans = 0;
ll combination[60][60];
ll combinationsum[60][60];
int main() {
    for(int i = 0; i <= 55; i++) {
        combination[i][0] = 1;
        for(int j = 1; j <= i; j++) {
            combination[i][j] = combination[i-1][j-1] + combination[i-1][j];
        }
        for(int j = 0; j <= 55; j++) {
            combinationsum[i][j+1] = combinationsum[i][j] + combination[i][j];
        }
    }
    cin >> N >> K >> S >> T;
    if((T & S) != S) {
        cout << 0 << endl;
        return 0;
    }
    for(int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        if((a & S) != S) {
            i--;
            N--;
            continue;
        }
        if((a | T) != T) {
            i--;
            N--;
            continue;
        }
        //cerr << a << endl;
        A.push_back(a);
    }
    for(ll bits = 0; bits < (1LL << 18); bits++) {
        if((bits & S) != S) continue;
        if((bits | T) != T) continue;
        ll factor = __builtin_popcountll(bits ^ S);
        map<ll, ll> mp;
        for(int i = 0; i < N; i++) {
            ll a = A[i];
            a &= (~bits);
            mp[a]++;
        }
        ll num = 0;
        for(auto tmp : mp) {
            ll val = combinationsum[tmp.second][K+1] - 1;
            //cerr << bits << " " << tmp.first << " " << tmp.second << " " << val << endl;
            //num += (1LL << tmp.second);
            num += val;
        }
        if(factor % 2 == 1) ans -= num;
        else ans += num;
    }
    ans = abs(ans);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3692
def is_left(p)
  _k = 0
  cost = 0

  $ws.each do |w|
    cost += w
    if cost > p
      _k += 1
      cost = w
      return false if _k == $k
    end
  end
  true
end

n, $k = gets.split.map(&:to_i)
$ws = []
n.times do
  $ws << gets.to_i
end

l = $ws.max

if is_left(l)
  puts l
else
  r = 100000 * 10000

  while l + 1 < r
    m = (l + r) / 2
    if is_left(m)
      r = m
    else
      l = m
    end
  end

  puts r
end

Measured memory_bytes: 7024
#!/usr/bin/env python3
import sys
import math
from collections import deque
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = 10**15


n, m = [int(item) for item in input().split()]
possibility = [0] * n
possibility[0] = 1.0

class DirectedGraph:
    def __init__(self, adj):
        self.n = len(adj)
        self.adj = adj
        self.is_asyclic = False
        self.max_path_len = None

    def topological_sort(self):
        indegree = [0] * self.n
        for i, vs in enumerate(self.adj):
            for dest in vs:
                indegree[dest] += 1
        zero_v = []
        for v, indeg in enumerate(indegree):
            if indeg == 0:
                zero_v.append(v)
        max_path_len = 1
        tp_sorted = []
        to_be_added = []
        while True:
            while zero_v:
                v = zero_v.pop()
                if len(self.adj[v]):
                    p = possibility[v] / len(self.adj[v])
                tp_sorted.append(v)
                for dest in self.adj[v]:
                    indegree[dest] -= 1
                    possibility[dest] += p
                    if indegree[dest] == 0:
                        to_be_added.append(dest)
            if len(to_be_added) > 0:
                zero_v.extend(to_be_added)
                to_be_added = []
                max_path_len += 1
            else:
                break
        if len(tp_sorted) == self.n:
            self.is_asyclic = True
            self.max_path_len = max_path_len
            return tp_sorted
        else:
            self.is_asyclic = False
            return None

edge = [[] for _ in range(n)]
for i in range(m):
    s, t = [int(item) - 1 for item in input().split()]
    edge[s].append(t)
dag = DirectedGraph(edge)
tps = dag.topological_sort()
distance = [0] * n
mdist = []

for item in tps[::-1]:
    if item == n-1:
        continue
    dist = 0.0
    max_dist = 0.0
    for dest in edge[item]:
        dist += distance[dest] + 1  
        max_dist = max(max_dist, distance[dest] + 1)
    distance[item] = dist / len(edge[item])
    if len(edge[item]) > 1:
        diff = distance[item] - (dist - max_dist) / (len(edge[item]) - 1)
        mdist.append((diff * possibility[item], item))
mdist.sort(reverse=True)
if len(mdist) > 0:
    print(distance[0] - mdist[0][0])
else:
    print(distance[0])

Measured memory_bytes: 53084
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

d,t,s = miinps()

k = d/s

if k <= t:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9200
import math
import heapq
from bisect import bisect_right, bisect_left
from collections import defaultdict, Counter
import itertools
import sys
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
INF = float("inf")


def main():
    s = input()
    if s == "Sunny":
        print("Cloudy")
    elif s == "Cloudy":
        print("Rainy")
    else:
        print("Sunny")


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]

def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

######
# URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_A&lang=ja
######

def main():
    N, M = l_inpl()

    d = {}
    for i in range(M):
        k = [int(j)-1 for j in input().split(" ")]
        d[i] = k[1:]

    p = [int(i) for i in input().split(" ")]
    ans = 0

    for i in range(2 ** N):
        tmp = []
        for j in range(N):
            if ((i >> j) & 1):
                tmp.append(j)
        flag = True
        for idx, k in d.items():
            cnt = 0
            for ki in k:
                if ki in tmp:
                    cnt += 1
            
            if cnt % 2 != p[idx]:
                flag = False
                break
        
        if flag:
            ans += 1
    
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3668
// Vicfred
// https://atcoder.jp/contests/abc126/tasks/abc126_c
// math
import std.stdio;
import std.math;

void main() {
    real n, k;
    readf("%s %s\n", &n, &k);

    real ans = 0.0;
    for(int dice = 1; dice <= n; dice++) {
        const real steps = ceil(log2(k/dice));
        real prob = (1.0/n);
        if(dice < k)
            prob *= (1.0/2.0)^^steps;
        ans += prob;
    }
    writefln("%.15f", ans);
}


Measured memory_bytes: 2880
#
# abc150 c
#

import sys
from io import StringIO
import unittest
import itertools


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3
1 3 2
3 1 2"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """8
7 3 5 4 2 1 6 8
3 8 2 5 4 6 7 1"""
        output = """17517"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """3
1 2 3
1 2 3"""
        output = """0"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))

    NL = [i+1 for i in range(N)]
    IL = list(itertools.permutations(NL))

    a = b = 0
    for i in range(len(IL)):
        if list(IL[i]) == P:
            a = i
        if list(IL[i]) == Q:
            b = i

    print(abs(a-b))


if __name__ == "__main__":
    # unittest.main()
    resolve()


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    auto ok = [&](char c) {
        return (c == 'A' || c == 'C' || c == 'G' || c == 'T');
    };
    string s;
    cin >> s;
    int res = 0;
    for (int i = 0; i < (int) s.size(); i++) {
        int get = 0;
        if (ok(s[i])) {
            int pos = i;
            while (ok(s[pos]) && pos < (int) s.size()) {
                ++pos, ++get;
            }
            i = pos;
            res = max(res, get);
        }
    }
    cout << res << '\n';
    return 0;
}


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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  vector<bool> B(1e6 + 1, 1);
  B.at(0) = B.at(1) = 0;
  for (long i = 2; i <= 1e6; i++) {
    if (B.at(i)) for (long j = i * i; j <= 1e6; j += i) B.at(j) = 0;
  }
  vector<vector<int>> V(1e6+1);
  for (int i = 2; i <= 1e6; i++) {
    if (B.at(i)) for (int j = i; j <= 1e6; j += i) V.at(j).push_back(i);
  }

  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  vector<bool> B2(1e6+1);
  for (auto a : A) {
    for (auto b : V.at(a)) {
      if (B2.at(b)) goto NG;
      B2.at(b) = 1;
    }
  }
  return cout << "pairwise coprime" << "\n", 0;
  NG:;
  int G = 0;
  for (int i = 0; i < N; i++) {
    G = gcd(G, A.at(i));
  }
  cout << ((G == 1) ? "setwise coprime" : "not coprime") << "\n";
}

Measured memory_bytes: 62848
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;

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

        int n = sc.nextInt();
        sc.nextLine();
        ArrayList<String> s = new ArrayList<>();
        for(int i=0; i<n; i++) {
            s.add(sc.nextLine());
        }

        int m = sc.nextInt();
        sc.nextLine();
        ArrayList<String> t = new ArrayList<>();
        for(int j=0; j<m; j++) {
            t.add(sc.nextLine());
        }

        Set<String> setS = new HashSet<>(s);
        Set<String> setT = new HashSet<>(t);

        Map<String,Integer> mapS = new HashMap<>();
        for(String str: setS) {
            mapS.put(str, Collections.frequency(s, str));
        }

        Map<String,Integer> mapT = new HashMap<>();
        for(String str: setT) {
            mapT.put(str, Collections.frequency(t, str));
        }

        int count = 0;
        int currentCount = 0;
        for(String str: setS) {
            if(setT.contains(str)) {
                count = mapS.get(str) - mapT.get(str);
            } else {
                count = mapS.get(str);
            }
            if(currentCount < count) {
                currentCount = count;
            }
        }

        System.out.println(currentCount);
        sc.close();
    }
}


Measured memory_bytes: 21844
n = int(input())
a = []
for i in range(n):
    c = list(input())
    c.sort()
    a.append(''.join(c))
a.sort()
sol = 0
i = 0
while i < len(a):
    j = i + 1
    temp = 1
    while j < len(a) and a[j] == a[i]:
        j += 1
        temp += 1
    i = j
    if temp == 0 or temp == 1: continue
    if temp == 2:
        sol += 1
        continue
    if temp == 3:
        sol += 3
        continue
    else:
        sol += (temp * (temp - 3) // 2 + temp)
print(sol)


Measured memory_bytes: 10612
#include<iostream>

using namespace std;

int main()
{
	int N;
	int *a;

	cin >> N;
	a = new int[N];

	int ans = 0;

	for (int i = 0; i < N; i++) {
		cin >> a[i];
		ans += (a[i] - 1);
	}

	cout << ans << endl;

	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 REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

ll mp[3];

int main(){
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
	ll n;cin >> n;
	string str;cin >> str;
	ll ans = 1;
	REP(i, str.size()){
		ll kake = INF;
		if(str[i] == 'R'){
			if(mp[1])kake = min(kake, mp[1]);
			if(mp[2])kake = min(kake, mp[2]);
			if(kake != INF)kake = max(1LL, kake - mp[0]);
			mp[0]++;
		}
		else if(str[i] == 'G'){
			if(mp[0])kake = min(kake, mp[0]);
			if(mp[2])kake = min(kake, mp[2]);
			if(kake != INF)kake = max(1LL, kake - mp[1]);
			mp[1]++;
		}
		else if(str[i] == 'B'){
			if(mp[0])kake = min(kake, mp[0]);
			if(mp[1])kake = min(kake, mp[1]);
			if(kake != INF)kake = max(1LL, kake - mp[2]);
			mp[2]++;
		}
		//cout << i << " " << kake << endl;
		if(kake == INF)kake = 1;
		ans = (ans * kake) % MOD;
		if(mp[0] && mp[1] && mp[2]){
			mp[0]--;
			mp[1]--;
			mp[2]--;
		}
	}

	for(ll i = 1;i <= n;i++){
		ans = ans * i % MOD;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
int main() {
	string S;
	cin>>S;
	bool judge=true;
	if(S.at(0)!='A')judge=false;
	int counter=0;
	for(int i=2;i<S.size()-1&&counter<=1;i++){
		if(S.at(i)=='C')counter++;
	}
	if(counter!=1)judge=false;
	counter=0;
	for(auto s:S)if(islower(s))counter++;
	if(counter!=S.size()-2)judge=false;
	if(judge){cout<<"AC"<<endl;}
	else{cout<<"WA"<<endl;}
}

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

typedef pair<int,int>pii;
typedef long long ll;
#define fi first
#define se second

int read() {
	int xx=0,ww=1;
	char ch=getchar();
	while(ch>'9'||ch<'0') {
		if(ch=='-') ww=-ww;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') {
		xx=10*xx+ch-48;
		ch=getchar();
	}
	return xx*ww;
}

char s[410][410];
int n,m;
int dx[]= {0,1,-1,0},dy[]= {1,0,0,-1};
bool vis[410][410];
ll ans;

bool In_range(int x,int y) {
	return x>=0&&y>=0&&x<n&&y<m;
}

pii dfs(int dep,int a,int b) {
	vis[a][b]=true;
	char ch=s[a][b];
	pii an;
	if(ch=='#')
	an.fi=1,an.se=0;
	else
	an.se=0,an.se=1;
	for(int i=0; i<4; i++) {
		int aa=a+dx[i];
		int bb=b+dy[i];
		if(In_range(aa,bb)&&!vis[aa][bb]&&ch!=s[aa][bb]) {
			pii answ;
			answ=dfs(dep+1,aa,bb);
			an.fi+=answ.fi;
			an.se+=answ.se;
		}
	}
	return an;
}

int main() {
	n=read();
	m=read();
	for(int i=0; i<n; i++) scanf("%s",s[i]);
	for(int i=0; i<n; i++)
		for(int j=0; j<m; j++)
			if(!vis[i][j]) {
				pii anss;
				anss=dfs(0,i,j);
				ans+=(ll)anss.fi*(ll)anss.se;
			}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 13056
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

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

int main()
{
    int H, W, M;
    std::cin >> H >> W >> M;
    std::vector<std::pair<int, int>> bombList(M);

    std::vector<int> bombsX(300001, 0);
    std::vector<int> bombsY(300001, 0);

    std::vector<int> maxRows;
    std::vector<int> maxColumns;

    std::vector<bool> isMR(300001, false);
    std::vector<bool> isMC(300001, false);

    rep(i, M)
    {
        int x, y;
        std::cin >> x >> y;

        // 爆弾の位置を記憶 
        bombList[i].first = x;
        bombList[i].second = y;

        // X座標、Y座標の爆弾の数を増やす 
        bombsX[x]++;
        bombsY[y]++;
    }

    // 1番爆弾を持っているX, Y座標(複数個)を取得する 
    // 座標を実数で持っているので<= 
    int maxX = 0;
    for(int i = 0; i <= H; i++)
    {
        if(bombsX[i] > maxX)
        {
            maxX = bombsX[i];
            maxRows.clear();
            maxRows.push_back(i);
        }
        else if(bombsX[i] == maxX)
        {
            maxRows.push_back(i);
        }
    }
    int maxY = 0;
    for(int i = 0; i <= M; i++)
    {
        if(bombsY[i] > maxY)
        {
            maxY = bombsY[i];
            maxColumns.clear();
            maxColumns.push_back(i);
        }
        else if(bombsY[i] == maxY)
        {
            maxColumns.push_back(i);
        }
    }

    // かぶっているかどうかチェックする 
    // 一番多い行/列にフラグを立てる 
    rep(i, maxRows.size())
    {
        isMR[maxRows[i]] = true;
    } 
    rep(i, maxColumns.size())
    {
        isMC[maxColumns[i]] = true;
    }

    // 爆弾のX座標、Y座標をみて交点とかぶっているか確認する 
    int samePointCnt = 0;
    rep(i, M)
    {
        if((isMR[bombList[i].first]) && (isMC[bombList[i].second]))
        {
            samePointCnt++;
        }
    }

    int ans = maxX + maxY;
    // 交点の数と爆弾がかぶった数が同じなら、
    // かぶっていない交点は無いので--する
    // 次に多い組み合わせは交点を考えない最大値より少なくとも1小さいので 
    // どうせ同じか今より小さくなるので考えなくてよい   
    if(samePointCnt == (maxRows.size() * maxColumns.size()))
    {
        ans--;
    }

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 12132
#include <stdio.h>

int main(void) {
    char s[11];
    int len = 0;
    int max_len = 0;

    scanf("%s", s);

    for (int i = 0; i <= 10; ++i) {
        switch (s[i]) {
            case 'A':
            case 'C':
            case 'G':
            case 'T':
                len = 1;
                for (int j = i + 1; j <= 10; ++j) {
                    switch (s[j]) {
                        case 'A':
                        case 'C':
                        case 'G':
                        case 'T':
                            len++;
                            break;
                        default:
                            if (len > max_len) {
                                max_len = len;
                            }
                            len = 0;
                            break;
                    }
                    if (len == 0) break;
                }
                break;
            default:
                break;
        }
    }

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

    return 0;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    LL a[50];
    inc(i, 0, n) cin >> a[i];

    LL ans = 0;
    while(true){
        bool flag = true;
        LL s = 0;
        inc(i, 0, n){
            if(a[i] >= n) flag = false;
            s += a[i]/n;
        }
        if(flag) break;

        inc(i, 0, n){
            ans += a[i]/n;
            a[i] = a[i]%n + s - a[i]/n;
        }
    }
    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
char a[1005], b[1005];
int main()
{
	scanf("%s %s",a,b);
	int lena = strlen(a);
	int lenb = strlen(b);
	if(lena > lenb)
	{
		printf("GREATER\n");
		return 0;
	}
	else if(lena < lenb)
	{
		printf("LESS\n");
		return 0;
	}
	else 
	{
		int flag = 0;
		for(int i = 0;i < lena;i++)
		{
			if(a[i] > b[i])
			{
				printf("GREATER\n");
				flag = 1;
				return 0;
			}
			else if(a[i] < b[i])
			{
				printf("LESS\n");
				flag = 1;
				return 0;
			}
		}
		if(flag == 0) printf("EQUAL\n");
	}
	return 0;
}

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

int main() {
    char ch[4][4];
    for(int i=0; i<3; i++)
        for(int j=0; j<3; j++) {
            cin>>ch[i][j];
        }
    cout<<ch[0][0]<<ch[1][1]<<ch[2][2];
}



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

int n,arr[1000000],arr2[1000000];

int main(){
	scanf("%d",&n);
	for(int i=0;i<n-1;i++){
		scanf("%d",&arr[i]);
	}
	arr2[0]=arr[0];
	for(int i=0;i<n;i++){
		if(i==n-1){
			arr2[i+1]=arr[i];
		}else{
			if(arr[i]<arr2[i]){
				arr2[i]=arr[i];
			}
			arr2[i+1]=arr[i];
		}
	}
	int sum=0;
	for(int i=0;i<n;i++){
//		printf("%d",arr2[i]);
		sum+=arr2[i];
	}
	printf("%d",sum);
	
	return 0;
} 

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline LL gl()
{
	LL f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

int n, m;

int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	cin >> n >> m;
	int cnt = 0;
	while (n)
	{
		++cnt;
		n /= m;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
n=int(input())
S=sorted([int(input()) for _ in range(n)])
ans=sum(S)
i=0
while S!=[] and ans%10==0:
    for s in S:
        if (ans-s)%10!=0:
            ans-=s
            break
    if ans%10==0:ans-=S.pop(0)
print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;
import java.util.SortedSet;
import java.util.TreeSet;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n, m;
		while ((n = in.nextInt()) != 0 && (m = in.nextInt()) != 0) {
			SortedSet<Integer> tset = new TreeSet<Integer>();
			int taroSum = 0;
			for (int i = 0; i < n; i++) {
				int s = in.nextInt();
				tset.add(s);
				taroSum += s;
			}
			SortedSet<Integer> hset = new TreeSet<Integer>();
			int hanakoSum = 0;
			for (int i = 0; i < m; i++) {
				int s = in.nextInt();
				hset.add(s);
				hanakoSum += s;
			}
			int span = taroSum - hanakoSum;
			boolean isNotFind = true;
			if (Math.abs(span) % 2 != 1) {
				span /= 2;
				for (int tc : tset) {
					if (hset.contains(tc - span)) {
						int hc = tc - span;
						System.out.println(tc + " " + hc);
						isNotFind = false;
						break;
					}
					isNotFind = true;
				}
			} else {
				isNotFind = true;
			}
			if (isNotFind) {
				System.out.println(-1);
			}
		}

	}
}

Measured memory_bytes: 21068
//
//  main.cpp
//  ABC_065_B
//
//  Created by Joe Mori on 2020/05/30.
//  Copyright © 2020 Joe Mori. All rights reserved.
//

#include <iostream>
#include<vector>

int main(int argc, const char * argv[]) {
    // insert code here...
    int n,count=0;
    std::cin>>n;
    std::vector <int>a(n);
    for(int i=0;i<n;i++){
        std::cin>>a[i];
    }
    int b=1;
    while(true){
        b=a[b-1];
        count++;
        if(b==2){
            std::cout<<count<<std::endl;
            break;
        }
        if(count>n+1){
            std::cout<<-1<<std::endl;
            break;
        }
    }
    return 0;
}


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

const long long INF = 1LL << 60;

int main() {
    string S;
    cin>>S;
  int flag=1;
  int sum=0;
  	for(int i=0;i<3;i++){
      if(i<1 && S[i]=='R') sum++;
      if(i>0 && S[i-1]=='S' && S[i]=='R') sum=1;
      if(i>0 && S[i-1]=='R' && S[i]=='R' ) sum++;

    }
    cout << sum << endl;
    return 0;
}

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

import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())

if N == 1:
    print(0)
    exit()


c = collections.Counter(prime_factorize(N))

ans = 0

a = list(c.values())

for i in range(len(a)):
    cnt = 1
    while True:
        a[i] -= cnt
        cnt += 1
        if a[i] <0:
            break
        ans += 1

print(ans)

Measured memory_bytes: 9476
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	int h, w,H,W,sum;
	cin >> H >> W >> h >> w;
	sum = H * W;
	sum -= h * W;
	sum -= w * (H - h);
	cout << sum << endl;

}

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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)


int main(void){
  int d;
  cin>>d;

  if(d==24)cout<<"Christmas Eve"<<endl;
  else if(d==25)cout<<"Christmas"<<endl;
  else if(d==23)cout<<"Christmas Eve Eve"<<endl;
  else if(d==22)cout<<"Christmas Eve Eve Eve"<<endl;



return 0;}


Measured memory_bytes: 256
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n, k;
    cin >> n >> k;

    int num = 0;
    int knum = 0;
    FOR(a, 1, n) {
        if ((a % k) * 2 == k) num++;
        if (a % k == 0) knum++;
    }
    cout << num * num * num + knum * knum * knum << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
int arr[11][11] ;
int ans[206][206] ;
int inp[206][206] ;
int main()
{
    int n,m ;
    cin >> n >> m ;

    for(int i = 0 ; i < 10 ; i++)
    {
        for(int j = 0 ;  j < 10 ; j++)
            cin >> arr[i][j] ;
    }

    for(int k = 0 ; k < 10 ; k++)
    {
        for(int i = 0 ; i < 10 ; i++)
        {
            for(int j = 0 ; j < 10 ; j++)
            {
                if(arr[i][j] > arr[i][k] + arr[k][j])
                    arr[i][j] = arr[i][k] + arr[k][j] ;
            }
        }
    }


    int sum = 0 ;

    for(int i = 0 ; i < n ; i++)
    {
        for(int j = 0 ; j < m ; j++){
            cin >> inp[i][j] ;

        if(abs(inp[i][j]) != 1)
            sum += arr[inp[i][j]][1] ;
        }

    }

    cout << sum << endl ;

}


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

using namespace std;

#define ll       long long
#define PII      pair<int, int>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 10;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);

int n, vis[N];
double sum, fact[N];
pair<double, double> a[N];

void runFact() {
    fact[1] = 1;
    for (int i = 2; i < 10; i++) {
        fact[i] = fact[i - 1] * (double) i;
    }
}

void go(int last, int cnt, double val) {
    if (cnt == n) {
        sum += val;
        return;
    }
    for (int i = 0; i < n; i++) {
        if (vis[i]) {
            continue;
        }
        double tmp = val;
        if (last != -1) {
            double x = a[last].first - a[i].first;
            double y = a[last].second - a[i].second;
            double dis = sqrt((x * x) + (y * y));
            tmp += dis;
        }
        vis[i] = 1;
        go(i, cnt + 1, tmp);
        vis[i] = 0;
    }
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i].first >> a[i].second;
    }
    runFact();
    go(-1, 0, 0.0);
    double ans = sum / fact[n];
    cout << fixed << setprecision(10) << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
def solve(N, A, B, C, D, memo):
    if N in memo:
        return memo[N]
    ans = D * N
    if N <= 1:
        memo[N] = ans
        return ans
    divs = [(2, A), (3, B), (5, C)]
    for divider, divcost in divs:
        delta = N % divider
        if delta:
            ans = min(ans, solve(N // divider, A, B, C, D, memo) +
                      divcost + D * delta)
            ans = min(ans, solve(N // divider + 1, A, B, C, D, memo) +
                      divcost + D * (divider - delta))
        else:
            ans = min(ans, solve(N // divider, A, B, C, D, memo) + divcost)
    memo[N] = ans
    return ans


def main():
    T = int(input())
    for _ in range(T):
        N, A, B, C, D = map(int, input().split())
        ans = solve(N, A, B, C, D, {})
        print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 82904
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int n,k;
	cin >> n >> k;
	if(n == 0 && k == 0) break;
	ll d[101][101];
	REP(i,101)REP(j,101) d[i][j] = 100000000000;
	bool flg = false;
	REP(l,k){
	    int m,a,b,c;
	    cin >> m;
	    if(m == 0){
		cin >> a >> b;
		if(!flg){
		    FOR(k,1,n+1)FOR(i,1,n+1)FOR(j,1,n+1){
			d[i][j] = min(d[i][k] + d[k][j] , d[i][j]);
		    }
		    flg = true;
		}
		if(d[a][b] > 1000000000) cout << -1 << endl;
		else cout << d[a][b] << endl;
	    }else if(m == 1){
		cin >> a >> b >> c;
		flg = false;
		if(d[a][b] > c){
		    d[a][b] = c;
		    d[b][a] = c;
		}
	    }
	}
    }
    return 0;
}

Measured memory_bytes: 1236