akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<lli>
#define pb  push_back
#define mp  make_pair
#define ss  second
#define ff  first
#define all(x) x.begin(),x.end()
const lli mod = 1e9+7;

lli p2(lli n){lli ans=0;while(n>=1){n=n/2;ans++;}return ans;}
lli b_ex(lli n,lli a){lli res=1;while(n){if(n%2==1)res*=a;n>>=1;a=a*a;}return res;}
lli ncr(lli n,lli k){lli ans=1;if(k>n-k)k=n-k;for(lli i=1;i<=k;i++){ans*=(n-i+1),ans=ans/i;}return ans;}
lli add(lli a,lli b){return(a+b)%mod;}
lli mul(lli a,lli b){return (a*b)%mod;}
lli power(lli a , lli n){lli ans = 1;while(n){if(n % 2)ans = (ans * a) % mod;n /= 2;a = (a * a) % mod;}return ans;}
lli lcm(lli a,lli b)
{
    lli ans=(a*b)/(__gcd(a,b));
    return ans;
}
vll setprime(lli n)
{
    vll prime;
    if(n%2==0)
    {
        prime.pb(2);
        while(n%2==0){n/=2;}
    }
    for(lli i=3;i<=sqrt(n);i+=2)
    {
        if(n%i==0)
        {
            while(n%i==0){n=n/i;}
            prime.pb(i);
        }
    }
    if(n>1)prime.pb(n);
    return prime;
}
///-----------------------TEMP TSF99--------------------------------------------------------------------------------------///

void solve()
{
    int n;cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        int a;cin>>a;
        if(a%2==1 and i%2==1)sum++;
    }
    cout<<sum<<endl;
}
int main()
{
    int t=1;//cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 3724
#include <cstdio>
#include <numeric>
 
int const N = 1000001;
 
int spf[N], u[N], s[17], d, i, j, k;
char const* r = "pairwise";
 
int main() {
    while (++i < N)spf[i] = i;
    for (i = 2; i * i < N; i++)
        for (j = i * i; j < N; j += i)
            if (spf[j] == j) spf[j] = i;
    for (scanf("%*d"); ~scanf("%d", &j); k = 0) {
        d = std::gcd(d, j);
        for (; j > 1; j /= i)
            if (u[s[k++] = i = spf[j]]) r = "setwise";
        while(k--) u[s[k]] = 1;
    }
    printf("%s coprime\n", d > 1 ? "not" : r);
    return 0;
}


Measured memory_bytes: 9548
#include<stdio.h>
int a[100001][3],x[100001][3];
int main()
{
	int n;
	int i,j,k,max=-1;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		for(j=0;j<3;j++){
			scanf("%d",&a[i][j]);
			x[i][j]=0;
			x[0][i]=a[0][i];
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<3;j++){
			for(k=0;k<3;k++){
				if(j!=k&&i<n&&a[i+1][k]+x[i][j]>x[i+1][k]){
					x[i+1][k]=x[i][j]+a[i+1][k];
				}
			}
		}
	}
	for(i=0;i<3;i++){
		if(max<x[n-1][i]) max=x[n-1][i];
	}
	printf("%d\n",max);
	return 0;
}

Measured memory_bytes: 4036
using System;
public class Program
{
    public static void Main()
    {
        int[] a = new int[10];
        for (int i = 0; i < 10; i++) a[i] = int.Parse(Console.ReadLine());
        Array.Sort(a);
        for (int i = 9; i > 6; i--) Console.WriteLine(a[i]);
    }
}

Measured memory_bytes: 9264
#include<bits/stdc++.h>
#define ll long long 
#define fast ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
int main()
{
    fast
    int n;cin>>n;vector<double>dp(n+1);
    dp[0]=1;
    for(int coin=1;coin<=n;coin++)
    {
        double p;cin>>p;
        for(int i=coin;i>=0;i--)
            dp[i]=(i==0?0:dp[i-1])*p + dp[i]*(1-p);
    }
    double ans=0;
    for(int i=n/2+1;i<=n;i++)
        ans+=dp[i];
    cout<<fixed<<setprecision(10)<<ans;
return 0;
}


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

int main(){
	int n,m,p,sum;
	while(cin >> n >> m >> p ,n){
		vector<int> data(n);
		sum = 0;
		for(int i=0;i<n;i++){
			cin >> data[i];
			sum+= data[i]*100;
		}
		sum = (double)(100-p)/100*sum;
		cout << (data[m-1]?sum / data[m-1]:0) << endl;
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>

#define forn(i,n) for(int i = 0;i<int(n);i++)
#define ll long long

using namespace std;

int main(){
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  int N,M;
  cin>>N>>M;
  int total=0;
  forn(i,M){
    int tmp;
    cin>>tmp;
    total += tmp;
  }
  int ans = N-total;
  if(ans>=0)
    cout<<ans<<endl;
  else
    cout<<-1<<endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb push_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int N = 100000;
const int oo = 0x3f3f3f3f;
 
template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

int n, m;
bool vis[N + 5];
vector<int> G[N + 5], Ans;

void dfs(int u) {
    if(!vis[u]) Ans.pb(u);
    vis[u] = true;
    for(const auto&v : G[u]) if(!vis[v]) {
        dfs(v);
        break;
    }
}

int main() {
#ifdef Wearry
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif 

    scanf("%d%d", &n, &m);
    for(int i = 1; i <= m; ++i) {
        static int a, b;
        scanf("%d%d", &a, &b);
        G[a].pb(b), G[b].pb(a);
    }

    dfs(1);
    reverse(Ans.begin(), Ans.end());
    dfs(1);

    printf("%d\n", int(Ans.size()));
    for(const auto&x : Ans) printf("%d ", x);

    return 0;
}


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

int main(){
	int n;cin >> n;
	string str;cin >> str;
	set<string> s;
	s.insert(str);
	REP(i,n-1){
		string now;
		cin >> now;
		if(s.count(now) || str[str.size() - 1] != now[0]){
			cout << "No" << endl;
			return 0;
		}
		s.insert(now);
		str = now;
	}
	
	cout << "Yes" << endl;
		
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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; }

// 無限大の値
const ll  lINF = 1LL << 60;
const int iINF = 1 << 29;

int main(void){
  int a,b,c;
  cin  >> a >> b >> c;
  cout << (a == b ? c : b == c ? a : b) << endl;
  return 0;
} 

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			(3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
template<class T> void chmax(T &a, const T &b){if(a<b)a=b;}
template<class T> void chmin(T &a, const T &b){if(a>b)a=b;}
void YN(bool b){cout<<(b?"YES":"NO")<<endl;}
void Yn(bool b){cout<<(b?"Yes":"No")<<endl;}
void yn(bool b){cout<<(b?"yes":"no")<<endl;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll h,w,ans=0;
	string s;
	cin>>h>>w;
	vvi vv(h+2,vi(w+2));
	vvb vstd(h+2,vb(w+2,true));
	rep(i,h){
		cin>>s;
		rep(j,w){
			if(s[j]=='.')vv[i+1][j+1]=1;
			else vv[i+1][j+1]=-1;
			vstd[i+1][j+1]=false;
		}
	}
	rep(i,h){
		rep(j,w){
			if(vstd[i+1][j+1]==false){
				ll bl=0,wh=0;
				vstd[i+1][j+1]=true;
				queue<pll> q;
				q.push(pll(i+1,j+1));
				while(!q.empty()){
					ll x,y;
					tie(x,y)=q.front(),q.pop();
					(vv[x][y]==-1?bl++:wh++);
					rep(k,4){
						if(vstd[x+dx[k]][y+dy[k]]==false&&(vv[x+dx[k]][y+dy[k]]==-1*vv[x][y])){
							vstd[x+dx[k]][y+dy[k]]=true;
							q.push(pll(x+dx[k],y+dy[k]));
						}
					}
				}
				ans+=(bl*wh);
			}
		}
	}
	cout<<ans<<endl;
}

 

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string s;
  cin >> s;
  set<char> chars;
  map<char, int> mp;
  rep(i, 4) {
    chars.insert(s.at(i));
    mp[s.at(i)]++;
  }

  for (char c : chars) {
    if (mp[c] != 2) {
      cout << "No" << endl;
      return 0;
    }
  }
  if (chars.size() != 2) {
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
using namespace std;
typedef long long LL;
const int N = 1005;
const int M = 200005;

template <typename T> inline void read(T &AKNOI) {
	T x = 0, flag = 1;
	char ch = getchar();
	while (!isdigit(ch)) {
		if (ch == '-') flag = -1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	AKNOI = flag * x;
}

int n, m, U[M], V[M], id[N][N], ID;
vector<int> e[N];
int vis1[N], vis2[N];
bool vis[N], ok1[N][N], ok2[N][N]; 

void DFS1(int u, int rt) {
	ok1[rt][u] = vis[u] = 1;
	for (auto v : e[u]) {
		if (vis[v]) continue;
		DFS1(v, rt);
	}
}

void DFS2(int u, int tp) {
	vis[u] = 1;
	for (auto v : e[u]) {
		if (vis[v]) continue;
		(tp == 1? vis1[v] : vis2[v]) = id[u][v];
		DFS2(v, tp);
	}
}

void init() {
	read(n); read(m);
	for (int i = 1, u, v; i <= m; ++i) {
		read(u); read(v);
		U[i] = u; V[i] = v;
		id[u][v] = ++ID;
		e[u].push_back(v);
	}
}

void solve() {
	for (int i = 1; i <= n; ++i) {
		mset(vis, 0);
		DFS1(i, i);
	}
	for (int i = 1; i <= n; ++i) {
		mset(vis, 0);
		mset(vis1, 0);
		DFS2(i, 1);
		reverse(e[i].begin(), e[i].end());
		mset(vis, 0);
		mset(vis2, 0);
		DFS2(i, 2);
		for (auto v : e[i]) {
			ok2[i][v] = (vis1[v] != id[i][v] || vis2[v] != id[i][v]);
		}
	}
	for (int i = 1; i <= m; ++i) {
		int u = U[i], v = V[i];
		puts(ok1[v][u] == ok2[u][v]? "same" : "diff");
	}
}

int main() {
	init();
	solve();
	return 0;
}


Measured memory_bytes: 12636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++)
   cin>>a[i];
  ll dp[n];
  memset(dp,0,sizeof(dp));
 dp[0]=0;
 dp[1]=abs(a[0]-a[1]);
 for(ll i=2;i<n;i++)
 dp[i]=min(abs(a[i]-a[i-2])+dp[i-2],abs(a[i]-a[i-1])+dp[i-1]);
 cout<<dp[n-1];
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		System.out.println(new Main().doWork(args));
	}

	public String doWork(String[] args) {
		Scanner reader = new Scanner(System.in);

		String st = reader.next();
		String o1 = "YYMM";
		String o2 = "MMYY";
		String o3 = "AMBIGUOUS";
		String o4 = "NA";

		reader.close();

		int st1 = Integer.parseInt(st.substring(0, 2));
		int st2 = Integer.parseInt(st.substring(2));

		if (1 <= st1 && st1 <= 12) {
			if (1 <= st2 && st2 <= 12) {
				return o3;
			} else {
				return o2;
//			} else {
//				return o4;
			}
		} else {
			if (1 <= st2 && st2 <= 12) {
				return o1;
//			} else if (13 <= st2) {
//				return o4;
			} else {
				return o4;
			}
		}

		//		return ch.substring(0, k - 1) + ch.substring(k - 1, k + 1 - 1).toLowerCase() + ch.substring(k + 1 - 1);
	}
}


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

int main() {
	// your code goes here
	int n;
	cin>>n;
	vector<vector<int>> arr(n,vector<int>(3));
	for(int i=0;i<n;i++)
	{
	    for(int j=0;j<3;j++)
	    {
	        cin>>arr[i][j];
	    }
	}
	vector<int> prevDp(arr[0].begin(),arr[0].end());
	
	for(int i=1;i<n;i++)
	{
	    vector<int> curDp(3,0);
	    for(int j=0;j<3;j++)
	    {
	       for(int k=0;k<3;k++)
	       {
	           if(j==k)
	            curDp[k] = max(curDp[k],max(arr[i][k],prevDp[j]));
	           else
	            curDp[k] = max(curDp[k],prevDp[j]+arr[i][k]);
	       }
	    }
	    prevDp = curDp;
	   // for(int k=0;k<3;k++)
	   //     cout<<prevDp[k]<<" ";
	   // cout<<endl;
	   
	}
	int ansmax=INT_MIN;
	for(int i=0;i<3;i++)
	    ansmax = max(ansmax,prevDp[i]);
	cout<<ansmax<<endl;
	return 0;
}


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

int main() {
  int n, c = 0;
  vector<int> v;
  cin >> n;
  int p[n];
  REP(i, n) cin >> p[i];

  REP(i, n - 2) {
    if(p[i + 1] != min(min(p[i], p[i + 1]), p[i + 2])
    && p[i + 1] != max(max(p[i], p[i + 1]), p[i + 2])) ++c;
  }

  cout << c << endl;

  return 0;
}

Measured memory_bytes: 256
void main()
{
    int[] tmp = readln.split.to!(int[]);
    int n = tmp[0], a = tmp[1], b = tmp[2];
    writeln((b - a) & 1 ? "Borys" : "Alice");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
n, x, y = map(int, input().split())
if x > y:
    x, y = y, x

xy = y - x

ans = [0 for i in range(n)]

for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        if i == j:
            continue
        if (i <= x and j <= x) or (i >= y and j >= y):
            ans[j - i] += 1
        elif i <= x and y <= j:
            ans[j - i - xy + 1] += 1
        else:
            ans[min(j - i, abs(x - i) + abs(y - j) + 1)] += 1

for i in ans[1:]:
    print(i)


Measured memory_bytes: 3444
N=int(input())

m=[1,6,6**2,6**3,6**4,6**5,6**6,9,9**2,9**3,9**4,9**5]
m.sort()
cnt=[0]*(N+1)
for i in range(1,N+1):
    #print('i',i)
    formararr=[]
    for l in m:
        #print('l',l)
        if i>=l:
            formararr.append(cnt[i-l])
        cnt[i]=min(formararr)+1
print(cnt[N])

Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+9
#define MOD 1000000007
using namespace std;


int main(){
    int a[5];
    int k;
    for(int i=0; i<5; i++){
        cin >> a[i];
    }
    cin >> k;
        if(a[4]-a[0]>k){
            cout<<":("<<endl;
            return 0;
        }
    cout<<"Yay!"<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		int max = 0, total = 0;
		int[] a = new int[n];
		for (int i = 0; i < n; i ++) {
			a[i] = sc.nextInt();
			total += a[i];
		}
		int c = 0;
		for (int z : a) {
			if (z * 4 * m >= total ) {
				c++;
			}
		}

		if (c >= m) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 24916
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &in, vector<T> &vec) {
    for (auto &e : vec) in >> e;
    return in;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    int N;
    read(N);
    map<int, int> even, odd;

    rep(i, N) {
        int a; read(a);
        if (i & 1) {
            odd[a] += 1;
        } else {
            even[a] += 1;
        }
    }

    vector<pii> x, y;
    int xcnt = 0;
    int ycnt = 0;
    for (const auto &e : even) {
        x.emplace_back(e.second, e.first);
        xcnt += e.second;
    }
    for (const auto &e : odd) {
        y.emplace_back(e.second, e.first);
        ycnt += e.second;
    }
    x.emplace_back(0, -1);
    y.emplace_back(0, -1);
    sort(all(x), greater<>());
    sort(all(y), greater<>());

    i64 ans = INF;
    rep(i, 2) rep(j, 2) {
        const int numx = x[i].second;
        const int numy = y[j].second;
        if (numx == numy) continue;
        trace(x[i], y[j]);
        chmin(ans, (xcnt - x[i].first) + (ycnt - y[j].first));
    }

    print(ans);
    return 0;
}


Measured memory_bytes: 7288
import sys
input = sys.stdin.readline
N, K = [int(x) for x in input().split()]
V = [int(x) for x in input().split()]

ans = 0
for i in range(K + 1):
    for j in range(K + 1 - i):
        k = K - i - j
        tmp = list()
        tmp.extend(V[:min(i, N)])
        tmp.extend(V[max(i, N - j):N])
        tmp.sort(reverse=True)
        for _ in range(k):
            if len(tmp) > 0 and tmp[-1] < 0:
                tmp.pop()
        ans = max(ans, sum(tmp))

print(ans)




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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(), a.rend()
#define ll long long
#define endl "\n"

typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;

#define for0(i, a, b) for(int i = a; i < b; ++i)
#define for1(i, b, a) for(int i = b; i >= a; --i)
#define test_case(t) int t; cin >> t; while (t--)

#define prec(n) fixed<<setprecision(n)
#define inf (int)(1e18)
#define MAX 1000002
#define MOD 1e9 + 7

void solve() {
    string s;
    cin>>s;

    if(*s.rbegin() == 's')
        s += "es";

    else
        s += "s";

    cout<<s<<endl;
}

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

    int t = 1;

    //cin>>t;
    while(t--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3600
S,T = gets.strip.split.map(&:to_s)
A,B = gets.strip.split.map(&:to_i)
U = gets.strip.to_s

if U == S then
  puts "#{A-1} #{B}"
elsif U == T then
  print "#{A} #{B-1}"
else
  print "#{A} #{B}"
end
#空白入れて出力の時はこのように書く＃を使う。

Measured memory_bytes: 14424
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
const ll inf = 1e18+5;
const ll mod = 1e9+7;
ll n, a[10005], ans, bigg[1000005];
map<ll, ll> m[10005]; //each index stores a map of the prime factors and their powers
ll add(ll x, ll y){
	return (x%mod + y%mod+mod)%mod;
}
ll mult(ll x,ll y){
	return (x%mod * y%mod+mod)%mod;
}
void sieve(ll x, ll ind){ 
	while (x % 2 == 0){
		x /= 2;
		(m[ind].find(2) == m[ind].end()? m[ind][2] = 1:m[ind][2]++);
		if (m[ind][2] > bigg[2])bigg[2] = m[ind][2];
	}
	for (ll i= 3; i <= sqrt(x); i++){
		while (x % i == 0){
			x /= i;
			(m[ind].find(i) == m[ind].end()? m[ind][i] = 1:m[ind][i]++);
			if (m[ind][i] > bigg[i])bigg[i] = m[ind][i];
		}
	}
	if (x > 2){
		(m[ind].find(x) == m[ind].end()? m[ind][x] = 1:m[ind][x]++);
		//~ bigg[x]++;
		if (m[ind][x] > bigg[x])bigg[x] = m[ind][x];
	}
}
ll quick_expo(ll x, ll exp){
	ll anss = 1, base = x;
	while (exp){
		if (exp & 1)anss *= base;
		base *= base;
		base %= mod;
		anss %= mod;
		exp >>= 1;
	}
	return anss;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> n;
	for (ll i = 0; i< n;i++){
		cin >> a[i];
		sieve(a[i], i);
	}
	vector<ll> v;
	for (ll i = 0; i < 1000001; i++){
		if (bigg[i] != 0){
			v.pb(i);
		}
	}
	for (ll i = 0; i< n; i++){
		ll cur = 1;
		//~ auto it = m[i].begin();
		//~ while (it != m[i].end()){
			//~ ll k = it->F;
			//~ ll v = it->S;
			//~ cur = mult(cur, mult(bigg[k]-v, k));
			//~ it++;
		//~ }
		for (auto ii:v){ //each guy
			if (m[i].find(ii) != m[i].end()){//here have
				cur = mult(cur, quick_expo(ii, bigg[ii]-m[i][ii]));
			}else{ //mult full thing
				cur = mult(cur, quick_expo(ii, bigg[ii]));
			}//not mult but exponential oof 
		}
		ans = add(ans, cur);
	}
	cout << ans;
	//~ ll i = 0;
	//~ auto it = m[i].begin();
		//~ while (it != m[i].end()){
			//~ ll k = it->F;
			//~ ll v = it->S;
			//~ cout << k << ' ' << v << '\n';
			//~ it++;
		//~ }
	//~ for (ll i = 0; i <= 5; i++)cout << bigg[i] << ' ';
}


Measured memory_bytes: 9984
#include<cstdio>
#include<utility>
#include<algorithm>
using namespace std;


const int MAX_N = 100000;
const int MAX_V = 1000000000;

int N;
int X[MAX_N];
int L[MAX_N];

void input(){
    scanf("%d", &N);
    for(int i=0;i<N;i++){
        scanf("%d%d", X+i,L+i);
    }
}

pair<int, int> point[MAX_N];

void solve(){
    for(int i=0;i<N;i++){
        point[i].first = X[i] + L[i];
        point[i].second = X[i] - L[i];
    }
    sort(point,point+N);

    int ans = 0, t = -1000000000;
    for(int i=0;i<N;i++){
        if(t<=point[i].second){
            ans++;
            t = point[i].first;
        }
    }

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

int main (){
    input();
    solve();
    return 0;
}

Measured memory_bytes: 1664
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn main() {
    let a:usize = read().unwrap();
    let b:usize = read().unwrap();
    let c:usize = read().unwrap();

    let tmp = a;
    let a = b;
    let b = tmp;

    let tmp = c;
    let c = a;
    let a = tmp;

    println!("{} {} {}", a, b, c);
}

Measured memory_bytes: 4352
package main

import "fmt"

var N, K int
var d []int
var A[][]int
var x int

func input() {
  fmt.Scan(&N, &K)
  d = make([]int, K)
  A = make([][]int, K)
  
  for i:=0; i<K; i++ {
    fmt.Scan(&x)
    d[i] = x
    A[i] = make([]int, x)
    
    for j:=0; j<d[i]; j++ {
      fmt.Scan(&x)
      A[i][j] = x
    }
  }
}

func solve() {
  var ans int = 0
  for i:=1; i<=N; i++ {
    var have bool = false
    for _, v := range A {
      for _, p := range v {
        if p == i {
          have = true
        }
      }
    }
    if have==false {
        ans++
    }
  }
  fmt.Println(ans)
}

func main() {
  input()
  solve()
}

Measured memory_bytes: 2516
from collections import deque;h,w,k=map(int,input().split());m=[input()for _ in[0]*h];v=[[-1]*w for _ in[0]*h];r=9**20
for i in range(h):
 if'S'in m[i]:j=m[i].index('S');q=deque([[i,j]]);v[i][j]=0
while q:
 y,x=q.popleft();r=min(r,y,x,h-1-y,w-1-x)
 for i,j in([1,0],[-1,0],[0,1],[0,-1]):
  t,u=y+i,x+j
  if t+1and t<h and u+1and u<w and m[t][u]=='.'and v[t][u]<0and v[y][x]<k:v[t][u]=v[y][x]+1;q.append([t,u])
print(1-(-r//k))

Measured memory_bytes: 58972
s = list(input())
s2 = s[:]
k = int(input())

s1_count = 0
for i in range(1, len(s)):
    if s[i-1] == s[i]:
        s1_count += 1
        s[i] = '-'

if k == 1:
    print(s1_count)
elif s[0] != s[-1]:
    print(s1_count * k)
elif len(list(set(s2))) == 1:
    if len(s) % 2 == 0:
        print(s1_count * k)
    else:
        s2_count = s1_count + 1
        if k % 2 == 0:
            print(int((s1_count + s2_count) * (k // 2)))
        else:
            print(int((s1_count + s2_count) * (k // 2) + s1_count))
else:
    s2_count = 0
    if s[-1] == '-':
        print(s1_count * k)
    else:
        s2[0] = '-'
        s2_count += 1
        for i in range(1, len(s2)):
            if s2[i-1] == s2[i]:
                s2_count += 1
                s2[i] = '-'
        print(s1_count + s2_count * (k-1))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { ll X;
  cin >> X;
  ll num = 100;
  int cnt = 0;
  while(num<X){
    cnt++;
    num += 0.01*num;
  }
  cout << cnt << endl;
  }

Measured memory_bytes: 3636
val nodeList = arrayListOf<Long?>(null)

fun main(args: Array<String>) {

    val nodeCount = readLine()!!.toInt()

    val nodeKeys = readLine()!!.split(" ")

    // ヒープに格納
    for (i in 1..nodeCount) {
        nodeList.add(i, nodeKeys[i - 1].toLong())
    }

    // 表示
    for (i in 1..nodeCount) {

        val parentNodeKey = getParentNode(i)
        val leftNodeKey = getLeftNode(i)
        val rightNodeKey = getRightNode(i)

        var label = "node $i: key = ${nodeList[i]}, "
        if (parentNodeKey != null) {
            label += "parent key = $parentNodeKey, "
        }
        if (leftNodeKey != null) {
            label += "left key = $leftNodeKey, "
        }
        if (rightNodeKey != null) {
            label += "right key = $rightNodeKey, "
        }
        println(label)
    }
}


fun getLeftNode(index: Int): Long? {
    val leftNodeIndex = index * 2
    return nodeList.getOrNull(leftNodeIndex)
}

fun getRightNode(index: Int): Long? {
    val rightNodeIndex = index * 2 + 1
    return nodeList.getOrNull(rightNodeIndex)
}

fun getParentNode(index: Int): Long? {
    val parentNodeIndex = Math.floor(index.toDouble() / 2).toInt()
    return nodeList.getOrNull(parentNodeIndex)
}


Measured memory_bytes: 32564
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int a, b;
	cin >> a >> b;
	cout << (a-1)*(b-1) << endl;
}

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

typedef long long ll;
typedef long double ld;

int boja(int x){
    if(x <= 399) return 1;
    if(x <= 799) return 2;
    if(x <= 1199) return 3;
    if(x <= 1599) return 4;
    if(x <= 1999) return 5;
    if(x <= 2399) return 6;
    if(x <= 2799) return 7;
    if(x <= 3199) return 8;
    return 9;
}

map <int, int> br;

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n;
    cin >> n;
    for(int i=1; i<=n; i++){
        int x;
        cin >> x;
        br[boja(x)]++;
    }
    int res = 0;
    for(int i=1; i<=8; i++){
        if(br[i]) res++;
    }
    if(!br[9]){
        cout << res << " " << res << "\n";
    }
    if(br[9]){
        if(res == 0) cout << 1;
        else cout << res;
        cout << " " << res + br[9];
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char S[3]; char T[3];
  int N;
  cin >> S >> T;
  
  for(int i = 0;i < 3;i++){
    if(S[i] == T[i]) N++;
  }
  cout << N << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    int ans = 1;
    for (int i = 2; i <= 1000; i++) {
        int num = i * i;
        while (num <= x) {
            ans = max(ans, num);
            num = num * i;
        }

    }
    cout << ans;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vi;
typedef long double td;
typedef vector<td> vd;
typedef pair<ll,ll> ii;
typedef vector<ii> vii; typedef vector<bool> vb;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(ll i = ll(a); i < (ll)(b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define show(v,n) cerr << #v << " = "; forn(i,n) cerr << v[i] << " "; cerr << endl;
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl
int MAXN = 500005;

int solve(vector <string> &v, int n, int m)
{
	vector < vector <int> > dp(n+1,vector <int>(m+1,0));
	int modu = (int)(1e9+7);
	dp[0][0]=1;
	forn(i,n)
	{
		forn(j,m)
		{
			if(v[i][j]=='#') continue;
			if(i>0) {dp[i][j]+=dp[i-1][j]; dp[i][j]%=modu;}
			if(j>0) {dp[i][j]+=dp[i][j-1]; dp[i][j]%=modu;}
		}
	}
	
	return dp[n-1][m-1];
}
 
int main()
{ 	
	FIN;
	#ifdef input
		freopen("test1.txt", "r", stdin);
	#endif
	
	int n, m;
	cin >> n >> m;
	vector <string> v(n);
	forn(i,n) cin >> v[i];
	cout << solve(v,n,m) << endl;
    return 0;
}

Measured memory_bytes: 8196
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n==1||n==2||n==3||n==5||n==6||n==9||n==10) cout<<"No";
	else if(n==13||n==17||n==27) cout<<"No";
	else cout<<"Yes";
  return 0;
}

Measured memory_bytes: 256
N,K = map(int, input().split())

if K%2 == 1:
    M = N//K
    print(M*M*M)
else:
    M = 2*N//K
    if M%2 == 0:
        evenM = M//2
        oddM = M//2
    else:
        evenM = (M-1)//2
        oddM = (M+1)//2
    print(evenM*evenM*evenM + oddM*oddM*oddM)

Measured memory_bytes: 38384
import re
s,t=input().replace(*"?."),input()
l,m,*c=len(s),len(t)
for i in range(l-m+1):
 if re.match(s[i:i+m],t):c+=(s[:i]+t+s[i+m:]).replace(*".a"),
print(c and min(c)or"UNRESTORABLE")

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

using namespace std;

int main(void){
    long long M, K;
    cin >> M >> K;
    long long b = 1;
    for(int i = 0; i < M; i++) b *= 2;
    if(K >= b){
        cout << -1 << endl;
        return 0;
    }
    if(M == 0){
        cout << 0 << " " << 0 << endl;
        return 0;
    }
    if(M == 1){
        if(K == 0){
            cout << "0 0 1 1" << endl;
            return 0;
        }else{
            cout << -1 << endl;
            return 0;
        }
    }
    for(int i = 0; i < b; i++){
        if(i == K) continue;
        cout << i << " ";
    }
    cout << K << " ";
    for(int i = b - 1; i >= 0; i--){
        if(i == K) continue;
        cout << i << " " ;
    }
    cout << K << endl;

    return 0;
}

Measured memory_bytes: 1792
from math import atan, pi

a, b, x = map(int, input().split())

if x == a * a * b:
  print(0)
elif x >= a * a * b / 2:
  print(atan((a*a*b-x)/(a*a*a)*2)/(2 * pi)*360)
else:
  print(90 - atan(x/(a*b*b/2))/(2 * pi)*360)


Measured memory_bytes: 3060
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)

#define INF 1e9;
#define MOD 1e9+7;
#define INF64 1e18;

#define F first
#define S second


using namespace std;

int main() {

	SINT32 A,B,C,X;
	cin >> A >> B >> C >> X;
	SINT32 cnt = 0;
	
	rep(i,0,A+1) {
		rep(j,0,B+1) {
			rep(k,0,C+1) {
				if ((500*i+100*j+50*k) == X) {
					cnt++;
				}
			}
		}
	}

	cout << cnt << endl;
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());	//ソート後に使用

//	DATA.insert(DATA.begin() + X, 0);	//X番目の要素に0を挿入


//	vector<vector<SINT32>> DP(N,vector<SINT32>(3));　//2次元配列

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

// 	vector<pair<int,pair<int,int>>> DATA(M);
//	cin >> DATA[i].first;
//	cin >> DATA[i].second.first;
//	cin >> DATA[i].second.second;


//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();	//key以上を探す
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();


/* 文字列回転
	string N;
	cin >> N;
	N = N[N.length()-1] + N.substr(0,N.length()-1);
*/

/* SET コンテナ
	set<SINT32> DATA;
	for (SINT32 i = 0; i < N; i++) {
		SINT32 buf;
		cin >> buf;
		DATA.insert(buf);
	}

	//全表示
    set<string>::iterator it; //  イテレータを用意
    for(it = DATA.begin(); it != DATA.end(); it++) {
        cout << *it << endl;
    }

	//N番目を一部表示
	set<string>::iterator it; //  イテレータを用意
	it = DATA.begin();
	rep (i,0,N) {
		it++;
	}
	cout << *it << endl;
*/

/* map
	map<string,SINT32> mp;
	SINT32 N = 0;
	SINT32 mx = 0;

	cin >> N;
	for (SINT32 i = 0; i < N; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	for(auto it=mp.begin();it!=mp.end();it++) {
		mx=max(mx,it->second);
	}

*/

Measured memory_bytes: 256
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int[] A = new int[N];

		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}

		int ans=0;


		for (int i = 0; i < N; i++) {

			if(A[i]%2==1) {
				continue;
			}

			while(A[i]%2==0) {

				A[i]=A[i]/2;
				++ans;

			}

		}

		System.out.println(ans);
	}

	//以下テンプレート

	public static int[] extgcd(int a, int b) {

		int x0 = 1;
		int x1 = 0;

		int y0 = 0;
		int y1 = 1;

		while (b != 0) {
			int q = a / b;
			int r = a % b;

			int x2 = x0 - q * x1;
			int y2 = y0 - q * y1;

			a = b;
			b = r;

			x0 = x1;
			x1 = x2;

			y0 = y1;
			y1 = y2;
		}

		return new int[] { a, x0, y0 };

	}

	static int gcd(int a, int b) {

		if (b == 0)
			return a;

		if (a < b) {
			int t = a;
			a = b;
			b = t;
		}

		return gcd(b, a % b);

	}

	static int lcm(int a, int b) {
		return a * b / gcd(a, b);
	}

	static void swap(int[] a) {
		int t;

		t = a[0];
		a[0] = a[1];
		a[1] = t;

		return;
	}

	static <T> void output(List<T> list) {

		for (int i = 0; i < list.size(); i++) {
			System.out.print(list.get(i));

			if (i != list.size() - 1) {
				System.out.print(" ");
			} else {
				nl();
			}
		}

	}

	static void output(String[][] str) {

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				print(str[i][j]);
			}

			nl();
		}

	}

	static void output(boolean flg, String Yes, String No) {

		if (flg) {
			pln(Yes);
		} else {
			pln(No);
		}

	}

	static void output(String[][] str, int digit) {

		String dig = "%" + String.valueOf(digit) + "s";

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				System.out.printf(dig, str[i][j]);
			}
			nl();
		}

	}

	static void pln(String str) {
		System.out.println(str);
	}

	static void pln(int x) {
		System.out.println(x);
	}

	static void print(String str) {
		System.out.print(str);
	}

	static void print(int x) {
		System.out.print(x);
	}

	static void print(String str, int times) {
		for (int i = 0; i < times; i++) {
			print(str);
		}
	}

	static void print(int x, int times) {
		for (int i = 0; i < times; i++) {
			print(x);
		}
	}

	static void nl() {
		System.out.println();
	}

}


Measured memory_bytes: 34212
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for (int i = (s); i < (int)(n); i++)
#define INF 100000000

using namespace std;

int main() {
   string s;
   cin >> s;
   int ans = 700;
   rep(i,3){
      if(s[i]=='o')
      ans+=100;
   }
   cout << ans << endl;
}

Measured memory_bytes: 256
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

H, W = imn()
count = [[-1 for _ in range(W)] for _ in range(H)]
queue = deque([])
A = []
for i in range(H):
    s = input()
    for j in range(W):
        if s[j] == '#': 
            queue.append((i,j))
            count[i][j] = 0
    A.append(list(s))

dx = [1, 0, -1, 0]
dy = [0, -1, 0, 1]
ans = 0
while len(queue) > 0:
    point = queue.popleft()
    for i in range(4):
        x = point[1] + dx[i]
        y = point[0] + dy[i]
        if x < 0 or x >= W or y < 0 or y >= H: continue
        if count[y][x] != -1: continue
        count[y][x] = count[point[0]][point[1]] + 1
        queue.append((y,x))
        ans = max(ans, count[y][x])
print(ans)

Measured memory_bytes: 141272
#include<bits/stdc++.h>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iostream>
#define ios   ios_base::sync_with_stdio(false);  cin.tie(0);    cout.tie(0);
typedef long long int ll;
typedef long double  ld;
using namespace std;
const int M=1e9+7;
ll a[1000001],b[1000001];
map<pair<ll,ll>,ll> ma;
int main()
{
    ios;
 ll A,B,M;cin>>A>>B>>M;
  ll um=LLONG_MAX,vm=LLONG_MAX;
 for(ll i=1;i<=A;++i)
 {cin>>a[i];um=min(a[i],um);}
 for(ll i=1;i<=B;++i)
 {cin>>b[i];vm=min(b[i],vm);}
// map<pair<ll,ll>,ll> ma;
 while(M--)
 {
    ll u,v,c;cin>>u>>v>>c;
    if(ma[make_pair(u,v)]!=0)
     ma[make_pair(u,v)]=max(ma[make_pair(u,v)],c);
     else
    ma[make_pair(u,v)]=c;
 }
 ll ans=LLONG_MAX;
    for(auto x: ma)
    {
      ll i=x.first.first;
      ll j=x.first.second;
      ans=min(ans,a[i]+b[j]-ma[make_pair(i,j)]);
    }
cout<<min(ans,um+vm);
}

Measured memory_bytes: 11392
s = input()
x, y = int(s[:2]), int(s[2:])

if 1 <= x <= 12 and 1 <= y <= 12:
    print("AMBIGUOUS")
elif 1 <= x <= 12:
    print("MMYY")
elif 1 <= y <= 12:
    print("YYMM")
else:
    print("NA")


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

using namespace std;

set<long long> s, com;

int main() {
  long long a, b;
  cin >> a >> b;
  long long x = sqrt(a);
  for (long long i = 1; i <= x; i++) {
    if (a % i == 0) {
      s.insert(i);
      if (a / i != i) s.insert(a / i);
    }
  }
  x = sqrt(b);
  for (long long i = 1; i <= x; i++) {
    if (b % i == 0) {
      if (s.find(i) != s.end()) com.insert(i);
      if (b / i != i) if (s.find(b / i) != s.end()) com.insert(b / i);
    }
  }
  for (auto i : com) {
    long long rem = -1;
    for (auto j : com) {
      if (i == j) continue;
      long long g = __gcd(i, j);
      if (g != 1) {
        rem = j;
        break;
      }
    }
    if (rem != -1) com.erase(rem);
  }
  cout << com.size() << '\n';
  return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <cstdlib>
#include <string>

int main()
{
    int x, y;
    
    std::cin >> x;
    std::cin >> y;
    
    x = (x - 1) * (y - 1);
    
    std::cout << x << std::endl;
    
    return 0;
}


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

using namespace std;

int main()
{
  int a, b;
  
  cin >> a;
  cin >> b;
  
  int c = a + b;
  
  if(c%2!=0){
  	c += 1; 
  }
  
  cout << c/2 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
using ll=long long;

const ll INF = pow(10,18)+1;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

template<typename T> bool chmin(T& a, T b) {return a > b ? a = b, true : false;}
template<typename T> bool chmax(T& a, T b) {return a < b ? a = b, true : false;}
 
int main(){
    int A[10],tmp[10];
    REP(i,5){
        cin >> A[i];
    }
    int mem = 10;
    int mem_num = 0;
    REP(i,5){
        if(A[i]%10!=0&&A[i]%10<mem){
            mem = A[i]%10;
            mem_num = i;
        }
    }
    int ans = 0;
    REP(i,5){
        if(i == mem_num || A[i]%10==0) ans += A[i];
        else ans += A[i] + (10 - A[i]%10);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>

#define X first
#define Y second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())


//INT_MAX
//INT_MIN
//LLONG_MAX
//LLONG_MIN
//DBL_MIN
//DBL_MAX
//LDBL_MIN
//LDBL_MAX

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    if (n / 100 * 100 + n / 100 * 10 + n / 100 >= n) {
        cout << n / 100 * 100 + n / 100 * 10 + n / 100 << endl;
    }else{
        cout << (n / 100 + 1) * 100 + (n / 100 + 1) * 10 + (n / 100 + 1) << endl;
    }
}


Measured memory_bytes: 256
//Compete against Yourself.
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int a[N];
string x = "bust";
string y = "win";

int32_t main(){_

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

   if (sum >= 22){
      cout<<x;
      exit(0);
   }
   
   cout<<y;
   

   return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;


  string s;
  for (int i=0; i<n; i++) {
    char tmp;
    cin>>tmp;
    s+=tmp;
  }

  string ss1,ss2;
  bool flag=false;
  for (int i=0; i<m; i++) {
    int cnt=0;
    cin>>cnt;
    ss1+=string(cnt,'0'+(int)flag);
    ss2+=string(cnt,'0'+(int)!flag);
    flag=!flag;

  }
  // cout<<s<<endl;
  //cout<<ss1<<endl;
  //cout<<ss2<<endl;


  queue<pair<string,int> >qu;
  set<string> hash;
  qu.push(make_pair(s,0));

  while(!qu.empty())
    {
      string ss=qu.front().first;
      int cnt=qu.front().second;
      qu.pop();
      if(ss==ss1 || ss==ss2)
        {
          cout<<cnt<<endl;
          break;
        }
      for(int i=0;i<ss.size()-1;i++)
        {
          string tmp=ss;
          swap(tmp[i],tmp[i+1]);
          if(hash.count(tmp)==0)
            {
              hash.insert(tmp);
              qu.push(make_pair(tmp,cnt+1));
            }

        }
    }
  return 0;

}

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

A_sum =sum(A)

ans = 0
for i in range(N):
    if A[i] >= A_sum/(4*M):
        ans += 1

if ans >= M:
    print('Yes')
else:
    print('No')
        

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

int digitsum(int n) {
	int ans = 0;
	while (n > 0) {
		ans += n % 10;
		n /= 10;
	}
	return ans;
}

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

	int n, i, j, k, ans;
	cin >> n;
	ans = n * 100;
	for (i = 1; i < n; i++) {
		ans = min(ans, digitsum(i) + digitsum(n - i));
	}
	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 256
n = int(input())
a = input().split(" ")
kotae=1
listaa = [int(n) for n in a]
lista = sorted(listaa)
if lista[0]==0:
  print(0)
  exit()
for i in range(n):
  kotae*=lista[i]
  if kotae>10**18:
    kotae=-1
    break
if kotae>10**18:
  kotae=-1
print(kotae)

Measured memory_bytes: 22460