akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int main(){
  rep(i, 7){
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n", abs(a-b));
  }
  return 0;
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
#define pb           push_back
#define pii          pair<int,int>
#define vi           vector<int>
#define vpii         vector<pair<int,int>>
#define gph          map<int, vector<int>>
#define mp           make_pair
#define FOR(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD0(i, n) for (int i = (int)n; i >= 0; i--)
#define FORD1(i, n) for (int i = (int)n; i >= 1; i--)
#define FORS(i, n) for(; i < (int)(n); i++)
#define debug(X) { cout << #X << " = " << (X) << endl; }
#define printArr(A,n) { cout << #A << " = "; FOR(i,n) cout << A[i] << ' '; cout << endl; }
using namespace std;
#define int long long int

vi len((int)3e5);
int n;
bool check(int x){
 //   debug(x);
    map<int, int> s;
    int prev = len[0];
    priority_queue<int> q;
    FOR1(i, n-1){
        if(len[i] <= prev){
            if(x == 1)return false;
            s[len[i]] += 1; 
            q.push(len[i]);
            int j = len[i];
            while(j >= 1 && s[j] == x){
                if(j == 1)return false;
                s[j] = 0;
                j--;
                q.push(j);
                s[j]++;
            }
        }else{
            // do nothing here
            // everything after prev should be 0
            while(!q.empty() && q.top() > prev){
                s[q.top()] = 0;
                q.pop();
            }
        }
        //update prev at the end
        prev = len[i];
    }
    return true;
}
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);

  //  freopen("in16.txt", "r" , stdin);
    cin >> n;
    FOR(i, n)cin >> len[i];
    int s = 1, e= n;
    int ans =n;
    while(s <= e){
        int mid = (s + e) >> 1;
        if(check(mid)){
            e = mid -1;
            ans = mid;
        }else{
            s = mid + 1;
        }
    }
    cout << ans;
}




Measured memory_bytes: 16532
#include <bits/stdc++.h>    
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define int long long
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define fone for(i=0;i<n;i++)
#define endl "\n"
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N          = 5000*100+1;
const ll N2      = 1000*1000+5;
const ld PI  = 3.14159265;
const ll R   = 250;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;} 
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
    }

signed main ()
{
    fastio();
    string s,t;
    cin>>s>>t;
    vector<vector<ll> > dp(4000,vector<ll>(4000,0LL));
   
    for(int i=1;i<=s.length();i++)
    {
        for(int j=1;j<=t.length();j++)
        {
            //cout<<dp[i][j];
            if(s[i-1]==t[j-1])
            {
                dp[i][j]=dp[i-1][j-1]+1;
                //cout<<s[i-1];
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
            //cout<<dp[i][j]<<endl;
        }
    }
    int index=dp[s.length()][t.length()];
    int i = s.length();int j = t.length(); 
    char lcs[index+1];
    lcs[index] = '\0'; 
   while (i > 0 && j > 0) 
   { 
      // If current character in X[] and Y are same, then 
      // current character is part of LCS 
      if (s[i-1] == t[j-1]) 
      { 
          lcs[index-1] = s[i-1]; // Put current character in result 
          i--; j--; index--;     // reduce values of i, j and index 
      } 
  
      // If not same, then find the larger of two and 
      // go in the direction of larger value 
      else if (dp[i-1][j] > dp[i][j-1]) 
         i--; 
      else
         j--; 
   } 
  cout<<lcs;
    
}


Measured memory_bytes: 125568
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
using System.ComponentModel;

class Program
{
    static void Main(string[] args)
    {
        var alice = new Magatro();
        alice.Scan();
        alice.Solve();
    }
}

public class Scanner
{
    private StreamReader Sr;
    private string[] S;
    private int Index;
    private const char Separator = ' ';

    public Scanner() : this(Console.OpenStandardInput())
    {
        Index = 0;
        S = new string[0];
    }
    public Scanner(Stream source)
    {
        Sr = new StreamReader(source);
    }

    private string[] Line()
    {
        return Sr.ReadLine().Split(Separator);
    }

    public string Next()
    {
        string result;
        if (Index >= S.Length)
        {
            S = Line();
            Index = 0;
        }
        result = S[Index];
        Index++;
        return result;
    }
    public T Next<T>()
    {
        var converter = TypeDescriptor.GetConverter(typeof(T));
        return (T)converter.ConvertFromString(Next());

    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public decimal NextDecimal()
    {
        return decimal.Parse(Next());
    }
    public string[] StringArray(int index = 0)
    {
        Next();
        Index = S.Length;
        return S.Skip(index).ToArray();
    }
    public int[] IntArray(int index = 0)
    {
        return StringArray(index).Select(int.Parse).ToArray();
    }
    public long[] LongArray(int index = 0)
    {
        return StringArray(index).Select(long.Parse).ToArray();
    }
    public bool EndOfStream
    {
        get { return Sr.EndOfStream; }
    }
}

public class Magatro
{
    private int W, a, b;
    public void Scan()
    {
        Scanner cin = new Scanner();
        W = cin.NextInt();
        a = cin.NextInt();
        b = cin.NextInt();
    }



    public void Solve()
    {
        if (a + W < b)
        {
            Console.WriteLine(b - a - W);
        }
        else if (b + W < a)
        {
            Console.WriteLine(a - b - W);
        }
        else
        {
            Console.WriteLine(0);
        }
    }

}



Measured memory_bytes: 11092
//成長し続けることが目的
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#define N_MAX 100000
#define L_MAX 50000
using namespace std;
typedef int TL;
typedef int num;
typedef pair<TL,num> I;

int N,L;
int Ice[N_MAX+2+1];
int ct = 0;
priority_queue<I> que;

void solve(){
	for(int i = 1;i <= N;i++){
		if(Ice[i] > Ice[i-1] && Ice[i] > Ice[i+1])
			que.push(make_pair(-1*(L-Ice[i]),i));
	}
	while(!que.empty()){
		I ic = que.top();que.pop();
		ct = -1 * ic.first;
		int n = ic.second;
		Ice[n] = 0;
		if(n + 1 <= N && Ice[n+1] > Ice[n+2])
			que.push(make_pair(-1*(L-Ice[n+1]+ct),n+1));
		if(n - 1 >= 1 && Ice[n-1] > Ice[n-2])
			que.push(make_pair(-1*(L-Ice[n-1]+ct),n-1));
	}
	printf("%d\n",ct);
	return;
}


int main() {
	scanf("%d %d",&N,&L);
	Ice[0] = 0;Ice[N+1] = 0;
	for(int n = 1;n <= N;n++)scanf("%d",&Ice[n]);
	solve();
    
    return 0;
}

Measured memory_bytes: 2036
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <complex>
//定数
#define MOD 1000000007
//マクロ
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

#define vsort(v) sort((v).begin(), (v).end());

typedef unsigned long long int ull;
typedef long long lint;

using namespace std;




int main(){
    int A, B;
    int count=0;
    int tap=0;


    //入力
    cin >> A >> B;

    if(B==1){
        cout << 0 << endl;
        return 0;
    } else {
        count++;
        tap+=A;
    }


    while(tap<B) {
        count++;
        tap += A-1;
    }

    cout << count << endl;
    

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,x;
int a[2521];
int b[2521];

int main(){
  scanf("%d%d",&n,&x);
  REP(i,n)scanf("%d",a+i);
  ll ans = 1e18;
  REP(s,n+1){
    ll tmp = 0;
    REP(i,n)tmp += a[i];
    CHMIN(ans,tmp+(ll)s*x);
    // update
    //
    REP(i,n){
      b[i] = min(a[i],a[(i+n-1)%n]);
    }
    REP(i,n)a[i]=b[i];
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
int main(){
  ll n,i,j;
  cin>>n;
  ll a[n][3];
  for(i=0;i<n;i++){
    cin>>a[i][0]>>a[i][1]>>a[i][2];
  }
  for(i=1;i<n;i++){
    a[i][0]+=max(a[i-1][1],a[i-1][2]);
    a[i][1]+=max(a[i-1][0],a[i-1][2]);
    a[i][2]+=max(a[i-1][0],a[i-1][1]);
  }
  cout<<max(max(a[n-1][0],a[n-1][1]),a[n-1][2])<<endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using  namespace std ;
#define fi first
#define se second
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define ALL(x) (x).begin(),(x).end() 
#define UNQ(x) (x).erase( unique(ALL(x)) , (x).end() ) 
#define lwb( x , y ) lower_bound(ALL(x) , (y) ) - (x).begin() 
#define upb( x , y ) upper_bound(ALL(x) , (y) ) - (x).begin() 
#define sz(x) (int)(x).size() 
#define pb push_back
typedef long long ll ;

const int mod = 1e9 + 7 ;
int n , m , dp[105][5][5] ; 
char s[2][60] ;

int main(){
	// freopen("in.txt" , "r" , stdin);
	// freopen("out.txt" , "w" , stdout) ;
	scanf("%d" ,&n) ;
	for(int i=0;i<2;i++) scanf("%s" , s[i] + 1 ) ;
	dp[0][0][0] = 1 ;
	for(int i=0;i<n;i++){
		for(int j=0;j<4;j++){
			for(int k=0;k<4;k++){
				for(int p1 = 1; p1 <4 ; p1++){
					if(p1 == j && s[0][i+1] != s[0][i]) continue ;
					if(p1 != j && s[0][i+1] == s[0][i]) continue ;
					for(int p2 = 1 ; p2 < 4 ; p2++){
						if(p2 == k && s[1][i+1] != s[1][i]) continue ;
						if(p2 != k && s[1][i+1] == s[1][i]) continue ;
						if(p1 == p2 && s[0][i+1] != s[1][i+1]) continue ;
						if(p1 != p2 && s[0][i+1] == s[1][i+1]) continue ;
						dp[i+1][p1][p2] += dp[i][j][k] ;
						dp[i+1][p1][p2] %=mod ; 
					}
				}
			}
		}
	}
	int res = 0 ;
	for(int i=1;i<4;i++) for(int j=1;j<4;j++)  res = (res + dp[n][i][j])%mod ; 
	printf("%d\n" ,res ) ;
	return  0 ;
}


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

int main() {
  ll n,a,b;
  cin >> n >> a >> b;

  ll ans;
  if ((b-a) % 2 == 0){
    ans = (b-a) / 2;
  } else {
    ll x = (b-a) / 2 + a;
    ll y = (n-(a+(n-b))+1) / 2 + (n-b);
    ans = min(x,y);
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3612
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] array = new int[n];

        for (int i = 0; i < n; i++) {
            array[i] = scan.nextInt();
        }

        Arrays.sort(array);

        int half = array.length / 2;

        if (array[half - 1] == array[half]) {

            System.out.println(0);
            return;
        }

        int ans = 0;
        System.out.println(array[half] - array[half - 1]);

    }
}

Measured memory_bytes: 53060
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
#define lson root<<1
#define rson root<<1|1
#define Mid int mid=(l+r)>>1;
#define FREI freopen("in.txt","r",stdin)
#define FREO freopen("out.txt","w",stdout)
#define Mem(a,b) memset(a,b,sizeof(a))
#define MAXN 400
#define mod 1000000007
#define ll long long
#define eps 1e-6
using namespace std;
int main()
{
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    int x=max(a,c);
    int y=min(b,d);
    x<y?printf("%d\n",y-x):printf("%d\n",0);
    return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> d(K);
  vector<int> A(N, 0);
  rep(i, K) {
    cin >> d[i];
    rep(j, d[i]) {
      int a;
      cin >> a;
      --a;
      A[a]++;
    }
  }
  int ans = 0;
  rep(i, N) {
    if (A[i] == 0) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
import scala.io.StdIn._
import scala.collection._

object Main {

  class Sieve(val n: Int){
    private[this] val top = (n - 3) / 2 + 1
    private[this] val sqrtLimit = (Math.sqrt(n).toInt - 3) / 2

    private[this] val cmpsts = new Array[Int]((top >>> 5) + 1)
    def isPrime(ci: Int): Boolean = (cmpsts(ci >>> 5) & (1 << (ci & 31))) == 0
    def notPrime(ci: Int): Unit = cmpsts(ci >>> 5) |= 1 << (ci & 31)

    def next(i: Int): Int = if((i > top) || isPrime(i)) 2 * i + 3 else next(i + 1)

    def exec: Iterator[Int] = {

      for{
        i <- 0 to sqrtLimit
        if isPrime(i)
        j <- Range(((2 * i + 3)*(2 * i + 3)-3)/2, top, (2 * i + 3))
      } notPrime(j)

      /*
      (0 to sqrtLimit).map{ i =>
        val p = 2 * i + 3
        if(isPrime(i))Range((p*p-3)/2, top, p).map{notPrime}
      }
      */
/*
      (0 to sqrtLimit).withFilter(isPrime).map { i =>
        val p = 2 * i + 3
        Range((p*p-3)/2, top, p).map(notPrime)
      }
*/

      if(n==2)Iterator.single(2)
      else Iterator.single(2) ++ Iterator.iterate(3)(p => next((p - 1) / 2)).takeWhile(_ <= n)
    }
  }

  def loop(s: String){
    if(s != null){
       val Array(n,_*) = s.split(" ").map(_.toInt)
       if(n<2) println(0)
       else println(new Sieve(n).exec.size)
       loop(readLine)
    }
  }

  def main(args: Array[String]): Unit = loop(readLine)
}

Measured memory_bytes: 66216
N,M = map(int,input().split())
info = []
maxa = [0] * (N+1)

for i in range(M):
    a,b = map(int,input().split())
    info.append([a,b])
    if maxa[b] < a:
        maxa[b] = a 

ok = 0
count = 0

for j in range(1,N+1):
    if ok < maxa[j]:
        count += 1
        ok = j-1

print(count)

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

int main(){
    int H,W,h,w;
    cin>>H>>W;
    cin>>h>>w;
    int ans=H*W-(h*W+H*w-h*w);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;

const int mod = 1000000007;
int add(int a, int b) { return (a += b) < mod? a : a - mod; }
int sub(int a, int b) { return (a -= b) >=  0? a : a + mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
void adds(int& a, int b) { a = add(a, b); }
void subs(int& a, int b) { a = sub(a, b); }
void muls(int& a, int b) { a = mul(a, b); }
void maxs(int& a, int b) { a = max(a, b); }
void mins(int& a, int b) { a = min(a, b); }
int pwr(int a, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mul(a, pwr(a, p - 1));
    return pwr(mul(a, a), p / 2);
}
int inv(int a) { return pwr(a, mod - 2); }

int main()
{
    ll n, k;
    cin >> n >> k;
    ll sol = 0;
    for (ll x = k; x <= n + 1; ++x)
    {
        ll lo = (x * (x - 1) / 2);
        ll hi = (n * (n + 1) / 2 - (n - x) * (n - x + 1) / 2);
        sol += (hi - lo + 1) % mod;
        sol %= mod;
    }
    cout << sol;
}


Measured memory_bytes: 3624
#include<iostream>
#include <algorithm>
using namespace std;
int main(){
    long long int N,K,i;
    cin >> N >> K;
  
    long long int A[N + 1];
    long long int P[N + 1];
    A[0] = 1;
    P[0] = 1;
    for(i = 1;i <= N;i++){
        A[i] = 2 * A[i - 1] + 3;
        P[i] = 2 * P[i - 1] + 1;
    }
    long long int count = 0;
    for(i = N; i > 0; i--){
        if(K == 0) break;
        K--;
        if(K <= A[i - 1]) continue;
        K -=A[i - 1] + 1;
        count += P[i - 1] + 1;
    }
    if(K) count++;
    cout << count << "\n";
    return 0;
}

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

int main() {
  int n,ans=0;
  string s;
  cin >> n >> s;
  r(i,n-2){
    if(s.substr(i,3)=="ABC")ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long

using namespace std;
int n,a[100005],dp[100005],k;
int main(){
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++){
        dp[i]=1e9+1e8;
        for(int j=1;j<=k;j++){
            if(i-j<0)break;
            dp[i]=min(dp[i],abs(a[i]-a[i-j])+dp[i-j]);
        }

    }
    cout<<dp[n-1]<<endl;
    return 0;
}



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

using namespace std;

const ll inf=998244353;

inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}
ll a[100005];
ll u[100005];
ll all[100005];
int main()
{
    string str;
    cin >> str;
    int ct=0,ans=0;
    for(int i=0;i<str.size();i++)
    {
        if(str[i]=='R')
            ct++;
        else
        {
            ans=max(ans,ct);
            ct=0;
        }
    }
    cout << max(ans,ct);
    return 0;
}


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

*V, = map(int, input().split())

V.sort(reverse=True)

dp = [0]*N



for i in range(N-1):
    z = (V[len(V)-2]+V[len(V)-1])/2
    dp[i+1] = dp[i] + z
    #print(dp[i],z)
    #print(V)
    V.pop()
    V.pop()
    V.append(z)
    V.sort(reverse=True)


#print(dp[N-1])
print(V[0])


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

int main(){

  int a,b,c;

  cin>>a>>b>>c;

  int yakusu=0;

  for(int i=a; i<=b; i++){

    
    if(c%i == 0) yakusu++;

  }

  cout<<yakusu<<endl;

  return 0;
}
   
 


Measured memory_bytes: 3096
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define DEBUG 0 
#define LIMIT (LONG_MAX / 10)
#define POSITIVE_LAST_D (LONG_MAX % 10)
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;


int main(){
    ll a;
    double b;
    cin>>a>>b;
    ll c=b*100+0.5;
    ll d=(a*c)/100;
    cout<<d<<endl;
    return 0;
}


Measured memory_bytes: 3688
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define HEAP priority_queue
#define heap(T) priority_queue<T,vector<T>,greater<T> > 
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout);
using namespace std;

const int N=300005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
inline void ch(int &x,int y){x=(x+y)%mod;}
const int BufferSize=1<<25;
char buffer[BufferSize],*Bufferhead,*Buffertail;
int Terminal;
inline char Getchar(){
	if(Bufferhead==Buffertail){
		int l=fread(buffer,1,BufferSize,stdin);
		if(!l){Terminal=1;return 0;}
		Buffertail=(Bufferhead=buffer)+l;
	}
	return *Bufferhead++;
}
template<class T> inline bool read(T &x){
	x=0;char c=Getchar(),rev=0;
	while(c<'0'||c>'9'){c=Getchar();rev|=c=='-';if(Terminal)return 0;}
	while(c>='0'&&c<='9') x=x*10+c-'0',c=Getchar();
	x=rev?-x:x;
	return 1;
}
template<class T>inline void print(T x,const char c){
	if(!x){putchar('0');putchar(c);return;}
	if(x<0) putchar('-'),x=-x;
	int m=0,a[10];
	while(x) a[m++]=x%10,x/=10;
	while(m--) putchar(a[m]+'0');
	putchar(c);
}
inline int exp(int x,int y){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}
struct node{int to,next;}p[N<<1];
int n,rta,rtb,tot=1,head[N],edg[N],u[N];
bool ca[N],cb[N],vis[N];

inline int add(int x,int y){
	p[++tot]=(node){y,head[x]};head[x]=tot;
	p[++tot]=(node){x,head[y]};head[y]=tot;
	return tot>>1;
}
inline void dfs(int x){
	for(int i=head[x];i;i=head[x]){
		head[x]=p[head[x]].next;
		if(vis[i>>1]) continue;
		vis[i>>1]=1;u[i>>1]=x;
		dfs(p[i].to);
	}
}

int main(){
#ifdef rqgao2014
	freopen("input.txt","r",stdin);
#endif
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int x;scanf("%d",&x);
		if(~x) ca[x]^=1,add(i,x); else rta=i;
	}
	for(int i=1;i<=n;i++){
		int x;scanf("%d",&x);
		if(~x) cb[x]^=1,add(i+n,x+n); else rtb=i;
	}
	for(int i=1;i<=n;i++){
		if(ca[i]^cb[i]){puts("IMPOSSIBLE");return 0;}
		if(!ca[i]) edg[i]=add(i,i+n);
	}
	add(rta,rtb+n);
	dfs(1);
	puts("POSSIBLE");
	for(int i=1;i<=n;i++)
		if(!edg[i]) print(0,' '); else if(u[edg[i]]<=n) print(1,' '); else print(-1,' ');
	puts("");
	return 0;
}

Measured memory_bytes: 14848
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream &operator << (ostream& out,const pair<S,T>& o){
    out << "(" << o.first << "," << o.second << ")"; return out;
}
/*
 Atcoder 100~200点代
 アな問題が多いので,まとめる
*/
// https://abc042.contest.atcoder.jp/tasks/abc042_a
//void solve(){ ll A,B,C; cin >> A >> B >> C; if(A == 5 && B == 5 && C == 7){ cout << "YES" << endl; return;} if(A == 5 && B == 7 && C == 5){ cout << "YES" << endl; return;} if(A == 7 && B == 5 && C == 5){ cout << "YES" << endl; return;} cout << "NO" << endl; return ; }
// https://abc043.contest.atcoder.jp/tasks/abc043_a
//void solve(){ ll N; cin >> N; cout << N*(N+1)/2 << endl; }
// https://abc044.contest.atcoder.jp/tasks/abc044_a
//void solve(){ll N,K,X,Y;cin>>N>>K>>X>>Y; cout<<X*min(N,K)+Y*max(0LL,N-K)<<endl;}
// https://abc045.contest.atcoder.jp/tasks/abc045_a
//void solve(){ll a,b,h;cin>>a>>b>>h;cout<<(a+b)*h/2<<endl;}
// https://abc046.contest.atcoder.jp/tasks/abc046_a
//void solve(){ ll a,b,c; cin >> a >> b >> c; set<ll> s; s.insert(a); s.insert(b); s.insert(c); cout << s.size() << endl; }
// https://abc047.contest.atcoder.jp/tasks/abc047_a
//void solve(){ll a,b,c;cin>>a>>b>>c;if(a==b+c||b==a+c||c==a+b)cout<<"Yes"<<endl;else cout<<"No"<<endl;}
// https://abc048.contest.atcoder.jp/tasks/abc048_a
//void solve(){string s1,s2,s3;cin>>s1>>s2>>s3;cout<<"A"<<s2[0]<<"C"<<endl;}
// https://abc049.contest.atcoder.jp/tasks/abc049_a
//void solve(){char c;cin>>c;string s="aiueo";if(s.find(c)!=string::npos)cout<<"vowel"<<endl;else cout<<"consonant"<<endl;}
// https://abc050.contest.atcoder.jp/tasks/abc050_a
//void solve(){ll A,B;char op;cin>>A>>op>>B;if(op=='+')cout<<A+B<<endl;else cout<<A-B<<endl;}
// https://abc051.contest.atcoder.jp/tasks/abc051_a
//void solve(){string s;cin>> s;cout<<s.substr(0,5)<<" "<<s.substr(6,7)<<" "<<s.substr(14)<<endl;}
// https://abc052.contest.atcoder.jp/tasks/abc052_a
//void solve(){ll A,B,C,D;cin>>A>>B>>C>>D;cout<<max(A*B,C*D)<<endl;}
// https://abc053.contest.atcoder.jp/tasks/abc053_a
void solve(){ll x;cin>>x;cout<<(x<1200?"ABC":"ARC")<<endl;}
// https://abc054.contest.atcoder.jp/tasks/abc054_a
//void solve(){}

// Main function
int main(void) {cin.tie(0); ios::sync_with_stdio(false); solve(); return 0; }


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

#define dcm(x) cerr << #x << ": " << x << endl;

using namespace std;

typedef long long int lli;
typedef vector<int> vi;

int main() {
    //clock_t start = clock();
    ios::sync_with_stdio(false); cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n; cin >> n;
    int arr[205];
    int sum = 0;
    for (int i=0; i<2*n; ++i) {
        cin >> arr[i];
    }
    sort(arr, arr+2*n);
    for (int i=0; i<2*n; ++i) {
        if (i%2==0) {
            sum += arr[i];
        }
    }
    cout << sum << endl;
    //clock_t stop = clock();
    //cout << (double)(stop-start)/CLOCKS_PER_SEC << " (s)" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
LL lpow(LL a,LL n){LL ans=pow(a,n)*10;if(ans%10<5)return ans/10;return ans/10+1;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}

LL dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
LL co[500][500];
void WF(LL v,LL e,LL* a,LL* b,LL* l){LL i,j,k;FOR(i,1,v+1)FOR(j,1,v+1){if(i==j)co[i][j]=0;else co[i][j]=INF;}FOR(i,0,e)co[a[i]][b[i]]=l[i];FOR(k,1,v+1)FOR(i,1,v+1)FOR(j,1,v+1)co[i][j]=MIN(co[i][j],co[i][k]+co[k][j]);}

int main(){
  LL H,W,i,j,k,nx,ny,m=0,ans=0;
  scanf("%lld%lld",&H,&W);
  char S[H][W+1];
  FOR(i,0,H)scanf("%s",S[i]);
  LL a[10000],b[10000],l[10000];
  FOR(i,0,H)FOR(j,0,W)if(S[i][j]=='.')FOR(k,0,4){
    nx=i+dx[k],ny=j+dy[k];
    if(nx>=0&&nx<H&&ny>=0&&ny<W)if(S[nx][ny]=='.')
    a[m]=nx*W+ny+1,b[m]=i*W+j+1,l[m++]=1,a[m]=i*W+j+1,b[m]=nx*W+ny+1,l[m++]=1;
  }
  WF(H*W,m,a,b,l);
  FOR(i,1,H*W+1)FOR(j,i,H*W+1)if(co[i][j]!=INF)ans=MAX(ans,co[i][j]);

  printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  string S;
  cin >> S;
  ll N = S.size();

  string s1 = S.substr(0, N / 2);
  string s2 = s1;
  reverse(s2.begin(), s2.end());
  string s3 = S.substr((N + 3) / 2 - 1, N / 2);
  string s4 = s3;
  reverse(s4.begin(), s4.end());

  //cerr << s1 << " " << s2 << " " << s3 << " " << s4 << endl;

  cout << ((s1 == s2 && s2 == s3 && s3 == s4) ? "Yes" : "No") << endl;
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

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

#define MAX 1000000020
#define INF 1001001001

int main(int, char**)
{
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  ll ans = 1000;

  ll mini = 0, maxi = 0;


  while (mini < n) {
    while (mini+1 < n && a[mini+1] < a[mini]) mini++;
    maxi = mini;
    while (maxi+1 < n && a[maxi+1] > a[maxi]) maxi++;

    ans = ans / a[mini] * a[maxi] + ans % a[mini];

    mini = maxi+1;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[200];
	bool c=false,f=false;
	cin>>a;
	for(int i=0;i<strlen(a);i++)
	{
		if(a[i]=='C'&&c==false) c=true;
		if(a[i]=='F'&&c==true) {f=true;break;}
	}
	if(f==true)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <math.h>
#include <vector>

using namespace std;
int main(){
    int n;
    while(scanf("%d",&n)!=EOF){
        printf("%d\n",n/3);
    }
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	int x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	vi p(a),q(b),r(c);
	rep(i,a)cin>>p[i];
	rep(i,b)cin>>q[i];
	rep(i,c)cin>>r[i];
	sort(all(p));
	reverse(all(p));
	sort(all(q));
	reverse(all(q));
	sort(all(r));
	reverse(all(r));
	vi d,e;
	for(int i=0;i<x;++i){
		d.PB(p[i]);
	}
	for(int i=0;i<y;++i){
		d.PB(q[i]);
	}
    int m=r.size();
	for(int i=0;i<min(x+y,m);++i){
		e.PB(r[i]);
	}
	if(e.size()<x+y){
		while(e.size()<x+y){
			e.PB(0);
		}
	}
	sort(all(d));
	ll ans=0;
	rep(i,x+y){
		ans+=max((ll)e[i],(ll)d[i]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
unsigned long long int ull;
vector<int>adj[200105];
int visited[200105];
//int b[1000000];
//ll cnt,n,d;
#define mod 1000000007

void solve()
{
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++)
  {
      if(s[i]=='7')
      {
          cout<<"Yes";
          return;
      }
  }
  cout<<"No\n";
}
int main()
{
//int t;cin>>t;while(t--)
  solve();
  return 0;
}

Measured memory_bytes: 8324
object Main extends App {
  import scala.io.StdIn._


  val prime = primes(math.sqrt(100000).toInt)
  val n = readInt
  val numbers = readLine.trim.split(' ').map(_.toInt)
  val sorted = numbers.zipWithIndex.sortBy(_._1).map(_._2)
  val primeUnions = Array.tabulate(100001){_ ⇒ new UnionFind}
  val numberUnions = Array.tabulate(n){_ ⇒ new UnionFind}
  for (p ← prime){
    for (i ← numbers.indices if numbers(i) % p == 0){
      primeUnions(p).merge(numberUnions(i))
      while(numbers(i) % p == 0){
        numbers(i) /= p
      }
    }
  }
  for (i ← numbers.indices if numbers(i) != 1) {
    numberUnions(i).merge(primeUnions(numbers(i)))
  }
  println(
    if (sorted.indices.forall(i ⇒ numberUnions(sorted(i)).isSameUnion(numberUnions(i)))) 1 else 0
  )
  class UnionFind{
    private var mParent = this
    private var mSize: Int = 1
    private def parent: UnionFind = {
      if (mParent == this) this
      else {
        mParent = mParent.parent
        mParent
      }
    }
    def isSameUnion(that: UnionFind): Boolean = {
      parent == that.parent
    }
    def merge(that: UnionFind): Unit = {
      if (!isSameUnion(that)){
        val thisP = parent
        val thatP = that.parent
        if (thisP.mSize > thatP.mSize) {
          thisP.mSize += thatP.mSize
          thatP.mParent = thisP
        }else {
          thatP.mSize += thisP.mSize
          thisP.mParent = thatP
        }
      }
    }
  }
  def primes(upper: Int): Array[Int] = {
    val memo = Array.tabulate(upper + 1){_ ⇒ true}
    for (i ← 2 to math.sqrt(upper).toInt if memo(i)){
      for (j ← 2 * i to upper by i){
        memo(j) = false
      }
    }
    (2 to upper).filter(memo).toArray
  }
  implicit class Scope[T](val value: T) extends AnyVal {
    @inline
    def also(@inline func: T ⇒ Unit): T = {
      func(value)
      value
    }
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
  }
}



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

int main(){
    while(1){
        string s;
        cin >> s;
        if(s=="0")break;
        int sum=0;
        rep(i,s.length())sum+=(s[i]-'0');
        cout<<sum<<endl;
    }
    return 0;
}


Measured memory_bytes: 3176
#include <cstdio>
#include <iostream>
#include <set>
using namespace std;
int main(void){
  string aisiri="";
  set<string> tested;
  for(char i='a';;){
    string s;
    
    s+=aisiri;
    if(tested.find(s+i)!=tested.end()){
    	for(char j='a';j<='z';++j){
    		if(tested.find(s+j+i)==tested.end()){s=s+j+i;break;}
    	}
    }else s+=i;
    tested.insert(s);
    printf("?%s\n",s.c_str());
    fflush(stdout);
    
    char str[3];
    scanf("%s", str);
    string aistr(str);
    if(aistr[0]!=s[s.size()-1]||tested.find(aistr)!=tested.end()){puts("!OUT");break;}
    tested.insert(aistr);
    aisiri="";aisiri+=aistr[aistr.size()-1];
  }
  return 0;
}

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

int Search(int *a,int b,int c){
  int l,r,m;

  l=0;
  r=c;

  while(l<r){
    
    m=(l+r)/2;
    
    if(a[m]==b){
      
      return 1;
    }
    
    else if(a[m]<b){
      
      l=m+1;
      
    }else
      
      r=m;
    
  }
  return 0;
}


int main(){
  int *a,*b,c,d,i,e=0,f;

  scanf("%d",&c);

  a=(int *)malloc(c*sizeof(int));
  
  for(i=0;i<c;i++){
    scanf("%d",&a[i]);
  }

  scanf("%d",&d);
  
 b=(int *)malloc(d*sizeof(int));
  
  for(i=0;i<d;i++){
    scanf("%d",&b[i]);
  }
  
  for(i=0;i<d;i++){
    
    f=Search(a,b[i], c);
    
  if(f==1)
    
    e++;
  }
  
  printf("%d\n",e);
  
  free(a);

  return 0;
}



Measured memory_bytes: 2108
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace ABC103C
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

            return;
        }

        public void Solve(ConsoleInput cin)
        {

            var N = cin.ReadInt;
            var a = cin.ReadIntArray(N);

            Console.WriteLine(a.Sum() - N);

        }
    }

    public static class Extensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 13456
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
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;}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;
    cin >> S;
    
    ll sum = 0;
    ll num = 0;
    
    rep(i, S.size()){
        if(S[i] == 'W'){
            sum += i;
            num ++;
        }
    }
    
    rep(i, num) sum -= i;
    
    cout << sum << endl;
    
    
    
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 720
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define sqr(x) (x) * (x)

using namespace std;
using namespace __gnu_pbds;

mt19937_64 gen(time(0));

typedef tree<
pair <int, int>,
null_type,
less<pair <int, int>>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

//const int mod = 1e9 + 7;
//const int inf = 2e9 + 6555;
//const int maxn = 1e5 + 55;

int st[10];

signed main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif
    st[0] = 1;
    for(int i = 1; i < 10; ++i)
        st[i] = st[i - 1] * 2;
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    bool f = false;
    for(int i = 0; i <= k; ++i)
        for(int j = 0; j + i <= k; ++j)
            for(int x = 0; x + j + i <= k; ++x)
            {
                if (st[x] * c > st[j] * b && st[j] * b > st[i] * a) f = true;
            }
    if (f) cout << "Yes";
        else cout << "No";
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;

int main(void){
  int i,k[2]={};
  string s;
  
  cin >> s;
  
  for (i=0;i<3;i++) k[s[i]-'A']++;
  
  if (k[0]==0 || k[1]==0) cout << "No" << endl;
  else cout << "Yes" << endl;
  
  return 0;
}

Measured memory_bytes: 256
a = input().split()
W, H, x, y, r = int(a[0]), int(a[1]), int(a[2]), int(a[3]), int(a[4])

if x - r >= 0 and y - r >= 0 and x + r <= W and y + r <= H:
    print("Yes")

else:
    print("No")


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pf push_front
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;

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

int main(){
	//input
	ll N; cin>>N;

    cout<<(N%2==0?(N/2)*(N-2):(N-1)*(N-1)/2)<<endl;
    set<P> se;
    if(N%2==1){
        rep1(i,N-1){
            rep1(j,N){
                if(!(j==i) && !(j==N) && !(j==N-i)){
                    ll A=i,B=j;
                    if(B<A) swap(A,B);
                    se.insert(mp(A,B));
                }
            }
        }
        rep1(i,N-1){
            se.insert(mp(i,N));
        }
    }
    else{
        rep1(i,N){
            rep1(j,N){
                if(!(j==i) && !(j==N+1-i)){
                    ll A=i,B=j;
                    if(B<A) swap(A,B);
                    se.insert(mp(A,B));
                }
            }
        }
    }
    for(auto x:se){
        cout<<x.a<<" "<<x.b<<endl;
    }
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll      long long
#define pii     pair<int, int>
#define f       first
#define s       second
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d ", a)
#define pfl(a) printf("%lld\n", a)
#define Case(a) printf("Case %d: ", a)

using namespace std;
int main()
{
//    int t;
//    cin>>t;
//
//    for(int tc = 1;tc<=t; tc++){
//
//    }
    string s;
    cin>>s;

    if(s[2]==s[3] && s[4]==s[5]){
        cout<<"Yes";
    }
    else
        cout<<"No";
}



Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
 
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
typedef long long ll; 
int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    ll x,y,z;
    x=abs(a-b);
    y=abs(b-c);
    z=abs(c-a);
    if(a==b &&b ==c && a%2==0 ){
        cout<<-1<<endl;
    }
    else if(a==b &&b ==c && a%2==1 ) cout<<0<<endl;
    else {
        ll cnt=0;
        while(1){
            if(x%2==0 && y%2==0 && z%2==0) {
               x/=2,y/=2,z/=2;
                cnt++;
            }
            else break;
        }
        cout<<cnt<<endl;  
    }
    
    return 0;
}

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

const int N=15;

int n,mn,k;

int a[N],d,bin[N],ban[N];

inline int solve(int step=d,int flag=0){
  if(flag){
    int ret=0;
    for(int i=1;i<=step;i++)ret+=bin[i]*mn;
    return ret;
  }
  if(!step)return 0;
  for(int i=flag?0:a[step];i<10;i++)if(!ban[i]){
    int tmp=0;
    if(~(tmp=solve(step-1,flag||i>a[step])))
      return tmp+bin[step]*i;
  }
  return -1;
}

int main(){
  scanf("%d%d",&n,&k);
  bin[1]=1;for(int i=2;i<=6;i++)bin[i]=bin[i-1]*10;
  while(k--){
    int x;
    scanf("%d",&x);ban[x]=1;
  }
  while(ban[mn])mn++;
  while(n)a[++d]=n%10,n/=10;
  int ans=solve();
  if(!~ans){
    int x=mn;
    while(!x||ban[x])x++;
    ans=bin[d+1]*x;
    for(int i=1;i<=d;i++)ans+=bin[i]*mn;
  }
  printf("%d\n",ans);
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll k, s;
  cin >> k >> s;

  ll ans = 0;
  for (ll x = 0; x <= k; ++x) {
    for (ll y = 0; y <= k; ++y) {
      if (x+y > s) continue;
      if (s-(x+y) > k) continue;
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256