akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String S = sc.next();
		char[] c = S.toCharArray();
		int c0 = Integer.valueOf(c[0] - '0');
		int c1 = Integer.valueOf(c[1] - '0');
		int c2 = Integer.valueOf(c[2] - '0');
		int c3 = Integer.valueOf(c[3] - '0');
		int S1 = c0 * 10 + c1;
		int S2 = c2 * 10 + c3;

		if (!(S1 - 12 > 0 || S1 == 0)) {
			if (!(S2 - 12 > 0 || S2 == 0))
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if (!(S2 - 12 > 0 || S2 == 0))
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}

	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 21076
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())

def reydeoro(n):
    return n*(n+1)//2
ans = 0
for i in range(1,n+1):
    res = n//i
    ans += i*reydeoro(res)

print(ans)


Measured memory_bytes: 63604
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N = sc.nextInt();
		int[] v = new int[N];
		for (int i = 0; i < N; ++i) {
			v[i] = sc.nextInt();
		}
		long[][] dp = new long[N - 1][21];
		dp[0][v[0]] = 1;
		for (int i = 1; i < N - 1; ++i) {
			for (int j = 0; j <= 20; ++j) {
				if (j + v[i] <= 20) {
					dp[i][j + v[i]] += dp[i-1][j];
				}
				if (j - v[i] >= 0) {
					dp[i][j - v[i]] += dp[i-1][j];
				}
			}
		}
		System.out.println(dp[N - 2][v[N - 1]]);
	}

}

Measured memory_bytes: 12000
#import re
import sys
input = sys.stdin.readline
#import heapq
#import bisect
#from collections import deque
import math

def main():
    a, b, h, m = map(int, input().split())
    degh = (h*60 + m)/720. * 360
    degm = m/60. * 360
    cos = math.cos(math.radians(abs(degh - degm)))
    anssqure = a**2 + b**2 - 2*a*b*cos
    print(anssqure**0.5)
    


    
if __name__ == '__main__':
    main()


Measured memory_bytes: 62584
#include<iostream>
#include<algorithm>
#include<deque>
#include<vector>
#include<map>
using namespace std;

int main(){
  int T;
  deque<int> R,B,G;
  int inx[10];
  char iny;
  map<int,int> Ri,Bi,Gi;



  cin >> T;
  while(T-- > 0){
    R.clear();B.clear();G.clear();
    Ri.clear();Bi.clear();Gi.clear();
    for(int i=0;i<9;i++){
      cin >> inx[i];
    }
    for(int j=0;j<9;j++){
      cin >> iny;
      if(iny == 'R'){
	R.push_back(inx[j]);
	Ri[inx[j]]++;
      }
      else if(iny == 'B'){
	B.push_back(inx[j]);
	Bi[inx[j]]++;
      }
      else if(iny == 'G'){
	G.push_back(inx[j]);
	Gi[inx[j]]++;
      }
    }

    sort(R.begin(),R.end());
    sort(B.begin(),B.end());
    sort(G.begin(),G.end());

    int tp;
    for(int i=0;i<3;i++){
      if(R.size() < 3)break;
      tp = R.front();
      if((Ri[tp+1]>0 && Ri[tp+2]>0)){
	R.pop_front();
	deque<int>::iterator Rit = R.begin();
	while(Rit != R.end()){
	  if(tp+1 == (*Rit)){
	    R.erase(Rit);
	    break;
	  }
	  Rit++;
	}
	Rit = R.begin();
	while(Rit != R.end()){
	  if(tp+2 == (*Rit)){
	    R.erase(Rit);
	    break;
	  }
	  Rit++;
	}
	Ri.clear();
	for(int i=0;i<R.size();i++){
	  Ri[R[i]]++;
	}
      }
      else if(Ri[tp] >= 3){
	R.pop_front();R.pop_front();R.pop_front();
	for(int i=0;i<R.size();i++){
	  Ri[R[i]]++;
	}
      }

    }


 for(int i=0;i<3;i++){
   if(B.size() < 3)break;
      tp = B.front();
      if((Bi[tp+1]>0 && Bi[tp+2]>0)){
	B.pop_front();
	deque<int>::iterator Bit = B.begin();
	while(Bit != B.end()){
	  if(tp+1 == (*Bit)){
	    B.erase(Bit);
	    break;
	  }
	  Bit++;
	}
	Bit = B.begin();
	while(Bit != B.end()){
	  if(tp+2 == (*Bit)){
	    B.erase(Bit);
	    break;
	  }
	  Bit++;
	}
	Bi.clear();
	for(int i=0;i<B.size();i++){
	  Bi[B[i]]++;
	}
      }
      else if(Bi[tp] >= 3){
	B.pop_front();B.pop_front();B.pop_front();
	for(int i=0;i<B.size();i++){
	  Bi[B[i]]++;
	}
      }
    }

 for(int i=0;i<3;i++){
   if(G.size() < 3)break;
      tp = G.front();
      if((Gi[tp+1]>0 && Gi[tp+2]>0)){
	G.pop_front();
	deque<int>::iterator Git = G.begin();
	while(Git != G.end()){
	  if(tp+1 == (*Git)){
	    G.erase(Git);
	    break;
	  }
	  Git++;
	}
	Git = G.begin();
	while(Git != G.end()){
	  if(tp+2 == (*Git)){
	    G.erase(Git);
	    break;
	  }
	  Git++;
	}
	Gi.clear();
	for(int i=0;i<G.size();i++){
	  Gi[G[i]]++;
	}
      }
      else if(Gi[tp] >= 3){
	G.pop_front();G.pop_front();G.pop_front();
	for(int i=0;i<G.size();i++){
	  Gi[G[i]]++;
	}
      }

    }



 if(R.empty() && G.empty() && B.empty() )cout << "1" << endl;
 else cout << "0" << endl;




  }
  return 0;
}

Measured memory_bytes: 1224
n = gets.chomp.to_i

results = {
  AC: 0,
  WA: 0,
  TLE: 0,
  RE: 0,
}

n.times do
  c = gets.chomp.to_sym
  results[c] += 1
end

results.each do |k, v|
  puts "#{k} x #{v}"
end

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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
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 (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll N,T;
cin>>N>>T;
vector<ll> t(N+1,0);
ll ans=0;
reps(i,N+1,1){
    cin>>t[i];
    ans+=min(t[i]-t[i-1],T);
}
cout<<ans+T<<endl;

return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.Remoting.Contexts;

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;

        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }

            var res = line[index];
            index++;
            return res;
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }

        public int[] IntArray()
        {
            var array = Array();
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }

        public long[] LongArray()
        {
            var array = Array();
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }

        public uint NextUint()
        {
            return uint.Parse(Next());
        }
    }

    class Program
    {
        private int A, B;
        private void Scan()
        {
            var sc = new Scanner();
            A = sc.NextInt();
            B = sc.NextInt();
        }


        public void Solve()
        {
            Scan();
            if (A <= 8 && B <= 8)
            {
                Console.WriteLine("Yay!");
            }
            else
            {
                Console.WriteLine(":(");
            }
        }

        static void Main() => new Program().Solve();
    }

}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define MAX 100
using namespace std;
vector<int>adjlist[MAX+5];
int visited[MAX+5];
int dist[MAX+5];
int main()
{
    int n,x,u,k,y,g;
    cin>>n;
    memset(dist,-1,sizeof(dist));
    for(int i=1; i<=n; i++)
    {
        cin>>u>>k;
        for(int j=0; j<k; j++)
        {
            cin>>x;
            adjlist[u].push_back(x);
        }
    }
    queue<int>q;
        int i=1;
        dist[i]=0;
        if(visited[i]==0 && adjlist[i].size()!=0)
        {
            //cout<<i<<endl;
            q.push(i);
            visited[i]=1;
            while(!q.empty())
            {
                x=q.front();
                q.pop();
                for(int j=0; j<adjlist[x].size(); j++)
                {
                    g=adjlist[x][j];
                    if(visited[g]==0)
                    {
                        visited[g]=1;
                        dist[g]=dist[x]+1;
                        q.push(g);
                    }

                }
            }
        }

    for(int i=1; i<=n; i++)
    {
        cout<<i<<" "<<dist[i]<<endl;
    }

    return 0;

}



Measured memory_bytes: 3172
import sys

def bigsmall(x,y):
    return (x,y) if x>y else (y,x)

def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()

    if len(a) == 2:
        b,s = bigsmall(a[0],a[1])
        print(b-s)
        print(b,s)
        sys.exit()

    ops = []
    curr = 0
    b,s = bigsmall(a[0],a[-1])
    if a[1] <= 0:
        ops.append((b,s))
        curr = b - s
    else:
        ops.append((s,b))
        curr = s - b

    del a[-1]
    a.append(-1) # to set answer > 0

    for i in range(1, len(a)-1):
        b,s = bigsmall(curr,a[i])

        if a[i+1] <= 0:
            ops.append((b,s))
            curr = b - s
        else:
            ops.append((s,b))
            curr = s - b

    print(curr)
    for x,y in ops:
        print(x,y)

if __name__=='__main__':
    main()

Measured memory_bytes: 19440
from math import *
a, b, h, m = map(int, input().split())
h = 30 * h + m / 2
m *= 6
d = (a * sin(radians(h))) - (b * sin(radians(m)))
e = (a * cos(radians(h))) - (b * cos(radians(m)))
print((d * d + e * e)**0.5)

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int A, B; cin >> A >> B;
    cout << (1^2^3^A^B);
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include<math.h>
#include<bitset>
#include<iomanip>
using namespace std;

int main() {
	long long x; cin >> x;
	cout << (x*2+9) / 11 ;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll; 
#define pb push_back
#define mp make_pair
#define mod 998244353
#define vi vector <ll>
using namespace std ; 
ll power(ll x,ll y,ll m)
{            //power(x,y)=x^y  %m;
	ll res=1%m;
	while(y)
	{
	    if(y&1)
	    res=(res*x)%m;
	    x=(x*x)%m;
	    y=(y>>1)%m;
	}
	return res;
}
ll mod_inverse(ll x,ll m)
{
	return power(x,m-2,m);
}
//ll least_prime[10000005]; 

int main ()
{
    ios_base :: sync_with_stdio ( false );
    cin.tie( NULL );
    cout.tie( NULL );
ll t = 1 ;
//cin>>t;
while ( t--)  
{
  ll n,m,k;
  cin>>n>>m>>k;
  ll a[n];
  ll b[m];
  for(ll i=0;i<n;i++)
  cin>>a[i];
  for(ll i=0;i<m;i++)
  cin>>b[i];
  ll pre[n];
  ll pre1[m];
  pre[0]=a[0];
  pre1[0]=b[0];
  for(ll i=1;i<n;i++)
  {
  	pre[i]=pre[i-1]+a[i];
  }
   for(ll i=1;i<m;i++)
  {
  	pre1[i]=pre1[i-1]+b[i];
  }
  ll cnt=0;
  for(ll i=0;i<n;i++)
  {
  	if(k-pre[i]>=0)
  	{
  		ll tt;
  		tt=upper_bound(pre1,pre1+m,k-pre[i])-pre1;
  	
  	tt--;
  		cnt=max(cnt,i+1+tt+1);
	  }
	  else
	  {
	  		ll tt;
  		tt=upper_bound(pre1,pre1+m,k)-pre1;
  	
  	tt--;
  		cnt=max(cnt,tt+1);
	  }
  }
  for(ll i=0;i<m;i++)
  {
  	if(k-pre1[i]>=0)
  	{
  		ll tt;
  		tt=upper_bound(pre,pre+n,k-pre1[i])-pre;
  	
  	tt--;
  		cnt=max(cnt,i+1+tt+1);
	  }
	  else
	  {
	  		ll tt;
  		tt=upper_bound(pre,pre+n,k)-pre;
  	
  	tt--;
  		cnt=max(cnt,tt+1);
	  }
  }
  
 cout<<cnt<<"\n";
}

 return 0;
}


Measured memory_bytes: 9844
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<long> v;
    for(int i = 0; i < n; i++){
        long a;
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(), v.end());
    int ans = 0;
    for(int i = 0; i < v.size(); i++){
        long value = v[i];
        int pos = i;
        int count = 1;
        while(true){
            pos++;
            if(v[pos] == value){
                count++;
            } else {
                if(count > value){
                    ans += count - value;
                } else if(count < value){
                    ans += count;
                } else {
                }
                i = pos - 1;;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define ll                long long int
#define ld                long double
#define pb                push_back
#define pf                push_front
#define ppb               pop_back
#define ppf               pop_front
#define sz                size()
#define pi                acos(-1.0)
#define mod               1000000007
#define F                 first
#define S                 second
#define C                 continue
#define G                 goto done
#define maxe              max_element
#define mine              min_element
#define min3(a,b,c)       min(a,min(b,c))
#define max3(a,b,c)       max(a,max(b,c))
#define min4(a,b,c,d)     min(a,min(b,min(c,d)))
#define max4(a,b,c,d)     max(a,max(b,max(c,d)))
#define mem(a,b)          memset(a,b,sizeof(a))
#define all(a)            (a).begin(),(a).end()
#define gcd(a,b)          __gcd(a,b)
#define lcm(a,b)          ((a)*((b)/gcd(a,b)))
#define case(a)           cout<<"Case "<<(a)<<": "
#define point(a)          fixed<<setprecision(a)
#define get(a)            for(auto &x:a) cin>>x
#define print(a)          for(auto x:a) cout<<x<<" "; cout<<endl
#define see(x)            cout<<#x<<" = "<<x<<endl
#define uniq(a)           sort(all(a)); (a).erase(unique((a).begin(),(a).end()),(a).end())
#define big(a)            transform((a).begin(),(a).end(),(a).begin(),::toupper)
#define small(a)          transform((a).begin(),(a).end(),(a).begin(),::tolower)
#define ischar(a)         (('a'<=a&&a<='z')('A'<=a&&a<='Z'))
#define isvowel(a)        (a=='a'||a=='e'||a=='i'||a=='o'||a=='u'||a=='A'||a=='E'||a=='I'||a=='O'||a=='U')
#define fast              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define tc                int test; cin>>test; while(test--)
using namespace std;
int main()
{
    ll n; cin>>n; ll a[n]; get(a);
    sort(a,a+n);
    ld s=((ld)(a[0]+a[1]))/(ld)2;
    for(ll i=2;i<n;i++)
    {
        s=(s+a[i])/(ld)2;
    }
    cout<<point(6)<<s;
}




















Measured memory_bytes: 3760
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<math.h>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod = 1e9 + 7;
typedef long long ll;

int main(){
  string s;
  cin >> s;
  int n = s.size();
  int ans = 999;
  rep(i, n-2){
    int num = (s[i] - '0') * 100 + (s[i+1] - '0') * 10 + s[i+2] - '0';
    ans = min(ans, abs(num - 753));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
                       ///****   Hasebul Hassan Chowdhury ***////
#define ms(a,v)        memset(a,v,sizeof a)
#define lll            long long
#define FOR(i,a,b)     for(int i=a;i<=b;i++)
#define fast           ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Read           freopen("input.txt", "r", stdin)
#define Write          freopen("output.txt", "w", stdout)
#define INF            1e18


void solve()
{
   long long a,b,c,d;
   cin>>a>>b>>c>>d;
   long long ans=0;
   if(d<=a) { ans+=d; d=0; }
   else { ans+=a; d-=a; }
   if(d==0) { cout<<ans<<endl; return; }
   if(d<=b) { d=0; }
   else { d-=b; }
   if(d==0) { cout<<ans<<endl; return; }
   if(d<=c) { ans-=d; d=0; }
   else { ans-=c; d-=a; }
   if(d==0) { cout<<ans<<endl; return; }
   cout<<ans<<endl;

}

int main()
{
    fast
    #ifndef ONLINE_JUDGE
    //Read;
    //Write;
    #endif
    //sieve();
    //int cnt=1;
    //int t; cin>>t; while(t--) solve();
    solve();
}


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

count = 0
while True:
    sum = 0
    for i in range(N):
        if A[i] % 2 == 0:
            sum += 1
    if sum != N:
        print(count)
        break
    else:
        A = list(map(lambda x:x/2, A))
        count=count+1

Measured memory_bytes: 3060
n, y = map(int,input().split())
a, b, c = -1, -1, -1
i = 0
while 10000 * i <= y:
    j = 0
    s = y - 10000 * i
    if 5000 * (n-i) >= s:
        while 5000 * j <= s:
            r = y - 10000 * i - 5000 * j
            if r % 1000 == 0 and r // 1000 == n - i - j:
                a, b, c = i, j, n - i - j
                break
            j += 1
    if a != -1:
        break
    i += 1

print(a, b, c)


Measured memory_bytes: 3060
n=int(input())
s=input()

r_cnt=s.count('R')
g_cnt=s.count('G')
b_cnt=s.count('B')

ans=r_cnt*g_cnt*b_cnt

for i in range(n):
    for d in range(n):
        j=i+d
        k=j+d
        if k>=n:break
        if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
            ans-=1
            
print(ans)

Measured memory_bytes: 9208
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<numeric>
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 namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main()
{
    int n;
    cin >> n;
    int a[n];
    int cnt = 0; int loc = 1;
    for (int i=0; i<n; ++i)
    {
        int val;
        cin >> val;
        if(loc==val)
        {
            ++loc;
        
        }
        else
        {
            ++cnt;
        }
        a[i] = val;
        // cin >> a[i];
    }

    if(cnt == n) cout << -1 << endl;
    else cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
using namespace std;

int32_t main()
{ int n;
cin >> n;
string s;
cin >> s;
int cnt=0;
for(int i=0; i<n; i++)
{ if(s[i]=='R')
{
    cnt++;
}


}
int ans=0;
for(int i=0; i<cnt;i++)
{ if(s[i]=='W')
{
    ans++;
}


}
cout << ans << endl;



}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll, ll> pii;
 
#define REP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define PER(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)
 
void ii(ll &x){ cin >> x; }
void is(string &x){ cin >> x; }
void oi(ll x){ cout << x << " "; }
void os(string x){ cout << x; }
void oie(ll x){ cout << x << endl; }
void ose(string x){ cout << x << endl; }
void oe(){ cout << endl; }

ll INF = 1e9+7;

int main(){
    ll N, M, K;
    cin >> N >> M >> K;
    vector<vector<ll>> relations(N);
    vector<ll> root(N,-1);
    map<ll, ll> count;
    REP(i,0,M){
        ll a,b;
        ii(a), ii(b);
        a--;b--;
        relations[a].push_back(b);
        relations[b].push_back(a);
    }
    vector<vector<ll>> tree(relations.begin(), relations.end());
    REP(i,0,K){
        ll c,d;
        ii(c), ii(d);
        c--;d--;
        relations[c].push_back(d);
        relations[d].push_back(c);
    }
    REP(i,0,N){
        queue<ll> q;
        ll r = i;
        q.push(i);
        while (!q.empty())
        {
            ll c = q.front(); q.pop();
            if(root[c]!=-1) continue;
            root[c]=r;
            count[r]++;
            for(ll x : tree[c]){
                q.push(x);
            }
        }
    }

    REP(i,0,N){
        ll g=root[i];
        ll ans=count[g]-1;
        for(ll x : relations[i]){
            if(root[x]==g){
                ans--;
            }
        }
        oi(ans); os(" ");
    }
    oe();
    return 0;
}

Measured memory_bytes: 19000
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
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; }
ll n;
vector<string> ans;
void dfs(int k,vector<int> zoku,int maxa){
    if(k==n){
        string res="";
        char base='a';
        map<int,char> m;
        vector<bool> used(n,false);
        for(int i=0;i<n;i++){
            if(!used[zoku[i]]){
            m[zoku[i]]=base;
            base++;
            used[zoku[i]]=true;
            }
        }
        for(int i=0;i<n;i++){
            res+=m[zoku[i]];
        }
        ans.push_back(res);
        return ;
    }
    for(int i=0;i<=maxa+1;i++){
        vector<int> temp=zoku;
        temp.push_back(i);
        dfs(k+1,temp,max(maxa,i));
    }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    vector<int> zoku;
    dfs(0,zoku,0);
    sort(ALL(ans));
    ans.erase(unique(ans.begin(), ans.end()),ans.end());
    rep(i,ans.size())
    cout <<ans[i] << "\n";
}


Measured memory_bytes: 49512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long  n;
    cin>>n;
    long long a[n],i,k=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    long long p=a[0];
    for(i=0;i<n;i++)
    {
        if(a[i]<=p)
        {
            k++;
        p=a[i];
        }
    }
    cout<<k<<endl;

    return 0;
}


Measured memory_bytes: 5180
#N,X= map(int,input().split())

N = int(input())
p_list = list(map(int,input().split()))
cnt = 0
for i in range(1,N-1):
    p = p_list[i-1:i+2]
    p_s =p_list[i-1:i+2]
    p_s.sort()
    if p[1] == p_s[1]:
        cnt += 1
print(cnt)
#print(ans)    




Measured memory_bytes: 38384
#include <iostream>
#include <map>

int main() {
    int N;
    std::cin >> N;
    std::cin.ignore();
    int n = N;
    std::map<uint32_t,int> vals;
    while(n-->0){
        uint32_t v;
        std::cin >> v;
        auto it = vals.find(v);
        if(it == vals.end()) {
            if(vals.size() ==3) {
                std::cout << "No" << std::flush;
                return 0;
            }
            vals[v] = 1;
        } else {
            ++it->second;
        }
    }
    if(vals.size() == 1 && vals.begin()->first == 0) {
         std::cout << "Yes" << std::flush;
    } else if (vals.size() == 2)  {
       auto it = vals.begin();
       if(it->first != 0 || it->second !=N/3 || (++it)->second != 2*N/3) {
            std::cout << "No" << std::flush;
       } else {
           std::cout << "Yes" << std::flush;
       }
        
    } else if(vals.size() == 3) {
       auto third = vals.begin();
       auto first = third++;
       auto second = third++;
        
       if( ((first->first^second->first^third->first)!=0) || first->second !=  second->second || first->second !=  third->second) {
            std::cout << "No" << std::flush;
       } else {
           std::cout << "Yes" << std::flush;
       }
    } else {
        std::cout << "No" << std::flush;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
//#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define MAX 200009
//#define int long long
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht;
void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
bool chk(ht& st, int fac, int num){
	/*dbg(st);
	dbg(fac, num);*/
	if(fac == num) return (st[fac] > 1);
	else{
		return (st[fac] > 0? true : false);
	}

}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T=1;
	//cin >> T;
	FOR1(tp, T)
	{
		//cout << "Case #" << tp << ": ";
		int n; cin >> n;
		ht st;
		vector<int> v;
		FOR1(i, n){
			int x;
			cin >> x;
			v.pb(x);
			st[x] += 1;
		}
		int cnt = 0;
		for(int num : v){
			//cout << num << ":";
			bool f = false;
			for(int i = 1; i*i <= num; i++){
				if(num % i == 0){
					//cout << i << " " << num/i << " ";
					if(chk(st, i, num)){
						f = true;
						break;
					}
					if(i*i != num){
						if(chk(st, num/i, num)){
							f = true;
							break;
						}
					}
				}
			}
			//cout << '\n';
			if(f == false) {
				//cout << num << " ";
				cnt++;
			}
		}
		cout << cnt;
		cout<<'\n';
	}
	return 0;
}


Measured memory_bytes: 44932
#include <iostream>
#include <string>
#include <cctype>
using namespace std;

typedef string::const_iterator State;

int expression(State&);
int term(State&);
int number(State&);
int factor(State&);

int expression(State &begin){
	int ret = term(begin);
	for(;;){
		if(*begin == '+'){
			++begin;
			ret += term(begin);
		}
		else if(*begin == '-'){
			++begin;
			ret -= term(begin);
		}
		else break;
	}
	return ret;
}

int term(State &begin){
	int ret = factor(begin);
	for(;;){
		if(*begin == '*'){
			++begin;
			ret *= factor(begin);
		}
		else if(*begin == '/'){
			++begin;
			ret /= factor(begin);
		}
		else {
			break;
		}
	}
	return ret;
}

int factor(State &begin){
	int ret;
	if(*begin == '('){
		++begin;
		ret = expression(begin);
		++begin;
	}
	else{
		ret = number(begin);
	}
	return ret;
}

int number(State &begin){
	int ret = 0;
	while(isdigit(*begin)){
		ret *= 10;
		ret += *begin - '0';
		++begin;
	}
	return ret;
}


int main(){
	int n;
	string q;
	cin >> n;
	cin.ignore();
	for(int i(0);i < n;++i){
		getline(cin, q);
		State begin = q.begin();
		cout << expression(begin) << endl;
	}
    return 0;
}

Measured memory_bytes: 1204
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
@n,@m,q = gets.chomp.split.map(&:to_i)
@req = []
q.times do
  @req.push gets.chomp.split.map(&:to_i)
end

@ans = 0
def solve(ar)
  if ar.size == @n
    tmp = 0
    @req.each do |a,b,c, d|
      tmp += d if ar[b-1] - ar[a-1] == c
    end
    @ans = [@ans, tmp].max
    return
  end
  ar.last.upto(@m).each do |i|
    adup = ar.dup
    adup.push i
    solve(adup)
  end
end

solve([1])

puts @ans




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

ll nC2(ll n){return n*(n-1)/2;}//組み合わせ

int main(){
	int N; cin>>N;
	vector<int> A(N), C(N);
	rep(i, N){cin>>A[i]; A[i]--;}//値補正
	rep(i, N) C[A[i]]++;//値の種類毎の計数
	ll all = 0;//組み合わせの総計
	rep(a, N) all += nC2(C[a]);//組み合わせ
	rep(k, N) cout<< all - nC2(C[A[k]]) + nC2(C[A[k]]-1) <<endl;
}

Measured memory_bytes: 4096
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
const int N = 1e5+7;
int a[N];
bool st[N];
int main()
{
    int n;scanf("%d",&n);
    for(int i = 1;i <= n;++i)   scanf("%d",&a[i]);
    st[1] = 1;
    int cur = 1,res = 0;
    while(1)
    {
        cur = a[cur];
        if(st[cur])
        {
            res = -1;
            break;
        }
        st[cur] = 1;
        ++res;
        if(cur == 2)    break;
    }
    printf("%d",res);
    return 0;
}


Measured memory_bytes: 768
#include<iostream>
using namespace std;
using uint = unsigned int;

int main() {
	uint N;
	cin >> N;

	string S;
	cin >> S;

	for(uint i=0; i<S.length(); i++) {
		char c = S[i] + N;
		if(c > 'Z') {
			c-= 26;
		}
		cout << c;
	}

	return 0;
}


Measured memory_bytes: 256
high, width, y, x = map(int, input().split())

def nCr(n, r):
    return ((((fact[n]*finv[n-r])%mod)*finv[r])%mod)

mod = 10**9 + 7
inv = mod - 2
maxn = high + width - 2
fact = [0] * (maxn+1)
finv = [0] * (maxn+1)
fact[0] = fact[1] = 1
finv[0] = finv[1] = 1

# 階乗を求める
for i in range(2, maxn+1):
    fact[i] = (fact[i-1] * i) % mod

# 階乗の逆元を求める
for i in range(2, maxn+1):
    finv[i] = pow(fact[i], inv, mod)

route = 0
for i in range(1, high-y+1):
        route += (nCr(x+i-2, i-1) * nCr(width+high-x-1-i, high-i)) % mod
        route = route % mod
print(int(route))

Measured memory_bytes: 18868
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,d,x;
  cin>>n>>d>>x;
  int ans=x;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    int c=0;
    while(1+a*c<=d){c++;}
    ans+=c;
  }
  cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  string t;
  cin >> s >> t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if(s<t){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  char s[12];
  int ans=0,st;
  for(int i=11;i>=0;i--){
    cin>>s[i];
    if(s[i]=='?')st=i;
    else{
      if(i>6)ans+=(i-5)*(s[i]-'0');
      else if(i>0)ans+=(i+1)*(s[i]-'0');
    }
  }
  if(st==0){
    if(ans%11<=1)cout<<0<<endl;
    else cout<<11-ans%11<<endl;
  }else{
    int cnt=0,m,q=(st>6?st-5:st+1);
    for(int i=0;i<10;i++){
      if((ans+q*i)%11<=1&&s[0]=='0'){
	cnt++;
	m=i;
      }
      if(11-(ans+q*i)%11==s[0]-'0'){
	cnt++;
	m=i;
      }
    }
    if(cnt>=2)cout<<"MULTIPLE"<<endl;
    if(cnt==1)cout<<m<<endl;
  }
  return 0;
}



Measured memory_bytes: 3084
#include<iostream>
using namespace std;
int main() {
	int N, type = 1;
	long long count1 = 0, count2 = 0;
	long long a[100009];
	cin >> N;
	cin >> a[0];
	long long sum1 = a[0], sum2;
	if (a[0] == 0) {
		sum1 = 1;
		sum2 = -1;
		count1++;
		count2++;
	}
	else if (a[0] < 0) {
		type = -1;
		sum2 = 1;
		count2 += -a[0] + 1;
	}
	else {
		count2 += a[0] + 1;
		sum2 = -1;
	}
	for (int i = 1; i < N; i++) {
		cin >> a[i];
		sum1 += a[i];
		sum2 += a[i];
		type = -type;
		if (sum1 == 0) {
			sum1 += type;
			count1++;
		}
		else if ((sum1 > 0) && (type == -1)) {
			count1 += sum1 + 1;
			sum1 = -1;
		}
		else if ((sum1 < 0) && (type == 1)) {
			count1 += -sum1 + 1;
			sum1 = 1;
		}

		if (sum2 == 0) {
			sum2 -= type;
			count2++;
		}
		else if ((sum2 < 0) && (type == -1)) {
			count2 += -sum2 + 1;
			sum2 = 1;
		}
		else if ((sum2 > 0) && (type == 1)) {
			count2 += sum2 + 1;
			sum2 = -1;
		}
	}

	if (count1 < count2)cout << count1 << endl;
	else cout << count2 << endl;
}


Measured memory_bytes: 1024
a,b,c = map(int,input().split())

if a<=b<=c:
    print(a,b,c)
elif a<=c<=b:
    print(a,c,b)
elif b<=a<=c:
    print(b,a,c)
elif b<=c<=a:
    print(b,c,a)
elif c<=a<=b:
    print(c,a,b)
else:
    print(c,b,a)


Measured memory_bytes: 5596
h, w = map(int, input().split())
s = [input() + '#' for _ in range(h)]
s.append('#' * w)

yoko = [[0] * w for _ in range(h)]
for i in range(h):
  si = s[i]
  jj = -1
  for j in range(w):
    if si[j] == '.':
      start = j
      jj = j + 1
      break
  if jj == -1:
    continue
  for j in range(jj, w + 1):
    if si[j] == '#':
      if start != -1:
        for k in range(start, j):
          yoko[i][k] = j - start
        start = -1
    else:
      if start == -1:
        start = j

tate = [[0] * w for _ in range(h)]
for i in range(w):
  jj = -1
  for j in range(h):
    if s[j][i] == '.':
      start = j
      jj = j + 1
      break
  if jj == -1:
    continue
  for j in range(jj, h + 1):
    if s[j][i] == '#':
      if start != -1:
        for k in range(start, j):
          tate[k][i] = j - start
        start = -1
    else:
      if start == -1:
        start = j

result = 0
for i in range(h):
  yokoi = yoko[i]
  tatei = tate[i]
  for j in range(w):
    t = yokoi[j] + tatei[j] - 1
    if t > result:
      result = t

print(result)


Measured memory_bytes: 129624
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 2000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define rsort(x) sort(all(x));reverse(all(x))
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

bool debug=false;
/*---------------------------------------------------*/

int main(){
  string s;
  cin>>s;
  if(s.find("9")!=-1)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define _LIBCPP_DEBUG 0
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<62;



int main(void) {

    string s;
    int n;
    cin>>n;
    cin>>s;
    int ans =1;
    char last=s[0];
    for(int i=1;i<s.size();i++){
        if(s[i]!=last){
            last=s[i];
            ans++;
        }
    }
    fin(ans);

}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int64 H,W,ans = 1e18;
int64 maxdec(int64 a,int64 b,int64 c) {
    return max(max(abs(a - b),abs(a - c)),abs(b - c));
}
void Solve() {
    read(H);read(W);
    for(int i = 1 ; i < H ; ++i) {
	int64 h = (H - i) / 2;
	ans = min(ans,maxdec(i * W,h * W,(H - i - h) * W));
	int64 t = W / 2;
	ans = min(ans,maxdec(i * W,t * (H - i),(W - t) * (H - i)));
    }
    for(int i = 1 ; i < W ; ++i) {
	int64 h = (W - i) / 2;
	ans = min(ans,maxdec(i * H,h * H,(W - i - h) * H));
	int64 t = H / 2;
	ans = min(ans,maxdec(i * H,t * (W - i),(H - t) * (W - i)));
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


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

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

    set<int> wrong;
    wrong.insert(a);
    wrong.insert(b);
    for(int i=1; i<=3;i++){
        if(wrong.find(i) == wrong.end()){
            cout << i << endl;
            return 0;
        }
    }
}

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

int n,x,ans;
int main(){
    cin>>n;
    ans=0;
    for (int i=1;i<=n;i++){
        cin>>x;
        while (x%2==0){x/=2;ans++;}
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#define PI (3.14159265358979323846)
#define INF (1e+9)
#define DIV_NUM (1000000007)

using namespace std;

int main()
{

	/*--------------------------------*/
		/* 数字宣言と入力*/
		
		
//    string iS,iT,iU;
//	string S ,T;
//	cin >> S >> T;

		
	int a, b;
	
	cin >> a >>b;
	
	if( a%b==0){
		cout << a/b << endl;
	}else{
		cout << a/b+1 << endl;
		
	}
		
	
//	char u ;
	
//	string >>u;
	
//	if(u==s){
//		tmpX = a-1;
//		cout << a-1 << b << endl;
//	}
	
//	elseif(u==t){
//		cout << a << b-1 << endl;
//	}
//	else{
//		cout << a << b << endl;
//		
//	}



	/*---------------------------------*/
		/* 出力 */
//	cout << tmpX << endl;


	/*----------------------------------*/
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

int main() {
	int seven = 0, five = 0;

	for (int i = 0; i < 3; i++) {
		int num;

		std::cin >> num;

		if (num == 5) {
			five++;
		} else if (num == 7) {
			seven++;
		}
	}


	if (five == 2 && seven == 1) {
		std::cout << "YES" << std::endl;
	}else{
		std::cout << "NO" << std::endl;
	}


	return 0;
}

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

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

    int n, y;
    cin >> n >> y;
    y /= 1000;

    bool ans = false;
    int a, b, c;
    a = b = c = 0;
    REP(i, n + 1) REP(j, n + 1) {
        if (n - i - j >= 0) {
            if (i * 10 + j * 5 + (n - i - j) == y) {
                ans = true;
                a = i;
                b = j;
                c = n - i - j;
            }
        }
    }

    if (ans) cout << a << ' ' << b << ' ' << c << '\n';
    else cout << -1 << ' ' << -1 << ' ' << -1 << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int SN = (int) Math.pow(2, N);
		long[] S = new long[SN];
		for (int i = 0; i < SN; i++) {
			S[i] = scn.nextLong();
		}
		Arrays.sort(S);
		PriorityQueue<Long> ex = new PriorityQueue<Long>(new MyComp());
		PriorityQueue<Long> noko = new PriorityQueue<Long>(new MyComp());
		PriorityQueue<Long> buf = new PriorityQueue<Long>(new MyComp());
		PriorityQueue<Long> noko_buf = new PriorityQueue<Long>(new MyComp());

		boolean can = true;
		buf.add(S[SN - 1]);
		for (int i = 0; i < SN - 1; i++) {
			noko_buf.add(S[i]);
		}
		for (int i = 0; i < N; i++) {

			ex = buf;
			noko = noko_buf;
			buf = new PriorityQueue<Long>(new MyComp());
			noko_buf = new PriorityQueue<Long>(new MyComp());
			while (!ex.isEmpty()) {
				long p = ex.poll();
				buf.add(p);
				while (!noko.isEmpty()) {
					long np = noko.poll();
					if (p > np) {
						buf.add(np);
						break;
					} else {
						noko_buf.add(np);
					}
				}

			}
			while (!noko.isEmpty()) {
				long np = noko.poll();
				noko_buf.add(np);
			}
		}
		int ans = 0;
		while (!buf.isEmpty()) {
			buf.poll();
			ans++;
		}

		System.out.println(ans == SN ? "Yes" : "No");

	}

}

class MyComp implements Comparator<Long> {
	public int compare(Long o1, Long o2) {
		if ((long) o1 > (long) o2)
			return -1;
		if ((long) o1 < (long) o2)
			return 1;
		return 0;
	}

}


Measured memory_bytes: 168044
n, m, c = map(int, input().split())
b_list = list(map(int, input().split()))
count = 0

for _ in range(n):
    a_list = list(map(int, input().split()))
    sum = 0

    for i in range(m):
        sum += a_list[i] * b_list[i]
    sum += c

    if sum > 0:
        count += 1

print(count)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,L;
    cin >> N >> L;
    int S = 0;
    for(int i = 1; i <= N; i++){
        S += (L + i - 1);
    }
    //cout << S << endl;
    if(L > 0) cout << S - L << endl;
    else if(L <0 && L + N > 0) cout << S << endl;
    else if(L == 0) cout << S << endl;
    else cout << S - (L + N - 1) << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>

using namespace std;

typedef long long ll;
const int Maxn = 1e9 + 10;
const int N = 1e5 + 10;
const int INF=(0x7fffffff)/2;
const int MOD = 1000000007;
const int MaxN = 1000;
int a[50];

int main(){
	ll n;
	while(~scanf("%lld", &n)){
		int sum = 0, ans = 0, j = 0, p, q;
		while(n){
			int h = n % 10;
			a[j] = h;
			ans += h;
			n = n / 10;
			j++;
			if(n > 0 && n <= 9)
				p = n;
		}
		if(a[j - 1] != 9){
			sum += a[j - 1] - 1;
			for(int i = j - 2; i >=  0; i--){
				sum += 9;
			}
		}
		else{
			sum += 8;
			for(int i = j - 2; i >= 0; i--){
				sum += 9;
			}
		}
		printf("%d\n", max(ans, sum));
	}
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);

	}
} init_;

int main() {


	int N;
	cin >> N;

	vector<int> A(N);
	for (int i = 0; i < N - 1; i++) {
		int a;
		cin >> a;
		a--;
		A[a]++;
	}

	for (int i = 0; i < N; i++) {
		cout << A[i] << "\n";
	}

	return 0;
}



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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  string S;
  cin>>S;
  lint a=stoi(S.substr(0,4))*10000+stoi(S.substr(5,2))*100+stoi(S.substr(8,2));
  cerr<<a<<endl;
  cout<<(a>20190430?"TBD":"Heisei")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >


int A[101];

int sum(int val, int N) {
    int i,cnt=1;
    for(i = 1;;i++){
	if(i*val + 1 <= N) {
	    cnt++; 
	} else break;
    }

    return cnt;
}

int main(){
    std::ios::sync_with_stdio(false);

    int N, D, X,i;
    cin >> N >> D >> X;
    f(i,1,N+1) cin >> A[i];

    int res = 0;
   f(i,1,N+1) {
        int a = sum(A[i],D); 

	res+= a;

   }
    cout << res + X << endl;

    return 0;
    
} 

Measured memory_bytes: 256