akhauriyash/Code-Regression huggingface dataset:
// Do you knOW what it feels like?

		// To be TorTured by your own MinD?
	
	// I don't wanna feel the PAIN.

// I BeG you to KILL me, pleASE...

#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Os")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=1e5+10, lg=17, mod=1e9+7, inf=1e18;

const int S=200005,M=1e9+7;
int n,x,y,c,w,m[S],f,s,d,i;
vector<int> G[S];
long long fc[S]={1},iv[S],k,b,a=1;

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	cin>>n>>x>>y;
	fill(m,m+n,M);
	for(i=0;i<n;i++){
		cin>>c>>w;
		G[--c].push_back(w);
		m[c]=min(m[c],w);
		if(c!=f){
			if(w<m[f]){
				s=f;f=c;
			}else if(w<m[s])s=c;
		}
		fc[i+1]=fc[i]*(i+1)%M;
	}
	for(iv[n]=1,k=M-2,b=fc[n];k;k/=2,(b*=b)%=M)if(k&1)(iv[n]*=b)%=M;
	for(i=n;i>0;i--)iv[i-1]=iv[i]*i%M;
	for(i=0;i<n;i++)if(y-m[f]>=m[i]){
		w=max(y-m[f==i?s:f],x-m[i]);c=0;
		for(int t:G[i])if(t<=w)c++;
		d+=c;
		a=a*fc[d]%M*iv[d-c]%M*iv[c]%M;
	}
	cout<<a;
	
	return 0;
}


















Measured memory_bytes: 13184
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n+1,0);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i+1];
        --a[i+1];
    }
    for (ll i = 0; i < n; ++i) {
        a[i+1] += a[i];
        a[i+1] %= k;
    }
    ll res = 0;
    map<ll, ll> counts;
    for (ll i = 0 ; i < n+1 ; ++i){
        if (i >= k)--counts[a[i-k]];
        res += counts[a[i]];
        ++counts[a[i]];
    }
    cout << res << endl;
}


Measured memory_bytes: 14336
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let n:usize = read();
    let mut s:Vec<char> = read::<String>().chars().collect();
    let k:usize = read();

    let chk = s[k-1];

    let mut ans = String::new();
    for ch in s.iter() {
        if chk != *ch {
            ans.push('*');
        } else {
            ans.push(*ch);
        }
    }

    println!("{}", ans);
    
}


Measured memory_bytes: 4352
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        System.out.println(n < 105 ? 0 : n < 135 ? 1 : n < 165 ? 2 : n < 189 ? 3 : n < 195 ? 4 : 5);
    }
}

Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    ll N,K,S;
    cin >> N >> K >> S;
    if(N == K){
        REP(i,N){
            cout << S << " ";
        }
        cout << endl;
        return 0;
    }
    ll A = S/2;
    ll B = S-A;
    ll C;
    if(S == 1){
        A = 1;
        B = 1;
        K--;
    }
    if(S == 1e9){
        C = 1e9-1;
    }else{
        C = 1e9;
    }
    REP(i,N){
        if(i < K+1){
            if(0 == i%2){
                cout << A << " ";
            }else{
                cout << B << " ";
            }
        }else{
            cout << C << " ";
        }
    }
    cout << endl;
}

Measured memory_bytes: 3608
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int r;
    cin >> r;
    double pi = atan2(0, -1);
    cout << fixed << setprecision(10) << 2.0 * r * pi;
    return 0;
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
int main(){
    double r , S , L , pi = 3.141592653589;
    cin >> r;
    S = pi * r * r;
    L = 2 * pi * r;
    cout << fixed << setprecision(7) << S << " " << L << endl; 
    return 0;
}


Measured memory_bytes: 3272
#include<bits/stdc++.h>
using namespace std;
 
typedef long long   ll;
typedef long double ld;
const int N  = 5e5+10;
const ll mod = 1e9+7;
const ll inf = 1e18;
 
#define fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb              push_back
#define mp              make_pair
#define ub              upper_bound                 // first element >  val(itr)
#define lb              lower_bound                 // first element >= val(itr) 
#define all(x)          (x).begin(),(x).end()
#define reset(a,x)      memset(a,x,sizeof(a))       // x can be 0 or -1
#define leadzero(a)     __builtin_clz(a)            // count leading zeroes
#define trailzero(a)    __builtin_ctz(a)            // count trailing zeroes
#define bitcount(a)     __builtin_popcount(a)       // count set bits
#define iceil(n,x)      ((n)+(x)-1)/(x)
#define test            int t; cin>>t; while(t--)
#define forn(i,a,e)     for(ll i = a; i < e; i++)
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define sp              <<" "<<

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;    }
ll powm(ll base,ll exp){ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
ll add(ll a,ll b)  { return (a%mod+b%mod)%mod;        }
ll sub(ll a, ll b) { return (a%mod+mod-b%mod)%mod;    }
ll mult(ll a,ll b) { return ((a%mod)*(b%mod))%mod;    }
ll choose2(ll n)   { ll ans=(n*(n-1))/2; return ans;  }
ll dist2(ll x1,ll y1,ll x2,ll y2){ ll ans=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1); return ans;}

int main()
{
     fast
     ll n,k;
     string s;
     cin>>n>>k>>s;

     if(s[k-1]<97)
          s[k-1]=s[k-1]+32;

     cout<<s;

     return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        sc.close();
        int[] cnt = new int[n];
        for(int i = 1; i < n; i++){
            for(int j = i + 1; j <= n; j++){
                int dist = j - i;
                if(j <= x || i >= y){
                    cnt[dist]++;
                } else {
                    int dist2 = Math.abs(x - i) + Math.abs(y - j) + 1;
                    cnt[Math.min(dist, dist2)]++;
                }
            }
        }
        for(int i = 1; i < n; i++){
            System.out.println(cnt[i]);
        }
    }
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    int w;
    cin >> w;
    cout << w * 32 << endl;

    return 0;
}


Measured memory_bytes: 3188
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   
#include <bitset>
//#include <boost/math/common_factor_rt.hpp>

#define ll long long
#define max 100000
using namespace std;
ll l = 1000000007;

int main()
{	
	string s, t;
	int min = 1000;
	int num, ber;
	int ans = 0;
	cin >> s;

	for (int i = 0; i <= s.size() - 3 ; i++)
	{
		t = s.substr(i, 3);
		num = stoi(t);
		ber = abs(num - 753);
		if (min > ber) {
			min = ber;
			ans = ber;
		}
	}

	cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>

//
// Input
// N
// A1 A2 ... An
//  * N is Num of Data
//  * A is Random Integer, up to 10^9
// Output
// N ... Operation Count

int main () {

    int size = 0;
    int count = 0;

    std::cin >> size;
    int data[size] = {};

    for (int &x : data) {
        std::cin >> x;
    }

    while(true){
        bool isOdd = false;
        for (int &i : data) {
            if (i & 1) {
                isOdd = true;
                break;
            }
            i = i >> 1;
        }

        if(isOdd) {
            break;
        }
        count++;
    }

    std::cout << count << std::endl;

    return 0;
}


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

typedef pair<ll,ll> P;
const ll MO = 1000000007;
int ans;
vector<int> a,b,c,d;
int n,m,q;

int main(){
    int n;
    cin >> n;
    deque<int> b;
    rep(i,n){
        int x; cin >> x;
        if(i%2==0)b.push_back(x);
        else b.push_front(x);
    }
    if(n%2==0){
        rep(i,n){
            int f;
            f = b.front();b.pop_front();
            cout << f << endl;
        }
    }else{
        rep(i,n){
            int f;
            f = b.back();b.pop_back();
            cout<<f<<endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 2944
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)      x.begin(), x.end()
#define SIZE(x)     static_cast<i64>(x.size())
#define rep(i,n)    for (i64 i = 0, i ## _limit = (n); i < i ## _limit; ++i)
#define reps(i,s,t) for (i64 i = (s), i ## _limit = (t); i <= i ## _limit; ++i)
#define repr(i,s,t) for (i64 i = (s), i ## _limit = (t); i >= i ## _limit; --i)

#ifdef DBG
#define trace(...) _trace(#__VA_ARGS__, __VA_ARGS__);
#else
#define trace(...)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template<class T, class U>inline bool chmax(T &a, const U &b){return b>a && (a=b, true);}
template<class T, class U>inline bool chmin(T &a, const U &b){return b<a && (a=b, true);}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template<class T>
ostream& operator<< (ostream &os, const vector<T> &vec) {
    rep(i, vec.size()) os << vec[i] << (i+1 == vec.size() ? "" : " ");
    return os;
}

template<class T, class U>
ostream& operator<< (ostream &os, const pair<T, U> &p) {
    return os << p.first << ' ' << p.second;
}

template<class Itr>
ostream& printContainer(Itr begin, Itr end, const string &separator = " ", ostream &os = cout) {
    const auto rbegin = std::prev(end);
    for (; begin != rbegin; ++begin) os << *begin << separator;
    os << *rbegin;
    return os;
}

ostream& operator<< (ostream &os, ostream&) {
    return os;
}

template <class T>
void _trace(const char *s, T&& x) {
    clog << '{';
    while(*s != '\0') clog << *(s++);
    clog << ":" << setw(3) << x << '}' << endl;
}

template <class Head, class... Tail>
void _trace(const char *s, Head&& head, Tail&&... tail) {
    clog << '{';
    while(*s != ',') clog << *(s++);
    clog << ":" << setw(3) << head << "}, ";
    for (++s; !isgraph(*s); ++s);
    _trace(s, std::forward<Tail>(tail)...);
}
// }}} End Header

#define to first
#define type second

struct UnionFind { // {{{
    vector<int> u;
    explicit UnionFind(int n): u(n+5, -1) {}
    int  size(int x)        { return -u[root(x)]; }
    int  root(int x)        { return (u[x] < 0)? x : (u[x] = root(u[x])); }
    bool same(int x, int y) { return (root(x) == root(y)); }
    bool unite(int x, int y){ return (x=root(x)) == (y=root(y))? false : (u[x]+=u[y], u[y]=x, true); }
}; // }}}

int N, M;
bool know[100010];

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

    cin >> N >> M;

    UnionFind uf(N);

    rep(i, M){
        int x, y, z;
        cin >> x >> y >> z;
        uf.unite(x, y);
        // if ((z & 1) == 0) {
        //     know[x] = know[y] = true;
        // }
    }

    // reps(u, 1, N) {
    //     if (know[u]) know[uf.root(u)] = true;
    // }

    unordered_set<int> unknown;
    reps(u, 1, N) {
        unknown.insert(uf.root(u));
    }

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

    return 0;
}


Measured memory_bytes: 4772
#include <vector> 
#include <algorithm>
#include <iostream>

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    for(int i = 0; i < n; i++){
        cin >> l[i];
    }
    int max = 0;
    sort(l.begin(),l.end());
    for(int i = 0; i < k ; i++){
        max += l[n-1-i];
    }
    cout << max << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long cnt = sc.nextLong();
        long min = 0;
        long max = 0;
        long total = 0;
        for(long i=0;i<cnt;i++){
            long num = sc.nextLong();
            if(i==0){
                min = num;
                max = num;
            } else if(num > max){
                max = num;
            } else if(num < min){
                min = num;
            }
            total += num;
        }
        System.out.printf("%s %s %s%n",min,max,total);
    }
}


Measured memory_bytes: 40812
import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Blulogix
 */
public class Main {
    public static void main(String[] args)throws Exception {
       Scanner in=new Scanner(System.in);
        int a=in.nextInt();
        int b=in.nextInt();
        
        if((a*b)%2==0)
            System.out.println("Even");
        else
             System.out.println("Odd");
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(std::unique(all(x)), x.end());
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
const double PI = acos(-1);
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    string s, t;
    cin >> s >> t;
    cout << t << s << endl;
}

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


int main()
{
    long N;
    long A[100000+1];
    long B[100000];
    std::cin >> N;
    for(long i=0; i<N+1;i++){
        std::cin >> A[i];
    }
    for(long j=0; j<N; j++){
        std::cin >> B[j];
    }
    long monster=0;
    long nokori=0;
    if(A[0] > B[0]){//倒しきれない
        monster+=B[0];
        B[0]=0;
    }else{
        monster+=A[0];
        B[0]=B[0]-A[0];
    }
    for(long i=1; i<N; i++){
        if(B[i-1]<A[i]){ //前の人が倒しきれない
            if(B[i-1]+B[i] > A[i]){ //2人なら倒しきれる
                monster+=A[i];
                B[i]-=A[i]-B[i-1];
            }else{ //2人でもだめ
                monster=monster+B[i-1]+B[i];
                B[i]=0;
            }
        }else{ //前の人が倒しきれる
            monster+=A[i];
        }
    }
    if(B[N-1]<A[N]){
        monster+=B[N-1];
    }else{
        monster+=A[N];
    }
    std::cout << monster << std::endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.Arrays;
import java.util.Scanner;

//Beat Panel
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int[][] dp = new int[2][1<<16];
		for(;;){
			int n = sc.nextInt(), c = sc.nextInt();
			if(n+c==0)break;
			int[] a = new int[n], b = new int[c];
			for(int i=0;i<n;i++)for(int j=0;j<16;j++)a[i] = (a[i]<<1) + sc.nextInt();
			for(int i=0;i<c;i++)for(int j=0;j<16;j++)b[i] = (b[i]<<1) + sc.nextInt();
			Arrays.fill(dp[0], -1);
			dp[0][0] = 0;
			int X = 1;
			for(int i=0;i<n;i++,X=1-X){
				Arrays.fill(dp[X], -1);
				for(int S=0;S<1<<16;S++)if(dp[1-X][S]!=-1){
					int light = S|a[i];
					for(int j=0;j<c;j++){
						int pushed = light & b[j];
						int point = Integer.bitCount(pushed);
						int nx = light & ~pushed;
						dp[X][nx] = Math.max(dp[X][nx], dp[1-X][S] + point);
					}
				}
			}
			int res = 0;
			for(int S=0;S<1<<16;S++)res = Math.max(res, dp[1-X][S]);
			System.out.println(res);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 31780
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():

    a,b,c = map(int, input().split())

    if a==b:
        print(c)
    elif b==c:
        print(a)
    else:
        print(b)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62832
#include <iostream>
#include <math.h>
using namespace std;

int main(){
	int a, b,c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;

	if( abs(a-b) >  k ){
		cout << ":(" << endl;
	}
	else if( abs(a-c) >  k ){
		cout << ":(" << endl;
	}
	else if( abs(a-d) >  k ){
		cout << ":(" << endl;
	}
	else if( abs(a-e) >  k ){
		cout << ":(" << endl;
	}
	else if( abs(b-c) >  k ){
		cout << ":(" << endl;
	}
	else if( abs(b-d) >  k ){
		cout << ":(" << endl;
	}
	else if( abs(b-e) >  k ){
		cout << ":(" << endl;
	}
	else if( abs(c-d) >  k ){
		cout << ":(" << endl;
	}
	else if( abs(c-e) >  k ){
		cout << ":(" << endl;
	}
	else if( abs(d-e) >  k ){
		cout << ":(" << endl;
	}
	else{
		cout << "Yay!" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define F(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define VE(i,v) for(int i = 0;i < (v).size();i++)

using namespace std;
#define trace(...) cerr<<__FUNCTION__<<":"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned int ui;
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
typedef pair<ll,ll> pll;
typedef vector<pll> vpll; 
const int lim = 1e5 + 1 ;
vector<int> adj[lim];
int N;
vl white;
vl black;
vi done;
void dfs(int u, int p)
{
	white[u] = 1LL;
	black[u] = 1LL;
	for(int v:adj[u])
	{
		if(v==p)
			continue;
		dfs(v, u);
		white[u] = (white[u]*((white[v] + black[v])%MOD))%MOD;
		black[u] = (black[u] * white[v])%MOD;
	}
	done[u]=1;

	
}


int main()

{
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);
	int T;
	T=1;
	for(int tc=1; tc<=T;tc++)
	{
		cin >> N ;
		white.resize(N);
		black.resize(N);
		done.resize(N,0);
		for(int i =1; i < N; i++)
		{
			int x,y;
			cin >> x >> y;
			x--;
			y--;
			adj[x].pb(y);
			adj[y].pb(x);
		}
		ll ans = 0;
		for(int i=0; i <N; i++)
		{
			if(done[i])
				continue;
			dfs(i,-1);

			ans = (ans + white[i] + black[i])%MOD;
		}
		if(N==1)
			ans = 2LL;
		cout<<ans<<"\n";
	}
 
 
 
	return 0;
}
 
 


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int w, h;
  cin >> w >> h;
  vector<pair<ll, char>> vp;
  rep(i, w) {
    int p;
    cin >> p;
    vp.eb(mp(p, 'p'));
  }
  rep(i, h) {
    int q;
    cin >> q;
    vp.eb(mp(q, 'q'));
  }

  sort(all(vp));

  int pcnt = h + 1;
  int qcnt = w + 1;
  ll ans = 0;
  rep(i, vp.size()) {
    if (vp[i].S == 'p') {
      ans += vp[i].F * pcnt;
      qcnt--;
    } else {
      ans += vp[i].F * qcnt;
      pcnt--;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 6384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ans = 0;
        for (int i = 0; i < s.length(); i++) {
            if("2".equals(s.substring(i, i + 1))) ans++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35744
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int n;cin >> n;
   vector<char> c(n);
   rep(i,n)cin>>c[i];
   vector<int> cnt_R;
   vector<int> cnt_W;
   cnt_R.push_back(0);
   cnt_W.push_back(0);
   rep(i,n)cnt_W.push_back(cnt_W[i]+(c[i]=='W'));
   rep(i,n)cnt_R.push_back(cnt_R[i]+(c[n-i-1]=='R'));
   reverse(cnt_R.begin(),cnt_R.end());
   int ans = n;
   for(int border = 0; border <= n; border++){
      int sum = 0;
      sum += max(cnt_R[border], cnt_W[border]);
      ans = min(ans, sum);
   }
   cout << ans << endl;
}

Measured memory_bytes: 5796
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    ld t, x;
    cin>>t>>x;
    out(t/x);
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG 
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, s, n) for (int i = s; i < n; i++)
#define all(v) v.begin(), v.end() // sort(all(array))
#define INF 1000000000LL
#define mod 1000000007
#define EPS 0.0001
using namespace std;
using ll = long long;
using vi = vector<int>; //vi array(要素数, 初期値)
using pll = pair<ll, ll>;
using pii = pair<int, int>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>; //vvi table(行数, vi(列数, 初期値))
using vvc = vector<vc>;
using vvs = vector<vs>;
using vvb = vector<vb>;

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    ll ans = max(a*c, max(a*d, max(b*c, b*d)));
    
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <queue>
#include <map>
#include <cstdio>

using namespace std;

int main(){
	int t=0,T,i,j,k;
	map<int,vector<int> >a;
	for(scanf("%d",&T); t<T; t++)for(scanf("%d%d",&i,&k); k--; a[i].push_back(j))scanf("%d",&j);
	map<int,int>m;
	queue<int>q;
	for(q.push(1),m[1]=1;!q.empty();){
		k = q.front();
		q.pop();
		for (i = 0; i < a[k].size(); i++){
		    if(!m[a[k][i]])m[a[k][i]]=m[k]+1,q.push(a[k][i]);
		}
	}
	for(i=1;i<=T;i++){
	    printf("%d %d\n",i,m[i]-1);
	}
}



Measured memory_bytes: 2840
import java.util.Scanner;
public class Main {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int K=sc.nextInt();
		int N=(sc.nextInt());
		int A[]=new int[N];
		int max=0;
		int maxi=0;
		A[0]=sc.nextInt();
		for(int i=1;i<N;i++) {
			A[i]=sc.nextInt();
			if(max<A[i]-A[i-1]) {
				max=A[i]-A[i-1];
				maxi=i;
			}
		}
		if(K-(A[N-1]-A[0])>max) {
			maxi=0;
			max=K-(A[N-1]-A[0]);
		}
		System.out.println(K-max);
	}
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

const ll mod = 1000000007;

template<typename T>
static inline void chmin(T & ref, const T  value) {
	if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T& ref, const T value) {
	if (ref < value) ref = value;
}



int main() {
	ll x; cin >> x;
	ll a = x / 200;
	cout << (10 - a) << endl;
	return 0;
}


Measured memory_bytes: 3632
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main(H, W, XY):
    U = 300_010
    row = np.zeros(U, np.int64)
    col = np.zeros(U, np.int64)
    
    for i in range(0, len(XY), 2):
        x, y = XY[i:i+2]
        row[x] += 1 ; col[y] += 1

    row_max = row.max() ; col_max = col.max()
    choice = np.sum(row == row_max) * np.sum(col == col_max)
    for i in range(0, len(XY), 2):
        x, y = XY[i:i+2]
        if row[x] == row_max and col[y] == col_max:
            choice -= 1
    ans = row_max + col_max
    return ans if choice else ans-1



H, W, M = map(int, readline().split())
XY = np.array(read().split(), np.int64)

print(main(H, W, XY))


Measured memory_bytes: 68952
#include <stdio.h>

int main(){
  int v[6];
  for(int i=0;i<6;i++){
    scanf("%d",&v[i]);
  }
  int count[5]={};
  for(int i=0;i<6;i++){
    if(v[i]==1) count[1]++;
    if(v[i]==2) count[2]++;
    if(v[i]==3) count[3]++;
    if(v[i]==4) count[4]++;
  }
  if(count[1]<3 && count[2]<3 && count[3]<3 && count[4]<3) printf("YES\n");
  else printf("NO\n");
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=3005;
int n,head[maxn],t[maxn<<1],ne[maxn<<1],num,v[maxn];
bool lose[maxn];
inline void addedge(int x,int y){
	ne[++num]=head[x];head[x]=num;t[num]=y;
	ne[++num]=head[y];head[y]=num;t[num]=x;
}
inline bool dfs(int x,int f){
	if(lose[x])return 0;
	bool die=0;
	forE(i,x)if(t[i]!=f){
		if(v[t[i]]>=v[x])continue;
		if(dfs(t[i],x)==0)die=1;
	}
	return die;
}
int main(){
	read(n);
	rep(i,1,n)read(v[i]);
	rep(i,1,n)head[i]=-1;
	rep(i,1,n-1){
		int x,y;read(x);read(y);
		addedge(x,y);
	}
	rep(x,1,n){
		lose[x]=1;
		forE(i,x)if(v[t[i]]<v[x])lose[x]=0;
	}
	rep(i,1,n)if(dfs(i,-1))printf("%d ",i);
	return 0;
}


Measured memory_bytes: 384
char s[1025];
i,w,f;
main(c){
	for(i=0;c=getchar(),c+1;i++){
		if(c==32||c==44||c==46){
			if(i-w>=3 && i-w<=6){
				s[i]=0;
				if(f)
					putchar(32);
				printf(s+w);
				f=1;
			}
			w=i+1;
		}
		s[i]=c;
	}
	exit(!puts(""));
}

Measured memory_bytes: 0
class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
    # ノードxのrootノードを見つける
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def unite(self, x, y):
    # 木の併合、入力は併合したい各ノード⇒(a,b)
        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):
    # ノードxが属する木のサイズを返す
        return -self.parents[self.find(x)]

    def same(self, x, y):
    # 入力ノード(x,y)が同じグループに属するかを返す
        return self.find(x) == self.find(y)

    def members(self, x):
    #ノード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())

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

n,m=map(int,input().split())
u=UnionFind(n)
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    u.unite(a,b)
ans=u.roots()
print(len(ans)-1)


Measured memory_bytes: 12848
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
LL A[100010],B[100010];
int use[100010];
int main(){
  LL ans;
  LL N;scanf("%lld",&N);
  vector<pair<LL,int>>ab;
  for(int i=0;i<N;i++){
    scanf("%lld%lld",&A[i],&B[i]);
    ab.push_back({A[i],i});
    ab.push_back({B[i],i});
  }
  sort(ab.begin(),ab.end());
  int i=0;
  LL sum=0;
  for(i=0;i<N;i++)sum+=ab[i].first;
  for(i=0;i<N;i++)use[ab[i].second]=1;
  for(i=0;i<N;i++)if(use[i]==0)break;
  if(i!=N)ans=sum;
  else{
    if(ab[N].second==ab[N-1].second)
      ans=sum+min(ab[N].first-ab[N-2].first,
                  ab[N+1].first-ab[N-1].first);
    else
      ans=sum+ab[N].first-ab[N-1].first;
  }
  for(i=0,sum=0;i<N;i++)sum+=A[i];
  ans=min(ans,sum);
  
  for(i=0,sum=0;i<N;i++)sum+=B[i];
  ans=min(ans,sum);
  
  printf("%lld\n",ans);
  return 0;
}

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

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

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

    for (int j = 0; j < n; j++){
        cout << array[n - 1 - j];
        if (j != n - 1) cout << " ";
    }

    cout << endl;
    return 0;
}


Measured memory_bytes: 3092
A,V = map(int, input().split())
B,W = map(int, input().split())
T = int(input())
if B < A:
    if (A - B) - (V - W) * T <= 0:
        print("YES")
    else:
        print("NO")
elif A < B:
    if (B - A) - (V - W) * T <= 0:
        print("YES")
    else:
        print("NO")
elif A == B:
    print("YES")


Measured memory_bytes: 9192
from heapq import heappush, heappop
import math

n = int(input())
v = list(map(int, input().split()))
hq = []
for i in range(n):
    heappush(hq, v[i])
for i in range(n-1):
    b = heappop(hq)
    c = heappop(hq)
    heappush(hq, (b+c)/2)
print(sum(hq))


Measured memory_bytes: 3060
a=-1,A=65,d;
char
*N="GKSOCNWLDFVTBRXHAJUPEMQI",
*E="PHLTIDOXQAGWECSUMBKVJFNR",
*R="BCDAFGHEJKLINOPMRSTQVWXU",
s[9];
main(c)
{
for(;c-48&&scanf("%s",s);a+=d/4+1)
{
(c=*s)<A?~a&&printf("%d\n",a),a=d=0:0;
d=c==78?d=N[d]-A:
c==69?d=E[d]-A:
c==82?d=R[d]-A:
c==83?d=N[N[N[d]-A]-A]-A:d;
if(c==87)d=E[E[E[d]-A]-A]-A;
if(c==76)d=R[R[R[d]-A]-A]-A;
}}

Measured memory_bytes: 0
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
const int MAXN=100005;

int N;
vector<int> adj[MAXN];
int col[MAXN];

bool dfs(int u,int f)
{
    if(adj[u].size()==1U)
    {
        col[u]=0;
        return false;
    }
    int cnt[2]={0};
    for(int i=0;i<(int)adj[u].size();i++)
    {
        int v=adj[u][i];
        if(v==f)
            continue;
        if(dfs(v,u))
            return true;
        cnt[col[v]]++;
    }
    if(cnt[0]>=2)
        return true;
    else if(cnt[0])
        col[u]=1;
    else
        col[u]=0;
    return false;
}

int main()
{
    scanf("%d",&N);
    for(int i=1;i<N;i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
	if(N&1)
		puts("First");
    else if(N==2)
        puts("Second");
    else
    {
        bool ans;
        for(int i=1;i<=N;i++)
            if(adj[i].size()>1U)
            {
                ans=dfs(i,0);
                break;
            }
        puts(ans?"First":"Second");
    }

    return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=INT_MAX,MOD=1e9+7;

int main(){
    int n; cin>>n;
    string s1,s2; cin>>s1>>s2;
    bool now=(s1[0]==s2[0]?1:0);
    long long ans=(s1[0]==s2[0]?3:6);
    int i=(s1[0]==s2[0]?1:2);
    for(;i<n;i++){
        if(s1[i]==s2[i]){
            ans*=(now?2:1);
            now=1;
        }else{
            ans*=(now?2:3);
            now=0;
            i++;
        }
        ans%=MOD;
        // cout<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
#define int long long
#define double long double
int gcd(int x,int y){
    if(y==0)return x;
    x=x%y;
    gcd(y,x);
}
int keta(int i){
    return to_string(i).length();
}
int keisan(int a,int b,int i){
    return a*i+b*keta(i);
}
main()
{
    int n,k;
    cin>>n>>k;
    vector<int>a(n);
    rep(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    vector<int>b(n-k+1);
    rep(i,n-k+1){
        b[i]=a[i+k-1]-a[i];
    }
    sort(b.begin(),b.end());
    cout<<b[0]<<endl;

}

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

int D;
int d[22];
long long ans;

bool analyze(int ndig) {
	int tmp = D;
	for (int i = ndig; i >= 1; --i) {
		d[i] = tmp % 10; tmp /= 10;
	}
	return tmp == 0;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> D;
	for (int ndig = 2; ndig <= 20; ++ndig) {
		bool odd = ndig % 2;
		if (!analyze(ndig)) continue;
			
		long long cur = 1; // current answer
		// d[1], d[2], ..., d[ndig]
		bool lef = 0 /* -> */, rig = 0 /* <- */;
		for (int dig = 1; dig <= ndig / 2; ++dig) {
			bool nlef = 0, nrig = 0;
			bool LEF = 0, RIG = 0;
			// opposite: ndig + 1 - dig
			int npair = 0;
			for (int i = 0; i <= 9; ++i) {
				for (int j = 0; j <= 9; ++j) {
					// check for validity
					if (dig == 1) {
						if (j == 0) continue;
						if (i < j) continue;
					}

					// I - J ~ [d[dig] + 1, d[dig]]
					// J - I = d[n + 1 - dig] || 10 + J - I = d[n + 1 - dig]
					int I = i, J = j;
					if (lef) I += 10; if (rig) --J;
					
					if (I - j == d[dig]) nlef = 0;
					else if (I - j == d[dig] + 1) nlef = 1;
					else continue;
					
					if (J - i == d[ndig + 1 - dig]) nrig = 0;
					else if (10 + J - i == d[ndig + 1 - dig]) nrig = 1;
					else continue;

					// now valid
					++npair;
					LEF = nlef;
					RIG = nrig;
				}
			}
			cur *= npair;
			lef = LEF;
			rig = RIG;
		}
		if (!odd && lef != rig) continue;
		else if (odd) {
			int cnt = 0;
			for (int i = 0; i <= 9; ++i) {
				int I = i;
				if (lef) I += 10;
				if (rig) I--;
				if (I - i == d[(ndig + 1) / 2]) ++cnt;
			}
			cur *= cnt;
		}
		ans += cur;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){

  int n;
  cin>>n;
  llong ans = 0;
  REP(i,n){
    int t;
    cin>>t;
    ans += t-1;
  }

  cout<<ans<<endl;

  return 0;
}

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


Measured memory_bytes: 2124
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
using namespace std;

template<class T>
void in(vector<T>& V) {
	for (auto itr = V.begin(); itr != V.end(); itr++)cin >> *itr;
	return;
}

template<class T>
void out(vector<T>& V) {
	for (T& itr : V)cout << itr << endl;
	return;
}

typedef pair<int, int> pii;
vector<vector<bool>> M;
vector<vector<int>> MM;
int H, W;

int main() {
	cin >> H >> W;
	M.resize(W, vector<bool>(H));
	for (int y = 0; y < H; y++) {
		string S;
		cin >> S;
		for (int x = 0; x < W; x++) {
			if (S[x] == '.')M[x][y] = true;
			else M[x][y] = false;
		}
	}
	MM.resize(W, vector<int>(H,-1));
	int l = 0;
	long long ans = 0;
	for (int x = 0; x < W; x++) {
		for (int y = 0; y < H; y++) {
			if (MM[x][y] != -1)continue;
			long long bl = 0,wh = 0;
			queue<pii> q;
			q.push(pii(x, y));
			while (!q.empty()) {
				int cx = q.front().first;
				int cy = q.front().second;
				q.pop();
				if (MM[cx][cy] != -1)continue;
				MM[cx][cy] = l;
				if (M[cx][cy] == true)bl++;
				else wh++;
				int vec[4][2] = {
					{0,1},{0,-1},{1,0},{-1,0}
				};
				for (int v = 0; v < 4; v++) {
					int dx = cx + vec[v][0];
					int dy = cy + vec[v][1];
					if (dx < 0 || dx >= W || dy < 0 || dy >= H)continue;
					if (MM[dx][dy] != -1)continue;
					if (M[dx][dy] == M[cx][cy])continue;
					q.push(pii(dx, dy));
				}
			}
			l++;
			ans += bl * wh;
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;

int main()
{
    int a;
    int first = true;
    while (cin >> a, a) {
        int b[4], ans[4];
        int kind[4] = {10, 50, 100, 500};
        cin >> b[0] >> b[1] >> b[2] >> b[3];

        int total = 0;
        loop(4, i) total += b[i] * kind[i];
        int oturi = total - a;
        for (int i = 3; i >= 0; i--) {
            int tmp = oturi / kind[i];
            ans[i] = b[i] - tmp;
            oturi -= tmp * kind[i];
        }

        if (!first) cout << endl;
        loop(4, i) if(ans[i] > 0) cout << kind[i] << ' ' << ans[i] << endl;
        first = false;
    }
}

Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <cmath>
#include <deque>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <iomanip>
using namespace std;
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define pf push_front
#define fs first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s; cin>>s;
    ll flag=0;
    for(ll i=0;i<s.size();i++)
    {
        if(s[i]=='7')
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
    {
        cout<<"Yes"<<endl;
    }
    else
    cout<<"No"<<endl;
}

Measured memory_bytes: 3612
package main

import "fmt"

var date int

func main() {
  fmt.Scan(&date)

  if date == 22 {
    fmt.Println("Christmas Eve Eve Eve")
  } else if date == 23 {
    fmt.Println("Christmas Eve Eve")
  } else if date == 24 {
    fmt.Println("Christmas Eve")
  } else {
    fmt.Println("Christmas")
  }
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

ll mpow(ll x, ll n) { ll y = 1; for (; n; n /= 2) { y = n % 2 ? y * x % MOD : y; x = x * x % MOD; } return y; }
struct Combination {
    static ll mpow(ll x, ll n) { ll y = 1; for (; n > 0; n /= 2) { y = n % 2 ? y * x % MOD : y; x = x * x % MOD; } return y; }
    vector<ll> fact, ifact;
    Combination(int n) : fact(n + 1), ifact(n + 1) {
        fact[0] = 1; for (int i = 0; i < n; ++i) fact[i + 1] = fact[i] * (i + 1) % MOD;
        ifact[n] = mpow(fact[n], MOD - 2); for (int i = n; i > 0; --i) ifact[i - 1] = ifact[i] * i % MOD;
    }
    ll operator ()(int n, int k) { return k < 0 || k > n ? 0 : fact[n] * ifact[n - k] % MOD * ifact[k] % MOD; }
} C(1e5 + 5);

int main() {
    int N;
    cin >> N;
    vector<int> A(N + 1);
    rep(i, N + 1) cin >> A[i];

    vector<int> idx(N + 1, -1);
    int x, y;
    rep(i, N + 1) {
        if (idx[A[i]] != -1) {
            x = idx[A[i]];
            y = i;
            break;
        }
        idx[A[i]] = i;
    }

    int out = x + (N - y);
    int in = y - x - 1;

    rep(k, 1, N + 2) {
        ll ans = C(N + 1, k);
        ans = (ans + MOD - C(out, k - 1)) % MOD;

        write(ans);
    }
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(ll i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
#define INF 1000000000000000LL
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
//DBG("","","","");

signed main(){
	IO_STREAM;
	int A,B;
	cin>>A>>B;
	rep(i,1,1001){
		int tax8,tax10;
		tax8  =i* 8/100;
		tax10 =i*10/100;
		if(tax8==A && tax10==B){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

int main() {
  int n;
  cin >> n;
  map<string,int> mp;
  rep(i,n) {
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    mp[s]++;
  }
  ll ans = 0;
  for(auto p: mp) {
    if(p.second>1) ans += (ll)p.second*(p.second-1)/2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 11136