akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/

int main()
{
	ll n, k;
	vector<ll> a;
	
	cin >> n >> k;
	a.resize(n);
	
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] == k) {
			cout << "POSSIBLE";
			return 0;
		}
	}

	sort(a.begin(), a.end());

	if (a[n - 1] < k) {
		cout << "IMPOSSIBLE";
		return 0;
	}

	ll minsub;
	bool flug = true;
	while (flug) {
		minsub = LONG_MAX;
		ll length = a.size();
		for (ll i = 0; i < length - 1; i++) {
			if (abs(a[i + 1] - a[i]) > 0) {
				minsub = min(minsub, abs(a[i + 1] - a[i]));
			}
		}
		if (minsub == k) {
			cout << "POSSIBLE";
			return 0;
		}

		for (ll i = 0; i < length; i++) {
			if (a[i] == minsub) {
				flug = false;
				break;
			};
		}
		if (flug) {
			a.push_back(minsub);
			sort(a.begin(), a.end());
		}
	}

	sort(a.begin(), a.end());

	if (a[0] == 1) {
		cout << "POSSIBLE";
	}
	else {
		ll length = a.size();
		if (k%a[0] == 0&&a[length-1]!=a[0]) {
			cout << "POSSIBLE";
			return 0;
		}
		else {
			cout << "IMPOSSIBLE";
			return 0;
		}

	}


	return 0;
}

Measured memory_bytes: 1792
from itertools import combinations
import sys

l,r = map(int,input().split())

if r-l> 2019:
    print(0)
    sys.exit(0)

A = list(range(l,r+1))

ans_L = [i[0]*i[1]%2019 for i in combinations(A,2)]
print(sorted(ans_L)[0])


Measured memory_bytes: 111916
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？


k=ii()
arr=list(ss())

if len(arr)<=k:
    print("".join(arr))
else:
    print("".join(arr[:k])+"...")



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

int main(){
	int n,ans=0;
	cin>>n;
	vector<int>p(n);
	for(int i=0;i<n;i++) cin>>p[i];
	for(int i=1;i<n-1;i++){
		if(p[i]>p[i-1] && p[i]<p[i+1]){
			ans++;
		}else if(p[i]<p[i-1]&& p[i]>p[i+1]){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2)%MOD;
  return x%MOD*POW(x,n-1)%MOD;
}

ll POW2(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW2(x*x,n/2);
  return x*POW2(x,n-1);
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}

ll lcm(ll u, ll v) {
  return u*v/gcd(u,v);
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll KAI2(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI2(m-1);
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll COM2(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI2(m)/KAI2(n)/KAI2(m-n);
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

struct UnionFind {
  vector< long > data;
 
  UnionFind(long sz) {
    data.assign(sz, -1);
  }
 
  bool unite(long x, long y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  long find(long k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  long size(long k) {
    return (-data[find(k)]);
  }
};

int main()
{
  long n,m,x[120000],y[120000],z[120000],p=0;
  cin >> n >> m;
  rep(i,m)cin >> x[i] >> y[i] >> z[i];
  UnionFind uf(n);
  rep(i,m){
    if(uf.find(x[i])!=uf.find(y[i])){
      uf.unite(x[i],y[i]);
      p++;
    }
  }
  printf("%ld",n-p);
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define intt int64_t
#define all(vec) vec.begin(), vec.end()
#define INF 2000000000
#define MOD 1000000007

int main() {
    string s;
    cin >> s;
    int a=(-1), z=(-1);
    rep(i,s.size()) {
        if (a == (-1) && s.at(i) == 'A') a = i;
        if (z == (-1) && s.at(s.size()-i-1) == 'Z') z = s.size()-i-1;
    }
    printf("%d\n", z-a+1);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) REP(i, 0, n)
#define REP(i, s, e) for(int i = (int)(s); i < (int)(e); ++i)
#define repr(i, n) REP(i, n, 0)
#define REPR(i, s, e) for(int i = (int)(s-1); i >= (int)(e); --i)
#define all(X) (X).begin(), (X).end()
#define pb push_back

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int odd = 0;
  rep(i, n) if(a[i]& 1) odd++;
  cout << (odd&1 ? "NO": "YES") << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
void init_ios() {ios_base::sync_with_stdio(false); cin.tie(nullptr);}

string s;

int main() {
    cin >> s;
    string t;

    if (s == "zyxwvutsrqponmlkjihgfedcba") {
        cout << -1 << endl;
        return 0;
    }

    vector<int> latin(26);
    for (auto& c : s) {
        ++latin[c-'a'];
    }

    if (s.size() == 26) {
        for (int i = 25; 0 <= i; --i) {
            vector<char> tmp;
            for (int j = i+1; j < 26; ++j) {
                if (s[j] < s[i]) continue;
                tmp.push_back(s[j]);
            }
            if (tmp.size()) {
                sort(tmp.begin(), tmp.end());
                t = string(s.begin(), s.begin()+i) + *tmp.begin();
                break;
            }
        }
    } else {
        t = s;
        for (int i = 0; i < 26; ++i) {
            if (latin[i]) continue;
            t += 'a'+i;
            break;
        }
    }

    cout << t << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include<iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<deque>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

using namespace std;

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

vector<vector<ll> > v(30000);

int main()
{
	ll n,k;cin >> n >> k;
	
	REP(i,n)
	{
		ll a,b;
		char c;
		cin >> a >> b >> c;
		if(c != 'W')
		{
			if(a < k)a += k;
			else a -= k;
		}
		a = a % (2LL*k);
		b = b % (2LL*k);
		v[a].PB(b);
		
	//	cout << a << ' ' << b << endl;
	}
	
	ll ans = 0;
	REP(i,k+1)
	{
		ll l = i;
		ll r = i+k-1;
		ll now = 0;
		REP(j,2*k)
		{
			if(j >= k)
			{
			//	cout << "!!" << endl;
				REP(q,v[j].size())
				{
					ll tmp = v[j][q];
					if(tmp >= l && tmp <= r)now++;
					else now--;
				}

				REP(q,v[j-k].size())
				{
					ll tmp = v[j-k][q];
					if(!(tmp >= l && tmp <= r))now++;
					else now--;
				}
			}
			else
			{
			//	cout << "!!!" << endl;
				REP(q,v[j+k].size())
				{
					ll tmp = v[j+k][q];
					if(!(tmp >= l && tmp <= r))now++;
				}
				
				REP(q,v[j].size())
				{
					ll tmp = v[j][q];
					if(tmp >= l && tmp <= r)now++;
				}
			}	
			
			ans = max(ans,now);
			//cout << i << ' ' << j << ' '<< now << endl;
		}
	}
	
	REP(i,k+1)
	{
		ll l = i;
		ll r = i+k-1;
		ll now = 0;
		REP(j,2*k)
		{
			if(j >= k)
			{
			//	cout << "!!" << endl;
				REP(q,v[j].size())
				{
					ll tmp = v[j][q];
					if(!(tmp >= l && tmp <= r))now++;
					else now--;
				}

				REP(q,v[j-k].size())
				{
					ll tmp = v[j-k][q];
					if((tmp >= l && tmp <= r))now++;
					else now--;
				}
			}
			else
			{
			//	cout << "!!!" << endl;
				REP(q,v[j+k].size())
				{
					ll tmp = v[j+k][q];
					if((tmp >= l && tmp <= r))now++;
				}
				
				REP(q,v[j].size())
				{
					ll tmp = v[j][q];
					if(!(tmp >= l && tmp <= r))now++;
				}
			}	
			
			ans = max(ans,now);
			//cout << i << ' ' << j << ' '<< now << endl;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#define lli long long int
using namespace std;
lli min(lli x, lli y){return x < y ? x : y;}
int main(){
	int n; cin >> n;
	lli a[n+1];
	for(int i = 0; i < n+1; i++) cin >> a[i];
	lli b[n];
	for(int i = 0; i < n; i++) cin >> b[i];
	lli res = 0;
	lli m = 0;
	for(int i = 0; i < n; i++){
		if(a[i] != 0){
			m = min(a[i], b[i]);
			b[i] -= m;
			res += m;
		}
		if(a[i+1] != 0 && b[i] != 0){
			m = min(a[i+1], b[i]);
			a[i+1] -= m;
			res += m;
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, M;
	cin >> N >> M;
	VI X(N);
	vector<VI> modX(M);
	REP(i, N) cin >> X[i];
	SORT(X);
	REP(i, N) modX[X[i] % M].push_back(X[i]);

	int ans = 0;
	eREP(i, M/2) {
		if ((i + i) % M == 0) {
			ans += modX[i].size() / 2;
			continue;
		}
		int s = modX[i].size(), t = modX[M - i].size();
		ans += min(s, t);

		if (s < t) {
			//SORT(modX[M-i]);
			
			int a = 0;
			while (t - 2 >= s&& a < modX[M - i].size() - 1) {
				if (modX[M - i][a] == modX[M - i][a + 1]) {
					ans++;
					t -= 2;
					a++;
				}
				a++;
				if (t - 2 < s || a >= modX[M - i].size() - 1) {
					break;
				}
			}		
		}
		else{
			//SORT(modX[i]);
			int a = 0;
			while (s - 2 >= t && a < modX[i].size() - 1) {
				if (modX[i][a] == modX[i][a + 1]) {
					ans++;
					//cout << modX[i][a] << endl;
					s -= 2;
					a++;
					//cout << a << endl;
				}
				a++;
				if (s - 2 < t || a >= modX[i].size() - 1) {
					break;
				}
			}
		}
	}
	
	cout << ans << endl;



	return 0;
}



Measured memory_bytes: 6528
n = int(input())
ds = [[int(s) for s in input().split()] for _ in range(n)]

count = 0
for i in range(n):
    if ds[i][0] == ds[i][1]:
        count += 1
        if count == 3:
            print("Yes")
            exit(0)
    else:
        count = 0
print("No")

Measured memory_bytes: 9056
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
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; }
ll MOD = 1000000007;

//Union-Find tree
struct UnionFind
{
	vector<ll> par;
	vector<ll> rank;
	vector<ll> siz;

	UnionFind(ll n) : par(n), rank(n), siz(n)
	{
		for (ll i = 0; i < n; i++)
		{
			par[i] = i;
			rank[i] = 0;
			siz[i] = 1;
		}
	}
	ll root(ll x)
	{
		if (par[x] == x) return x;
		else return par[x] = root(par[x]);
	}
	ll size(ll x)
	{
		return siz[root(x)];
	}
	void unite(ll x, ll y)
	{
		ll rx = root(x);
		ll ry = root(y);
		if (rx == ry)return;
		if (rank[rx] < rank[ry])swap(rx, ry);
		par[ry] = rx;
		siz[rx] += siz[ry];
		if (rank[rx] == rank[ry])rank[rx]++;
	}
	bool same(ll x, ll y)
	{
		return root(x) == root(y);
	}
};

void solve()
{
	int n, m, k; cin >> n >> m >> k;
	vector<int> friends(n, 0);
	vector<vector<int>> block(n);
	UnionFind uf(n);
	rep(i, m) 
	{
		int a, b; cin >> a >> b;
		a--;b--;
		friends[a]++;
		friends[b]++;
		uf.unite(a, b);
	}
	rep(i, k) 
	{
		int c, d; cin >> c >> d;
		c--;d--;
		block[c].push_back(d);
		block[d].push_back(c);
	}
	rep(i, n)
	{
		int ans = uf.size(i)-friends[i]-1;
		for(auto e : block[i])
		{
			if(uf.same(i,e))ans--;
		}
		cout << ans;
		if(i!=n-1)cout<<" ";
	}
	return;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


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

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    long long r,br=0,x=100;
    cin >> r;
    while(x<r)
    {
        x+=x/100;
        br++;
    }
    cout << br;
}


//freopen("testcases/17.in", "r", stdin);
//freopen("output.txt", "w", stdout);


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt(), b = in.nextInt();
		int c = a + b;
		if (c > 23) {
			System.out.println(c - 24);
		} else {
			System.out.println(c);
		}
	}
}


Measured memory_bytes: 23764
#include <cstdio>
#include <algorithm>

#define f first
#define s second

using namespace std;

pair <int, int> v[100010];

int main ()
{
  //  freopen ("file.in", "r", stdin);

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

    for (int i = 1; i <= n; ++i)
    {
        scanf ("%d", &v[i].f);
        v[i].s = i;
    }

    sort (v + 1, v + n + 1);

    int nr = 0;
    for (int i = 1; i <= n; ++i)
        if ((i & 1) != (v[i].s & 1)) ++nr;

    printf ("%d\n", nr >> 1);

    return 0;
}


Measured memory_bytes: 896
#include <stdio.h>
#define MAX 500000
#define SEN 2000000000
 
int L[250002], R[250002],count = 0, A[MAX],n;

void merge(int left, int mid, int right) {
  int n1,n2,i,j,k;
 
  n1 = mid - left;
  n2 = right - mid;
 
  for(i = 0; i < n1; i++) {
    L[i] = A[left+i];
  }
 
  for(i = 0; i < n2; i++) {
    R[i] = A[mid+i];
  }
  L[n1] = SEN;
  R[n2] = SEN;
 
  i = 0;
  j = 0;
for(k = left; k < right; k++) {
    if(L[i] <= R[j]) {
      A[k] = L[i];
      i++;
      count++;
    }
    else{
      A[k] = R[j];
      j++;
      count++;
    }
  }
}


void mergeSort(int left, int right) {
  int mid;
  if(left+1 < right) {
    mid =(left + right) / 2;
    mergeSort(left, mid);
    mergeSort(mid, right);
    merge(left, mid, right);
  }
}
 
int main()
{
  int i;
 
  scanf("%d",&n);
 
  for(i = 0; i < n; i++) {
    scanf("%d",&A[i]);
  }
  mergeSort(0, n);
  for(i = 0; i < n - 1 ; i++) {
    printf("%d ",A[i]);
  }
  printf("%d", A[n - 1]);
  printf("\n");
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 4504
def main():
  n,k,*t=map(int,open(0).read().split())
  *z,=zip(*[iter(t)]*2)
  ok=10**19
  ng=-1
  while ok-ng>1:
    mid=(ok+ng)//2
    if sum((mid-w)//d+1for w,d in z if w<=mid)<k:ng=mid
    else:ok=mid
  print(ok)
main()

Measured memory_bytes: 26764
import numpy as np 
IN = lambda:map(int, input().split())
 
n, k = IN()
dp = np.zeros(k + 1)
 
for i in range(n):
    w, c = IN()
    dp[w:] = np.maximum(dp[w:], dp[:-w] + c)
    
print(int(dp[-1]))

Measured memory_bytes: 22264
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] mt = new int[10];
        for(int i = 0; i<10;i++){
            mt[i]=Integer.parseInt(sc.next());
        }
        Arrays.sort(mt);
        for(int i= 0;i<3;i++){
            System.out.println(mt[9-i]);
        }
    }
}

Measured memory_bytes: 26352
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; //mp::cpp_intで宣言
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////

ll po(ll i,ll p){
    if(p==0)return 1;
    else if(p==1)return mod(i);
    else if(p%2==0)return mod(po(mod(mod(i)*mod(i)),p/2));
    else  return mod(mod(i)*mod(po(i,p-1)));
}

ll p[405][405];
void calc(){
    rep(j,0,400){
        rep(i,0,400){
            if(i==0)p[i][j]=1;
            else p[i][j]=mod(p[i-1][j]*j);
        }
    }
    rep(i,1,400){
        rep(j,1,400){
            p[i][j]=mod(p[i][j]+p[i][j-1]);
        }
    }
    rep(j,0,400)p[0][j]=j;
}


int main(){
    calc();
    /*rep(i,0,5){
        cout<<i<<":";
        rep(j,0,5){
            cout<<p[i][j]<<" ";
        }cout<<endl;
    }*/
    ll n,c;cin>>n>>c;
    ll a[n],b[n];rep(i,0,n-1)cin>>a[i];rep(i,0,n-1)cin>>b[i];
    ll dp[n+1][c+1];memset(dp,0,sizeof(dp));dp[0][0]=1;
    rep(i,1,n){
        rep(j,0,c){
            rep(k,0,j){
                Add(&dp[i][j],mod(dp[i-1][k]*mod((p[j-k][b[i-1]]-p[j-k][a[i-1]-1]))));
                //Add(&dp[i][j],mod(dp[i-1][k]*(ll)po(b[i-1],j-k)));
            }
        }
    }
   /* rep(i,0,n){
        rep(j,0,c){
            cout<<dp[i][j]<<" ";
        }cout<<endl;
    }*/
    cout<<mod(dp[n][c])<<endl;
    
    return 0;
}


Measured memory_bytes: 2816
#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--)

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

  vector<int> a(n);
  rep(i, n) {
    cin >> a[i];
    a[i]--;
  }

  vector<int> cnt(n, -1);
  int j = 0;
  int t = 0;
  cnt[0] = 0;
  while (cnt[a[j]] < 0) {
    j = a[j];
    t++;
    cnt[j] = t;
  }

  int e = a[j];
  int64_t cycle = t - cnt[e] + 1;

  if (k <= cnt[e]) {
    int result = 0;
    rep(i, k) { result = a[result]; }
    cout << result + 1 << endl;
  } else {
    k -= cnt[e];
    int result = e;
    rep(i, k % cycle) { result = a[result]; }
    cout << result + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 4844
#include <iostream>

#define MOD 1000000007

typedef long long ll;

using namespace std;

ll factMod(ll a) {
    ll ans = 1;
    for (ll i = 2; i <= a; ++i) ans = ans * i % MOD;
    return ans;
}

int main() {
    ll n, m, ans = 1;
    cin >> n >> m;
    switch (n - m) {
        case 0: ans = 2;
        case 1: case -1: ans = ans * factMod(n) * factMod(m) % MOD; cout << ans << endl; break;
        default: cout << 0 << endl; break;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define N 200

int main()
{
	int a,b,data[N],i=0,j,n;
	while(scanf("%d %d",&a,&b) != EOF){
		data[i]=a+b;
		i++;
	}
	for(n=0;n<i;n++){
		for(j=6;j>=0;j--){
			if((data[n])/((int)pow(10,j))){
				printf("%d\n",j+1);
				break;
			}
		}
	}
         return 0;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long int lint;
using namespace std;

//ただの辺
struct edge {
    using lint = long long int;
    int to;
    lint cost;
    //引数一つの時は距離1
    edge(int t, lint c = 1) : to(t), cost(c) {
    }
    edge() {
    }
};

// path[start]を計算して格納する
void dfs(int start, vector<vector<edge>> &g, vector<int> &path,
         vector<bool> &calced) {
    if (calced[start]) {
        return;
    }
    if (g[start].size() == 0) {
        path[start] = 0;
    } else {
        int temp = 0;
        for (int i = 0; i < g[start].size(); i++) {
            dfs(g[start][i].to, g, path, calced);
            temp = max(temp, path[g[start][i].to]);
        }
        path[start] = temp + 1;
    }
    calced[start] = true;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<edge>> g(n);
    // spring[i]:iが湧き出しかどうか
    vector<bool> isSpring(n, true);
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        g[x].push_back(y);
        isSpring[y] = false;
    }
    //湧き出しだけの集合を作る
    vector<int> spring;
    for (int i = 0; i < n; i++) {
        if (isSpring[i]) {
            spring.push_back(i);
        }
    }
    vector<int> path(n, 0);
    vector<bool> calced(n, false);
    int ans = 0;
    // iスタートのパスで最長なものの長さ
    for (int i = 0; i < spring.size(); i++) {
        dfs(spring[i], g, path, calced);
        ans = max(ans, path[spring[i]]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 17024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000007
#define maxn 1000000009b
int main()
{
    int N, M;
    cin >> N >> M;
    vector<ll> a(N + 1, true);
    vector<ll> dp(N + 1);
    for (int i = 0; i < M; i++)
    {
        int kai = 0;
        cin >> kai;
        a[kai] = false;
    }
    dp[0] = 1;
    for (int now = 0; now < N; now++)
    {
        for (int next = now + 1; next <= min(N, now + 2); next++)
        {
            if (a[next])
            {
                dp[next] += dp[now];
                dp[next] %= INF;
            }
        }
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int count(int a, int b) {
    int c = a & b;
    int sum = 0;
    while(c != 0){
        if(c & 1) {
            sum++;
        }
        c >>= 1;
    }
    return sum;
}

int main() {
    int n; cin >> n;
    int bits[n];
    long long p[n][11];
    for(int i = 0; i < n; i++){
        int sum = 0;
        for(int j = 0; j < 10; j++){
            sum <<= 1;
            int tmp; cin >> tmp;
            if(tmp)
                sum += 1;
        }
        bits[i] = sum;
    }
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < 11; j++){
            cin >> p[i][j];
        }
    }
    long long ans = -(1 << 30);
    for(int bit = 1; bit < (1 << 10) ;bit++) {
        long long sum = 0;
        for(int i = 0; i < n; i++) {
            sum += p[i][count(bit, bits[i])];
        }
        if(ans < sum){
            ans = sum;
        }
    }
    cout << ans << endl;
}



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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cnt = 0;
  rep(i, n) {
    if (s[i] == 'R') cnt++;
  }
  int ans = 0;
  rep(i, cnt) {
    if (s[i] == 'W') ans++;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3764
N, T = map(int, input().split())
t = list(map(int, input().split()))

t.append(10**10)
total = 0
for i in range(N):
    if t[i+1] - t[i] <= T:
        total += t[i+1] - t[i]
    else:
        total += T
print(total)

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

int main() {
  vector<int> a(5),b(5),c;
  rep(i,5){
    int n;
    cin >> n;
    a[i] = n/10;
    b[i] = n%10;
  }
  rep(i,5){
    if (b[i] != 0) c.push_back(b[i]);
  }
  int ans = 0;
  rep(i,5){
    ans += a[i]*10;
  }
  if (c.size() != 0) {
    ans += *min_element(c.begin(),c.end());
    ans += 10*(c.size()-1);
  }
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String [] args){
       
             Scanner scan = new Scanner(System.in);
        int m,f,r;
        
        while(true){
            m = scan.nextInt(); f = scan.nextInt(); r = scan.nextInt();
            int v = m + f;
            if (v >=80) {
                System.out.println("A");
            }
            else if(v >= 65 && v <80 ){
                 System.out.println("B");
            }
            else if(v >= 50 && v <65 ){
                 System.out.println("C");
            }
            else if(v >= 30 && v <50 ){
                if (r >= 50) {
                    System.out.println("C");
                }else if(m == -1 || f == -1){
                         System.out.println("F");
                  }else{
                    System.out.println("D");
                }
            }else if(v <30){
                    if (m<0 && f<0 && r<0) {
                          break;
                    }else if(m == -1 || f == -1){
                         System.out.println("F");
                     }
                    else{
                         System.out.println("F");
                    }
            }
            
            
        }
            
            
        
    }
}


Measured memory_bytes: 26352
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
//#define mod2 20071027
//#define MOD 998244353
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a) for(int i=1;i<=a;i++)
#define base 139
//#define mod 1000074259
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case #%lld: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
const ll N=300010,M=1000010;
ll n,res;
vector<ll>v;
int main()
{
    in1(n);
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=n;j++)
        {
            ll g=__gcd(i,j);
            v.pb(g);
        }
    }
    for(ll i=1;i<=n;i++)
    for(auto u:v)
    {
        res+=__gcd(u,i);
    }
    printf("%lld\n", res);
    return 0;
}

/*

*/


Measured memory_bytes: 3964
#include <bits/stdc++.h>
        #include<iostream>
        #include<cstdio>
        #include<vector>
        #include<queue>
        #include<map>
        #include<cstring>
        #include<string>
        #include <math.h>
        #include<algorithm>
        #include<functional>
   //    #define int long long
        #define inf  1000000007
        #define pa pair<int,int>
#define ll long long
        #define pal pair<ll,ll>
        #define ppa pair<int,pa>
        #define EPS (1e-10)
        #define equals(a,b) (fabs((a)-(b))<EPS)

        using namespace std;

        class Point{
        	public:
        	double x,y;
        	Point(double x=0,double y=0):x(x),y(y) {}
        	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
        	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
        	Point operator * (double a) {return Point(x*a,y*a);}
        	Point operator / (double a) {return Point(x/a,y/a);}
        	double absv() {return sqrt(norm());}
        	double norm() {return x*x+y*y;}
        	bool operator < (const Point &p) const{
        		return x != p.x ? x<p.x: y<p.y;
        	}
        	bool operator == (const Point &p) const{
        		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
        	}
        };
        typedef Point Vector;

        struct Segment{
        Point p1,p2;
        };

    double hen(Vector a){
    if(fabs(a.x)<EPS && a.y>0) return acos(0);
    else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0);
    else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0);
    else if(fabs(a.y)<EPS && a.x>0) return 0.0;
    else if(a.y>0) return acos(a.x/a.absv());
    else return 2*acos(0)+acos(-a.x/a.absv());

    }

        double dot(Vector a,Vector b){
        	return a.x*b.x+a.y*b.y;
        }
        double cross(Vector a,Vector b){
        	return a.x*b.y-a.y*b.x;
        }
        int dx[4] = {1, 0, -1, 0};
        int dy[4] = {0, 1, 0, -1};
        //----------------kokomade temple------------
int n,k;
vector<int> G[100050];
int x[100050],y[100050],kosuu[100050];
int visit[100050]={0};






signed main(){

	
int n,m;
cin>>n>>m;
	for(int i=1;i<=n;i++) kosuu[i]=1;
	bool w=true;
	visit[1]=1;
	for(int i=0;i<m;i++){
		cin>>x[i]>>y[i];
		kosuu[x[i]]--;
		kosuu[y[i]]++;
		if(x[i]==1) w=false;
		if(w==false && visit[x[i]]>0){
			visit[y[i]]++;
			if(kosuu[x[i]]==0) visit[x[i]]=0;
		}
	}


	
	int ans=0;
	for(int i=1;i<=n;i++){
		if(visit[i]>0 && kosuu[i]>0) ans++;
	//	cout<<visit[i]<<" "<<kosuu[i]<<endl;
	//	cout<<ans<<endl;
		
	}
	cout<<ans<<endl;
	
	return 0;
        }


Measured memory_bytes: 4096
#include<iostream>
using namespace std;
int main()
{
	int a;
	cin>>a;
	if(a==1)
	cout<<"1";
	else if(a<4)
	cout<<"2";
	else if(a<8)
	cout<<"4";
	else if(a<16)
	cout<<"8";
	else if(a<32)
	cout<<"16";
	else if(a<64)
	cout<<"32";
	else
	cout<<"64";
}

Measured memory_bytes: 764
h,w = map(int, input().split())
s = [list(input()) for i in range(h)]
dx = [0,1,0,-1]
dy = [1,0,-1,0]

for x in range(h):
    for y in range(w):
        if s[x][y] == "#":
            flag = False

            for i in range(4):
                nx = x + dx[i]
                ny = y + dy[i]

                if 0 <= nx < h and 0 <= ny < w and s[nx][ny] == "#":
                    flag = True

            if not flag:
                print("No")
                exit()

print("Yes")

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
typedef long long ll;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
#define INF 100000000
#define MAX_V 100001
#define MOD 1000000007
typedef vector<vector<int> > Graph;

int main(){
    int n;cin>>n;
    ll count=0;
    ll ans=0;
    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> c(n);
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++) cin>>b[i];
    for(int i=0;i<n;i++){
        c[i]=a[i]-b[i];
        if(c[i]<0){
            ans++;
            count+=c[i];
        }
    }
    sort(c.begin(),c.end());
    for(int i=n-1;i>=0;i--){
        if(count>=0) break;
        if(c[i]<=0) break;
        count+=c[i];
        ans++;
    }
    if(count<0) cout<<-1<<endl;
    else cout<<ans<<endl;
}


Measured memory_bytes: 2560
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int x = parseInt(sc.next());
		int y = parseInt(sc.next());
		int z = parseInt(sc.next());
		sc.close();
		out.println((x-z)/(y+z));
	}
}


Measured memory_bytes: 22740
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>


typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

int gcd(int a, int b) {
	int c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

map<string, int> memo;

using P=pair<int, int>;

struct Clock {
	int hour, minute, second;
	void set(int h, int m, int s) {
		hour = h; minute = m; second = s;
	}
	string to_str() {
		string h, m, s;
		h = to_string(hour);
		m= to_string(minute);
		s= to_string(second);
		if (h.size() < 2) h = "0" + h;
		if (m.size() < 2) m = "0" + m;
		if (s.size() < 2) s = "0" + s;
		return h + ":" + m + ":" + s;
	}
	void shift(int diff_second) {
		int h, m;
		h = diff_second / 3600;
		m = diff_second / 60;
		diff_second %= 60;
		second += diff_second;
		
	}
};


/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
int main() {
	//sort(a.begin(),a.end());
	int  k, x;
	cin >> k >> x;
	for (int i = x - k + 1; i <= x + k - 1; i++) {
		cout << i << endl;
	}
	return 0;
}









Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    int n;
    cin >> n;
    double x[n], y[n];
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        p[i] = i;
    }
    double sum = 0;
    do {
        for (int i = 0; i < n-1; i++) {
            sum += sqrt((x[p[i]]-x[p[i+1]])*(x[p[i]]-x[p[i+1]]) + (y[p[i]]-y[p[i+1]])*(y[p[i]]-y[p[i+1]]));
        }
    } while (next_permutation(p.begin(), p.end()));
    for (int i = 1; i <= n; i++) {
        sum /= i;
    }
    printf("%.10f\n", sum);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};

int main()
{
    int n;
    cin>>n;
    ll ans = 0ll;
    VLL a;
    map<ll, ll> mp;
    REP(i,n) {
        a.push_back(input<int>());
        mp[a[i]]++;
    }
    REPITR(itr,mp) {
        ans += itr->e2 * (itr->e2 - 1) / 2;
    }
    REP(i,n) {
        cout<<ans-mp[a[i]]*(mp[a[i]]-1)/2+(mp[a[i]]-1)*(mp[a[i]]-2)/2<<endl;
    }

    return 0;
}


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

d = list(map(int,input().split()))

res = 0
for i_a in range(len(d)-1):
  for i_b in range(i_a+1,len(d)):
    #print(i_a,i_b)
    res += d[i_a]*d[i_b]
    
print(res)

Measured memory_bytes: 39024
N=int(input())
num=0
cdcount=0
count=0
for i in range(N):
    num=i+1
    for j in range(num):
        if (num%(j+1)==0):
            cdcount=cdcount+1
    if (cdcount==8)and(num%2==1):
        count=count+1
    cdcount=0
print(count)

Measured memory_bytes: 39152
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    ll C;
    cin>>A>>B>>C>>M;
    cout<<((abs(C-A) <= M) || ((abs(B-A) <= M) && (abs(C-B) <= M)) ? "Yes" : "No")<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#define N 200010
#define ls x << 1
#define rs x << 1 | 1
#define inf 0x3f3f3f3f
#define inc(i) (++ (i))
#define dec(i) (-- (i))
#define mid ((l + r) >> 1)
#define int long long
#define XRZ 1000000007
#define debug() puts("XRZ TXDY");
#define mem(i, x) memset(i, x, sizeof(i));
#define Next(i, u) for(register int i = head[u]; i ; i = e[i].nxt)
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout);
#define Rep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
#define Dep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i >= i##Limit ; dec(i))
int dx[10] = {1, -1, 0, 0};
int dy[10] = {0, 0, 1, -1};
using namespace std;
inline int read() {
    register int x = 0, f = 1; register char c = getchar(   );
    while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}

int n, A[N], Ans, sum[N];
signed main() { n = read();
    Rep(i, 1, n) sum[A[i] = read()] ++;
    Rep(i, 1, N) Ans += sum[i] * (sum[i] - 1) / 2;
    Rep(i, 1, n) { int now = Ans;
        now -= sum[A[i]] * (sum[A[i]] - 1) / 2;
        now += (sum[A[i]] - 1) * (sum[A[i]] - 2) / 2;
        printf("%lld\n", now);
    }
	return 0;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fr(a,b) for(ll i = a; i < b; i++)
#define mod 1000000007
#define inf (1LL<<60)
#define all(x) (x).begin(), (x).end()
#define prDouble(x) cout << fixed << setprecision(10) << x 
#define triplet pair<ll,pair<ll,ll>>
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

vector<vector<ll>> multiply(vector<vector<ll>> A, vector<vector<ll>> B)
{
    int n = A.size();
    vector<vector<ll>> res(n, vector<ll>(n, 0));
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++)
        {
            for(int x = 0; x < n; x++)
                res[i][j] = (res[i][j] + A[i][x]*B[x][j]) % mod;
        }
    }
    return res;
}
vector<vector<ll>> power(vector<vector<ll>> mat, ll exp)
{
    if(exp == 1)
        return mat;
    vector<vector<ll>> res = power(mat, exp/2);
    if(exp&1)
        return multiply(multiply(mat,res),res);
    else return multiply(res,res);
}

ll solve(vector<vector<ll>>& adj, ll k, int n)
{
    vector<vector<ll>> ak = power(adj, k);
    ll ans = 0;
    for(int i = 0; i <n; i++)
        for(int j = 0; j <n; j++)
            ans = (ans + ak[i][j]) % mod;
    return ans;
}

int main() {
   int n; 
   ll k;
   cin >> n >> k;
   vector<vector<ll>> adj(n, vector<ll>(n));
   for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            cin >> adj[i][j];
   cout << solve(adj, k, n);
   return 0;
}


Measured memory_bytes: 4956
#include <stdio.h>

int main(void)
{
	int a[10];
	int n = 10,i,j,tmp;
	
	for(i = 0;i < 10;i++){
		scanf("%d",&a[i]);
	}
	for(i = 0;i <= n - 1;i++){
		for(j = n - 1;j > i;j--){
			if(a[j] > a[j-1]){
				tmp = a[j];
				a[j] = a[j -1];
				a[j-1] = tmp;
			}
		}
	}
	for(i = 0;i < 3;i++){
		printf("%d\n",a[i]);
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000000

void get(int N,int A,int B){
	int a=0,b=0;
	for(int i=0;i<(1<<N);i++){
		string s = "";
		for(int j=0;j<N;j++){
			if((i>>j)&1)s += '0';
			else s += '1';
		}

		for(int j=0;j<N;j++){
			if(j+A-1>=N)break;
			bool f = true;
			for(int k=0;k<A;k++){
				if(s[j+k]!='0'){
					f=false;
					break;
				}
			}
			if(f){
				for(int k=j;k<N;k++){
					if(s[k]=='0')s[k]='1';
					else break;
				}
			}
		}
		bool f = false;
		for(int j=0;j<N;j++){
			if(j+B-1>=N)break;
			bool F = true;
			for(int k=0;k<B;k++){
				if(s[j+k]!='1'){
					F=false;
					break;
				}
			}
			if(F)f=true;
		}
		if(!f){
			if(i%2==0)a++;
			else b++;
		}
	}
	
	cout<<a<<','<<b<<endl;
}

int main(){
	
	int N,A,B;
	cin>>N>>A>>B;
	if(A>B)swap(A,B);
	
	int t = 1;
	for(int i=0;i<N;i++)t = mod(t*2);
	
	vector<vector<int>> cnt(N+1,vector<int>(2,0));
	cnt[0][1] = 1;
	for(int i=0;i<N;i++){
		cnt[i+1][1] = mod(cnt[i+1][1] + cnt[i][1]);
		
		for(int j=A;true;j++){
			if(i+j>N)break;
			cnt[i+j][0] = mod(cnt[i+j][0] + cnt[i][1]);
		}
		
		for(int j=A+1;true;j++){
			if(i+j>N)break;
			cnt[i+j][1] = mod(cnt[i+j][1] + cnt[i][1]);
		}
	}
	
	vector<vector<int>> dp(N+1,vector<int>(2,0));
	dp[0][0] = 1;
	dp[0][1] = 1;
	
	for(int i=0;i<N;i++){
		for(int j=1;j<A;j++){
			if(i+j<=N)dp[i+j][0] = mod(dp[i+j][0] + dp[i][1]);
		}
		if(i!=0){
			for(int j=1;j<B;j++){
				if(i+j<N)dp[i+j][1] = mod(dp[i+j][1] + mod(cnt[j-1][1]*dp[i][0]));
				if(i+j==N){
					dp[i+j][1] = mod(dp[i+j][1] + mod((cnt[j-1][0]+cnt[j-1][1])*dp[i][0]));
				}
			}
		}
		else{
			for(int j=1;j<B;j++){
				if(i+j<N)dp[i+j][1] = mod(dp[i+j][1] + mod(cnt[j][1]*dp[i][0]));
			}
		}

	}
	
	int ans = 0;
	ans = mod(ans + dp.back()[0] + dp.back()[1]);
	ans = mod(t-ans);
	
	//get(N,A,B);
	
	//t = mod(t-mod(dp.back()[0]+dp.back()[1]));
	
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 4168
#include <iostream>
#include <vector>
#include <bitset>
#include <cmath>
#include <map>
#include <algorithm>
#include <queue>
#include <chrono>
#include <array>
#include <random>
#include <fstream>
#include <list>

std::string yesno(bool b) {
    return b ?
        "Yes" : "No";
        // "YES" : "NO";
        // "yes" : "no";

}


int main() {
    std::cin.tie(0); std::ios::sync_with_stdio(false);
    int n, a;
    std::cin >> n >> a;
    std::cout << yesno(n%500 <= a) << std::endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define max_size 500001

int main(){
	int i, j, LT, LP;
	char *T = (char *)malloc(sizeof(char) * max_size);
	char *P = (char *)malloc(sizeof(char) * max_size);
	scanf("%s", T);
	scanf("%s", P);
	for(i = 0; T[i] != '\0'; i++){}
	for(j = 0; P[j] != '\0'; j++){}
	LT = i;
	LP = j;
	int *go = (int *)malloc(sizeof(int) * LP);
	int *back = (int *)malloc(sizeof(int) * LP);
	for(i = 0, j = 0; i < LT && j < LP; i++){
		if(T[i] == P[j]){
			go[j] = i;
			j++;
		}
	}
	if(j < LP){
		printf("no\n");
		return 0;
	}
	for(i = LT - 1, j = LP - 1; i >= 0 && j >= 0; i--){
		if(T[i] == P[j]){
			back[j] = i;
			j--;
		}
	}
	for(j = 0; j < LP; j++){
		if(go[j] != back[j]){
			printf("no\n");
			return 0;
		}
	}
	printf("yes\n");
	return 0;
}

Measured memory_bytes: 6540
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;}

int n;
void dfs(string s,char mx) {
    if(s.size()==n) {
        cout << s << endl;
        return;
    }
    for(char i = 'a';i<=mx;i++) {
        string t = s;
        t += i;
        dfs(t,max(mx,(char)(i+1)));
    }
}
int main() {
    cin >> n;
    dfs("",'a');
}

Measured memory_bytes: 3584
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	int A, B, C, K;
	cin >> A >> B >> C >> K;

	int sum = 0;

	if (K <= A) {
		cout << K << endl;
	}
	else if (K <= A + B) {
		cout << A << endl;
	}
	else {
		cout << A - (K - A - B) << endl;
	}

}


Measured memory_bytes: 3528
N, T = map(int, input().split())

answer = 'TLE'
INF = 100000000
min_cost = INF

for i in range(N):
    c, t = map(int, input().split())

    if t <= T and c < min_cost:
        min_cost = c

if min_cost == INF:
    print('TLE')
else:
    print(min_cost)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int a;
cin >> a;
int y = 0;
for(int i = 0;i < a;i++){
  for(int j = 0;j < a;j++){
    for(int k = 0;k < a;k++){
y += __gcd(i+1,__gcd(j+1,k+1));
}
}
}
cout << y << endl;}

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

int main(){
    string S;
    cin >> S;
    for (int i = 1; i < S.size(); i++)
    {
        if(S[i - 1] == S[i]){
            cout << "Bad"<< endl;
            return 0;
        }
    }
    cout << "Good"<< endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
	string s;
	cin >> s;
	for (int i = 0; i < 12; i++) {
		cout << s.at(i);
		if (i == 3) cout << " ";
	}
	cout << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	static boolean prime[];
	void doIt() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		System.out.println(getGcd(n, m));
	}

	int getGcd(int n, int m) {
		int num = 1;
		for(int i = m / n + 1; i >= 1; i--) {
			if(m % i == 0) {
				if(m / i >= n) {
					return i;
				}
			}
		}
		return num;
	}
	Main(){doIt();}
	public static void main(String[] args) {
		new Main();
	}

}


Measured memory_bytes: 22736