akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list> 
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<string>
#include<fstream>
#include<set>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define ld long double
#define vi vector<int>
#define vll vector<long long>
#define pi pair<int,int>
#define pll pair<long long,long long>
#define mp make_pair
#define B begin()
#define E end()
#define S size()
#define m9 1000000007
using namespace std;
 
 

 
ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}
 
/*
ll gcdextended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1; 
    int gcd = gcdextended(b%a, a, &x1, &y1); 
   
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
}
 
 
///RELATIVE COPRIME
ll modinverse(ll a, ll m) 
{ 
    ll x, y; 
   ll g = gcdextended(a, m, &x, &y); 
    if (g != 1) 
return -1;
    else
    { 
        ll res = (x%m + m) % m; 
        return res;  
    } 
} 
  */
ll powmod(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = powmod(x, y/2, m) % m; 
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
} 
///M IS PRIME
ll modif(ll x,ll m){
return(powmod(x,m-2,m));
 
}
 
 
 
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define pin(a) for(auto x:a)cout<<x<<" ";cout<<endl
#define fck(a) cout<<a;exit(0)
#define vvll vector<vector<ll> >
#define A(b) b.begin(),b.end()
#define vpi std::vector<pll>
#include <array>
#include <stack>
#define arr2 array<ll,2>
#define arr3 array<ll,3>
//include<bits/stdc++.h>
 
 
bool fa(vll &x,vll &y){return x[0]<y[0];}
bool fa1(vll &x,vll &y){return x[1]<y[1];}
bool f1(pll &x,pll &y){return x.second>y.second;}
bool f2(pll &x,pll &y){
    return x.first>y.first;
}
 
 
bool f3(ll &x,ll &y){
    return x>y; 
    }


const ll maxn=1e6+2;


int main()
{ fastio;
//freopen("input.txt, "r", stdin); 
//freopen("output.txt", "w", stdout);
ll n;cin>>n;
ll b[n];
forl(i,0,n)cin>>b[i];
sort(b,b+n);
// pin(b);
ll ans=0;
forl(i,0,n){
    forl(t,i+1,n){
        forl(z,t+1,n){
            if(b[i]+b[t]>b[z]&&b[i]!=b[t]&&b[t]!=b[z]){ans++;}
        }
    }
}
p1(ans);


 
return 0;
}
 


  





Measured memory_bytes: 3652
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 100000

typedef long long ll;
typedef pair<int,int> P;

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    string s;
    string t;
    cin >> s >> t;
    int index = -1;
    int n = s.length();
    int m = t.length();
    for(int i = n - m; i >= 0; i--){
        bool flag = true;
        for(int j = 0; j < m; j++){
            if(s[i+j] == '?' || s[i+j] == t[j]) continue;
            else{
                flag = false;
                break;
            } 
        }
        if(flag){
            index = i;
            break;
        }
    }
    if(index < 0) cout << "UNRESTORABLE" << endl;
    if(index >= 0){
        for(int i = 0; i < n; i++){
            if(s[i] == '?') s[i] = 'a';
        }
        for(int i = 0; i < m; i++){
            s[index + i] = t[i];
        }
        cout << s << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf = 1e9+7;


int N;
int cntE[300100], cntW[300100];
string s;
int main(){
    cin>>N;
    cin>>s;

    REP(i,1,N+1){
        if(s[i-1]=='E'){
            cntE[i]=cntE[i-1]+1;
            cntW[i]=cntW[i-1];
        }else{
            cntE[i]=cntE[i-1];
            cntW[i]=cntW[i-1]+1;
        }
    }
    int ans=inf;
    REP(i,0,N){
        ans= min(ans, cntW[i]+(cntE[N]-cntE[i+1]));
    }
    p(ans);
    return 0;
}


Measured memory_bytes: 3076
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main(void){
    int N;
    cin>>N;
    int a[N],b[9];
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    for(int i=0;i<10;i++){
        b[i]=0;
    }
    for(int i=0;i<N;i++){
        if(a[i]<400) b[0]++;
        if(400<=a[i]&&a[i]<800) b[1]++;
        if(800<=a[i]&&a[i]<1200) b[2]++;
        if(1200<=a[i]&&a[i]<1600) b[3]++;
        if(1600<=a[i]&&a[i]<2000) b[4]++;
        if(2000<=a[i]&&a[i]<2400) b[5]++;
        if(2400<=a[i]&&a[i]<2800) b[6]++;
        if(2800<=a[i]&&a[i]<3200) b[7]++;
        if(3200<=a[i]) b[8]++;
    }
    int sum=0;
    for(int i=0;i<=7;i++){
        if(b[i]!=0) sum++;
    }
    if(sum!=0) {cout<<sum<<' '<<sum+b[8];}
    else {cout<<1<<' '<<b[8];}
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

int f(int x, int y){
  return (x <= y ? y - x : x - y + 2);
}

int main(void){
  int x,y;
  cin>>x>>y;

  cout<<min(min(f(x,y), f(-x,y) + 1), min(f(x,-y) + 1, f(-x,-y) + 2))<<endl;
}

Measured memory_bytes: 256
time=[];timeloss=[];ans=0
for i in range(5):
    a=input()
    if int(a[-1])==0:
        ans+=int(a)
    else:
        time.append(int(a))
        timeloss.append(10-int(a[-1]))
while len(time)>0:
        for i in range(len(time)):
            if timeloss[i]==min(timeloss):
                ans+=time[i]
                if not len(time)==1:
                    ans+=timeloss[i]
                del time[i];del timeloss[i];break
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ((int)(x).size())

typedef map<int, int> M;
typedef pair<int, int> P;
typedef long long ll;

int main() {
  ll N, D, result = 0;
  cin >> N >> D;
  vector<ll> X(N), Y(N);
  REP(i, N) {
    cin >> X[i] >> Y[i];
  }
  REP(i, N) {
    if (sqrt(X[i]*X[i]+Y[i]*Y[i]) <= D) {
      result++;
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 6484
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}

//vc alp(26) ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//cout<<""<<endl;
int main(){
  int a,b;cin>>a>>b;
  bool ok=false;int num;
  if(keta(b)==1)num=a*10+b;
  else if(keta(b)==2)num=a*100+b;
  else num=a*1000+b;
  for(int i=1;i<=1000;i++){
    if(i*i==num)ok=true;
  }
  if(ok)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}







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

int main() {
	int n, count=100000000, a, c;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		c = 0;
		while (a % 2 == 0) {
			c++;
			a /= 2;
		}
		if (count > c) {
			count = c;
		}
	}
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#template
def inputlist(): return [int(j) for j in input().split()]
#template
import copy
def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)
def check(s,n):
    if len(s) < n:
        d = n-len(s)
        for _ in range(d):
            s = '0'+s
    return s
ans = 0
H,W,K = inputlist()
maze = [[0] for _ in range(H)]
for i in range(H):
    maze[i] = list(input())
maza = copy.deepcopy(maze)
for i in range(2**H):
    xi = base10to(i,2)
    xi = check(xi,H)
    x_ = []
    for ind in range(H):
        if xi[ind] == "1":
            x_.append(ind)
    for j in range(2**W):
        yj = base10to(j,2)
        yj = check(yj,W)
        y_ = []
        for stu in range(W):
            if yj[stu] == "1":
                y_.append(stu)
        for x in x_:
            maze[x] = ["x" for _ in range(W)]
        for y in y_:
            for xa in range(H):
                maze[xa][y] = "x"
        count = 0
        for a in range(H):
            for b in range(W):
                if maze[a][b] == "#":
                    count+=1
        if count == K:
            ans +=1
        maze = copy.deepcopy(maza)

print(ans)

Measured memory_bytes: 80508
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#include <cstring>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define FIND(x, target) find(x.begin(),x.end(),target)
#define pb(x) push_back(x)
#define output(x) cout<<x<<endl
#define ERASE(x, n) x.erase(x.begin(), x.begin()+n)
// #define int long long
#define P pair<int, int>
typedef long long ll;

const long long int MOD = 1e9+7;
const int INF = -1;
ll dp[100005][13];

signed main(void) {
  	string S;
  	cin >> S;

  	ll beki = 1;
  	for (int i=0; i<S.size(); i++) {
  		if (S[i] != '?') {
  			ll number = int (S[i]) - int('0');
  			if (i==0) {
  				dp[i][number%13] = 1;
  			} else {
	  			for (int j=0; j<13; j++) {
	  				dp[i][(number + j*10)%13] = dp[i-1][j]%MOD;
	  				// cout << number + j*10 << endl;
	  				// cout << i << " " << (number + j*10)%13 << ": " << dp[i][(number + j*10)%13] << endl;
	  			}
	  		}
  		} else {
  			if (i==0) {
  				for (int j=0; j<10; j++) {
			  		dp[i][j] = 1;
			  	}
  			} else {
	  			for (int j=0; j<10; j++) {
	  				for (int k=0; k<13; k++) {
	  					dp[i][(j+k*10)%13] = (dp[i][(j+k*10)%13] + dp[i-1][k])%MOD;
	  				}
	  			}
	  		}
  		}

  // 		for (int j=0; j<13; j++) {
		// 	cout << i << " " << j << ": " << dp[i][j] << endl;
		// }
  	}

  	cout << dp[S.size()-1][5] << endl;

	return 0;
}


Measured memory_bytes: 10624
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

int N, M;
vector<vector<bool>> G(8, vector<bool>(8, false));

int dfs(int v, vector<bool> visited) {
    bool all_visited = true;
    REP(i, N) {
        if (!visited[i]) {
            all_visited = false;
            break;
        }
    }
    if (all_visited) {
        return 1;
    }

    int res = 0;
    REP(i, N) {
        if (!G[v][i]) {
            continue;
        } else if (visited[i]) {
            continue;
        }

        visited[i] = true;
        res += dfs(i, visited);
        visited[i] = false;
    }
    return res;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    REP(i, M) {
        int a, b;
        cin >> a >> b;
        G[a - 1][b - 1] = true;
        G[b - 1][a - 1] = true;
    }

    vector<bool> visited(N, false);
    visited[0] = true;
    cout << dfs(0, visited) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  vector<string> a(H);
  
  for(int i=0; i<H; i++){
    cin >> a.at(i);
  }
  
  for(int i=0; i<W+2; i++){
    cout << "#";
  }
  cout << endl;
  
  for(int i=0; i<H; i++){
    cout << "#" << a.at(i) << "#" << endl;
  }
  
  for(int i=0; i<W+2; i++){
    cout << "#";
  }
  cout << endl;
}

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

using namespace std;
using ll = long long;

ll solve(ll a, ll b) {
  if (a == b) return 2 * a - 2;
  if (b < a) return solve(b, a);
  ll lb = a, ub = 2 * b, ab = a * b;
  while (1 < ub - lb) {
    ll mid  = (lb + ub) / 2.0;
    ll maxp = (mid + 1) / 2 * (mid / 2 + 1);
    if (maxp < ab)
      lb = mid;
    else
      ub = mid;
  }
  return lb - 1;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int Q;
  cin >> Q;
  for (int i = 0; i < Q; i++) {
    ll a, b;
    cin >> a >> b;
    cout << solve(a, b) << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;


int main(){
    
    vector<ll>v(3);
    for(ll i = 0; i < 3; i++)cin >> v[i];
    sort(v.begin(), v.end());
    cout << v[0] + v[1] + v[2] * 10 << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(){
  int i,j,n,q;
  int count=0;
  int right,mid,left;
  scanf("%d",&n);
  int S[n];
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  int T[q];
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }
  for(i=0;i<q;i++){
    left=0;
    right=n;
    while(left<right){
      mid=(left+right)/2;
      if(S[mid]==T[i]){
        count++;
        break;
      }
      else if(T[i]<S[mid]){
        right=mid;
      }
        else left=mid+1;
        }
  }
  printf("%d\n",count);
  return 0;
}


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

using namespace std;

int main( ) {
    ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	string a,b,c;
	t = 1;
	while(t--) {
	 cin >> a >> b >> c;
	 if(a[a.size( ) - 1] == b[0] && b[b.size( ) - 1] == c[0])
	  cout << "YES" << endl;
	 else
	  cout << "NO" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll getint() {
	ll i = 0, f = 1;
	char c;
	for (c = getchar(); (c != '-') && (c < '0' || c > '9'); c = getchar());
	if (c == '-') c = getchar(), f = -1;
	for (; c >= '0' && c <= '9'; c = getchar())
		i = (i << 3) + (i << 1) + c - '0';
	return i * f;
}
const int N = 100005, mod = 1e9 + 7;
int n, ans, f[N], g[N];
ll a[N], A, B;
int main() {
	n = getint(), A = getint(), B = getint();
	if (A > B) swap(A, B);
	for (int i = 1; i <= n; i++) a[i] = getint();
	sort(a + 1, a + n + 1);
	for (int i = 3; i <= n; i++)
		if (a[i] - a[i - 2] < A) {
			puts("0");
			return 0;
		}
	f[0] = g[0] = 1;
	int l = 0, r = 0;
	for (int i = 1; i <= n; i++) {
		while (r < i - 1 && a[i] - a[r + 1] >= B) ++r;
		if (l <= r) f[i] = (g[r] + mod - (l ? g[l - 1] : 0)) % mod;
		g[i] = (g[i - 1] + f[i]) % mod;
		if (i > 1 && a[i] - a[i - 1] < A) l = i - 1;
	}
	for (int i = n; i >= 0; i--) {
		ans = (ans + f[i]) % mod;
		if (i < n && a[i + 1] - a[i] < A) break;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};

const int INF = 1<<30;

int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<int> lv(n+1), rv(n+1);
    for(int i = 0; i < n; i++){
        if (s[i] == 'W') lv[i+1]++;
        else rv[i+1]++;
        lv[i+1] += lv[i];
        rv[i+1] += rv[i];
    }
    int ans = INF;
    for(int i = 0; i < n; i++){
        int cnt = 0;
        ans = min(ans, lv[i] + rv[n]-rv[i+1]);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;





int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	int X;

	cin >> X;

	if (X >= 30)
		cout << "Yes\n";
	else
		cout << "No\n";

	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
	return 0;
}


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

const int maxn = 1e5+10;

int n, m, a[maxn], b[maxn], p[maxn];
vector<int> to[maxn];

bool cmd(int i, int j) { return a[i]-b[i] < a[j]-b[j]; }

int f[maxn];
long long B[maxn], w[maxn];
int find(int x) { return f[x]>0?f[x]=find(f[x]):x; }

bool vis[maxn];

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++i) {
		scanf("%d%d", a+i, b+i);
		B[i] = b[i];
		p[i] = i;
	}
	int u, v;
	for (int j = 1; j <= m; ++j) {
		scanf("%d%d", &u, &v);
		to[u].push_back(v);
		to[v].push_back(u);
	}
	sort(p+1, p+1+n, cmd);
	for (int _ = 1; _ <= n; ++_) {
		int i = p[_];
//		printf("%d: %d\n", i, a[i]-b[i]);
		w[i] = max(0, a[i]-b[i]);
		for (auto __: to[i]) if (vis[__]) {
			int j = find(__);
			if (j == i) continue;
			if (B[j]+w[j] >= a[i]-b[i]) w[i] = min(w[i], w[j]);
			else w[i] = min(w[i], (a[i]-b[i])-B[j]);
			B[i] += B[j];
			f[j] = i;
		}
		vis[i] = 1;
//		printf("%d: B=%d w=%d\n", i, B[i], w[i]);
	}
	cout << w[p[n]]+B[p[n]] << endl;
}


Measured memory_bytes: 9084
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef double lld;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
template <typename T, typename U>ostream &operator<<(ostream &out, const pair<T, U> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>void print(const ContainerType<ValueType, Args...> &c){for (const auto &v : c)cout << v << ' ';cout << '\n';} void print(){cout<<'\n';}
template <typename T, typename... Args>void print(T a, Args... args){cout << a << " ";print(args...);}
lli llipower(lli x, lli y, lli p = LLONG_MAX){lli res = 1;x = x % p;while (y > 0){if (y & 1)res = (res * x) % p;y = y >> 1;x = (x * x) % p;}return res;}

//8====================================D
int main(){
    int n;
    cin>>n;
    cout<<(1000-n%1000)%1000<<endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A, B, C, D;
  string ans;
  
  cin >> A >> B >> C >> D;
  
  while(1){
    C -= B;
    if(C <= 0){
      ans = "Yes";
      break;
    }
    
    A -= D;
    if(A <= 0){
      ans = "No";
      break;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

llint n, k;
llint sum[200005];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> k;
	
	for(int i = 1; i <= n; i++) sum[i] = sum[i-1] + i, sum[i] %= mod;
	
	llint ans = 0;
	for(int i = k; i <= n+1; i++){
		ans += sum[n] - sum[n-i] + mod, ans %= mod;
		ans += mod - sum[i-1] + 1, ans %= mod;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 5124
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n;
    cin >> n;
    vi a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            swap(a[i], a[j]);
            bool q = true;
            for(int k = 0; k < n - 1; k++){
                if(a[k] + 1 != a[k+1]) {
                    q = false;
                    break;
                }
            }
            if(q){
                cout << "YES";
                return 0;
            }
            swap(a[i], a[j]);
        }
    }
    cout << "NO";
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

const int MAXN=1e6+5;

int mark[MAXN];

void solve(){
    int n, mx=0, cnt=0;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        mx=max(a[i],mx);
    }
    for(int i=0;i<n;i++){
        for(int j=a[i];j<=mx;j+=a[i]){
            mark[j]++;
        }
    }
    for(int i=0;i<n;i++){
        if(!mark[a[i]] || mark[a[i]]==1)cnt++;
    }
    cout<<cnt<<endl;
}

int main()
{
    //freopen("IN.txt","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 7892
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <bitset>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
typedef tuple<int, int, int> t3;

const int MOD = 1e9 + 7;
int h, w, k;

const int L = 2e7 + 10;
ll F[L], IF[L];

ll pw(ll x, ll y = MOD - 2) {
	ll res = 1;
	while(y) {
		if(y & 1) res = res * x % MOD;
		x = x * x % MOD;
		y >>= 1;
	}
	return res;
}

ll f(int a, int b) {
	return (F[a+b] * 2 * a + F[a+b] * IF[2] % MOD * a % MOD * (a-1) + (ll)a * b % MOD * F[a+b] + (ll)a * (a-1) % MOD * (ll)b % MOD * F[a+b] % MOD * IF[3] * 2LL) % MOD;
}

ll Do(int a, int b) {
	return (f(a,b) + f(b,a)) % MOD;
}

int main() {
	F[0] = 1;
	for(int i=1;i<L;i++) F[i] = i * F[i-1] % MOD;
	IF[L-1] = pw(F[L-1]);
	for(int i=L-2;i>=0;i--) {
		IF[i] = (i+1) * IF[i+1] % MOD;
	}
	scanf("%d%d%d", &h, &w, &k);
	ll ans = 0;
	for(int a=0;a<=h;a++) {
		int b = k - a;
		if(0 <= b && b <= w) {
			ans = (ans + Do(a,b) * F[h] % MOD * IF[a] % MOD * IF[h-a] % MOD * F[w] % MOD * IF[b] % MOD * IF[w-b]) % MOD;
		}
	}
	printf("%lld\n", ans);
	return 0;
}


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

int main(){
  vector<int> vec(3);
  for(int i=0;i<3;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  cout << vec.at(0) + vec.at(1) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define re(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int
struct Union{
  vector<int> par;
  Union(int a){
  par=vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(int a,int b){
    return (find(a)==find(b));
  }
  int size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    int c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
int main(){
  long long x,y;
  cin >> x >> y;
  long long q=3000000000;
  if(y-x>=0)q=min(q,y-x);
  if(-y+x>=0)q=min(q,-y+x+2);
  if(y+x>=0)q=min(q,x+y+1);
  if(-y-x>=0)q=min(q,-x-y+1);
  cout << q;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  string S;
  cin >> S;
  int N = S.size();
  map<int, int> mp;
  vector<int> memo(N+1);
  int tmp = 0;
  rep(i, N) {
    memo[i] = tmp;
    if(S[i] == 'g') tmp++;
    else tmp--;
    if(mp.count(tmp)) mp[tmp]++;
    else mp[tmp] = 1;
  }
  memo[N] = tmp;
  ll ans = 0;
  tmp = 2;
  rep(i, N) {
    if(S[i] == 'g' &&
       mp.begin()->first >= tmp)
      tmp += 2, ans++;
    mp[memo[i+1]]--;
    if(mp[memo[i+1]] == 0)
      mp.erase(memo[i+1]);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 5376
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
int a,b;
int c=0;
cin>>a>>b;
if(b>=a)
c++;
c=c+a-1;
cout<<c;
system("pause");
return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

int main(){
  int N,K,ans=INF;
  cin >> N >> K;
  int i0;
  int x[N];
  FOR(i,0,N)cin >> x[i];
  FOR(i,0,N-K+1){
    int l = x[i];
    int r = x[i+K-1];
    if(l <= 0 && r <= 0){
      ans = min(ans,abs(l));
    }
    else if(l >= 0 && r >= 0){
      ans = min(ans,r);
    }
    else ans = min(ans,2*min(abs(l),abs(r))+max(abs(l),abs(r)));
  }
  cout << ans << endl;
}


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

using namespace std;


int main(){
 string s;
  cin>>s;
  if(s[5]=='1') cout<<"TBD"<<endl;
  else{
  if(s[6]=='1'||s[6]=='2'||s[6]=='3'||s[6]=='4') cout<<"Heisei"<<endl;
  else cout<<"TBD"<<endl;
  }
}

Measured memory_bytes: 256
def main():
    n = int(input())
    num_list = []
    for _ in range(n-1):
        num_list.append(list(map(int,input().split())))

    for i in range(n):
        t = 0
        for j in range(i,n-1):
            if t <= num_list[j][1]:
                t = num_list[j][1]
            elif t % num_list[j][2] != 0:
                t = (t // num_list[j][2]+1) * num_list[j][2]
            t += num_list[j][0]
        print(t)

if __name__ == '__main__':
    main()

Measured memory_bytes: 42092
#include<stdio.h>
int main(){
  long long int a,b,n,i,j;
  while(scanf("%lld %lld",&a,&b)!=EOF){
    if(a>=b){
      n=b;
    }
    else{
      n=a;
    }
    i=a;
    j=b;

    while(1){
      /*   if(n<a){
	n=a%n;
      if(n==0){
	n=a;
	break;
      }
      }
      else if(n<b){
	n=b%n;
      if(n==0){
	n=b;
	break;
      }
      }*/

      n=a%b;
      if(n==0){
	n=b;
	break;
      }else{
	a=b;
	b=n;
      }

    }
    /*
    while(1){
      if(a*i==b*j){
	break;
      }
      else if(a*i<b*j){
	i++;
      }
     else if(a*i>b*j){
	j++;
	   }
	   }*/

    printf("%lld %.0f\n",n,(double)(i)*(double)(j)/(double)(n));
  }
  return (0);
}

Measured memory_bytes: 1060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll max_n = 2e5+5;

int main() {
    // your code goes here
    ll n, k, h[200005], sum = 0;
    cin >> n >> k;
    for(ll i = 0; i < n; i++){
        cin >> h[i];
    }
    sort(h, h + n);
    for(ll i = 0; i < n-k; i++){
        sum += h[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

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

signed main(){
    int n; cin >> n;
    ll g[n+1][n+1];
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            g[i][j]=gcd(i,j);
        }
    }
    ll sum=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            for(int k=1;k<=n;k++){
                sum+=gcd(i,g[j][k]);
            }
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 3884
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    x = int(input())

    for i in range(-120,120):
        for j in range(-120,120):
            if i**5 - j ** 5 == x:
                print(i, j)
                exit()

if __name__=="__main__":
    main()


Measured memory_bytes: 66952
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

int main(){
        ll n;
        scanf("%lld", &n);
        vector<vector<P>> links(n, vector<P>(0));
        for(ll i=0; i<n-1; i++){
                ll a, b, c;
                scanf("%lld %lld %lld", &a, &b, &c);
                links[a-1].push_back(P(b-1, c));
                links[b-1].push_back(P(a-1, c));
        }


        ll q, k;
        scanf("%lld %lld", &q, &k);
        k--;

        vector<ll> dist(n, 1e18);
        dist[k] = 0;
        priority_queue<P, vector<P>, greater<P>> que;
        que.emplace(dist[k], k);

        while(!que.empty()){
                ll cost, idx;
                tie(cost, idx) = que.top();
                que.pop();
                if(dist[idx]<cost) continue;

                for(auto e: links[idx]){
                        if(dist[e.first]<=cost+e.second) continue;
                        dist[e.first] = cost+e.second;
                        que.emplace(dist[e.first], e.first);
                }
        }


        for(ll i=0; i<q; i++){
                ll x, y;
                scanf("%lld %lld", &x, &y);
                printf("%lld\n", dist[x-1]+dist[y-1]);
        }
        return 0;
}

Measured memory_bytes: 13016
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		
		Scanner scan =new Scanner(System.in);
		int n=scan.nextInt();
		int min=scan.nextInt();
		int max=-2000000000;
		for(int i=1;i<n;i++){
			int tmp=scan.nextInt();
			max=Math.max(max, tmp-min);
			min=Math.min(min, tmp);
		}
		System.out.println(max);
	}

}



Measured memory_bytes: 100000
import java.util.Scanner;


public class Main {
	
	public static int gcd(int a, int b){
		int r;
		if(b > a){
			int t = a;
			a = b;
			b = t;
		}
		
		while((r = a % b) != 0){
			a = b;
			b = r;
		}
		
		return b;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
			System.out.println(gcd(sc.nextInt(), sc.nextInt()));
		}

	}

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
const int64_t MOD = 1e9 + 7;

#define MAX 100005
#define NIL -1

struct Node { int p, l, r; };

Node T[MAX];
int n, D[MAX];

void print(int u) {
	int i, c;
	cout << "node " << u << ": ";
	cout << "parent = " << T[u].p << ", ";
	cout << "depth = " << D[u] << ", ";

	if (T[u].p == NIL) cout << "root, ";
	else if (T[u].l == NIL) cout << "leaf, ";
	else cout << "internal node, ";

	cout << "[";

	for (int i = 0, c = T[u].l; c != NIL; i++, c = T[c].r) {
		if (i) cout << ", ";
		cout << c;
	}
	cout << "]" << endl;
}

void rec(int u, int p) {
	D[u] = p;
	if (T[u].r != NIL) rec(T[u].r, p);
	if (T[u].l != NIL) rec(T[u].l, p + 1);
}

int main() {
	int i, j, d, v, c, l, r;
	cin >> n;
	for (int i = 0; i < n; i++) {
		T[i].p = T[i].l = T[i].r = NIL;
	}

	for (int i = 0; i < n; i++) {
		cin >> v >> d;
		for (int j = 0; j < d; j++) {
			cin >> c;
			if (j == 0) T[v].l = c;
			else T[l].r = c;
			l = c;
			T[c].p = v;
		}
	}
	for (int i = 0; i < n; i++) {
		if (T[i].p == NIL) r = i;
	}

	rec(r, 0);

	for (int i = 0; i < n; i++) print(i);

	return 0;
}


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

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

  for (int i = 0; i <= n; i++) {
    if (n < pow(2, i + 1) && n >= pow(2, i)) {
      cout << pow(2, i) << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

    int n;
    cin>>n;
    vi in(n);
    cin>>in;
    sort(all(in));
    int out=0;
    rep(i,n)loop(j,i+1,n){
        out+=lower_bound(all(in),in[i]+in[j])-in.begin()-j-1;
    }
    cout<<out<<endl;
}


Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		HashSet<Integer> set = new HashSet<Integer>();

		for (int i=0; i < 3; i++){
			set.add(Integer.parseInt(sc.next()));
		}

		System.out.println(set.size());

	}
}



Measured memory_bytes: 21844
fun main(args: Array<String>) {
    fun calcDist(x: Double, y: Double) = Math.sqrt((x * x + y * y))
    val n = readLine()!!.toInt()
    val xyrList = mutableListOf<Triple<Double, Double, Double>>()
    (1..n).forEach {
        val (x, y) = readLine()!!.split(' ').map(String::toDouble)
        xyrList.add(Triple(x, y, Math.atan2(y, x)))
    }
    xyrList.sortBy { it.third }
    xyrList.addAll(xyrList)
    var ans = 0.0
    for (start in 0 until n) {
        var end = start
        var curDist = calcDist(xyrList[start].first, xyrList[start].second)
        while (++end - start < n) {
            val subList = xyrList.subList(start, end + 1)
            val nextDist = calcDist(subList.map { it.first }.sum(), subList.map { it.second }.sum())
            if (curDist > nextDist) break else curDist = nextDist
        }
        ans = Math.max(ans, curDist)
    }
    println(ans)
}

Measured memory_bytes: 51432
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;

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

    int q;
    cin>>q;
    for(int i=0;i<q;i++){
        int c,a,n;
        cin>>c>>a>>n;
        int ans=0;
        for(int x=0;x<=1000;x++){
            if(x*2>c||x>a)break;
            for(int y=0;y<=1000;y++){
                if(x*2+y*3>c)break;
                int tc=c-(x*2+y*3),ta=a-x,tn=n;
                ans=max(ans,x+y+min({tc,ta,tn}));
            }
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 3188
e,n,N = map(int,input().split())
w=s=0
for _ in[0]*N:
    x,y,a = map(int,input().split())
    if a == 1:
        w = max(w,x)
    elif a == 2:
        e = min(e,x)
    elif a == 3:
        s = max(s,y)
    else:
        n = min(n,y)
print((e-w)*(n-s)*(e>w)*(n>s))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1e14;
const ll MOD = 1e9 + 7;
// level iバーガーの厚さ a[i] := 2*a[i-1] + 3, a[0] = 1
// level iバーガーのパティの総数 p[i] := 2*p[i-1] + 1, p[0] = 1
vector<ll> a = { 1 }, p = { 1 };


ll f(ll n, ll x)
{
    if (n == 0) {
        return x <= 0 ? 0 : 1;
    } else if (x <= 1 + a[n - 1]) {
        return f(n - 1, x - 1);
    } else {
        return p[n - 1] + 1 + f(n - 1, x - 2 - a[n - 1]);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n, x;
    cin >> n >> x;
    for (int i = 0; i < n; i++) {
        a.push_back(a[i] * 2 + 3);
        p.push_back(p[i] * 2 + 1);
    }
    cout << f(n, x) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a,b[10000];
    cin >> a;
    for(int i = 0;i < a;i++)cin >> b[i];
    for(int i = 0;i < a;i++){
        int v,j;
        v = b[i];
        j = i - 1;
        while(j >= 0 && b[j] > v){
            b[j + 1] = b[j];
            b[j] = v;
            j--;
        }
    	for (int k = 0; k < a; k++) {
			if (k < a - 1)cout << b[k] << " ";
			else cout << b[k] << endl;
		}
    }
    return 0;
}


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

using namespace std;

const int mod = 1e9 + 7;

int N, M;
char a[1005][1005];
int dp[1005][1005];

int main()
{
    scanf("%d%d\n", &N, &M);
    for(int i = 1; i <= N; i++)
        scanf("%s", a[i] + 1);

    dp[1][1] = 1;
    for(int i = 1; i <= N; i++)
        for(int j = 1; j <= M; j++)
        {
            if(i == 1 && j == 1)    continue;
            if(a[i][j] == '#')  continue;

            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
        }
    cout << dp[N][M];

    exit(0);
}

Measured memory_bytes: 5120
#標準入力
n=int(input())
t=[int(i) for i in input().split()]
v=[int(i) for i in input().split()]

#n個の区間について
dt=[0 for i in range(n)] #区間の時間
v0=[0 for i in range(n)] #各区間の最初の速度
ve=[0 for i in range(n)] #各区間の最後の速度
S=[0 for i in range(n)] #各区間に走った距離（v-tグラフの面積）
ok=0 #ok牧場　後でフラグに使う

#dt, v0, veを格納(v0, veは後で題意を満たすように調整する）----------

for i in range(n):
    if n ==1:
        dt[0]=t[0]
    elif i==n-1:
        v0[i]=ve[i-1]
        ve[i]=0
        dt[i]=t[i]
    else:
        v0[i]=ve[i-1]
        dt[i]=t[i]
        ve[i]=min(v[i+1],v[i],v0[i]+dt[i])

#α=(ve-v0)/dtが±1以下になるように調整-----------------------------------------

while ok==0:
    for i in range(n-1):
        if  abs((ve[i+1]-v0[i+1])/dt[i+1]) >1:
                ve[i]=ve[i]-1
                v0[i+1]=v0[i+1]-1

                break
    else:
        ok=1
#------------------------------------------------------------------------------------------------

#各区間に関して、走った距離（v-tグラフの面積）を計算---------------------
for i in range(n):

    ttt=0.5*(ve[i]+dt[i]-v0[i])
    vvv=ttt+v0[i]
    if vvv-v[i]>=0:
        S[i]=0.5*(v0[i]+vvv)*ttt + 0.5*(ve[i]+vvv)*(dt[i]-ttt) - (ttt-v[i]+v0[i])*(vvv-v[i]) 

    else:
        S[i]=0.5*(v0[i]+vvv)*ttt + 0.5*(ve[i]+vvv)*(dt[i]-ttt)

#------------------------------------------------------------------------------------------------
print(sum(S)) #各区間の走った距離の総和（答え）を出力

Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	vector<vector<int>> g(n);
	rep(i, 0, n - 1) {
		int u, v; cin >> u >> v;
		u--; v--;
		g[u].push_back(v); g[v].push_back(u);
	}
	vector<ll> ans(n), c(n), d(n, -1);
	rep(i, 0, n) cin >> c[i];
	sort(c.begin(), c.end());
	ll a = 0;
	rep(i, 0, n - 1) a += c[i];
	printf("%lld\n", a);
	queue<int> q;
	d[0] = 0; q.push(0);
	while (!q.empty())
	{
		int p = q.front(); q.pop();
		for (int v : g[p])if (d[v] < 0) {
			q.push(v); d[v] = d[p] + 1;
		}
	}
	vector<P> k;
	rep(i, 0, n) k.push_back({ d[i],i });
	sort(k.begin(), k.end(), greater<P>());
	rep(i, 0, n)ans[k[i].second] = c[i];
	rep(i, 0, n) printf("%lld ", ans[i]);
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
const long long INF = 1LL << 60;

int main() {
  string S; cin>>S;
  if(S=="ABC") cout<<"ARC"<<endl;
  if(S=="ARC") cout<<"ABC"<<endl;
}


Measured memory_bytes: 3624
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n+1)
for i in reversed(range(1,n+1)):
    tmp_num=i
    tmp=0
    while tmp_num<=n:
        tmp+=b[tmp_num]
        tmp_num+=i
    b[i]=(a[i-1]+tmp)%2
cnt=0
c=[]
for i in range(len(b)):
    if b[i]==1:
        cnt+=1
        c.append(str(i))
print(cnt)
if cnt!=0:
    print(" ".join(c))


Measured memory_bytes: 17208
'use strict';
process.stdin.on('data', function(chunk) {
    var inputs = chunk.toString().trim().split(' ');
    var W = Number(inputs[0]);
    var H = Number(inputs[1]);
    var x = Number(inputs[2]);
    var y = Number(inputs[3]);
    var r = Number(inputs[4]);

    var x0 = W - x - r;
    var x1 = W - x + r;
    var y0 = H - y - r;
    var y1 = H - y + r;

    if ((x0 >= 0 && x1 <= W) && (y0 >=0 && y1 <= H)) {
        console.log('Yes');
    } else {
        console.log('No');
    }
});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 15560
# AOJ ITP2_1_D: Vector II
# Python3 2018.6.24 bal4u

from collections import deque
n, q = map(int, input().split())
Q = []
for i in range(n): Q.append(deque())
for i in range(q):
	a, *b = map(int, input().split())
	if   a == 0: Q[b[0]].append(b[1])   # pushBack
	elif a == 1: print(*Q[b[0]])        # dump
	else: Q[b[0]].clear()                    # clear




Measured memory_bytes: 30820
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC050
{
	class Q2
	{
		static void Main()
		{
			int N = int.Parse(Console.ReadLine());
			List<int> T = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
			int M = int.Parse(Console.ReadLine());
			List<Tuple<int, int>> Drinks = Enumerable.Range(1, M).Select(x =>
			 {
				 string[] buff = Console.ReadLine().Split(' ');
				 return new Tuple<int, int>(int.Parse(buff[0]) - 1, int.Parse(buff[1]));
			 }).ToList();
			foreach(Tuple<int,int> drink in Drinks)
			{
				var Tdelta = new List<int>(T);
				Tdelta[drink.Item1] = drink.Item2;
				Console.WriteLine(Tdelta.Sum());
			}
		}
	}
}


Measured memory_bytes: 3032