akhauriyash/Code-Regression huggingface dataset:
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> v(n);
  rep(i, n)
  {
    if (s[i] == 'R')
      v[i] = 0;
    else if (s[i] == 'G')
      v[i] = 1;
    else
      v[i] = 2;
  }
  ll sum = 0;
  ll csum[4010][3];
  rep(i, 3) csum[0][i] = 0;
  rep(i, n)
  {
    rep(j, 3)
    {
      csum[i + 1][j] = csum[i][j] + (v[i] == j);
    }
  }
  REP(j, 1, n - 1)
  {
    int c1, c2;
    if (v[j] == 0)
      c1 = 1, c2 = 2;
    else if (v[j] == 1)
      c1 = 0, c2 = 2;
    else
      c1 = 0, c2 = 1;
    sum += csum[j][c1] * (csum[n][c2] - csum[j + 1][c2]);
    sum += csum[j][c2] * (csum[n][c1] - csum[j + 1][c1]);
    for (int i = j - 1, k = j + 1; i >= 0 && k < n; i--, k++)
    {
      if (v[i] != v[j] && v[j] != v[k] && v[i] != v[k])
        sum--;
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3768
N = int(raw_input())

d_num = 0
even = True
ary = []
N_tmp = N

while N_tmp != 0:
    ary.append(N_tmp % 10)
    N_tmp = N_tmp / 10
    even = not even
    d_num = d_num + 1

# print d_num, ary

if d_num == 1:
    print ary[0]
elif d_num == 2:
    print 9
elif d_num == 3:
    print 9 + (N -100) +1
elif d_num == 4:
    print 9 + 900
elif d_num == 5:
    print 9 + 900 + (N -10000) +1
elif d_num == 6:
    print 9 +  900 + 90000


Measured memory_bytes: 2568
N = int(input())
A = list(map(int, input().split()))

p = [0 for _ in range(N)]

for i in range(1, N - 1):
    if A[i - 1] <= A[i] > A[i + 1]:
        p[i] = 1
    elif A[i - 1] >= A[i] < A[i + 1]:
        p[i] = 2

if A[0] > A[1]:
    p[0] = 1
if A[0] < A[1]:
    p[0] = 2
if A[-2] <= A[-1]:
    p[-1] = 1
if A[-2] > A[-1]:
    p[-1] = 2

res = 1000
kabu = 0

for i in range(N)[::-1]:
    if p[i] == 1:
        break
    if p[i] == 2:
        p[i] = 0

for i in range(N):
    if p[i] == 2:
        v = res // A[i]
        kabu += v
        res -= A[i] * v
    elif p[i] == 1:
        res += kabu * A[i]
        kabu = 0

print(res)

Measured memory_bytes: 9276
#include<stdio.h>
#define MAX 44
int f[MAX];
int fibo(int n){
  int i;
  f[0]=f[1]=1;
  for(i=2;i<=n;i++) f[i]=f[i-1]+f[i-2];
  return f[n];
}
int main(){
  int n;
  scanf("%d",&n);
  printf("%d\n",fibo(n));
  return 0;
}



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

using namespace std;

using ll = long long;
using ld = long double;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cout << setprecision(9) << setiosflags(ios::fixed);

    ll w, h, x, y;
    cin >> w >> h >> x >> y;

    cout << 0.5 * (w * h) << " ";
    if ((2 * x == w) && (2 * y == h)) cout << "1\n";
    else cout << "0\n";

    return 0;
}


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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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; }

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    string s,t;
    cin >> s >> t;

    multiset<char> set_s;
    multiset<char> set_t;

    rep(i,s.size()) set_s.insert(s[i]);
    rep(i,t.size()) set_t.insert(t[i]);

    string S = "";
    string T = "";

    for(multiset<char>::iterator itr = set_s.begin(); itr != set_s.end(); itr++)
    {
        S += *itr;
    }
    
    for(multiset<char>::iterator itr = set_t.begin(); itr != set_t.end(); itr++)
    {
        T += *itr;
    }
    reverse(all(T));


    if( S < T ) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main() {
    vector<string> vec(2);
    cin >> vec[0];
    cin >> vec[1];

    if (vec[0][0] == vec[1][2] && vec[0][1] == vec[1][1] && vec[0][2] == vec[1][0]) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[4];
    map < char , int >mp;
    map < char , int >:: iterator it;
    int c1=0,c2=0;

    cin>>s;
    for(int i=0;i<4;i++)
    {
        mp[s[i]]++;
    }
    for(it=mp.begin();it!=mp.end();it++)
    {
        c1++;
    }
    for(it= mp.begin();it!=mp.end();it++)
    {
        if(it->second==2)
            c2++;
    }
    if(c1==2 && c2==2)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 256
x = gets.to_i
i = gets.chop.split.map(&:to_i)
o = 0
count = 0
flg = true
while flg do
    while o < x do 
        if i[o] % 2 == 1 then
            flg = false
        end
        i[o] /= 2
        o += 1
    end
    o = 0
    if flg then
        count += 1
    end
end

puts count

Measured memory_bytes: 1788
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

//Code Short
#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define DSORT(n) sort(n.begin(),n.end())
#define QECHO(n) cout << n
#define QECHOS(n) cout << n << " "

//Define Math
const double EPS = 1e-10;
const double PI  = acos(-1.0);

using namespace std;
typedef long long ll;
/* prototype */
int EDSum(ll);//各桁の和
vector<int> SOE(int,int);//素数 (Min,Max)
int MinCM(int,int);//最小公倍数(num1,num2)
int MaxCD(int,int);//最大公約数(num1,num2)
vector<int> igets(int);//cin * N
ll nPr(ll,ll); //(n,r)
ll nE(ll); //(n)
ll nCr(ll,ll); //(n,r)

void solve(){
    //START
    int N;
    cin >> N;
    vector<int> a = igets(N);
    
    int p = a[0];
    int ans = 0;
    for(int i = 1; i < N;++i){
      if(p == a[i]){
        a[i] = i*-1;
        ++ans;
      }
      p = a[i];
    }
    cout << ans << endl;
}

int main(void){cin.tie(0);ios::sync_with_stdio(false);solve();}
int EDSum(ll number) {
  int ans = 0;
  while (1) {
    ans += number % 10;
    number /= 10;
    if (number == 0) break;
  }
  return ans;
}

vector < int > SOE(int min, int max) {
  if (min < 2) min = 2;
  vector < int > int_array;
  for (int i = min; i <= max; i++) int_array.push_back(i);
  vector < int > sosu;
  double stop = sqrt(max);
  while (true) {
    sosu.push_back(int_array.front());
    int_array.erase(int_array.begin());
    if (stop < (double)(sosu.back())) break;
    for (int i = 0; i < (int) int_array.size(); i++) {
      if (int_array[i] % sosu.back() == 0)
        int_array.erase(int_array.begin() + i);
    }
  }
  sosu.insert(sosu.end(), int_array.begin(), int_array.end());
  return sosu;
}

int MinCM(int a, int b) {
  int c = a * b;
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return c / b;
}

int MaxCD(int a, int b) {
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
vector < int > igets(int N) {
  vector < int > A;
  int temp;
  for (int i = 0; i < N; ++i) {
    cin >> temp;
    A.push_back(temp);
  }
  return A;
}

ll nPr(ll n, ll r) {
  ll ans = 1;
  r = n - r;
  while (n != r) {
    ans *= n;
    --n;
  }
  return ans;
}

ll nE(ll n) {
  return nPr(n, n);
}

ll nCr(ll n, ll r) {
  if (r == 0) return -1;
  else {
    if (0 != n - r && n - r < r) r = n - r;
    return nPr(n, r) / nE(r);
  }
}

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

template <class T> using V = vector<T>;

using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;


#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;


ll sum(ll n) {
  ll m=0;
  FOR(i,0,12){
    m+=n%10;
    n/=10;
  }
  return m;
}


ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}


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


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/


signed main() {
  ll a,b,c;
  	ci(a>>b>>c);
  co(max({a,b,c})-min({a,b,c}))
     }

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

const int N = 1e5, MOD = 1e9 + 7;

int a[N], t[N];

int main(){
	int n, mt, ma;
	unsigned long long res = 1;
	cin >> n;
	for(int i = 0;i < n;++i){
		cin >> t[i];
	}
	for(int i = 0;i < n;++i){
		cin >> a[i];
	}
	if(t[n - 1] != a[0]) res = 0;
	else{
		for(int i = 0;i < n;++i){
			if(t[i] == t[n - 1]){
				mt = i;
				break;
			}
		}
		for(int i = n - 1;0 <= i;--i){
			if(a[i] == a[0]){
				ma = i;
				break;
			}
		}
		if(ma - mt < 0) res = 0;
		for(int i = 1;i < n - 1;++i){
			if(i < mt) {
				res *= (t[i] != t[i - 1] ? 1 : t[i]);
			}
			else if(ma < i) {
				res *= (a[i] != a[i + 1] ? 1 : a[i]);
			}
			else if(mt < i && i < ma){
				res *= a[0];
			}
			res %= MOD;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1152
N = int(input())
time = [0]*N
tmp = input().split()
total = 0
for i in range(N):
  time[i] = int(tmp[i])
  total += time[i]
M = int(input())
for j in range(M):
  tmp = input().split()
  print(total+int(tmp[1])-time[(int(tmp[0])-1)])

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

int main()
{
  int n;
  cin >> n;
  char c[n];
  int a[n];
  for(int i=0;i<n;i++)
    cin >> c[i] >> a[i];

  char x[52];
  int y[52];

  for(int i=0;i<13;i++)
    {
      x[i]='S';y[i]=i+1;
      x[i+13*1]='H';y[i+13*1]=i+1;
      x[i+13*2]='C';y[i+13*2]=i+1;
      x[i+13*3]='D';y[i+13*3]=i+1;
    }

  for(int i=0;i<52;i++)
    {
      int k=0;
      for(int j=0;j<n;j++)
	{
	  if(x[i]==c[j]&&y[i]==a[j])
	  k++;
	}
    
      if(k==0) cout << x[i] << " " << y[i] << endl;
 
    }
  return 0;
}

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

using namespace std;

using ll = long long;

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

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template <typename T>
using matrix = std::vector<std::vector<T>>;

long long mod = 1e9+7;

template <typename T>
matrix<T> modmul(const matrix<T> &l, const matrix<T> &r)
{
    matrix<T> ret(l.size(), std::vector<T>(r[0].size()));
    for (int i = 0; i < (int)l.size(); i++)
    {
        for (int k = 0; k < (int)r.size(); k++)
        {
            for (int j = 0; j < (int)r[0].size(); j++)
            {
                ret[i][j] += l[i][k] * r[k][j] % mod;
                ret[i][j] %= mod;
            }
        }
    }
    return ret;
}

template <typename T>
std::vector<T> modmul(const matrix<T> &a, const std::vector<T> &x)
{
    const int n = a.size();
    const int m = x.size();
    std::vector<T> ret(n);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            ret[i] += a[i][j] * x[j] % mod;
            ret[i] %= mod;
        }
    }
    return ret;
}

template <typename T>
matrix<T> eye(const int n)
{
    matrix<T> ret(n, std::vector<T>(n));
    for (int i = 0; i < n; i++)
        ret[i][i] = 1;
    return ret;
}

template <typename T>
matrix<T> modpow(matrix<T> x, long long n)
{
    auto ret = eye<T>(x.size());
    while (n)
    {
        if (n & 1)
            ret = modmul(ret, x);
        x = modmul(x, x);
        n /= 2;
    }
    return ret;
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);
  while(1) {
    int n, m, a, b, c, t;
    cin >> n >> m >> a >> b >> c >> t;
    mod = m;
    if(n == 0) break;

    matrix<int> B(1, vector<int>(n+2, 0));
    for(int i=1;i<n+1;++i) {
      cin >> B[0][i];
    }

    matrix<int> A(n+2, vector<int>(n+2, 0));
    for(int i=0;i<n+2;++i) {
      for(int j=0;j<n+2;++j) {
        if(j == 0 || j == n+1) continue;
        if(i - j == 1) A[i][j] = c;
        else if(i == j) A[i][j] = b;
        else if(j - i == 1) A[i][j] = a;
      }
    }

    A = modpow(A, t);
    B = modmul(B, A);

    for(int i=1;i<n+1;++i) {
      cout << B[0][i];
      if(i == n) cout << endl;
      else cout << " ";
    }
  }
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>
#define _USE_MATH_DEFINES
#define ll long long int
using namespace std;
//mp.reserve(1024);
//mp.max_load_factor(0.25);
bool sortit(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
       return (a.first -a.second > b.first-b.second);
}

int main()
{
	ios_base::sync_with_stdio(false);
   	cin.tie(NULL);
   	cout.tie(NULL);
    // freopen("mr_x_input.txt", "r", stdin);
    //freopen("output1.txt", "w", stdout);
	ll l,r,d;
	cin>>l>>r>>d;
	ll ans = r/d - l/d + (r%d==0&&l%d==0);
	cout<<ans<<endl;
  	return 0;
}


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

#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define FILL(v,p) memset(v,p,sizeof v)
#define FIO ios::sync_with_stdio(NULL); cin.tie(NULL)
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define PI acos(-1.0)

const ll MOD = 1000000007;
const ll INF = 2000000000000000001LL;
const ld EPS = 1e-9;

bool isPal(string s)
{
    for(int i=0, j=s.size()-1;i<j;i++,j--)
        if(s[i]!=s[j]) return 0;
    
    return 1;
}

int main()
{
    FIO;
    
    string s;
    cin >> s;
    
    ll sz = (s.size()-1)/2;
    
    string tmp;
    
    for(int i=1;i<=sz;i++) tmp.push_back(s[i-1]);
    
    string x;
    
    for(int i=(s.size()+3)/2; i<=s.size();i++) x.push_back(s[i-1]);
    
    if(isPal(tmp) && isPal(x) && isPal(s)) cout << "Yes\n";
    else cout << "No\n";
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(){
    long long a, b, k;
    std::cin >> a >> b >> k;

    long long x = std::min(a, k);
    a -= x;
    k -= x;

    if(0 != k){
        b -= std::min(b, k);
    }

    std::cout << a << " " << b << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define mp make_pair
#define fi first
#define se second
#define pb push_back

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

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int a, b, c;
    cin >> a >> b >> c;

    cout << a * b / 2 << endl;

    return 0;
}

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

const int MAX=200010;


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

    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    vector<vector<int>> cnt(h,vector<int>(w,INF));
    if (s[0][0]=='.') cnt[0][0]=0;
    else cnt[0][0]=1;
    rep(i,h) {
        rep(j,w) {
            if (j<w-1) {
                if (s[i][j]==s[i][j+1]) cnt[i][j+1]=min(cnt[i][j+1],cnt[i][j]);
                else cnt[i][j+1]=min(cnt[i][j+1],cnt[i][j]+1); 
            }
            if (i<h-1) {
                if (s[i][j]==s[i+1][j]) cnt[i+1][j]=min(cnt[i+1][j],cnt[i][j]);
                else cnt[i+1][j]=min(cnt[i+1][j],cnt[i][j]+1); 
            }
        }
    }
    cout << (cnt[h-1][w-1]+1)/2 << endl;
    
    return 0;
}


Measured memory_bytes: 3684
import java.util.*;

public class Main {

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

		
		Scanner s=new Scanner(System.in);
		
		int a=s.nextInt();
		int b=s.nextInt();
		int t=s.nextInt();
		
	
		
		System.out.println(b*(t/a));
	}

}


Measured memory_bytes: 21844
import java.util.*;
import java.io.*;
public class Main {
    long MOD = 1000000007;
    void solve(BufferedReader in) throws Exception {
        int[] xx = toInts(in.readLine());
        int min = Math.min(xx[0], xx[1]);
        int max = Math.max(xx[0], xx[1]);
        long res;
        if(min == max) {
            long f = f(min);
            res = (2*f*f)%MOD;
        } else if(min + 1 == max){
            long f = f(min);
            res = (f*((f*max)%MOD))%MOD;
        } else {
            res = 0;
        }
        System.out.println(res);
    }
    long f(int n) {
        long res = 1;
        for(int i = 2; i<=n; i++) res = (res*i)%MOD;
        return res;
    }
    int toInt(String s) {return Integer.parseInt(s);}
    int[] toInts(String s) {
        String[] a = s.split(" ");
        int[] o = new int[a.length];
        for(int i = 0; i<a.length; i++) o[i] = toInt(a[i]);
        return o;
    }
    void e(Object o) {
        System.err.println(o);
    }
    public static void main(String[] args) throws Exception{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        (new Main()).solve(in);
    }
}


Measured memory_bytes: 20948
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    string s;
    cin >> s;
    queue<P> r,l;
    int n=s.size();
    bool which;
    int ctr;
    rp(i,n){
        if(i==0){
            which=true;
            ctr=1;
            continue;
        }
        if(which&&s.at(i)=='L'){
            r.push(mp(i-1,ctr));
            ctr=1;
            which=false;
            continue;
        }
        if(!which&&s.at(i)=='R'){
            l.push(mp(i-ctr,ctr));
            ctr=1;
            which=true;
            continue;
        }
        ctr++;
    }
    l.push(mp(n-ctr,ctr));
    vi ans(n,0);
    while(!r.empty()){
        P p=r.front(); r.pop();
        ans.at(p.first)+=(p.second+1)/2;
        ans.at(p.first+1)+=p.second/2;
    }
    while(!l.empty()){
        P p=l.front(); l.pop();
        ans.at(p.first)+=(p.second+1)/2;
        ans.at(p.first-1)+=p.second/2;
    }
    for(auto i:ans){
        princ(i);
    }
    cout << endl;
    return 0;
}

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

typedef long long ll;
#define PI 2 * acos (0.0)

ll MOD = 1e9 + 7 ;
ll arr[200005] ;

int main()
{
  ll n, cnt = 0, val = 1, x ;
  cin >> n ;

  for(int i = 0; i < n; i++) {
    cin >> x ;
    if(x != val)  cnt++ ;
    else  val++ ;
  }
  if(cnt == n)  cout << -1 << endl ;
  else  cout << cnt << endl ;

}


Measured memory_bytes: 256
import java.util.*;
public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int  N = sc.nextInt();
     int[] a;
     a = new int[N];
     for(int i=0;i<N;i++){
       a[i]=sc.nextInt();
     }
     int j = 1;
     int ans = N;
     boolean flag=false;
     for(int i=0;i<N;i++){
       if(j==a[i]){
         j++;
         ans--;
         flag=true;
       }
     }
     if(!flag){
       ans = -1;
     }
     System.out.println(ans);
   }
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll n;
vector<ll> a;

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

  cin>>n;
  a.resize(n);
  rep(i,n)cin>>a[i];

  double res=0;
  rep(i,n){
    res+=(double)1.0/(double)a[i];
  }
  res=1.0/res;
  printf("%.10f\n", res);

  return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;
ll ans = 0;
unordered_map<ll, ll> m;
ll n, a[200009];
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++) {
        ll need = i - a[i];
//        cout<<i<<" "<<need<<" "<<i + a[i]<<" "<<ans<<endl;
        if(need > 0)
            ans += m[need];
        m[i + a[i]]++;
    }
    cout<<ans;
}
/*
 2
 1 1
 1 0
 1 1
 1 1
 */


Measured memory_bytes: 13596
#include  "bits/stdc++.h"
//#include  <iostream>
 using namespace std;
 
#define IOS         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define mem(a,v)    memset((a), (v), sizeof (a))
#define FOR(i,a,n)  for(int i = (a); i<(n); ++i) 
#define FORE(i,a,n) for(int i = (a); i<=(n); ++i)
#define mp(a , b)   make_pair(a , b)
#define pb(a)       push_back(a)

#define anal         '\n'

#define mod 1000000009


typedef long long ll;


 

int main(){
     
 IOS;
 
 #ifndef ONLINE_JUDGE  
    freopen("input.in", "r", stdin);
    freopen("output.in", "w", stdout);
 #else
// online submission
#endif 

 // -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
   
   ll a, n, b;
    cin >> a >> b >> n;

    if(n < b){
    	cout << floor(a * n / b);
    	return 0;
    }
    else{
        
         cout << floor((a * (b - 1)) / b);
         return 0;

    }
  return  0 ;      
}        


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

#define debug(x) cout << x << "\n";
#define debug2(x,y) cout << x << " " << y << "\n"
#define fi first
#define se second
#define pb push_back
#define ll long long 
const ll mod = 1e9+7;
const int MAX = 2e5+5;

int main() {
    int x;
    cin >> x;
    if(x == 0)
        cout << 1 << "\n" ;
    else if(x == 1)
        cout << 0 << "\n" ;
}






Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
    int a,b,c;
    cin>>a>>b;

   


    cout << (a-1)/b +1 << endl;

   return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 2019. 6/6
# Grid Repainting

from collections import deque

INF = 100000
dx = [1, 0, -1, 0]
dy = [0, -1, 0, 1]


class Coordinate(object):
    def __init__(self, x, y, dist=INF):
        self.x = x
        self.y = y
        self.dist = dist


if __name__ == '__main__':
    cnt = 0
    H, W = map(int, input().split())
    grid = [['#'] * (W + 2)]
    for i in range(H):
        line = list(input())
        cnt += line.count('.')
        grid.append(['#'] + line + ['#'])
    grid.append(['#'] * (W + 2))

    # BFS
    queue = deque()
    start = Coordinate(1, 1, 1) # dist means the panels needed to goal
    goal = Coordinate(W, H)
    queue.append(start)
    distance = [[INF]*(W+2) for i in range(H+2)]
    distance[1][1] = 0

    while len(queue):
        head = queue[0]
        queue.popleft()
        if head.x == goal.x and head.y == goal.y:
            goal.dist = head.dist
            break
        for i in range(4):
            next_p = Coordinate(head.x + dx[i], head.y + dy[i], head.dist)
            if (1 <= next_p.x <= W and 1 <= next_p.y <= H and
                    grid[next_p.y][next_p.x] != '#'
                        and distance[next_p.y][next_p.x] == INF):
                next_p.dist = head.dist + 1
                distance[next_p.y][next_p.x] = next_p.dist
                queue.append(next_p)

    if goal.dist == INF:
        print(-1)
    else:
        print(cnt - goal.dist)

Measured memory_bytes: 3440
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::iter::FromIterator;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let k = scan.read::<usize>();
    let mut g = vec![vec![];k];
    for i in 0..k {
        g[i].push((1, (i+1)%k));
        if i >=1 {g[i].push((0, i*10%k));}
    }
    let d = dijkstra(&g, 1);
    println!("{}", d[0]+1);
}

#[allow(dead_code)]
fn dijkstra(graph: &[Vec<(i64, usize)>], s: usize) -> Vec<i64> {
    let n = graph.len();
    let mut d = vec![1i64 << 60; n];
    d[s] = 0;
    let mut heap = std::collections::BinaryHeap::new();
    heap.push(Rev((0, s)));
    while let Some(Rev((p_cost, p))) = heap.pop() {
        if d[p] < p_cost {
            continue;
        }
        for &(v_cost, v) in &graph[p] {
            if d[v] > d[p] + v_cost {
                d[v] = d[p] + v_cost;
                heap.push(Rev((d[v], v)));
            }
        }
    }
    d
}

#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<std::cmp::Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> std::cmp::Ordering {
        other.0.cmp(&self.0)
    }
}

// region template
#[allow(dead_code)]
fn iu(i: isize) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> isize { i as isize }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

#[allow(dead_code)]
fn alt<S, T>(v: Vec<S>) -> T where T: FromIterator<S> {
    v.into_iter().collect::<T>()
}

#[allow(dead_code)]
fn dup<S, T>(v: &[S]) -> T where T: FromIterator<S>, S: Clone {
    v.iter().cloned().collect::<T>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

Measured memory_bytes: 16636
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

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

ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}

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


/////////////////////////////////////////////////////////////////////////////////////////

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

    ll n;
    cin >> n;

    cout << n * (n-1) / 2 << endl;
}


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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << res << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, l, r)  (a).begin()+(l),(a).begin()+(r)

int main() {
	int n, m;
	cin >> n >> m;
	vector<pair<int, bool>> v(n);
	FOR(i, 1, m) {
		int s, c;
		cin >> s >> c;
		if (v[s - 1].second) {
			if (v[s - 1].first != c) {
				ps(-1);
				return(0);
			}
		}
		else {
			v[s - 1].first = c;
			v[s - 1].second = true;
		}
	}
	if (n == 1) {
		pv(v[0].first);
		return(0);
	}
	if (v[0].second && (v[0].first == 0)) {
		ps(-1);
		return(0);
	}
	else {
		if (v[0].first == 0) {
			v[0].first = 1;
		}
	}
	FOR(i, 0, n - 1) {
		cout << v[i].first;
	}
	cout << endl;
	return(0);
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    int N=gi();
	    long[] A= new long[3*N];
        for(int i=0; i<3*N;i++) {
            A[i]=gl();
	    }
	    
        Arrays.parallelSort(A);
        
        int l=0;
        int r=3*N-2;
        long v=0;
        while(l<r) {
            v+=A[r];
            l++;
            r-=2;
        }
		System.out.println(v);
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 61540
import java.io.*;
class Main
{
public static void main(String[] args)throws IOException {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int K=Integer.parseInt(br.readLine());
    String S=br.readLine();
    String tokens[]=S.split(" ");
    int A=Integer.parseInt(tokens[0]);
    int B=Integer.parseInt(tokens[1]);
    int result=multiple(A,B,K);
    if (result==1)
        System.out.print("OK");
    else
        System.out.print("NG");
}

static int multiple(int a, int b,int x){

    int f=0;
    for (int i=a;i<=b;i++)
    {
        if(i%x==0)
            {f=1;
            break;
            }

    }
    return f;
}

}

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

using namespace std;

int main() {
  int n, d, x;
  cin >> n >> d >> x;
  int sum = x;
  for ( int i = 0; i < n; i++ ) {
    int a;
    cin >> a;
    sum += ( d - 1 ) / a + 1;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int n,m,i,j,k,l,r;
int a[100005];
long long ans,tmp,ans_sum,sum1[200005],sum2[200005];

int main()
{
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;++i)scanf("%d",&a[i]);
	for(i=1;i<n;++i)
	{
		l=a[i];r=a[i+1];
		if(r<l)r+=m;
		ans_sum+=r-l;
		if(l+1<r)
		{
			++sum1[l+2];sum2[l+2]-=l+1;
			--sum1[r+1];sum2[r+1]+=l+1;
		}
	}
	for(i=1;i<=m+m;++i)sum1[i]+=sum1[i-1],sum2[i]+=sum2[i-1];
	for(i=1;i<=m;++i)
	{
		tmp=sum1[i]*i+sum2[i]+sum1[i+m]*(i+m)+sum2[i+m];
		if(tmp>ans)ans=tmp;
	}
	printf("%lld\n",ans_sum-ans);
}

Measured memory_bytes: 3712
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<sstream>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; ++i)
#define per(i, a, n)  for(int i=n-1; i>=a; --i)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 1000000007
using namespace std;
typedef long long ll;

int main(){
  int N;  cin >> N;
  vector<int> H(N);
  rep(i, 0, N){
    cin >> H[i];
  }
  int ans = 0;
  rep(i, 0, N){
    bool able = true;
    rep(j, 0, i){
      if(H[i]<H[j]) able = false;
    }
    if(able)  ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let K = cin.getInt();
    const S = (n) => n.toString().split('').reduce((ac, v) => ac + (v - 0), 0);
    const compare = (x, y) => !(x * S(y) <= y * S(x));

    let n = 0, a = 1;
    for (let i = 0; i < K; i++) {
        if (compare(n + a, n + 10 * a)) a *= 10;
        n += a;
        console.log(n);
    }
}
class Inputer{constructor(t){if(typeof t=='undefined')throw new Error('引数（stdin）を省略できません！');this.cnt=0;this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');if(t<1)throw new Error('引数は1以上であること！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');if(t<1)throw new Error('引数は1以上であること！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 9516
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mode        998244353
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265358979323



void solve()
{
       string s;
       cin>>s;
       ll cnt[26];
       memset(cnt, 0, sizeof cnt);
       for(char c:s) cnt[c-'a']++;
       ll n = sz(s);
       if(n!=26)
       {
              cout<<s;
              rep(i,0,26)
              {
                     if(!cnt[i])
                     {
                            cout<<(char)(i+'a');
                            exit(0);
                     }
              }
       }
       if(n==26)
       {
              string t;
              for(ll j=24; j>=0; j--)
              {
                     if(s[j]<s[j+1])
                     {
                           ll mn = s[j+1];
                           ll idx = j+1;
                           for(ll k=j+2; k<26; k++)
                           {
                                  if(s[k]<mn && s[k]>s[j])
                                  {
                                         mn=s[k];
                                         idx=k;
                                  }
                           }
                           swap(s[j], s[idx]);
                           t = s.substr(0,j+1);
                           cout<<t;
                           exit(0);
                     }
              }
              cout<<-1;
              exit(0);
       }
}


int main()
{
    speed_up
    ll T=1;
    //cin>>T;
    while(T--)
        solve();
    return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

def main():
  x=I()
  l=primes(x+10000)

  for i,y in enumerate(l):
    if x<=y:
      return l[i]

# main()
print(main())


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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;



void solve(){

    int r;
    cin >> r;

    cout << setprecision(5) << 2*acos(-1)*r << "\n";
    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

    fast_io;
    int t=1;
    // cin >> t;

    while(t--){
        solve();
    }

    cpuTime();
return 0;
}


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

using namespace std;

int h, w;
char mp[100][100];

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

void dfs(int y, int x, char fruit)
{
	if (y < 0 || y >= h || x < 0 || x >= w || mp[y][x] != fruit) return;
	mp[y][x] = ' ';
	for (int i = 0; i < 4; ++i) dfs(y + dy[i], x + dx[i], fruit);
}

int main()
{
	while (cin >> h >> w, h || w) {
		for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) cin >> mp[i][j];

		int cnt = 0;

		for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) {
			if (mp[i][j] != ' ') {
				cnt++;
				dfs(i, j, mp[i][j]);
			}
		}

		printf("%d\n", cnt);
	} 
}

Measured memory_bytes: 1620
N=int(input())
A=sorted(map(int,input().split()),reverse=True)
B=sorted(map(int,input().split()),reverse=True)
C=sorted(map(int,input().split()),reverse=True)

ind0=0
LIST=[0]*N
for i in range(N):
    while ind0<N and B[i]<C[ind0]:
        ind0+=1
    LIST[i]=ind0
    
ind0=0
ALIST=[0]*N
for i in range(N):
    while ind0<N and A[i]<B[ind0]:
        ind0+=1
    ALIST[i]=ind0

from itertools import accumulate
S=[0]+list(accumulate(LIST))

ANS=0
for i in range(N):
    ANS+=S[ALIST[i]]
    
print(ANS)

Measured memory_bytes: 28212
#include<iostream>
using namespace std;
int main(){
  string s;
  int h,w;cin>>h>>w;
  for(int i=1;i<=h;i++){
    for(char c='A';c<'A'+w;c++){
      cin>>s;
      if(s=="snuke")cout<<c<<i<<endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int check, result=0;
    string S, T;
    cin >> S;
    cin >> T;
    for(int i=0; i < S.size()-T.size()+1; i++) {
        check = 0;
        for(int j=0; j < T.size(); j++) {
            if(S[i+j]==T[j]) {
                check++;
            }
        }
        if(result < check) result = check;
    }
    cout << T.size() - result << endl;
}

Measured memory_bytes: 3628
#include<iostream>

#define endl '\n'

using namespace std;

const int MAXN=3e3+3;
long long nums[MAXN],dp[MAXN][MAXN];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    for(int i=1;i<=n;++i){
        cin>>nums[i];
        dp[i][i]=nums[i];
    }
    for(int l=n;l>=1;--l){
        for(int r=l;r<=n;++r){
            dp[l][r]=max(nums[l]-dp[l+1][r],nums[r]-dp[l][r-1]);
        }
    }
    cout<<dp[1][n]<<endl;
return 0;
}

Measured memory_bytes: 70016
#include <bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=(x);i<=(y);++i) 
int a[210];
int main() {
	int n;
	cin>>n;
	rep(i,1,n*2)cin>>a[i];
	sort(a+1,a+n*2+1);
	int ans=0;
	for(int i=1;i<=n*2;i+=2){
		ans+=a[i];
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

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

    string s;cin>>s;
    int n=s.size();

    int res=INF;
    for(int i=0; i<n-2; i++){
        int num=stoll(s.substr(i,3));
        chmin(res,abs(753-num));
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nm = Input.ar;
        var ab = new int[nm[0]][];
        for (var i = 0; i < nm[0]; i++)
            ab[i] = Input.ar;
        ab = ab.OrderBy(v => v[0]).ToArray();
        var ct = 0;
        var res = 0L;
        var index = 0;
        while (ct != nm[1])
        {
            if (ct + ab[index][1] >= nm[1])
            {
                res += (long)ab[index][0] * (nm[1] - ct);
                ct = nm[1];
            }
            else
            {
                ct += ab[index][1];
                res += (long)ab[index][0] * ab[index][1];
            }
            index++;
        }
        WriteLine(res);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 28100