akhauriyash/Code-Regression huggingface dataset:
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

string max_s(string s1, string s2) {
    if (s1.size() == s2.size()) return s1 > s2 ? s1 : s2;
    else return s1.size() > s2.size() ? s1 : s2;
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        string a = ins(), b = ins();
        if (a == b) {
            cout << "EQUAL" << endl;
        } else if (max_s(a, b) == a) {
            cout << "GREATER" << endl;
        } else {
            cout << "LESS" << endl;
        }

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

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

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

bool judge(vector<ll> &a, vector<ll> &f, ll k, ll param) {
    ll minus = 0;
    ll n = a.size();
    vector<ll> a_temp(a.size());

    rep(i, n) {
        a_temp[i] = param / f[i];
        minus += max((ll)0, a[i] - a_temp[i]);
        if (minus > k) {
            return false;
        }
    }
    return true;
}

ll solve(vector<ll> &a, vector<ll> &f, ll k, ll l, ll r) {

    while (true) {
        if (judge(a, f, k, l)) {
            return l;
        }
        if (!judge(a, f, k, r)) {
            return r;
        }
        if (r - l == 1) {
            return r;
        }
        ll half = l + (r - l) / 2;
        bool result = !judge(a, f, k, half);
        if (result) {
            l = half;
        } else {
            r = half;
        }
    }
}

int main() {
    // source
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n), f(n);
    rep(i, n) { cin >> a[i]; }
    rep(i, n) { cin >> f[i]; }

    vector<ll> score(n);
    ll score_max = 0;
    rep(i, n) {
        score[i] = a[i] * f[i];
        score_max = max(score_max, score[i]);
    }

    sort(a.begin(), a.end());
    sort(f.begin(), f.end(), greater<ll>());

    ll ans = solve(a, f, k, 0, score_max);

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

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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

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

void prime_map(map<ll, ll> &m, ll num) {

    if (num == 1) {
        return;
    }
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }
    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }

        return;
    }
    prime_map(m, num);
    return;
}


Measured memory_bytes: 6528
#include <stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
const int MAXN=1000005;
vector <int> adj[MAXN];
int prof[MAXN],low[MAXN],padre[MAXN],cont,N,M,root;
bool usa[MAXN],ap[MAXN];
void articulationPoints(int v){
    int child=0;
    usa[v]=true;
    low[v]=prof[v]=++cont;
    for (int i=0; i<(int)adj[v].size(); i++){
        int w=adj[v][i];
        if (!usa[w]){
            child++;
            padre[w]=v;
            articulationPoints(w);
            low[v]=min(low[v],low[w]);
            if (padre[v]==-1 && child>1) ap[v]=true;
            if (padre[v]!=-1 && low[w]>=prof[v]) ap[v]=true;
        } else if(w!=padre[v]) low[v]=min(low[v],prof[w]);
    }
}
int main()
{
    scanf("%d%d",&N,&M);
    int a,b;
    for (int i=0; i<M; i++){
        scanf("%d%d",&a,&b);
        adj[a].push_back(b); adj[b].push_back(a);
    }
    fill(padre,padre+N,-1);
    articulationPoints(0);
    for (int i=0; i<N; i++)
        if (ap[i])printf("%d\n",i);
    return 0;
}

Measured memory_bytes: 31448
<?php
fscanf(STDIN,"%d",$n);
$h_li = explode(" ",trim(fgets(STDIN)));
$sum = array_sum($h_li);
$c = 0;
$flag = false;
while(!$sum==0){
  for($i=0;$i<$n;$i++){
    if(($flag&&$h_li[$i]==0) || ($i==$n-1&&$h_li[$i]>0)){
      $c++;
      $flag = false;
    }
    if($h_li[$i]>0){
      $h_li[$i]--;
      if($i!=$n-1){
      	$flag = true;
      }
      $sum--;
    }
  }
}

echo $c;
  

Measured memory_bytes: 16264
N,*H=map(int,open(0).read().split())
H[0]-=1
def main():
    ihmax=0
    hmax=H[0]
    for i in range(1,N):
        if H[i-1]<H[i]:
            ihmax=i-1
            H[i]-=1
            hmax=max(H[i],hmax)
        elif H[i-1]==H[i]:
            continue
        else:
            return 'No'
    return 'Yes'
print(main())

Measured memory_bytes: 20148
// Standard I/O
#include <iostream>
#include <sstream>
#include <cstdio>
// Standard Library
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
// Template Class
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
// Container Control
#include <algorithm>

using namespace std;

#define rep( i, n ) for( int i = 0; i < n; ++i )
#define irep( i, n ) for( int i = n-1; i >= 0; --i )
#define reep( i, s, n ) for ( int i = s; i < n; ++i )
#define ireep( i, n, s ) for ( int i = n-1; i >= s; --i )
#define foreach(itr, x) for( typeof(x.begin()) itr = x.begin(); itr != x.end(); ++itr)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all( v ) v.begin(), v.end()
#define fs first
#define sc second
#define vc vector

// for visualizer.html
double SCALE = 1.0;
double OFFSET_X = 0.0;
double OFFSET_Y = 0.0;
#define LINE(x,y,a,b) cerr << "line(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(a) + OFFSET_X << ","										\
	<< SCALE*(b) + OFFSET_Y << ")" << endl;
#define CIRCLE(x,y,r) cerr << "circle(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(r) << ")" << endl;

typedef long long ll;
typedef complex<double> Point;

typedef pair<int, int> pii;
typedef pair<int, pii> ipii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector< vector<int> > vii;
typedef vector< vector<double> > vdd;

typedef vector<int>::iterator vi_itr;

const int IINF = 1 << 28;
const int MOD = 1e9+7;
const double INF = 1e30;
const double EPS = 1e-10;
const double PI = acos(-1.0);

// Direction : L U R D
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1 };

ll powll ( ll x, ll n ) {
    if ( n == 0 ) return 1ll;
    return x*powll(x, n-1);
}

int main()
{
    int n;

    cin >> n;

    int ans = IINF;
    set<ll> six, nine;
    reep(i, 1, 12) {
        six.insert(powll(6, i));
        nine.insert(powll(9, i));
    }

    rep(i, n+1) {
        int x = i, y = n - i;
        int tmp = 0;
        
        {
            auto itr = six.rbegin();
            while ( itr != six.rend() ) {
                if ( x >= *itr ) {
                    int num = x / *itr;
                    x -= *itr * num;
                    tmp += num;
                }
                ++itr;
            }
        }
        {
            auto itr = nine.rbegin();
            while ( itr != nine.rend() ) {
                if ( y >= *itr ) {
                    int num = y / *itr;
                    y -= *itr * num;
                    tmp += num;
                }
                ++itr;
            }
        }

        ans = min(ans, tmp + x + y);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var DN = Sarray();
            var D = DN[0];
            var N = DN[1];
            if (N == 100) ++N;
            var ans = (long)Pow(100, D) * N;
            WriteLine(ans);

            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int N;
    ll E, T;
    cin >> N >> E >> T;
    ll x[N];
    rep(i, N) cin >> x[i];
    ll dp[N+1];
    fill(dp, dp+N+1, INF);
    dp[0] = 0;
    int pos1 = 0, pos2 = 0;
    ll m = INF;
    rep(i, N){
        if(dp[i] == INF) continue;
        while(pos1 < N && (x[pos1]-x[i])*2 < T) pos1++;
        chmin(dp[pos1], dp[i]+T);
        while(pos2 < N && (x[i]-x[pos2])*2 >= T){
            if(pos2 > 0) m += (x[pos2]-x[pos2-1])*2;
            chmin(m, dp[pos2++]);
        }
        if(pos2 > 0) chmin(dp[i+1], m+(x[i]-x[pos2-1])*2);
    }
    cout << dp[N]+E << endl;
}

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

using namespace std;


int main()
{
    int n;
    cin>>n;
    vector<int>v(1e6+5);
    vector<int>vis(1e6+5);
    for(int i=0;i<n;i++){
        int tm;
        cin>>tm;
        if(vis[tm]==1){
            v[tm]=1;
            continue;
        }
        for(int i=2*tm;i<=1e6;i+=tm){
            v[i]=1;
        }

        vis[tm]=1;
    }
    int ans=0;
    for(int i=1;i<=1e6;i++){
        if(vis[i]&&!v[i])
            ans++;
    }
    cout<<ans<<'\n';
    return 0;

}
/***
5 4 1
1000000000 1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1000000000 1000000000
3 4 730
60 90 120
80 150 80 150
*/


Measured memory_bytes: 11156
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;

constexpr static ll MOD = 1000000007ll;
constexpr static int INF = 1 << 28; // for x <= 10^9
constexpr static ll INFL = 1ll << 60; // for x <= 10^19

int main() {
    string s;
    cin >> s;
    int len = s.length();
    for (int i = 0; i < len; i++) {
        if (i % 2 == 0 && s[i] == 'L') {
            cout << "No" << endl;
            return 0;
        } else if (i % 2 == 1 && s[i] == 'R') {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    int n;
    cin >> n;
    int sum= 0;
    vector<int>B(n-1);
    vector<int>A(n,0);
    for(int i=0; i<n-1; i++){
        cin >> B[i];
    }
    for(int i=0; i<n-1; i++){
        A[i+1]= B[i];
        if(i==0 || A[i]>B[i]){
            A[i]= B[i];
        }
    }
    for(int x:A) cerr << x << " ";
    cout << accumulate(A.begin(), A.end(), 0) << endl;

}

Measured memory_bytes: 256
// https://beta.atcoder.jp/contests/abc076
// status:

#define SUBMIT
//#define DEBUG

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <queue>
#include <numeric>
#include <limits>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

int N, K;

int main() {
#ifdef SUBMIT
    auto& stream = cin;
#else
    auto program_input = std::string(R"(10
10
)");
    stringstream stream(program_input);
#endif
    stream >> N >> K;

    ui64 ans = 1;
    while (N != 0) {
        ans = min(2 * ans, ans + K);
        N--;
    }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x){
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x/10) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
ll mul(ll a,ll b,ll mod){long double c=1.;return (a*b-(ll)(c*a*b/mod)*mod)%mod;}
it qpow(int x,int m,int mod){
	int res=1,bas=x;
	while(m){
		if(m&1) res=(1ll*res*bas)%mod;
		bas=(1ll*bas*bas)%mod,m>>=1;
	}
	return res;
}
const int MAXN = 3e5+5,mod = 1e9+7;
int n,ans,bas[MAXN],cnt[65];
ll val[MAXN];
it add(int x,int y){
	return x+y>=mod?x+y-mod:x+y;
}
it mul(int x,int y){
	return 1ll*x*y%mod;
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	for(ri i=1;i<=n;++i)
		read(val[i]);
	bas[0]=1;
	for(ri i=1;i<60;++i)
		bas[i]=mul(bas[i-1],2);
	for(ri i=1;i<=n;++i){
		for(ri j=0;j<60;++j){
			if(val[i]&(1ll<<j))
				ans=add(ans,mul(bas[j],i-1-cnt[j])),++cnt[j];
			else
				ans=add(ans,mul(bas[j],cnt[j]));
		}
	}
	print(ans);
	return 0;
}

Measured memory_bytes: 2560
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn Agrawal coderbond007  PLEASE!! PLEASE!! HACK MY SOLUTION!!
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            String s = in.nextString();
            out.println(StringUtils.checkPalindrome(s) ? "Yes" : "No");
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = pread();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        private static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class StringUtils {
        public static boolean checkPalindrome(String s) {
            for (int i = 0, j = s.length() - 1; i < j; i++, j--) {
                if (s.charAt(i) != s.charAt(j)) {
                    return false;
                }
            }
            return true;
        }

    }
}



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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

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

    const int mod = 1e9 + 7;
    const int N = 22;
    const int B = 1 << 22;
    static int dp[N][B];
    fill(&dp[0][0], &dp[N - 1][B - 1] + 1, 0);
    dp[0][0] = 1;
    for (int i = 0; i < n; ++i) {
      for (int bit = 0; bit < (1 << n); ++bit) {
        if (__builtin_popcount(bit) != i) continue;
        for (int j = 0; j < n; ++j) {
          if (a[i][j] && (bit & (1 << j)) == 0) {
            (dp[i + 1][bit | (1 << j)] += dp[i][bit]) %= mod;
          }
        }
      }
    }
    cout << dp[n][(1 << n) - 1] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 360704
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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


	int n, m;
	cin >> n >> m;
	unordered_map<int, vector<int>> q;
	rep(i, n) {
		int a, b;
		cin >> a >> b;
		q[m - a].push_back(b);
	}

	long long ans = 0;
	priority_queue<int> pq;
	for (int i = m - 1; i >= 0;i--) {
		for (int a : q[i]) {
			pq.push(a);
		}

		if (!pq.empty()) {
			ans += pq.top();
			pq.pop();
		}
	}
	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 8868
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str[] = br.readLine().split(" ");
        int a = Integer.parseInt(str[0]);
        int b = Integer.parseInt(str[1]);
        int c = Integer.parseInt(str[2]);
        int count = 0;
        for(int i=a;i<=b;i++){
            if(c%i == 0){
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 24464
#include<bits/stdc++.h>
using namespace std;
#define int long long
void Digvijay()
{
    int n,d;
    cin>>n>>d;
    int cnt=0;
    while(n--)
    {
        int x,y;
        cin>>x>>y;
        double ans = sqrt(x*x+y*y);
        if(ans<=d)cnt++;
    }
    cout<<cnt<<"\n";
}
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int _=1;
    //cin>>_;
    for(int __=1;__<=_;__++)
    {
        Digvijay();
    }
}



Measured memory_bytes: 3664
// #include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;

int main(){
	//cin.sync_with_stdio(false); cin.tie(0);
	//cin >> sth; cout << sth;	
	int N, D;
	int R = 1;
	cin >> N >> D;
	if(N%(2*D+1) == 0) R = 0;
	cout << N/(2*D+1)+R;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>

using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

void dfs(int from, vector< vector<int> >& friends, vector<int>& group, int group_idx) {
    // cerr << "from: " << from << endl;
    if(group[from]!=-1) return;
    group[from] = group_idx;
    for(auto itr = friends[from].begin(); itr!=friends[from].end(); ++itr) {
        dfs(*itr, friends, group, group_idx);
    }
}

int main() {
    int N, M, K;
    cin >> N >> M >> K;

    vector<vector<int> > friends(N, vector<int>()), blocks(N, vector<int>());
    // cerr << "get input" << endl;
    REP(i, M) {
        int tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        friends[tmp1-1].push_back(tmp2-1);
        friends[tmp2-1].push_back(tmp1-1);
    }
    // cerr << "get input2" << endl;

    REP(i, K) {
        int tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        blocks[tmp1-1].push_back(tmp2-1);
        blocks[tmp2-1].push_back(tmp1-1);
    }

    // cerr << "dfs" << endl;
    int group_idx = 0;
    vector<int> group(N, -1);
    REP(i, N) {
        if(group[i]==-1) {
            dfs(i, friends, group, group_idx);
            group_idx++;
        }
    }
    
    // cerr << "print answer" << endl;
    map<int, int> group_population;
    REP(i, group_idx) group_population[i] = 0;
    REP(i, N) {
        group_population[group[i]]++;
    }

    REP(i, N) {
        int blocks_in_cluster = 0;
        for(auto itr = blocks[i].begin(); itr!=blocks[i].end(); ++itr)
            if(group[*itr] == group[i]) blocks_in_cluster++;
        cout << group_population[group[i]] - friends[i].size() - blocks_in_cluster - 1 << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 13440
ABCDE=[]
modABCDE=[]
for i in range(5):
  ABCDE+=[int(input())]
  if ABCDE[i]%10!=0:
    modABCDE+=[ABCDE[i]%10]  
if modABCDE!=[]:
  MIN=min(modABCDE)
else:
  MIN=10  
ans=sum(ABCDE)-sum(modABCDE)+(len(modABCDE)-1)*10+MIN
print(ans)

Measured memory_bytes: 3060
n,k = map(int,input().split())
pn = list(map(int,input().split()))
cn = list(map(int,input().split()))
ans = -float("inf")


for i in range(n): 
    start=i
    now=start
    total = 0 #ループ計
    ls = [0]

    for j in range(1, k+1):
        now = pn[now]-1
        total += cn[now]
        ans = max(ans, total)
        ls.append(total)
        if now == start:
            rp = j
            break
    else:
        continue  #roopなし

    if total <= 0:
        continue
    else:
        if k % rp == 0:
            ans2 = total * (k // rp-1) + max(ls)
            ans = max(ans, ans2)
        else:
            ans2 = total * (k//rp) + max(ls[:k%rp+1])
            ans = max(ans, ans2)
print(ans)


Measured memory_bytes: 81128
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int n,m,k,ans;

main(){
	int a,b;
	double t;
	cin>>a>>b>>t;
	t+=0.5;
	for(;t-(double)a>=0.0;t-=(double)a){
		ans+=b;
	}
	dans;
}





Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    final Scanner scanner = new Scanner(System.in);

    final int a = scanner.nextInt();
    final int b = scanner.nextInt();
    if ((a * b) % 2 == 0) {
      System.out.println("Even");
    } else {
      System.out.println("Odd");
    }

  }

}

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

int main(){
	int n;
	bool t[31];
	for(int i=0;i<31;i++){
		t[i]=0;
	}
	for(int i=0;i<28;i++){
		cin>>n;
		t[n]=1;
	}
	for(int i=1;i<31;i++){
		if(t[i]==0){
			cout<<i<<endl;
		}
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
using namespace std;

bool isupper(char x) {
  return x >= 65 && x <= 90;
}

bool islower(char x) {
  return x >= 97 && x <= 122;
}

int main() {
  string s;
  cin>>s;
  bool flag = true;
  if(s[0] != 'A') flag = false;
  int c = 0;
  fr(i,1,s.size()) {
    if(isupper(s[i])) {
      if(i < 2 || i == s.size()-1 || s[i] != 'C') flag = false;
      else c++;
    }
  }
  if(c != 1) flag = false;
  if(flag) cout<<"AC";
  else cout<<"WA";
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

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

fn main(){
    let a: u64 = read();
    println!("{}", (a + 1) / 2);
}



Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
 
int main(){
    int n, x[100], y[100], i, p;
    double sum, max = 0;
     
    scanf("%d", &n);
    for(i=0; i<n; i++) scanf("%d", &x[i]);
    for(i=0; i<n; i++) scanf("%d", &y[i]);
     
    for(p=1; p<=3; p++){
        sum = 0;
        for(i=0; i<n; i++){
            sum += pow(fabs(x[i]-y[i]), p);
        }
        switch(p){
        case 2:
            sum = sqrt(sum);
            break;
        case 3:
            sum = cbrt(sum);
            break;
        }
        printf("%f\n", sum);
    }
     
    for(i=0; i<n; i++){
        if(fabs(x[i]-y[i]) > max) max = fabs(x[i]-y[i]);
    }
    printf("%f\n", max);
     
    return 0;
}

Measured memory_bytes: 708
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    D, G = LI()
    pc = [LI() for _ in range(D)]

    # コンプリートする問題を全パターン試す
    # 足りない分があれば解いてない最高点数の問題で埋める
    ans = sum([i[0] for i in pc])
    for i in range(2 ** D):
        score = 0
        num = 0
        not_completed_max = -1
        for j in range(D):
            if i >> j & 1:
                score += pc[j][0] * (j + 1) * 100  + pc[j][1]
                num += pc[j][0]
            else:
                not_completed_max = max(j, not_completed_max)
        if score >= G:
            ans = min(num, ans)
        elif (G - score) // ((not_completed_max + 1) * 100) <= pc[not_completed_max][0]:
            ans = min(num + (G - score - 1) // ((not_completed_max + 1) * 100) + 1, ans)

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10032
#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 reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int n; cin >> n;
  vi32 a(n); cin >> a;
  map<int, int, greater<int>> se;
  rep(i, n) {
    auto x = se.upper_bound(a[i]);
    if (x == se.end()) {
      se[a[i]]++;
    } else {
      int v, w;
      tie(v, w) = *x;
      se[v]--;
      se[a[i]]++;
      if (se[v] == 0) {
        se.erase(v);
      }
    }
  }
  int ans = 0;
  each(s, se) ans += s.second;
  cout << ans << '\n';
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

 
int main() {

    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n)    cin >> a[i];

    int sum=0;
    rep(i,n)    sum+=a[i];

    int res=0;
    rep(i,n) {
        if(a[i]>=(sum+(4*m-1))/(4*m)) res++;
    }
    if(res>=m)  cout<<"Yes"<<endl;
    else    cout<<"No"<<endl;

 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree < pairs ,  null_type , greater<pairs>,  rb_tree_tag ,  tree_order_statistics_node_update > 
#define ll long long
#define lld long double
#define vc vector<ll>
const ll MOD=(1e9 +7);
typedef pair<ll,ll>pairs;
ll power(ll a, ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;b--;}a=(a*a)%MOD;b>>=1;}
    return res;}

int main() {
	// your code goes here
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	ll t,n,i,j,k,l,c,f;
	lld d;
	lld di,x,y;
	cin>>n>>d;
	ll cnt=0;
	for(i=1;i<=n;i++)
	{
	    cin>>x>>y;
	    di=sqrt(x*x+y*y);
	    if(di<=d)cnt++;
	}
	cout<<cnt;
	return 0;
}


Measured memory_bytes: 3832
n,k=[int(i) for i in input().split()]
s=0
#g=n*(n+1)//2
lim=10**9+7
ma=n*(n+1)//2
mi=n*(n+1)//2
for i in range(n+2-k):
    #print(mi,ma)
    s = (s+ma-mi+1)%lim
    ma -= i
    mi -= (n-i)
    #print(ma-mi+1)
print(s%lim)

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

#define STACK_MAX 100

    /* ※この例では，double型のデータを格納するスタックを作成 */
    int stack[STACK_MAX];
    /* スタック頂上の位置（最下部からのオフセット） */
    int stack_top=0;

    /* スタックへpush */
    void stack_push(int val)
   {

           /* 渡された値をスタックに積む */
     ++stack_top;
     stack[stack_top]=val;
   }

   /* スタックからデータをpop */
   int stack_pop(void)
   {

           /* いちばん上の値を返す */
           --stack_top;
           return stack[stack_top+1];

   }


int main(){
  int x;
  char s[100];
  int a,b;

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      a=stack_pop();
      b=stack_pop();


      stack_push(a+b);

    }
    else if ( s[0] == '-' ){
      a=stack_pop();
      b=stack_pop();


      stack_push(b-a);
    }
    else if ( s[0] == '*' ){
     a =stack_pop();
     b=stack_pop();
     

     stack_push(a*b);
    }
    else {
      x = atoi(s);

      stack_push(x);
    }
  }
  printf("%d\n", stack[1]);

  return 0;
}

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

typedef long long ll;
ll sticks[100005];
ll best[100005];

int main(){
	int N;
	cin >> N;
	for(int a = 0; a < N; a++){
		cin >> sticks[a];
	}
	sort(sticks, sticks + N);
	int bestcnt = 0;
	for(int a = 0; a + 1 < N; a++){
		if(sticks[a] == sticks[a + 1]){
			best[bestcnt++] = sticks[a];
			a++;
		}
	}
	if(bestcnt < 2){
		cout << 0;
	} else {
		cout << best[bestcnt - 1] * best[bestcnt - 2];
	}
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define i_love_u_Phuong ios_base::sync_with_stdio(0); cin.tie(0);

using ll = long long;
using namespace std;
using ld = long double;
const int MAXN=1e6 + 5;



int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
    i_love_u_Phuong;
    string s;
    string t;
    cin >> s;
    cin >> t;
    int ans=0;
    for(int i=0; i<3; ++i)
        if (s[i]==t[i]) ans++;
    cout << ans;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define endl '\n'
#define ld long double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }
 
/*
░░░░░░░░░░░░░░░░░░░░░░░░░
░░█▀▀▄░░░░░░░░░░░▄▀▀█░░░░
░░█░░░▀▄░▄▄▄▄▄░▄▀░░░█░░░░
░░░▀▄░░░▀░░░░░▀░░░▄▀░░░░░
░░░░░▌░▄▄░░░▄▄░▐▀▀░░░░░░░
░░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█░
░░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█░
░▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█░
░█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀░
░░▀▄░░▀░░▀▀▀░░▀░░░▄█▀░░░░
░░░░█░░░░░░░░░░░▄▀▄░▀▄░░░
░░░░█░░░░░░░░░▄▀█░░█░░█░░
░░░░█░░░░░░░░░░░█▄█░░▄▀░░
░░░░█░░░░░░░░░░░████▀░░░░
░░░░▀▄▄▀▀▄▄▀▀▄▄▄█▀░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░
*/
 
// I want to be the very best, like no one ever was, I will battle everyday to claim my rightful place
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
// I am questioning life and universe and 
// everything else after looking at this

const ll MAXN = 1005;
ll aa[MAXN][MAXN];

void solve(){
    ll h,w,a,b; cin>>h>>w>>a>>b;

    ll min_ = a, _ = w-a;

    if(_ < min_){
        cout<<-1<<endl;
        return;
    }

    ll min__ = b,__ = h-b;

    if(__ < min__){
        cout<<-1<<endl;
        return;
    }

    FOR(i,1,min__){
        FOR(j,1,min_) aa[i][j] = 1;
        FOR(j,min_+1,w) aa[i][j] = 0;
    }


    FOR(i,min__+1,h){
        FOR(j,1,min_) aa[i][j] = 0;
        FOR(j,min_+1,w) aa[i][j] = 1;
    }

    FOR(i,1,h){
        FOR(j,1,w) cout<<aa[i][j];
        cout<<endl;
    }
}   

signed main(){
 
   FastRead;    


    ll t;
    t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

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

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

using namespace std;

int main(){
    int a[8],b[8];
    rep(i,7)
        cin >>a[i]>>b[i];
    rep(i,7)
        cout <<a[i]-b[i] <<endl;
    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
 
#define DAY (24*60)
 
long long me[3][1500] = {};
 
int cbit(long long bit){
        int ans = 0;
        while(bit > 0){
                ans += (bit & 1);
                bit >>= 1;
        }
        return ans;        
}
 
int solve(int d, int y, long long bit1, long long bit2, long long bit3){
        if(d == 3) return cbit(bit1 & bit2 & bit3);
         
        int ans = 0;
        long long old1, old2, old3;
        old1 = old2 = old3 = 0;
         
        for(int i = y;i < DAY;i++){
                if(old1 != me[0][i] || old2 != me[1][i] || old3 != me[2][i]){
                        old1 = me[0][i];
                        old2 = me[1][i];
                        old3 = me[2][i];
                        ans = max(ans, solve(d+1, i+1, bit1 | old1, bit2 | old2, bit3 | old3));
                }
        }
         
        return ans;
}
 
int main(){
        int n;
         
        long long stbit[3][1500] = {};
        long long enbit[3][1500] = {};
         
        cin >> n;
        int sth, stm, enh, enm;
        for(long long i = 0;i < n;i++){
                for(int j = 0;j < 3;j++){
                        cin >> sth >> stm >> enh >> enm;
                        int st = sth*60 + stm;
                        int en = enh*60 + enm;
                        stbit[j][st] |= ((long long)1 << i);
                        enbit[j][en] |= ((long long)1 << i);
                }
        }
         
        long long next[3] = {};
         
        for(int i = 0;i < DAY;i++){
                for(int j = 0;j < 3;j++){
                        next[j] |= stbit[j][i];
                        me[j][i] = next[j];
                        next[j] = (next[j] & (~enbit[j][i]));
                }
        }
         
        cout << solve(0, 0, 0, 0, 0) << endl;
         
        return 0;
}



Measured memory_bytes: 3196
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)


int main(void)
{
	int n, d;
	scanf("%d %d", &n ,&d);

	int x[n][d];
	int i, j, k;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < d; j++)
		{
			scanf("%d", &x[i][j]);
		}
	}

	int ans, norm;
	ans = 0;
	for (i = 0; i < n; i++)
	{
		for (j = i + 1; j < n; j ++)
		{ 
			norm = 0;
			for (k = 0; k < d; k++)
			{
				norm += pow(abs(x[i][k] - x[j][k]), 2);
			}
			if (sqrt(norm) - (int)sqrt(norm) == 0) ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#define N 100
#define INFTY (1<<21)
#define LEN 1000

int Q[LEN];
int head = 0, tail = 0;

void enqueue(int x) {
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}

int dequeue() {
	int x = Q[head];
	head = (head + 1) % LEN; 
	return x;
}

int n, M[N][N];
int d[N];

void bfs(int s) {
	int i;
	int u, v;
	enqueue(s);
	for ( i = 0; i < n; i++) d[i] = INFTY;
	d[s] = 0;

	while ( head != tail) {
		u = Q[head];
		dequeue();
		for ( v = 0; v < n; v++) {
			if ( M[u][v] == 0 ) continue;
			if (d[v] != INFTY) continue;
			d[v] = d[u] + 1;
			enqueue(v);
		}
	}

	for ( i = 0; i < n; i++) {
		printf("%d %d\n",i + 1,(d[i] == INFTY ? (-1) : d[i]));
	}
}

int main() {
	int i, j;
	int u, k, v;

	scanf("%d",&n);
	for ( i = 0; i < n; i++) {
		for ( j = 0; j < n; j++) M[i][j] = 0;
	}

	for ( i = 0; i < n; i++) {
		scanf("%d%d",&u,&k);
		u--;
		for (j = 0; j < k; j++) {
			scanf("%d",&v);
			v--;
			M[u][v] = 1;
		}
	}

	bfs(0);

	return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll max_N = 1e6 + 50, INF = 1e15, MOD = 1e9 + 7;
ll N, heights[max_N];

int main()
{
    int min_cost[max_N];
    cin >> N;
    for (int i = 0; i < N; ++i)
        cin >> heights[i];
    min_cost[0] = 0;
    min_cost[1] = abs(heights[1] - heights[0]);
    for (int i = 2; i < N; ++i)
    {
        int opt1 = min_cost[i - 1] + abs(heights[i] - heights[i - 1]);
        int opt2 = min_cost[i - 2] + abs(heights[i] - heights[i - 2]);
        min_cost[i] = min(opt1, opt2);
    }
    cout << min_cost[N - 1] << "\n";
    return 0;
}

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

int main() {
    int n, i, min, max;
    long long a, sum;

    cin >> n;
    for (i = 0,
         min = numeric_limits<int>::max(),
         max = numeric_limits<int>::min(),
         sum = 0;
         i < n; i++) {
        cin >> a;
        sum += a;
        if (a < min) min = a;
        if (max < a) max = a;
    }
    cout << min << " " << max << " " << sum << endl;

    return 0;
}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
using namespace std;
int n,k,a[100001],ans=0;
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    cin>>a[i];
    sort(a+1,a+1+n);
    for(int i=n;i>=n-k+1;i--)
    ans+=a[i];
    cout<<ans<<endl;
    return 0;
}

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


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int a, b, k;
    cin >> a >> b >> k;

    if ((b - a + 1) / 2  < k) {
        for (int i = a; i <= b; i++) {
            cout << i << endl;
        }
        return 0;
    }
    for (int i = a; i < a+k; i++) {
        cout << i << endl;
    }
    for (int i = b-k+1; i <= b; i++) {
        cout << i << endl;
    }
	return 0;
}

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

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

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

    bool flg = true;

    const int d = w.size();
    for(int i = 0; i < d - 1; ++i){
        if(w[i].back() != w[i + 1].front()){
            flg = false;
        }
    }

    for(int i = 0; i < d; ++i){
        for(int j = i + 1; j < d; ++j){
            if(w[i] == w[j]){
                flg = false;
            }
        }
    }
    
    if(flg){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

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

  int ans = N;
  for (int i=0; i<=N; i++) {
    int c = 0;
    int t = i;
    while (t>0) c += t % 6, t /= 6;
    t=N-i;
    while (t>0) c += t % 9, t /= 9;
    if (ans>c) ans = c;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 888
/**
 * 
 */
import java.util.Scanner;

/**
 * @author Neeraj
 *
 */
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		long sum=0l;
		for(int i=1;i<=n;i++) {
			if(i%3==0||i%5==0)
				continue;
			else
				sum+=i;
		}
		System.out.println(sum);
	}

}


Measured memory_bytes: 35760
#include <iostream>
#include <vector>

int main()
{
  std::string w;
  std::cin >> w;
  std::vector<int> wordCount(26);
  
  for (auto word : w)
  {
    ++wordCount[word - 'a'];
  }
  bool isBeautiful = true;
  for (auto count : wordCount)
  {
    if (count % 2 != 0)
    {
      isBeautiful = false;
      break;
    }
  }
  if (isBeautiful == true)
  {
    std::cout << "Yes" << std::endl;
  }
  else
  {
    std::cout << "No" << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 256