akhauriyash/Code-Regression huggingface dataset:
<?php
  fscanf(STDIN,"%d%d%d", $h,$w,$k);
  $c = [];
  for($i=0; $i<$h; $i++){
      $c[$i] = trim(fgets(STDIN));
  }
  
  function kumiawase($zentai,$nukitorisu){
      $zentaisu=count($zentai);
      if($zentaisu<$nukitorisu){
        return;
      }elseif($nukitorisu==1){
        for($i=0;$i<$zentaisu;$i++){
          $arrs[$i]=array($zentai[$i]);
        }
      }elseif($nukitorisu>1){
        $j=0;
        for($i=0;$i<$zentaisu-$nukitorisu+1;$i++){
          $ts=kumiawase(array_slice($zentai,$i+1),$nukitorisu-1);
          foreach($ts as $t){
            array_unshift($t,$zentai[$i]);
            $arrs[$j]=$t;
            $j++;
          }
        }
      }
      return $arrs;
    }

    $aka = "";
    for($i=0; $i<$w; $i++){
        $aka .= "x";
    }

    $ans = 0;
    
    counter($c);
    for($i=1; $i<$h; $i++){
        $gyo = kumiawase(range(0,$h-1),$i);
        // print_r($gyo);
        foreach($gyo as $kumi){
            $c_copy = $c;
            foreach($kumi as $change){
                $c_copy[$change] = $aka;
            }
            counter($c_copy);
            for($j=1; $j<$w; $j++){
                $retu = kumiawase(range(0,$w-1),$j);
                foreach($retu as $rkumi){
                    $cp = $c_copy;
                    foreach($rkumi as $rcha){
                        for($l=0; $l<$h; $l++){
                            $cp[$l][$rcha] = "x";
                        }
                    }
                    // print_r($cp);
                    counter($cp);
                }
            }
        }
    }
    
    
    function counter($a){
        global $ans, $h, $w, $k;
        $cnt = 0;
        for($ii=0; $ii<$h; $ii++){
            for($jj=0; $jj<$w; $jj++){
                if($a[$ii][$jj] == "#"){
                    $cnt++;
                }
            }
        }
        // echo $k;
        if($cnt == $k){
            $ans++;
        }
    }
    
    for($j=1; $j<$w; $j++){
        $retu = kumiawase(range(0,$w-1),$j);
        foreach($retu as $rkumi){
            $cp = $c;
            foreach($rkumi as $rcha){
                for($l=0; $l<$h; $l++){
                    $cp[$l][$rcha] = "x";
                }
            }
            // print_r($cp);
            counter($cp);
        }
    }
    
    echo $ans;

Measured memory_bytes: 16268
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cini(N);
    string s;
    if(N<1000) s="ABC";
    else s="ABD";
    cout << s << nn;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

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

A.sort(reverse=True)
l = 0
r = 3*10**5
while r - l > 1:
    m = (r + l)//2 # 和がm以上になるペアはいくつ？
    ind = N-1
    cnt = 0
    for a in A:
        while ind >= 0 and A[ind] + a < m:
            ind -= 1
        cnt += ind+1
    if cnt >= M:
        l = m
    else:
        r = m

B = [0]
for a in A:
    B.append(B[-1]+a)

ans = 0
border = l
ind = N-1
cnt = 0
for a in A:
    while ind >= 0 and A[ind] + a < border:
        ind -= 1
    cnt += (ind+1)
    ans += a*(ind+1) + B[ind+1]

ans -= (cnt-M)*border

print(ans)

Measured memory_bytes: 20456
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

int main(void){
    char c;
    cin >> c;

    cout << (char)(c + 1) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define rg register

using namespace std;
int n,h,w,l,r,ans;
int main()
{
	scanf("%d%d%d",&n,&h,&w);
	while(n--)
	{
		scanf("%d%d",&l,&r);
		if(l<h || r<w) continue;
		ans++;
	}
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
    int X, i;
    int v[41] = {1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000};
    scanf("%d", &X);
    for(i = 0; v[i] <= X; ++i);
    printf("%d\n", v[i-1]);

}

Measured memory_bytes: 128
n,m,X,Y = map(int, raw_input().split(' '))
xis = map(int,raw_input().split(' '))
xis.sort()
yis = map(int,raw_input().split(' '))
yis.sort()

aa = [xis[n - 1], yis[-m]]
aa[0] = max(aa[0], X)
aa[1] = min(aa[1], Y)
print 'No War' if aa[0]<aa[1] else 'War'

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

//短縮
#define rep(i,n) for(int i=0;i<(n);++i)
//sort()用
#define all(v) v.begin(), v.end()

#define PB(N) push_back(N)

#define MOD 1000000007

using namespace std;

using Graph = vector<vector<int>>;

//mod,mでのaの逆元a^(-1)を計算する
long long modinv(long long a, long long m){
  long long b = m, u=1,v=0;
  while(b){
    long long t=a/b;
    a -= t*b; swap(a,b);
    u -= t*v; swap(u,v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

long long kumiawase(long long a, long long b){
  long long answer=1;
  for(long long i=0;i<a+b;i++){
    answer *= (a%MOD+b%MOD-i%MOD)%MOD;
    answer=answer%MOD;
    if(i < a){
      answer = ((answer%MOD)*modinv(i+1,MOD))%MOD;
      answer=answer%MOD;
    }
    if(i < b){
      answer = ((answer%MOD)*modinv(i+1,MOD))%MOD;
      answer=answer%MOD;
    }
  }
  //aとb
  return answer;
}

int main(){
  int X,Y;
  cin >> X >> Y;
  long long a=(2*Y-X)/3;
  long long b=(2*X-Y)/3;
  //(a+b)%2==(X+Y)%2はいらない?
  if((2*Y-X)%3==0&&(2*X-Y)%3==0){
    if(a<0||b<0) cout << 0;
    else cout << kumiawase(a, b) << endl;
  }
  else{
    cout << 0;
  }

  return 0;
}


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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

int main(){
	summon_tourist;

	lnt N, X[200000], Y[200000];
	lnt mxx = -BBIG, mnx = BBIG, mxy = 0, mny = BBIG;
	cin >> N;
	REP(i, N){
		cin >> X[i] >> Y[i];
		chmax(mxx, X[i]-Y[i]);
		chmin(mnx, X[i]-Y[i]);
		chmax(mxy, X[i]+Y[i]);
		chmin(mny, X[i]+Y[i]);
	}
	cout << max(mxx-mnx, mxy-mny) << ln;
}

Measured memory_bytes: 6728
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a,b);}
ll MOD=1000000007;

int main(){
  ll n,a,b,c,d,e;cin>>n>>a>>b>>c>>d>>e;
  ll w;
  w=min({a,b,c,d,e});
  ll ans=ceil((double)n/w);
  cout<<ans+4<<endl;
}

Measured memory_bytes: 256
def abc(n):

    if n%10 != 0:
        for i in range(1,14):
            if 0<10*i-n<10:
                return 10*i
    else:
        return n

x = [int(input()) for _ in range(5)]

lst1 = []
for i in range(5):
    lst1.append(abc(x[i]))

lst2 = []
for i in range(5):
    lst2.append(abc(x[i])-x[i])

print(sum(lst1)-max(lst2))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <typename T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long INFLL = 1LL << 60;
const long long MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    cout << N / 500 * 1000 + (N % 500) / 5 * 5 << endl;
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <array>

int main(void)
{
	int16_t data_num = 0;
	int16_t first = 0;
	int16_t second = 0;
	int16_t third = 0;
	
	std::cin >> data_num;


	std::array<int16_t, 3> sides;

	for (int i = 0; i < data_num; i++)
	{
		std::cin >> sides[0] >> sides[1] >> sides[2];

		std::sort(sides.begin(), sides.end());
		
		if ( std::pow(sides[2], 2) == (std::pow(sides[0], 2) + std::pow(sides[1], 2)) )
		{
			std::cout << "YES" << std::endl;
		}
		else
		{
			std::cout << "NO" << std::endl;
		}
	}

	return 0;
}

Measured memory_bytes: 2992
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[n];
  rep(i,n){
    cin>>a[i];
  }
  int flag[n]={};
  sort(a,a+n);
  rep(i,n){
    if(a[i]==a[i+1]){
      flag[i]=flag[i+1]=1;
    }
  }
  int ans=0;
  int x[a[n-1]+10]={};
  rep(i,n){
    if(x[a[i]]==1) flag[i]=1;
    for(int j=a[i];j<=a[n-1];j+=a[i]){
      x[j]=1;
    }
  }
  rep(i,n){
    if(flag[i]==0) ans++;
  }
  cout<<ans<<endl;
    

  return 0;
}


Measured memory_bytes: 14488
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
typedef pair<int, int> P;
bool dp[3333][3333];
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  CLR(dp);
  dp[0][0] = true;
  FOR(i,0,3003) {
    FOR(j,0,3003) {
      if(i >= 100 * A) dp[i][j] |= dp[i - 100 * A][j];
      if(i >= 100 * B) dp[i][j] |= dp[i - 100 * B][j];
      if(j >= C) dp[i][j] |= dp[i][j - C];
      if(j >= D) dp[i][j] |= dp[i][j - D];
    }
  }
  P mx = P(0, 100 * A);
  FOR(i, 1, 3001)
  {
    FOR(j,0,3001) {
      if(!dp[i][j]) {
        continue;
      }
      if(i + j <= F) {
        if(i * E >= 100 * j) {
          if(100 * j * mx.second > mx.first * (i + j)) {
            mx = P(100 * j, i + j);
          }
        }
      }
    }
  }
  cout << mx.second << " " << mx.first / 100 << endl;
  return 0;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
const int maxn=200005;
int a[maxn],tot=0;
int dp[maxn],head[maxn];
int ans[maxn];
int n;
struct node{
	int next,to;
}edge[maxn*2];
void add_edge(int u,int v){
	tot++;
	edge[tot].next=head[u];
	edge[tot].to=v;
	head[u]=tot;
}
//lower bound
int binary_search(int low,int high,int key){
	int mid,ans=1;
	while(low<=high){
		mid=(high+low)>>1;
		if(dp[mid]>=key) ans=mid,high=mid-1;
		else low=mid+1;
	}
	return ans;
}
void dfs(int u,int fa){
	int pos=binary_search(1,n,a[u]);
	int tmp=dp[pos];
	dp[pos]=a[u];
	ans[u]=max(ans[fa],pos);
	for(int i=head[u];i;i=edge[i].next){
		int v=edge[i].to;
		if(v==fa) continue;
		dfs(v,u);
	}
	dp[pos]=tmp;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1,u,v;i<=n-1;i++){
		scanf("%d%d",&u,&v);
		add_edge(u,v);
		add_edge(v,u);
	}
	memset(dp,0x3f,sizeof(dp));
	dfs(1,0);
	for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
}

Measured memory_bytes: 24320
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    char a;
    cin >> a;
    if(a >= 65 && a<= 90) cout << "A" << endl;
    else cout << "a" << endl;
    
    return 0;
}

Measured memory_bytes: 3616
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define rep2(i, a)for(auto i : a)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x, std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll co(ll n, ll k) { ll a = 1; rep(i, 1ll, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
int t[1000001];
int main(void) {
	int n, ans = 0;
	cin >> n;
	vector<int> a(n);
	rep(i, 0, n) {
		cin >> a[i];
		t[a[i]]++;
	}
	rep(i, 0, n) {
		bool f = 1;
		if (a[i] == 1 && t[a[i]] == 1) { ans++; continue; }
		if (t[a[i]] >= 2 || t[1] >= 1)continue;
		int s = sqrt(a[i]);
		rep(k, 2, s + 1) {
			if (a[i] % k == 0 && (t[k] || t[a[i] / k])) {
				f = 0; break;
			}
		}
		if (f)ans++;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 8028
using System;
using System.Text.RegularExpressions;
using System.Numerics;
using System.Linq;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine(); //標準入力
            int value = 0;

            value = 700 + str.Where(c => c == 'o').Count() * 100;
            Console.WriteLine(value);
        }
    }
}


Measured memory_bytes: 11220
n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n+1):
        k = n-i-j
        if y == i*10000+j*5000+k*1000 and k >= 0:
            print(i,j,k)
            exit()
print(-1,-1,-1)

Measured memory_bytes: 3060
#define  _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144 * 4LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}


#define int ll

unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

long double dist[20][20][20] = {};
long double dp[10002][20][20] = {};
void solve() {
    int n;
    cin >> n;
    long double r, theta;
    cin >> r >> theta;
    REP(i, n) {
        REP(q, n) {
            REP(j, n) {
                dist[i][q][j] = -1;
            }
            REP(j, 10002) {
                dp[j][i][q] = r + 1;
            }
        }
    }
    vector<complex<long double>> inputs;
    REP(i, n) {
        long double a, b;
        cin >> a >> b;
        inputs.push_back(complex<long double>{a, b});
    }
    REP(i, n - 1) {
        dist[0][0][i + 1] = abs(inputs[i + 1] - inputs[0]);
    }
    REP(i, n) {
        REP(q, n) {
            if (i == q) continue;
            REP(j, n) {
                if (q == j||j == i) continue;
                complex<long double> a = inputs[q] - inputs[i];
                complex<long double> b = inputs[j] - inputs[q];
                a /= abs(a);
                b /= abs(b);
                long double cosine = a.real() * b.real() + a.imag() * b.imag();
                cosine /= abs(a);
                cosine /= abs(b);
                cosine = min(1.0L, cosine);
                cosine = max(-1.0L, cosine);
                long double kakudo = (long double)acos((long double)cosine);
                //cout << kakudo << endl;
                kakudo *= 180.0L / (long double)M_PI;
                if (kakudo > theta) continue;
                dist[i][q][j] = abs(inputs[j] - inputs[q]);
            }
        }
    }
    dp[0][0][0] = 0;
    int ans = 0;
    REP(i,10001){
        REP(q, n) {
            REP(j, n) {
                if (dp[i][q][j] > r) continue;
                ans = i;
                REP(t, n) {
                    if (dist[q][j][t] == -1) continue;
                    dp[i + 1][j][t] = min(dp[i + 1][j][t], dp[i][q][j] + dist[q][j][t]);
                }
            }
        }
    }
    cout << ans << endl;
}

#undef int
int main() {
    init();
    solve();
}


Measured memory_bytes: 65996
Program traveling;
uses    math;
var n,res,maxl,minl,x,i:longint;

begin
    read(n);
    maxl:=-maxlongint;
    minl:=maxlongint;
    for i:=1 to n do
        begin
        read(x);
        maxl:=max(maxl,x);
        minl:=min(minl,x);
        end;
    res:=maxl-minl;
    write(res);
end.

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		String op = scanner.next();
		int b = scanner.nextInt();

		if (op.charAt(0) == '+') {
			System.out.println(a + b);
		} else {
			System.out.println(a - b);
		}

	}
}


Measured memory_bytes: 21972
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int cnt = 3;
		if(a==b)cnt--;
		if(b==c)cnt--;
		if(a==c)cnt--;
		if(a==b&&b==c)cnt++;
		System.out.println(cnt);
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string.h>
using namespace std;
typedef long long ll;

int main() {
    int a, b, c; cin >> a >> b >> c;
    int cnt = 0;
    if (a != b) cnt++;
    if (a != c) cnt++;
    if (b != c) cnt++;
    if (cnt == 2) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 256
n, k, s = map(int, input().split())
a = []
for _ in range(k):
        a.append(str(s))
for _ in range(n-k):
  if s != 1000000000:
  	a.append(str(s+1))
  else:
    a.append(str(s-1))
ans = ' '.join(a)
print(ans)


Measured memory_bytes: 13464
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl
   
int UF[214514];
void UFinit(int n){
    for(int i=0;i<=n;i++){
        UF[i]=i;
    }
}
int UFroot(int k){
    if(UF[k]==k){
        return k;
    }else{
        UF[k]=UFroot(UF[k]);
        return UF[k];
    }
}
int UFsame(int P,int Q){
    if(UFroot(P)==UFroot(Q)){
        return true;
    }else{
        return false;
    }
}
void UFunite(int P,int Q){
    int p=UFroot(P);
    int q=UFroot(Q);
    if(p==q)return;
    if(p>q)swap(p,q);
    UF[q]=p;
}


signed main(){
    int H,W;
    char C[500][500];
    cin >> H >> W;
    REP(i,H){REP(j,W){
      cin >> C[i][j];  
    }}
    
    UFinit(214415);
    
    REP(i,H){
        REP(j,W){
            if(i!=H-1 && C[i][j]!=C[i+1][j]){
                UFunite(i*500+j,(i+1)*500+j);
            }
            if(j!=W-1 && C[i][j]!=C[i][j+1]){
                UFunite(i*500+j,i*500+j+1);
            }
        }
    }
    
    int Sum[214514][2]={};
    
    REP(i,H){
        REP(j,W){
            if(C[i][j]=='.'){
                Sum[UFroot(i*500+j)][0]++;
            }else{
                Sum[UFroot(i*500+j)][1]++;
            }
        }
    }
    int Ans=0;
    REP(i,214514){
        Ans+=Sum[i][0]*Sum[i][1];
    }
    
    //REP(i,H){REP(j,W){cout << UF[i*500+j] << " ";}cout << endl;}
    //REP(i,H){REP(j,W){cout << Sum[i*500+j][0] << " "<<Sum[i*500+j][1] << "   ";}cout << endl;}
    
    cout << Ans << endl;
    return 0;
}

Measured memory_bytes: 5504
#include<cstdio>
int arr[1010];
int count;
int main() {
	int n, a, b, x;
	scanf("%d%d%d", &n, &a, &b);
	for(int i=1; i<=n; i++) {
		scanf("%d", &x);
		if(x<a||x>=b) count++;
	}
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
    int main()
    {
        double x1,x2,x3,y1,y2,y3,m1,c1,c2,X,Y,m2,xm,ym;
        int i,q;
        scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
        scanf("%d",&q);
        for(i=0;i<q;i++)
        {
            scanf("%lf %lf",&x3,&y3);
            if(x1==x2)
            {
                X=x2;
                Y=y3;
            }
            else if(y1==y2)
            {
                Y=y1;
                X=x3;
            }
            else
            {
                m1=(y1-y2)/(x1-x2);
                c1=y1-m1*x1;
                m2=-1/m1;
                c2=y3-m2*x3;
                X=(c2-c1)/(m1-m2);
                Y=m2*X+c2;}
                xm=2*X-x3;
                ym=2*Y-y3;
            printf("%.10lf %.10lf\n",xm,ym);
        }

    	return 0;
    }

  // ALHAMDULLIAH





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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc85() {
	ll n, y;
	ll ans = 0;

	cin >> n >> y;

	ll a, b, c;
	ll p, q;

	a = b = c = -1;
	rep(i, y / 10000 + 1){
		p = y - 10000 * i;
		rep(j, p / 5000 + 1) {
			q = y - 10000 * i - 5000 * j;
			ll k = q / 1000;
			if (i + j + k == n && 10000 * i + 5000 * j + 1000 * k == y) {
				a = i;
				b = j;
				c = k;
				cout << a << " " << b << " " << c << "\n";
				return;
			}
		}
	}

	cout << a << " " << b << " " << c << "\n";
}

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

	solve_abc85();

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
using namespace std;
const int MAX = 1000000;

int main(){
    int a, b, sum, digit;
    while(scanf("%d %d", &a, &b) != EOF){
        sum = a+b;
        digit = 0;
        while(sum > 0){
            sum /= 10;
            digit++;
        }
        cout << digit << endl;
    }
    return 0;
}



Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n ;
  cin>>n ;
  map<int,int>m ;
  for(int i=0;i<n;i++){
    int x ;
    cin>>x ;
    m[x]++ ;
  }
  int res=0 ;
  for(auto u : m){
    if(u.second >= u.first )
    res+=u.second - u.first ;
    else res+=u.second ;
    
  }
  cout<<res<<endl ;
}

Measured memory_bytes: 8012
#include <iostream>

int main()
{
    std::string s;
    std::cin >> s;

    int count_0 = 0, count_1 = 0;

    for (auto c : s) {
        if (c == '0') {
            count_0++;
        } else {
            count_1++;
        }
    }

    std::cout << std::min(count_0, count_1) * 2 << std::endl;
}


Measured memory_bytes: 512
N, D = list(map(int, input().split(' ')))

counter = 0

def dis(x, y):
  return (x**2 + y**2)**(0.5)

for i in range(N):
  X, Y = list(map(int, input().split(' ')))
  if dis(X, Y) <= D:
    counter += 1

print(counter)

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

int main(){
  int stack[101], s_top = 0, x, i;
  char n[100];

  while ( ( scanf("%s",n) ) != EOF){
    if(n[0] == '+'){
      s_top -= 1;
      x = stack[s_top];
      x += stack[s_top + 1];
    }
    else if(n[0] == '-'){
      s_top -= 1;
      x = stack[s_top];
      x -= stack[s_top + 1];
    }
    else if(n[0] == '*'){
      s_top -= 1;
      x = stack[s_top];
      x *= stack[s_top + 1];
    }
    else{
      x = atoi(n);
      s_top += 1;
    }
    stack[s_top] = x;
  }      
  
  printf("%d\n" ,stack[s_top]);
  
  return 0;
}

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

struct Point{
  double x,y;

  Point(){}
  Point(double x,double y) : x(x),y(y) {}

  Point operator + (const Point &p)const{ return Point(x+p.x,y+p.y); }
  Point operator - (const Point &p)const{ return Point(x-p.x,y-p.y); }
  Point operator * (const double &k)const{ return Point(x*k,y*k); }
  Point operator / (const double &k)const{ return Point(x/k,y/k); }
  bool operator < (const Point &p)const{ return x != p.x ? x < p.x : y < p.y; }
};

int N;
vector<Point> v;

double getArea(){
  double ans = 0;
  for(int i = 1; i < N+1 ; i++){
    ans += (v[i%N].x-v[i-1].x)*(v[i%N].y+v[i-1].y);
  }
  ans /= 2.0;
  return abs(ans);
}

int main(){
  cin >> N;
  double x ,y;
  for(int i = 0 ; i < N ; i++){
    cin >> x >> y;
    v.push_back(Point(x,y));
  } 
  printf("%.1f\n",getArea());
  return 0;
}

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

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}


int main() {
  int s,w;
  cin >> s >> w;
  string ans = "safe";
  if (s<=w) ans = "unsafe";
  cout << ans << endl;
}


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

#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INFTY 1000000000

int n,M[101][101],color[101],d[101],p[101];

void prim() {
  for ( int i = 0; i < 101; i++ ) {
    color[i] = WHITE;
    d[i] = INFTY;
    p[i] = -1;
  }
  
  d[0] = 0;
  int u;
  while(1){
    u = -1;
    int mincost = INFTY;

    for ( int i = 0; i < n; i++ ) {
      if ( color[i] != BLACK && d[i] < mincost ) {
	mincost = d[i];
	u = i;
      }
    }

    if ( u == -1 ) break;

    color[u] = BLACK;
    
    for ( int v = 0; v < n; v++ ) {
      if ( color[v] != BLACK && M[u][v] != INFTY ) {
	if ( M[u][v] < d[v] ) {
	  d[v] = M[u][v];
	  p[v] = u;
	  color[v] = GRAY;
	}
      }
    }
  }

  int ans = 0;

  for ( int i = 0; i < n; i++ ) {
    if ( p[i] != -1 ) {
      int tmp = d[i]/100-1;
      ans += tmp;
    }
  }
  cout << ans << endl;
}

int main() {

  while( cin >> n,n) {
    for ( int i = 0; i  < 101; i++ ) {
      for ( int j = 0; j < 101; j++ ) {
	M[i][j] = INFTY;
      }
    }
    int m; cin >> m;
    char ch;
    for ( int i = 0; i < m; i++ ) {
      int a,b,distance;
      cin >> a >> ch >> b >> ch >> distance;
      M[a][b] = distance;
      M[b][a] = distance;
    }
  
    prim();

  }
  
  return 0;
}

Measured memory_bytes: 1196
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val h = sc.nextInt()
    val w = sc.nextInt()
    val n = sc.nextInt()

    val max = if (h < w) w else h
    val ans = Math.ceil(n.toDouble / max.toDouble).toInt

    println(s"$ans")
  }
}


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

class main{
  public static void Main(string[] args){
    int ans = 0;
    int s = int.Parse(Console.ReadLine());
    if(s < 3){
      Console.WriteLine(ans);
      return;
    }
    
    string[] t = Console.ReadLine().Split(" ");
    List<int> lengthes = new List<int>();
      
    for(int a = 0; a < t.Length; a++){
      lengthes.Add(int.Parse(t[a])); 
    }
       
    int[] length = lengthes.OrderByDescending(p => p).ToArray();
    for(int i = 0; i < length.Length; i++){
      for(int j = i + 1; j < length.Length; j++){
        if (length[i] == length[j])
          continue;
        for(int k = j + 1; k < length.Length; k++){
          if(length[j] == length[k])
            continue;
          if(length[i] < length[j] + length[k])
            ans++;
        }
      }
    }
    Console.WriteLine(ans);
  }
}

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



int main() {
    int N,K;
    cin>>N>>K;
    vector<int> h(N);
    rep(i,N){
        cin>>h.at(i);
    }
    vector<int> dp(N+K,MOD);
    dp[0]=0;
    rep(i,N-1){
        rep(j,K){
            int now=dp.at(i+j+1);
            int ne=dp[i]+abs(h[i+j+1]-h[i]);
            dp.at(i+j+1)=min(now,ne);
        }
    }
    cout<<dp[N-1]<<endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e9;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
int n;
int w[200000];
int wa;
signed main(){
  cin >> n;
  REP(i,n){
    cin >> w[i];
    wa += w[i];
  }
  int ans = INF;
  int now = 0;
  REP(i,n-1){
    now += w[i];
    ans = min(ans,abs(wa-now-now));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e

ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
int main() {
cout << fixed << setprecision(16);
  ll n;
  cin>>n;
  vector<double> x(n);
  vector<double> y(n);
  loop(i,n){
    cin>>x[i]>>y[i];
  }
  vec v(n);
  loop(i,n){
    v[i]=i;
  }
  double ans=0;
  double ANS=0;
  do{
    loop(i,n-1){
      ans+=sqrt(   (x[v[i+1]]-x[v[i]])*(x[v[i+1]]-x[v[i]]) +  (y[v[i+1]]-y[v[i]])*(y[v[i+1]]-y[v[i]])  );
    }

    ANS+=ans;
    ans=0;
}while(next_permutation(v.begin(), v.end()));
  double d=1;
  loop(i,n){
    d*=(i+1);
  }

  putout(ANS/d);
  
  
  
}

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

A=[]
B=[]
C=[]
D=[]
for i in range(1,N+1):
    A.append(i)
for i in range(1,N//3+1):
    B.append(3*i)
for i in range(1,N//5+1):
    C.append(5*i)
for i in range(1,N//15+1):
    D.append(i*15)
    
print(sum(A)-(sum(B)+sum(C)-sum(D)))

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

const int MAXM = 3000000;
const int MAXN = 300000;

int n , m ;

bool cmp(int a,int b){
return a>b;
}
int a[ MAXN ];
int main(){
    scanf("%d%d",&n,&m);
    for (int i=1;i<=n;i++)
        {
            int x;
            scanf("%d",&x);
            a[x]++;
        }
    sort(a,a+MAXN,cmp);
    int sum=0;
    for (int i=0;i<m;i++)
        sum+=a[i];
    printf("%d\n",n-sum);
    return 0;
}


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

using namespace std;

int main(void) {
    int n, a;
    cin >> n;
    vector<int> numb(n);
    for(int i = 0; i < (n -1); i++){
        cin >> a;
        numb.at(a - 1) += 1;
    }

    for(int i = 0; i < n; i++){
        cout << numb.at(i) << endl;
    }
    return 0;
}


Measured memory_bytes: 4052
import sys
import re
import random
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def fact_and_inv(SIZE):
    inv = [0] * SIZE  # inv[j] = j^{-1} mod MOD
    fac = [0] * SIZE  # fac[j] = j! mod MOD
    finv = [0] * SIZE  # finv[j] = (j!)^{-1} mod MOD
    inv[1] = 1
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2, SIZE):
        inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD
        fac[i] = fac[i - 1] * i % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    return fac, finv

def solve():
    n = getN()

    points = [getList() for i in range(n)]

    inf = 10 ** 10

    org = []
    far = []
    for x, y in points:
        org.append(x + y)
        far.append(y + inf-x)

    org.sort()
    far.sort()

    a1 = abs(org[0] - org[-1])
    a2 = abs(far[0] - far[-1])

    ans = max(a1, a2)
    print(ans)

def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()

Measured memory_bytes: 135108
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    a, b, n = map(int, input().split())

    x = min(b - 1, n)

    print(int(a * x / b) - a * int(x / b))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 61880
#include<stdio.h>
#include<string.h>
#define rep(a,b) for(int i=a;i<=b;i++)

int main(void){
  char s[100]; scanf("%s",&s);
  int len=strlen(s);

  int cnt=0,pnt=0;
  //condition_1
  rep(0,len-1){
    if(s[i]==s[len-1-i]){
      cnt+=1;
    }
  }
  if(cnt==len){
    pnt+=1;
  }
  //condition_2
  cnt=0;
  rep(0,(len-1)/2-1){
    if(s[i]==s[(len-1)/2-1-i]){
      cnt+=1;
    }
  }
  if(cnt==(len-1)/2){
    pnt+=1;
  }
  //conditon_3
  cnt=0;
  rep(0,(len-1)/2-1){
    if(s[len-1-i]==s[(len-1)/2+1+i]){
      cnt+=1;
    }
  }
  if(cnt==(len-1)/2){
    pnt+=1;
  }
  //judge
  if(pnt==3){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }

  return 0;
}


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

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

  if(A + B > C + D){
    cout << "Left" <<endl;
  }
  else if(A + B < C + D){
    cout << "Right" <<endl;
  }
  else{
    cout << "Balanced" <<endl;
  }
}

Measured memory_bytes: 3564
#include<bits/stdc++.h> 
using namespace std; 
  
// Function to find the minimum number  
// character change required  
   
int change(string s) 
{ 
  
    // Finding the length of the string  
    int n = s.length();  
  
    // To store the number of replacement operations  
    int cc = 0; 
  
    for(int i=0;i<n/2;i++) 
    { 
  
        // If the characters at location  
        // i and n-i-1 are same then  
        // no change is required  
        if(s[i]== s[n-i-1])  
            continue; 
  
        // Counting one change operation  
        cc+= 1; 
  
        // Changing the character with higher  
        // ascii value with lower ascii value  
        if(s[i]<s[n-i-1])  
            s[n-i-1]= s[i] ; 
        else
            s[i]= s[n-i-1] ; 
    } 
    //printf("Minimum characters to be replaced = %d\n", (cc)) ; 
    //cout<<s<<endl;
  return cc;
} 
// Driver code  
int main() 
{ 
string s ;
  cin>>s;
cout<<change((s)); 
return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
using namespace std;
int main()
{
	int a,b,c;
	cin >> a>>b>>c;
	cout << (a+b)*c/ 2 << endl;
}

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}

int main(void){
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    long double rad=2*PI*((long double)h/12+((long double)m/60)/12.0-(long double)m/60.0);
    long double ans=(long double)(a*a+b*b)-(long double)2*a*b*cosl(rad);
    printf("%.12Lf\n",sqrt(ans));
    return 0;
}

Measured memory_bytes: 4156
#include<bits/stdc++.h>
#include <iostream>
#define ll long long
#define MOD (int)1e9+7

using namespace std;

int main() {
    ll n;cin>>n;
    vector<ll> vt(n,0),sf_sum(n,0);
    for(int i=0;i<n;i++) cin>>vt[i];
    ll sum = vt[n-1];
    for(int i=n-2;i>=0;i--){
        sum%=MOD;
        sf_sum[i] = sum;
        sum+= vt[i];
    }
    ll ans =0;
    for(int i=n-2;i>=0;i--){
        ans+= vt[i]*sf_sum[i];
        ans%=MOD;
    }
    // for(auto it: sf_sum) cout<<it<<" ";
    // cout<<"\n";
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 6424
S = list(input())

kisu = ['R', 'U', 'D']
guu = ['L', 'U', 'D']
check = 'Yes'
for i, st in enumerate(S):
		if (i + 1) % 2 == 0:
				if not st in guu:
						check = 'No'
		else:
				if not st in kisu:
						check = 'No'

print(check)


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

using ll =  long long;
using pint =  pair<int,int>;

#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i))
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(x,v) for(const auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義 #define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
//lambda: [&](int x, int y){return x<y;}

signed main(void){
    string s;cin>>s;
    rep(i,s.length()){
        if(i%2==0){
            cout << s[i];
        }
    }
    cout << endl;

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int x,y;
string s;
int main()
{
	cin>>s;
	for(int i=0;i<4;i++)
	{
		cout<<s[i];
	}
	cout<<' ';
	for(int i=4;i<s.size();i++)
	{
		cout<<s[i];
	}
	cout<<endl;
    return 0;
}

Measured memory_bytes: 256
// mod 組み合わせ計算2
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)

// 自動でmodを取ってくれる整数型
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const { // ans=mint(a).pow(b); // a^b
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint f(int n){ // 2のn乗
    if(n==0) return 1;
    mint x=f(n/2);
    x*=x;
    if(n%2==1) x*=2;
    return x;
}

// n(>10^8)が大きくても早く計算できる
// 但し、何回も呼ぶと遅い
mint choose(int n,int a){ // 組み合わせ　nCa
    mint x=1,y=1;
    rep(i,a){
        x*=n-i;
        y*=i+1;
    }
    return x/y;
}

int main(){
    ll X,Y;
    cin>>X>>Y;
    ll a,n;
    if((2*Y-X)%3<0){
        cout<<"0"<<endl;
        return 0;
    }
    a=(2*Y-X)/3;
    if(a<0 || (Y+X)%3!=0){
        cout<<"0"<<endl;
        return 0;
    }
    n=(X+Y)/3;
    mint ans=choose(n, a);
    cout<<ans<<endl;
    return 0;
}


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

int main() {
    bool b[] = {false, false, false, false, false};
    for (int i = 0; i < 5; i++) {
        int x;
        cin >> x;
        if (x == 0) continue;
        b[x - 1] = true;
    }
    for (int i = 0; i < 5; i++) {
        if (!b[i]) cout << i + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define md 1000000007
#define ll long long 
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fastmap mp.reserve(1024);mp.max_load_factor(0.25);
#define fastset st.reserve(1024);st.max_load_factor(0.25);
ll int mpw(ll int a,ll int b,ll int m)
{
	ll int ans=1;
	if(a==0)return 0;
	if(a==1 || b==0)return 1;
	while(b)
	{
		if(b&1)
		{
			ans=(ans*a)%m;
		}
		a=(a*a)%m;
		b>>=1;
	}
	return ans;
}
 
ll int pw(ll int a,ll int b)
{
	ll int ans=1;
	if(a==0)return 0;
	if(a==1 || b==0)return 1;
	while(b)
	{
		if(b&1)
		{
			ans*=a;
		}
		a*=a;
		b>>=1;
	}
	return ans;
}
 
ll int mn(ll int a,ll int b)
{
	if(a<=b)
	{
		return a;
	}
	return b;
}
 
ll int mx(ll int a,ll int b)
{
	if(a>=b)
	{
		return a;
	}
	return b;
}
 
int main()
{
	fio
	int n,k;
	cin>>n>>k;
	vector<int>nm(n);
	for(int i=0;i<n;++i)
	{
		cin>>nm[i];
	}
	vector<vector<ll int>>D(n,vector<ll int>(k+1,0));
	for(int i=0;i<=nm[0];++i)
	{
		D[0][i]=1;
	}
	for(int i=k-1;i>=0;--i)
	{
		D[0][i]=(D[0][i+1]+D[0][i])%md;
	}
	for(int i=1;i<n;++i)
	{
		D[i][0]=1;
		for(int j=1;j<=k;++j)
		{
			if(j>=nm[i])
			{
				D[i][j]=(((D[i-1][j-nm[i]]-(j==k?0:D[i-1][j+1]))%md)+md)%md;
			}
			else{
				D[i][j]=(((D[i-1][0]-(j==k?0:D[i-1][j+1]))%md)+md)%md;
			}	
		}
		for(int j=k-1;j>=0;--j)
		{
			D[i][j]=(D[i][j+1]+D[i][j])%md;
		}
	}
	cout<<D[n-1][k]<<"\n";
	return 0;
}

Measured memory_bytes: 82228