akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(){
    char p[100],x[1000];
    int temp=0,now=0,ans=0;
    bool f;
    for(int i=0;i<100;i++)p[i]='\0';
    scanf("%s",p);
    while(p[temp]!='\0'){
        if(p[temp]-'A'>=0&&p[temp]-'A'<26)p[temp]+=32;
        temp++;
    }
    for(int i=0;i<1000;i++)x[i]='\0';
    while(scanf("%s",x)!=EOF){
        now=0;
        while(x[now]!='\0')now++;
        f=(now==temp);
        for(int i=0;i<now&&f;i++){
            if(x[i]-'A'>=0&&x[i]-'A'<26)x[i]+=32;
            if(p[i]!=x[i])f=false;
        }
        if(f)ans++;
        for(int i=0;i<now;i++)x[i]='\0';
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 2744
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <math.h>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using pii = pair<Int,Int>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

Int LCM(Int a, Int b){
    return a*b/GCD(a,b);
}


int main() {
    Int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;

    int dx = tx-sx;
    int dy = ty-sy;

    // Path 1
    cout << string(dy,'U') << string(dx,'R');

    // Path 2
     cout << string(dy,'D') << string(dx,'L');

     // Path 3
     cout << 'L' << string(dy+1,'U') << string(dx+1,'R') << 'D';

     // Path 4
     cout << 'R' << string(dy+1,'D') << string(dx+1,'L') << 'U';

     // EndLine
     cout << endl;


    return 0;
}

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

int main(){
	
	for(int h,w;cin>>h>>w,h;){
		for(int i=1;i<=h;i++){
			for(int j=1;j<=w;j++){
				if(i==1 || i==h || j==1 || j==w)cout<<"#";
				else cout<<".";
			}
			cout<<endl;
		}
		cout<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 1152
n = int(input())
l = []
c = 0
for i in range(1,n+1,2):
    c = 0
    for j in range(1,i+1,2):
        if i%j == 0 :
            c += 1
    if c == 8 :
        l.append(i)
print(len(l))


Measured memory_bytes: 9092
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int dx[6]={1,1,0,-1,-1,0};
int dy[6]={1,0,-1,-1,0,1};
int mtx[601][601]={0};

int main(){
    int t,n,x,y;
    while(1){
        queue< pair<int,pair<int,int> > > que;
        fill(mtx[0],mtx[600],0);
        scanf("%d %d",&t,&n);
        if(!t && !n){break;}
        for(int i=0;i<n;i++){
            scanf("%d %d",&x,&y);
            mtx[x+300][y+300]=-1;
        }
        scanf("%d %d",&x,&y);
        mtx[x+300][y+300]=1;
        que.push(make_pair(0,make_pair(x+300,y+300)));
        int cnt=0;
        while(!que.empty()){
            pair< int,pair<int,int> > p=que.front();
            que.pop();
            if(p.first>t){break;}
            for(int j=0;j<6;j++){
                int tx=p.second.first+dx[j];
                int ty=p.second.second+dy[j];
                int tu=p.first+1;
                if(mtx[tx][ty]==0){
                    mtx[tx][ty]=1;
                    que.push(make_pair(tu,make_pair(tx,ty)));
                }
            }
            cnt++;
        }
        printf("%d\n",cnt);
    }
    return 0;
}




Measured memory_bytes: 4172
#include <bits/stdc++.h>
 
using namespace std;
 
using P = pair<int, int>;
using ll = long long;
 
const int MAX_V = 100000;
 
vector<P> G[MAX_V];
ll dist[MAX_V];
 
void dfs(int v, int p) {
	for (int i = 0; i < G[v].size(); i++) {
		if (G[v][i].first != p) {
			dist[G[v][i].first] = dist[v] + G[v][i].second;
			dfs(G[v][i].first, v);
		}
	}
}
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 1; i < n; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--;
		b--;
		G[a].emplace_back(b, c);
		G[b].emplace_back(a, c);
	}
 
	int q, k;
	cin >> q >> k;
	k--;
	dfs(k, -1);
	for (int i = 0; i < q; i++) {
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		cout << dist[x] + dist[y] << endl;
	}
	return 0;
}

Measured memory_bytes: 14336
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

struct State{
	int li,lj,ri,rj;
	State(){}
	State(int li,int lj,int ri,int rj):li(li),lj(lj),ri(ri),rj(rj){}
};
int main()
{
	for(int w,h;cin>>w>>h,w|h;){
		vs lgrid(h),rgrid(h);
		rep(i,h) cin>>lgrid[i]>>rgrid[i];
		
		queue<State> q;
		{
			int li,lj,ri,rj;
			rep(i,h) rep(j,w){
				if(lgrid[i][j]=='L')
					li=i,lj=j,lgrid[i][j]='.';
				if(rgrid[i][j]=='R')
					ri=i,rj=j,rgrid[i][j]='.';
			}
			q.emplace(li,lj,ri,rj);
		}
		
		bool res=false;
		vvvvi vis(h,vvvi(w,vvi(h,vi(w))));
		while(!q.empty()){
			State c=q.front(); q.pop();
			
			if(vis[c.li][c.lj][c.ri][c.rj]) continue;
			vis[c.li][c.lj][c.ri][c.rj]=1;
			
			if(lgrid[c.li][c.lj]=='%' && rgrid[c.ri][c.rj]=='%'){
				res=true;
				break;
			}
			else if(lgrid[c.li][c.lj]=='%' || rgrid[c.ri][c.rj]=='%')
				continue;
			
			int di[]={-1,1,0,0},dj[]={0,0,-1,1};
			rep(k,4){
				int nli=c.li+di[k],nlj=c.lj+dj[k];
				if(nli<0 || h<=nli || nlj<0 || w<=nlj || lgrid[nli][nlj]=='#')
					nli=c.li,nlj=c.lj;
				int nri=c.ri+di[k],nrj=c.rj-dj[k];
				if(nri<0 || h<=nri || nrj<0 || w<=nrj || rgrid[nri][nrj]=='#')
					nri=c.ri,nrj=c.rj;
				q.emplace(nli,nlj,nri,nrj);
			}
		}
		cout<<(res?"Yes":"No")<<endl;
	}
	
	return 0;
}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)
#define fi first
#define se second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
template <class T> using vec = vector<T>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

int main(int argc, char* argv[]) {
  long long K;
  scanf("%lld", &K);

  ll ans = 0;
  rep(i, 1, K + 1) rep(j, 1, K + 1) rep(k, 1, K + 1) { ans += gcd(gcd(i, j), k); }
  put(ans);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) {
  T c = min(a, b), d = max(a, b);
  return c * (d / gcd(c, d));
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


Measured memory_bytes: 3688
// E

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  int H,W;
  int A[80][80];
  int B[80][80];
  cin>>H>>W;
  for(int i(0);i<H;i++){
    for (int j(0);j<W;j++){
      cin>>A[i][j];
    }
  }
  int sa[80][80];
  for(int i(0);i<H;i++){
    for (int j(0);j<W;j++){
      cin>>B[i][j];
      sa[i][j] = abs(B[i][j]-A[i][j]);
    }
  }
  bool dp[81][81][13001]={0};
  dp[0][0][sa[0][0]]=true;
  for (int i(0);i<H;i++){
    for (int j(0);j<W;j++){
      for (int k(0);k<=13000;k++){
        if(i > 0){
          dp[i][j][k] |= dp[i-1][j][abs(k-sa[i][j])];
          dp[i][j][k] |= dp[i-1][j][abs(k+sa[i][j])];
        }
        if(j > 0){
          dp[i][j][k] |= dp[i][j-1][abs(k-sa[i][j])];
          dp[i][j][k] |= dp[i][j-1][abs(k+sa[i][j])];
        }
      }
    }
  }
  //for (int i(0);i<10;i++) cout << dp[H-1][W-1][i] << " ";
  //cout << endl;
  for (int i(0);i<=13000;i++){
    if (dp[H-1][W-1][i]){
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}



Measured memory_bytes: 83584
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
N = int(input())
fac = factorization(N)
Answer = 0
for i in range(len(fac)):
    faci = fac[i][1]
    An = 1
    while faci >= An:
        Answer += 1
        faci -= An
        An +=1
if N == 1:
    Answer = 0
print(Answer)

Measured memory_bytes: 9424
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class Main{
  public static void main(String[] args)throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] line1 = br.readLine().split(" ");
    String[] line2 = br.readLine().split(" ");
    
    int numAllDice = Integer.parseInt(line1[0]);
    int numPlayDice = Integer.parseInt(line1[1]);
    double max = 0;
    double temp = 0;
    int next;
    
    int[] dice = new int[numAllDice];
    
    for(int i=0; i<numPlayDice; i++){
      dice[i] = Integer.parseInt(line2[i]);
      max += (dice[i]+1)/2.0;
    }
    temp = max;
    
    for(int i=0; i<numAllDice-numPlayDice; i++){
      next = Integer.parseInt(line2[i+numPlayDice]);
      dice[i+numPlayDice] = next;
      temp += ((next+1)-(dice[i]+1))/2.0;
      if(max < temp){
        max  = temp;
      }
    }
    System.out.println(max);
  }
}

Measured memory_bytes: 50328
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int gcd(int a,int b) {
    if(a < b) swap(a,b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,k;
    cin >> n >> k;
    vi X(n),Y(n);
    rep(i,n) cin >> X[i] >> Y[i];
    rep(i,n) {
        map<P,ll> mp;
        rep(j,n) {
            if(i == j) continue;
            int x = X[i]-X[j];
            int y = Y[i]-Y[j];
            int g = gcd(abs(x),abs(y));
            x /= g;
            y /= g;
            auto rev = [&]() {
                x = -x;
                y = -y;
            };
            if(x <= 0) {
                if(y <= 0) rev();
            } else {
                if(y < 0) rev();
            }
            mp[{x,y}]++;
        }
        for(auto p : mp) {
            if(p.second+1 >= k) {
                cout << 1 << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
}


Measured memory_bytes: 3328
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, w int64
	fmt.Scanf("%d%d", &n, &w)
	weight := make([]int64, n)
	values := make([]int64, n)
	for i := 0; i < int(n); i++ {
		fmt.Scanf("%d%d", &weight[i], &values[i])
	}
	ans := maximumPossibleSum(n, w, values, weight)
	fmt.Println(ans)
}

// https://atcoder.jp/contests/dp/tasks/dp_d
func maximumPossibleSum(n int64, w int64, values []int64, weight []int64) int64 {
	dp := make([][]int64, n+1)
	for i := 0; i <= int(n); i++ {
		dp[i] = make([]int64, w+1)
	}
	for i := 1; i <= int(n); i++ {
		for j := 1; j <= int(w); j++ {
			if weight[i-1] > int64(j) {
				dp[i][j] = dp[i-1][j]
			} else {
				dp[i][j] = int64(math.Max(float64(dp[i-1][j]), float64(values[i-1]+dp[i-1][int64(j)-weight[i-1]])))
			}
		}
	}
	return dp[n][w]
}


Measured memory_bytes: 83068
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#define N 3006
#define ll long long
#define dd double
#define esp 1e-10
using namespace std;

int n,k;
int a[1000006];

int main(){
	ll ans=0;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i)
		scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	for(int i=1;i<=k;++i)
		ans+=a[i];
	cout<<ans;
}

Measured memory_bytes: 3260
#include<bits/stdc++.h>
#define rep(i,k,n) for(ll i= (ll) k;i< (ll) n;i++)
#define all(v) (v).begin(), (v).end()
#define SZ(v) (int)((v).size())
#define pb push_back
#define ft first
#define sd second
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const long long INF = 4e18L + 1;
const int IINF = 2e9 + 1;

using namespace std;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define DBG(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define DBG(...)
#define cerr if(0)cout
#endif

int main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
	int n, a, b; cin >> n >> a >> b;
	if((b ^ a) & 1){
		cout << "Borys\n";
	} else {
		cout << "Alice\n";
	}
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void setIO(string s = "") {
	// cin.exceptions(cin.failbit); 
	// throws exception when do smth illegal
	// ex. try to read letter into int
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
 
int rnd (int l, int r) {
	return uniform_int_distribution<int> (l, r)(gen);
}
 
int N, V[1 << 18], W[1 << 18];
int dptable[1024][100001];
int dp(int i, int j) {
	if (i < 1024) return dptable[i][j];
	if (j < W[i]) return dp(i / 2, j);
	return max(dp(i / 2, j - W[i]) + V[i], dp(i / 2, j));
}
int main() {
	int Q, v, L;
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i) scanf("%d %d", &V[i], &W[i]);
	for (int i = 1; i < 1024; ++i) {
		for (int j = 0; j <= 100000; ++j) {
			if (j < W[i]) dptable[i][j] = dptable[i >> 1][j];
			else dptable[i][j] = max(dptable[i >> 1][j], dptable[i >> 1][j - W[i]] + V[i]);
		}
	}
	scanf("%d", &Q);
	for (int i = 0; i < Q; ++i) {
		scanf("%d %d", &v, &L);
		printf("%d\n", dp(v, L));
	}
	return 0;
}
// B...a

Measured memory_bytes: 405416
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int n,a;
int main() {
int ans=0;
cin>>n;
for(int i=0;i<n;i++){
 cin>>a;
 while(a%2==0){
  a/=2;
  ans++;
 }
}
cout<<ans;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

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

	if (a + b == 15) cout << "+" << endl;
	else if (a * b == 15) cout << "*" << endl;
	else cout << "x" << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);
        int c = int.Parse(input[2]);
        int d = int.Parse(input[3]);

        int ac = Math.Abs(a - c);
        int ab = Math.Abs(a - b);
        int bc = Math.Abs(b - c);





        if (ac<=d)
        {
            Console.WriteLine("Yes");
        }
        else {
            if (ab <= d && bc <= d)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;
const ll inf = 1e18;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,m,k; cin >> n >> m >> k;
    vec<ll> a(n),b(m);
    rep(i,n)cin >> a[i];
    rep(i,m)cin >> b[i];
    vec<ll> sa(n+1),sb(m+1); sa[0]=0; sb[0]=0;
    rep(i,n)sa[i+1] = sa[i] + a[i];
    rep(i,m)sb[i+1] = sb[i] + b[i];
    ll res = 0;
    rep(i,n+1){
        ll t = k - sa[i];
        if(t < 0)break;
         res = max(res,i-1+distance(sb.begin(),upper_bound(sb.begin(), sb.end(),t)));
    }
    cout << res << endl;
}


Measured memory_bytes: 9472
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,m;
    cin>>n>>m;
    if((n==2)&&(m==2))
    {
        cout<<"Yes"<<endl;
    }
    else if((n==1||n==3||n==5||n==7||n==8||n==10||n==12)&&(m==1||m==3||m==5||m==7||m==8||m==10||m==12))
    {
        cout<<"Yes"<<endl;

    }
    else if((n==4||n==6||n==9||n==11)&&(m==4||m==6||m==9||m==11))
    {
       cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
return 0;
}


Measured memory_bytes: 256
s = int(input())


def f(n):
    if n % 2 == 0:
        return n / 2
    else:
        return 3*n + 1


a = [s]
i = 1
while True:
    ret = f(a[i - 1])
    i += 1
    if ret in a:
        ans = i
        break
    a.append(ret)

print(ans)


Measured memory_bytes: 2940
import java.util.Scanner;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String tmpS = "";

    while (!s.equals(tmpS)) {
      if (s.endsWith("dreamer" + tmpS)) {
        tmpS = "dreamer" + tmpS;
      } else if (s.endsWith("dream" + tmpS)) {
        tmpS = "dream" + tmpS;
      } else if (s.endsWith("eraser" + tmpS)) {
        tmpS = "eraser" + tmpS;
      } else if (s.endsWith("erase" + tmpS)) {
        tmpS = "erase" + tmpS;
      }

      else {
        System.out.println("NO");
        sc.close();
        return;
      }
    }

    System.out.println("YES");
    sc.close();
    return;
  }
}

Measured memory_bytes: 58532
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    string s; cin>>s;
    int ans = 0;
    if(s == "SUN") ans = 7;
    else if(s == "MON") ans = 6;
    else if(s == "TUE") ans = 5;
    else if(s == "WED") ans = 4;
    else if(s == "THU") ans = 3;
    else if(s == "FRI") ans = 2;
    else ans = 1;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX_N = 110;
const int INF = 10000;
int d_cost[MAX_N][MAX_N];
int d_time[MAX_N][MAX_N];
int n, m;

void warshall_floyd(int d[MAX_N][MAX_N])
{
    for (int k = 0; k < m; k++)
        for (int i = 0; i < m; i++)
            for (int j = 0; j < m; j++)
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}

int main()
{
    while (cin >> n >> m, n || m) {
        int a, b, cost, time;
        int k, p, q, r;

        // 初期化
        for (int i = 0; i < m; i++)
            for (int j = 0; j < m; j++) {
                if (i == j) 
                    d_cost[i][j] = d_time[i][j] = 0;
                else
                    d_cost[i][j] = d_time[i][j] = INF;
            }

        for (int i = 0; i < n; i++) {
            cin >> a >> b >> cost >> time;
            a--, b--;
            d_cost[a][b] = d_cost[b][a] = cost;
            d_time[a][b] = d_time[b][a] = time;
        }

        warshall_floyd(d_cost);
        warshall_floyd(d_time);

        cin >> k;
        for (int i = 0; i < k; i++) {
            cin >> p >> q >> r;

            p--, q--;
            if (r == 0)
                cout << d_cost[p][q] << endl;
            else
                cout << d_time[p][q] << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1248
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-03-28 20:28:21
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

LL modpower(LL n, LL m, LL mod) {
    if (m == 0) {
        return 1;
    } else if (m % 2 == 0) {
        LL p = modpower(n, m/2, mod);
        return p*p % mod;
    } else {
        return n*modpower(n, m-1, mod) % mod;
    }
}

LL modinv(LL n, LL mod) {
    return modpower(n, mod-2, mod);
}

LL modcombination(LL n, LL r, LL mod) {
    LL ret = 1;

    for (int i = 0; i < r; i++) {
        ret *= (n-i);
        ret %= mod;
        ret *= modinv(i+1, mod);
        ret % mod;
    }

    return ret % mod;
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int x, y, z;
    cin >> x >> y >> z;

    double ans = (double)x*y/2;
    cout << ans << endl;

    return 0;
}


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

int main() {
  int n,d,ans = 0;
  cin >> n >> d;
  d = d*2 + 1;
  ans = n/d;
  if(n%d != 0) ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define LOCAL

#include <bits/stdc++.h>

using namespace std;

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define LLINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f

using llong = long long;
using PII = pair<int, int>;

const llong MOD = 998244353LL;
const double PI = acos(-1);

int main() {
	IOS;
	int n; cin >> n;
	int consecMax = 0, consec = 0;
	for (int i = 0; i < n; i++) {
		int a, b; cin >> a >> b;
		if (a == b) consec++;
		else {
			consec = 0;
		}
		consecMax = max(consecMax, consec);
	}
	if (consecMax >= 3) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << p.first << " " << p.second;
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll N, M;
  std::cin >> N >> M;

  std::vector< ll > va(N, 0LL);
  for (ll i = 0; i < N; i++) {
    std::cin >> va[i];
  }
  std::sort(va.begin(), va.end());

  std::vector< std::pair<ll, ll> > vp(M);
  for (ll i = 0; i < M; i++) {
    std::cin >> vp[i].second >> vp[i].first;
  }

  std::sort(vp.begin(), vp.end(), std::greater<>());

  ll apos = 0LL;
  for (auto p : vp) {
    ll num = p.second;
    ll change_value = p.first;

    for (ll pos = apos; pos < apos + num && pos < N; pos++) {
      if (change_value >= va[pos]) {
	va[pos] = change_value;
      }
    }
    apos = std::min(apos + num, N);
  }

  //print(va);
  ll sum = std::accumulate(va.begin(), va.end(), 0LL);
  print(sum);

  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A;
  int B;
  cin >> A >> B;
  int count = 0;
  for (int i = A; i <= B; i++){
    if (i / 10000 == i % 10 &&
        (i / 1000) % 10 == (i % 100) / 10)
      count += 1;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  int x, a, b;
  ci(x, a, b);
  if(abs(a - x) > abs(b - x)){
    co("B");
  }
  else{
    co("A");
  }
}

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

using namespace std;

int main(void)
{
  int n;

  string c1;
  string c2;
  string c3;

  cin>>c1;
  cin>>c2;
  cin>>c3;

  cout<<c1[0]<<c2[1]<<c3[2]<<endl;
}


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


int main() {
  string s;

  cin >> s;

  set<char> station;

  for(int i=0; i<s.size(); i++){
    station.insert(s.at(i));
    
  }
  
  if(station.size() == 2)
    cout << "Yes";
  else
    cout << "No";
   
}

Measured memory_bytes: 256
//
//  main.cpp
//  agc23
//
//  Created by cfhaiteeh on 2018/4/28.
//  Copyright © 2018 cfhaiteeh. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#define  LL  long long

using namespace std;
const int maxn=2*123456;
int ai[maxn];
int n;
map<LL,int> M;
void init(){
    for(int i=1;i<=n;i++)scanf("%d",&ai[i]);
}
LL ans;
void play(){
    M.clear();
    LL sum=0;
    ans=0;
    M[0]=1;
    for(int i=1;i<=n;i++){
        sum+=ai[i];
        
        
        int z=M[sum];
       // cout<<z<<endl;
        ans+=z;
        M[sum]++;
    }
}
void pri(){
    printf("%lld\n",ans);
}
int main() {
    // insert code here...
    while(scanf("%d",&n)!=EOF){
        init();
        play();
        pri();
    }
    return 0;
}


Measured memory_bytes: 13568
#include<bits/stdc++.h>
using namespace std;
int a[200010];
int main()
{
	a[0]=0;
	int k,n;
	cin>>k>>n;
	int ans=k;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
	{
		ans=min(ans,k-(a[i]-a[i-1]));
	}
	ans=min(ans,k-(k-a[n]+a[1]));
	cout<<ans<<endl;
}

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

h, w = map(int, input().split())
a = [""]*h
for i in range(h):
    a[i] = input()

row = [False] * h
col = [False] * w


for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            row[i] = True
            col[j] = True


for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j], end = "")

        print()


Measured memory_bytes: 4468
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k,a[100],mn=(int)1e8,dp[100001];
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++){  
		scanf("%d",a+i);
		mn=min(mn,a[i]);
	}
	for(int i=0;i!=mn;i++) dp[i]=false;
	for(int i=mn;i<=k;i++){
		bool win=false;
		for(int j=0;j<n;j++)
			if(i-a[j]>=0&&!dp[i-a[j]]) win=true;
		dp[i]=win;
	}
	if(dp[k]) cout<<"First\n";
	else cout<<"Second\n";
	return 0;

}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
	int n;
	while(cin >> n){
		if(n==0) break;
		int A=0, B=0, a,b;
		for(int i=0; i<n; i++){
			cin >> a >> b;
			if(a>b) A+=a+b;
			if(a<b) B+=a+b;
			if(a==b) A+=a, B+=b;
		}
		cout << A << " " << B << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	int N, M, C;
	VI B(M);
	cin >> N >> M >> C;
	REP(i, M) {
		cin >> B[i];
	}
	int as = 0;
	REP(i, N) {
		int cnt = 0;
		REP(j, M) {
			int A;
			cin >> A;
			cnt += A*B[j];

		}
		if (C + cnt > 0)as++;
	}
	cout << as << endl;
	return 0;

}



Measured memory_bytes: 33024
from operator import itemgetter
N,K = map(int,input().split())
ls = [list(map(int,input().split())) for _ in range(N)]
ls = sorted(ls,key=itemgetter(0))
len = 0
ans = 0
i = 0
while True:
    if len >= K:
        break
    ans = ls[i][0]
    len += ls[i][1]
    i += 1
print(ans)

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

using namespace std;

int main()
{
    long long a,b,n;
    cin>>a>>b>>n;
    cout<<(long long)((a*min(n,b-1ll))/b)-(long long)(min(n,b-1ll)/b)*a;
    return 0;
}
/***
32
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5

6
2 3 3 1 3 1
*/


Measured memory_bytes: 3552
import sys
X,N=map(int,input().split())
if N==0:
    print(X)
    sys.exit( )

Ps = list(map(int,input().split()))
A_small=0
A_big=0


for i in range(101):
    A_small=X-i
    if A_small in Ps:
        continue
    else:
        break
for i in range(101):
    A_big=X+i
    if A_big in Ps:
        continue
    else:
        break
if A_big-X >= X-A_small:
    print(A_small)
else:
    print(A_big)

Measured memory_bytes: 61856
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int ans = 700;
	rep(i, 3) {
		if (s[i] == 'o') ans += 100;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
n = int(input())
ans = float('Inf')
for i in range(1, n//2+1):
  if sum(list(map(int, str(i)))) + sum(list(map(int, str(n - i)))) < ans:
    ans = sum(list(map(int, str(i)))) + sum(list(map(int, str(n - i))))
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#define mod 1000000007
using namespace std;



int main()
{
    int m,n,o=0,i,j,k;
    int sum=0,pre=101;
    //long long int m,n,o,i,j,k;
    //vector <int> v;
    //float f,g,h;
    //char c,d;
    //string a;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>m;
        if(i==0) sum+=m;
        if(pre<m) sum+=m-pre;
        pre=m;
    }
    cout<<sum;
    //cin>>m>>c>>n>>d>>i;
    //cin>>f>>g;
    //cin>>c;
    return 0;
}





Measured memory_bytes: 256
using System;
using System.Numerics;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Console.ReadLine();
            var nums = x.Split(' ');
            var a = BigInteger.Parse(nums[0]);
            var b = BigInteger.Parse(nums[1]);
            var c = BigInteger.Parse(nums[2]);
            var d = BigInteger.Parse(nums[3]);

            //a*c
            //a*d
            //b*c
            //b*d
            BigInteger res = a * c;
            res = Max(a * d, res);
            res = Max(b * c, res);
            res = Max(b * d, res);
            // res = Math.Max(c * d, res);

            Console.WriteLine(res);
        }

        private static BigInteger Max(BigInteger a, BigInteger b) {
            if (a > b) return a;
            return b;
        }
    }
}


Measured memory_bytes: 27796
import java.util.Scanner;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main{
    public static void main(String[] args){
			Scanner sc = new Scanner(System.in);
      		int[] height = new int[10];
      		for(int i=0; i<10; i++){
              height[i]=sc.nextInt();
            }
      			Arrays.sort(height);
              System.out.println(height[9]);
              System.out.println(height[8]);
              System.out.println(height[7]);
    }
}



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

using namespace std;

int main() {

	int n;
	cin >> n;

	vector<vector<int>> a(2, vector<int>(n, 0));

	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	int maxx = 0;
	for (int i = 0; i < n; i++) {
		int total = 0;
		for (int j = 0; j < n; j++) {
			if (j <= i ) {
				total += a[0][j];
			}
			if (j >= i) {
				total += a[1][j];
			}
		}
		maxx = max(total, maxx);
	}


	cout << maxx << endl;
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
int A[100];

int cnt[100];

bool C(){
    int ma=*max_element(A,A+N);
    for(int i=ma;i>ma/2;i--){
        if(cnt[i]<2)return false;
        cnt[i]-=2;
    }
    if(ma%2==0){
        if(cnt[ma/2]<1)return false;
        cnt[ma/2]--;
    }

    int lim;
    if(ma&1)lim=ma/2+1;
    else lim=ma/2;
    rep(i,lim+1)if(cnt[i])return false;
    return true;
}

signed main(){
    cin>>N;
    rep(i,N)cin>>A[i],cnt[A[i]]++;

    if(C())cout<<"Possible"<<endl;
    else cout<<"Impossible"<<endl;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> C(H, vector<char>(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 < 2; j++) {
      for (int k = 0; k < W; k++) {
        cout << C[i][k];
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
using namespace         std;
#define                 int long long
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<endl
#define                 endl '\n'              
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 1014159
#define  vi vector<int>
#define  v  vector
using namespace __gnu_pbds;  
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update> oset; 
gp_hash_table<int, int> table;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash {
    int operator()(int x) const { return x ^ RANDOM; }
};
 
vi adj[N];
int visited[N];
int cmp;
int arr[N];
multiset<int>dc; 
int dfs(int u)
{
    visited[u] = 1;
    int x = arr[u];
    for(auto i : adj[u])
    {
        if(visited[i] == 0){
            x = min(x,dfs(i));
        }
    }
    return x;
}
 
void solve()
{
    int n,m;
    cin>>n>>m;
    forn(i,1,n){cin>>arr[i];dc.insert(arr[i]);}
    forn(i,1,m)
    {
        int a,b;
        cin>>a>>b;
        a++,b++;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    int ans = 0;
    forn(i,1,n)
    {
        if(visited[i] == 0)
        {
            int x = dfs(i);
            ans+=x;
            //cout<<x<<"\n";
            dc.erase(dc.find(x));
            cmp++;
        }
    }
   
    if(n<2*(cmp-1))
    {
        cout<<"Impossible";
    }
    else if(cmp == 1)
    {
        cout<<0;
    }
    else
    {
        int y = 2*(cmp - 1) - cmp;
        while(y)
        {
            int x = *dc.begin();
            ans+=x;
            y--;
            dc.erase(dc.find(x));
        }
        cout<<ans;
    }
}
 
 
signed main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int t = 1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
 
 
 
    return 0;
 
}
 
//       g++ -g c.cpp ; ./a.exe


Measured memory_bytes: 38784
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;

const ll INF = 1ll << 60;

int main()
{
    ll n;
    cin >> n;
    ll ans = INF;
    ll cur = 1;

    while (cur * cur <= n)
    {
        if (n % cur == 0)
        {
            chmin(ans, cur - 1 + n / cur - 1);
        }
        cur++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//0040 Affine Cipher

#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
using namespace std;


const int N = 26;
void Transrate(string &refStr, int a, int b)
{
	for(int i = 0; i < refStr.size(); i++)
	{
		refStr[i] = (a*(refStr[i]-'a') + b)%N + 'a';
	}
}

int GCD(int a, int b)
{
	int c;
	while((c = a%b) != 0)
	{
		a = b;
		b = c;
	}
	return b;
}

int main(void)
{
	int n;
	string from, to;
	cin >> n;
	getline(cin, to);	//êsÚÌüsð

	while(n--)
	{
		getline(cin, to);
		int i, j;
		int a, b;
		from.resize(to.size());

		string t1, t2;
		for(a = 1; a < N; a++)
		{
			if(GCD(N, a) != 1)
				continue;
			for(b = 0; b < N; b++)
			{
				t1 = "this";
				t2 = "that";
				Transrate(t1, a, b);
				Transrate(t2, a, b);

				if( (to.find(t1) != string::npos) ||
					(to.find(t2) != string::npos) )
				{
					for(i = 0; i < to.size(); i++)
					{
						if(isalpha(to[i]))
						{
							for(j = 0; j < N; j++)
							{
								if(to[i] == (a*j+b)%N + 'a')
								{
									from[i] = j+'a';
									break;
								}
							}
						}
						else
							from[i] = to[i];
					}
					cout << from << endl;
					goto END;
				}
			}
		}
	END:
		;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int n;
    string s;
    cin >> n >> s;
    string x, y;
    int cnt, max = 0;
    char pre = '0';
    for (int i = 1; i < n; i++) {
        x.clear();
        y.clear();
        cnt = 0;
        pre = '0';
        
        x = s.substr(0, i);
        y = s.substr(i, n - i);
        sort(x.begin(), x.end());
        sort(y.begin(), y.end());
        //cout << x << ' ' << y;
        for (i = 0; i < x.length(); i++) {
            for (int j = 0; j < y.length() && pre != x[i]; j++) {
                if (x[i] == y[j]) {
                    pre = x[i];
                    cnt++;
                    break;
                }
            }
        }
        //cout << ' ' << cnt << endl;
        if (max < cnt) {
            max = cnt;
        }
        //sort(x.begin(), x.end());
    }
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 256