akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)


#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

// calc nCk mod p, O(n + log p)
// 1. init(n, p)
// 2. use mod_nck(n, k, p) 
const int MAX_N = 200000;
ll fact[MAX_N + 1], fact_inv[MAX_N + 1];

ll mod_pow(ll x, ll n, ll p) {
  if(n == 0) return 1;
  ll res = mod_pow(x * x % p, n / 2, p);
  if(n & 1) res = res * x % p;
  return res;
}

void init(ll n, ll p) {
  fact[0] = 1;
  for(int i = 0; i < n; i++) {
    fact[i + 1] = fact[i] * (i + 1) % p;
  }
  fact_inv[n] = mod_pow(fact[n], p - 2, p);
  for(int i = n - 1; i >= 0; i--) {
    fact_inv[i] = fact_inv[i + 1] * (i + 1) % p;
  }
}

ll mod_nck(ll n, ll k, ll p) {
  return (fact[n] * fact_inv[k]) % p * fact_inv[n-k] % p;
}


ll N, M, K;

int main(){
  cin >> N >> M >> K;
  init(N * M, MOD);
  ll x = 0, y = 0;
  REP(i, N) x = (x + i * (N - i) * M * M) % MOD;
  REP(j, M) y = (y + j * (M - j) * N * N) % MOD;
  ll ans = mod_nck(N * M - 2, K - 2, MOD) * ((x + y) % MOD) % MOD;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
    using namespace std;
    typedef unsigned long long ull;
    typedef long long ll;
    #define ll long long
    #define dd double
    #define MOD1 1000000007
    #define MOD2 998244353
    #define nl cout<<endl
    #define rt ll Q[100005]={0}
    #define mp make_pair
    #define test() ll t;cin>>t;while(t--)
    #define pb push_back
    #define ff first    
    #define ss second
    #define all(v) v.begin(),v.end()
    #define s(ar,n) sort(ar,ar+n)
    #define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
    #define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
    #define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
    #define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
    #define ovp(a,n) for(ll i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<endl;
    #define maxa(ar,N) *max_element(ar,ar+N)
    #define mina(ar,N) *min_element(ar,ar+N)
    #define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
    typedef pair<ll,ll> pii;
    ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
    ll mpowe(ll n,ll m,ll MOD){if(m==0)return 1;ll t=mpowe(n,m/2,MOD);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
    ll logtwo(ll n){if(n==1)return 0;if(n==0) return -1;return logtwo(n/2)+1;}
    int main()
    {
        fastio();
       
        int t=1;
        //cin>>t;
        while(t--)
        {
            ll a,b,c,d;
            cin>>a>>b>>c>>d;
            ll dp[c+1][d+1];
            for(int i=0;i<=c;i++)
            {
                for(int j=0;j<=d;j++)
                {
                    dp[i][j]=0;
                }
            }
            dp[a][b]=1;
            for(int i=1;i<=c;i++)
            {
                for(int j=1;j<=d;j++)
                {
                    if(i<=a && j<=b)
                        continue;
                    dp[i][j] = i*dp[i][j-1] + j*dp[i-1][j] - ((i-1)*(j-1)*dp[i-1][j-1])%MOD2;
                    dp[i][j] = (dp[i][j]+MOD2)%MOD2;
                }
            }
            cout<<dp[c][d]<<endl;
        }
        
    }   

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

string S;

int main() {
	cin >> S;
	if (S == "Sunny") cout << "Cloudy" << endl;
	if (S == "Cloudy") cout << "Rainy" << endl;
	if (S == "Rainy") cout << "Sunny" << endl;
	return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            long N = long.Parse(input[0]);
            long K = long.Parse(input[1]);
            Dictionary<long, long> num = new Dictionary<long, long>();

            for (long i = 0; i < N; i++)
            {
                string[] input_num = Console.ReadLine().Split(' ');
                long a = long.Parse(input_num[0]);
                long b = long.Parse(input_num[1]);
                if (num.ContainsKey(a))
                {
                    num[a] += b;
                }
                else
                {
                    num.Add(a, b);
                }
            }

            long ans = 0;
            long sum = 0;

            foreach (KeyValuePair<long, long> item in num.OrderBy(x => x.Key))
            {
                sum += item.Value;
                if (sum >= K)
                {
                    ans = item.Key;
                    break;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

void solve(){
    string s;
    cin >> s;
    if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]) print("Bad");
    else print("Good");
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(true) {
        c -= b;
        if (c <= 0) {
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if (a <= 0) {
            cout << "No" << endl;
            break;
        }
    }
    return 0;
}

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

int32_t main() {
	ios::sync_with_stdio(0);cin.tie(0);
	string s;
	cin >> s;
	if(s == "ARC") {
		cout << "ABC";
	} else {
		cout << "ARC";
	}
}

Measured memory_bytes: 3648
#include <iostream>
int a = 0;
int b = 0;
int c = 0;

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

	c = a * 2 - 1;

	if (c < b * 2 - 1) {
		c = b * 2 - 1;
	}
	
	if (c < a + b) {
		c = a + b;
	}

	std::cout << c;    
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>

using namespace std;

int main(){
  int h,w;
  cin >> h >> w;
  queue< pair<int, int> > q;
  int dir[2][4] = { {1, -1, 0, 0}, {0, 0, 1, -1}};
  vector< vector<int> > v(h);
  int wt = 0;
  for(int i = 0; i < h ; i++){
    for(int j = 0; j < w; j++){
      char tmp;
      cin >> tmp;
      if(tmp == '#') v[i].push_back(1);
      else{
        v[i].push_back(0);
        wt++;
      }
    }
  }

  q.push(make_pair(0, 0));
  while(!q.empty()){
    pair<int, int> f = q.front();
    q.pop();
    if(f.first == h - 1 && f.second == w -1){
      cout << wt - v[f.first][f.second] - 1 << endl;
      return 0;
    }
    for(int i = 0; i < 4; i++){
      if(f.first + dir[0][i] >= 0 && f.first + dir[0][i] < h && f.second + dir[1][i] >= 0 && f.second + dir[1][i] < w){
        if(v[f.first + dir[0][i]][f.second + dir[1][i]] == 0){
          q.push(make_pair(f.first + dir[0][i], f.second + dir[1][i]));
          v[f.first + dir[0][i]][f.second + dir[1][i]] = v[f.first][f.second] + 1;
        }
      }
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 256
function Main(input) {
	input = input.split("");
	var arr = ["C","O","D","E","F","E","S","T","I","V","A","L","2","0","1","6",];
	var sum = 0;
	for(var i=0;i<input.length;i++){
		if(input[i]!=arr[i]) sum++;
	}
	console.log(sum)
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 7372
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            String S = in.next();
            int l = Integer.parseInt(S.substring(0, 2));
            int r = Integer.parseInt(S.substring(2, 4));
            if (canMonth(l)) {
                if (canMonth(r)) {
                    System.out.println("AMBIGUOUS");
                } else {
                    System.out.println("MMYY");
                }
            } else {
                if (canMonth(r)) {
                    System.out.println("YYMM");
                } else {
                    System.out.println("NA");
                }
            }
        }
    }

    private static boolean canMonth(int n) {
        return n >= 1 && n <= 12;
    }
}


Measured memory_bytes: 21972
#include <stdio.h>
#include <assert.h>

int main(void) {
  int length_seq;
  int current_term;
  int current_max;
  int current_max_idx = 0;
  int next_max;
  int next_max_idx = 1;
  
  scanf("%d", &length_seq);
  scanf("%d", &current_max);
  scanf("%d", &next_max);
  
  if (current_max < next_max) {
    int temp = current_max;
    current_max = next_max;
    next_max = temp;
    current_max_idx = 1;
    next_max_idx = 0;
  }
  
  assert(length_seq >= 2);
  assert(length_seq <= 200000);
  
  for (int i = 2; i < length_seq; i++) {
    scanf("%d", &current_term);
    if (current_term > current_max) {
      next_max = current_max;
      next_max_idx = current_max_idx;
      current_max = current_term;
      current_max_idx = i;
    } else if (current_term > next_max) {
      next_max = current_term;
      next_max_idx = i;
    }
  }
  
  for (int i = 0; i < length_seq; i++) {
    if (i == current_max_idx) {
      printf("%d\n", next_max);
    } else {
      printf("%d\n", current_max);
    }
  }
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();


    string s, t;
    cin>> s;
    t= s;
    reverse(s.begin(), s.end());

    int c= 0;

    for(int i=0; i<s.size(); i++)
    {
        if( s[i]!= t[i])
            c++;
    }

    cout << c/2 ;
    nl;

    return 0;
}




Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);

    int n,ans=0;
    cin>>n;
    long long l[n];
    for(int i=0; i<n; i++){
        cin>>l[i];
    }
    
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            if(l[i]==l[j])    continue;
            for(int k=j+1; k<n; k++){
                if(l[i]==l[k] || l[j]==l[k])    continue;
                
                long long len = l[i]+l[j]+l[k];
                long long ma = max({l[i], l[j], l[k]});
                long long rest = len-ma;
                if(ma<rest)     ans++;
            }
        }
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3652
A,B,C,D,E,F = (int(x) for x in input().split())

CCT = {}
for a in range(F//(100*A)+1):
    for b in range(F//(100*B)+1):
        water = (a*A+b*B)*100
        if water > F:
            continue
        max_suger = water*E//100
        for c in range(max_suger//C+1):
            for d in range(max_suger//D+1):
                suger = c*C+d*D
                total = water + suger
                if total > F or total == 0:
                    continue
                if max_suger < suger:
                    continue
                CCT[water,suger] = suger/total

ans = (A*100, 0)
max_cct = 0
for (water,suger),cct in CCT.items():
    if cct > max_cct:
        max_cct = cct
        ans = (water+suger, suger)
print(*ans)


Measured memory_bytes: 10252
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n, m; cin >> n >> m;
	int can[100000] = {}; int num[100000];
	fill(num, num + n, 1);
	can[0] = 1;
	rep(i, m) {
		int x, y; cin >> x >> y; x--; y--;
		if (can[x]) {
			can[y] = 1;
			if (num[x] == 1)can[x] = 0;
		}
		num[x]--; num[y]++;
	}
	int cnt = 0;
	rep(i, n) {
		if (can[i])cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	long long n,m;
	long long maxx=1;
	scanf("%lld%lld",&n,&m);
	if(m<n)
	{
		printf("0");
		return 0;
	}
	else if(m%n==0)
	{
		printf("%lld",m/n);
		return 0;
	}
	else 
	{
		for(long long j=1;j<=m;j++)
		{
			if(m%j==0&&m/j>=n)
			maxx=j;
			if(m<n*j)
			break;
		}
		printf("%lld",maxx);
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int prime[1000000], i, j, n, c;

    for (i = 2; i < 1000000; i += 2) {
        prime[i] = 0;
        prime[i + 1] = 1;
    }
    prime[0] = prime[1] = 0;
    prime[2] = 1;
    for (i = 3; i < 1000000; i += 2)
        if (prime[i])
            for (j = 2 * i; j < 1000000; j += i)
                prime[j] = 0;

    while (scanf("%d", &n) != EOF) {
        c = 0;
        for (i = 2; i <= n; ++i)
            if (prime[i])
                ++c;
        printf("%d\n", c);
    }

    return 0;
}

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

typedef long long ll;

const int N = 100100;

int n;
ll dp[N][2], rem[N][2], a[N];

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) 
		cin >> a[i];	
	dp[1][0] = a[1] / 2;
	rem[1][0] = a[1] % 2;
	for (int i = 2; i <= n; i++) {
		dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]) + a[i] / 2;
		ll add1 = (a[i] - 1) / 2 + rem[i - 1][0];
		ll add2 = (a[i] - 1) / 2 + rem[i - 1][1];
		if (a[i] == 0) add1 = 0, add2 = 0;
		dp[i][1] = max(dp[i - 1][0] + add1, dp[i - 1][1] + add2);
		rem[i][0] = a[i] % 2;
		if (a[i] > 0) rem[i][1] = (a[i] - 1) % 2;
	}
	cout << max(dp[n][0], dp[n][1]) << '\n';
}


Measured memory_bytes: 7492
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("YES") if fl else print("NO")
import collections
import math
import itertools
import heapq as hq
n,k  = ma()
A  = lma()
mx = max(A)
lm = len(bin(max(mx,k)))-2
ls = [0]*lm
for a in A:
    ba = bin(a)[::-1]
    for i in range(len(ba)-2):
        if ba[i]=="1":
            ls[i]+=1

bk = bin(k)[2:].zfill(lm)
bk=bk[::-1]
lk = len(bk)
def score(idx,f2=False):
    f=False
    ret=0
    if bk[idx]=="1":
        f=True
    for i in range(lm):
        if f2:
            if bk[i]=="0":
                ret+=ls[i]*2**i
            else:
                ret+=max(ls[i],n-ls[i])*2**i
            continue
        if f:
            if i<idx:
                ret+=max(ls[i],n-ls[i])*2**i
            elif i==idx:#bk[i]==0
                ret +=ls[i]*2**i
            else:
                if bk[i]=="0":
                    ret+=ls[i]*2**i
                else:
                    ret+=max(ls[i],n-ls[i])*2**i
        else:
            if bk[i]=="0":
                ret+=ls[i]*2**i
            else:
                ret+=max(ls[i],n-ls[i])*2**i

    return ret
ans = 0
for i in range(1,lk):
    tmp = score(i)
    #print(tmp)
    ans = max(ans,tmp)
ans = max(ans,score(0,f2=True))
print(ans)
#bina = [bin(a)[2:] for a in A]; print(*bina)
#print(ls)
# print(bin(k)[2:],bk)


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

using namespace std;

int main()
{
     LL a,b,c,d;
     LL x,y;
     cin>>a>>b>>c>>d;
      LL ans  = a*c;
      ans = max(a*d,ans);
      ans = max(b*d,ans);
      ans = max(ans,b*c);
      cout<<ans<<endl;
     return 0;
}


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

int main(){

  int i,j,k;
  char input[4];
  scanf("%s",input);
  
  if( strcmp(input,"MON")==0 ){
    printf("6\n");
  }
  else if( strcmp(input,"TUE")==0 ){
    printf("5\n");
  }
  else if( strcmp(input,"WED")==0 ){
    printf("4\n");
  }
  else if( strcmp(input,"THU")==0 ){
    printf("3\n");
  }
  else if( strcmp(input,"FRI")==0 ){
    printf("2\n");
  }
  else if( strcmp(input,"SAT")==0 ){
    printf("1\n");
  }
  else if( strcmp(input,"SUN")==0 ){
    printf("7\n");
  }
  
  return 0;
    
}

Measured memory_bytes: 128
from math import gcd
from functools import reduce
from sys import exit

# O(A+N)解
MAX_A = 1000000
lowerst_prime = [0] * (MAX_A + 1) # 最小の素因数をいれる(2以上をみていけばいい)
primes = [] # MAX_A以下の素数の集合
count = [0] * (MAX_A + 1) # 約数として出てくる回数を数える
for i in range(2, MAX_A + 1): # 線形時間で処理してくれる
    if lowerst_prime[i] == 0:
        lowerst_prime[i] = i
        primes.append(i)
    for p in primes:
        if p > lowerst_prime[i] or i * p > MAX_A:
            break
        lowerst_prime[i * p] = p # p が i * p のもっとも小さな素因数となるときのみ更新されるので、線形時間アルゴリズムとなる
# 入力
N = int(input())
A = [*map(int, input().split())]
if reduce(gcd, A) != 1:
    print("not coprime")
    exit(0)
for i in range(N):
    while A[i] > 1:
        divide = lowerst_prime[A[i]]
        if count[divide]:
            # A[x] % i == A[y] % i == 0 となるx != yが存在するので、i | gcd(x, y) となる
            print("setwise coprime")
            exit(0)
        count[divide] += 1
        while A[i] % divide == 0: # 割れるだけ割る
            A[i] //= divide
print("pairwise coprime")

Measured memory_bytes: 215240
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N;
int main(){
    cin >> N;
    int tp,ct = 0;
    rep(i,N){
        cin >> tp;
        while(!(tp%2)) tp/=2, ct++;
    }
    pr(ct);
}

Measured memory_bytes: 256
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
ll power(ll x, ll y); 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitcount(n) __builtin_popcountll(n)
#define in_edges(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B);}
#define endl "\n"

const ll MOD = 1000000007;

void f(ll n) 
{    
    char res[10000]; 
    int i = 0; 
    while(n!=0) 
    {    
        int temp  = 0; 
        temp = (n - 1)% 26; 
            res[i] = temp + 'a'; 
            i++; 
        n = (n - 1)/26; 
    }
     for(int j=i-1; j>=0; j--) 
        cout << res[j]; 
}
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    quickio
    ll n;
    cin >> n;
    f(n);
}

ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

Measured memory_bytes: 3640
import java.util.*;
public class Main {
    static Scanner sc = new Scanner(System.in);
    static int[][] dir = new int[][]{{1,0},{0,1},{-1,0},{0,-1}};
    public static void main(String[] args) {
        int x = sc.nextInt();
        int n = sc.nextInt();
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            set.add(sc.nextInt());
        }
        if(!set.contains(x))
            System.out.println(x);
        else {
            int diff = 1;
            while (true) {
                int a = x - diff;
                int b = x + diff;
                if (!set.contains(a)) {
                    System.out.println(a);
                    break;
                }
                if (!set.contains(b)) {
                    System.out.println(b);
                    break;
                }
                diff++;
            }
        }
    }
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N,K,S;
    Scd3(N,K,S);

    vl ans(N+1);
    ll dummy = S>(N-K)?1:1e9;
    Rep(i,N-K+1){
        ans[i+1] = ans[i] + dummy;
    }
    Repe(i,N,N-K){
        ans[i+1] = ans[i] + S;
    }

    Rep(i,N){
        printf ("%d%s", ans[i+1] - ans[i], i == N-1 ? "\n" : " " );
    }

    return 0;
}



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

    int n, k;
    cin >> n >> k; 
    vector<int> h(n);
    rep(i, n) cin >> h[i];

    int ans = 0;
    rep(i, n){
        if(h[i] >= k)
            ans++;
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

bool check(int number){

	for(int i = 1; i*i <= number; i++){
		if((number-i)%(2*i+1) == 0){
			return true;
		}
	}
	return false;
}


int main(){

	int N,ans = 0,tmp;
	scanf("%d",&N);

	for(int i = 0; i < N; i++){
		scanf("%d",&tmp);
		if(!check(tmp)){
			ans++;
		}
	}

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 3184
#include<bits/stdc++.h>
using namespace std;
#define freop freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define st string
typedef long long ll;
 
void solve(){
     ll n;
     cin >> n;
     ll arr[n];
     for(ll i = 0; i < n; i++){
         cin >> arr[i];
     }
  	 ll aux = arr[0];
  	 ll ans = 0;
     for(ll i = 1; i < n; i++){
         if(aux > arr[i]) {
             ans += aux - arr[i];
             
         }
         aux = max(aux, arr[i]);
     }
     cout << ans;
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 5180
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		long n=scn.nextLong();
	        System.out.println( res(n));

	}
	public static StringBuilder res(long n){
		if(n<=0){
			StringBuilder sb=new StringBuilder();
			return sb;
		}
		if(n<=26){
			StringBuilder sb=new StringBuilder();
			char ch = (char)((n-1)+'a');
			sb.append(ch);
			return sb;
		}
		  StringBuilder ans=new StringBuilder();
		  if(n%26==0){
		StringBuilder a= res(n/26-1);
		  ans.append(a);
		  }else{
			  StringBuilder a= res(n/26);
			  ans.append(a);
		  }
		  
		    long val=n%26;
		    if(val==0){
		    	val=26;
		    }
		    char ch=(char)((val-1)+'a');
		    ans.append(ch);
		    return ans;
		
	}

}

Measured memory_bytes: 35732
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  string J;
	cin >> A >> B >> C >> D;
  	if(A+B > C+D){
      J = "Left";
    }
    else if(A+B < C+D){
      J = "Right";
    }
    else{
      J = "Balanced";
    }
  cout << J << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<malloc.h>
#include<math.h>
using namespace std;
//#define int long long
typedef pair<int, int> pii;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007

int N, par[100100], dep[100100], type[100100];
vector<int> G[100100];
char name[3][100] = {"root", "internal node", "leaf"};
bool chi[100100];

void dfs(int v, int p, int d){
    par[v] = p;
    dep[v] = d;
    for(int i = 0; i < (int)G[v].size(); i++){
        int to = G[v][i];
        if(to != p){
            dfs(to, v, d + 1);
        }
    }
    return;
}

signed main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        int n, k;
        cin >> n >> k;
        if(k == 0){
            type[n] = 2;
        }
        else {
            type[n] = 1;
        }
        for(int j = 0; j < k; j++){
            int c;
            cin >> c;
            G[n].push_back(c);
            chi[c] = true;
        }
    }
    int root = -1;
    for(int i = 0; i < N; i++){
        if(!chi[i]){
            type[i] = 0;
            root = i;
        }
    }
    if(root < 0)return 1;
    dfs(root, -1, 0);
    for(int i = 0; i < N; i++){
        printf("node %d: parent = %d, depth = %d, %s, [", i, par[i], dep[i], name[type[i]]);
        for(int j = 0; j < (int)G[i].size(); j++){
            int to = G[i][j];
            printf("%d", to);
            if(j < (int)G[i].size() - 1)printf(", ");
        }
        printf("]\n");
    }


    return 0;
}

/*

*/


Measured memory_bytes: 7572
import java.io.*;

public class Main{
    public static void main (String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{
            int x = Integer.parseInt(reader.readLine());
            System.out.println(x * x * x);
        } catch(IOException e){
            System.out.println(e);
        }
    }
}


Measured memory_bytes: 24204
#include <iostream>
using namespace std;
int main(){
    int W,H;
    while(1){
    cin>>W>>H;
    if(W == 0&&H == 0){
        break;
    }
    for(int i=1;i<=W;i++){
        for(int a=1;a<=H;a++){
            cout<<'#';
        }
        cout<<endl;
    }
    cout<<endl;
    }
    return 0;
}


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

vector<int> as;
map<int,long long int> bs;

int main(){
	
	int n;
	long long int k;
	cin >> n >> k;
	for (int i = 0; i < n; ++i)
	{
		int a;
		long long b;
		cin >> a >> b;
		if(bs[a]==0){
			bs[a]=b;
			as.push_back(a);}
		else{
			bs[a]+=b;
		}
	}

	sort(as.begin(),as.begin()+as.size());
	long long int cont=0;
	int i=0,salvar=as[0];
	while(cont<k){
		cont+=bs[as[i]];
		salvar=as[i];
		i+=1;
	}
	cout << salvar;
}


Measured memory_bytes: 4476
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
    long long n;
    long long a,b;
    cin >> n;
    int ans=0;
    for( a=sqrt(n)+1;n%a!=0;--a){

    }
    b=max((n/a),a);
    while(b!=0){
        b/=10;
        ans++;
    }
   // cout<<a<<" "<<b<<endl;
    cout<<ans;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		var k = p[0];
		var s = p[1];
		long wa = 0;
		for(int i = 0; i <= k; i++)
		{
			for(int j = 0; j <= k; j++)
			{
				var z = (s-i-j);
				if(z <= k && z >= 0 && i+j+z == s)
				{
					wa++;
				}
			}
		}
		Console.WriteLine(wa);
	}
	

	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}



Measured memory_bytes: 13140
import java.util.Scanner;


public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int i = 0; i<n; i++){
			float x1=sc.nextFloat();
			float y1=sc.nextFloat();
			float x2=sc.nextFloat();
			float y2=sc.nextFloat();
			float x3=sc.nextFloat();
			float y3=sc.nextFloat();
			float[] Sixcoeff =MakeSixCoeff(x1,y1,x2,y2,x3,y3);
			float[] sols = Solve(Sixcoeff[0],Sixcoeff[1],Sixcoeff[2],Sixcoeff[3],Sixcoeff[4],Sixcoeff[5]);
			double r = Math.sqrt((double) (sols[0]-x1)*(sols[0]-x1)+(sols[1]-y1)*(sols[1]-y1));
			System.out.printf("%.3f %.3f %.3f\n",sols[0],sols[1],r);
		}
	}


/**
 * This function connects between Main and Solve function below.
 */

	static float[] MakeSixCoeff(float x1, float y1, float x2, float y2, float x3, float y3){
		float[] SixCoeff = new float[6];
		SixCoeff[0]=2*(x2-x1);
		SixCoeff[1]=2*(y2-y1);
		SixCoeff[2]=y2*y2-y1*y1+x2*x2-x1*x1;
		SixCoeff[3]=2*(x3-x1);
		SixCoeff[4]=2*(y3-y1);
		SixCoeff[5]=y3*y3-y1*y1+x3*x3-x1*x1;
		return SixCoeff;
	}

/**
 * This Function is the reuse of Probrem No.0004
 */
	static float[] Solve(float a, float b, float c, float d, float e, float f){
		float[] sols = new float[2];
		sols[0] = (float) (e*c-b*f)/(a*e-b*d);
		sols[1] = (float) (a*f-d*c)/(a*e-b*d);
		for(int i=0;i<=1;i++){
			if(sols[i]==-0){sols[i]=0;}
		}
		return sols;
	}
}

Measured memory_bytes: 20760
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) v.begin(), v.end()


int main() {
	ll N;
	vll po = { 111, 222, 333 ,444, 555, 666, 777, 888, 999};
	cin >> N;
	rep(i, 9) {
		if (N <= po[i]) {
			cout << po[i] << endl;
			break;
		}
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> v(n+1, 1);
    vector<int> dp(n+1);
    for (int i = 0; i < m; ++i) {
        int x;
        cin >> x;
        v[x] = 0;
    }
    dp[0] = 1; dp[1] = v[1];
    for (int i = 2; i <= n; ++i) {
        if(v[i]) (dp[i] += dp[i-1]+dp[i-2]) %= MOD;
    }
    cout << dp.back() << "\n";
    return 0;
}

Measured memory_bytes: 1024
//D - Banned K

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int n;

    cin >> n;

    int a[n];
    int cnt[n];

    for(int i=0; i<n; i++) cnt[i]=0;
    
    for(int i=0; i<n; i++){
        cin >> a[i];
        cnt[a[i]-1]++;
    }

    long long sum = 0;

    for(int i=0; i<n; i++){
        sum += (long long)cnt[i] * (cnt[i] -1) / 2;
    }

    for(int i=0; i<n; i++){
        cout << sum - cnt[a[i]-1] + 1 << endl;
    }

 

    return 0;
}



Measured memory_bytes: 4096
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, 0, n) cin >> a[i];
    int pos = 0;
    unsigned int ans = 0;
    rep(i, 0, n) {
        if(a[i] != pos+1) {
            ans++;
        }
        else {
            pos++;
        }
    }
    if(pos == 0) {
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
using namespace std;
int n, a[100005], cnt=0;
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	sort(a+1, a+n+1);
	int x=n/2;
	int ans=a[x+1]-a[x];
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

const int maxn = 100010;

typedef long long ll;

ll v1;
int n = 0;
int A[maxn], B[maxn];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &A[i]);
	v1 = A[1];
	B[1] = A[1] - A[n];
	for (int i = 2; i <= n; i++) B[i] = A[i] - A[i-1];
	int mx = 0, ok = 1;
	for (int i = 1; i <= n; i++) mx = max(mx, B[i]);
	for (int i = 1; i <= n; i++) {
		if ((B[i] - mx) % n != 0) {
			ok = 0;
		}
	}
	if (!ok) {
		puts("NO");
		return 0;
	}
	for (int i = 1; i <= n; i++) {
		int cnt = (mx - B[i]) / n;
		int cost = (n + 2 - i);
		if (cost > n) cost -= n;
		v1 -= 1LL * cnt * cost;
	}
	if (v1 < 0) puts("NO");
	else {
		ll t = 1LL * n * (n+1) / 2;
		if (v1 % t == 0) puts("YES");
		else puts("NO");
	}
	return 0;
}

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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

//Write From this Line

const int mod = 1e9+7;
int main()
{
	int n , k ;
	cin>> n >> k ;
	int r , s  , p ; 
	cin>> r >> s  >> p ; 
	string t ;
	cin>> t ;
	ll ans = 0 ;
	string WL = "";

	rep(i,n){
		char c = t[i];
		if(c == 'r'){
			if(i < k){
				ans += p;
				WL+='W';
			}else{ if(WL[i - k ]=='W'&&t[i]==t[i-k]){
				ans += 0;
				WL += 'L';
			}else{
				ans += p ;
				WL +='W';
			}
			}
		}
		if(c == 's'){
			if(i < k){
				ans += r;
				WL+='W';
			}
			else{ if(WL[i-k]=='W'&&t[i]==t[i-k]){
				ans += 0;
				WL += 'L';
			}else{
				ans += r;
				WL += 'W';
			}
			}
		}
		if(c == 'p'){
			if(i < k){
				ans += s;
				WL+='W';
			}
			else{ if(WL[i - k]=='W'&&t[i]==t[i-k]){

				ans += 0;
				WL += 'L';
			}else{
				ans += s;
				WL += 'W';
			}
			}
			//sで勝つ
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define ll long long

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  for(int i=0; i<n; i++){
    cin >> d[i];
  }
  int ans=0;
  for(int i=0; i<n; i++){
    for(int j=i+1; j<n; j++){
      ans += d[i]*d[j];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<cmath>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n-1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(a, n) sort(a, a+n)
#define VSORT(v) sort(v.begin(), v.end())

using namespace std;

int main()
{
    int k;

    cin >> k;

    queue<long> q;

    FOR(i, 1, 10) {
        q.push(i);
    }

    long x;

    REP(i, k-1) {
        x = q.front();
        q.pop();
        if(x % 10 != 0) { q.push((long)(10 * x + x % 10 - 1)); }
        q.push((long)(10 * x + x % 10));
        if(x % 10 != 9) { q.push((long)(10 * x + x % 10 + 1)); }
    }

    cout << q.front() << endl;

    return 0;
}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

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

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

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    ll a,b,n;
    cin>>a>>b>>n;

    ll x;
    if(n < b-1)x = n;
    else x = b-1;

    ll s = (a/b);
    ll t = (a%b);

    //db2(s,t);ln;
    //db2(x/b,x%b);ln;

    ans = (a/b)*x + ((x*t)/b);
    cout<<ans<<endl;

    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[n+1];
    for(int i=1;i<=n;i++)
    {
        int p;
        cin>>p;
        arr[p]=i;
    }
    for(int i=1;i<=n;i++) cout<<arr[i]<<" ";

    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<iomanip>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>

i64 inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

i64 cup(i64 xxx, i64 yyy) {//切り上げ
	return (xxx + yyy - 1) / yyy;
}

//メモリ置き場
int a, b, c;

//inputします
void input() {
	cin >> a >> b >> c;
	
}

//ライブラリ置き場



//main
int main() {
	input();
	if (a == b && b != c) {
		cout << "Yes" << endl;
		return 0;
	}
	else if (a == c && b != c) {
		cout << "Yes" << endl;
		return 0;
	}
	else if (b == c && a != c) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main { 
	// Driver program to test above function 
	public static void main(String[] args) 
	{ 
		Scanner sc = new Scanner(System.in);
      	long num = sc.nextLong();
      	StringBuilder columnName = new StringBuilder(); 

		while (num > 0) { 
		
			long rem = num % 26; 
			if (rem == 0) { 
				columnName.append("Z"); 
				num = (num / 26) - 1; 
			} 
			else 
			{ 
				columnName.append((char)((rem - 1) + 'A')); 
				num = num / 26; 
			} 
		} 
		String lowerCase = columnName.toString().toLowerCase();
      	char c[]=lowerCase.toCharArray();
		String reverse="";

		for(int i=c.length-1;i>=0;i--){
			reverse+=c[i];
			}
		System.out.println(reverse); 
	} 
      	
} 



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

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < n - 2; ++i) {
        if (s.at(i) == 'A' && s.at(i + 1) == 'B' && s.at(i + 2) == 'C')  ans++;
    }
    cout << ans << endl;
}


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

class Solution
{
    static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var n = vals[0];
        var k = vals[1];
        var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        var bit = Enumerable.Range(0, 63).Select(_ => new HashSet<long>()).ToArray();
        var acc = new long[a.Length + 1];
        long v = 0;
        for (int i = 0; i < a.Length; i++)
        {
            v += a[i];
            acc[i + 1] = v;
        }

        for (int i = 0; i < a.Length; i++)
        {
            for (int j = i + 1; j < a.Length; j++)
            {
                int b = 0;
                var sum = acc[j + 1] - acc[i];
                for (var t = sum; t > 0; t >>= 1)
                {
                    if ((t & 1) == 1)
                    {
                        bit[b].Add(sum);
                    }
                    b++;
                }
            }
        }

        var bi = bit.Length - 1;
        for (; bi > 0; bi--)
        {
            if (bit[bi].Count >= k)
            {
                break;
            }
        }

        var selected = bit[bi].ToList();
        for (; bi > 0; bi--)
        {
            var nexts = selected.Where(x => bit[bi].Contains(x)).ToList();
            if (nexts.Count >= k)
            {
                selected = nexts;
            }
        }

        var result = selected.Aggregate((a1, a2) => a1 & a2);

        Console.WriteLine(result);
    }
}

Measured memory_bytes: 347576
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1000000007;
const ll INF = 9223372036854775807;
#define Sort(a) sort(a.begin(), a.end())
#define Bsort(a) sort(a.begin(), a.end(), greater<ll>())
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  ll n;
  cin >> n;
  rep(i,n) {
    ll a;
    cin >> a;
    if (a%2 == 0) {
      if (a%3 != 0 && a%5 != 0) {
        cout << "DENIED\n";
        return 0;
      }
    }
  }
  cout << "APPROVED\n";
}

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

int main()
{
    int n;
    long long int e[4000], p[4000], q[4000], sum[4000];
    bool ej[4000];

    while( cin >> n )
    {
        if( n == 0 )
            break;

        for( int i = 0; i < 4000; i++ )
        {
            sum[i] = 0;
            ej[i] = false;
        }

        for( int i = 0; i < n; i++ )
        {
            cin >> e[i] >> p[i] >> q[i];
            sum[e[i]] += p[i] * q[i];
        }
        
        bool judge = false;
        for( int i = 0; i < n; i++ )
        {
            if( sum[e[i]] >= 1000000 && ej[e[i]] == false )
            {
                cout << e[i] << endl;
                judge = true;
                ej[e[i]] = true;
            }
        }
        if( judge == false )
            cout << "NA" << endl;
    }
    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007

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

    int n= s.length();
    vector< pair<char ,char> > p(n);
    vector< pair<char ,char> > q(n);
    rep(i,n){
        p[i]=make_pair(s[i],t[i]);
        q[i]=make_pair(t[i],s[i]);
    }
    sort(p.begin(),p.end());
    sort(q.begin(),q.end());
    rep(i,n-1){
        if(p[i].first==p[i+1].first){
            if(p[i].second != p[i+1].second){
            cout<<"No"<<endl;
            return 0;
            }
        }
        if(q[i].first==q[i+1].first){
            if(q[i].second != q[i+1].second){
            cout<<"No"<<endl;
            return 0;
            }            
        }
    }   
    cout<< "Yes"<<endl;
}

Measured memory_bytes: 1672
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;

  double s;
  if (n % 2 == 0) {
    s = n / 2.0;
  } else {
    s = (n + 1) / 2.0;
  }

  cout << s / n << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 200000
int main(){
  int a,i,b[N],min,max,c,d;

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



Measured memory_bytes: 2564