akhauriyash/Code-Regression huggingface dataset:
//# define FLAG
///delet....................................
# include <iostream>
# include <cstring>
# include <cstdlib>
# include <cstdio>
# include <string>
# include <cmath>
# include <ctime>
# include <set>
# include <map>
# include <queue>
# include <stack>
# include <bitset>
# include <vector>
# include <fstream>
# include <algorithm>
using namespace std;
# define eps 1e-8
# define pb push_back
# define mp make_pair
# define pi acos(-1.0)
# define bug puts("H");
# define mem(a,b) memset(a,b,sizeof(a))
# define IOS ios::sync_with_stdio(false);
# define FO(i,n,a) for(int i=n; i>=a; --i)
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define MAX 0x7fffffffffffff
# define INF 0x3f3f3f3f
# define MOD 1000000007
///          1234567890
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef unsigned long long ULL;
typedef long long LL;
inline int Scan(){
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
///coding...................................


int main()
{
    IOS
#ifdef FLAG
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif /// FLAG
    int x,a,b;
    cin>>x>>a>>b;
    if(abs(a-x)<abs(b-x))puts("A");
    else puts("B");
    return 0;
}
///delete FLAG..............................



















Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;

using namespace std;


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int last = 1e9 + 2, inp, p = 0, ans = 0;
    for(int i = 0; i < n; i++){
        cin >> inp;
        if (last >= inp){
            p++;
        }

        else{
            ans = max(ans, p);
            p = 1;
        }
        last = inp;;
    }
    ans = max(ans, p);
    cout << ans - 1 << endl;

    return 0;


}


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

int main()
{
    int n,l;
    cin>>n>>l;
    int s=(2*l+n-1)*n/2;
    if(l+n-1<0)
    {
        s-=l+n-1;
    }
    else
    {
        if(l>0)
        {
            s-=l;
        }
    }
    cout<<s<<endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;



int main(void){
    string s;
    cin>>s;
    if(s=="AAA")cout<<"No"<<endl;
    else{
        if(s=="BBB")cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
    return 0;

}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<set>
#include<stack>
#include<queue>
using namespace std;

int main()
{
long long int n,x,nw,m;
scanf("%lld %lld %lld",&n,&x,&m);
long long int fst[100005]={};
long long int ss[100005]={};
nw=x;
int st=0,fi=0,flg=0;
for(int i=1;i<200000;i++)
{
	if(fst[nw]!=0){st=fst[nw]; fi=i-1;break;} //ループの開始はst,終了はfiで周期的
	fst[nw]=i;
	ss[i]=ss[i-1]+nw;
	//printf("%d %lld %lld\n",fst[nw],nw,ss[i]);
	nw=(nw*nw)%m;
	if(i==n){flg=1;break;}
}
//ループ前の部分:ss[st-1],ループの部分:ss[fi]-ss[st-1],ループの回数:(n-st+1)/(fi-st+1),
//ループ後の部分:zed=(n-st+1)%(fi-st+1)として ss[st-1+zed]-ss[st-1];
long long int ans=ss[st-1];
if(flg==0)
{
long long int lp=(n-st+1)/(fi-st+1);
long long int yo=(n-st+1)%(fi-st+1);
ans=ans+lp*(ss[fi]-ss[st-1]);
ans=ans+ss[st-1+yo]-ss[st-1];
}
else{ans=ss[n];}
printf("%lld",ans);
}


Measured memory_bytes: 5368
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
int main(){
	float n;cin>>n;
	float a=0,ans=0;
	vector<float>v(n);
	rep(i,n)cin>>v[i];
	sort(v.begin(),v.end());
	ans=v[0];
	rep(i,n-1){
		ans=(ans+v[i+1])/2;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
//NAME-DEEPESH BHATT
//Institute-IIT Dhanbad
//MOTTO-THINK FIRST,CODE LATER
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1000000007  ;
#define pb push_back
#define mp make_pair
#define endl '\n'
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a ,ll b)
{
    return a/gcd(a,b)*b;
}
ll power(ll a,ll n)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2);
    p = (p * p);
    if (n % 2)
        return (p * a);
    else
        return p;
}
int main()
{
    ios_base::sync_with_stdio(false);    //for fast I/O operation
    cin.tie(NULL);
    ll test=1;
    /*cin>>test;*/
    while(test--) {
        int n,maxWeight;
        cin >> n>>maxWeight;
        int* weights = new int[n+1];
        ll* values = new ll[n+1];
        for(int i = 1; i <= n; i++){
            cin >> weights[i]>>values[i];
        }
        ll **dp=new ll*[n+1];
        for(int i=0;i<=n;i++){
            dp[i]=new ll[maxWeight+1];
        }
        for(int i=0;i<=n;i++){
            for(int j=0;j<=maxWeight;j++){
                dp[i][j]=0;
            }
        }
        for(int i=1;i<=n;i++){
            for(int j=1;j<=maxWeight;j++){
                if(j>=weights[i]){
                    dp[i][j]=max(dp[i-1][j-weights[i]]+values[i],dp[i-1][j]);
                }
                else{
                    dp[i][j]=dp[i-1][j];
                }
            }
        }
        ll ans=0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=maxWeight;j++){
                ans=max(ans,dp[i][j]);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 79488
// CPP program to print prime factors and their 
// powers. 
#include <bits/stdc++.h> 
using namespace std; 

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  1e+5+7;

vpll v;
// function to calculate all the prime factors and 
// count of every prime factor 
void factorize(long long n) 
{ 
	int count = 0; 

	// count the number of times 2 divides 
	while (!(n % 2)) { 
		n >>= 1; // equivalent to n=n/2; 
		count++; 
	} 

	// if 2 divides it 
	if (count) 
		v.pb({2,count});

	// check for all the possible numbers that can 
	// divide it 
	for (long long i = 3; i <= sqrt(n); i += 2) { 
		count = 0; 
		while (n % i == 0) { 
			count++; 
			n = n / i; 
		} 
		if (count) 
			v.pb({i,count}); 
	} 

	// if n at the end is a prime number. 
	if (n > 2) 
		v.pb({n,1});
} 
ll func(ll mid){return (mid*(mid+1))/2;}
ll binsearch(ll x)
{
	ll l = 1;ll r = 1e+8;ll ans = -1;
	while(l<=r)
	{
		ll mid = (l+r)/2;
		if(func(mid)<=x){ans = mid;l =mid+1;}
		else r = mid-1;
	}
	return ans;
}
// driver program to test the above function 
int main() 
{ 
	ll n;cin>>n;ll ans1 = 0;
	factorize(n); 
	for(auto it:v)
	{
		ans1 += binsearch(it.s);
	}
	cout<<ans1<<endl;
	return 0; 
} 


Measured memory_bytes: 3684
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {

     char buf[16];
     char buf2[16];

     int len;
    
    scanf("%16s",buf);
    scanf("%16s",buf2);

    len = strlen(buf);

    for(int i = 0;i < len;i++){
        if(buf[i] != buf2[i]){
            printf("No\n");
            return 0;
        }
    }

    printf("Yes\n");

    return 0;
}

Measured memory_bytes: 2092
#include <bits/stdc++.h>
#define RANGE(i,n) for(int i=0;i<n;i++)
typedef long long ll;
struct P{
    ll var1;
    ll var2;
};
bool operator< ( const P &one, const P &two){
    return one.var1 < two.var1;
};
bool operator> ( const P &one, const P &two){
    return one.var1 > two.var1;
};

using namespace std;

signed main() {
    int N, X;
    cin >> N >> X;
    int count=0;
    int now=0;
    RANGE(i, N){
        if(now <= X) count++;
        int l;
        cin >> l;
        now = now + l;
    }
    if(now <= X) count++;

    cout << count << endl;
}


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

void solve(){

	int n ;
	cin>>n ;

	vector<vector<int>> v(n,vector<int>(2)) ;

	rep(i,n){

		cin>>v[i][0]>>v[i][1] ;
		
	}	

	int c=0 ;
	bool flag=false ;

	rep(i,n){

		if(v[i][0]==v[i][1]){
			c++ ;
			flag=true ;
		}
		else{
			c=0 ;
			flag=false ;
		}

		if(flag==true && c>=3){
			 cout<<"Yes" ;
			 return ;
		}

	}

	cout<<"No" ;


	
}


int main(){

		int y ;

		y=1 ;
		//cin>>y ;

		while(y--){
 
			solve() ;

		}

}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int h = in.nextInt();
        int w = in.nextInt();
        int k = in.nextInt();
        char cs[][] = new char[h][w];

        for (int i = 0; i < h; i++) {
            cs[i] = in.next().toCharArray();
        }

        int ans = 0;
        for (int r = 0; r <= powLong(2, h) - 1; r++) {
            for (int c = 0; c <= powLong(2, w) - 1; c++) {
                int blackCount = 0;
                for (int i = 0; i < h; i++) {
                    for (int j = 0; j < w; j++) {
                        if (((r >> i) & 1) == 0 && 
                            ((c >> j) & 1) == 0 &&
                            cs[i][j] == '#') {
                                blackCount++;
                            }
                    }
                }

                if (blackCount == k) {
                    ans++;
                }
            }
        }

        System.out.println(ans);
    }

    static final long powLong(long a, long e) {
        long r = 1;
        while (e > 0) {
            if ((e & 1) == 1) {
                r *= a;
            }
            e = e >> 1;
            a *= a;
        }
        return r;
    }
}

Measured memory_bytes: 35788
function main(input) {
  const a = parseInt(input.split(" ")[0], 10);
  const b = parseInt(input.split(" ")[1], 10);
  if(a<=b){
    console.log(a);
  }else{
    console.log(a-1);
  }

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
    long long a,b,c;
    scanf("%lld%lld%lld",&a,&b,&c);
    if(c>a+b && 4*a*b<(c-a-b)*(c-a-b))
    {
        printf("Yes");
    }
    else    printf("No");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <tuple>
#include <cmath>
using namespace std;
#define _GLIBCXX_DEBUG

int main(void){

    long long A, B , V, W;
    long long T;

    cin >> A >> V >> B >> W >> T;

    long long dst = abs(A-B);
    long long haya = V - W;
    double check;
    check = (double)dst / (double)haya;

    if(haya <= 0){
        cout << "NO" << endl;
    }

    else if(check <= T ){
      cout << "YES" << endl;
    }

    else{
        cout << "NO" << endl;
    }

}

Measured memory_bytes: 3632
def solve(n, A):
    m = max(A)
    r = 0
    for a in A:
        if abs(m / 2 - r) > abs(m / 2 - a):
            r = a
    return (m, r)

_n = int(input())
_A = list(map(int, input().split()))
print(*solve(_n, _A))


Measured memory_bytes: 14428
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

int ans[100010];

void solve() {
    int n;
    cin >> n;
    int a[n];
    REP(i,n) {
        cin >> a[i];
    }
    int mx = 0;
    ans[n - 1] = 0;
    for (int i = n - 2; i >= 0; i--) {
        if (a[i] >= a[i + 1]) {
            ans[i] = ans[i + 1] + 1;
        } else {
            ans[i] = 0;
        }
        mx = max(mx,ans[i]);
    }
    cout << mx << endl;
}

int main(int argc, char *argv[]){
    // /* Regular */
    // int case_num = 1;
    // if (argc > 1 && stoi(argv[1])) cin >> case_num;
    // REP(case_no, case_num) {
    //   cerr << endl << "case " << case_no + 1 << endl;
    //   solve();
    // }
    /* AOJ */
    solve();
    return 0;
}

Measured memory_bytes: 1024
use std::cmp::*;
use std::io::*;
fn main() {
    let mut s: String = String::new();
    stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<i64> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let mut s = vec![0; n + 1];
    for i in 0..n {
        s[i + 1] = s[i] + a[i];
    }
    let mut ans = 1i64 << 60;
    for i in 1..n {
        let l = s[i] - s[0];
        let r = s[n] - s[i];
        ans = min(ans, (r - l).abs());
    }
    println!("{}", ans);
}


Measured memory_bytes: 10492
#include "bits/stdc++.h"

#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			1'010'000'000'000'000'017LL
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )

using namespace std;

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


void Main()
{
	ll N;
	cin >> N;
	vi H(N + 10, 0);
	rep(i, 0, N) cin >> H[i];

	vi dp(N + 10, inf);
	dp[0] = 0;

	rep(i, 0, N) {
		rep(j, 1, 3) {
			if (i + j >= N) continue;
			chmin(dp[i + j], dp[i] + abs(H[i] - H[i + j]));
		}
	}

	cout << dp[N - 1] << endl;

}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	Main();
	return 0;
}

Measured memory_bytes: 4788
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  int k = 0;
  if(n==1){
    cout<<1<<endl;
    return 0;
  }
  while(n>=1){
    int d = 0;
    drep(j,10){
      if(n-j*pow(10,k)>=0){
        d = j;
        break;
      }
    }
    ans+=d;
    n-=d*pow(10,k);
    k++;
  }
  cout<<ans<<endl;
  return 0;
}

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

int f(int x)
{
	int res = 0;
	while (x)
	{
		res += x % 10;
		x /= 10;
	}
	return res;
}

int main()
{
	int n, ans = 10000;
	cin >> n;
	for (int a = 1; a < n; ++a)
	{
		ans = min(ans, f(a) + f(n - a));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as C
import Data.Maybe

main = sol <$> get <*> get >>= print

get = fmap fst . mapMaybe C.readInt . C.words <$> C.getLine

sol [_,x] = pm (0,0)
  where
  pm (s,p) []   = s
  pm (s,p) (a:as)
    | p+a <= x  = pm (s,a) as
    | p <= x    = pm (s+p+a-x,x-p) as
    | otherwise = pm (s+p+a-x,0) as

Measured memory_bytes: 4092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;



int main() {
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
	cin>>n;
	
    ull a=1;
    ull p = 1000000000000000000;
    // cout<<p;
    bool f =true;
    for(int i=0;i<n;i++){
        ull k;
        cin>>k;
        if(a>=p || a*k<a)
        {   if(k==0 || k==1)
                {a*=k;
                    f = true;
                    continue;
                }
                f = false;
            continue;
        }
        
         a*=k;
        
        
    }
    if(a>p || !f)
        cout<<-1;
    else    
    cout<<a;

	


	return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main() {
	int k; cin >> k;
	string s = "ACL";
	REP(i, k)
		cout << s;
	cout << '\n';
	return 0;
}

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

int main()
{
	string s, t;
	int x;
	bool flag = false;

	cin >> s >> t;

	x = stoi(s + t);

	for (int i = 1; i <= 1000 ; i++) {
	
		if (x == i * i) {
			flag = true;
			break;
		}	
	}
	
	if (flag) cout << "Yes" << endl;
	else  cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 384
n=int(input())
a = list(map(int,input().split()))
a0 = [0] * (n//2+1)
a1 = [0] * (n//2+1)
for i in range(n//2):
    a0[i+1] = a0[i] + a[i*2]
if n% 2 != 0:
    a0.append(a0[-1] + a[-1])

max_even = [0] * (n//2+1)
for i in range(n//2):
    max_even[i+1] = max(max_even[i]+a[2*i+1], a0[i+1])

ans = -1e9*n
if n%2 == 0:
    ans = max_even[-1]
else:
    for i in range(0,n//2+1):
        ans = max(ans, max_even[i] + a0[-1] - a0[i+1])
print(ans)

Measured memory_bytes: 31476
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[55][2505][55];
int n,v[55],cs[55];
ll bat(int i,int s,int m){
    if(dp[i][s][m]==-1){
        if(!s&&!m)dp[i][s][m]=1;
        else if(i==n||s>cs[i]||!m||s<v[i])dp[i][s][m]=0;
        else dp[i][s][m]=bat(i+1,s,m)+bat(i+1,s-v[i],m-1);
    }
    return dp[i][s][m];
}
int main(){
    ios_base::sync_with_stdio(0);
    int a,i,j,k,x;
    ll ans=0;
    cin>>n>>a;
    for(i=0;i<n;++i)cin>>v[i];
    sort(v,v+n);
    cs[n-1]=v[n-1];
    for(i=n-2;i>-1;--i)cs[i]=cs[i+1]+v[i];
    x=cs[0];
    for(i=0;i<=n;++i)for(j=0;j<=x;++j)for(k=0;k<=n;++k)dp[i][j][k]=-1;
    for(i=1;i<=n;++i)ans+=bat(0,a*i,i);
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 55168
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define MP make_pair
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N, K, count=0;
	cin >> N >> K;
	FOR(i, 0, N){
		int h;
		cin >> h;
		if(h>=K)
			count++;
	}

	cout << count << endl;

	return 0;
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl


signed main(void){
    int N,A,B;
    cin >> N >> A >> B;
    if((A+B)%2==0){
        cout << (B-A)/2 << endl;
    }else{
        int Ans=INF;
        int num=0;
        num+=A-1;
        num+=1;
        num+=(B-A-1)/2;
        Ans=num;
        
        num=0;
        num+=N-B;
        num+=1;
        num+=(N-(N+A-B+1))/2;
        Ans=min(Ans,num);
        
        cout << Ans << endl;
    }
    
    
    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<iomanip>
#include<string.h>
using namespace std;
int main()
{
	char s[15];
	scanf("%s",&s);
	int l=strlen(s);
	int num=0,sum=0;
	if(s[0]=='A'&&(s[1]>'Z')&&(s[l-1]>'Z'))
	{
		for(int i=2;i<l-1;i++)
		{
			if(s[i]=='C')
				sum++;
			if(s[i]<='Z'&&s[i]>='A')
				num++;
		}
		if(sum==1&&num==sum)
			printf("AC\n");
		else
			printf("WA\n");	
	}
	else
	printf("WA\n");	
}

Measured memory_bytes: 256
class DSU():
    def __init__(self, n):
        self._n = n
        self.parent_or_size = [-1] * n
    
    def merge(self, a, b):
        assert 0 <= a < self._n
        assert 0 <= b < self._n
        x, y = self.leader(a), self.leader(b)
        if x == y: return x
        if -self.parent_or_size[x] < -self.parent_or_size[y]: x, y = y, x
        self.parent_or_size[x] += self.parent_or_size[y]
        self.parent_or_size[y] = x
        return x

    def same(self, a, b):
        assert 0 <= a < self._n
        assert 0 <= b < self._n
        return self.leader(a) == self.leader(b)

    def leader(self, a):
        assert 0 <= a < self._n
        if self.parent_or_size[a] < 0: return a
        self.parent_or_size[a] = self.leader(self.parent_or_size[a])
        return self.parent_or_size[a]
    
    def size(self, a):
        assert 0 <= a < self._n
        return -self.parent_or_size[self.leader(a)]
    
    def groups(self):
        leader_buf = [self.leader(i) for i in range(self._n)]
        result = [[] for _ in range(self._n)]
        for i in range(self._n): result[leader_buf[i]].append(i)
        return [r for r in result if r != []]


def main():
   n, q = map(int, input().split()) 
   d = DSU(n)
   for _ in range(q):
        t, u, v = map(int, input().split())
        if t == 0:
           d.merge(u, v)
        else:
            print(1 if d.same(u, v) else 0) 

if __name__ == "__main__":
    main()




Measured memory_bytes: 11736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    int k, t; cin >> k >> t;
    VI a(t); cin >> a;
    SORT(a);
    int mx = a[t - 1];
    cout << max(mx - 1 - (k - mx), 0) << "\n";
}

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

int main(void)
{
	int a[30], b[30], c[30];
	int i, n, s;
	s=0;

	scanf("%d", &n);
	for(i=0;i<n;i++){
		scanf("%d", &a[i]);
	}
	
	for(i=0;i<n;i++){
		scanf("%d", &b[i]);
		s=s+b[i];
	}

	for(i=0;i<n-1;i++){
		scanf("%d", &c[i]);
	}
	
	for(i=0;i<n;i++){
		if(a[i]+1==a[i+1]){
			s=s+c[a[i]-1];
		}
	}
	
	printf("%d", s);	
	return 0;
}

Measured memory_bytes: 128
from heapq import heapify, heappush, heappop
from collections import Counter, defaultdict, deque, OrderedDict
from sys import setrecursionlimit as setreclim
from sys import maxsize
from bisect import bisect_left, bisect, insort_left, insort
from math import ceil, log, factorial, hypot, pi
from fractions import gcd
from copy import deepcopy
from functools import reduce
from operator import mul
from itertools import product, permutations, combinations, accumulate, cycle
from string import ascii_uppercase, ascii_lowercase, ascii_letters, digits, hexdigits, octdigits

prod = lambda l: reduce(mul, l)
prodmod = lambda l, mod: reduce(lambda x, y: mul(x,y)%mod, l)

class Dijkstra:
    """Dijkstra's algorithm : find the shortest path from a vertex
       used in GRL1A(AOJ)
    """

    def __init__(self, V, E, start, INF=10**9):
        """ V: the number of vertexes
            E: adjacency list
            start: start vertex
            INF: Infinity distance
        """
        self.V = V
        self.E = E
        self.dijkstra(start, INF)

    def dijkstra(self, start, INF):
        que = list()
        self.distance = [INF] * self.V # distance from start
        self.prev = [-1] * self.V # prev vertex of shortest path
        self.distance[start] = 0
        heappush(que, (0, start))

        while len(que) > 0:
            dist, v = heappop(que)
            if self.distance[v] < dist: continue
            for to, cost in self.E[v]:
                if self.distance[v] + cost < self.distance[to]:
                    self.distance[to] = self.distance[v] + cost
                    heappush(que, (self.distance[to], to))
                    self.prev[to] = v

    def getPath(self, end):
        path = [end]
        while self.prev[end] != -1:
            end = self.prev[end]
        return path[::-1]

V, E, r = map(int, input().split())
INF = 10**10
edge = [[] for _ in range(V)]
for i in range(E):
    s, t, cost = map(int, input().split())
    edge[s].append((t, cost))
sp = Dijkstra(V, edge, r, INF)
print(*[dist if dist != INF else 'INF' for dist in sp.distance], sep='\n')

Measured memory_bytes: 102712
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#define int long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
int mod = 1e9+7;

int32_t main(){

	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int f = 0;
	while(a > 0 && c > 0){
		if(f == 0)
			c -= b, f^=1;
		else
			a -= d, f^=1;
	}

	if(a <= 0){
		cout<<"No\n";
	}
	else
		cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;
import java.math.BigInteger;

class Main{
    static long lmod = 4294967311L;
    static final BigInteger mod = BigInteger.valueOf(4294967311L);
    static BigInteger mypow(BigInteger n,long p){
	if (p == 1)return n;
	BigInteger ret = mypow(n,p/2);
	ret = ret.multiply(ret).mod(mod);
	if (p%2 == 1)ret = ret.multiply(n).mod(mod);
	return ret;
    }
    static BigInteger getinv(BigInteger a){
	return mypow(a,lmod-2);
    }
    static long solve(int n,int op[],int val[]){
	long ret = 0;
	for(int i=0;i<n;i++){
	    if (op[i] == 1){//+
		ret = (ret + val[i])%lmod;
	    }else if (op[i] == 2){//-
		ret = (ret - val[i])%lmod;
		ret = (ret + lmod)%lmod;
	    }else if (op[i] == 3){//*
		BigInteger tval = BigInteger.valueOf(val[i]);
		ret = tval.multiply(BigInteger.valueOf(ret)).mod(mod).longValue();
	    }else if (op[i] == 4){///
		BigInteger tval = BigInteger.valueOf(val[i]);
		BigInteger inv = getinv(tval);
		ret = inv.multiply(BigInteger.valueOf(ret)).mod(mod).longValue();
	    }
	}
	return ret;
    }
    public static void main(String[] args){
	long maxi = BigInteger.valueOf(2147483648L).longValue();
	int n;
	Scanner in = new Scanner(System.in);
	while(true){
	    if (in.hasNextInt());
	    else break;
	    n = in.nextInt();
	    if (n == 0)break;
	    int op[] = new int[n],val[] = new int[n];
	    for(int i=0;i<n;i++){
		op[i] = in.nextInt();
		val[i] = in.nextInt();
	    }
	    long ret = solve(n,op,val);
	    if (ret < maxi){
	    }else {
		ret = ret-lmod;
	    }
	    System.out.println(ret);
	}
    }
}

Measured memory_bytes: 13000
#include<iostream>
using namespace std;
long cnt[1<<17];
main()
{
	long n,k;cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		int a,b;cin>>a>>b;
		cnt[a]+=b;
	}
	long sum=0,now=0,p=0;
	while(sum<k)
	{
		sum+=cnt[p];
		now=p;
		p++;
	}
	cout<<now<<endl;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<cstring>
#define rep(i,a,b) for(i=a;i<=b;i++)
using namespace std;
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	if(a>b)	swap(a,b);
	if((b-a-1)&1)	printf("Alice\n");
	else printf("Borys\n");
	return 0;
}	
	

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


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

    REP(i, s.size()){
        if(s[i] != 'a' and 26-(s[i]-'a') <= K){
            K -= 26-(s[i]-'a');
            s[i] = 'a';
        }
        if(i == s.size()-1){
            K %= 26;
            if(s[i]+K > 'z') s[i] = 'a' + K-(s[i]-'a');
            else s[i] = s[i] + K;
        }
        // cout << i << " " << K << endl;
    }
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 512
s=input()
ans=[]

for i in range(2**3):
  a=int(s[0])
  for j in range(3):
    if ((i>>j)&1):
      a+=int(s[j+1])
    else:
      a-=int(s[j+1])
      
  if a==7:
    ans.append(i)
    
u=ans[0]
ans1=[]
for j in range(3):
  if ((u>>j)&1):
      ans1.append('+')
  else:
      ans1.append('-')
      
print(s[0]+ans1[0]+s[1]+ans1[1]+s[2]+ans1[2]+s[3]+'=7')

Measured memory_bytes: 61920
import java.util.Scanner;
public class Main {
@SuppressWarnings("resource")
public static void main(String[] args) {
	Scanner sc =new Scanner(System.in);
	int N=sc.nextInt();
	String S=sc.next();
	String T=sc.next();
	String S2[]=S.split("");
	String T2[]=T.split("");
	String ans="";
	for(int i=0;i<N;i++) {
		ans+=S2[i];
		ans+=T2[i];
	}
	System.out.println(ans);
}
}

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

int main(){
    ll N,A,B; cin >> N >> A >> B;
    ll ans=0;
    ll ama=0;
    ans=N/(A+B)*A;
    ama=N%(A+B);
    
    if(ama<=A) ans+=ama;
    else ans+=A;
    
    cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,t;
  cin>>s>>t;
  bool k;
  k=true;
  int n,m;
  n=s.length();
  m=t.length();
 if(m!=n+1)
 {
   k=false;
 }
  int i;
  for(i=0;i<n;i++)
  {
    if(s[i]!=t[i])
    {
      k=false;
    }
  }
  if(k)
    cout<<"Yes";
  else
    cout<<"No";
  
  return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t,a,b;
	t = 1;
	while(t--) {
	 cin >> a >> b;
	 cout << a + b / 2 << endl;
	}
	return 0;
}



Measured memory_bytes: 256
/**
 *    authur: Bao Trung <3
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define all(x) (x).begin(), (x).end()
#define set_vect(a,n); vector<int>a(n); for(auto &z : a)cin>>z;
const int mod = 1e9+7;
int a,b,c,d;
void solve(){
	cin >> a >> b >> c >> d; // health  stength
	while(1){
		c -= b;
		if(c <= 0){
			cout << "Yes" << '\n';
			break;
		}
		a -= d;
		if(a <= 0){
			cout <<  "No" << '\n';
			break;
		}
	}
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int t = 1; //cin >> t;
	while(t--){solve();}
	return 0;
}

// Code By CodeWar :3


Measured memory_bytes: 3648
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}


void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
  
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(x!=NIL){
    y=x;//親 設定
    if(z->key < x->key){
      x = x->left;
    }
    else{
      x = x->right;
    }
  }
  z->parent = y;
  if(y==NIL){
    root=z;
  }
  else if(z->key < y->key){
    y->left = z;
  }
  else {
    y->right = z;
  }
    
}

void inorder(Node u){
  if(u->left!=NIL){
    inorder(u->left);
  }           
  printf(" %d",u->key);
  if(u->right != NIL){
    inorder(u->right);
  }
}
void preorder(Node u){
  printf(" %d",u->key);
  if(u->left!=NIL){
    preorder(u->left);
  }
  if(u->right != NIL){
    preorder(u->right);
  }
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 24040
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw	 "\n"
#define mod 1000000007

int main(void)
{
	CIN;
	ll tc,l,k,sum=0,x=0,y,z=0,m=1,n=0,ans=0,cnt=0;
	cin>>n;
	cin>>x;
	k=x,n--;
	while(n--){
		cin>>x;
		if(k>x)sum+=k-x;
		else k=x;
	}
	cout<<sum;

}

Measured memory_bytes: 3664
#include<cstdio>
const int maxn = 1001010;
int n,a,b,c,d,flag;
long long int min1[maxn],min2[maxn],max1[maxn],max2[maxn];
int main()
{
    scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
    min1[1] = max1[1] = a;
    for(int i = 2; i <= n; i++){
        min1[i] = min1[i-1] + c;
        max1[i] = max1[i-1] + d;
    }
    min2[n] = max2[n] = b;
    for(int i = n-1; i > 0; i --){
        min2[i] = min2[i+1] + c;
        max2[i] = max2[i+1] + d;
    }
    for(int i = 1; i <= n ; i++){
        if(min2[i] <= min1[i] && min1[i] <= max2[i])
            flag = 1;
        if(min2[i] <= max1[i] && max1[i] <= max2[i])
            flag = 1;
        if(min1[i] <= min2[i] && min2[i] <= max1[i])
            flag = 1;
        if(min1[i] <= max2[i] && max2[i] <= max1[i])
            flag = 1;
    }
    if(flag)
        printf("YES");
    else
        printf("NO");
    return 0;
}

Measured memory_bytes: 22656
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
template <typename T> using V = vector<T>;

struct Solver {
    ll H, W;
    V<V<ll>> vs;
    Solver() {
        cin >> H >> W;
        if(H + W) {
            vs = V<V<ll>>(H, V<ll>(W, 0));
            for(auto &v : vs) for(auto &ele : v) cin >> ele;
        }
    }

    ll calc(ll uh, ll dh, ll lw, ll rw) {
        ll lowest = 5e15;
        ll highest = 0;
        ll osum = 0;
        ll sum = 0;
        // cout << uh << ", " << dh << ", " << lw << ", " << rw << endl;
        for(ll h = uh; h < dh; h++) for(ll w = lw; w < rw; w++) {
            if(h == uh || h == dh - 1 || w == lw || w == rw - 1) {
                lowest = min(lowest, vs[h][w]);
            } else {
                highest = max(highest, vs[h][w]);
                sum += vs[h][w];
            }
        }
        // cout << highest << ", " << lowest << endl;
        if(highest >= lowest) return 0;
        ll ans = (dh - uh) * (rw - lw) * lowest - sum;
        ans -= ((dh - uh) + (rw - lw) - 2) * 2 * lowest;
        return ans;
    }
    
    bool solve() {
        if(!(H + W)) return false;
        ll ans = 0;
        for(ll lw = 0; lw < W; lw++) for(ll rw = lw + 3; rw <= W; rw++) {
            for(ll uh = 0; uh < H; uh++) for(ll dh = uh + 3; dh <= H; dh++) {
                ans = max(ans, calc(uh, dh, lw, rw));
            }
        }
        cout << ans << endl;
        return true;
    }
};

int main() {
    while(Solver().solve());
    return 0;
}



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

using namespace std;

int opr, a, b;

int main() {
	cin>>opr;
	if (opr==1) {
		cout<<"Hello World"<<endl;
	}
	else {
		cin>>a>>b;
		cout<<a+b<<endl;
	}


	return 0;
}


Measured memory_bytes: 256
import math

N,D=map(int,input().split())
X=[]
for i in range(N):
        X.append(list(map(int,input().split())))

cnt=0
for i in range(N-1):
    for j in range(N-i-1):
        j+=i+1
        s=0
        for d in range(D):
            s+=(X[i][d]-X[j][d])**2
        for l in range(160):
            if l**2==s:
                cnt+=1
                break
print(cnt)

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

int main() {
    int a[4];
    int i, s, e;

    for(i=0; i<4; ++i) cin >> a[i];
    s = max(a[0], a[2]);
    e = min(a[1], a[3]);
    if(e-s < 0) cout << 0 << endl;
    else cout << e-s << endl;

    return 0;
}


Measured memory_bytes: 256
/*
 * Author: RainAir
 * Time: 2019-10-27 20:05:48
 */
#include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define fi first
#define se second
#define U unsigned
#define P std::pair
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
#define int LL
signed main(){
    int N;scanf("%lld",&N);
    int q = std::sqrt(1.0*N);
    int ans = 1e18;
    FOR(i,1,q){
        if(!(N%i)){
            int j = N/i;
            ans = std::min(ans,i+j-2);
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
import Text.Printf

solve1 a b = (d,r,f)
  where
    d = a `div` b
    r = a `mod` b
    f = (toDouble a) / (toDouble b)

toDouble :: Int -> Double
toDouble x = fromInteger $ toInteger x

solve2 r = (a, c)
  where
    a = pi * r**2
    c = 2 * pi * r

main = do
  r <- getLine
  let r' = read r :: Double
      (a,c) = solve2 r'
  printf "%.5f %.5f\n" a c



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

int main() {
    int a, b, k; cin >> a >> b >> k;
    int cnt = 0;
    for(int i = a; i <= min(a+k, b); i++){
        cout << i << endl;
        cnt ++; 
        if (cnt >= k) break;
    }
    cnt = 0;
    for(int i = max(0, b-k+1); i <= b; i++){
        if (i <= a+k-1) continue;
        cout << i << endl;
        cnt ++;
        if (cnt >= k) break;
    }
}

Measured memory_bytes: 3604
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <iomanip>
#include <cstring>
#include <iostream>
#include <algorithm>
//#include <unordered_map>

#define fast_read ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef unsigned long long ULL;

const int N = 203, INF = 0x3f3f3f3f, MOD1 = 1e9 + 7, MOD2 = 998244353;



bool cmp(int a, int b) {
    return a > b;
}

void solve() {
    string str; cin >> str;
    int ans = 0;
    for(int i = 0; i < 3; i++)
        if(str[i] == 'R') {
            for(int j = i + 1; j <= 3; j++)
                if(j == 3 || str[j] == 'S') {
                    ans = max(ans, j - i);
                    break;
                }
        }
    cout << ans;
}

int main() {
    fast_read

    solve();

    return 0;
}

Measured memory_bytes: 3196
#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/

/*ABC 142 A*/

int main(void)
{
  int N;
  scanf("%d", &N);
  if (N%2 == 0) {
    printf("0.5000000000\n");
    return 0;
  }else if( N != 1){
    printf("%f\n", (float)(N/2 + 1)/(float)(N));
    return 0;
  }else printf("1.0000000000\n");
  return 0;
}


Measured memory_bytes: 128
<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

//$fp = fopen("input.txt", "r");
$fp = fopen("php://stdin", "r");
$inning = (int)fgets($fp);
$out = 0;
$run = 0;
$onbase = 0;
while($inning > 0) {
    $batting = rtrim(fgets($fp));
    if($batting === "HIT") {
        hit($onbase, $run);
    } elseif($batting === "OUT") {
        $out++;
        if($out == 3) {
            echo "$run";
            $out = 0;
            $run = 0;
            $onbase = 0;
            $inning--;
            if($inning != 0) echo "\n";
        }
    } elseif($batting === "HOMERUN") {
        homerun($onbase, $run);
    }
}

function hit(&$onbase, &$run) {
    $onbase = ($onbase << 1) + 1;
    if($onbase > 7) {
        $run++;
        $onbase -= 8;
    }
}

function homerun(&$onbase, &$run) {
    $run++;
    if($onbase & 1) $run++;
    if($onbase & 2) $run++;
    if($onbase & 4) $run++;
    $onbase = 0;
}
?>

Measured memory_bytes: 6608
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>

auto& in = std::cin;
auto& out = std::cout;

int32_t N,M;
int32_t count[10000000];
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> N>>M;
	for (int32_t i = 0; i < M; ++i)
	{
		int a, b;
		in >> a >> b; --a; --b;
		count[a]++;
		count[b]++;

	}

	for (int32_t i = 0; i < N; ++i)
	{
		std::cout << count[i] << '\n';

	}

	return 0;
}
#endif


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;



int main(){
    
    int a,b,c;
    cin>>a>>b>>c;
    
    int maxn =max(a,max(b,c));
    int minn =min(a,min(b,c));
    
    cout <<maxn - minn<<endl;
    
}









Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int n = 1e5+5;
int N;
vector<pair<int, bool>> G[n];
bool vis[n];
bool col[n];

void DFS(int v, int pr, bool c){
	col[v] = c;
	vis[v] = true;
	for(auto p : G[v]){
		int j = p.first;
		bool cg = p.second;
		if(!vis[j] && j != pr){
			DFS(j, v, c^cg);
		}
	}
}

int main(){
	cin >> N;
	for(int i = 0; i < N-1; ++i){
		int u,v,w;
		cin >> u >> v >> w;
		u--;v--;
		G[u].push_back({v, w%2});
		G[v].push_back({u, w%2});
	}
	for(int i =0; i < N; ++i){
		if(!vis[i]){
			DFS(i, -1, true);
		}
		cout << col[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 8192
import numpy as np
import math

n, d = map(int, input().split(' '))

x = []
for iN in range(n):
    x.append(np.array(list(map(int, input().split(' ')))))

count = 0
# 全通り試す
for iFirst in range(n - 1):
    for iSecond in range(iFirst + 1, n):
        # 距離が整数なら
        if math.sqrt(np.sum(np.power(x[iFirst] - x[iSecond], 2))).is_integer():
            # カウントする
            count += 1
# 結果出力
print(count)

Measured memory_bytes: 12508
#include <stdio.h>
#include <math.h>
int main(void){
    
    int D,N,ans;
    scanf("%d",&D);
    scanf("%d",&N);
    
    if(N==100){
        ans=pow(100,D)*101;    
    }
    
    else ans=pow(100,D)*N;
    
    printf("%d\n",ans);
    
    return 0;
    
}


Measured memory_bytes: 128