akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <vector>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

constexpr ll LL_MOD = 1000000009;
constexpr int I_MOD = 1000000007;
constexpr double EPS = numeric_limits<double>::epsilon();
constexpr double PI = 3.14159265358979323846264338327950288;

template <class T> void scan(vector<T> &v);
void scan(vector<string> &v, bool isWord = true);
boost::dynamic_bitset<> scan(char trueValue = 'o');

class Point {
public:
  int cur;
  set<int> s;
  Point(int p) : cur(p), s({p}) {}
  bool in(int next) { return s.find(next) != end(s); }
  void add(int next) {
    cur = next;
    s.insert(next);
  }
};

int main(int argc, char *argv[]) {
  // INFILE();
  int n, m;
  cin >> n >> m;

  vector<vector<int>> edges(m);
  for (auto &e : edges) {
    e.resize(2);
    scan(e);
  }

  multimap<int, int> em;
  for (const auto &e : edges) {
    em.insert(make_pair(e[0], e[1]));
    em.insert(make_pair(e[1], e[0]));
  }

  queue<Point> q;
  Point point(1);
  q.push(point);

  int total = 0;
  while (!q.empty()) {
    Point next_p = q.front();
    q.pop();

    if (next_p.s.size() == n) {
      total++;
      continue;
    }

    auto keys = em.equal_range(next_p.cur);
    for (auto s = keys.first; s != keys.second; s++) {
      if (next_p.in(s->second)) {
        continue;
      }

      Point new_point = next_p;
      new_point.add(s->second);
      q.push(new_point);
    }
  }

  cout << total << "\n";
  return 0;
}

template <class T> void scan(vector<T> &v) {
  map<type_index, const char *const> m = {{typeid(int), "%d"},
                                          {typeid(ll), "%lld"},
                                          {typeid(double), "%lf"},
                                          {typeid(char), "%c"}};

  auto tFormat = m[typeid(T)];

  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

void scan(vector<string> &v, bool isWord) {
  if (isWord) {
    for (auto &n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

boost::dynamic_bitset<> scan(char trueValue) {
  string s;
  getline(cin, s);

  if (s.size() == 0) {
    getline(cin, s);
  }

  for_each(begin(s), end(s),
           [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
  return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


Measured memory_bytes: 2304
import numpy as np

n, m = map(int,input().split())

ss = np.zeros((n,m),int)

for i in range(n):
    s = list(map(int, input().split()))
    
    if s[0]>0:
        for k in s[1:]:
            ss[i,k-1]=1

c = ss.sum(0)

ans = np.sum(c==n)

print(ans)

Measured memory_bytes: 22252
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
int INF=1e9;
const long long mod=1e9+7;


int main(){
  int n;
  cin>>n;
  vector<int>x(n),y(n);
  vector<pair<int,int> >p(n);
  rep(i,n){
    cin>>x[i]>>y[i];
    p[i]=make_pair(x[i],y[i]);
  }
  sort(p.begin(),p.end());
  rep(i,n){
    cout<<p[i].first<<" "<<p[i].second<<endl;
  }
  return 0;
}


Measured memory_bytes: 4388
#include<iostream>
#include<vector>
#include<functional>
#include<algorithm>
#include<string>
#include<map>
#include<queue>

using namespace std;

int main(void){

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

    for(int i = 0;i < n;i++){
        while(1){
            if(a[i] % 2 == 0){
                ans++;
                a[i] /= 2;
            }else{
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#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 IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int X;
  cin >> X;

  int ans = 0;
  int now = 0;
  while(1){
    now += X;
    ans++;
    if(now >= 360) now -= 360;
    if(now == 0) break;
  }

  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline int read()
{
	int s=0,f=1;char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=1e5+20;
const int mod=1e9+7;

struct point {
	int x,y;
};
point p[maxn];
int ptot;

int n;

int sx[maxn],tx;

inline void init()
{
	static int a[maxn],b[maxn];
	n=read();int m=read();
	REP(i,1,n)a[i]=read();
	REP(i,1,m)b[i]=read();
	REP(i,1,n)
	{
		int t=a[i];
		if(t<b[1] || t>b[m]);
		else
		{
			int x,y;
			x=t-b[lower_bound(b+1,b+m+1,t)-b-1];
			y=*lower_bound(b+1,b+m+1,t)-t;
			p[++ptot]=(point){x,y};
		}
	}
	REP(i,1,ptot)sx[++tx]=p[i].y;
	sort(sx+1,sx+tx+1); tx=unique(sx+1,sx+tx+1)-sx-1;
	REP(i,1,ptot)p[i].y=lower_bound(sx+1,sx+tx+1,p[i].y)-sx;
	sort(p+1,p+ptot+1,[](point a,point b){ return a.x==b.x?a.y<b.y:a.x<b.x;});
}

int f[maxn];
int s[maxn];
inline void Add(int x,int d){ for(;x<=tx;x+=x&(-x))s[x]=(s[x]+d)%mod;}
inline int Sum(int x){ int res=0;for(;x;x-=x&(-x))res=(res+s[x])%mod;return res;}

inline void doing()
{
	int j=1,ans=0;
	REP(i,1,ptot)
	{
		while(j<i && p[j].x<p[i].x)
		{
			Add(p[j].y,f[j]);
			j++;
		}
		if(i==ptot || (p[i].x!=p[i+1].x || p[i].y!=p[i+1].y))
		{
			f[i]=(Sum(p[i].y-1)+1)%mod;
			ans=(ans+f[i])%mod;
		}
	}
	ans=(ans+1)%mod;
	printf("%d\n",ans);
}

int main()
{
	init();
	doing();
	return 0;
}


Measured memory_bytes: 2688
#include <iostream>

using namespace std;

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    if (a>b) {
        printf("%d", a+a-1);
    } else if (b>a) {
        printf("%d", b+b-1);
    } else {
        printf("%d", a+a);
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, k;
    cin >> n >> k;
    ll ans = 0;
    for(int b = 1; b <= n; ++b){
        if(k >= b)  continue;
        int per = b - k;
        int cnt = n / b;
        ans += (ll)cnt * per;
        int lb = b * cnt + k;
        ans += max(0, n - lb + 1);
        if(k == 0)  --ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/// Bismillahir Rahmanir Rahim
/* Mohammad Morsalin
   Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int long long
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ms2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pi pair<int,int>
#define tc(t) int t;cin>>t;while(t--)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define fi first
#define se second
#define PI acos(-1)
#define sz(a) (int)a.size();
#define IOS ios::sync_with_stdio(false);
using namespace std;
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
double sq(double x) {return x*x;}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
signed main()
{
    IOS
    int a,b,c,d;
    cin>>a>>b>>c>>d;
        while(a && c){
        c-=b;
        if(c<=0) {cout<<"Yes"<<endl; return 0;}
        a-=d;
        if(a<=0) {cout<<"No"<<endl; return 0;}
     }
}
///Alhamdulillah


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

string r,a;

bool input(){
  cin>>r>>a;
  if(r=="0")return false;
  return true;
}
int solve(){
  int x=0,y=0;
  for(int i=0;i<r.size();i++){
    for(int j=0;j<a.size();j++){
      if(r[i] == a[j]){
        if(i==j){
          y++;
        }else{
          x++;
        }
      }
    }
  }
  cout<<y<<" "<<x<<endl;
}


int main(){
  while(input()){
    solve();
  }

}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<bool> list(N, true);
  rep(i, K) {
    int d, a;
    cin >> d;
    rep(j, d) {
      cin >> a;
      list.at(a - 1) = false;
    }
  }

  int ans = 0;
  for (auto flag : list) {
    if (flag) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3640
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
// #define mp make_pair
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'
 #define int ll
vector<ll> ft(1, 1LL);

/*======================================================================*/

vll arr;
map<int, int> m;
void solve(){
    int n, ans= 0;
    cin >> n;
    rep(i, 0, n){
        int a;
        cin >> a;
        ans += m[i-a+1];
        m[a+i+1]++;
    }
    cout << ans;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 26292
#include<iostream>

using namespace std;

int main() {

	int N;
	cin >> N;

	string S, T;
	cin >> S >> T;

	string R = "";
	for (int i = 0; i < N; ++i)
	{
		R += S[i];
		R += T[i];
	}

	cout << R;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

mint dp[3005][3005][3];

int main(){
    int n, s;
    cin >> n >> s;
    mint ans(0);
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    dp[0][0][0] = mint(1);
    
    rep(i, n) rep(j, s+1) {
        dp[i+1][j][0] += dp[i][j][0];
        dp[i+1][j][1] += dp[i][j][0] + dp[i][j][1];
        dp[i+1][j][2] += dp[i][j][0] + dp[i][j][1] + dp[i][j][2];
        if (a[i]+j<=s) {
            dp[i+1][j+a[i]][1] += dp[i][j][0] + dp[i][j][1];
            dp[i+1][j+a[i]][2] += dp[i][j][0] + dp[i][j][1];
        }
    }
    
    
    cout << dp[n][s][2].x << endl;
    return 0;
}


Measured memory_bytes: 211840
#include <iostream>
#include <cstring>
#include <cassert>
using namespace std;

const int mod = 1000000007;

using ll = long long;
int N,C;
int a[410], b[410];
ll dp[410][410];
ll power[410][410];

ll modpow(ll x, ll y){
    if(y == 0) return 1;
    ll a = modpow(x, y/2);
    a *= a;
    a %= mod;
    if(y&1){
        a *= x;
        a %= mod;
    }
    return a;
}

ll rec(int p, int rc){
    ll &res = dp[p][rc];
    if(res != -1) return res;
    if(p == N-1){
        res = power[b[p]+1][rc] - power[a[p]][rc] + mod;
        res %= mod;
    } else {
        res = 0;
        for(int c = 0; c <= rc; ++c){
            ll x = power[b[p]+1][c] - power[a[p]][c] + mod;
            x *= rec(p+1, rc-c);
            x %= mod;
            res += x;
        }
        res %= mod;
    }
    return res;
}

int main(){
    while(cin >> N >> C){
        for(int i = 0; i <= 400; ++i){
            power[0][i] = 0;
            for(int j = 0; j <= 400; ++j){
                power[j+1][i] = power[j][i] + modpow(j,i);
                power[j+1][i] %= mod;
            }
        }
        for(int i = 0; i < N; ++i) cin >> a[i];
        for(int i = 0; i < N; ++i) cin >> b[i];
        memset(dp, -1, sizeof dp);
        cout << rec(0,C) << endl;
    }
}


Measured memory_bytes: 2816
def calc x, y, operand
  case operand
  when "+"
    x + y
  when  "-"
    x - y
  when "*"
    x * y
  when "/"
    x / y
  end
end

while input = $stdin.gets do
  stack = Array.new
  input.chomp.split(" ").each do |s|
    if s =~ (/[0-9]+/)
      s = s.to_f
      stack.push(s)
    else
      y = stack.pop
      x = stack.pop
      stack.push calc(x, y, s)
    end
  end

  printf "%.5f\n", stack[0]
end

Measured memory_bytes: 6128
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
  int N;
  cin >> N;
  int L[N];
  rep(i,N) cin >> L[i];
  sort(L,L+N);
  int ans=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      for(int k=j+1;k<N;k++){
        if(abs(L[i]-L[j])<L[k] && L[i]+L[j]>L[k]) ans++;
        if(L[i]+L[j]<=L[k]) break;
      }
    }
  }
  cout << ans << endl;
}

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

using namespace std;

int main() {
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;

    vector<int> vtx(N + 1);
    for (int i = 0; i < N; ++i) {
        cin >> vtx[i];
    }
    vtx[N] = X;
    int xmax = *max_element(vtx.begin(), vtx.end());

    vector<int> vty(M + 1);
    for (int i = 0; i < M; ++i) {
        cin >> vty[i];
    }
    vty[M] = Y;
    int ymin = *min_element(vty.begin(), vty.end());

    if (xmax < ymin) {
        cout << "No War" << endl;
    } else {
        cout << "War" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,b,r;
  cin >> n >> b >> r;
  long long t=b+r;
  long long a=n/t;
  long long s=n%t;
  if(s > b)s=b;
  cout << a * b + s << endl;
}


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

using namespace std;

const int maxn = 200100;

int n;
ll a[maxn];
map<ll,int> cnt;

int main() {
   // freopen("in.txt","r",stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n;
    for (int i=1;i<=n;i++) {
        cin>>a[i];
        a[i] = a[i-1]+a[i];
        cnt[a[i]]++;
    }
    ll ans=cnt[0];
    for (int i=1;i<=n;i++)
        if (cnt[a[i]]) {
            ans += 1ll*(cnt[a[i]]-1)*cnt[a[i]]/2;
            cnt[a[i]]=0;
        }
    cout<<ans<<endl;
}


Measured memory_bytes: 14336
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
#include <climits>
#include <algorithm>
#include <functional>
#include <string.h>
#include <numeric>
#include <math.h>

#define LOP(N) for(int i=0; i<N; i++)
#define LOOP(i, N) for(int i=0; i<N; i++)
#define LOOP_s(i, start, end) for(int i=start; i<end; i++)

typedef long long ll;

using namespace std;


int main() {
    int max, sum; cin >> max >> sum;
    ++max;
    
    int rest, count=0;
    LOOP(X, max) {
        LOOP(Y, max) {
            rest = sum - X - Y;
            if (rest < 0) break;
            if (rest < max) ++count;
            // cout << X << Y << rest << endl;
        }
    }
    cout << count;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

int main(){
    int N, M;
    cin >> N >> M;
    vector<string> A(N), B(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    for(int i=0;i<M;i++){
        cin >> B[i];
    }
    for(int ai=0;ai<N;ai++){
        for(int aj=0;aj<N;aj++){
            bool ok = true;
            for(int bi=0;bi<M;bi++){
                for(int bj=0;bj<M;bj++){
                    if(N <= ai + bi || N <= aj + bj || A[ai+bi][aj+bj] != B[bi][bj]){
                        ok = false;
                        break;
                    }
                }
                if(!ok) break;
            }
            if(ok){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
while True:
    try:
        #(a,b,c,d)=map(int,raw_input().split())
        n=input()
        cnt=0
        for a in xrange(10):
            for b in xrange(10):
                for c in xrange(10):
                    for d in xrange(10):
                        if a+b+c+d==n:
                            cnt+=1
        print(cnt)
    except EOFError: break

Measured memory_bytes: 4200
/*  -*- coding: utf-8 -*-
 *
 * 2905.cc: Colorful Drink
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int MAX_M = 100000;

/* typedef */

typedef pair<string,int> psi;

/* global variables */

char s[64];
psi ps[MAX_N];

/* subroutines */

/* main */

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

  for (int i = 0; i < n; i++) {
    int d;
    scanf("%s%d", s, &d);
    ps[i] = psi(string(s), d);
  }
  sort(ps, ps + n);

  int m;
  scanf("%d", &m);

  int pd = 0;
  for (int i = 0; i < m; i++) {
    scanf("%s", s);
    string c(s);
    psi r(c, pd);

    int k = upper_bound(ps, ps + n, r) - ps;
    if (k < n && ps[k].first == c)
      pd = ps[k].second;
    else {
      puts("No");
      return 0;
    }
  }

  puts("Yes");
  return 0;
}



Measured memory_bytes: 11124
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const int mod = 1e9 + 7;

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  vector<int> res = vector<int>((n + 1)/2, 0);
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    res[(n - x - 1) / 2]++;
  }
  ll ans = 1;
  for(int i = 0; i < (n + 1) / 2; i++){
    if(!(n % 2 == 1 && i == n / 2) && res[i] != 2){
      cout << 0 << endl;
      return 0;
    }else if(n % 2 == 1 && i == n / 2){
      if(res[i] != 1){
        cout << 0 << endl;
        return 0;
      }
    }else{
      ans = (ans * 2) % mod;
    }
  }
  cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void){
	int a, b;

	scanf("%d %d", &a, &b);
	if (a < b) {
		printf("a < b\n");
	}
	else if (a > b) {
		printf("a > b\n");
	}
	else {
		printf("a == b\n");
	}

	return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <cstdio>
#include <climits>
#include <cstring>
using namespace std;

int main () {
  int n;
  cin >> n;
  int a[n], cnt = 0, min;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (!i) min = a[i];
    if (min >= a[i]) {
      cnt++;
      min = a[i];
    }
  }
  cout << cnt;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
int main()
{
    int N;
    int total_W;
    while(cin>>N>>total_W)
    {
        vector<long long int> W(N+5),V(N+5),DP(100005,1e9+1);
        for(int i=0;i<N;i++)
        {
            cin >> W[i] >> V[i];
        }
        DP[0]=0;
        for(int i=0;i<N;i++)
        {
            for(int j=100000;j-V[i]>=0;j--)
            {
                DP[j]=min(DP[j],DP[j-V[i]] + W[i]);
            }
        }
        for(int j=100000;j>=0;j--)
        {
            if(DP[j]<=total_W)
            {
                cout<<j<<'\n';
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int aInt = sc.nextInt();
	int bInt = sc.nextInt();
	int seki = aInt * bInt;

	if((seki % 2) == 0) {
		System.out.println("Even");
	}else{
		System.out.println("Odd");
	}
	}
}

Measured memory_bytes: 35492
#include<iostream>
#include<set>

using namespace std;

int main(){
  set<string> HT;
  int n;
  cin >> n;
  for(int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    HT.insert(s);
  }
  printf("%d\n", HT.size());
  return 0;
}

Measured memory_bytes: 15728
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(a,b,n) for(ll a = (ll)(b); a < (ll)(n); a++)
#define mrep(i,n) for (ll i = (ll)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	ll n,h; cin >> n >> h;
	vint a(n); vint b(n);
	rep(i,n) cin >> a[i] >> b[i];
	sort(be(a)); sort(be(b));
	reverse(be(a)); reverse(be(b));
	ll A=a[0];
	ll ans=0;
	ll cut=0;
	rep(i,n) {
		if(A<b[i]) {
			cut++;
			ans+=b[i];
			if(ans>=h) {
				cout << cut << endl;
				return 0;
			}
		}
		else break;
	}
	cut+=(h-ans+A-1)/A;
	cout << cut << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll x,gain1,gain2,a,b,total,c;
  cin>>x;
  a=x/500;
  gain1=1000*a;
  b=x-(a*500);
  c=b/5;
  gain2=5*c;
  total=gain1+gain2;
  cout<<total<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

ll N, M;

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

  if(N > M / 2){
    cout << M / 2 << endl;
  }
  else{
    cout << N + (M - 2*N)/4 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, XY):
    rc = [False] * (N + 1)
    bn = [1] * (N + 1)

    rc[1] = True
    for x, y in XY:
        bn[x] -= 1
        bn[y] += 1
        if rc[x]:
            rc[y] = True
        if bn[x] == 0 and rc[x]:
            rc[x] = False

    return rc.count(True)


def main():
    N, M = read_int_n()
    XY = [read_int_n() for _ in range(M)]
    print(slv(N, M, XY))


if __name__ == '__main__':
    main()


Measured memory_bytes: 82900
def main
  n = gets.to_i
  a_code = "a".ord
  s = []
  n.times do
    chars = []
    26.times do |i|
      chars[i] = 0
    end
    str = gets.chomp
    str.length.times do |i|
      chars[str[i].ord-a_code] += 1
    end
    s << chars
  end

  min_chars = []
  26.times do |i|
    min = nil
    s.each do |str|
      min = str[i] if not min or str[i] < min
    end
    min_chars[i] = min
  end

  answer = ""
  min_chars.each_with_index do |char, i|
    char.times do
      answer += (a_code + i).chr
    end
  end
  puts answer
end

main


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main(){
  ios_base::sync_with_stdio (false);
  cin.tie(NULL);

  ll N;
  cin >> N;

  vl h(N, 0);

  FOR(i, 0, N) cin >> h[i];

  vl dp(N, 0);

  dp[0] = 0;
  dp[1] = abs(h[0]-h[1]);
  FOR(i, 2, N){
    dp[i] = min(dp[i-2]+abs(h[i-2]-h[i]), dp[i-1]+abs(h[i-1]-h[i]));
  }

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


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

int main()
{
    int n;
    scanf("%d",&n);
    int tmp = 0;
    for(int i=0;i<n;i++){
        int x;
        scanf("%d",&x);
        if(x%2==1)tmp++;
    }
    if(tmp%2==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 764
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
	double r;
	double p=3.141592653589;
	scanf("%lf", &r);
	//printf("%f %f\n",r*r*p,p);
	double x=r*r*p;double y=2.0*r*p;
	printf("%f %f\n",x,y); 
return 0;
}

Measured memory_bytes: 1232
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000007
#define inf 1000000000
#define pr1(a) cout << a << endl
#define pr2(a,b)cout << a <<  " " <<b<< endl
#define pr3(a,b,c) cout << a <<" " << b << " " << c << endl

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

int gcd(int a, int b){
    if(b==0)return a;
    gcd(b,a%b);
}
const int mx = 200015;
char a[4*mx];

void solve(){
    
    string s;
    cin >> s;

    int l = mx, r = mx+s.size() - 1;
    for(int i = 0;i<s.size();i++){
        a[l+i] = s[i];

    }

    int n;
    cin >> n;
    int rev = 0;
    while(n--){
        int t;
        cin >> t;

        if(t==2){
            int f;
            char c;
            cin >> f >> c;
            f--;

            if(rev%2){
                if(f){
                    //s = c + s;
                    a[--l] = c;
                }
                else {
                    //s = s + c;
                    a[++r] = c;
                    
                }
            }
            else{
                if(!f){
                    //s = c + s;
                    a[--l] = c;
                }
                else {
                    //s = s + c;
                    a[++r] = c;
                    
                }
               
            }
        }
        else 
            rev++;
    }

    if(rev%2){
        for(int i = r;i>=l;i--)
            cout << a[i];
        cout << endl;
    }
    else{
        for(int i = l;i<=r;i++){
            cout << a[i];
        }
        cout << endl;
    }

 
} 

signed main() 
{   
    IOS;
    int t = 1;
    //cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 
    

Measured memory_bytes: 1104
#include <stdio.h>
#include <math.h>

typedef struct {
double x;
double y;
}Point;

void kock(int n, Point a, Point b)
{
  if(n == 0){return;}
    Point s,t,u;
    double th=M_PI*60.0/180.0;
    
    s.x=(2.0*a.x+1.0*b.x)/3.0;
    s.y=(2.0*a.y+1.0*b.y)/3.0;
    t.x=(1.0*a.x+2.0*b.x)/3.0;
    t.y=(1.0*a.y+2.0*b.y)/3.0;
    u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
    u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;

    kock(n-1, a, s);
    printf("%.8f %.8f\n",s.x,s.y);
    kock(n-1, s, u);
    printf("%.8f %.8f\n",u.x,u.y);
    kock(n-1, u, t);
    printf("%.8f %.8f\n",t.x,t.y);
    kock(n-1, t, b);
}

int main(){
  Point a,b;
  int n;

  scanf("%d",&n);
  
  a.x=0;
  a.y=0;
  b.x=100;
  b.y=0;

  printf("%.8f %.8f\n",a.x,a.y);
  kock(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);
  return 0;
}


Measured memory_bytes: 2080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
ll n,h[40005],a[40005],d[40005],s[40005];
vector<pair<pair<ll,ll>,int> >M;
bool cmp(const pair<pair<ll,ll>,int> &a,const pair<pair<ll,ll>,int> &b){
	return 1LL*a.fi.fi*b.fi.sc < 1LL*b.fi.fi*a.fi.sc;
}
int main(){
	cin >> n;
	for(int i=0;i<=n;i++) cin >> h[i] >> a[i] >> d[i] >> s[i];
	ll C = 0;
	for(int i=1;i<=n;i++){
		if(a[i] <= d[0]){
			continue;
		}
		if(a[0] <= d[i]){
			puts("-1"); return 0;
		}
		C += (a[i]-d[0]);
		M.pb(mp( mp( (h[i]+a[0]-d[i]-1)/(a[0]-d[i]),a[i]-d[0]) , i ));
	}
	sort(M.begin(),M.end(),cmp);
	ll cur = 0;
	for(int i=0;i<M.size();i++){
		int m = M[i].sc;
		ll T = (h[m]+a[0]-d[m]-1)/(a[0]-d[m]);
		cur += 1LL * T * C;
		if(s[m] < s[0]) cur -= (a[m]-d[0]);
		if(cur >= h[0]){
			puts("-1"); return 0;
		}
		C -= (a[m]-d[0]);
	}
	printf("%lld\n",cur);
}

Measured memory_bytes: 5628
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define SZ(X) ((int)(X).size())
#define endl "\n";
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n,k,j;
	vector<int> a;
	cin>>n>>k;
	for (int i = 0; i < n; ++i)
	{
		cin>>j;
		a.push_back(j);

	}
	sort(all(a));
	int cnt=0;
	for (int i = 0; i< n; ++i)
	{
		if(a[i]>=k){
		 cnt++;	
		}
	}
	cout<<cnt;

   return 0;
}


Measured memory_bytes: 3900
a,b,c,d = map(int,input().split())

if a<c:
    if b>c:
        if b>d:
            print(d-c)
        else:
            print(b-c)
    else:
        print(0)
else:
    if d>a:
        if d>b:
            print(b-a)
        else:
            print(d-a)
    else:
        print(0)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}


int main() {
	int n,k;read(k);
	if(k<=500){
		n=k;printf("%d\n",n);rep(i,1,n){rep(j,1,n)printf("%d ",j);puts("");}
	}
	else{
		n=500;printf("%d\n",n);
		rep(i,1,n){rep(j,1,n){int x=(i+j)%n+1+(i&1?n:0);printf("%d ",x<=k?x:x-n);}puts("");}
	}
	return 0;
}


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

int main()
{
  int n;
  cin >> n;
  set<int> d;
  for (int i = 0; i < n; i++) {
    int cache;
    cin >> cache;
    d.insert(cache);
  }
  cout << d.size() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
/* clang-format off */
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  double r;
  cin >> r;
  cout << 2 * 3.14159265358979 * r;
  return 0;
}


Measured memory_bytes: 3788
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		String S = sc.next();
		String str = S.substring(0,K-1) + S.substring(K-1,K).toLowerCase() + S.substring(K,N);
		System.out.println(str);
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main(){
  int N;
  cin >> N;
  int upper[N+1], lower[N+1];

  for(int i=0;i<N+1;i++){
    upper[i] = 0;
    lower[i] = 0;
  }

  int sum = 0;
  for(int i=0;i<N;i++){
    int l;
    cin >> l;
    sum += l;
    upper[i+1] = sum;
  }

  sum = 0;
  for(int i=0;i<N;i++){
    int l;
    cin >> l;
    sum += l;
    lower[i+1] = sum;
  }

  int ans = 0;
  for(int i=1;i<=N;i++){
    ans = max(ans, upper[i]+ lower[N]-lower[i-1]);
  }

  cout << ans <<endl;
  
  

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
 
        
  int main(){
     long double a,b,c;
      cin>>a>>b>>c;
      lint x=a+b+2*sqrt(a)*sqrt(b);
      if(x<c)cout<<"Yes";
      else cout<<"No";
  }
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define zcin(type, a) type a; cin >> a;
#define zcout(a, sep1, b, sep2) cout << a << sep1 << b << sep2;
#define zfor(i, b, n) for (int i = b; i < n; ++i)
#define pb push_back

using namespace std;

int main()
{
	#ifdef ME
		freopen("input.txt", "r", stdin);
		//freopen("output.txt", "w", stdout);
	#endif
	zcin(int, n);
	map<int, int> zm;
	zfor(i, 1, n)
	{
		zcin(int, x);
		zm[x]++;
	}
	zfor(i, 1, n+1)
			cout << zm[i] << endl;
			

	return 0;
}


Measured memory_bytes: 13004
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) throws IOException {
     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
     
     
        //BufferedReader br=new BufferedReader(new FileReader("sample.txt"));
        String str=br.readLine();
        String[] st=str.split(" ");
        str=br.readLine();
        Dice dice1 =new Dice(st);
        dice1.roll(str);
        System.out.println(dice1.getd1());
    }
    }
class Dice{
 
String d1,d2,d3,d4,d5,d6;
 
    Dice(String[] s){
        d1=s[0];
        d2=s[1];
        d3=s[2];
        d4=s[3];
        d5=s[4];
        d6=s[5];
    }
         
    void roll(String s){
        String top,bot,back,front,left,right;
        for(int i=0;i<s.length();i++){
            char c=s.charAt(i);
        top=d1;
        bot=d6;
        front=d2;
        back=d5;
        left=d4;
        right=d3;
        switch(c){
        case 'N':
            top=d2;
            bot=d5;
            front=d6;
            back=d1;
            break;
         
        case 'S':
            top=d5;
            bot=d2;
            front=d1;
            back=d6;
            break;
        case 'W':
            top=d3;
            bot=d4;
            right=d6;
            left=d1;break;
         
        case 'E':
            top=d4;
            bot=d3;
            right=d1;
            left=d6;
            break;
        }
        d1=top;
        d2=front;
        d3=right;
        d4=left;
        d5=back;
        d6=bot;
         
    }}
    String getd1(){return d1;}
}


Measured memory_bytes: 24280
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef int64_t LL;
typedef uint64_t ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
template<class T, class... U> void DEBUG(const T &head, const U &... tail) { 
#ifdef HOME
    _W('#'); _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...);
#endif
}
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    LL X,Y;
    R(X,Y);
    if(X%Y==0)W(-1);
    else{
        LL v=Y/X*X;
        while(v<=Y||v%Y==0)v+=X;
        W(v);
    }
    return 0;
}


Measured memory_bytes: 256
=begin
－－－－－－－－－－－－－－
  N = 入力値
  cnt = 桁数
  ans = 答え
－－－－－－－－－－－－－－
  digitsメソッドを作成(num)
    1: cnt += 1
    2: num /10
    3. num < 0 になったら cnt を返す
  メソッド－－－－－－－－－－

  1: 1 ~ N まで繰り返す(i)
  2: digits(i) % 2 が 0 以外なら ans += 1
  3: ans を出力
=end

def digits(num)
  cnt = 0;
  while num > 0
    cnt += 1;
    num /= 10;
  end
  return cnt;
end

n = gets.to_i;
ans = 0;

(1..n).each do |i|
  ans += 1 unless digits(i) % 2 == 0
end

puts ans

Measured memory_bytes: 3836
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,m = li()
py = []
for _ in range(m):
    py.append(list(li()))

order = [{} for _ in range(n+1)]
cnt = [0]*(n+1)

for p,y in sorted(py, key=lambda x:x[1]):
    order[p].update({y: cnt[p]})
    cnt[p] += 1


for p,y in py:
    cnt[p] += 1
    ans = str(p).zfill(6) + str(order[p][y]+1).zfill(6)
    print(ans)

Measured memory_bytes: 71564
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<queue>
using namespace std;
typedef long long s64;

const int ONE = 100005;

int get()
{
        int res = 1, Q = 1; char c;
        while( (c = getchar()) < 48 || c > 57)
            if(c == '-') Q = -1;
        if(Q) res = c - 48;
        while( (c = getchar()) >= 48 && c <= 57)
            res = res * 10 + c - 48;
        return res * Q;
}

s64 n;
int now;
deque <int> q;

void Solve(s64 n)
{
		if(n == 1) return;
		if(n & 1) Solve(n - 1), q.push_front(++now);
		else Solve(n / 2), q.push_back(++now);
}

int main()
{
		cin >> n;
		Solve(++n);
		printf("%d\n", now << 1);
		while(!q.empty())
			printf("%d ", q.front()), q.pop_front();
		for(int i = 1; i <= now; i++)
			printf("%d ", i);
}

Measured memory_bytes: 256
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N, M = get_ints

def divisor(n)
  result = SortedSet.new
  result.add(1); result.add(n)
  i = 1
  num = Math.sqrt(n)
  while i <= num do
    remainder = n % i
    if remainder == 0
      result.add(i)
      result.add(n/i)
    end
    i += 1
  end
  result.to_a
end

mx = divisor(M)

ans = mx.reverse.find { |m| m * N <= M }

puts ans


Measured memory_bytes: 14460