akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n, a;
    cin >> n;
    vector<int> ans(n+1, 0);
    for(int i = 0; i < n-1; i++) {
        scanf("%d", &a);
        ans[a]++;
    }
    for(int i = 1; i <= n; i++) {
        printf("%d\n", ans[i]);
    }
    return 0;
}

Measured memory_bytes: 4052
N, M = map(int, input().split())
if M > 0:
    S = [[i for i in input().split()] for _ in range(M)]
    w = [0] * (N+1)
    ac = set()
    for s in S:
        if int(s[0]) in ac:
            continue
        elif s[1] == "AC":
            ac.add(int(s[0]))
        else:
            w[int(s[0])] += 1
    wa = [w[i] for i in ac]
    print(len(ac), sum(wa))
else:
    print(0, 0)


Measured memory_bytes: 35636
#include<stdio.h>
int main(void){
	int n,i,j,flag,ptr=0,prime[20000];
	prime[ptr++]=2;prime[ptr++]=3;
	for(i=5;i<=50021;i+=2){
		flag=0;
		for(j=1;prime[j]*prime[j]<=i;j++){
			if(i%prime[j]==0){flag=1;break;}
		}
		if(!flag){prime[ptr++]=i;}
	}
	while(scanf("%d",&n)!=EOF){
		for(i=0;;i++){
			if(prime[i]==n){
				printf("%d %d\n",prime[i-1],prime[i+1]);
				break;
			}
			if(prime[i]>n){
				printf("%d %d\n",prime[i-1],prime[i]);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 620
/*
Contest: -
Problem: ARC 074C
Author: tzc_wk
Time: 2020.6.22
*/
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define giveup(...) return printf(__VA_ARGS__),0;
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define fillsmall(a) memset(a,0xcf,sizeof(a))
#define mask(a)		(1ll<<(a))
#define maskx(a,x)	((a)<<(x))
#define _bit(a,x)	(((a)>>(x))&1)
#define _sz(a)		((int)(a).size())
#define filei(a)	freopen(a,"r",stdin);
#define fileo(a)	freopen(a,"w",stdout);
#define fileio(a) 	freopen(a".in","r",stdin);freopen(a".out","w",stdout)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define put(x)		putchar(x)
#define eoln        put('\n')
#define space		put(' ')
#define y1			y1010101010101
#define y0			y0101010101010
typedef pair<int,int> pii;
inline int read(){
	int x=0,neg=1;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')	neg=-1;
		c=getchar();
	}
	while(isdigit(c))	x=x*10+c-'0',c=getchar();
	return x*neg;
}
inline int qpow(int x,int e,int _MOD){
	int ans=1;
	while(e){
		if(e&1)	ans=ans*x%_MOD;
		x=x*x%_MOD;
		e>>=1;
	}
	return ans;
}
const int MOD=1e9+7;
int n=read(),m=read();
int l[305],r[305],x[305];
vector<int> tr[305];
int dp[305][305][305];
inline bool check(int i,int j,int k){
	bool flg=1;
	foreach(it,tr[i]){
		int ind=*it;
		int cnt=1;
		if(j>=l[ind])	cnt++;
		if(k>=l[ind])	cnt++;
		if(cnt!=x[ind])	flg=0;
	}
	return flg;
}
signed main(){
	fz(i,1,m)	l[i]=read(),r[i]=read(),x[i]=read(),tr[r[i]].push_back(i);
	if(check(1,0,0))	dp[1][0][0]=dp[0][1][0]=dp[0][0][1]=1;
	fz(i,2,n){
		fz(j,0,i-1){
			fz(k,0,j){
				if(j==k&&j)	continue;
				if(!check(i,j,k))	continue;
				dp[i][j][k]=dp[i-1][j][k];
				dp[i][k][j]=dp[i-1][k][j];
				dp[j][i][k]=dp[j][i-1][k];
				dp[j][k][i]=dp[j][k][i-1];
				dp[k][i][j]=dp[k][i-1][j];
				dp[k][j][i]=dp[k][j][i-1];
				if(j==i-1||k==i-1){
					for(int l=0;l<i-1;l++)	dp[i][j][k]=(dp[i][j][k]+dp[l][j][k])%MOD;
					for(int l=0;l<i-1;l++)	dp[i][k][j]=(dp[i][k][j]+dp[l][k][j])%MOD;
					for(int l=0;l<i-1;l++)	dp[j][i][k]=(dp[j][i][k]+dp[j][l][k])%MOD;
					for(int l=0;l<i-1;l++)	dp[j][k][i]=(dp[j][k][i]+dp[j][k][l])%MOD;
					for(int l=0;l<i-1;l++)	dp[k][i][j]=(dp[k][i][j]+dp[k][l][j])%MOD;
					for(int l=0;l<i-1;l++)	dp[k][j][i]=(dp[k][j][i]+dp[k][j][l])%MOD;
				}
//				cout<<i<<" "<<j<<" "<<k<<" "<<dp[i][j][k]<<endl;
			}
		}
	}
	int ans=0;
	for(int i=0;i<n;i++)	for(int j=0;j<i;j++){
		ans=(ans+dp[n][i][j])%MOD;
		ans=(ans+dp[n][j][i])%MOD;
		ans=(ans+dp[i][n][j])%MOD;
		ans=(ans+dp[i][j][n])%MOD;
		ans=(ans+dp[j][n][i])%MOD;
		ans=(ans+dp[j][i][n])%MOD;
	}
	ans=(ans+dp[n][0][0]*3)%MOD;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 112728
a,b = map(int,input().split())
p = 2
def gcm(a,b):
    if a < b:
        return gcm(b,a)
    elif b == 0:
        return a
    else:
        return gcm(b,a%b)

g = gcm(a,b)

l = []
while p*p <= g:
    if g % p == 0:
        l.append(p)
        while g % p  == 0:
            g //= p
    p+=1

if g > 1:
    l.append(p)

print(len(l)+1)


Measured memory_bytes: 3064
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn naive(seq: &mut Vec<i64>, cnt: usize) -> usize {
    let n = seq.len();
    for i in 0..cnt {
        seq.sort();
        seq.reverse();
        if seq[0] < n as i64 {
            return i;
        }
        seq[0] -= n as i64;
        for j in 1..n {
            seq[j] += 1;
        }
    }
    cnt
}

fn main() {
    let n = read::<usize>();
    let mut seq = vec![0i64; n];
    for i in 0..n {
        seq[i] = read::<i64>();
    }
    let mut ans = 0;
    ans += naive(&mut seq, 100);
    if seq[n - 1] >= n as i64 {
        for i in 0..n {
            let cnt = std::cmp::max(seq[i] / (n as i64 + 1) - 1, 0);
            ans += (n + 1) * cnt as usize;
            seq[i] -= cnt * (n as i64 + 1);
            assert!(seq[i] >= n as i64);
        }
    }
    ans += naive(&mut seq, 10000);
    // println!("{:?}", seq);
    println!("{}", ans);
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

int main(){
    ll N;
    cin >> N;
    vector<ll> v(N);
    for(int i=0;i<N;i++) cin >> v[i];
    bool f = true;
    for(int i=0;i<N;i++) if(v[i]%2==1) f = false;
    if(!f) cout << "first" << endl;
    else cout << "second" << endl;
    return 0;
}

Measured memory_bytes: 4048
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
	int n,m;
	int p;
	
	while(true){
		std::cin >> n >> m;
		if(n == 0 && m == 0){
			break;
		}
		
		std::vector<int> price;
		for(int i=0; i<n ;++i){
			std::cin >> p;
			price.push_back(p);
		}
		//sort in descending order
		std::sort(price.begin(), price.end(), std::greater<int>());
		
		int i=1; //counter
		int sum=0;
		for(int x : price){
			if(i%m != 0){
				sum += x;
			}
			++i;
		}
		//output
		std::cout << sum << std::endl;
	}
}

Measured memory_bytes: 3044
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define MX              200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int32_t main()
{
   // c_p_c();
    int n; cin>>n;

    double ans=0.0;

    for(int i=0;i<n;++i)
    {
        int x; cin>>x;

        ans += 1.0/x;
    }

    ans = 1.0/ans;

    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

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

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int n,k;
vector<vector<int> > sum_w,sum_b;

int w(int i,int j){
	if(i<0 || j < 0) return 0;
	if(i>=2*k && j>=2*k) return sum_w[2*k-1][2*k-1];
	else if(i>=2*k) return sum_w[2*k-1][j];
	else if(j>=2*k) return sum_w[i][2*k-1];

	return sum_w[i][j];
}
int b(int i,int j){
	if(i<0 || j < 0) return 0;
	if(i>=2*k && j>=2*k) return sum_b[2*k-1][2*k-1];
	else if(i>=2*k) return sum_b[2*k-1][j];
	else if(j>=2*k) return sum_b[i][2*k-1];

	return sum_b[i][j];
}

int main()
{
	cin>>n>>k;
	vector<int> x(n),y(n);
	vector<char> c(n);
	for (int i = 0; i < n; i++)
	{
		cin>>x[i]>>y[i]>>c[i];
	}

	sum_w.resize(2*k,vector<int>(2*k,0)),sum_b.resize(2*k,vector<int>(2*k,0));

	for (int i = 0; i < n; i++)
	{
		x[i] %= 2*k;
		y[i] %= 2*k;
		if(c[i]=='W') sum_w[x[i]][y[i]]++;
		else sum_b[x[i]][y[i]]++;
	}
	for (int i = 0; i < 2*k; i++)
	{
		for (int j = 1; j < 2*k; j++)
		{
			sum_w[i][j]+=sum_w[i][j-1];
			sum_b[i][j]+=sum_b[i][j-1];
		}
	}
	for (int i = 1; i < 2*k; i++)
	{
		for (int j = 0; j < 2*k; j++)
		{
			sum_w[i][j]+=sum_w[i-1][j];
			sum_b[i][j]+=sum_b[i-1][j];
		}
	}

	int ans = 0;
	for (int i = 0; i < k; i++)
	{
		for (int j = 0; j < k; j++)
		{
			int num_w=0,num_b=0;
			num_w = w(i,j) - w(i-k,j) - w(i,j-k) + w(i-k,j-k);
			num_w += w(i+2*k,j+2*k) - w(i+k,j+2*k) - w(i+2*k,j+k) + w(i+k,j+k);
			num_w += w(i,j+2*k) - w(i-k,j+2*k) - w(i,j+k) + w(i-k,j+k);
			num_w += w(i+2*k,j) - w(i+2*k,j-k) - w(i+k,j) + w(i+k,j-k);
			num_w += w(i+k,j+k) - w(i,j+k) - w(i+k,j)+w(i,j);

			num_b = b(i+k,j) - b(i,j) - b(i,j-k) + b(i,j-k);
			num_b += b(i,j+k) - b(i-k,j+k) - b(i,j) + b(i-k,j);
			num_b += b(i+k,j+2*k) - b(i,j+2*k) - b(i+k,j+k) + b(i,j+k);
			num_b += b(i+2*k,j+k) - b(i+2*k,j) - b(i+k,j+k) + b(i+k,j);
			ans = max(ans,max(num_w+num_b,max(0,n-(num_w+num_b))));
			// ans = max(ans,num_w+num_b);
			// cout<<num_w+num_b<<endl;
		}
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 32512
def main():
    x, y = map(int, input().split())
    groups = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11]]
    for group in groups:
        if x in group and y in group:
            print("Yes")
            break
    else:
        print("No")


if __name__ == '__main__':
    main()



Measured memory_bytes: 2940
#include <iostream>
#include<iomanip>
#include<math.h>
using namespace std;
int main(void){
    double r;
    cin>>r;
    double S,R;
    S = (M_PI)*r*r;
    R = 2*(M_PI)*r;
    std::cout<<std::setprecision(15)<<S<<" "<<std::setprecision(15)<<R<<endl;
    
}



Measured memory_bytes: 3284
# -*- coding: utf-8 -*-

import sys
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)

N = INT()
A = LIST()

l = 1
for a in A:
    l = lcm(l, a)
l %= MOD

B = [0] * N
for i, a in enumerate(A):
    B[i] = fermat(l, a, MOD)

ans = 0
for b in B:
    ans += b
    ans %= MOD
print(ans)


Measured memory_bytes: 68696
#include<iostream>
using namespace std;
int main()
{
	long long int n,i,l;
	string str;
	cin >> n;
	cin >> str;
	l=str.length();
	if(n%26!=0)
	{
		for(i=0;i<l;i++)
		{
			str[i]=(str[i]+n);
			if(str[i]>'Z')
				str[i]=str[i]-26;
		}
	}
	cout << str << endl;
	return 0;
}

Measured memory_bytes: 256
#include <assert.h>
#include <math.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cout << i << "\n"

const int INF = 100000000;
const ll MOD = 1000000007;

ll pow_mod(ll x, ll y, ll mod) {
  if (y == 0) return 1;
  if (y % 2) {
    return (x * pow_mod(x, y - 1, mod)) % mod;
  } else {
    return pow_mod(x * x, y / 2, mod);
  }
}

ll dp[100010][13] = {0};

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  std::string s;
  std::cin >> s;
  if (s[0] != '?') {
    dp[0][s[0] - '0'] = 1;
  } else {
    rep(i, 0, 10) dp[0][i] = 1;
  }

  rep(i, 1, s.size()) {
    if (s[i] != '?') {
      rep(j, 0, 13) {
        dp[i][((10 * j) + (s[i] - '0')) % 13] += dp[i - 1][j];
        dp[i][((10 * j) + (s[i] - '0')) % 13] %= MOD;
      }
    } else {
      rep(j, 0, 13) {
        rep(k, 0, 10) {
          dp[i][((10 * j) + k) % 13] += dp[i - 1][j];
          dp[i][((10 * j) + k) % 13] %= MOD;
        }
      }
    }
  }

  std::cout << dp[s.size() - 1][5];
  return 0;
}

Measured memory_bytes: 10604
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(void){
	int lop2,fg=0;
	string s;
	string moji={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
	
	cin>>s;
	
	for(int lop=0;lop<26;lop++){
		lop2=0;
		while(s[lop2]!='\0'){
			if(s[lop2]==moji[lop]){
				fg=1;
				break;
			}
			lop2++;
		}
		if(fg==0){
			cout<<moji[lop]<<endl;
			return 0;
		}else{
			fg=0;
		}
	}
	
	cout<<"None"<<endl;
	
	
	return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/nikkei2019-2-qual/tasks/nikkei2019_2_qual_d>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int N,M; cin >> N >> M;
    vector<vector<pll>> G(N);
    vector<int> imos(N+1);
    for(int i = 0; i < M;i++){
        int L,R,C; cin >> L >> R >> C;
        L--; R--;
        G[L].push_back(pll(R,C));
        
        imos[L]++;
        imos[R]--;
    }
    for(int i = 0; i < N;i++){
        imos[i+1] += imos[i];
    }
    
    for(int i = 0; i < N;i++){
        if(imos[i]) G[i+1].push_back(pll(i,0));
    }
    vector<ll> dist(N,LINF);
    priority_queue<pll> pq;
    pq.push(pll(0,0));
    dist[0] = 0;
    while(pq.size()){
        ll cost,n;
        tie(cost,n) = pq.top(); pq.pop();
        if(dist[n] < cost) continue;
        for(auto p:G[n]){
            if(dist[p.first] > dist[n] + p.second){
                dist[p.first] = dist[n] + p.second;
                pq.push(pll(-dist[p.first],p.first));
            }
        }
    }
    res = dist[N-1];
    if(res == LINF) res = -1;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


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

using ll = long long;
#define f(i,a,b) for (int i = a; i < b; i++)

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	clock_t start = clock();
#endif

	int n; ll x;
	cin>>n>>x;

	int a[n];
	f(i,0,n) cin>>a[i];
	sort(a,a+n);
	int i = 0;
	while (i<n&&a[i]<=x)
		x-=a[i++];
	cout << i-(i==n&&x>0) << endl;

#ifdef LOCAL
	cout << setprecision(12) << (long double)(clock()-start) / CLOCKS_PER_SEC << endl;
#endif
	
	return 0;
}



Measured memory_bytes: 256
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debugg cout<<"debugged\n";
#define setpr(xval) cout<<fixed<<setprecision(12)<<xval<<endl;
#define minval -2e9
#define maxval 2e9
long double PI =3.14159265358979323846;
 
const ll M=1e9+7;
const ll inf=1e18;
const ll ms=2e5+5;
fast;
ll N,A,B,C,D,E;
void solve()
{
	cin >> N >> A >> B >> C >> D >> E;
	cout << max({ (N - 1) / A, (N - 1) / B, (N - 1) / C, (N - 1) / D, (N - 1) / E }) + 5 << endl;
}

int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    //int t;cin>>t;while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{

    int i,n,sum[300005],ans;
    char a[300005];
    memset(sum,0,sizeof(sum));
    scanf("%d%s",&n,a);
    for(i=1;i<n;i++)
        if(a[i]=='E')
            sum[0]++;
    ans=sum[0];
    for(i=1;i<n;i++)
    {
        if(a[i]=='E'&&a[i-1]=='E')
            sum[i]=sum[i-1]-1;
        else if(a[i]=='E'&&a[i-1]=='W')
            sum[i]=sum[i-1];
        else if(a[i]=='W'&&a[i-1]=='E')
            sum[i]=sum[i-1];
        else
            sum[i]=sum[i-1]+1;
        if(sum[i]<ans) ans=sum[i];
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>

int main() {
    long x[2], y[2];

    for(int i = 0; i < 2; ++i) {
        std::cin >> x[i];
    }

    for(int i = 0; i < 2; ++i) {
        std::cin >> y[i];
    }

    long long p = -1e18;

    for(int i = 0; i < 2; ++i) {
        for(int j = 0; j < 2; ++j) {
            if(x[i] * y[j] > p) {
                p = x[i] * y[j];
            }
        }
    }

    std::cout << p << "\n";
}

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

int main() {
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;

  int sum = a1 + a2 + a3;
  if(sum<22){
    cout << "win" << endl;
  }else{
    cout << "bust" << endl;
  }

}

Measured memory_bytes: 256
import collections
def input_int_list():
    return [int(thing) for thing in input().split(" ")]

nCr = {}

def nC2(n):
    if n in nCr:
        return nCr[n]
    else:
        val=n*(n-1)//2
        nCr[n]=val
        return val



N=int(input())
A_list=input_int_list()
int_count=collections.Counter(A_list)
the_sum=sum([nC2(int_count[i]) for i in int_count])
for i in range(N):
    number=A_list[i]
    c=int_count[number]
    print(the_sum-c+1)

Measured memory_bytes: 26772
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--) 
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();
//16:13

int main(){
  string c[3];
    REP(i,3){
    cin>>c[i];
  }
  string s=c[0].substr(0,1)+c[1].substr(1,1)+c[2].substr(2,1);
  cout<<s<<endl;

}

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

int gcd(int a, int b) {
    if (b == 0)
        return a;

    return gcd(b, a % b);
}

int main(){
  int K;
  cin>>K;
  int sum=0;
  for(int a=1;a<=K;a++){
    for(int b=1;b<=K;b++){
      for(int c=1;c<=K;c++){
        sum+=gcd(gcd(a,b),c);
      
      }
    }
  }
  cout<<sum<<endl;      
  
  
}
   

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;
#define int long long
int a[212345];
int pos[212345];
signed main(){

  int n;
  cin>>n;
  rep(i,n){
    cin>>a[i];
    pos[a[i]]=i;
  }
  set<int> s;
  s.insert(-1);
  s.insert(n);
  int ans=0;

  for(int i=1;i<=n;i++){
    s.insert(pos[i]);
    auto it = s.find(pos[i]);
    --it;
    int left = *it;
    ++it;
    ++it;
    int right  = *it;
    ans+=i*(pos[i]-left)*(right-pos[i]);
  }
  cout<<ans<<endl;


}


Measured memory_bytes: 12800
#include <stdio.h>

int main (void) {
    int a, b, k;
    scanf("%d%d%d", &a, &b, &k);

    int min = (a < b)? a : b;
    int ans[min];
    int i, cnt = 0;
    for (i = 1; i <= min; i++) {
        if ( a % i == 0 && b % i == 0 ) {
            ans[cnt] = i;
            cnt++;
        }
    }

    printf("%d\n", ans[cnt - k]);
    return 0;
}

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

int main() {
  int n; cin >> n;
  cout << (n + 1) / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
s = input()
t = input()
ls = len(s)
lt = len(t)
D = {}
for i, item in enumerate(s):
    try:
        D[item].append(i)
    except:
        D[item] = [i]

for i in D.keys():
    # print(D[i][0])
    D[i].append(D[i][0] + ls)

# print(D)

import bisect

def e():
    ans = 0
    ind = -1
    for i in range(lt):
        try:
            L = D[t[i]]
            # print(L)
            bs = L[bisect.bisect_right(L, ind)]
            # print(ans,bs,ind)
            ans += bs - ind
            ind = bs % ls
        except:
            return -1
    return ans

print(e())

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

struct node {
  int num;
  struct node *next,*first;
};

struct node *nil;

struct node* listsearch(int);
void initem();
void print();
void deletenode(struct node *);
void deleteFirst();
void deleteLast();
void deletenum();
void insert(int);

struct node* listsearch(int num)
{
  struct node *x = nil->next;
  while(x != nil && x->num != num) {
    x = x->next;
  }
  return x;
}

void initem()
{
  nil = (struct node*)malloc(sizeof(struct node));
  nil->next = nil;
  nil->first = nil;
}

void print()
{
  int isfirst = 0;
  struct node *y = nil->next;

  while(1) {
    if(y == nil)
      break;
    if(isfirst++ > 0)
      printf(" ");
    printf("%d",y->num);
    y = y->next;
  }
  printf("\n");
}

void deletenode(struct node *z)
{
  if(z == nil)
    return;
  z->first->next = z->next;
  z->next->first =  z->first;
  free(z);
}

void deleteFirst()
{
  deletenode(nil->next);
}

void deleteLast()
{
  deletenode(nil->first);
}

void deletenum(int num)
{
  deletenode(listsearch(num));
}

void insert(int num)
{
  struct node *r = (struct node*)malloc(sizeof(struct node));
  r->num = num;
  r->next = nil->next;
  nil->next->first = r;
  nil->next = r;
  r->first = nil;
}

int main()
{
  int n,i,num;
  int size=0,a=0,b=0;
  char rei[20];

  scanf("%d",&n);
  initem();
 
  for(i=0;i<n;i++) {
    scanf("%s%d",rei,&num);
    if(rei[0] == 'i') {
      insert(num);
      a++;
      size++;
    }else if(rei[0] == 'd') {
      if(strlen(rei) > 6) {
	if(rei[6] == 'F') 
	  deleteFirst();
	  else if(rei[6] == 'L')
	  deleteLast();
	}else{
	  deletenum(num);
	  b++;
      }
      size--;
    }
  }

  print();

  return 0;
}



Measured memory_bytes: 32992
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <ctime>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll n; cin >> n;
	vl a(n); rep(i,n) cin >> a[i];
	ll ans = 0;
	vl bit(60,0);
	rep(i,n){
		rep(j,60){
			if(a[i]>>j & 1){
				ans += (1LL<<j) % mod * (i-bit[j]);
				bit[j]++;
			}else{
				ans += (1LL<<j) % mod * bit[j];
			}
			ans %= mod;
		}
	}
	cout << ans << endl;
}

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

int main(){
  //ifstream in("input.txt");
  //cin.rdbuf(in.rdbuf());

  string S;
  cin>>S;

  int check=0;
  if(S.size()>=2){
    for(int i=1;i<S.size();i++){
      if(S.at(i)=='9') check++;
    }
  }
  //cout<<check<<endl;

  if(check==S.size()-1){
    cout<<(S.at(0)-48)+(S.size()-1)*9<<endl;
  }else{
    cout<<(S.at(0)-48-1)+(S.size()-1)*9<<endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  int ans;
  cin >> a >> b;
  if (a < b) ans = min(b - a, abs(a + b) + 1);
  else ans = min(a - b + 2, abs(a + b) + 1);
  cout << ans << endl;
}

Measured memory_bytes: 256
n,k = gets.split.map(&:to_i)
h = Array.new
c = 0
x = 0
ans = 1000000000

n.times do
	h << gets.to_i
end

h.sort!

(n-k+1).times do
	x = h[c+k-1] - h[c]
	ans = x if x < ans
	c += 1
end

puts ans

Measured memory_bytes: 4016
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <stack>
#include <cstring>
 
#define ll long long
#define MP make_pair
#define PB push_back
#define P push
#define f first
#define se second
#define S size()
#define B begin()
#define E end()
#define rB rbegin()
#define rE rend()
#define PI acos(-1)

 
const int N = 1e5 + 100;
const int M = 1e6 + 100;
const ll oo = 1e18;
 
ll n, m, k, t, q, h, a, b, d, c, e, w, x, y, z;
using namespace std;

int ar[101], dp[N];

int main() {

	cin >> n >> k;
	for(int i = 0; i < n; i++)
		cin >> ar[i];


	sort(ar, ar + n);

	int x = ar[0];

	dp[0] = 2;

	for(int x, i = 1; i <= k; i++) {
		dp[i] = 2;
		for(int j = 0; j < n; j++) {
			if(ar[j] > i) continue;
			if(dp[i - ar[j]] == 2) dp[i] = 1;
				
		}
	}

	// for(int i = 0; i <= k; i++){
	// 	cout << i << " " << dp[i] << endl;
	// }


	if(dp[k] == 1) puts("First");
	else puts("Second");


    return 0;
}




Measured memory_bytes: 640
import numpy as np

h,w = map(int,(input().split()))
s = [list(map(str,input())) for i in range(h)]
l = [[0]*(w+2) for i in range(h+2)]


def addFlag(i,j):
    for x in range(3):
        for y in range(3):
            if l[i+x][j+y] != '#':
                l[i+x][j+y] += 1
                
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            l[i+1][j+1] = '#'
            addFlag(i,j)

l = np.delete(l,[0,h+1],0)
l = np.delete(l,[0,w+1],1)


for i in l:
    ans = ''.join(map(str,i))
    print(ans)

Measured memory_bytes: 27164
#include <stdio.h>

int main(void) {
  char s[100000];
  char alphabet[26];
  int i, j;

  for(i = 0; i < 26; i++) {
    alphabet[i] = 'a' + i;
  }

  for(i = 0; i < 100000; i++) {
    s[i] = 0;
  }

  scanf("%s", s);

  i = 0;
  while(s[i] != 0) {
    for(j = 0; j < 26; j++) {
      if(s[i] == alphabet[j]) {
	alphabet[j] = 0;
	break;
      }
    }
    i++;
  }

  for(i = 0; i < 26; i++) {
    if(alphabet[i] != 0) {
      printf("%c\n", alphabet[i]);
      return(0);
    }
  }

  printf("None\n");

  return(0);
}

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

int main() {
    ll a,ans;
    string s;
    cin>>a>>s;
    rep(i,s.size()){
        if(i==0)ans+=100*(s[i]-'0');
        if(i==2)ans+=10*(s[i]-'0');
        if(i==3)ans+=(s[i]-'0');
    }
    ans*=a;
    printf("%lld\n",ans/100);
}

Measured memory_bytes: 3724
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n;
    cin >> n;

    if (n >= 30) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>

#define N 100

int main(){

  int i,j,k,n,u,v,Adj[N][N];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      Adj[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
   
      Adj[u-1][v-1]=1;
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n-1;j++){
      printf("%d",Adj[i][j]);
      if(j<n) printf(" ");
    }
    printf("%d",Adj[i][j]);
    printf("\n");
  }

  return 0;
  
}

Measured memory_bytes: 636
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var ar []int
var br []bool
var g map[int][]int
var qr []int

func main() {
	sc.Split(bufio.ScanWords)
	n, q := ri(), ri()
	g = map[int][]int{}
	for i := 1; i < n; i++ {
		a, b := ri(), ri()
		g[a] = append(g[a], b)
		g[b] = append(g[b], a)
	}
	qr = make([]int, n+1)
	for i := 0; i < q; i++ {
		p, x := ri(), ri()
		qr[p] += x
	}
	ar = make([]int, n+1)
	br = make([]bool, n+1)
	dfs(1, 0)
	ans := fmt.Sprint(ar)
	fmt.Println(ans[3 : len(ans)-1])
}

func dfs(key, sum int) {
	if br[key] {
		return
	}
	br[key] = true
	sum += qr[key]
	ar[key] = sum
	ret := g[key]
	for _, v := range ret {
		dfs(v, sum)
	}
}

var sc = bufio.NewScanner(os.Stdin)

func ri() int {
	sc.Scan()
	s := sc.Text()
	a, _ := strconv.Atoi(s)
	return a
}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  int n, a; cin >> n >> a;
  vector<int> x(n);
  rep(i, n) cin >> x[i];
  rep(i, n) x[i] -= a;

  const int SUM_MAX = 2510;
  vector<vector<ll>> dp(n+1, vector<ll>(SUM_MAX*2, 0));

  dp[0][SUM_MAX] = 1;
  rep(i, n) {
    for(int sum = 0; sum < 2*SUM_MAX; ++sum) {
      if(0 <= sum+x[i] && sum+x[i] < SUM_MAX*2) dp[i+1][sum+x[i]] += dp[i][sum];
      dp[i+1][sum] += dp[i][sum];
    }
  }
  cout << dp[n][SUM_MAX] - 1 << endl;
}


Measured memory_bytes: 5332
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
  
int main()
{
  int H, W;
  cin >> H >> W;

  vector<string> A(H);
  REP(i, H) cin >> A[i];
  
  
  int x[] = {1,0,-1,0};
  int y[] = {0,1,0,-1};

  int flag = 0;
  REP(i,H){
    REP(j,W){
      if(A.at(i).at(j)=='#'){
        int flag2 = 0; 
        REP(k,4){
          if(j+x[k]<0||i+y[k]<0||j+x[k]>=W||i+y[k]>=H){
            continue;
          }
          if(A.at(i+y[k]).at(j+x[k])=='#'){
            flag2 = 1;
          }
        }
        if(flag2 == 0){
          flag = 1;
        }
      }
    }
  }

  if(flag == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main() {
    int N, p;
    vector<int> prices;
    cin >> N;
    for (int i=0; i<N; i++){
        cin >> p;
        prices.push_back(p);
    }
    sort(prices.begin(), prices.end());
    int res = accumulate(prices.begin(), prices.end() - 1, 0);
    cout << res + (int)(prices.back() / 2) << endl;

}

Measured memory_bytes: 256
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<char> Vc;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<char>> VVc;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgset(st) cerr << #st << ":"<<endl; for (auto i = st.begin(); i != st.end(); ++i) { cerr << *i <<" ";}cerr<<endl;
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#else
#define dbg(...)
#define dbgmap(...)
#define dbgset(...)
#define dbgarr(...)
#define dbgdp(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    ll n, m;
    cin>>n>>m;
    ll tm = m*1900+ (n-m)*100;
    out(tm*pow(2,m));
    return  0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);
//    ll T;
//    cin>>T;
//    while(T--)
    solve();
}


Measured memory_bytes: 4172
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime>

using namespace std;

bool is_prime[70001];

void sieve(int n){
	int p=0;
	int i,j;
	for(i=0;i<=n;i++)is_prime[i]=true;
	is_prime[0]=is_prime[1]=false;
	for(i=2;i<=n;i++){
		//is_prime[i]==true時
		if(is_prime[i]){
			for(j=2*i;j<=n;j+=i)is_prime[j]=false;
		}
	}
}

int main(void){
	sieve(70000);
	int a,b;
	bool ch=true;
	while(~scanf("%d",&a)){
		ch=true;
		b=a;
		while(ch){
			b--;
			if(is_prime[b]){
				printf("%d ",b);
				ch=false;
			}
		}
		ch=true;
		b=a;
		while(ch){
			b++;
			if(is_prime[b]){
				printf("%d\n",b);
				ch=false;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int N;
vector<int>g[1000005];
int dist[2][1000000],id;
void dfs(int idx,int par=-1)
{
	if(par!=-1)dist[id][idx]=dist[id][par]+1;
	for(int i=0;i<g[idx].size();i++)
	if(g[idx][i]!=par)dfs(g[idx][i],idx);
}
int main()
{
	cin>>N;
	for(int i=0;i<N-1;i++)
	{
		int a,b;
		cin>>a>>b;
		a--;b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	id=0;
	dfs(0);
	id=1;
	dfs(N-1);
	int ret=0;
	for(int i=0;i<N;i++)
	if(dist[0][i]<=dist[1][i])ret++;
	if(ret>=N/2+1)cout<<"Fennec";
	else cout<<"Snuke";
	cout<<endl;
	return 0;
}


Measured memory_bytes: 37632
from math import factorial

def cc(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

n, k= list(map(int, input().split()))

if n == k:
    for i in range(k):
        if i == 0:
            cnt = 1
        else:
            cnt = 0
        print(cnt % (10 ** 9 + 7))

else:
    for i in range(k):
        j = i + 1
        if j > n-k+1:
            cnt = 0
        else:
            cnt = cc(n-k+1, j) * cc(k-1, j-1)


        print(cnt % (10**9 + 7))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
 
const long double pi=3.14159265359;
 
int main()
{
 int t=1,n;
 //cin>>t;
 while(t--)
 {double r;
  cin>>r;
  cout<<2*pi*r;
//   printf()
 }
 return 0;
}

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

int main()
{
	int a,b,c,d,i=0;
  cin>>a>>b>>c>>d;
  while((a>0)&&(c>0))
  {
    if(i%2==0)
      c-=b;
    else
      a-=d;
    i++;
  }
  if(c<=0)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}


Measured memory_bytes: 3636
n=int(input())
w=[input() for i in range(n)]
a=0
for i in range(1,n):  
  if w[i-1][-1] == w[i][0]:
    if w[i] not in w[:i]:
      a=a
    else:
      a+=1
  else:
    a+=1
if a==0:print("Yes")
else:print("No")


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

int main()
{
    #define int long long
    int n,w;
    cin>>n>>w;
    int a[n+1][w+1];
   
    int x[n+1],y[n+1];
    for(int i=0;i<n;i++)
    {
        cin>>x[i]>>y[i];
    }
    
   for(int i=0;i<=n;i++)
   {
       for(int j=0;j<=w;j++)
       {
           if(i==0 or j==0){a[i][j]=0;}
           else if(j>=x[i-1])a[i][j]=max(a[i-1][j-x[i-1]]+y[i-1],a[i-1][j]);
           else a[i][j]=a[i-1][j];
       }    
     /*  for(int p=0;p<=n;p++)
       {
           for(int q=0;q<=w;q++)
           {
               cout<<a[p][q]<<" ";
           }
           cout<<"\n";
       }*/  
   }
   cout<<a[n][w];
    
}

Measured memory_bytes: 79232
#include<stdio.h>

int main(){
  char S[3];
  int a=0,b=0,c=0;
  scanf("%s",S);
  for(int i=0;i<3;i++){
  if(S[i]=='a')a+=1;
    else if(S[i]=='b')b+=1;
    else if(S[i]=='c')c+=1;
  }
  if((a==1)&&(b==1)&&(c==1))printf("Yes");
  else printf("No");
  return 0;
}

Measured memory_bytes: 128
import math
import collections
import sys

input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]

n,m=MI()
A=LI()
def num2(x):
    ans=0
    while x%2==0:
        x=x//2
        ans+=1
    return ans
mod=2**(num2(A[0]))
for i in range(1,n):
    if A[i]%mod!=0:
        print(0)
        sys.exit()
    if A[i]%mod==0 and (A[i]//mod)%2==0:
        print(0)
        sys.exit()
#print(A)
for i in range(n):
    A[i]//=2
#print(A)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a // gcd(a, b) * b

L=A[0]   
for i in range(1,n):
    L=lcm(L,A[i])
#print(L)
if L>m:
    an=0
else:
    an=int(((m/L)-1)/2)+1
print(an)


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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    vector<int> ans(n), flag(n);
    rep(i, n - 1){
        if(s[i] == 'R' && s[i + 1] == 'L'){
            flag[i] = 1;
            flag[i + 1] = 2;
        }
    }
    rep(i, n){
        if(!flag[i]) ans[i] = 0;
        if(flag[i] == 1){
            ans[i]++; ans[i + 1]++;
            int j = i - 1;
            int memo = 0;
            while(j >= 0){
                if(s[j]=='R')memo++;
                if(s[j]=='L')break;
                j--;
            }
            ans[i] += memo / 2;
            ans[i + 1] += (memo + 1) / 2;
            j = i + 2;
            memo = 0;
            while(j < n){
                if(s[j] == 'L') memo++;
                if(s[j] == 'R') break;
                j++;
            }
            ans[i] += (memo + 1)/2;
            ans[i + 1] += memo / 2;
        }
    }
    rep(i, n - 1)cout << ans[i] << " ";
    cout << ans[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define debug(x) cout << #x << " = " << (x) << endl;
#define pb push_back
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000000000
#define EPS 0.00000000001
typedef long long ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    //---------------------------------------------

    int n;
    cin>>n;
    vector<int> p(n);
    rep(i,n){
        cin>>p[i];
    }
    ll ans=0;
    int renzoku=0;
    rep(i,n){
        if(i+1==p[i]){
            ans++;
            renzoku++;
            if(renzoku==2){
                ans--;
                renzoku=0;
            }
        }
        else{
            renzoku=0;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long int a,b,x;
  cin >> a>> b >> x; 
  long int start = a+( (x-a%x)%x );
  long int end = b-(b%x);
  long int count = (end-start)/x+1;
  cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int adad[5],k,eror=0;
    for(int i=0;i<5;i++){
        cin>>adad[i];
    }
    cin>>k;
    for(int i=0;i<4;i++){
        for(int j=i+1;j<5;j++){
            if(adad[j]-adad[i]>k){
                eror=1;
                break;
            }
        }
        if(eror==1){
            break;
        }
    }
    if(eror==1){
        cout<<":(";
    }
    else{
        cout<<"Yay!";
    }
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve() {
	ll n;
	cin >> n;
	string ans = "";
	while(n) {
		ll k = n / 26;
		ll z = n % 26;
		if(z == 0) {
			ans += (char) 'z';
			k--;
		} else {
			ans += (char) ('a' + z - 1);
		}
		n = k;
	}
	for (int i = ans.size() - 1; i >= 0; i--) {
		cout << ans[i];
	}
	cout << endl;
}
int main()
{
	solve();
	
	return 0;
}

Measured memory_bytes: 3604
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

from datetime import datetime, timedelta

a, b = list(map(int, sys.stdin.buffer.readline().split()))
dt = datetime(2018, 1, 1)
until = datetime(2018, a, b)
cnt = 0
while dt <= until:
    if dt.month == dt.day:
        cnt += 1
    dt += timedelta(days=1)
print(cnt)


Measured memory_bytes: 14132