akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int[] h = new int[n];
		for(int i = 0;i < n;i++){
			h[i] = saori.saori_hayami();
		}
		for(int i = n-1;i > 0;i--){
			if(!(h[i] >= h[i-1])){
				if(h[i] >= h[i-1]-1){
					h[i-1]--;
				} else {
					System.out.println("No");
					return;
				}
			}
		}
		System.out.println("Yes");
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((abs(a-b) <= d && abs(b-c) <= d) || abs(a - c) <= d) {
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
} 


Measured memory_bytes: 256
import numpy as np
h, w, d = map(int, input().split())
X = np.zeros(h*w, dtype=int)
Y = np.zeros(h*w, dtype=int)
score = np.zeros(h*w, dtype=int)
for x in range(h):
    inp = tuple(map(int, input().split()))
    for y in range(w):
        i = int(inp[y]) - 1
        X[i] = x
        Y[i] = y

score[d:] += np.abs(X[d:] - X[:-d]) + np.abs(Y[d:] - Y[:-d])
for i in range(len(score) - d):
    score[i+d] += score[i]

q = int(input())
ans = []
for _ in range(q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    ans.append(score[r]-score[l])

print(*ans, sep="\n")


Measured memory_bytes: 26812
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main(){
  int n;
  cin >> n;
  vi a;
  REP(i,n){
    int c;
    cin >> c;
    if(c==0){
      int x;
      cin >> x;
      a.eb(x);
    }else if(c==1){
      int p;
      cin >> p;
      cout << a[p] << endl;
    }else{
      a.pop_back();
    }
  }
}



Measured memory_bytes: 4988
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

void add(ll &a,ll b){
    a=(a+b)%MOD;
}

void mul(ll &a,ll b){
    a=a*b%MOD;
}

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

ll N;

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

  cin>>N;
  vector<ll> dp(2*N,0);
  for(int i=N;i<=2*N-1;i++) dp[i]=1;
  dp[N-1]=N;
  ll sum=0;
  for(int i=N-1;i<=2*N-1;i++) add(sum,dp[i]);

  for(int i=N-2;i>=0;i--){
      ll res=(N-1);
      mul(res,N-1);
      add(res,sum);
      add(res,MOD-dp[i+2]);

      dp[i]=res;
      add(sum,dp[i]);
      add(sum,MOD-dp[i+N+1]);
  }

  cout<<dp[0]<<endl;

  return 0;
}


Measured memory_bytes: 15872
#define R register
#include <bits/stdc++.h>
 
using namespace std;
 
const int maxn = 2e6 + 5;
 
int n, val, sum;
bitset<maxn> f;
 
int main()
{
  scanf("%d", &n);
  f[0] = 1;
  for (R int i = 1; i <= n; ++i) scanf("%d", &val), f |= (f << val), sum += val;
  if(n == 1) return printf("%d", sum), 0;
  for (R int i = (sum >> 1); i; --i) if(f[i]) return printf("%d", sum - i), 0;
}

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

#define int long long
#define debug(x) cout<<#x<<" "<<x<<endl;

const int N=1e6+5;
const double eps=1e-9;
const int INF=1e18;

signed main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    string x;
    cin>>x;
    for(int i=0;i<x.size();i++){
        if(x[i]=='7'){
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}

//Created Time  :2020/4/12 20:06:46


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int p, q, r;
  cin >> p >> q >> r;
  int res = min({p+q, q+r, p+r});
  cout << res << endl;
}


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

constexpr int MAX_N=100;

int n;

int s[MAX_N];

int main() {
    std::cin>>n;
    for(int i=0;i<n;++i)
        std::cin>>s[i];
    std::sort(s,s+n);

    int ans=std::accumulate(s,s+n,0);

    if(ans%10!=0){
        std::cout<<ans<<std::endl;
        return 0;
    }

    for(int i=0;i<n;++i){
        if(s[i]%10!=0){
            std::cout<<ans-s[i]<<std::endl;
            return 0;
        }
    }

    std::cout<<0<<std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);

	// #ifndef ONLINE_JUDGE
 //    freopen("input.txt" , "r" , stdin);
	// freopen("output.txt" , "w" , stdout);
	// #endif

	ll n,k,m=1e9+7,ans=0,k1,k2;
	cin>>n>>k;
	k1=((k*(k+1))/2)%m;
	k2=((k*(k-1))/2)%m;
	ll a[n+1];
	for(ll i=1;i<=n;i++)
		cin>>a[i];
	ll b[n+1]={0},c[n+1]={0};
	b[1]=0;
	for(ll i=2;i<=n;i++)
	{
		for(ll j=1;j<i;j++)
		{
			if(a[j]>a[i])
				b[i]++;
			else if(a[j]<a[i])
				c[i]++;
		}
		ans=(ans+b[i]*k1)%m;
		ans=(ans+c[i]*k2)%m;

	}
	cout<<ans<<endl;

	
	
}


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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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


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

    s.erase(s.end()-1);
    if( s.size()%2 != 0 )s.erase(s.end()-1);

    string front = "";
    string last = "";
    rep(i, s.size()/2) front += s[i];
    REP(i, s.size()/2, s.size()) last += s[i];

    while( front != last )
    {
        front = "";
        last = "";
        s.erase(s.end()-1);
        s.erase(s.end()-1);
        rep(i, s.size()/2) front += s[i];
        REP(i, s.size()/2, s.size()) last += s[i];
    }
    cout << front.size()+last.size() << endl;
}


Measured memory_bytes: 256
from collections import Counter
n = int(input())

a = list(map(int,input().split()))
q = int(input())

cnt = Counter(a)
tot = 0
for k,v in cnt.items():
    tot += (k*v)

for i in range(q):
    b,c = map(int,input().split())
    tot -= b*cnt[b]
    tot -= c*cnt[c]
    cnt[c] += cnt[b]
    cnt[b] = 0
    tot += b*cnt[b]
    tot += c*cnt[c]
    print(tot)


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

int main(){
  int n,k; cin>>n>>k;
  vector<int> v(n);
  rep(i,n){cin>>v[i];}
  sort(v.begin(),v.end());
  vector<int> vec;
  int c=0;
  rep(i,n){
    if(i==0){c++;}
    else if(v[i]==v[i-1]){c++;}
    else {vec.push_back(c);c=1;}    
    if(i==n-1){vec.push_back(c);}
  }
  sort(vec.begin(),vec.end());
  int ans=0;
  rep(i,vec.size()-k){ans+=vec[i];}
  cout<<ans;
}



Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  int min = 10000;
  cin >> a;
  while(a > 0){
    int b;
    cin >> b;
    int c = 0;
    while(b%2==0){
      b /= 2;
      c += 1;
    }
    if(min > c)
      min = c;
    a--;
  }
  cout << min << endl;
}

Measured memory_bytes: 256
/**
 * @author      : cromarmot (yexiaorain@gmail.com)
 * @license     : GPL
 * @created     : 星期六 9月 28, 2019 20:30:23 CST
 */

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

typedef long long ll;
#define ten5 100000+10
#define MOD 1000000007
#define rep(i,a,n) for (int i=a;i<n;i++)
#define iif(c,t,f) ((c)?(t):(f))
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
const double pi = acos(-1.0);

int n,m;

// 有向图  no self-loops or multiple edges.
vector<int>p2[1010];

tuple<int,int,int> stk[1010][1010];

vector<int>ans;
map<int,int>vis[1010];
int st[1010] ;
int rear[1010] ;

void printpick(int idx,tuple<int,int,int>tup){
  while(get<1>(tup) != -1){
    ans.pb(get<0>(tup));
    tup = stk[idx][get<1>(tup)];
  }
  ans.pb(get<0>(tup));
  printf("%d\n",int(ans.size()));
  per(i,0,ans.size()){
    printf("%d\n",ans[i]);
  }
}

bool rootfind(int idx,int dep){
  if(dep == 2){
    stk[idx][rear[idx]++] = make_tuple(idx,-1,0);
    vis[idx][idx] = true;
  }
  while(st[idx] < rear[idx]){
    auto pick = stk[idx][st[idx]];
    if(get<2>(pick) == dep)break;
    for(auto item : p2[get<0>(pick)]){
      if(dep == get<2>(pick) + 1){
        if(item == idx){
          printpick(idx,pick);
          return true;
        }
      }
      if(vis[idx][item])continue;
      vis[idx][item] = true;
      stk[idx][rear[idx]++] = make_tuple(item,st[idx],get<2>(pick)+1);
    }
    st[idx]++;
  }
  return false;
}

int main(){
  cin>>n>>m;
  rep(i,0,m){
    int a,b;
    scanf("%d %d",&a,&b);
    p2[a].pb(b);
  }
  rep(len,2,n+1){
    rep(i,1,n+1){
      int ret = rootfind(i,len);
      if(ret) return 0;
    }
  }
  cout<<-1<<endl;
  return 0;
}

/*
 *
 * hash prime
   61,83,113,151,211,281,379,509683,911
   1217,1627,2179,2909,3881,6907,9209
   12281,16381,21841,29123,38833,51787,69061,92083
   122777,163729,218357,291143,388211,517619,690163,999983
   1226959,1635947,2181271,2908361,3877817,5170427,6893911,9191891
   12255871,16341163,21788233,29050993,38734667,51646229,68861641,91815541
   122420729,163227661,217636919,290182597,386910137,515880193,687840301,917120411
   1000000007,1000000009
 * */



Measured memory_bytes: 59136
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(n);i++)
#define chmax(x, y) { x = max(x, y); }
#define chmin(x, y) { x = min(x, y); }

int main(){
    int a;
    cin>>a;

    cout<<a+a*a+a*a*a<<endl;
    return 0;
}

Measured memory_bytes: 3596
#define SUBMIT

#include <bits/stdc++.h>

using namespace std;

int64_t compute_min_diff(int64_t h, int64_t w) {
    int64_t ans = h * w;
    for (int64_t y = 1; y < h; ++y) {
        // horizontal line case
        int64_t h_line = y + (h - y) / 2;
        int64_t s1 = y * w;
        int64_t s2 = (h_line - y) * w;
        int64_t s3 = (h - h_line) * w;
        ans = min(ans, max({s1, s2, s3}) - min({s1, s2, s3}));

        // vertical line case
        int64_t v_line = w / 2;
        int64_t s4 = (h - y) * v_line;
        int64_t s5 = (h - y) * (w - v_line);
        ans = min(ans, max({s1, s4, s5}) - min({s1, s4, s5}));
    }

    return ans;
}

int main() {
#ifdef SUBMIT
    auto& in = cin;
#else
    stringstream in(R"(100000 100000
)");
#endif
    int h, w;
    in >> h >> w;

    auto ans = min(compute_min_diff(h, w), compute_min_diff(w, h));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    int ans=0;
    cin>>a;
    for(int i=0;i<a.size();i++)
    {
        if(a[i]=='1')ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#
# File    : B.rb
# Author  : Kazune Takahashi
# Created : 11/20/2018, 11:14:05 PM
# Powered by Visual Studio Code
#

a = gets.to_i
b = gets.to_i

if a > b
  puts "GREATER"
elsif a < b
  puts "LESS"
else
  puts "EQUAL"
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
const int INF=1e9+7;

int main() {
	ll H,W,r=INF,t,c1,c2,c3;
	cin >> H >> W;

	rep(i,2) {
		rep(j,H) {
			t = j+1;

			c1 = t*W;
			c2 = (H-t)*(W/2);
			c3 = H*W-c1-c2;
			r = min(r, max(c1,max(c2,c3))-min(c1,min(c2,c3)));

			c2 = ((H-t)/2)*W;
			c3 = H*W-c1-c2;
			r = min(r, max(c1,max(c2,c3))-min(c1,min(c2,c3)));
		}
		swap(H,W);
	}

	cout << r << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  long long k;
  scanf("%lld",&k);
  long long a[51];
  int i;
  for(i=0;i<50;i++)
    a[i]=i;
  for(i=0;i<50;i++)
    a[i]+=k/50;
  for(i=0;i<k%50;i++)
    a[49-i]++;
  puts("50");
  for(i=0;i<50;i++)
    printf("%lld ",a[i]);
  puts("");
  return 0;
}


Measured memory_bytes: 1692
#include <bits/stdc++.h>
#define int long long int
using namespace std;
signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t;
	t = 1;
	//cin >> t;
	while (t--)
	{
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		cout << max(max(max(a * c, a * d), b * c), b * d);
	}
}


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

using namespace std;

int N, M;
vector<pair<int, int>> indexH;
vector<bool> pass;
vector<unordered_set<int>> to;
int num = 0;

bool dfs(int n){
  pass[n] = true;
  bool ret = true;
  for(auto &next : to[n]){
    if(pass[next]) continue;
    if(indexH[next].second == indexH[n].second) ret = false;
    if(indexH[next].second <= indexH[n].second) dfs(next);
  }
  return ret;
}

int main(){
  cin >> N >> M;
  to.resize(N);
  pass.resize(N, false);
  indexH.resize(N);
  
  for(int i=0; i<N; i++){
    int h;
    cin >> h;
    indexH[i].first = i;
    indexH[i].second = h;
  }
  for(int i=0; i<M; i++){
    int a, b;
    cin >> a >> b;
    to[a-1].emplace(b-1);
    to[b-1].emplace(a-1);
  }
  
  auto sorted = indexH;
  sort(sorted.begin(), sorted.end()
       , [](pair<int, int> &l, pair<int, int> &r){return l.second > r.second;});
  
  for(auto &p : sorted){
    if(pass[p.first]) continue;
    if(dfs(p.first)) ++num;
  }
  
  cout << num << endl;
  return 0;
}

Measured memory_bytes: 19896
//
//  main2.cpp
//  XcodeProcon
//
//  Created by たかえすみずき on 2017/10/26.
//  Copyright © 2017年 homesentinel2147483648. All rights reserved.
//

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15

//ここから編集する


int main() {
    int N;
    cin >> N;
    int L;
    cin >> L;
    vector<string> s;
    for(int i = 0; i < N; i++){
        string str;
        cin >> str;
        s.push_back(str);
    }
    sort(s.begin(),s.end());
    
    for(int i = 0; i < N; i++){
        cout << s[i];
    }
    cout << endl;
    
    return 0;
    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    int N;
    cin >> N;
    vl A(N), B(N), C(N);
    REP(i, 0, N) cin >> A[i];
    REP(i, 0, N) cin >> B[i];
    REP(i, 0, N) cin >> C[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    vl B_count(N), B_cum(N);

    long ans = 0;
    REP(i, 0, N){
        int b = B[i];
        auto c_Itr = upper_bound(C.begin(), C.end(), b);
        B_count[i] = C.end() - c_Itr;
    }
    B_cum[N-1] = B_count[N-1];
    for(int i = N-2; i>=0 ;i--){
        B_cum[i] = B_cum[i+1] + B_count[i];
    }
    REP(i, 0, N){
        int a = A[i];
        auto b_Itr = upper_bound(B.begin(), B.end(), a);
        ans += B_cum[b_Itr - B.begin()];
    }
    cout << ans << endl;

}

Measured memory_bytes: 7224
#include <stdio.h>
 
int main(void)
{
  int A, B, max, i;
 
  scanf("%d %d", &A, &B);
 
  max = A + B;
  if(A - B > max){
     max = A - B;
     if(A * B > max) max = A * B;
  }
  else{
     if(A * B > max) max = A * B;
  }
  printf("%d", max);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  string a; cin >>a;
  vector<int> cnt(26,0);
  int s=0,n=a.size();
  li ans=1;
  rep(i,n){
    ans+=s-cnt[a[i]-'a'];
    s++; cnt[a[i]-'a']++;
  }
  print(ans);
}


Measured memory_bytes: 3740
using System;

namespace abc118A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            if (B % A == 0)
                Console.WriteLine(A + B);
            else
                Console.WriteLine(B - A);
        }
    }
}


Measured memory_bytes: 13140
from fractions import gcd
# from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
# input = sys.stdin.readline

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def main():
    c = input()
    print(chr(ord(c)+1))
    
            
                

        




    


if __name__ == '__main__':
    main()


Measured memory_bytes: 66028
n, Y = map(int, input().split())
Y //= 1000
for z in range(Y//10+1):
    for y in range((Y-z*10)//5+1):
        x = Y - z*10 - y*5
        if x < 0:
            break
        if x + y + z == n:
            print(z, y, x)
            exit(0)
print(-1, -1, -1)


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

def prime_factorize(n):
    a=[]
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f* f <= n:
        if n %f == 0:
            a.append(f)
            n //= f
        else:
            f+=2
    if n != 1:
        a.append(n)
    return a

num_list = prime_factorize(N)

from collections import defaultdict
d = defaultdict(int)

for key in num_list:
    d[key] += 1

cnt = 0
for key,value in d.items():
    for i in range(1,value+1):
        if value-i >= 0:
            cnt+=1
            value -= i
            
print(cnt)

Measured memory_bytes: 9488
n = int(input())
Bs = list(map(int, input().split()))
Ans = []
for i in range(0, n):
    if i == 0:
        Ans.append(Bs[0])
        continue
    if i == n-1:
        Ans.append(Bs[i-1])
        continue
    Ans.append(min([Bs[i-1], Bs[i]]))
print(sum(Ans))



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

def dfs(s):
  if int(s) > N:
    return 0
  
  ret = 1 if all(s.count(c) > 0 for c in '753') else 0
  for c in '753':
    ret += dfs(s + c)
  return ret
  
print(dfs('0'))
  

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

int main(){
int n=0;
  string s = "";
  
  cin >> n >> s;
  int count = 0;

  for(int i =0; i<n-2 ;i++){
   if(s.at(i)=='A' && s.at(i+1)=='B' && s.at(i+2)=='C' ){
    count ++; 
   }
  }
  
cout << count;
  
}

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

using namespace std;

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

    vector<int> r(n);
    for(int i=0;i<n;i++)
    {
        cin >> r.at(i);
    }

    int minv = r.at(0);
    int maxv = INT_MIN;
    for (int i = 1; i < n; i++)
    {
        maxv = max(maxv, r.at(i) - minv);
        minv = min(minv, r.at(i));
    }

    cout << maxv << endl;
}



Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;

int H,W;
char C[105][105];
char D[205][105];

int main(){ 

cin.tie(0);
ios::sync_with_stdio(false);

cin>>H>>W;

for(int h=1; h<=H; h++){
	for(int w=1; w<=W; w++){
		cin>>C[h][w];
	}
}

for(int h=1; h<=2*H; h++){
	for(int w=1; w<=W; w++){
		D[h][w]=C[(h+1)/2][w];
	}
}

cout<<endl;

for(int h=1; h<=2*H; h++){
	for(int w=1; w<=W; w++){
		cout<<D[h][w];
	}
	cout<<endl;
}

}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
write = sys.stdout.write
n, q = map(int, readline().split())
 
N0 = 2**(n-1).bit_length()
INF = 2**31-1
data = [INF]*(2*N0)

def update(k, x):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = min(data[2*k+1], data[2*k+2])

def query(l, r):
    L = l + N0; R = r + N0
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = min(s, data[R-1])
 
        if L & 1:
            s = min(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s
 
 
ans = []
for q in range(q):
    t, x, y = map(int, readline().split())
    if t:
        ans.append(str(query(x, y+1)))
    else:
        update(x, y)
write("\n".join(ans))
write("\n")


Measured memory_bytes: 12516
#include <iostream>

using namespace std ;

int mod(int x){
    if (x<0)
        x = -x ;
    return x ;
}

int min(int a, int b){
    if (a<b)
        return a ;
    else
        return b ;
}

void print_array(int a[], int n){
    for (int i=0 ; i<n ; i++)
        cout << a[i] << " " ;
    cout << endl ;
}

int frog1(int h[], int n, int k){
    int cost[n], temp ;
    
    cost[0] = 0 ;
    cost[1] = mod(h[1] - h[0]) ;
    for (int i=1 ; i<n ; i++){
        cost[i] = cost[i-1] + mod(h[i] - h[i-1]) ;
        for (int j=1 ; j<=k ; j++){
            if (i-j<0)
                break ;
            cost[i] = min(cost[i], cost[i-j] + mod(h[i] - h[i-j])) ;
        }
    }
    return cost[n-1] ;
}

int main(){
    int n, k ;
    cin >> n >> k;
    int h[n] ;

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

    cout << frog1(h, n, k) << endl ;

    return 0 ;
}



Measured memory_bytes: 1024
h,i={},-1;(?1..?6).map{|a|(?1..?5).map{|b|h[a+b]=([*?a..?z].join+".?! ")[i+=1]}};$<.map{|x|a=x.chop.scan(/..?/).map{|p|h[p]};puts a.all?? a.join: "NA"}

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

int main() {

  int x;
  cin >> x;
  
  int s=0;
  for (int i=0; i<3; i++) {
    if (x%10==1) s+=1;
    x/=10;
  }
  
  cout << s << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

from functools import lru_cache

def main(): 
    N = II()
    h = LI()

    @lru_cache()
    def min_cost(x):
        if x == 0: return 0
        elif x == 1: return abs(h[1] - h[0])
        else: return min(min_cost(x-1) + abs(h[x] - h[x-1]), min_cost(x-2) + abs(h[x] - h[x-2]))

    print(min_cost(N-1))

main()

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

int main(){
    int H, W;
    cin >> H >> W;
    vector<string> a(H);

    for(int i = 0; i < H; i++){
        cin >> a.at(i);
    }

    for(int i = 0; i < W+2; i++){
        cout << "#";
    }
    cout << endl;

    for(int i = 0; i < H; i++){
        cout << "#" << a.at(i) << "#" << endl;
    }

    for(int i = 0; i < W+2; i++){
        cout << "#";
    }
    cout << endl;

}

Measured memory_bytes: 3584
import java.util.*;
class Main{
public static void main(String args[]){

        Scanner sc= new Scanner(System.in);
        char[] n = sc.nextLine().toCharArray();
        for(int i=0;i<3;i++){
            if(n[i]=='7'){
                System.out.println("Yes");
                return;
            }
            
        }
        System.out.println("No");
    


}
}

Measured memory_bytes: 35596
#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;
#define int                 long long
#define FF(i,a,b)           for(int i=a;i<b;i++)
#define BF(i,a,b)           for(int i=a;i>=b;i--)
#define vi                  vector<int>
#define MAP                 map<int,int>
#define pb                  push_back
#define MP                  make_pair
#define F                   first
#define S                   second
#define pi                  pair<int,int>
#define all(v)              v.begin(),v.end()
#define PIE                 3.1415926535897932384626433832795
#define FastIO              ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
//#define ordered_set         tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
/*

    order_of_key (k) : Number of items strictly smaller than k .
    find_by_order(k) : K-th element in a set (counting from zero).

*/
/**************************************************************************************/
                       /*Global Variables*/
const int mod = 1e9+7;
const int N = 2e5+10;
const int inf = 3e18;

/**************************************************************************************/
template <typename A>istream& operator>>(istream& input,vector<A>& x) {for(auto& i:x)input>>i;return input;}
template<typename A>ostream& operator<<(ostream& output,vector<A>& x) {for(auto& i:x)output<<i<<' ';return output;}
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
int Power(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b&1)res*=a;
        a*=a;
        b>>=1;
    }
    return res;
}
signed main()
{
    FastIO;
    int T=1;
    //cin>>T;
    while(T--)
    {
        int a,b;
        cin>>a>>b;
        cout<<a*b<<"\n";
    }

}
/*
|| Do what you can with all you have,wherever you are. ||

|| Knowing is not enough, we must apply. Wishing is not enough, we must do. ||

|| A goal is a dream with deadline. ||

|| Whether you think you can or you think you can't, you're right. ||

|| A year from now you may wish you had started today ||
*/



Measured memory_bytes: 3640
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Control.Monad.State

main :: IO ()
main = getc (solve . words) >>= mapM_ print

solve :: [String] -> Double
solve xs = evalState (calc xs) []

calc :: [String] -> State [Double] Double
calc [] = do
  (x:xs) <- get
  return x

calc (x:xs)
  | x == "+" = do
      (a:b:cs) <- get
      put (a+b:cs)
      calc xs
  | x == "-" = do
      (a:b:cs) <- get
      put (b-a:cs)
      calc xs
  | x == "*" = do
      (a:b:cs) <- get
      put (a*b:cs)
      calc xs
  | x == "/" = do
      (a:b:cs) <- get
      put (b/a:cs)
      calc xs
  | otherwise = do
      cs <- get
      put (toDbl x : cs)
      calc xs
  
toDbl :: String -> Double
toDbl s = read s

getc :: (String -> a) -> IO [a]
getc f = map f . lines <$> getContents

Measured memory_bytes: 4384
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <set>
#include <vector>
#include <iomanip>
#include <queue>
#include <tgmath.h>
#define MOD 1000000007
using namespace std;
#define INT_MAX 2147000000
#define LONG_MAX 9223372036854775806
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int N;
#define MAXN 51
int d[MAXN];
int S[MAXN*MAXN];
int main(){
    cin >> N;
    
    int count = 0;
    rep(i,N)cin >> d[i];
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(i<=j)continue;
            S[count]=(d[i]*d[j]);
            count++;
        }
    }
    int ans = 0;
    for(int i=0;i<count;i++){
        ans += S[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < N; i++) {
            ans.append(S[i]).append(T[i]);
        }

        System.out.println(ans.toString());
    }
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 


int main()
{
  __;
  int n;
  cin >> n;
  cout << (n/500)*1000 + ((n%500)/5 )*5 << endl;
  return 0;
}


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

using namespace std;

long long MOD = 1e9 + 7;

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

    double n, k;
    cin >> n >> k;

    vector<int> h(n, 0);
    int res = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
        if (h[i] >= k) {
            res++;
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)





int N, W;
int v[100], w[100];
//-----------------------------------------------------------------
int dp[101][10001];
int rec(int i, int j) {
	if (0 <= dp[i][j]) return dp[i][j];
	if (i == N) return 0;

	int ret = rec(i + 1, j);
	if (j + w[i] <= W) ret = max(ret, rec(i + 1, j + w[i]) + v[i]);
	return dp[i][j] = ret;
}
//-----------------------------------------------------------------
int main() {
	cin >> N >> W;
	rep(i, 0, N) cin >> v[i] >> w[i];

	// dp[i][j] == -1 means this case isn't calculated yet
	rep(i, 0, 101) rep(j, 0, 10001) dp[i][j] = -1;

	cout << rec(0, 0) << endl;
}

Measured memory_bytes: 7052
#include <bits/stdc++.h>
#define ll long long int

using namespace std;

int main(){
  ll n;
  cin >> n;
  ll w;
  cin >> w;
  ll weights[n],value[n];
  for(ll i = 0;i < n;i++){
  	cin >> weights[i] >> value[i];
  }
  ll dp[w + 1] = {0};
  ll ans = 0;
  for(ll i = 0;i < n;i++){
  	for(ll j = w;j >= 0;j--){
      	if(j - weights[i] >= 0){
			dp[j] = max(dp[j],dp[j - weights[i]] + value[i]);
        }
        ans = max(dp[j],ans);
    }
  }
  cout << ans << endl;
  
  return 0;
}

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

int main(void){
    long long int i, j, k, n, q, ans=0, po=0, x[5], sum=0;
    scanf("%lld", &n);
    long long int a[n];
    for(i=0; i<n; i++) scanf("%lld", &a[i]);
    for(i=0; i<n; i++) sum = sum^a[i];
    for(i=0; i<n; i++) printf("%lld ", sum^a[i]);

    
}

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

int main(){

int N,AC=0,WA=0,TLE=0,RE=0;
scanf("%d",&N);
char S[N][4];

for (int i = 0; i < N; i++){
    scanf("%s",S[i]);
    if (S[i][0] == 'A' && S[i][1] == 'C')
    {
      AC++;
    }else if (S[i][0] == 'W' && S[i][1] == 'A')
    {
      WA++;
    }else if (S[i][0] == 'T' && S[i][1] == 'L' && S[i][2] == 'E')
    {
      TLE++;
    }else if(S[i][0] == 'R' && S[i][1] == 'E')
    {
      RE++;
    }
}

printf("AC x %d\n",AC);
printf("WA x %d\n",WA);
printf("TLE x %d\n",TLE);
printf("RE x %d\n",RE);

return 0;

}

Measured memory_bytes: 2120
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}


int main() {
	IOS;
	int n, m;
	cin >> n >> m;
	ll ans = (1900 * m + (n - m) * 100) * powl(2, m);
	cout << ans << endl;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var h=new int[4];
		for(int i = 0;i<n;i++) {
			var e=sc.S;
			if(e=="AC"){h[0]++;}
			else if(e=="WA"){h[1]++;}
			else if(e=="TLE"){h[2]++;}
			else{h[3]++;}
		}
		Console.WriteLine("AC x {0}",h[0]);
		Console.WriteLine("WA x {0}",h[1]);
		Console.WriteLine("TLE x {0}",h[2]);
		Console.WriteLine("RE x {0}",h[3]);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 30692
S = input()

if S == 'SUN':
    print(7)
elif S == 'MON':
    print(6)
elif S == 'TUE':
    print(5)
elif S == 'WED':
    print(4)
elif S == 'THU':
    print(3)
elif S == 'FRI':
    print(2)
else:
    print(1)

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

int main()
{
	string name;
	getline(cin,name);
	
	for(int i=0;name[i]!='\0';i++){
		if(name[i]>='A'&&name[i]<='Z'){
			name[i]+=' ';
		}
		else if(name[i]>='a'&&name[i]<='z'){
			name[i]-=' ';
		}
	}
	cout<<name<<endl;
}

Measured memory_bytes: 3128
#include<iostream>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<cstring>
using namespace std;

int main(void) {
	int a, b, ans;
	cin >> a >> b;
	if (b >= a) {
		cout << a << endl;
	}
	else {
		cout << a-1<< endl;
	}


	return 0;
}








Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	int a = read.to!int;
	string s = readln.chomp;
	
	if(a < 3200) s = "red";
	
	s.writeln;
}


Measured memory_bytes: 384
n, k = map(int, input().split())

ans = 0
count = 0

for i in range(n):
    p = i+1
    
    if p>=k:
        ans += 1
        
    else:
        while p<k:
            p= p*2
            count+=1
        
        ans += 0.5**count
        count = 0

print(ans/n)

Measured memory_bytes: 2940
//Vatsal Gupta
#ifdef __APPLE__
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <cctype>
#include <stack>
#include <list>
#include <queue>
#include <map>
#include <sstream>
#include <cmath>
#include <limits>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <bitset>
#include <utility>
#include <set>
#include <numeric>
#else
#include<bits/stdc++.h>
#endif

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define lli long long int
#define ulli unsigned long long int

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define ALL(a) a.begin(),a.end()
#define SZ(a) (int)(a.size())

#define loop(i,a,b) for(int i=a; i<b; i++)

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

#define INF 1000000000  //(10^9)
#define MOD 1000000007  //(10^9+7)

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);

typedef pair<lli,int> li;

vector<lli> arr(200010), dp(200010);
vi store(200010);
stack<li> s;

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

	int n;
	cin>> n;
	loop(i,0,n)
		cin>> arr[i];
	s.push(MP(arr[0],0));
	loop(i,1,n)
	{	
		li x= s.top();
		if(arr[i]>x.F)
			s.push(MP(arr[i],i));
		else
		{
			while(1)
			{
				if(arr[i]>x.F || s.empty())
				{
					s.push(MP(arr[i],i));	
					break;
				}
				store[x.S]= i-1;
				s.pop();
				if(!s.empty())
					x= s.top();
			}
		}
	}
	while(!s.empty())
	{
		ii x= s.top();
		store[x.S]= n-1;
		s.pop();
	}
	dp[n-1]= arr[n-1];
	for(int i= n-2; i>=0; i--)
	{
		lli cnt= store[i]-i+1;
		dp[i]= (arr[i]*cnt);
		if(store[i]!=n-1)
			dp[i]+= dp[store[i]+1];
	}
	lli ans=0LL;
	loop(i,0,n)
		ans+= dp[i];
	cout<< ans<< "\n";


	return 0;
}


Measured memory_bytes: 7424
#include <stdio.h>

int main(void) {
  int N;
  scanf("%d",&N);
  int v[N];
  for(int i=0;i<N;i++)
  scanf("%d",&v[i]);

  double max[N];
  for(int i=0;i<N;i++)
    max[i]=0;

  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++){
      if(max[i]<v[j])
      max[i]=v[j];
      if(j==N-1)
        for(int k=0;k<N;k++)
          if(max[i]==v[k]){
            v[k]=0;
            break;}
    }
  double sum=(max[N-1]+max[N-2])/2;
  if(N>2)
  for(int i=N-3;i>=0;i--)
    sum=(sum+max[i])/2;

  printf("%lf",sum);
  return 0;
}

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

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main() {
    ll N,A,B;
    cin >> N >> A >> B;
    if((B-A)%2) cout << "Borys" <<endl;
    else cout << "Alice" <<endl;
}

Measured memory_bytes: 256
kaibun = input()

j = True
for i in range(len(kaibun)//2):
    if kaibun[i] != kaibun[-(i+1)]:
        j = False
        break

if j == True:
    for i in range(len(kaibun)//2):
        if kaibun[i] != kaibun[len(kaibun)//2-(i+1)]:
            j = False
            break
        if kaibun[-(i+1)] != kaibun[len(kaibun)//2 + i+1]:    
            j = False
            break

if j == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include<algorithm>
#include<set>
#include<iterator>
using namespace std;

int main() {
   
    string s;
    cin>>s;
    int i;
    for( i=0;i<s.size();++i)
    {
        if(s[i]=='A')
            break;
    }
    int j;
    for(j=s.size()-1;j>=0;--j)
    {
        if(s[j]=='Z')
            break;
    }
    
    
    cout<<j-i+1;
    
    
	return 0;
}


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


namespace D
{
	class Program
	{
		static void Main(string[] args)
		{
			int K = int.Parse(Console.ReadLine());

			Queue<long> que = new Queue<long>();

			for (int i = 1; i < 10; i++)
			{
				que.Enqueue(i);
			}

			for (int i = 0; i < K-1; i++)
			{
				long x = que.Dequeue();

				if (x % 10 != 0)
					que.Enqueue(x * 10 + (x % 10) - 1);
				que.Enqueue(x * 10 + (x % 10));
				if (x % 10 != 9)
					que.Enqueue(x * 10 + (x % 10) + 1);
			}

			Console.WriteLine(que.Dequeue());
		}
	}
}


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

int main() {
  int n, k;
  string s;
  cin >> n >> s >> k;

  char target = s[k-1];

  for (int i = 0; i < n; i++) {
    if (s[i] != target) s[i] = '*';
  }

  cout << s << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<cstdio>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#include<utility>
#include<queue>
#define pi 3.14159
#define Inf (int)pow(2., 12.)

using namespace std;
typedef std::pair<int, int> mypair;
queue<mypair> qu;
#define M 1000000
 
int odd[M+10], all[M+10];
 
void update(int *ar, int x){
    for(int i = x; i <= M; ++i){
        ar[i] = min(ar[i], ar[i - x] + 1);
    }
}
 
int main(){
	odd[0] = all[0] = 0;
    for(int i = 1; i <= M; ++i){
        odd[i] = all[i] = 10000000;
    }
 
    for(int i = 1; ; ++i){
        int x = i * (i + 1) * (i + 2) / 6;
        if(x > M) break;
        update(all, x);
        if(x % 2 == 1) update(odd, x); 
    }
     
    int n;
    while(1) {
		cin >> n;
		if(n == 0) break;
		cout << all[n] << " " << odd[n] <<endl;
	}
}

Measured memory_bytes: 9012