akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

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

    string s, t;
    read(s, t);
    int N = s.length();

    bool f = s == t;
    rep(i, N) {
        char c = s.back();
        s.pop_back();
        s = c + s;
        f |= s == t;
    }

    print((f) ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(nullptr)
#define digit(N) cout << fixed << setprecision((N))
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

bool is_uruu(vector<int> &a, int x)
{
    int index = -1, n = a.size();

    for (int i = 0; i < n; i++)
    {
        if (x % a[i] == 0)
        {
            return (i + 1) % 2 == 1;
        }
    }

    return index == -1 && n % 2 == 0;
}

int main()
{
    int N, l, r;
    while (cin >> N >> l >> r)
    {
        if (N == 0)
            return 0;
        vector<int> a(N);

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

        int ans = 0;

        for (int i = l; i <= r; i++)
        {
            ans += is_uruu(a, i);
        }

        cout << ans << "\n";
    }
}


Measured memory_bytes: 3092
import sys
readline = sys.stdin.readline

mod = 10**9+7
def frac(limit):
    frac = [1]*limit
    for i in range(2,limit):
        frac[i] = i * frac[i-1]%mod
    fraci = [None]*limit
    fraci[-1] = pow(frac[-1], mod -2, mod)
    for i in range(-2, -limit-1, -1):
        fraci[i] = fraci[i+1] * (limit + i + 1) % mod
    return frac, fraci
frac, fraci = frac(1341398)
def comb(a, b):
    if not a >= b >= 0:
        return 0
    return frac[a]*fraci[b]*fraci[a-b]%mod

B, W = map(int, readline().split())
half = pow(2, mod-2, mod)
  
Kb = [pow(half, W+B-i+1, mod)*comb(B+W-i-1, W-1) for i in range(1, B+1)]
Kw = [pow(half, B+W-i+1, mod)*comb(B+W-i-1, B-1) for i in range(1, W+1)]


for i in range(B-2, -1, -1):
    Kb[i] = (Kb[i] + Kb[i+1])%mod
for i in range(W-2, -1, -1):
    Kw[i] = (Kw[i] + Kw[i+1])%mod

ans = [half]*(B+W)
for i in range(B):
    ans[i] = (ans[i]+Kb[i])%mod
for i in range(W):
    ans[i] = (ans[i]-Kw[i])%mod
print('\n'.join(map(str, ans[::-1])))

Measured memory_bytes: 163564
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
//while(true){
    int a=Integer.parseInt(sc.next());
    int b=Integer.parseInt(sc.next());
    int c=Integer.parseInt(sc.next());
    int count=0;
    for(int i=a;i<=b;i++){ 
    if(c%i==0)count++;
    }
    System.out.println(count);
//}
}
}


Measured memory_bytes: 26308
#include <iostream>
#include <math.h>
using namespace std;
 
int A, B;
int m;

int main(){
  if(scanf("%d %d", &A, &B)==1);
  
  m = A+B;
  if(m < A-B)m = A-B;
  if(m < A*B)m = A*B;
  
  printf("%d", m);
  
  return 0;
}

Measured memory_bytes: 256
# Cumulative Sum Bisect


class SegTree():
    def __init__(self, N, e=0, operator_func=lambda x,y:x+y):
        self.e = e

        self.N = N
        bitlen = (N).bit_length()
        self.size = 2**(bitlen if N&(N-1) else bitlen-1)
        self.node = [self.e] * (2*self.size)
        self.op = operator_func

    def set_list(self, l):
        for i,j in enumerate(l):
            self.node[i+self.size-1] = j
        for i in range(self.size-1)[::-1]:
            self.node[i] = self.op(self.node[2*i+1], self.node[2*i+2])
    
    def update(self, k, x):
        k += self.size - 1
        self.node[k] = x
        while k >= 0:
            k = (k - 1) // 2
            self.node[k] = self.op(self.node[2*k+1], self.node[2*k+2])

    def get(self, l, r):
        x = self.e
        l += self.size; r += self.size
        a, b = [], []

        while l<r:
            if l&1:
                a += [l-1]; l += 1
            if r&1:
                r -= 1; b += [r-1]
            l >>= 1; r >>= 1

        for i in a+(b[::-1]):
            x = self.op(x, self.node[i])
        return x

    def bisect_left(self, x):
        if x > self.node[0]:
            return self.N
        p, ans = 0, 0
        node_size = 2 * self.size - 1
        x -= 1

        while p < node_size:
            ans = p - (self.size - 1)
            p1, p2 = 2 * p + 1, 2 * p + 2

            if p1 < node_size and self.node[p1] <= x:
                x -= self.node[p1]
                p = p2
            else:
                p = p1
        
        return ans+1


if __name__ == "__main__":
    # ABC140-E sample
    N = int(input())
    l = [(j, i) for i, j in enumerate(map(int, input().split()))]
    l.sort(key=lambda x:-x[0])
    tree = SegTree(N)
 
    ans = 0
 
    for n, (value, idx) in enumerate(l, start=1):
        v = tree.get(0, idx + 1)
        a = tree.bisect_left(v - 1) if v > 1 else 0
        b = tree.bisect_left(v - 0) if v else 0
        c = tree.bisect_left(v + 1) if n-v>1 else N+1
        d = tree.bisect_left(v + 2) if n-v>2 else N+1
 
        tree.update(idx, 1)
        idx += 1
        ans += ((b-a)*(c-idx)+(d-c)*(idx-b)) * value
 
    print(ans)

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

using namespace std;

#define REP(var, n)  for (decltype(n) var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<decltype(var)>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

#define all(c) begin(c),end(c)

#define D(x) do { std::cerr << x << " "; } while (0)
#define D2(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)


template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}


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

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




auto solve() {
    int N, M;
    cin >> N >> M;
    vector<vi> edges(N);
    vi in(N, 0);
    REP(i, M) {
        int x, y;
        cin >> x >> y;
        --x, --y;
        edges[x].push_back(y);
        in[y]++;
    }

    vi topo;
    vector<bool> used(N, false);
    function<void(int)> topo_sort = [&](int v) {
        if(used[v]) return;
        used[v] = true;
        for(auto&&e: edges[v]) topo_sort(e);
        topo.push_back(v);
    };
    REP(i,N) topo_sort(i);
    reverse(all(topo));

    vll dp(N, 0);

    for(auto&&v: topo) {
        for(auto&&e: edges[v]) {
            chmax(dp[e], dp[v]+1);
        }
    }

    return *max_element(all(dp));
}


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

//    cout << (solve() ? "even" : "odd") << endl;
//    cout << (solve() ? "YES" : "NO") << endl;
    cout << solve() << endl;
//    solve();

    return 0;
}


Measured memory_bytes: 9464
#include <iostream>
#include <algorithm>
using namespace std;
int main () {
	unsigned int n,k;
	cin >>n>>k;
	int a[n];
	int kq=0;
	for (int i=0; i<n; i++) {
		cin >>a[i];
	}
	sort(a,a+n);
	for (int i=0; i<k; i++) {
		kq+=a[i];
	}
	cout <<kq;
	return 0;
}

Measured memory_bytes: 3128
def main():
    S = input()
    T = input()

    d = len(S) - len(T)
    t = len(T)
    ans = len(T)
    for s in range(d+1):
        x = len([1 for i in range(t) if S[s+i] != T[i]])
        ans = min(ans, x)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9064
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

int main()
{
    int a,b;
    cin>>a>>b;
    if(a*b%2==0)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
    
}

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

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


int main() {
    long long N, K;
    cin >> N >> K;
    cout << min(N % K, K - N % K) << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

void solve(vector<vector<vector<double>>>& dp, vector<vector<vector<bool>>>& filled, int n, int i, int j, int k)
{
    filled[i][j][k] = true;
    if (i == 0 && j == 0 && k == 0) {
        dp[i][j][k] = 0;
    } else {
        double tmp = n;
        if (i > 0) {
            if (!filled[i - 1][j][k]) {
                solve(dp, filled, n, i - 1, j, k);
            }
            tmp += i * dp[i - 1][j][k];
        }
        if (j > 0) {
            if (!filled[i + 1][j - 1][k]) {
                solve(dp, filled, n, i + 1, j - 1, k);
            }
            tmp += j * dp[i + 1][j - 1][k];
        }
        if (k > 0) {
            if (!filled[i][j + 1][k - 1]) {
                solve(dp, filled, n, i, j + 1, k - 1);
            }
            tmp += k * dp[i][j + 1][k - 1];
        }
        dp[i][j][k] = tmp / (i + j + k);
    }
}

int main()
{
    int n;
    cin >> n;
    int c[3] = { 0, 0, 0 };
    rep(i, n)
    {
        int a;
        cin >> a;
        c[a - 1]++;
    }

    vector<vector<vector<double>>> dp(n + 1, vector<vector<double>>(n + 1, vector<double>(n + 1)));
    vector<vector<vector<bool>>> filled(n + 1, vector<vector<bool>>(n + 1, vector<bool>(n + 1, false)));
    solve(dp, filled, n, c[0], c[1], c[2]);
    cout << fixed << setprecision(10) << dp[c[0]][c[1]][c[2]] << endl;

    return 0;
}

Measured memory_bytes: 224000
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };

int N;
int a[100005];
int odd;

signed main(){
    cin>>N;
    for(int i=0;i<N;++i)cin>>a[i];
    for(int i=0;i<N;++i){
        if(a[i]%2==0)odd++;
        if(a[i]%4==0)odd++;
    }
    if(N%2==0){
        if(odd>=N)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    else{
        if(odd>=N-1)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int MOD =1e9 + 7;
int fact(int u){
	int ret = 1;
	while(u){
		ret = ((long long)ret*u)%MOD;
		u--;
	}
	return ret%MOD;
}
int main(){
	//freopen("readin.txt","r",stdin);
	int n,m;
	cin >> n >> m;
	if(abs(n-m) > 1)return puts("0"),0;
	int ans = ((long long)fact(n)*fact(m))%MOD;
	if(n == m)ans=((long long)ans*2)%MOD;
	printf("%d\n",ans%MOD);
}

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

int main() {
    int n;
    std::cin >> n;
    std::vector<int> as(n);
    std::vector<int> bs(n);
    long long as_sum = 0;
    for (int i = 0; i < n; ++i) {
        int x = 0;
        std::cin >> x;
        as[i] = x;
        as_sum += x;
    }
    long long bs_sum = 0;
    for (int i = 0; i < n; ++i) {
        int x = 0;
        std::cin >> x;
        bs[i] = x;
        bs_sum += x;
    }

    if (as_sum == bs_sum) {
        if (as == bs) {
            std::cout << "Yes";
        } else {
            std::cout << "No";
        }
    } else if (as_sum > bs_sum) {
        std::cout << "No";
    } else {
        long long n_ops = bs_sum - as_sum;
        long long min_ops = 0;

        for (int i = 0; i < n; ++i) {
            if (bs[i] < as[i]) {
                min_ops += as[i] - bs[i];
            } else {
                if (bs[i] % 2 != as[i] % 2) {
                    min_ops += 1;
                }
            }
        }

        if (min_ops > n_ops) {
            std::cout << "No";
        } else {
            std::cout << "Yes";
        }
    }
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>
int main()
{
	int n,k,i,l,r,dis;
	scanf("%d %d",&n,&k);
	int x[n+1];
	for(i=1;i<=n;i++){
		scanf("%d",&x[i]);
	}
	int min = 2*abs(x[1]) + 2*abs(x[n]);
	for(i=1;i<=n-k+1;i++){
		l = x[i];
		r = x[i+k-1];
		if(l>=0){
			dis = abs(r);
		}if(r<=0){
			dis = abs(l);
		}else{
			if(abs(l)<abs(r))dis=abs(l)+abs(r-l);
			if(abs(l)>=abs(r))dis=abs(r)+abs(l-r);
		}
		if(min>dis)min=dis;
	}
	printf("%d",min);
	return 0;
}

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

int main() {
  int R,G,B,N;
  cin >> R >> G >> B >> N;
  int ans = 0;
  for (int i=0; i<N/R+1; i++) {
    for (int j=0; j<N/G+1; j++) {
      if ((N-i*R-j*G) < 0) {
        break;
      }
      if ((N-i*R-j*G) % B == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
def main():
  [k,a,b]=[int(x) for x in input().split()]
  
  if b-a<=2:
    print(k+1)
    exit()
  res=0
  while k>a:
    k-=2
    res+=b-a
  print(res+k+1)

if __name__ == '__main__':
  main()

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

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

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin >> n;
    while(n != 0)
    {
        int rem = n%10;
        if(rem == 7)
        {
            cout << "Yes" << endl;
            return 0;
        }
        n /= 10;
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<cmath>
using namespace std;
int main(void){
  int a,b,c;
  cin>>a>>b>>c;
  int x =abs(b-a);
  int y =abs(c-a);
  if(x>y)cout<<"B"<<endl;
  else cout<<"A"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	long long int a, b, c, d;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
	if(b < 0){
		if(c >= 0){
			printf("%lld", b * c);
		}
		else{
			printf("%lld", a * c);
		}
	}
	else{
		if(a >= 0){
			if(c >= 0){
				printf("%lld", b * d);
			}
			else{
				if(d >= 0){
					printf("%lld", b * d);
				}
				else{
					printf("%lld", a * d);
				}
			}
		}
		else{
			if(c >= 0){
				printf("%lld", b * d);
			}
			else{
				if(d >= 0){
					long long int max;
					if(a * c >= b * d){
						max = a * c;
					}
					else{
						max = b * d;
					}
					printf("%lld", max);
				}
				else{
					printf("%lld", a * c);
				}
			}
		}
	}

	return 0;
}

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

// main
int main(){
    string a, b;
    cin >> a >> b;

    string str1, str2;
    str1 = string(stoi(b), a[0]);
    str2 = string(stoi(a), b[0]);

    vector<string> str_v;
    str_v.push_back(str1);
    str_v.push_back(str2);
    sort(str_v.begin(), str_v.end(), greater<string>());

    cout << str_v[1] << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 1000005
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 1000000007
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define vll vector<ll>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
 
ll gcd(ll n1,ll n2){
	if(n2==0)
		return n1;
	if(n1%n2==0)return n2;
	return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent)
{
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%MOD;
		base=(base*base)%MOD;
		exponent/=2;
	}
	return ans;
}
vi v[MAX];
int dp[MAX];
void DFS(int node,int p)
{
	if(v[node].size()==1&&node!=1)
	{
		dp[node]=1;
		return;
	}
	int now=0;
	for(int i=0;i<v[node].size();i++)
	{
		int child=v[node][i];
		if(child!=p)
		{
			DFS(child,node);
			now^=dp[child];
		}
	}
	//cout<<node<<" "<<dp[node]<<endl;
	dp[node]=now+1;
}
int main()
{
	//cout<<dp[1]<<endl;
	ll n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	double one=(d-c)/2.0;
	one*=(n-1);
	double mo=(c+d)/2.0;
	double ff=abs(b-a);
	if(n%2==0)
	{
		for(int i=1;i<n;i+=2)
		{
			double lo=mo*i-one;
			double hi=mo*i+one;
			if(ff<=hi&&ff>=lo)
			{
				cout<<"YES"<<endl;
				return 0;
			}
		}
	}
	else
	{
		for(int i=0;i<n;i+=2)
		{
			double lo=mo*i-one;
			double hi=mo*i+one;
			if(ff<=hi&&ff>=lo)
			{
				cout<<"YES"<<endl;
				return 0;
			}
		}
	}
	/*for(int i=0;i<n;i++)
	{
		if(n%2==0)
		{

		}
	}
	int i=n-1;
	{
		double lo=ff-one*i;
		lo/=mo;
		//lo=fabs(lo);
		double hi=ff+one*i;
		hi/=mo;
		cout<<lo<<" "<<hi<<endl;
		if()
		if(hi<=i||lo<=i)
		{
			cout<<"YES"<<endl;
			return 0;
		}
	}*/
	cout<<"NO"<<endl;
}

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

int n;
int main(void){
    // Your code here!
    string S;
    cin >> S;
    int dp[100001];
    dp[0] = 0;
    

    for(int i = 0; i < S.size(); i++){
        if(S[i+1] == S[i]) {
            if(S[i+1] == '0') S[i+1] = '1';
            else S[i+1] = '0';
            dp[i+1] = dp[i] + 1;
        } else {
            dp[i+1] = dp[i];
        }
    }
    
    cout << dp[S.size()] << endl;
}


Measured memory_bytes: 896
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  int x=sc.nextInt(),y=sc.nextInt();
	  for(int i=0;i<=x;i++) {
		  if(i*2+(x-i)*4==y) {
			  System.out.println("Yes");
			  System.exit(0);
		  }
	  }
	  System.out.println("No");
  }
}



Measured memory_bytes: 35832
program main
  
  implicit none
  integer :: a, b
  integer :: i,n
  
  read(*,*) a,b
  
  n = 1 
  i = 0 
  do 
    
    if( n >= b ) exit
    n = n + a - 1 
    i = i + 1

  end do
  print*, i
end program main


Measured memory_bytes: 256
N = int(input())

A = list(map(int,input().split()))
import heapq
L = A[:N]
heapq.heapify(L)
sum_L = sum(A[:N])
L_list = []
L_list.append(sum_L)
for i in range(N):
    sum_L += A[N+i]
    heapq.heappush(L,A[N+i])
    sum_L -= heapq.heappop(L)
    L_list.append(sum_L)

A = list(map(lambda x:-x, A[::-1]))
R = A[:N]
heapq.heapify(R)
sum_R = sum(A[:N])
R_list = []
R_list.append(sum_R)


for i in range(N):
    sum_R += A[N+i]
    heapq.heappush(R,A[N+i])
    sum_R -= heapq.heappop(R)
    R_list.append(sum_R)
maxi = -10000000000000000000000000000
R_list = R_list[::-1]
for i in range(N+1):
    maxi = max(maxi,L_list[i] + R_list[i])

print(maxi)


Measured memory_bytes: 42720
import sys

input = sys.stdin.readline

N = int(input())
S = input().strip()

dic = {}
ans = 0

for i in range(N-2):
    dic['R'] = S[i+1:].count('R')
    dic['G'] = S[i+1:].count('G')
    dic['B'] = S[i+1:].count('B')
    for j in range(i+1, N-1):
        dic[S[j]] -= 1
        arr = ['R', 'G', 'B']
        if S[i] != S[j]:
            arr.remove(S[i])
            arr.remove(S[j])
            ans += dic[arr[0]]
            if j+j-i <= N-1 and S[j+j-i] == arr[0]:
                ans -= 1

print(ans)

Measured memory_bytes: 73900
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        solve();
    }

    private static void solve() {
        Scanner input = new Scanner(System.in);

        int p = input.nextInt();
        int q = input.nextInt();
        int r = input.nextInt();

        int a = p + q;
        int b = q + r;
        int c = r + p;

        int ans = Math.min(a, Math.min(b, c));

        System.out.println(ans);
    }
}


Measured memory_bytes: 23636
import math

def main():
    a, b, x = map(int, input().split())
    n_b = b//x + 1

    if a - 1 >= 0:
         n_a = (a - 1)//x + 1
    else:
        n_a = 0

    ans = n_b - n_a

    print(ans)

main()

Measured memory_bytes: 2940
N = int(input())
A = list(map(int,input().split()))

for i in range(1,N):
    A[i] += A[i-1]

diff_min = 10**16

for i in range(N):
    diff_min = min(diff_min,abs(A[N-1]-2*A[i]))

print(diff_min)


Measured memory_bytes: 26060
#include <cstdio>

const int N = 100000;

int n, a[N];

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++ i) {
        scanf("%d", a + i);
    }
    long long cnt = 0, need = 0;
    for (int i = 0, x; i < n; ++ i) {
        scanf("%d", &x);
        a[i] -= x;
        cnt += a[i];
        if (a[i] <= 0) {
            need += -a[i] + 1 >> 1;
        }
    }
    puts(need <= -cnt ? "Yes" : "No");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int A[4];
	for (int i = 0; i< 4; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < 4; i++) {
		if (A[i] == 1) {
			for (int i = 0; i<4; i++) {
				if (A[i] == 9) {
					for (int i = 0; i< 4; i++) {
						if (A[i] == 7) {
							for (int i = 0; i< 4; i++) {
								if (A[i] == 4) {
									cout << "YES" << endl;
									return 0;
								}
							}
						}
					}
				}
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}

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

// int N = 20;
// int A = 2;
// int B = 5;

int N, A, B;
int main() {
    cin >> N >> A >> B;
    int result = 0;
    for (int i = 1; i <= N; i++) {
        // 桁数の和を求める
        int target = i;
        int tmp = 0;
        while (true) {
            if (target == 0) {
                break;
            }
            tmp += target % 10;
            target /= 10;
        }
        
        if (A <= tmp && tmp <= B) {
            result += i;
        }
    }

    cout << result << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

    int n, c;
    cin >> n >> c;
    ++n;
    
    int total_p = 0, p;
    for ( int i=0; i<c; ++i ) {
	cin >> p;
	total_p += p;
    }

    p = total_p/n;
    if ( total_p%n != 0 ) ++p;

    cout << p << endl;
    return 0;
}



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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

ll MOD = 1e9+7;

class mint{
    ll n;
public:
    mint(ll m = 0){
        n = ((m % MOD) + MOD) % MOD;
    }
    mint operator-() const {
        return mint(-n);
    }
    mint& operator+=(const mint& m){
        n += m.n;
        if(n >= MOD) n -= MOD;
        return *this;
    }
    mint& operator-=(const mint& m){
        n += MOD - m.n;
        if(n >= MOD) n -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& m){
        n *= m.n;
        n %= MOD;
        return *this;
    }
    mint operator+(const mint& m) const{
        mint res(*this);
        res += m;
        return res;
    }
    mint operator-(const mint& m) const{
        mint res(*this);
        res -= m;
        return res;
    }
    mint operator*(const mint& m) const{
        mint res(*this);
        res *= m;
        return res;
    }
    mint pow(ll t) const{
        if(t == 0) return mint(1);
        mint m = pow(t>>1);
        m *= m;
        if(t & 1 == 1) m *= *this;
        return m;
    }
    // for prime modulo
    mint inv() const{
        return pow(MOD-2);
    }
    mint& operator/=(const mint& m){
        (*this) *= m.inv();
        n %= MOD;
        return *this;
    }
    mint operator/(const mint& m) const{
        mint res(*this);
        res /= m;
        return res;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.n;
        return os;
    }
};

ll K;
string S;

mint fact[2000001];
mint v25[1000001];
mint v26[1000001];

mint comb(ll a, ll b){
    return fact[a] / fact[a-b] / fact[b];
}

int main(){
    cin >> K;
    cin >> S;
    ll L = S.size();
    fact[0] = mint(1);
    for(int i=1;i<=2000000;i++) fact[i] = mint(i) * fact[i-1];
    v26[0] = v25[0] = mint(1);
    for(int i=1;i<=1000000;i++){
        v26[i] = mint(26) * v26[i-1];
        v25[i] = mint(25) * v25[i-1];
    }
    mint ans(0);
    for(int i=0;i<=K;i++){
        ans += comb(K-i+L-1,L-1) * v26[i] * v25[K-i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 36460
#include<iostream>

using namespace std;

typedef struct Dice
{
    int a[6];

    void Set(int b[])
    {
        for(int i=0;i<6;i++)
        {
            a[i]=b[i];
        }
    }

    void show()
    {
        for(int i=0;i<6;i++)
        {
            cout<<a[i]<<" ";
        }
        cout<<endl;
    }

    void roll(char ch)
    {
        int temp=a[0];
        switch(ch)
        {
        case 'N':
            a[0]=a[1];
            a[1]=a[5];
            a[5]=a[4];
            a[4]=temp;
            break;
        case 'E':
            a[0]=a[3];
            a[3]=a[5];
            a[5]=a[2];
            a[2]=temp;
            break;
        case 'R':
            temp=a[1];
            a[1]=a[2];
            a[2]=a[4];
            a[4]=a[3];
            a[3]=temp;
            break;
        }
    }

    bool Equal(struct Dice d)
    {

        for(int i=0;i<4;i++)
        {
            roll('N');
            for(int j=0;j<4;j++)
            {
                roll('E');
                for(int k=0;k<4;k++)
                {
                    roll('R');
                    bool flag=true;
                    for(int l=0;l<6&&flag;l++)
                    {
                        if(a[l]!=d.a[l])
                        {
                            flag=false;
                        }
                    }
                    if(flag)
                    {
                        return true;
                    }
                }
            }
        }


        return false;
    }

}Dice;


int main()
{
    int b[6];

    Dice d[101];

    int t;

    cin>>t;

    for(int i=0;i<t;i++)
    {
        for(int j=0;j<6;j++)
        {
            cin>>b[j];
        }
        d[i].Set(b);
    }

    for(int i=0;i<t;i++)
    {
        for(int j=0;j<t;j++)
        {
            if(i!=j)
            {
                if(d[i].Equal(d[j]))
                {
                    cout<<"No"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"Yes"<<endl;

    return 0;

}





Measured memory_bytes: 3084
#include<stdio.h>
int main()
{
	int H,W,i,j;
	while (1) {
		scanf("%d%d",&H,&W);
		if(H==0&&W==0)break;
		for (i=0;i<H;i++) {
			for (j=0;j<W;j++) printf("#");
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <ctime>
#include <unordered_map>
#include <iomanip>
#include <complex>
#include <cassert>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define deb(a) cerr<< #a << "= " << (a)<<"\n";

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
typedef complex<double> base;
typedef vector<int> vi;
typedef pair<int,int> pii;

template<class T> ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream; }
ll fpow(ll x, ll p, ll m){ll r=1; for (;p;p>>=1){ if (p&1) r=r*x%m; x=x*x%m; } return r;}
ll inv(ll a, ll b){ return a<2 ? a : ((a-inv(b%a,a))*b+1)/a%b; }
int gcd(int a, int b){ if (!b) return a; return gcd(b,a%b);}
ll gcd(ll a, ll b){ if (!b) return a; return gcd(b,a%b);}

int N,A,B,a[300010];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N >> A >> B;
	
	if (A+B-1>N || B<(N+A-1)/A){
		cout << -1 << "\n";
		return 0;
	}
	
	int p=1,i,k;
	for (k=0; k<=N-A; k++)
		if ((N-k+A-1)/A+k==B)
			break;
			
	
	for (i=N; i>k; i-=A){
		
		int l=max(k+1,i-A+1);
		
		
		while (l<=i)
			a[p++]=l++;
		
		
	}
	
	while (k)
		a[p++]=k--;
		
	for (i=1; i<=N; i++)
		cout << a[i] << " ";
	return 0;
}



Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <random>
#include <tuple>

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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1e9 + 7;


int main() {
    int n, m;
    cin >> n >> m;
    vector<ll> x(n), y(m);
    rep(i, n) cin >> x[i];
    rep(i, m) cin >> y[i];

    ll xsum = 0;
    rep(i, n-1) {
        int j = i + 1;
        xsum += (x[j]-x[i]) * (i+1) % MOD * (n-j) % MOD;
        xsum %= MOD;
    }

    ll ysum = 0;
    rep(i, m-1) {
        int j = i + 1;
        ysum += (y[j]-y[i]) * (i+1) % MOD * (m-j) % MOD;
        ysum %= MOD;
    }

    ll ans = xsum * ysum % MOD;
    cout << ans << endl;


    return 0;
}


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

int judge(int n)
{
  if(n<2)return 0;
  if(n==2)return 1;
  if(n%2==0)return 0;
  for(int i=3;i<=n/i;i+=2){
    if(n%i==0)return 0;
  }
  return 1;
}

int main()
{
  int n,m,sum=0;

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>m;
    sum+=judge(m);
  }
  cout<<sum<<endl;
  return 0;
}

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

typedef long long int ll;

ll mod = 1e9 + 7;

ll mul(ll a, ll b){
	return (mod+(a*b)%mod)%mod;
}

ll diff(ll a, ll b){
	return (mod+(a-b)%mod)%mod;
}

ll add(ll a, ll b){
	return (mod+(a+b)%mod)%mod;
}

ll dp[2001];

int main(){
	
	ll S;
	cin>>S;
	
	memset(dp, 0, sizeof(dp));
	dp[0] = 1;
	
	for(ll i=1;i<=S;++i){
		for(ll j=3;j<=S;j++){
			if(i-j>=0){
				dp[i] = add(dp[i], dp[i-j]);
			}
		}
	}
	cout<<dp[S];
}


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

int main(){
    int n,ans=0;
    cin>>n;
    vector<int>d(n);
    for(int i=0;i<n;i++){
        cin>>d.at(i);}
    sort(d.begin(),d.end());
    for(int i=1;i<n;i++){
        if(d.at(i)==d.at(i-1)){
            ans=1;
            break;
            }
        }
    if(ans==0){cout<<"YES"<<endl;}
    else{cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007


#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  ll bit=1,n,ans=1;
  cin>>n;
  if(n==1){
    cout<<1<<endl;
    return 0;
  }
  
  while(1){
    bit=(bit<<1)+1;
    if(bit<=n)ans++;
    else break;
  }
  cout<<ans<<endl;
  return 0;
}



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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

using namespace std;

const int maxn = 1e8;

vector<bool> sieve(maxn,1);

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a,b,t,at,ans=0;
	cin>>a>>b>>t; at=a;
	while(a<=t){
		ans+=b;
		a+=at;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 12416
#include "bits/stdc++.h"
using namespace std;typedef long long lint;typedef vector<lint> liv;
//#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(),v.end()
#define linf 1152921504606846976
#define MAXN 100010
#define md 1000000007//998244353

#define pb push_back
#define _vcppunko4(tuple) _getname4 tuple
#define _getname4(_1,_2,_3,_4,name,...) name
#define _getname3(_1,_2,_3,name,...) name
#define _trep2(tuple) _rep2 tuple
#define _trep3(tuple) _rep3 tuple
#define _trep4(tuple) _rep4 tuple
#define _rep1(n) for(lint i=0;i<n;++i)
#define _rep2(i,n) for(lint i=0;i<n;++i)
#define _rep3(i,a,b) for(lint i=a;i<b;++i)
#define _rep4(i,a,b,c) for(lint i=a;i<b;i+=c)
#define _trrep2(tuple) _rrep2 tuple
#define _trrep3(tuple) _rrep3 tuple
#define _trrep4(tuple) _rrep4 tuple
#define _rrep1(n) for(lint i=n-1;i>=0;--i)
#define _rrep2(i,n) for(lint i=n-1;i>=0;--i)
#define _rrep3(i,a,b) for(lint i=b-1;i>=a;--i)
#define _rrep4(i,a,b,c) for(lint i=a+(b-a-1)/c*c;i>=a;i-=c)
template<class T>
istream& operator>>(istream& is,vector<T>& vec);
template<class T,size_t size>
istream& operator>>(istream& is,array<T,size>& vec);
template<class T,class L>
istream& operator>>(istream& is,pair<T,L>& p);
template<class T>
ostream& operator<<(ostream& os,vector<T>& vec);
template<class T,class L>
ostream& operator<<(ostream& os,pair<T,L>& p);
template<class T>
istream& operator>>(istream& is,vector<T>& vec){ for(T& x: vec) is>>x;return is; }
template<class T,class L>
istream& operator>>(istream& is,pair<T,L>& p){ is>>p.first;is>>p.second;return is; }
//template<class T>
//ostream& operator<<(ostream& os,vector<T>& vec){ os<<vec[0];rep(i,1,vec.size())os<<' '<<vec[i];return os; }
//template<class T>
//ostream& operator<<(ostream& os,deque<T>& deq){ os<<deq[0];rep(i,1,deq.size())os<<' '<<deq[i];return os; }
template<class T,class L>
ostream& operator<<(ostream& os,pair<T,L>& p){ os<<p.first<<" "<<p.second;return os; }

inline void in(){}
template <class Head,class... Tail>
inline void in(Head&& head,Tail&&... tail){ cin>>head;in(move(tail)...); }
template <class T>
inline bool out(T t){ cout<<t<<'\n';return 0; }
inline bool out(){ cout<<'\n';return 0; }
template <class Head,class... Tail>
inline bool out(Head head,Tail... tail){ cout<<head<<' ';out(move(tail)...);return 0; }

#define rep(...) _vcppunko4((__VA_ARGS__,_trep4,_trep3,_trep2,_rep1))((__VA_ARGS__))
#define rrep(...) _vcppunko4((__VA_ARGS__,_trrep4,_trrep3,_trrep2,_trrep1))((__VA_ARGS__))
#define lin(...) lint __VA_ARGS__;in(__VA_ARGS__)
#define stin(...) string __VA_ARGS__;in(__VA_ARGS__)
#define vin(type,name,size) vector<type> name(size);in(name)
#define fi i.first
#define se i.second
#define YES(c) cout<<((c)?"YES\n":"NO\n")
#define Yes(c) cout<<((c)?"Yes\n":"No\n")

int main(){
	lin(n,l);
	vin(lint,a,n);
	lint t=-1;
	rep(n-1)if(a[i]+a[i+1]>=l){
		t=i;break;
	}
	if(t==-1)cout<<"Impossible\n";
	else{
		cout<<"Possible"<<endl;
		rep(i,t)
			cout<<i+1<<endl;
		rrep(i,t,n-1)
			cout<<i+1<<endl;
	}
}

Measured memory_bytes: 1664
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

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

int main(){
    int t;
    cin >> t;
    rep(zz,t){
        int n;
        cin >> n;
        vector<ll>a(n);
        rep(i,n)cin >> a[i];
        string s;
        cin >> s;
        vector<ll> basis;
        bool flag = 0;
        for(int i=n-1;i>=0;i--){
            if(s[i]=='0'){
                ll k = a[i];
                for(auto b:basis){
                    chmin(k,k^b);
                }
                if(k)basis.push_back(k);
            }else{
                ll k = a[i];
                for(auto b:basis){
                    chmin(k,k^b);
                }
                if(k!=0){
                    flag = 1;
                }
            }
        }
        cout << flag << "\n";
    }
    return 0;
}

Measured memory_bytes: 3120
import sys
sys.setrecursionlimit(10 ** 9)

N, M = map(int, input().split())

root = [-1] * N

def r(x):
    if root[x] < 0:
        return x
    else:
        root[x] = r(root[x])
        return root[x]


def unite(x, y):
    x = r(x)
    y = r(y)
    if x == y:
        return
    else:
        root[x] += root[y]
        root[y] = x


def size(x):
    x = r(x)
    # print(x)
    # print(root[x])
    return -root[x]


for i in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    unite(x, y)

# print(root)
# max_size = max(map(size, range(N)))
max_size = 0
for i in range(N):
    max_size = max(size(i), max_size)
print(max_size)

Measured memory_bytes: 35716
#include <stdio.h>

typedef long long int lli;
lli gcd(lli,lli);

typedef struct{
	long long int ax;
	long long int mx;
	lli ay;
	lli my;
	lli az;
	lli mz;
} are;

int main(void)
{
	are k;
	long long int x,y,z;
	long long int xn,yn,zn;
	long long int kbs;
	long long int i;
	i=0;
	while(scanf("%lld %lld %lld %lld %lld %lld",&k.ax,&k.mx,&k.ay,&k.my,&k.az,&k.mz),(k.ax || k.mx || k.ay || k.my || k.az || k.mz)){
		i=0;
		x=y=z=1;
		for(xn=1;;xn++){
			x=(k.ax*x)%k.mx;
			//printf("x=%d\n",x);
			if(x==1) break;
		}
		for(yn=1;;yn++){
			y=(k.ay*y)%k.my;
			if(y==1) break;
		}
		for(zn=1;;zn++){
			z=(k.az*z)%k.mz;
			if(z==1) break;
		}
		kbs=xn*yn/gcd(xn,yn);
		kbs=zn*kbs/gcd(zn,kbs);
		printf("%lld\n",kbs);
	}
	return 0;
}

lli gcd(lli a,lli b){
	int r=a%b;
	while(r!=0){
		a=b;
		b=r;
		r=a%b;
	}
	return b;
}

Measured memory_bytes: 600
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            long[] A = new long[N];
            int[] bitCnt = new int[60];
            for (int i = 0; i < N; i++) {
                A[i] = in.nextLong();
                for (int j = 0; j < 60; j++) {
                    if ((A[i] & (1L << j)) > 0) {
                        bitCnt[j]++;
                    }
                }
            }
            long ans = 0;
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < 60; j++) {
                    if ((A[i] & (1L << j)) > 0) {
                        bitCnt[j]--;
                    }
                }
                long pow2 = 1;
                for (int j = 0; j < 60; j++) {
                    long add = 0;
                    if ((A[i] & (1L << j)) > 0) {
                        add = N - i - 1 - bitCnt[j];
                    } else {
                        add = bitCnt[j];
                    }
                    add = (add * pow2) % 1_000_000_007;
                    ans = (ans + add) % 1_000_000_007;
                    pow2 = (pow2 * 2) % 1_000_000_007;
                }
            }
            out.println(ans);
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

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

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

    }
}



Measured memory_bytes: 79116
#include<stdio.h>

int F[44];
  
int fibonacci(int);

int main(){
  int n;
  int f;

  scanf("%d",&n);
  printf("%d\n",fibonacci(n));
  return 0;
}

int fibonacci(int n){
  if(n == 0 || n == 1) return 1;
  if(n == 44) return 1134903170;
  return fibonacci(n-2) + fibonacci(n-1);
}



Measured memory_bytes: 2036
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();

        String word = sc.next();

        if (word.length()>K) {
            word = word.substring(0, K);
            System.out.println(word + "...");
        }else {
            System.out.println(word);
        }
    }
}


Measured memory_bytes: 38692
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

ll mod = 1000000007;

template<class T>
class segtree {
	int n;
	vector<T> data;
	T def;
	function<T(T, T)> operation;
	function<T(T, T)> update;
	T _query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return def;
		if (a <= l && r <= b) return data[k];
		T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2);
		T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r);
		return operation(c1, c2);
	}
public:
	segtree(size_t _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update)
		:def(_def), operation(_operation), update(_update) {
		n = 1;
		while (n < _n) {
			n *= 2;
		}
		data = vector<T>(2 * n - 1, def);
	}
	void change(int i, T x) {
		i += n - 1;
		data[i] = update(data[i], x);
		while (i > 0) {
			i = (i - 1) / 2;
			data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
		}
	}
	T query(int a, int b) {
		return _query(a, b, 0, 0, n);
	}
	T operator[](int i) {
		return data[i + n - 1];
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int n, a, b;
	cin >> n >> a >> b;
	if (a > b) swap(a, b);
	vector<int> s(n);
	rep(i, n) cin >> s[i];
	segtree<int> dp(n + 1, 0, [](int a, int b) {return (a + b) % mod; }, [](int a, int b) {return b; });
	dp.change(0, 1); dp.change(1, 1);
	int left = 0;
	for (int i = 2; i <= n; i++) {
		int c = upper_bound(all(s), s[i - 1] - b) - s.begin();
		int cnt = dp.query(0, c + 1);
		dp.change(i, cnt);
		while (left < i - 1 && s[i - 1] - s[i - 2] < a || left == i - 1 && i >= 3 && s[i - 1] - s[i - 3] < a) {
			dp.change(left, 0);
			left++;
		}
	}
	int ans = 0;
	rep(i, n + 1) {
		ans += dp[i];
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3072