akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    if (N < 2 || M < 2) {
        cout << (ll)max(1, N-2) * (ll)max(1, M-2) << endl;
    } else {
        cout << (ll)(N-2) * (ll)(M-2) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
h;w;f(y){y=w/3;return w%3-1|y<h?fmax(h/2,y)+y+1:h+y;}main(){scanf("%d%d",&h,&w);printf("%.f",h%3&&w%3?fmin(fmin(h%2?h:h/2,w%2?w:w/2),fmin(f(),f(h^=w^=h^=w))):0);}

Measured memory_bytes: 128
#!/usr/bin/env ruby
a , b, c, d = STDIN.readline().split(' ').map(&:to_i)
def two_switches(a, b, c, d)
  d = [b, d].min - [a, c].max
  d < 0 ? 0 : d
end
puts "#{two_switches(a, b, c, d)}"


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

typedef long long ll;
typedef long double ld; 
typedef double db; 
typedef string str; 

typedef pair<int, int> pi;
typedef pair<ll,ll> pl; 
typedef pair<ld,ld> pd; 

typedef vector<int> vi; 
typedef vector<ll> vl;
typedef vector<ld> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound 
#define ub upper_bound 

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 1000001;

ll N;
ll ans;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    cin >> N;
    FOR(i, 1, N + 1) {
        if (i % 3 && i % 5) ans += i;
    }
    cout << ans;
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll INV(ll x) { return POW(x, MOD-2); }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, INV(y)); }
ll f[200001];

ll nCr(int n, int r){
    return DIV(f[n], MUL(f[n-r], f[r]));
}

ll solve(int N, ll A, ll B, ll C) {
    ll shrink = DIV(A+B+C, A+B);

    A = DIV(A, 100);
    B = DIV(B, 100);
    C = DIV(C, 100);

    A = MUL(A, shrink);
    B = MUL(B, shrink);

    ll ans = 0;
    {
        ll p = POW(A, N-1), q = p;
        rep(u,N) {
            ll r = MUL(nCr(N-1+u, u), MUL(q, A));
            (ans += MUL(r, N+u)) %= MOD;
            (q *= B) %= MOD;
        }
    }
    {
        ll p = POW(B, N-1), q = p;
        rep(u,N) {
            ll r = MUL(nCr(N-1+u, u), MUL(q, B));
            (ans += MUL(r, N+u)) %= MOD;
            (q *= A) %= MOD;
        }
    }

    ans = MUL(ans, shrink);
    return ans;
}

int main() {
    f[0]=f[1]=1;
    for(int i=2; i<=200000; ++i) {
        f[i] = (f[i-1] * i)% MOD;
    }

    int N,A,B,C; cin >> N >> A >> B >> C;
    cout << solve(N,A,B,C) << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }


int main(){
    ll M, D;
    cin >> M >> D;
    ll n = 0;

    for (int i = 11; i <= D;++i){
        int d1 = i % 10;
        int d2 = i / 10;
        int m = d1 * d2;
        if (d1<2||d2<2)
            continue;
        if(m<=M)
            ++n;
    }
    cout << n << endl;
    
    return 0;
}

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

int main(){
    ll N;
    cin >> N;
    vector<string> W(N);
    map<string, ll> v;
    cin >> W[0]; v[W[0]]++;
    rep(i, 1, N){
        cin >> W[i];
        if(W[i][0] != W[i-1][W[i-1].size()-1] || v.count(W[i]) > 0){
            cout << "No" << endl;
            return 0;
        }
        v[W[i]]++;
    }
    
    cout << "Yes" << endl;
    return 0;
}

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

const long double PI = acos(-1);

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


  double eps = 1e-9;
  using Point = complex<double>;
  struct Circle{ Point p; double r; };
  double dist(Point p, Point q){ return abs(p-q); }
  double area2(Point p, Point q){ return (conj(p)*q).imag(); }
  bool in(const Circle& c, Point p){ return dist(c.p, p) < c.r + eps; }
  Circle INVAL = Circle{Point(0, 0), -1};
  Circle mCC(Point a, Point b, Point c){
    b -= a; c -= a;
    double d = 2*(conj(b)*c).imag(); if(abs(d)<eps) return INVAL;
    Point ans = (c*norm(b) - b*norm(c)) * Point(0, -1) / d;
    return Circle{a + ans, abs(ans)};
  }
  Circle solve(vector<Point> p) {
    mt19937 gen(0x94949); shuffle(p.begin(), p.end(), gen);
    Circle c = INVAL;
    for(int i=0; i<p.size(); ++i) if(c.r<0 ||!in(c, p[i])){
      c = Circle{p[i], 0};
      for(int j=0; j<=i; ++j) if(!in(c, p[j])){
        Circle ans{(p[i]+p[j])*0.5, dist(p[i], p[j])*0.5};
        if(c.r == 0) { c = ans; continue; }
        Circle l, r; l = r = INVAL;
        Point pq = p[j]-p[i];
        for(int k=0; k<=j; ++k) if(!in(ans, p[k])) {
          double a2 = area2(pq, p[k]-p[i]);
          Circle c = mCC(p[i], p[j], p[k]);
          if(c.r<0) continue;
          else if(a2 > 0 && (l.r<0||area2(pq, c.p-p[i]) > area2(pq, l.p-p[i]))) l = c;
          else if(a2 < 0 && (r.r<0||area2(pq, c.p-p[i]) < area2(pq, r.p-p[i]))) r = c;
        }
        if(l.r<0&&r.r<0) c = ans;
        else if(l.r<0) c = r;
        else if(r.r<0) c = l;
        else c = l.r<=r.r?l:r;
      }
    }
    return c;
  }

void solve(){

  int n;
  cin >> n;
  vector<Point> p;
  for(int i=1;i<=n;i++){
    ld a,b;
    cin >> a >> b;
    Point x(a,b);
    p.push_back(x);
  }
  Circle ans = solve(p);
  cout << fixed << setprecision(10) << ans.r << endl;
}

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

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

 


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

int main()
{
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(),a.end());
  if(a[0]==a[1]&&a[1]==a[2])cout << "No" << endl;
  else if(a[0]!=a[1]&&a[1]!=a[2])cout << "No" << endl;
  else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define pa pair<int,int>
#define mod 998244353
#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define cl(x) memset(x,0,sizeof x)
#ifdef Devil_Gary
#define bug(x) cout<<(#x)<<" "<<(x)<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define bug(x)
#define debug(...)
#endif

const int INF = 0x7fffffff;
const int N=1e5+5;
/*
char *TT,*mo,but[(1<<15)+2];
#define getchar() ((TT==mo&&(mo=(TT=but)+fread(but,1,1<<15,stdin),TT==mo))?-1:*TT++)//*/
inline int read(){
    int x=0,rev=0,ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')rev=1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
    return rev?-x:x;
}

int main(){
#ifdef Devil_Gary
    freopen("in.txt","r",stdin);
//  freopen("out.txt","w",stdout);
#endif
	int x=read();
	if(400<=x&&x<=599) puts("8"); 
	if(600<=x&&x<=799) puts("7"); 
	if(800<=x&&x<=999) puts("6") ;
	if(1000<=x&&x<=1199) puts("5"); 
	if(1200<=x&&x<=1399) puts("4") ;
	if(1400<=x&&x<=1599) puts("3") ;
	if(1600<=x&&x<=1799) puts("2") ;
	if(1800<=x&&x<=1999) puts("1") ;
	return 0;
}


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



int main(){

    string str;
    string part;
    long long total = 0;
    long long sum = 0;


    cin >> str;

    for(long long  bit = 0; bit < (1 << (str.size() -1) ); ++bit ){
        sum = 0;
        part = "";
        for(int i = 0; i < str.size(); ++i){

            part += str[i];
            if((bit & (1 << i))){
                sum += stol( part );
                part = "";                 
            }
        }
        sum += stol( part );
        part = "";  
        total += sum;
    }

    cout << total << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define ff first
#define ss second
#define pi pair<ll,ll>


int main(){
	
	ll n;
	cin>>n;
	
	vector<ll>v(n+1);
	v[0]=0;
	for(int i=1;i<=n;i++){
		cin>>v[i];
		
	}
	ll ans=0;
	sort(v.begin(),v.end());
	for(int i=1;i<n;i++){
		ans+=v[n- i/2];
	}
	
	
	cout<<ans;
		
	}



Measured memory_bytes: 4784
#include<stdio.h>
#define MODN (1000000007)

static inline long mdml(long a,long b){
    long long res = (long long)a * b;
    return res % MODN;
}

static inline long mdsub(long lhs,long rhs){
    long res = lhs - rhs;
    if(res < 0)res += MODN;
    return res;
}

static inline long mdadd(long lhs,long rhs){
    return (lhs + rhs) % MODN;
}

static inline long mdpow(long num,long ind){
    unsigned long cnt = ind;
    long res = 1;  
    while(cnt){
        if(cnt & 1ul)res = mdml(res,num);
        num = mdml(num,num);
        cnt >>= 1;
    }
    return res;
}

static inline long mddiv(long rhs,long lhs){
    return mdml(rhs,mdpow(lhs,MODN - 2));
}

int main(void){
    register int i;
    int n,k;
    scanf("%d %d",&n,&k);
    int kd_sel = n + 2 - k;
    long cnt[kd_sel];
    for(i = 0;i < kd_sel;i++){
        int nsel = k + i;
        cnt[i] = mdadd( mdsub( mddiv( mdml( mdsub( mdml( 2 , n) , nsel-1) , nsel) , 2) , mddiv( mdml(nsel-1 , nsel) , 2)) , 1);
    }
    long ans = 0;
    for(i = 0;i < kd_sel;i++)ans = mdadd(ans,cnt[i]);
    printf("%ld",ans);
}

Measured memory_bytes: 3236
#include <cstdio>
#include <cstring>

int len;
char str[123456];
int wav[123456];
char out[123456];
int k;

int main()
{
	scanf("%s", str);
	len = strlen(str);
	scanf("%d", &k);
	strcpy(out, str);
	for (int i = 0; i < len; ++i)
	{
		wav[i] = (26 + 'a' - str[i]);
		if (wav[i] == 26)wav[i] = 0;
	}
	int rem = k;
	for (int i = 0; i < len; ++i)
	{
		if (rem >= wav[i])
		{
			rem -= wav[i];
			out[i] = 'a';
		}
		else
		{
			out[i] = str[i];
		}
	}
	rem %= 26;
	if (rem != 0)
	{
		out[len - 1] += rem;
		while (out[len - 1] > 'z')
		{
			out[len - 1] -= 26;
		}
	}
	printf("%s\n", out);
	return 0;
}

Measured memory_bytes: 896
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    P = [int(p) for p in input().split()]
    count = 0
    for i in range(1, N - 1):
        if P [i + 1] < P[i] < P[i-1] or P[i-1] < P[i] < P[i+1]: count += 1
    print(count)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3064
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

s = input()
c = 0
for i in range((len(s) - 1)// 2):
    if s[i] == s[-1 - i] and s[i] == s[(len(s) - 1)// 2 - 1 - i]:
        pass
    else:
        c += 1
        break

if c == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
from collections import deque

S = input()

ans = 0
Q = deque(S)
while len(Q) >= 2:
    left = Q.popleft()
    right = Q.pop()
    if left != right:
        if left == 'x':
            Q.append(right)
            ans += 1
        elif right == 'x':
            Q.appendleft(left)
            ans += 1
        else:
            print(-1)
            quit()
print(ans)

Measured memory_bytes: 4212
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

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

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n,m; cin >> n >> m; ll ans = 0;
  priority_queue<ll> pq;
 

  ll x = 0;
  
  rep(i,n){
    cin >> x;
    pq.push(x);
  }
  
  rep(i,m){
    x = pq.top();
    pq.pop();
    
    pq.push(x/2);
  }
  
  rep(i,n){
    ans += pq.top();
    pq.pop();
  }
  
  cout << ans << endl;
  
}


Measured memory_bytes: 4292
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int N ,  K , com;
 com = 0;
 cin >> N >> K;
 vector<int> x(N);
 for(int i = 0; i < N; i++) {
  cin >> x[i];
  com += min(x[i],abs(K - x[i]));
}
 
cout << com * 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  ll N = 0, A,B;;
  cin >> N >> A >> B;
  if(N == 1){
    cout << "Hello World";
  }
  else{
    cout << A + B;
  }
}
  

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

const int INF = 1e9;
int dp[41][401][401];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, ma, mb;
	cin >> n >> ma >> mb;
	vector<int> a(n), b(n), c(n);
	rep(i,n) cin >> a[i] >> b[i] >> c[i];
	rep(i,n+1)rep(j,401)rep(k,401) dp[i][j][k] = INF;
	dp[0][0][0] = 0;
	int ans = INF;
	rep(i,n)rep(j,401)rep(k,401){
		chmin(dp[i+1][j][k], dp[i][j][k]);
		if(j+a[i] <= 400 && k+b[i] <= 400) chmin(dp[i+1][j+a[i]][k+b[i]], dp[i][j][k] + c[i]);
		if(ma*k == mb*j && dp[i+1][j][k] != 0) chmin(ans, dp[i+1][j][k]);
	}
	if(ans == INF) ans = -1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 29404
#include <iostream>
#include <cmath>
#include <string>

using namespace std;

string s[2];

#define YES puts("YES");
#define NO puts("NO");

int main()
{
    cin >> s[0] >> s[1];
    if (s[0][0] == s[1][2] && s[0][1] == s[1][1] && s[0][2] == s[1][0])
    {
        YES
    }
    else
    {
        NO
    }
}


Measured memory_bytes: 256
import java.util.*
import kotlin.comparisons.compareBy

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    (1..sc.nextInt()).map { Triple(it, sc.next(), sc.nextInt()) }.sortedWith(compareBy({ it.second }, { -it.third })).forEach { println(it.first) }
}

Measured memory_bytes: 34308
#include<stdio.h>

int gcd(int x, int y)
 {
     int t;
 
     while (y != 0) {
         t = x % y;  x = y;  y = t;
     }
     return x;
}

int main(){
int k;
long sum;
scanf("%d",&k);
sum = 0;
for(int a=1;a<=k;a++){
    for(int b=1;b<=k;b++){
        for(int c=1;c<=k;c++){
            sum+=gcd(gcd(a,b),c);
        }
    }
}
printf("%ld\n",sum);
return 0;
}

Measured memory_bytes: 1736
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<set>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
#include <iterator>     // std::back_inserter
const double PI = acos(-1);
using namespace std;
using ll =long long;
#define rep(i,n)for(ll i=0;i<(n);i++)
const int mod = 1000000007;
const ll inf = 1e18 + 1;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
//ll f[101010], rf[101010];
//ll inv(ll x) {
//	ll res = 1;
//	ll k = mod - 2;
//	ll y = x;
//	while (k) {
//		if (k & 1) res = (res * y) % mod;
//		y = (y * y) % mod;
//		k /= 2;
//	}
//	return res;
//}
//void init() {
//	f[0] = 1;
//	for (ll i = 1; i < 101010;i++) f[i] = (f[i - 1] * i) % mod;
//	for(ll i = 0; i < 101010; i++) rf[i] = inv(f[i]);
//}
////---------------------------------------------------------------------------------------------------
//ll C(int n, int k) {
//	ll a = f[n]; // = n!
//	ll b = rf[n - k]; // = (n-k)!
//	ll c = rf[k]; // = k!
//
//	ll bc = (b * c) % mod;
//
//	return (a * bc) % mod;
//}

//小文字=大文字+32
int main() {
	int N;
	cin >> N;
	int a;
	
	set<int>s;
	rep(i, N) { cin >> a;
	s.insert(a);
	}
	cout << s.size();

}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<bool> vb;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sq(x) ((x)*(x))
#define fo(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<n;i++)
#define Fo(i,n) for(int i=1;i<=n;i++)
#define all(x) x.begin(),x.end()
#define deb(x) cout<<#x<<"="<<x<<"\n"
#define deb2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<"\n"
#define fi first
#define se second
const double pi = 3.14159265358979323846;
#define uni(c) (c).resize(unique(all(c))-(c).begin())
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
//pair <int, int> w[4] = {mp(-1, 0), mp(0, -1), mp(1, 0), mp(0, 1)};   // for matrix movement:
void cp()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
void solve()
{
	ll n, k; cin >> n >> k;
	ll ans = 0;
	fo(i, n)
	{
		ll x, y; cin >> x >> y;
		ll temp = ceil(sqrt(sq(x) + sq(y)));
		if (temp <= k)
			ans++;
	}
	cout << ans;

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


	return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(ll sz) {
    data.assign(++sz, 0);
  }

  T sum(ll k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(ll k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};
int main()
{
ll n , m ;
cin >> n >> m ;
vector<ll> ans(m);
vector<vector<ll>> q(m+2);
vector<vector<ll>> f(m+1);
BinaryIndexedTree< ll > b(m+1);
rep(i,n){
  ll l , r ;
  cin >> l >> r ;
  q[l].push_back(l);
  q[r+1].push_back(-l);
}
for (ll i = 1; i <= m; i++)
{
  for (ll j = i; j <= m; j+=i)
  {
    f[j].push_back(i);
  }
}
for (ll i = 1; i <= m; i++)
{
  for(auto t:q[i]){
    if(t>0)b.add(t,1);
    else b.add(-t,-1);
  }
  for(auto t:f[i]){
    ans[t-1]+=b.sum(i)-b.sum(i-t);
    //cout << b.sum(i) << " " << b.sum(i-t) << endl;
  }
}
for(auto an:ans)cout << an << endl;
return 0;
}

Measured memory_bytes: 29432
//Author : pakhandi
//
using namespace std;

#include <bits/stdc++.h>

#define wl(n) while(n--)
#define fl(i,a,b) for(i=a; i<b; i++)
#define rev(i,a,b) for(i=a; i>=b; i--)

#define si(n) scanf("%d", &n)
#define sll(l) scanf("%lld",&l)

#define debug(x) cout<<"\n#("<<x<<")#\n"
#define nline printf("\n")

#define mem(a,i) memset(a,i,sizeof(a))

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

#define PB push_back
#define SZ size
#define MP make_pair

#define IGNORE cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');

const ll INF = (1LL << 58);
const bool DEBUG = 0;

int A, B;

int main()
{
	int i, j;

	si(A);	si(B);

	if(A == 1)
		A = 14;
	if(B == 1)
		B = 14;

	if(A > B)
		printf("Alice\n");
	else if(B > A)
		printf("Bob\n");
	else
		printf("Draw\n");


	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

using namespace std;


pair<int, int> A[1<<20];

int main() {


    int n;cin>>n;
    for(int i=0;i<n;i++) {
        A[i].second = i;
        cin>>A[i].first;
    } sort(A, A+n);

    int counter=0;
    for(int i=0;i<n;i+=2) {
        if(A[i].second%2 != 0) counter++;
    } cout<<counter;


    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;

class Main{
  public static StringBuilder bl = new StringBuilder();
  public static int n;
  public static int M[][];
  public static final int INFTY = (int)Double.POSITIVE_INFINITY;
  public static final int WHITE = 0;
  public static final int GRAY = 1;
  public static final int BLACK = 2;

  public static void main(String args[])throws Exception{
    // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    // n = Integer.parseInt(br.readLine());
    Scanner sc = new Scanner(System.in);
    int k;
    int u;
    int v;
    n = sc.nextInt();
    M = new int[n][n];

    for(int i = 0 ; i < n; i++){
      for(int j = 0; j < n; j++){
        M[i][j] = INFTY;
      }
    }

    for(int i = 0 ;i<n; i++){
      // String s[] = br.readLine().split("\\s+");
      u = sc.nextInt();
      k = sc.nextInt();
      for(int j =0; j<k; j++){
        v = sc.nextInt();
        M[u][v] = sc.nextInt();
      }
    }
    dijkstra(0);
  }

  static void dijkstra(int s){
    int color[] = new int[n];
    int d[] = new int[n]; //最短経路コスト
    int p[] = new int[n];//親
    int minv;

    //初期化
    for(int i = 0; i < n; i++){
      d[i] = INFTY;
      color[i] = WHITE;
    }
    
    d[s]= 0;
    p[s] = -1;
    color[s] = GRAY;
    //
    while(true){
      minv = INFTY;
      int u = -1;
      for(int i = 0; i<n;i++){
        if(minv>d[i] && color[i]!=BLACK){
          u = i;
          minv = d[i];
        }
      }
      if(u == -1)break;
      color[u] = BLACK;
      for( int v = 0; v < n; v++){
        if(color[v] != BLACK && M[u][v] != INFTY){
          if(d[v] > d[u] + M[u][v]){
            d[v] = d[u] + M[u][v];
            color[v] = GRAY;
          }
        }
      }
    }
    for( int i = 0; i<n; i++){
      bl.append(i).append(" ").append((d[i]==INFTY ? -1 : d[i])).append("\n");
    }
    System.out.print(bl);
  }
}


Measured memory_bytes: 39820
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

	private static int N = 0;
	private static long MOD = 1000000007L;
	private static List<Map<String, Long>> memo = new ArrayList<Map<String, Long>>();
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		N = sc.nextInt();
		for (int i = 0; i <= N; i++) {
			memo.add(new HashMap<String, Long>());
		}

		System.out.println(dfs(0, "TTT"));

	}

	private static boolean ok(String last4) {
		for (int i = 0; i < 4; i++) {
			char[] t = last4.toCharArray();

			if (i >= 1) {
				char buf = t[i-1];
				t[i-1] = t[i];
				t[i] = buf;
			}
			if (String.valueOf(t).indexOf("AGC") >= 0) {
				return false;
			}
		}
		return true;
	}

	private static long dfs(int cur, String last3) {
//		System.out.println(cur);
		if (memo.get(cur).containsKey(last3)) {
			return memo.get(cur).get(last3);
		}

		if (cur == N) {
			return 1;
		}

		long ret = 0;

		char[] cList = {'A','C','G','T'};

		for (char c : cList) {
			if (ok(last3 + c)) {
				ret = (ret + dfs(cur + 1, last3.substring(1) + c)) % MOD;
			}
		}

		memo.get(cur).put(last3, ret);

		return ret;
	}

}

Measured memory_bytes: 34900
"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.trim().split(/ |\n/), cid = 0;

function main() {
    let X = +cin.shift();
    let s = 0;
    while (true) {
        for (let a = 0; a <= s; a++) {
            let b = s - a;
            let ma = -a;
            let mb = -b;
            if (a ** 5 - b ** 5 == X) {
                console.log(a, b);
                return;
            }
            if (a ** 5 - mb ** 5 == X) {
                console.log(a, mb);
                return;
            }
            if (ma ** 5 - b ** 5 == X) {
                console.log(ma, b);
                return;
            }
            if (ma ** 5 - mb ** 5 == X) {
                console.log(ma, mb);
                return;
            }
        }
        s++;
    }
}
main();


Measured memory_bytes: 32452
s = input()
q = int(input())
quest = [0]*q
state = 0
former, latter = '', ''
for i in range(q):
    que = input().split()
# for que in quest:
    if (que[0] == '1'):
        # 反転は計算量が多いので一度だけする。
        state = 1 - state
        continue
    else:
        if (state == 0 and que[1] == '1'):
            former = que[2] + former
        elif(state == 0 and que[1] == '2'):
            latter = latter + que[2]
        elif (state == 1 and que[1] == '1'):
            latter = latter + que[2]
        else:
            former = que[2] + former

if (state == 1):
    print(latter[::-1] + s[::-1] + former[::-1])
else:
    print(former + s + latter)


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#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[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){fastio
    ll n,m;cin>>n>>m;
    ll h[n+1];rep(i,1,n)cin>>h[i];
    ll a,b;
    bool ans[n+1];rep(i,1,n)ans[i]=1;
    rep(i,0,m-1){
        cin>>a>>b;
        if(h[a]<h[b]){
            ans[a]=0;
        }else if(h[a]==h[b]){
            ans[a]=0;
            ans[b]=0;
        }else{
            ans[b]=0;
        }
    }
    ll sum=0;
    rep(i,1,n){
        if(ans[i]){
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 4528
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

l,r = [int(i) for i in readline().split()]
if r-l > 2019:
    print(0)
    exit()

ans = 2222
for i in range(l,r+1):
    for j in range(i+1,r+1):
        ans = min(ans,i*j%2019)
print(ans)

Measured memory_bytes: 3060
from math import factorial 
a,b = map(int,input().split())
m = 10**9+7
s = (((factorial(a)%m)*(factorial(b)%m))%m)
if abs(a-b)>=2:
  print(0)
elif abs(a-b)==1:
  print(s)
else:
  print((2*s)%m)

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


int main() {
    int N;
    std::cin >> N;
    int count = 0;
    bool flag = false;
    for (int i = 0; i < N; i++) {
        int d1, d2;
        std::cin >> d1 >> d2;
        if (d1 == d2) {
            count++;
        } else {
            count = 0;
        }
        if (count >= 3) {
            flag = true;
        }
    }
    if (flag) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) (V).begin(),(V).end()
const ll MOD = 1000000007;

int N, K;
vector<int> V;
vector<int> ms;

int solve(int i, int j) {
	int ret = K - i - j;
	int cnt = 0;
	int rit = 0, lit = N - 1;
	while (i) {
		if (V[rit] < 0)
			ms.push_back(V[rit]);
		cnt += V[rit];
		rit++;i--;
	}
	while (j) {
		if (V[lit] < 0)
			ms.push_back(V[lit]);
		cnt += V[lit];
		lit--;j--;
	}
	j = ms.size();
	sort(all(ms));
	while (ret) {
		if (i == j)break;
		cnt -= ms[i];
		i++;ret--;
	}
	return cnt;
}

int main() {
	cin >> N >> K;
	int a;
	for (int i = 0;i < N;i++) {
		cin >> a;
		V.push_back(a);
	}
	for (int i = 0;i <= K;i++) {
		for (int j = 0;j <= K - i;j++) {
			if (i + j > N)continue;
			a = max(a, solve(i, j));
			ms.clear();
		}
	}
	cout << a << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#define ll long long
using namespace std;
int main(){
    int n,x;
    cin>>n>>x;
    int a[n],sum=0,count=1;
    for(int i=0;i<n;i++){
    	cin>>a[i];
    	sum+=a[i];
    	if(sum<=x){
    		count++;
		}
	}
	cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
     
#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair
     
using namespace std;
     
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  // Preprocess
  const int mod = 1e9 + 7;
  auto add = [&] (int a, int b) { return (a + b) % mod; };
  auto sub = [&] (int a, int b) { return (a - b + mod) % mod; };
  auto mul = [&] (int a, int b) { return (1LL * a * b) % mod; };
  auto mod_pow = [&] (int a, int b) {
    int ret = 1;
    while (b) {
      if (b & 1) ret = mul(ret, a);
      a = mul(a, a);
      b >>= 1;
    }
    return ret;
  };
  auto inv = [&] (int a) { return mod_pow(a, mod - 2); };
  const int N = 2e5 + 1;
  vi fact(N);
  fact[0] = 1;
  for (int i = 1; i < N; i++) fact[i] = mul(fact[i - 1], i);
  auto comb = [&] (int x, int y) {
    int ret = 1;
    for (int i = x - y + 1; i <= x; i++) {
      ret = mul(ret, i);
    }
    ret = mul(ret, inv(fact[y]));
    return ret;
  };
  // Solution
  int n, a, b;
  cin >> n >> a >> b;
  int ans = sub(mod_pow(2, n), 1);
  ans = sub(ans, comb(n, a));
  ans = sub(ans, comb(n, b));
  cout << ans << '\n';
  return (0);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;


int main() {
    ios_base::sync_with_stdio(false); 

    int m;
    cin >> m;
    vector<ll> d(m),c(m);
    rep(i,m) cin >> d[i] >> c[i];
    ll sum=0;
    ll ans=0;
    rep(i,m) {
        sum+=d[i]*c[i];
        ans+=c[i];
    }
    cout << ans-1+(sum-1)/9 << endl;

    return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
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; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    string s;
    cin >>s;
    ll ans;
    
    for (int i = 0; i < 3; ++i){
        if (s[i] == '1')ans += 1;
    }
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,s,e) for(int i=(s);i<(e);i++)
#define REP(i,n) FOR(i,0,n)
#define all(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

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

    int N, x;
    cin >> N >> x;
    vector<int> a(N);
    REP(i, N) cin >> a[i];
    sort(all(a));
    int ans = 0;
    REP(i, N){
        if(x-a[i] >= 0){
            if(i == N-1 && x != a[i]) break;
            ans++;
            x -= a[i];
        }else{
            break;
        }
    }
    cout << ans << endl;

        
    
    return 0;
}


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

#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

typedef long long LL;
typedef unsigned long long ULL;
template<typename T> using V = std::vector<T>;
template<typename T> using VV = std::vector<std::vector<T>>;
template<typename T> using VVV = std::vector<std::vector<std::vector<T>>>;
template<class T> inline T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> inline void print(T x) { std::cout << x << std::endl; }
template<class T> inline bool inside(T y, T x, T H, T W) {return 0 <= y and y < H and 0 <= x and x < W; }
inline double distance(double y1, double x1, double y2, double x2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }

const int INF = 1L << 30;
const double EPS = 1e-9;
const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";
const std::vector<int> dy = { 0, 1, 0, -1 }, dx = { 1, 0, -1, 0 };    // 4近傍（右, 下, 左, 上）

using namespace std;


// 部分文字列のhash値を計算
class SubstringHash {
    const int N;
    vector<unsigned long long> powb;
    vector<unsigned long long> shash;
    const unsigned long long b = 1000000007;

public:
    SubstringHash(string s) : N(s.size()) {
        this->powb.resize(s.size() + 10);
        this->shash.resize(s.size() + 10);
        powb[0] = 1;
        FOR(i, 0, s.size()) {
            powb[i + 1] = powb[i] * b;
            shash[i + 1] = shash[i] * b + s[i];
        }
    }

    // s[left, right)のhash値
    unsigned long long hash(int left, int right) {
        assert(0 <= left and 0 <= right and left <= right and right <= N);

        return shash[right] - shash[left] * powb[right - left];
    }
};

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

    int N, M;
    cin >> N >> M;
    string S;
    cin >> S;

    SubstringHash sh(S);
    set<unsigned long long> hash;
    int left = 0, right = 0;    // 0-index
    FOR(i, 0, M){
        string q;
        cin >> q;
        if      (q == "L++") { left++; }
        else if (q == "L--") { left--; }
        else if (q == "R++") { right++; }
        else if (q == "R--") { right--; }
        hash.insert(sh.hash(left, right + 1));
    }

    print(hash.size());

    return 0;
}


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

int main(){

	float a, b, c, d, e, f;

	while( cin >> a >> b >> c >> d >> e >> f ){

		float det = a * e - b * d;

		float dx = c * e - b * f;
		float dy = a * f - c * d;

		float x = dx / det;
		float y = dy / det;

		if( x == -0.000 )x = 0.000;
		if( y == -0.000 )y = 0.000;

		cout << fixed << setprecision(3) << x << " " << y << endl;
	}

	return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define N 200020
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int A,B,m,a[N],b[N],ans;
int main(){
	A=read(),B=read(),m=read();
	for(int i=1;i<=A;++i){
		a[i]=read();
	}
	for(int i=1;i<=B;++i){
		b[i]=read();
	}
	ans=(*min_element(a+1,a+A+1))+(*min_element(b+1,b+B+1));
	for(int i=1;i<=m;++i){
		int x=read(),y=read();
		ans=min(ans,a[x]+b[y]-read());
	}
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 4484
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
	ll a, b;
	cin >> a >> b;
	ll sum = a;
	ll ans = 1;
	while(sum < b){
		sum += a - 1;	
		ans++;
	}
	if(b == 1 or b == 0){
		ans = 0;
	}
	cout << ans << endl;	
	return 0;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  int n;
  cin >> n;
  int test[n][n];
  int a,x,y;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      test[i][j] = -1;
    }
  }

  for(int i=0;i<n;i++){
    cin >> a;
    for(int j=0;j<a;j++){
      cin >> x >> y;
      test[i][x-1] = y;
    }
  }

  int ans = 0;
  int temp = 0;
  int list[n];
  for(int i=0;i<(1<<n);i++){
    for(int j=0;j<n;j++){
      list[j] = -1;
    }
    vector<int> honest;
    temp = 0;
    for(int j=0;j<n;j++){
      if((1<<j)&i){
        honest.push_back(j);
      }
    }
    temp = honest.size();
    bool flag = true;
    int person;
    for(int j=0;j<temp;j++){
      person = honest[j];
      for(int k=0;k<n;k++){
        if(test[person][k] == -1) continue;
        if(list[k] == -1){
          list[k] = test[person][k];
          continue;
        }
        if(test[person][k] != list[k]){
          flag = false;
        }
      }
    }

    for(int j=0;j<n;j++){
      if((i&(1<<j)) && list[j] == 0) flag = false;
      if(!(i&(1<<j)) &&list[j] == 1) flag = false;
    }
    if(flag) ans = max(ans,temp);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
l=[int(x) for x in input().split()]
dicti={}
for i in range(n):
    if(l[i] in dicti):
        dicti[l[i]]+=1
    else:
        dicti[l[i]]=1
l=set(l)
l=list(l)
l.sort()
cout=0
if(len(l)<3):
    print(0)
else:
    i=0
    j=i+1
    while(i<len(l)-2):
        k=j+1
        while(k<len(l) and l[k]<l[i]+l[j]):
            cout+=(dicti[l[i]]*dicti[l[j]]*dicti[l[k]])
            k+=1
        j=j+1
        if(j==len(l)):
            i+=1
            j=i+1 
    print(cout)

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

int main() {
  int64_t n;cin>>n;
  int64_t s=n%60;
  n-=s;
  int64_t m = (n/60)%60;
  n-=m*60;
  int64_t h = n/3600;
  cout<<h<<":"<<m<<":"<<s<<endl;
}



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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  double n, m, d; cin >> n >> m >> d;
  cout << (d?2:1) * (n-d) / n * (m-1) / n << endl;

}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(){
    long long int B;
    scanf("%lld",&B);
 
    char name[100];
    int i = 0;
    
    while(B != 0) {
        B--;
        int b = B % 26;
        name[i] ='a' + b;
        B /= 26;
        i++;
    }
    for(int j = i - 1; j >= 0; j--) {
        printf("%c", name[j]);
    }   
    return 0;
}

Measured memory_bytes: 1644
import sys
# 許容する再帰処理の回数を変更
sys.setrecursionlimit(10**5+10)
# input処理を高速化する
input = sys.stdin.readline

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

lst_edge = [[] for _ in range(N)]
for i in range(M):
    x, y = map(int, input().split())
    lst_edge[x-1].append(y-1)

dp = [-1] * N

# rec(v) 頂点vを始点としたとき有効パスの長さの最大値
def rec(v):
    #print(dp, v)
    if dp[v] != -1:
        return dp[v] # 既に更新済み

    ans = 0
    lst_nv = lst_edge[v]
    for nv in lst_nv:
        ans = max(ans, rec(nv) + 1)
    dp[v] = ans # メモしながらリターン
    return dp[v]

ans_memo = 0
for i in range(N):
    ans_memo = max(ans_memo, rec(i))

print(ans_memo)

Measured memory_bytes: 120112
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll INF=2e18;
const ll MOD=1e9+7;
ll N;
ll a[105];
map<ll,ll> mp;
int main(){
    cin>>N;
    ll m=0;
    for(ll i=0;i<N;i++){
        cin>>a[i];
        mp[a[i]]++;
        m=max(m,a[i]);
    }
    for(ll i=m;i>(m+1)/2;i--){
        if(mp[i]<2){
            cout<<"Impossible"<<endl;
            return 0;
        }
    }
    if(m%2==0 && mp[m/2]!=1){
        cout<<"Impossible"<<endl;
        return 0;
    }
    if(m%2==1 && mp[(m+1)/2]!=2){
        cout<<"Impossible"<<endl;
        return 0;
    }

    for(ll i=(m+1)/2-1;i>=0;i--){
        if(mp[i]!=0){
            cout<<"Impossible"<<endl;
            return 0;
        }
    }
    cout<<"Possible"<<endl;
    return 0;
}

Measured memory_bytes: 384
h,w = map(int,input().split())
s = [input() for i in range(h)]
grid = [[0 for i in range(w+2)] for j in range(h+2)]
grid2 = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            grid[i+1][j+1] = 1
for i in range(h):
    for j in range(w):
        if grid[i+1][j+1] == 0:
            grid2[i][j] += sum(grid[i][j:j+3]) +sum(grid[i+1][j:j+3]) + sum(grid[i+2][j:j+3])
            grid2[i][j] = str(grid2[i][j])
        else:
            grid2[i][j] = '#'
    print(''.join(grid2[i]))

Measured memory_bytes: 3188
N,Q = map(int,input().split())
S = input()

csum = [0,0]
for i in range(1, N):
    if S[i-1] + S[i] == 'AC':
        csum.append(csum[i-1] + 1)
    else:
        csum.append(csum[i])
        
#文字番号に合わせた形になっている
for i in range(Q):
    l, r = map(int, input().split())
    print(csum[r]-csum[l])

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

int main(){
int X;
cin >>X;
vector <bool > expo(X+1);
expo[1] = 1;
for(int b=2;b<=X;b++){
int v = b*b;
while(v<=X){
expo[v] = 1;
v *= b;
}
}
for(int i=X;i>=1;i--) if(expo[i]){
cout <<i<<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++)
const long long INF = numeric_limits<long long>::max();
int main()
{
    int a;
    cin>>a;
    cout<<a+a*a+a*a*a<<endl;
    return 0;
}

Measured memory_bytes: 3584