akhauriyash/Code-Regression huggingface dataset:
// created_by  Rishi_Mohan

#include<bits/stdc++.h>

#define    ll           long long
#define    db1(x)       cout<<#x<<"="<<x<<'\n'
#define    db2(x,y)     cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define    db3(x,y,z)   cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define    rep(i,n)     for(int i=0;i<(n);++i)
#define    repA(i,a,n)  for(int i=a;i<=(n);++i)
#define    repD(i,a,n)  for(int i=a;i>=(n);--i)

using namespace std;

void solve()
{
   int n;
   cin >> n;
   map<int,int>mp;
   for(int i=1;i<=n;i++)
   {
   	mp[i]=0;
   }
   for(int i=1;i<n;i++)
   {
	   	int x;
	   	cin >> x;
	   	mp[x]++;
   }
   int j=1;
   for(auto it=mp.begin(); it!=mp.end() ;it++)
   {
   	   if(it->first == j)
       cout << it->second << endl;
       else cout << "0" << endl;
       j++;
   }
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}

Measured memory_bytes: 12996
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  for(int i = 0; i < n; i++){
      if(s[i] != t[i]){
          cout << "No" << endl;
          return 0;
      }  
     
  }
  
  cout << "Yes" << endl;
  
 
  
}



Measured memory_bytes: 3624
# 2019/05/07
# AtCoder Beginner Contest 051 - B

k, s = map(int, input().split())

cnt = 0
for i in range(k+1):
    for j in range(k+1):
        ws = s - i - j
        if ws >= 0 and ws <= k:
            cnt += 1

print(cnt)


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

int main(){
  int x, y, direction, val;
  string str;
  int dx[] = {0,1,0,-1}, dy[] = {1,0,-1,0};
  while(cin >> x >> y && x != 0){
    cin >> str;
    int i = 1, j = 1; direction = 0;
    while(str.compare("STOP") != 0){
      if(str.compare("RIGHT") == 0)
	direction = (direction+1)%4;
      else if(str.compare("LEFT") == 0)
	direction = (direction+3)%4;
      else if(str.compare("FORWARD") == 0 || str.compare("BACKWARD") == 0){
	cin >> val;
	if(str.compare("BACKWARD") == 0){
	  i -= val*dx[direction];
	  j -= val*dy[direction];
	}
	else{
	  i += val*dx[direction];
	  j += val*dy[direction];
	}
	if(i<1) i=1;
	if(i>x) i=x;
	if(j<1) j=1;
	if(j>y) j=y;
      }
      cin >> str;
    }
    cout << i << " " << j << endl;
  }
  return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int a, b; cin >> a >> b;
    bool ans;
    if((a + b) % 2 == 0) cout << (a + b) / 2 << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,i;
  cin >> n;
  string s1,s2;
  int t=0,h=0;
  
  for(i=0;i<n;i++){
    cin >> s1 >> s2;
    if(s1.compare(s2)==0) {
      t++;h++;
    }else if(s1.compare(s2)>0) t+=3;
    else h+=3;
  }
  cout << t << " " << h << endl;
}


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

int main(){
    string S;
    cin >> S;
    if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) {
        cout << "Bad" << endl;
    } else {
        cout << "Good" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

#include <math.h>
#include<iomanip>
using namespace std;

int main(){
    int n;
  cin >> n;
  int xy[2][n];
  for(int i =0; i < n; i ++){
    cin >> xy[0][i] >> xy[1][i];
  }
  double sum = 0;
  for(int i = 0; i < n ; i++){
    for(int j = 0; j <n; j++){
    	sum += sqrt((xy[0][i]-xy[0][j])*(xy[0][i]-xy[0][j])+(xy[1][i]-xy[1][j])*(xy[1][i]-xy[1][j]));
    }
  }
  cout<<std::setprecision(10)<<std::fixed<< sum/n;
  return 0;
}
  

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
typedef long long ll;
int main(){
    ll Q,H,S,D;
    ll N;
    cin >> Q >> H >> S >> D >> N;
    ll min1 = min(min(4*Q,2*H),S);
    ll ans;
    if(2*min1 <= D) ans = min1*N;
    else ans = D*(N/2) + min1*(N%2);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,a,b,arr[10000],max,min;
    //set<int>s;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    max=-1;
    for(int i=0;i<n;i++)
    {
        if(arr[i]>max) max=arr[i];
    }
    min=1000000000;
    for(int i=0;i<n;i++)
    {
        if(arr[i]<min) min=arr[i];
    }
    b=max-min;
    cout<<b<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <deque>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <complex>
#include <cstring>
#include <iomanip>
#include <bitset>

using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, a, b) for(int i = (a); i > (b); i--)
#define forIt(it, a) for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define forRev(it, a) for(__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define ft(a) __typeof((a).begin())
#define ll long long
#define ld long double
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define bitcount(n) __builtin_popcountll(n)


typedef complex<ld> cplex;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef pair<ll, ll> pll;

const int N = 1000 + 7;
const int M = 30;
const int inf = 1e9 + 7;
const long long linf = (ll) inf * inf + 7;
const double pi = acos(-1);
const double eps = 1e-20;
const bool multipleTest = false;

int n;
int a[N];

ll sqr(ll x) {
    return x * x;
}

void solve() {
    cin >> n;
    for(int i = 0; i < n; ++i) {
        scanf("%d", a + i);
    }
    sort(a, a + n);
    ll cost = linf;
    int res = a[0];
    
    for(int i = a[0]; i <= a[n - 1]; ++i) {
        ll cur = 0;
        for(int j = 0; j < n; ++j)
            cur += sqr(a[j] - i);
        //cout << i << ' ' << cost << "\n";
        if (cur < cost) {
            cost = cur;
            res = i;
        }
    }
    
    cout << cost;
    
}

int main() {
//#ifndef ONLINE_JUDGE
//    freopen("in.txt", "r", stdin);
//    auto t1 = clock();
//#endif
    
    
    int Test = 1;
    if (multipleTest) {
        cin >> Test;
    }
    
    for(int i = 0; i < Test; ++i) {
        solve();
    }
    
//#ifndef ONLINE_JUDGE
//    printf("\n%.9lf\n", (0.0 + clock() - t1) / CLOCKS_PER_SEC);
//#endif
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
// ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
ll powMod(ll x, ll k, ll m) {//x^k (mod n)
	if (k == 0)     return 1;
	if (k % 2 == 0) return powMod(x*x % m, k/2, m);
	else            return x*powMod(x, k-1, m) % m;
}
int N;
int cnt[114514]={0};
int main(){
	cin>>N;
	cout<<N*N*N<<endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

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

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

int main() {
  cout << setprecision(10);
  long long N;
  scanf("%lld", &N);
  std::vector<long long> P(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &P[i]);
  }

  bool ok = true;
  for (int i = 0; i < N; i++) {
    if (P[i] % 2 == 0 && P[i] % 3 != 0 && P[i] % 5 != 0) ok = false;
  }
  cout << ((ok) ? "APPROVED" : "DENIED") << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <deque>
#include <queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <iomanip>
#include <utility>
#include <functional>
using namespace std;
//orz hxr
#define ll long long
#define ull unsigned ll
const int dx[4]={0, 0, 1, -1};
const int dy[4]={1, -1, 0, 0};
int n, m, k;
int used[805][805];
char a[805][805];
queue<pair<pair<int, int>, int> > q;
int main() {
	cin>>n>>m>>k;
	for (int i=0; i<n; i++) {
		cin>>a[i];
		for (int j=0; j<m; j++)
			if (a[i][j]=='S') {
				a[i][j]='.';
				q.push(make_pair(make_pair(i, j), 0));
				used[i][j]=1;
			}
	}
	while (!q.empty()) {
		int x, y, d;
		x=q.front().first.first, y=q.front().first.second, d=q.front().second;
		q.pop();
		if (!x||!y||x==n-1||y==m-1) {
			cout<<1<<endl;
			return 0;
		}
		if (d==k)
			continue;
		for (int i=0; i<4; i++) {
			int nx=x+dx[i], ny=y+dy[i];
			if (nx>=0&&ny>=0&&nx<n&&ny<m&&a[nx][ny]=='.'&&!used[nx][ny]) {
				q.push(make_pair(make_pair(nx, ny), d+1));
				used[nx][ny]=1;
			}
		}
	}
	int ans=1000000000;
	for (int i=0; i<n; i++) {
		for (int j=0; j<m; j++) {
			if (used[i][j]) {
				ans=min(ans, (min(min(i, j), min(n-i-1, m-j-1))+k-1)/k);
			}
		}
	}
	cout<<ans+1<<endl;
	return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
#include<iostream>
#include<set>
#define ll long long
using namespace std;
double a[1000000]={0};
int main(){
    int t;
    cin>>t;
    for(int i=0;i<t;i++){
        cin >>a[i];
    }
    sort(a,a+t);
    double sum=0;
    sum = (a[0]+a[1])/2;
    for(int i=2;i<t;i++){
        sum = (sum+a[i])/2;
    }
    cout<<sum<<endl;
     return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
        int n;
        scanf("%d",&n);

        int h[n],i;
        for(i=0; i<n; i++)
                scanf("%d",&h[i]);

        int max=0;
        int count=0;

        for(i=0; i<n; i++){
                if(h[i] >= max){
                        count++;
                        max =  h[i];
                }
        }

        printf("%d\n",count);
        return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int f[123456];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    f[x]++;
  }
  int maxx = 0;
  for (int i = 1; i <= 100000; i++) {
    maxx = max(maxx, f[i - 1] + f[i] + f[i + 1]);
  }
  printf("%d\n", maxx);
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
char s[1005]; int h, w, c[26], cnt1, cnt2;
int main(){
	scanf( "%d%d", &h, &w );
	for( int i = 1; i <= h; i++ ){
		scanf( "%s", s );
		for( int j = 0; j < w; j++ ) c[s[j]-'a']++;
	}
	for( int i = 0; i <  26; i++ ){
		if( c[i] & 1 ) cnt1++;
		c[i] -= c[i]%2;
		if( c[i] % 4 == 2 ) cnt2++;
	}
	int cnt3 = ( h * w ) & 1, cnt4 = h % 2 * (w/2) + w % 2 * (h/2);
	if( cnt1 != cnt3 || cnt2 > cnt4 || ( cnt4 - cnt2 ) % 2 ) puts("No");
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pil pair<int,along long>
#define pli pair<long long,int>
#define pll pair<long long,long long>
#define pb push_back
#define mk make_pair
#define eps 1e-12
#define maxn 100009
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	int a[2*n];
	for(int i=0;i<2*n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+2*n);
	int ans=0;
	for(int i=0;i<2*n;i=i+2)
	{
		ans=ans+a[i];
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<double, double >pd;
typedef pair<string, string> sP;
typedef pair<ll, P> PP;
typedef pair<P, P> PPP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 5e14;
const double eps = 1e-10;
const double PI = acos(-1);
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,-1,-1,0,0,1,1,1 }, ty[8] = { -1,0,1,-1,1,-1,0,1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second

ll h, w;
char c[510][510], red[510][510], blue[510][510];

int main() {
	cin >> h >> w;
	for (int i = 0;i < h;i++) {
		for (int j = 0;j < w;j++) {
			cin >> c[i][j];
		}
	}
	for (int i = 0;i < h;i++) {
		for (int j = 0;j < w;j++) {
			if (i % 2 == 0 && j != w - 1)red[i][j] = '#';
			else if (j == 0 && i % 2 == 1)red[i][j] = '#';
			else if (i % 2 == 1 && c[i][j] == '#')red[i][j] = '#';
			else red[i][j] = '.';
		}
	}

	for (int i = 0;i < h;i++) {
		for (int j = 0;j < w;j++) {
			if (i % 2 == 1 && j != 0)blue[i][j] = '#';
			else if (j == w - 1 && i % 2 == 0)blue[i][j] = '#';
			else if (i % 2 == 0 && c[i][j] == '#')blue[i][j] = '#';
			else blue[i][j] = '.';
		}
	}
	for (int i = 0;i < h;i++) {
		for (int j = 0;j < w;j++) {
			cout << red[i][j];
		}
		cout << endl;
	}
	cout << endl;
	for (int i = 0;i < h;i++) {
		for (int j = 0;j < w;j++) {
			cout << blue[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1536
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        long k = sc.nextLong();
        System.out.println(50);
        long[] ans = new long[50];
        Arrays.fill(ans,49);
        long pow = k/50L;
        long rem = k%50L;
        for(int i = 0; i < 50; i++){
            ans[i] += pow;
        }
        for(int i = 0; i < rem; i++){
            ans[i] += 50;
            for(int j = 0; j < 50; j++){
                if(i == j) continue;
                ans[j]--;
            }
        }
        for(int i = 0; i < 50; i++){
            System.out.print(ans[i] + " ");
        }
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 25352
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long int ima=0,imb=0,wa=0,wb=0,n,m,k,i,x,kotae=0;
  cin>>n>>m>>k;
  long long int a[n+1],b[m+1];
  a[0]=0;
  b[0]=0;
  for(i=1;i<=n;i++){
    cin>>x;
    a[i]=a[i-1]+x;
  }
  for(i=1;i<=m;i++){
    cin>>x;
    b[i]=b[i-1]+x;
  }
  ima=0;
  imb=m;
  for(;ima<=n;ima++){
    for(;imb>=0;imb--){
      if(a[ima]+b[imb]<=k){
        kotae=max(kotae,ima+imb);
        break;
      }
    }
  }
  cout<<kotae;
}

Measured memory_bytes: 6724
def main():
    H,W,K = [int(x) for x in input().split()]

    B = 0
    BH = [0]*H
    BW = [0]*W
    BHW = []
    for h in range(H):
        BHW.append([0]*W)
    for i in range(H):
        C = list(input())
        for j in range(W):
            if C[j] == '#':
                B += 1
                BH[i] += 1
                BW[j] += 1
                BHW[i][j] = 1

    cnt = 0
    for ibit in range(0,1<<H):
        for jbit in range(0,1<<W):
            ib = 0
            jb = 0
            ijb = 0
            for i in range(H):
                if (1<<i) & ibit:
                    ib += BH[i]
            for j in range(W):
                if (1<<j) & jbit:
                    jb += BW[j]
            for i in range(H):
                for j in range(W):
                    if (1<<i) & ibit and (1<<j) & jbit:
                        ijb += BHW[i][j]
            b = B - ib - jb + ijb
            if K == b:
                cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 68256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 10000


int main(){
  int n;
  ll a, b;
  ll ans = LLINF;
  
  scanf("%lld%lld%d",&a,&b,&n);

  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      // i : j

      if(b%j) continue;

      ans = min(abs(a - (b/j)*i),ans);
    }
  }

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

Measured memory_bytes: 3212
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;
using i64 = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
const int INF = (1 << 30);
const i64 INFL = (1LL << 62);
const i64 MOD = 1000000007;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
i64 mod_pow(i64 a, i64 n, T mod) {
  mod = (i64)mod;
  i64 res = 1, p = a % mod;
  while (n) {
    if (n & 1) res = res * p % mod;
    p = p * p % mod;
    n >>= 1;
  }
  return res;
}
void print() { std::cout << std::endl; }
template <typename T, typename... A>
void print(const T& first, const A&... rest) {
  cout << sizeof...(rest) << endl;
  std::cout << first;
  if (sizeof...(rest)) std::cout << " ";
  print(rest...);
}
template <typename... A>
void print(const A&... rest) {
  print(rest...);
}
template <typename A>
void print(const std::vector<A>& v) {
  std::for_each(v.begin(), v.end(), [](A x) { std::cout << x << " "; });
  std::cout << std::endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  i64 n;
  cin >> n;
  vector<i64> l(n);
  rep(i, n) { cin >> l[i]; }
  i64 ans{0};
  sort(all(l));
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      for (int k = j + 1; k < n; ++k) {
        if ((l[i] < l[j] + l[k]) && (l[j] < l[i] + l[k]) &&
            (l[k] < l[j] + l[i])) {
          ++ans;
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {

  int sum = 0;
  int slack = 0;

  for (int i=0; i<5; i++) {
    int time;
    std::cin >> time;
    int rem = time % 10;

    if (rem == 0) {
      sum += time;
    } else {
      sum += time - rem + 10;
      slack = std::max(slack, 10-rem);
    }
  }

  std::cout << sum-slack << std::endl;

  return 0;
}


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

int h, w;
string s[50];

int main() {
	int i, j, di, dj;
	
	cin >> h >> w;
	for (i = 0; i < h; i++) cin >> s[i];
	
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			if (s[i][j] == '#') { cout << '#'; continue; }
			
			int cnt = 0;
			for (di = -1; di <= 1; di++) {
				for (dj = -1; dj <= 1; dj++) {
					if (0 <= i + di && i + di < h && 0 <= j + dj && j + dj < w && s[i + di][j + dj] == '#') {
						cnt++;
					}
				}
			}
			cout << cnt;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 888
// Contest: AtCoder Beginner Contest 153 (https://atcoder.jp/contests/abc153)
// Problem: D: Caracal vs Monster (https://atcoder.jp/contests/abc153/tasks/abc153_d)


// region {{{ boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cpp_lib_nonmember_container_access >= 201411
#   define sz(x) ((int)size(x))
#else
#   define sz(x) ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define all(a)         (a).begin(),(a).end()
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __has_cpp_attribute(maybe_unused) >= 201603
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18;
//endregion }}}

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

    ll h; cin >> h;
    ll c = 1;
    ll r = 0;

    while (h > 1) {
        r += c;
        c *= 2;
        h /= 2;
    }

    cout << (r + c) << '\n';

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
    	int C = sc.nextInt();
    	int count = 0;
    	if (A == B && B == C && A%2 == 0) {
    		System.out.println(-1);
    	} else {
        	while (A%2 == 0 && B%2 == 0 && C%2 == 0) {
        		int a = A;
        		int b = B;
        		int c = C;
        		A = b/2 + c/2;
        		B = a/2 + c/2;
        		C = a/2 + b/2;
        		count++;
        	}
        	System.out.println(count);
    	}
    }
}

Measured memory_bytes: 23508
a=gets.chomp.split("")
b=gets.chomp.to_i
an=true
b.times do 
  c=gets.chomp.split
  if c[0]=="1"
    an=!an
  elsif (c[1]=="2"&&an)||(c[1]=="1"&&!an)
    a.push(c[2])
  else a.unshift(c[2])
  end
end
if !an
  a=a.reverse
end
puts a.join

Measured memory_bytes: 30844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int a = sc.nextInt();
		int b = sc.nextInt();
		String u = sc.next();
		if(s.equals(u)) {
			a-=1;
		}else if(t.equals(u)) {
			b-=1;
		}
		System.out.println(a+" "+b);
	}
}

Measured memory_bytes: 23124
package main

import (
	"fmt"
)

type ll int64

func main() {

	var K ll
	fmt.Scan(&K)
	var X ll
	fmt.Scan(&X)

	var i ll = 0
	for i = 0 ; i < 2*K - 1 ; i++ {
		fmt.Print(X - K + 1 + i)
		fmt.Print(" ")
	}


}


Measured memory_bytes: 512
#include<stdio.h>
#include<string>
#include<stack>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
	int n,k;
	scanf("%d %d",&n,&k);
/*	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			for(int q=1;q<=n;q++){
				if((i+j)%k==0&&(i+q)%k==0&&(j+q)%k==0)
					printf("%d %d %d\n",i,j,q);
			}
	
		}
	}*/
	long long tem = n/k;
	if(k%2==1){
		cout<<tem*tem*tem<<endl;
	}
	else {
		int su = k/2;
		long long  tem1= 0;
		for(int i=1;i<=n;i++){
			if(i%k==su)
				tem1++;
		}
		cout<<tem*tem*tem+tem1*tem1*tem1<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
from math import *
MAX = 1000001; 
factor = [0]*(MAX + 1); 
  
def generatePrimeFactors(): 
    factor[1] = 1; 
   
    for i in range(2,MAX): 
        factor[i] = i; 
  
    for i in range(4,MAX,2): 
        factor[i] = 2; 
    i = 3; 
    while(i * i < MAX): 
        if (factor[i] == i): 
            j = i * i; 
            while(j < MAX):  
                if (factor[j] == j): 
                    factor[j] = i; 
                j += i; 
        i+=1
  
def calculateNoOFactors(n): 
    if (n == 1): 
        return 1; 
    ans = 1; 
    dup = factor[n]; 
    c = 1; 
    j = int(n / factor[n]); 
    while (j > 1): 
        if (factor[j] == dup): 
            c += 1; 
        else: 
            dup = factor[j]; 
            ans = ans * (c + 1); 
            c = 1; 
        j = int(j / factor[j]); 
    ans = ans * (c + 1); 
  
    return ans;
generatePrimeFactors()
# n = int(input())
# print(calculateNoOFactors(n))

n = int(input())
ans = 0
for i in range(1, n):
    tem = n-i
    ans += calculateNoOFactors(i)
#     print(tem ,ans)
print(ans)

Measured memory_bytes: 76464
package main
 
import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
 
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
 
func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`
 
 
				`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/
 
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())
	//https://atcoder.jp/contests/abc165/tasks/abc165_f
	//https://www.dropbox.com/sh/nx3tnilzqz7df8a/AAA0887IQFx5BcrZcrpRD7uga/ABC165/F?dl=0&subfolder_nav_tracking=1
 
	s := next()
 
	ans := 0
	for i := 0; i < len(s); i++ {
		if s[i] == '1' {
			ans++
		}
	}
 
	fmt.Fprintln(out, ans)
}
 
//------------------------------------------------------------------------------
 
// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-
 
func next() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}
 
func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}
 
func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}
 
func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

Measured memory_bytes: 640
///////////////////////////////////////////////////
/* __                                       __   */
/*|  |--.-----.---.-.----.----.-----.-----.|  |_ */
/*|  _  |  -__|  _  |  __|  __|  -__|  _  ||   _|*/
/*|_____|_____|___._|____|____|_____|   __||____|*/
/*                                  |__|         */
///////////////////////////////////////////////////
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
typedef long long lint; using namespace std;
#define rep(counter, limit) for (int counter = 0; counter < limit; counter++)
#define INF 1000000000000
#define MOD 10000007
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }
int lcm(int a, int b) { return a * b / gcd(a, b); }
bool primenum(int a) { if (a == 1) { return false; }if (a == 2) { return true; }if (a % 2 == 0) { return false; }for (int i = 3; i < sqrt(a) + 1; i += 2) { if (a != i) { if (a % i == 0) { return false; } } }return true; }
struct setupios{setupios(){cin.tie(0);ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}setupios;
int main() {

  int n,a,b;
  cin>>n>>a>>b;
  string s;
  cin>>s;
  int count=0;
  int kcount=0;
  rep(i,n){
    if(s[i]=='a'){
      if(count < a+b){
        count++;
        cout<<"Yes"<<endl;
      }else{
        cout<<"No"<<endl;
      }
    }else if(s[i]=='b'){
      if(count < a+b and kcount < b){
        count++;
        kcount++;
        cout<<"Yes"<<endl;
      }else{
        cout<<"No"<<endl;
      }
    }else if(s[i]=='c'){
      cout<<"No"<<endl;
    }
  }

}


Measured memory_bytes: 848
from itertools import permutations
import math
N = int(input())
C = []
for _ in range(N):
  C.append(list(map(int,input().split())))

res = 0
cnt = 0
for pair in list(permutations(range(N), N)):
  for i in range(N):
    if i+1 == N: continue
    x,y = pair[i], pair[i+1]
    x_y = math.sqrt( (C[x][0]-C[y][0])**2 + (C[x][1]-C[y][1])**2 )
    res += x_y
  cnt += 1

print(res / cnt)


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

int main(){
  long N,M,K;
  cin>>N>>M>>K;
  for(int k=0;k<=N;k++){
    for(int h=0;h<=M;h++){
      if(K==(k*M+h*N-2*k*h)){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
    cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define mod 1e9+7
#define debug(x) cout<<x<<endl;
#define fi first
#define se second
int main(){
	ll a,b; cin>>a>>b;
	cout<<max({a+b,a-b,a*b});
}


Measured memory_bytes: 3604
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

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

    int n;
    cin >> n;
    VI p(n);
    FOR(i, 0, n)cin >> p[i];

    int cnt = 0;
    FOR(i, 0, n)if (p[i] != i + 1)cnt++;
    cout << (cnt <= 2 ? "YES\n" : "NO\n");
}

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

using namespace std;

int main(){
	
	int a , b;
	string s1 , s2 , s3;
	
	map<string ,int> mp;
	
	cin >> s1 >> s2;
	cin >>a >> b;
	mp[s1] = a ,mp[s2] = b;
	cin >> s3;
	mp[s3]--;
	cout << mp[s1] << " " << mp[s2];
	
	return 0;
}

Measured memory_bytes: 256
(defn formula [ X Y x y]
  (unchecked-add-int (Math/abs (unchecked-subtract-int X x)) (Math/abs (unchecked-subtract-int Y y))))
 
(def formula (memoize formula))
 
(defn zero-case [X Y zs]
  (apply min (map (fn [[x y _]] (formula X Y x y)) zs)))
 
(defn Pyramid [ls]
  (let [{lsn false zs true} (group-by (fn [[_ _ h]] (zero? h)) ls)
        ^const range_it (range (unchecked-int 0) (unchecked-int 101))]
    (first
      (for [X range_it
            Y range_it
            :let [Hs (map (fn [[x y h]] (unchecked-add-int h (formula X Y x y))) lsn)
                  H  (first Hs)]
            :when (and (apply = Hs)
                    (if (nil? zs)
                      (<= 1 H)
                      (>= (zero-case X Y zs) H)))]
        (format "%d %d %d" X Y H)))))
 
(defn input [N]
  (when-not (zero? N)
    (let [x (unchecked-int (read)) y (unchecked-int (read)) h (unchecked-int (read))]
      (cons [x y h] (input (unchecked-dec-int N))))))
 
(-> (read) int input Pyramid println) 

Measured memory_bytes: 236704
import java.util.*;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int[][][] drops = {
		{ {0, -1}, {-1, 0}, {0, 0}, {1, 0}, {0, 1} }, //little
		{ {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1} },// middle 
		{ {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}, {0, -2}, {-2, 0}, {2, 0}, {0, 2} }, //big
	};
	
	public static void main(String[] args) {
		int[][] paper = new int[10][10];
		while(sc.hasNextLine()) {
			String[] parsed = sc.nextLine().split(",");
			int x = Integer.parseInt(parsed[0]), y = Integer.parseInt(parsed[1]), size = Integer.parseInt(parsed[2]);
			for(int i = 0; i < drops[size - 1].length; i++) {
				int dx = x + drops[size - 1][i][0], dy = y + drops[size - 1][i][1];
				if(inField(dx, dy)) paper[dy][dx]++;
			}
		}
		int deep = 0, no = 0;
		for(int i = 0; i < 10; i++) {
			for(int j = 0; j < 10; j++) {
				if(paper[i][j] == 0) {
					no++;
				} else {
					deep = Math.max(deep, paper[i][j]);
				}
			}
		}
		System.out.println(no);
		System.out.println(deep);
	}
	
	static boolean inField(int x, int y) {
		if(x < 0 || x >= 10 || y < 0 || y >= 10) {
			return false;
		} else {
			return true;
		}
	}
}

Measured memory_bytes: 12000
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll a, b, c, d;
	ll ans = 0;

	cin >> a >> b >> c >> d;

	if (a > b) {
		ans += b;
	}
	else {
		ans += a;
	}

	if (c > d) {
		ans += d;
	}
	else {
		ans += c;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool P[1000001];

void eratos()
{
	for( int i = 0;i < 1000001;i++ ) P[i] = true;
	P[0] = P[1] = false;
	for( int i = 0;i < 1000001;i++ ){
		if( P[i] ) for( int j = 2;j * i < 1000001;j++ ) P[i * j] = false;
	}
}

int main(void)
{
	int n;

	eratos();
	while( cin >> n ){
		for( int i = n - 1;;i-- ){
			if( P[i] ){ cout << i;
			break;}
		}
		for( int i = n + 1;;i++ ){
			if( P[i] ){ cout << " " << i << endl;
			break;}
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[5],b=0,c,k;

    for(int i=0; i<3; i++ ){
        cin>>a[i];
    }

    for(int i=0; i<3; i++ ){
        if(a[i]>=b){
            b=a[i];
            c=i;
        }
    }
    cin>>k;
    for(int i=0; i<k; i++ ){
        b*=2;
    }
    a[c]=b;
    cout<<a[0]+a[1]+a[2]<<endl;
    return 0;

}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	h, n := iScan(), iScan()
	a, b := make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		a[i], b[i] = iScan(), iScan()
	}
	dp := make([][]int, n+1)
	dp[0] = make([]int, h+1)
	for i := 1; i < h+1; i++ {
		dp[0][i] = mod
	}
	for i := 1; i < n+1; i++ {
		dp[i] = make([]int, h+1)
		for j := 1; j < h+1; j++ {
			dp[i][j] = min([]int{dp[i-1][j], dp[i-1][larger(0, j-a[i-1])] + b[i-1], dp[i][larger(0, j-a[i-1])] + b[i-1]})
		}
	}
	fmt.Println(dp[n][h])
}


Measured memory_bytes: 84880
while 1:
    n = input()
    if n==0: break
    s = raw_input()
    ba = 0; p = [0]*n;
    for i in xrange(100):
        if s[i]=='M':
            p[i%n]+=1
        elif s[i]=='L':
            p[i%n]+=ba+1; ba=0;
        else:
            ba+=p[i%n]+1; p[i%n]=0;
    print " ".join(map(str,sorted(p))),str(ba)

Measured memory_bytes: 4232
//#define LOCAL

#ifndef LOCAL
#include <bits/stdc++.h>
#else
#include "total.h"
#endif
#define fori(n) for(long long i=0;i<n;i++)
#define forr(i,x,y) for(long long i=x;i<y;i++)
#define forj(n) for(long long j=0;j<n;j++)
#define ll long long
#define d7 1000000007
#define en cout<<"\n";

using namespace std;

void dfs(ll s, vector<bool> &v, vector<ll> adj[]){
    if(v[s]) return;
    v[s]=true;
    //cout<<s+1<<" ";
    for(auto u: adj[s]){
        if(!v
           [u]){
            dfs(u,v,adj);}
    }
}
void bfs(vector<ll> &dis, vector<ll> adj[], ll s, vector<ll> &parent){
    dis[s]=0;
    //parent[s]=-1;
    queue<ll> q;
    q.push(s);
    while(!q.empty()){
        ll z=q.front();
        //cout<<z<<" ";
        q.pop();
        for(auto v:adj[z]){
            if(dis[v]==0){
            q.push(v);
            dis[v]=dis[z]+1;
                parent[v]=z;
            }
        }
    }
}

ll modexp(ll x, ll n,ll m){
    if(n==0) return 1%m;
    ll u=modexp(x,n/2,m);
    u=(u*u)%m;
    if(n%2==1) u=(u*x)%m;
    return u;
}

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

tuple<ll,ll,ll,ll> expA(tuple<ll,ll,ll,ll> v, ll n){
    if(n==0){return {1,0,1,0};}
    if(n==1){return v;}
        ll x1,y1,z1,w1;
        ll x2,y2,z2,w2;
        tie(x1,y1,z1,w1) = expA(v, n/2);
        x2=(x1*x1+y1*z1)%d7;
        y2=(x1*y1+y1*w1)%d7;
        z2=(z1*x1+w1*z1)%d7;
        w2=(z1*y1+w1*w1)%d7;
    if(n%2==0){
        return {x2,y2,z2,w2};
    }
    else{
        return {x2+z2,y2+w2,x2,y2};
    }
}

int main(){
    
    string s;
    cin>>s;
    bool t=false;
    fori(s.size()){
        if(s[i]=='0'+7) t=true;
        
    }
    cout<<(t? "Yes":"No");
    
    return 0;
}


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

int INF = 1e9 + 7;

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

int par[100010];
int urank[100010];

void init(int n) { 
	for (int i = 0; i < n; i++) {
		par[i] = i;
	}
}

int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else { 
		return par[x] = find(par[x]);
	}
}

bool same(int x, int y) { 
	return find(x) == find(y);
}

void unite(int x, int y) { 
	x = find(x);
	y = find(y);
	if (x == y) {
		return;
	}

	if (urank[x] < urank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
	}
	if (urank[x] == urank[y]) {
		urank[x]++;
	}
}

int main() {
	int n, m;
	cin >> n >> m;

	vector<int> p(n+10);
	for (int i = 1; i <= n; i++) {
		cin >> p[i];
	}
	init(n);

	int x, y;
	for (int i = 1; i <= m; i++) {
		cin >> x >> y;
		unite(x, y);
	}

	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (same(i, p[i])) {
			ans++;
		}
	}
	cout << ans << endl;
}

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

using namespace std;

int a,b,c;
int x,y;
int sum=0;

int main()
{
    ios::sync_with_stdio(false);
    cin>>a>>b>>c>>x>>y;
    if(a+b>=2*c)
    {
        if(x>y) sum=min(2*c*max(x,y),2*c*min(x,y)+a*(x-y));
        else sum=min(2*c*max(x,y),2*c*min(x,y)+b*(y-x));

    }

    else
    {
        sum=x*a;
        sum+=y*b;
    }

    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int ,int> pii;
typedef pair<ll ,ll> pll;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(X) (X).begin(), (X).end()
#define sll(n) scanf("%lld",&n)
#define sll2(x,y) scanf("%lld%lld",&x,&y)
#define sll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define REP(i,x,y) for(ll i = x;i <= y;++i)
#define debug(x) cerr<<#x<<"::"<<x<<endl
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n"
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n"
#define debug4(x,y,z,w) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<"\n"
ll power(ll x,ll y,ll z) {
	ll ret = 1;
	while(y > 0) {
		if(y & 1) ret = (ret*x)%z;
		x = (x*x)%z;
		y >>= 1;
	}
	return ret;
}
const ll N = 1e5 + 5;
ll dp[N][3], A[N][3];
int main() {
	
	ll n;
	sll(n);
	REP(i,1,n) REP(j,0,2) sll(A[i][j]);
	REP(i,1,n) {
		REP(j,0,2) {
			REP(k,0,2) {
				if(j == k) continue;
				dp[i][j] = max(dp[i][j], dp[i-1][k]+A[i][j]);
			}
		}
	} 
	printf("%lld\n", max(dp[n][0], max(dp[n][1], dp[n][2])));

	return 0;
}

Measured memory_bytes: 4992
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=2*1e5;
int n,A[MAXN+5];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&A[i]);
    int l=1,r=0,F=0;
    long long ans=0;
    while(r<n)
    {
        while(r<n && !(F&A[r+1]))
        {
            r++;ans+=r-l+1;
            F^=A[r];
        }
        while(l<=r && (F&A[r+1]))
            F^=A[l++];
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;
int main() {

        int A,B;
        int TMP[3];
        int ANS;
        int i;

        cin >> A >> B;

        TMP[0] = A + B;
        TMP[1] = A - B;
        TMP[2] = A * B;

        ANS=TMP[0];

        for(i=0; i < 3; i++){
                if(TMP[i] > ANS){

                        ANS=TMP[i];

                }
        }

        cout << ANS << endl;

return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int dp[2][51];

int main()
{
	while(1)
	{
		int n;
		if(EOF == scanf("%d",&n))
		{
			break;
		}
		int now = 0;
		for(int i = 0; i <= 50; i++)
		{
			dp[now][i] = 0;
		}
		dp[now][0] = 1;
		for(int k = 0; k < 4; k++)
		{
			int nex = (now + 1) % 2;
			for(int i = 0; i <= 50; i++)
			{
				dp[nex][i] = 0;
			}
			for(int j = 0; j <= 50; j++)
			{
				for(int i = 0; i <= 9; i++)
				{
					if(j + i <= 50)
					{
						dp[nex][j + i] += dp[now][j];
					}
				}
			}
			now = nex;
		}
		printf("%d\n",dp[now][n]);
	}
	return 0;
}

Measured memory_bytes: 1024