akhauriyash/Code-Regression huggingface dataset:
N, T = map(int, input().split())
t = list(map(int, input().split()))
i = 0
X = 0

while i <= N-2:
	if t[i+1] - t[i] >= T:
		X += T
		i += 1
	else:
		X += t[i+1] - t[i]
		i += 1

X += T

print(X)

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

using namespace std;
typedef long long ll;
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;
const ll INF=1000000000000000;

vector<ll> pw2(51,1); vector<ll> pw10(19,1);
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll myceil(ll x,ll y){if(x<=y) return 1;else if(x%y==0) return x/y;else return x/y+1;}
vector<ll> divisor(ll x){
	vector<ll> div;
	for(int i=1;i*i<=x;i++){
		if(i*i!=x && x%i==0){
			div.pb(i);
			div.pb(x/i);
		}
		else if(x%i==0) div.pb(i);
	}
	return div;
}
vector<ll> vectorprime(ll x){
	vector<bool> is_prime(x+1);
	vector<ll> prime;
	rep(i,x+1) is_prime[i]=true;
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<=x;i++){
		if(is_prime[i]){
			prime.pb(i);
		}
		for(int j=i*2;j<=x;j+=i) is_prime[j]=false;
	}
	return prime;
}

//a,b x
int main(){
	ll x,y; cin>>x>>y;
	if(abs(x-y)<=1) cout<<"Brown";
	else cout<<"Alice";
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int w, a, b;

int main() {
	cin >> w >> a >> b;
	
	cout << (inII(b, a - w, a + w) ? 0 : min(abs(a + w - b), abs(a - w - b))) << endl;
	
	return 0;
}


Measured memory_bytes: 256
def main():
    import sys

    input = sys.stdin.readline

    inf = float('inf')

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

    dp = [inf] * (1 << n)
    dp[0] = 0

    for i in range(m):
        cost, _ = map(int, input().split())
        c = tuple(int(x) - 1 for x in input().rstrip().split())

        for mask in range((1 << n) - 1):
            if dp[mask] != inf:
                n_bit = mask
                for cc in c:
                    n_bit |= (1 << cc)
                dp[n_bit] = min(dp[n_bit], dp[mask] + cost)
                # print(bin(n_bit), dp[n_bit])

    if dp[(1 << n) - 1] == inf:
        print(-1)
    else:
        print(dp[(1 << n) - 1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 44524
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;
// ------------------------------

int main() {
    int N;
    cin >> N;
    for (int i = 1; i <= N; ++i) {
        int ans = 0;
        for (int x = 1; x*x <= i; ++x) {
            for (int y = 1; x*x + y*y + x*y <= i; ++y) {
                for (int z = 1; x*x + y*y + z*z + x*y + y*z + z*x <= i; ++z) {
                    if (x*x + y*y + z*z + x*y + y*z + z*x == i) ans += 1;
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main()
{
  int a,b,c,d = 0,i;
  cin >> a >> b >> c;
  for(int i = a; i <= b; i++)
  {
    if(c % i == 0)
   {
    ++d;
   }
  }
    cout << d << endl;


  return 0;
}

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

using namespace std;
typedef long long lint;
typedef long double ldb;
typedef unsigned long long uli;

#define X first
#define Y second
#define F(i, l, r) for(auto i = l; i != r; i++)
#define Df(i, l, r) for(auto i = l; i != r; i--)
#define I(i, a) for(auto i : a)
#define pb push_back
#define rs resize
#define mk make_pair
#define asg assign
#define all(x) x.begin(),x.end()
#define ret return
#define cont continue
#define brk break
#define ins insert
#define era erase
#define fi0(x) memset(x, 0, sizeof(x))
#define finf(x) memset(x, 127, sizeof(x))
#define y1 adjf

const int MAXN = 1e5 + 5;

int a[MAXN];
int n;
int ma, mi;

int main(){
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	scanf("%d", &n);
	F(i, 0, n)scanf("%d", &a[i]);
	ma = mi = a[0];
	F(i, 1, n){
		mi = min(mi, a[i]);
		ma = max(ma, a[i]);
	}
	if(ma - mi > 1){printf("No"); ret 0;}
	if(ma == mi){
		if(ma == n - 1){printf("Yes"); ret 0;}
		if(1 <= ma && ma <= n/2){printf("Yes"); ret 0;}
		printf("No");
		ret 0;
	}
	int m = n;
	F(i, 0, n)if(a[i] == mi)m--;
	if(1 <= ma-(n-m) && ma-(n-m) <= m/2)printf("Yes"); else printf("No");
	ret 0;
}


Measured memory_bytes: 640
//naveen mall
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb               push_back
#define sz(c)            (int)c.size()
#define len(c)           (int)c.length()
#define vec              vector
#define int              long long int
#define all(c)           c.begin(), c.end()
#define rall(c)          c.rbegin(), c.rend()
#define trav(a,i)        for(auto i: a)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define invect(v,n)       for(int i=0;i<n;i++ ){int arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        fl(i,0,n){int aset;cin>>aset;s.insert(aset);}
#define display(c)        trav(c,i) cout<<i<<" ";cout<<"\n";
#define F                 first
#define S                 second
#define pii               pair<int,int>
#define PB                pop_back
#define endl              "\n"
#define what(x) cerr << #x << " is " << x << endl;
int sum() { return 0; }template<typename T,typename... Args>T sum(T a, Args... args) { return a + sum(args...); }
#define p   200005




void solve()
{  
   string s;
   cin>>s;
    if(s[2]==s[3] and s[4]==s[5])
        cout<<"Yes"<<endl;
      else
        cout<<"No"<<endl;
      




   
 }

  

signed main()
{fast
  int t;
  //cin>>t;
  t=1;
  while(t--)
    {solve();}
  
}












Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;

int main(void){
    int N, D;
    cin >> N >> D;

    int len = 2*D + 1;
    int res = (N + len - 1) / len;
    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll                  long long
#define pb                  push_back
#define mp                  make_pair
#define in                  insert
#define sz(a)               (int)(a).size()
#define all(x)              (x).begin(), (x).end()
#define fore(i,a,b)         for(ll i=a; i<b; i+=1)
#define forr(i,a)           for(ll i=a; i>=0; i-=1)
#define forg(i,b,e,c)       for (ll i=(ll)b; i<(ll)e; i+=c)
#define ford(i,a)           for(auto i=a.begin(); i!=a.end(); i++) 
#define F first
#define S second
#define min3(a, b, c)       min(min(a, b), c)
#define min4(a, b, c, d)    min(min(a, b), min(c, d))
#define max3(a, b, c)       max(max(a, b), c)
#define max4(a, b, c, d)    max(max(a, b), max(c, d))
#define endl "\n"
#define printV(arr)         fore(x,0,sz(arr)) cout << arr[x] <<" "; cout<<endl;
#define setp(x)             fixed<<setprecision(x)
 
 
using namespace std;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll,ll> lll;
typedef vector<ii> vii;
typedef vector<lll> vlll;
typedef pair<string, int> si;
typedef pair<int, string> is;
typedef vector<string> vs;
const int MAX=1e5+10;
const int MOD=1000000009;
const double pi=acos(-1);
const int dx[]={0,1,-1,0};
const int dy[]={-1,0,0,1};
const int dxc[]={0,1,-1,0,1,1,-1,-1};
const int dyc[]={-1,0,0,1,-1,1,-1,1};
 
ll min(ll a, ll b){
    if(a>b) return b;
    return a;
}
ll max(ll a, ll b){
    if(a>b) return a;
    return b;
}
 
ll gcd(ll a, ll b){
    while(b!=0){
        a%=b;
        swap(a,b);
    }
    return a;
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}
bool isPrime(ll n){
    if(n<=1) return false;
    if(n==2) return true;
    if(n%2==0) return false;
    for(ll i=3; i*i<=n; i+=2){
        if(n%i==0) return false;
    }
    return true;
}
 
set<ll> gen(ll n){
    set<ll> divs;
    for(ll i=1; i*i<=n; i++){
        if(n%i==0){
            divs.insert(i);
            divs.insert(n/i);
        }
    }
    return divs;
}
 
map<ll, int> fact(ll n){
    map<ll, int> F;
    for(ll p = 2; p*p <= n; p++){
        while(n%p == 0){
            F[p]++;
            n /= p;
        }
    }   
    if(n > 1) F[n]++;
    return F;
}
 
ll sum(ll n){
    return (n*(n+1))/2;
}
 
ll binaryExp(ll a, ll b, ll c){
    if(b==0) return 1;
    if(b%2==0){
        ll temp=binaryExp(a,b/2,c);
        return (temp*temp)%c;
    }
    else{
        ll temp=binaryExp(a,b-1,c);
        return (temp*a)%c;
    }
}
 
bool isPal(string& cad){
    int p1=sz(cad)-1;
    fore(i,0,sz(cad)/2){
        if(cad[i]!=cad[p1]) return false;
        p1--;
    }
    return true;
}

double dis(double x1,double y1, double x2, double y2){
    double ff=pow(x2-x1,2)+pow(y2-y1,2);
    return sqrt(ff);
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    double n,d; cin>>n>>d;
    int res=0;
    fore(i,0,n){
        double x,y; cin>>x>>y;
        if(dis(0,0,x,y)<=d) res++;
    }
    cout<<res<<endl;


    return 0;
}

Measured memory_bytes: 3756
import sys
sys.setrecursionlimit(10000000)
input=sys.stdin.readline

n,m,x = map(int,input().split())
l=[]

for _ in range(n):
    l.append(list(map(int,input().split())))
    
ans=10**8
for i in range(1<<n):
    p=0
    u=[0] * m

    for j in range(n):
        if(i>>j)&1:
            p+=l[j][0]

            for io in range(m):
                u[io] += l[j][1+io]

        f=0
        for jo in range(m):
            if u[jo] < x: f=1 ; break

        if not f:
            ans=min(ans,p)

if ans==10**8:print(-1)
else: print(ans)


Measured memory_bytes: 9224
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var [n,m]=arr.shift().split(" ").map(Number);
var cnt=0;
for(var i=0;i<n;i++){
   var s=arr[i];
   var t=arr[i+n];
   for(var j=0;j<m;j++){
      if(s[j]!=t[j])cnt++;
   }
}
console.log(cnt);


Measured memory_bytes: 31320
# Five Dishes

# input
menu = list()
for _ in range(5):
    x = int(input())
    if x % 10 != 0:
        t = x % 10
    else:
        t = 10
    menu.append([t, x])

menu = sorted(menu, reverse = True)
# print(menu)
total = 0
for e in menu[:-1]:
    if e[0] == 10:
        total += e[1]
    else:
        total += (e[1] + (10 - e[0]))
total += menu[-1][1]

print(total)

Measured memory_bytes: 3064
def kaibun(S):
    mid = len(S) // 2
    for i in range(mid):
        if S[i] != S[len(S) - i - 1]:
            return False
    return True

S = input()
mid = len(S) // 2
if kaibun(S) and kaibun(S[:mid]) and kaibun(S[(mid+1):]):
    print("Yes")
else:
    print("No")

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

const int INF = 1000000000;

void solve()
{
	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	vector<int> b(m);
	int c[1007][12];
	for (int i = 0; i < m; ++i) 
	{
		cin >> a[i] >> b[i];
		for (int j = 0; j < b[i]; ++j)
		{
			cin >> c[i][j];
			--c[i][j];
		}
	}

    vector<int> dp(5000, INF);
    dp[0] = 0;
    for(int i = 0; i < m; i++)
	{
        int now = 0;
        for(int j = 0; j < b[i]; j++)
		{
            now |= (1 << (c[i][j]));
        }
        for(int mask = 0; mask < (1 << n); mask++)
		{
            dp[mask | now] = min(dp[mask | now], dp[mask] + a[i]);
        }
    }
    cout << (dp[(1 << n) - 1] == INF ? -1 : dp[(1 << n) - 1]);

}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
 
using namespace std;
 
#define SZ(x) ((int)(x).size())
using namespace std;
typedef pair<int,int> PII;
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define REP(i,n) for (int i = 0; i < n; ++i)
#define FOR(i,a,b) for (int i = a; i <= b; ++i)
#define M 1000000007
#define MM 998244353
#define SZ(a) int((a).size())
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define mod 1000000007
//a and b are assumed to be taken modulo p
inline int add(int a, int b, int p = mod){ int c = a + b; if(c >= p) c -= p; return c; }
inline int sub(int a, int b, int p = mod){ int c = a - b; if(c < 0) c += p; return c; }
inline int mul(int a, int b, int p = mod){ return (a * 1ll * b) % p; }
 
using ll = long long;
using VI = vector<int>;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
using VLL = vector<ll>;
using ld = long double;
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
      
}
const int MX = 2e5+10;
const int MX2 = 1e6+5;

ll INF= 4 * (ll)1e18;
int mx = 2 * (ll)1e9 + 10;

int fre[MX];
vector<int> cnt;
int ans = 1e9;
int sto[MX];
ll power(ll x,ll y, ll p)
{
    ll res = 1;     // Initialize result
  
    x = x % p; // Update x if it is more than or
                // equal to p
  
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*1ll*x) % p;
  
        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
void store() {
    sto[0] = 1;
    for (int i = 1; i < MX; ++i) {
        sto[i] = mul(sto[i -1],i,mod);
    }
}
int main(int argc, const char * argv[]) {

    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0); // insert code here...
    int H,W,A,B;
    store();
    cin >> H >> W >> A >> B;
    int ans = 0;
    for (int j = B + 1; j <= W; ++j) {
        int m1 = H - A - 1;
        int n1 = j - 1;
        int m2 = A - 1;
        int n2 = W - j;
        int inv1 = power(mul(sto[n1],sto[m1],mod),mod-2,mod);
        int res1 = mul(sto[m1 + n1],inv1,mod);
        int inv2 = power(mul(sto[n2],sto[m2],mod),mod-2,mod);
        int res2 = mul(sto[m2+n2],inv2,mod);
        ans = add(ans,mul(res2,res1,mod),mod);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define fo(i,a,n) for (i = a; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;




void solve(){
    int n;
    cin>>n;
    n = (n%10);
    if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9)cout<<"hon";
    else if(n == 0 || n == 1 || n == 6 || n == 8)cout<<"pon";
    else cout<<"bon";
}

int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
  size_t N;
  string S;
  cin >> N;
  cin >> S;

  size_t result = 0;

  for(size_t i = 0; i < N - 2; ++i){
    if(S.at(i) == 'A' && S.at(i + 1) == 'B' && S.at(i + 2) == 'C') ++result;
  }

  cout << result << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define INF 1 << 30
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define FORALL(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll fact(ll a){ll b=1;FOR(i,1,a)b*=i;return b;}

class P
{
public:
  double x,y;
  P(){};P(double x,double y):x(x),y(y){};
  P operator+(const P&q){P t;t.x=x+q.x;t.y=y+q.y;return t;}
  P operator+=(const P&q){x+=q.x;y+=q.y;return *this;}
  P operator-(const P&q){P t;t.x=x-q.x;t.y=y-q.y;return t;}
  P operator-=(const P&q){x-=q.x;y-=q.y;return *this;}
  template<typename T> P operator*(T d){return P(x*d,y*d);}
  template<typename T> P operator*=(T d){x*=d;y*=d;return *this;}
  template<typename T> P operator/(T d){return P(x/d,y/d);}
  template<typename T> P operator/=(T d){x/=d;y/=d;return *this;}
  bool operator<(const P&q){return (x!=q.x)?(x<q.x):(y<q.y);}
  bool operator>(const P&q){return (x!=q.x)?(x>q.x):(y>q.y);}
  double norm(void){return sqrt(x*x+y*y);}
  double arg(void){return acos(x/this->norm())*P(1,0).sign(*this);}
  P rotate(double t){double c=cos(t),s=sin(t);return P(c*x-s*y,s*x+c*y);}
  P reverseX(void){return P(-x,y);}
  P reverseY(void){return P(x,-y);}
  P unit(void){return (*this).norm()==0?P(0,0):(*this)/(*this).norm();}
  P floor(void){return P((int)x,(int)y);}
  double dot(const P&q){return x*q.x+y*q.y;}
  double det(const P&q){return x*q.y-y*q.x;}
  int sign(const P&q){double d = (*this).det(q); return (d>0)-(d<0);}
  bool on_seg(P p1,P p2,P q){return (p1-q).det(p2-q)==0&&(p1-q).dot(p2-q)<=0;}
  P intersection(P p1,P p2,P q1,P q2){return p1+(p2-p1)*((q2-q1).det(q1-p1)/(q2-q1).det(p2-p1));}
};

int main()
{
  int n;
  while(cin >> n,n)
  {
    int m = 1;
    double d;
    vector<P> a(n);
    REP(i,n) scanf("%lf,%lf",&a[i].x,&a[i].y);
    REP(i,n) REP(j,n) if(i!=j&&(d=(a[j]-a[i]).norm())<=2)
    {
      int c1 = 2, c2 = 2; d /= 2;
      P e = (a[j]-a[i]).rotate(M_PI/2).unit();
      P p = (a[i]+a[j])/2+e*sqrt(1-d*d);
      P q = (a[i]+a[j])/2-e*sqrt(1-d*d);
      if(fabs(p.x)<=10&&fabs(p.y)<=10) REP(k,n) if(k!=i&&k!=j&&(p-a[k]).norm()<=1) c1++;
      if(fabs(q.x)<=10&&fabs(q.y)<=10) REP(k,n) if(k!=i&&k!=j&&(q-a[k]).norm()<=1) c2++;
      m = max(m,max(c1,c2));
    }
    cout << m << endl;
  }
}

Measured memory_bytes: 3212
object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datN, datD) = readLine.split(" ").map(_.toLong)
    val datA = for(i <- 1 to datN.toInt) yield (readLine.split(" ").map(_.toLong))

    val ans = datA.filter(v => v(0) * v(0) + v(1) * v(1) <= datD * datD).length
    println(ans)
  }
}


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

int main(){
    long long n,maxv=1;
    cin >> n;
    for(long long i=2;i*i<=n;i++){
        if(n%i==0){
            if(i>maxv){
                maxv = i;
            }
        }
    }
    cout << maxv + n/maxv -2 << endl;
}

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


int main() {

  int64_t L,R;
  cin>>L>>R;

  int64_t min_wk=2020;
  if(R-L>=2020)
    cout<<0<<endl;
  else{
    for(int64_t i=L;i<R;i++){
      for(int64_t j=i+1;j<=R;j++)
        min_wk = min(min_wk,(j*i)%2019);
    }
    cout<<min_wk<<endl;
  }

  return 0;
}



Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;


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

    if (X == 7 || X == 5 || X == 3) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;

int main() {
    const int INF = 100000000;
    int n, m;
    cin >> n >> m;
    int a[1000], b[1000], c[1000], dist[100][100];
    rep(i, m) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--,b[i]--;
    }

    rep(i, n) {
        rep(j, n) {
            if(i == j) {
                dist[i][j] = 0;
            } 
            else{
                dist[i][j] = INF;
            }
        }
    }
    rep(i, m) {
        dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
        dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
    }

    rep(k, n) {
        rep(i, n) {
            rep(j, n) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int ans = m;
    rep(i, m) {
        bool shortest = false;
        rep(j, n) {
            if(dist[j][a[i]] + c[i] == dist[j][b[i]]) {
                shortest = true;
            }
        }
        if(shortest == true) {
            ans--;
        }
    }
    
    cout << ans << endl;
    return 0;
}

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

int dt[50001];

int main(){
	dt[0]=0;
	dt[1]=0;
	for(int i=2;i<50001;i++){
		dt[i]=1;
	}
	for(int i=2;i<sqrt(50001);i++){
		for(int j=2;i*j<50001;j++){
			dt[i*j]=0;
		}
	}
	int num=0;
	while(1){
		int cnt=0;
		cin>>num;
		if(num==0)break;
		for(int i=1;i<(num/2+1);i++){
			if(dt[i]==1){
				if(dt[num-i]==1){
					cnt++;
				}
			}
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 1356
import sys
sys.setrecursionlimit(10**5)
class UnionFind:
    def __init__(self, n):
        self.d = []
        for _ in range(n):
            self.d.append(-1)
    
    def find(self, x):
        if self.d[x] < 0:
            return x
        else:
            self.d[x] = self.find(self.d[x])
            return self.d[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.d[x] > self.d[y]:
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -self.d[self.find(x)]


N, M = map(int, input().split())
uf = UnionFind(N)
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    uf.union(a,b)
group = set()
for i in range(N):
    group.add(uf.find(i))

print(len(group)-1)

Measured memory_bytes: 81408
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> N;
	if (N < 1200)cout << "ABC\n";
	else cout << "ARC\n";
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

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

  ll sz = 26;
  ll len = 0, c = 1;
  while (true) {
    ll p = sz * (c - 1) / (sz - 1);
    if (p >= n) {
      c /= sz;
      break;
    }
    len++;
    c *= sz;
  }
  ll p = sz * (c - 1) / (sz - 1);
  n -= p + 1;

  vector<ll> ans;
  REP(i, len) {
    ans.push_back(n % sz);
    n /= sz;
  }
  reverse(ALL(ans));
  REP(i, SZ(ans)) { cout << (char)(ans[i] + 'a'); }
  cout << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int a, b;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> a >> b;
    cout << ceil((a+b)/2.0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <math.h>
#include <vector>
 
#define MOD 1000000007
typedef long long ll;
 
using namespace std;

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

	ll t, n, ans;
	cin >> n;
	ll ac, wa, tle, re;
	ac=0, wa=0, tle=0, re=0;
	string s;
	while(n--) {
		cin >> s;
		if(s == "AC") ac++;
		else if(s == "WA") wa++;
		else if(s == "TLE") tle++;
		else if(s == "RE") re++;
	}

	cout << "AC x " << ac << '\n';
	cout << "WA x " << wa << '\n';
	cout << "TLE x " << tle << '\n';
	cout << "RE x " << re << '\n';
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100001,INF=1<<30;

struct edge{int from,to;ll dis;};

bool compare(edge a,edge b){
    return a.dis<b.dis;
}

int par[MAX];

void init(int n){
    for(int i=0;i<n;i++){
        par[i]=i;
    }
}

int root(int a){
    if(par[a]==a) return a;
    else return par[a]=root(par[a]);
}

void unite(int a,int b){
    if(root(a)!=root(b)) par[root(b)]=root(a);
}

bool check(int a,int b){
    return root(a)==root(b);
}

int main(){

    int V,E;cin>>V>>E;
    vector<edge> S(E);
    for(int i=0;i<E;i++){
        int a,b;
        ll c;cin>>a>>b>>c;
        S[i]={a,b,c};
    }
    
    sort(all(S),compare);
    
    init(V);
    
    ll sum=0;
    
    for(int i=0;i<E;i++){
        int a=S[i].from,b=S[i].to;
        ll c=S[i].dis;
        if(check(a,b)) continue;
        unite(a,b);
        sum+=c;
    }
    
    cout<<sum<<endl;
}




Measured memory_bytes: 4392
#include <iostream>
#include <string>
#include <iterator>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <sstream> 
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <functional>
#pragma GCC optimize("O3")
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define sp system("pause");
#define MOD 998244353 
#define mxN 2005
#define MXINT 1e9+5


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

// Function to find gcd of array of 
// numbers 
ll findGCD(ll arr[], ll n)
{
	ll result = arr[0];
	for (int i = 1; i < n; i++)
	{
		result = gcd(arr[i], result);

		if (result == 1)
		{
			return 1;
		}
	}
	return result;
}
void solve()
{
	ll k, ans=0;
	cin >> k;
	for (int i = 1; i <= k; i++)
	{
		for (int j = 1; j <= k; j++)
		{
			for (int t = 1; t <= k; t++)
			{
				ll arr[3];
				arr[0] = i; arr[1] = j; arr[2] = t;
				ans += findGCD(arr,3);
			}
		}
	}
	cout << ans;
}

int main()
{
	fast;
	solve();
	
	return 0;
}



Measured memory_bytes: 3568
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int h[10];
for(int i = 0; i < 10; i++) cin >> h[i];
sort(h, h+10);
for(int i = 9; i > 6; i--) cout << h[i] << endl;
return 0;
}

Measured memory_bytes: 3084
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];

void Solve() {
	int h, w;
	cin >> h >> w;
	for (size_t i = 0; i < h; i++)
	{
		for (size_t j = 0; j < w; j++)
		{
			string s;
			cin >> s;
			if (s == "snuke") {
				char col = 'A' + j;
				cout << (col) << (i+ 1) << endl;
				return;
			}
		}
	}

}


int main() {
	Solve();
	return 0;
}



Measured memory_bytes: 6400
class UnionFind:
    def __init__(self, N):
        """
        N:要素数
        root:各要素の親要素の番号を格納するリスト.
             ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
        rank:ランク
        """
        self.N = N
        self.root = [-1] * N
        self.rank = [0] * N

    def __repr__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

    def find(self, x):
        """頂点xの根を見つける"""
        while self.root[x] >= 0:
            x = self.root[x]
        return x

    def union(self, x, y):
        """x,yが属する木をunion"""
        # 根を比較する
        # すでに同じ木に属していた場合は何もしない.
        # 違う木に属していた場合はrankを見てくっつける方を決める.
        # rankが同じ時はrankを1増やす
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.rank[x] > self.rank[y]:
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

    def same(self, x, y):
        """xとyが同じグループに属するかどうか"""
        return self.find(x) == self.find(y)

    def count(self, x):
        """頂点xが属する木のサイズを返す"""
        return - self.root[self.find(x)]

    def members(self, x):
        """xが属する木の要素を列挙"""
        _root = self.find(x)
        return [i for i in range(self.N) if self.find == _root]

    def roots(self):
        """森の根を列挙"""
        return [i for i, x in enumerate(self.root) if x < 0]

    def group_count(self):
        """連結成分の数"""
        return len(self.roots())

    def all_group_members(self):
        """{ルート要素: [そのグループに含まれる要素のリスト], ...}の辞書を返す"""
        return {r: self.members(r) for r in self.roots()}


import sys
input = sys.stdin.readline
n, q = map(int, input().split())
uf = UnionFind(n)
for i in range(q):
    t, u, v = map(int, input().split())
    if t:
        print(int(uf.same(u, v)))
    else:
        uf.union(u, v)


Measured memory_bytes: 75244
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int l,r,ans=999999999;	cin>>l>>r;
	for(int i=l;i<=r&&i<=l+2500;i++)
		for(int j=i+1;j<=r&&j<=l+2500;j++)
			ans=min(ans , ( (i%2019) * (j%2019)%2019 ) );
	cout<<ans<<endl;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n, k;
  cin >> n >> k;
  if (n < 2 * k - 1) {
    cout << -1 << endl;
    return 0;
  }

  vector<int> xs(n);
  vector<int> ys(n);
  vector<int> zs(n);

  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      xs[i] = k + i / 2;
      ys[i] = k + n + (n / 2) + i / 2;
    } else {
      xs[i] = k + ((n + 1) / 2) + i / 2;
      ys[i] = k + n + i / 2;
    }
    zs[i] = k + 2 * n + i;
  }

  for (int i = 0; i < n; i++) {
    cout << xs[i] << " " << ys[i] << " " << zs[i] << endl;
  }
}

Measured memory_bytes: 3456
#include <iostream>
#include <string>
#include <string.h>

int main(int argc, char const *argv[]) {
  std::string s,r;
  std::getline(std::cin, s);
  std::getline(std::cin, r);
  s = s + s;
  std::size_t found;
  found = s.find(r);
  if(found != std::string::npos){
    std::cout << "Yes" << std::endl;
  }else std::cout << "No" << std::endl;
  return 0;
}

Measured memory_bytes: 3192
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int A,B;
    cin >> A >> B;
    double min_X,max_X;
    min_X = max(A/0.08, B/0.1);
    max_X = min((A+1)/0.08,(B+1)/0.1);
    for(int i=0;i<=1000;i++){
        if((min_X  <= i)&&(i < max_X)){
            cout << i<< endl;
            break;
        }
        else if(i==1000){
            cout << -1 <<endl;
        }
    }
}

Measured memory_bytes: 3604
#include <stdio.h>

int main(void)
{
	int a,b,x;
	scanf("%d %d %d",&a,&b,&x);
	if(a<=x && a+b>=x)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}
	return 0;
}

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

int main() {
    int N, four, seven;
    cin >> N;

    if (N % 4 == 0 || N % 7 == 0) {
        cout << "Yes" << endl;
        return 0;
    } else if (N < 4 || N < 7) {
        cout << "No" << endl;
        return 0;
    } else {
        if (7 < N) {
            seven = N / 7;
            for(int i = 1; i <= seven; i++) {
                if ((N - 7*i) % 4 == 0) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
        if (4 < N) {
            four = N / 4;
            for(int i = 1; i <= four; i++) {
                if ((N - 4*i) % 4 == 0) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


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

  int N , A , B ;
  cin >> N >> A >> B;
  ll count = 0 ;
  ll count1 = 0 ;
  for(int i = 1 ; i< N+1 ; i++ ){
    if (i < 10 ) if ( A-1 >= i ) count1+= i ;
    if (i>=10 && i < 100 ) if ( A-1 >= i/10 + i%10  ) count1+=i ; 
    if (i>=100 && i < 1000 ) if (A-1 >= i/100 + (i -(i/100)*100 )/10 + i%10) count1+=i ;
    if (i>=1000 && i < 10000 ) if (A-1 >= i/1000+ (i -(i/1000)*1000 )/100+ (i -(i/100)*100 )/10 +i%10 ) count1+=i ;
    if( i == 10000) if (A-1 >= i/10000 +(i -(i/10000)*10000 )/1000 + (i -(i/1000)*1000 )/100+ (i -(i/100)*100 )/10 +i%10 ) count1+=i ;
  }
  for(int i = 1 ; i< N+1 ; i++ ){
    if (i < 10 ) if ( B >= i ) count+=i ;
    if (i>=10 && i < 100 ) if ( B >= i/10 + i%10 )count+=i ; 
    if (i>=100 && i < 1000 ) if (B >= i/100 + (i -(i/100)*100 )/10 + i%10) count+=i ;
    if (i>=1000 && i < 10000 ) if (B >= i/1000+ (i -(i/1000)*1000 )/100+ (i -(i/100)*100 )/10 +i%10 ) count+=i ;
    if( i == 10000) if (B >= i/10000 +(i -(i/10000)*10000 )/1000 + (i -(i/1000)*1000 )/100+ (i -(i/100)*100 )/10 +i%10 ) count+=i ;
  }
  cout << count - count1 << endl ;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();
		long[] as = new long[100_000 + 1];
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			as[a] += b;
		}

		long sum = 0;
		long ans = 0;
		for (int i = 0; i < as.length; i++) {
			sum += as[i];
			if (sum >= k) {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 66864
N = int(input())
S = []
for i in range(N):
    S.append(input())
import collections

M = []
C = collections.Counter(S)
max = C.most_common()[0][1]
for c in C.most_common():
    if c[1] == max:
        M.append(c[0])
M.sort()
for m in M:
    print(m)

Measured memory_bytes: 45072
#include <iostream>

using namespace std;

int n;

int main()
{
	int n;
	cin >> n;
	int a, cn = 0, sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a;

		if (a >= 3200) {
			cn++;
		}
		else {
			sum |= 1 << (a / 400);
		}
	}
	
	int t = 0;
	while (sum != 0) {
		if (sum & 1 == 1) {
			t++;
		}
		sum >>= 1;
	}

	if (t == 0) {
		printf("%d %d\n", 1, cn);
	}
	else {
		printf("%d %d\n", t, t + cn);
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(c,itr) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	int n;
	cin>>n;
	int x[n],y[n];
	rep(i,n){
		cin>>x[i]>>y[i];
	}
	double sum=0;
	rep(i,n){
		REP(j,i+1,n){
			sum+=sqrt(abs(x[i]-x[j])*abs(x[i]-x[j])+abs(y[i]-y[j])*abs(y[i]-y[j]));
		}
	}
	forn(i,n-1){
		sum*=i;
	}
	sum*=2;
	ford(i,n){
		if(i!=0){
			sum/=i;	
		}
	}
	cout<<fixed<<setprecision(10)<<sum;
	re 0;
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
ll n;
vector<ll> a;
int main(void){
    cin >> n;
    a.resize(n);
    rep(i, n) cin >> a[i];

    ll now = 1000;
    ll stock = 0;
    bool f = false;
    for(ll i = 0; i < n - 1; i++){
        if(a[i] <= a[i + 1]){
            if(!f){
                stock += now / a[i];
                now -= (now / a[i]) * a[i];
            }
            f = true;
        } else {
            if(f){
                now += stock * a[i];
                stock = 0;
            }
            f = false;
        }
    }

    now += stock * a.back();

    cout << now << endl;

}



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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif

    ll N, M;
    cin >> N >> M;

    vector<Pll> stages(M);
    ll a = 1, b = a + M;
    for (ll i = M - 1; i >= 0; i -= 2) {
        stages[i].first = a;
        stages[i].second = b;
        ++a;
        --b;
    }

    a = M + 2, b = a + M - 1;
    for (ll i = M - 2; i >= 0; i -= 2) {
        stages[i].first = a;
        stages[i].second = b;
        ++a;
        --b;
    }

    for (ll i = 0; i < M; i++) {
        cout << stages[i].first << " " << stages[i].second << "\n";
    }

    cout << flush;
    return 0;
}

Measured memory_bytes: 4428
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int X,A,B,ans;

        X = sc.nextInt();
        A = sc.nextInt();
        B = sc.nextInt();


        ans = X - A;
        int C = ans/B;
        ans = ans - C*B;


        System.out.println(ans);

    }
}

Measured memory_bytes: 21844
n = int(input())
s = input()
 
r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')
 
ans = r_cnt * g_cnt * b_cnt
 
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
 
print(ans)

Measured memory_bytes: 9180
#include<stdio.h>
int main()
{
	int n,m,i,j,a[100],b[100],s,t,u,v;
	while(scanf("%d%d",&n,&m),n)
	{
		for(s=i=0;i<n;++i)scanf("%d",&a[i]),s+=a[i];
		for(t=i=0;i<m;++i)scanf("%d",&b[i]),t+=b[i];
		for(u=v=999,i=0;i<n;++i)for(j=0;j<m;++j)if(s-t+2*b[j]-2*a[i]==0&&u+v>a[i]+b[j])u=a[i],v=b[j];
		if(u-999)printf("%d %d\n",u,v);
		else puts("-1");
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <string>
#define SIS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);

using namespace std;
typedef long long ll;
const int N = 200005;
const int MAX = 0x7ffffff;
int n , m;
int a[N];
void slove()
{
	cin >> n;
	int x = 0;
	for(int i = 1;i <= n - 1 ;i ++)
	{
		cin >> x;
		a[x]++;
	}
	for(int i = 1;i <= n ;i ++)
	{
		cout << a[i] << endl;
	}
}
int main()
{
	SIS;
	slove();
}

Measured memory_bytes: 4424
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,i,x;
    cin>>n;
    map<ll,ll> m1;
    for(i=0;i<n;i++){
        cin>>x;
        if(m1[x]>0){
            cout<<"NO"<<endl;
            return 0;
        }
        m1[x]+=1;
    }
    cout<<"YES"<<endl;
    return 0;
}


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

int main() { 
    int N, X;
    cin >> N >> X;
    int L[N];
    int i = 0;
    for (int i=0; i<N; i++) {
        cin >> L[i];
    }

    int ct = 1;
    int dist = 0;
    for (int i=0; i<N; i++) {
        if (dist + L[i] <= X) {
            ct++;
        } else {
            break;
        }
        dist += L[i];
    }

    cout << ct << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int arr[5];
    for(int i=0;i<=2;i++){
        cin>>arr[i];
    }
    sort(arr,arr+3);
    int sum=0;
    for(int i=0;i<=1;i++){
        sum+=arr[i];
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
typedef long long int ll;
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define m0(x) memset(x,0,sizeof(x))

int main(void){
	int n,a,b;
	scanf("%d",&n);
	if(n==1) printf("Hello World");
	if(n==2) {
		scanf("%d",&a);
		scanf("%d",&b);
		printf("%d\n",a+b );
	}
	return 0;

}

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

const int N=1e5+10;

int a[N],b[N];

pair<int,int>A[N];


int f[N];

int main() {
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
	for(int i=1;i<=n;i++) A[i].first=a[i]+b[i],A[i].second=a[i]-b[i];
	sort(A+1,A+n+1);
	f[0]=0;
	for(int i=1;i<=n;i++) {
		int l=1,r=i-1;
		int Ans=0;
		while(l<=r) {
			int mid=l+r>>1;
			if(A[mid].first<=A[i].second) {
				Ans=mid;
				l=mid+1;
			}
			else r=mid-1;
		}
		f[i]=max(f[i-1],f[Ans]+1);
	}
	int Ans=0;
	for(int i=1;i<=n;i++) Ans=max(Ans,f[i]);
	cout<<Ans<<endl;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
int gcd(int a,int b){if(a<b)swap(a,b);int c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

int main(){
  ll x; cin >> x;
  ll now = 100;
  int c = 0;
  while(1){
     // cout << now <<endl;
    if(now >= x){
      cout << c << endl;
      return 0;
    }
    c ++;
    now += now/100;
  }

  return 0;
}


Measured memory_bytes: 3636