akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
//	cout << fixed << setprecision(15);
	ll n;
	cin >> n;
	ll ans = 0;
	rep1(i, n) if(i % 3 != 0 && i % 5 != 0) ans += i;
	cout << ans << endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N, M; ll X[1010], Y[1010], Z[1010];
ll dp[1010][1010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M;
    rep(i, 0, N) cin >> X[i] >> Y[i] >> Z[i];

    ll ans = -infl;
    rep(a, -1, 2) rep(b, -1, 2) rep(c, -1, 2) if (a) if (b) if (c) {
        rep(i, 0, N + 1) rep(j, 0, M + 1) dp[i][j] = -infl;
        dp[0][0] = 0;
        rep(i, 0, N) rep(j, 0, M + 1) {
            ll d = a * X[i] + b * Y[i] + c * Z[i];
            chmax(dp[i + 1][j], dp[i][j]);
            chmax(dp[i + 1][j + 1], dp[i][j] + d);
        }
        chmax(ans, dp[N][M]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 8192
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    static long X;
    static long Y;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        X = sc.nextLong();
        Y = sc.nextLong();

        System.out.println( solve() );
    }

    private static String solve() {
        if( Math.abs(X-Y) <= 1 ) {
            return "Brown";
        } else {
            return "Alice";
        }
    }

    static class FastScanner {

        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

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

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

            return tokenizer.nextToken("\n");
        }

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

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

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

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

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



Measured memory_bytes: 22484
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
using ll = long long;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//動的計画法で役に立つ関数
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; }

//最大公約数と最小公倍数
ll gcd(ll a, ll b) {
    if(b==0)return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a/g*b;
}

vector<vector<long long> > comb(int n) {
  vector<vector<long long> > v(n + 1,vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  
    int N;cin>>N;
    int minv=INF, maxv=-INF;
    int n_;cin>>minv;
    FOR(i,1,N)
    {
        int n;cin>>n;
        chmax(maxv, n-minv);
        chmin(minv, n);
    }
    cout<<maxv<<endl;
      
    return 0;
}




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

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

int N, cost[22][22], deg[22];

int dfs(int v, int p, int cst) {
	int res = cst;
	
	for_(u,0,N) {
		if (u == p) continue;
		if (cost[v][u] > 0) res = max(res, dfs(u, v, cst + cost[v][u]));
	}
	
	return res;
}

int main() {
	while (cin >> N, N) {
		memset(cost, 0, sizeof(cost));
		memset(deg, 0, sizeof(deg));
		
		int sum = 0;
		
		for_(i,0,N-1) {
			int a, b, t;
			cin >> a >> b >> t;
			--a;
			--b;
			cost[a][b] = cost[b][a] = t;
			sum += t;
			++deg[a];
			++deg[b];
		}
		
		int leaf = 0;
		
		for_(v,1,N) {
			if (deg[v] == 1) {
				for_(u,0,N) if (cost[u][v] > 0) {
					leaf += cost[u][v];
					cost[u][v] = cost[v][u] = 0;
				}
			}
		}
		
		int max_cst = dfs(0, -1, 0);
		
		cout << (2 * (sum - leaf) - max_cst) << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

using Edge = pair<long long, long long>;
using Graph = vector<vector<int>>;

Graph G;
//int N, d[200010];

// <最短距離, 頂点の番号>

signed main()
{
    int  n,m;
    cin >> n >> m;
    G.assign(n, vector<int>());
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> ans(n,-1);
    queue<int> q;
    q.push(0);
    vector<int> used(n, false);
    used[0] = true;
    ans[0] = 0;
    while (!q.empty())
    {
        int v = q.front();
        q.pop();
        for(auto &u :G[v]){
            if(!used[u]){
                //cerr << u << endl;
                ans[u] = v;
                used[u] = true;
                q.push(u);
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        if(ans[i]==-1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i < n; i++)
    {
        cout << ans[i] + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 13664
#include <iostream>
#include <vector>

typedef struct {
    int ph;
    int pw;
} T;

int main() {
    const int inf = 100000;
    int h, w;
    std::cin >> h >> w;
    char m[50][50];
    int _m[50][50];
    int dots = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            char t;
            std::cin >> t;
            if (t == '.') dots++;
            m[i][j] = t; _m[i][j] = inf;
        }
    }
    _m[0][0] = 1;
    T init = {0, 0};
    std::vector<T> now, next;
    now.push_back(init);
    while (!now.empty() && _m[h-1][w-1] == inf) {
        for (auto x: now) {
            int ph = x.ph, pw = x.pw, dep = _m[ph][pw]+1;
            if (ph > 0 && _m[ph-1][pw] == inf && m[ph-1][pw] == '.') {
                T temp = {ph-1, pw};
                _m[ph-1][pw] = dep;
                next.push_back(temp);
            }
            if (pw > 0 && _m[ph][pw-1] == inf && m[ph][pw-1] == '.') {
                T temp = {ph, pw-1};
                _m[ph][pw-1] = dep;
                next.push_back(temp);
            }

            if (ph < h-1 && _m[ph+1][pw] == inf && m[ph+1][pw] == '.') {
                T temp = {ph+1, pw};
                _m[ph+1][pw] = dep;
                next.push_back(temp);
            }

            if (pw < w-1 && _m[ph][pw+1] == inf && m[ph][pw+1] == '.') {
                T temp = {ph, pw+1};
                _m[ph][pw+1] = dep;
                next.push_back(temp);
            }
        }
        now = next;
        next.clear();
    }
    /*
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (_m[i][j] == inf) std::cout << "* ";
            else std::cout << _m[i][j] << " ";
        }
        std::cout << std::endl;
    }
    */
    int last = _m[h-1][w-1];
    if (last == inf) {
        std::cout << -1 << std::endl;
    } else {
        std::cout << dots - last << std::endl;
    }
    return 0;
}


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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
ll n, h, a[100001], b[100001], amax = 0, ans = 0;
vector<int> v;
signed main() {
	cin >> n >> h;
  rep(i, n) {
    cin >> a[i] >> b[i];
    amax = max(amax, a[i]);
  }
  rep(i, n) {
    if (amax < b[i]) v.pb(b[i]);
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for(auto x : v) {
    h -= x;
    ans++;
    if (h <= 0) {
      cout << ans << endl;
      return 0;
    }
  }
  ans += h / amax;
  if (h % amax) ans++;
  cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2936
N = gets.to_i
W = gets.split.map(&:to_i)
sum = 0
S = W.each.map { |w| sum+=w }

min = 100
N.times do |i|
  if (2*S[i]-S[N-1]).abs < min
    min = (2*S[i]-S[N-1]).abs
  end
end
puts min

Measured memory_bytes: 1788
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a+b >= c) System.out.print("Yes");
		else System.out.print("No");

	}

}


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

using namespace std;

int n,m;
char a[2005][2005];
int ans = 0;

int main()
{
    scanf("%d%d",&n,&m);
    int ma = n + m - 1;
    for(int i = 0;i < n;i++)
        scanf("%s",a[i]);
    for(int i = 0;i < n;i++)
        for(int j = 0;j < m;j++)
        {
            int s = 1;
            if(a[i][j] == '.')
            {
                for(int k = j - 1;k >= 0;k--)
                    if(a[i][k] == '.')
                        s++;
                    else
                        break;
                for(int k = j + 1;k < m;k++)
                    if(a[i][k] == '.')
                        s++;
                    else
                        break;
                for(int l = i - 1;l >= 0;l--)
                    if(a[l][j] == '.')
                        s++;
                    else
                        break;
                for(int l = i + 1;l < n;l++)
                    if(a[l][j] == '.')
                        s++;
                    else
                        break;
                ans = max(s,ans);
                if(ans == ma)
                    break;
            }
        }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll ATCODER_AMARI = 1000000007; //10^9 + 7
const ll INF = 10000000000000;

//階乗関数　ATCODER_AMARIに注意
ll factorial(ll k){
  ll sum = 1;
  for(int i = 1 ; i < k + 1; i++) {
    sum *= i;
    //sum = sum % ATCODER_AMARI;
  }
  return sum;
}

int main() {
  ll n,d;
  cin >> n >> d;

  ll count = 0;

  rep(i,n) {
    ll x,y;
    cin >> x >> y;

    if( sqrt(x * x + y * y) <= d){
      count++;
    }
    
   }

   cout << count << endl;
}


Measured memory_bytes: 3676
/********************************************************
  **░██████╗██╗░░░░░░█████╗░██╗░░░██╗██╗░█████╗░░██████╗░**
  **██╔════╝██║░░░░░██╔══██╗██║░░░██║██║██╔══██╗██╔════╝░**
  **╚█████╗░██║░░░░░███████║╚██╗░██╔╝██║██║░░╚═╝██║░░██╗░**
  **░╚═══██╗██║░░░░░██╔══██║░╚████╔╝░██║██║░░██╗██║░░╚██╗**
  **██████╔╝███████╗██║░░██║░░╚██╔╝░░██║╚█████╔╝╚██████╔╝**
  **╚═════╝░╚══════╝╚═╝░░╚═╝░░░╚═╝░░░╚═╝░╚════╝░░╚═════╝░**
  *********************************************************/

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


#define ll                          long long
#define ld                          long double

#define forn(i,n)                   for(int i=0;i<n;++i)
#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(),v.rend();
#define isSubstring(s1,s2)          s1.find(s2) != std::string::npos
	
#define pb                          push_back
#define pf                          push_front
#define mp                          make_pair
#define fr                          first
#define sc                          second

#define vpi                         <vector<pair<int,int>>
#define vi                          vector<int>
#define sz(a)                       (int)a.size()

#define   endl                       "\n"
#define     nl                       cout<<"\n";
#define fastio                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define MN                           INT_MIN
#define MX                           INT_MAX

bool isPrime(ll n){if(n<2)return false;for(ll x = 2;x*x <=n;x++){if(n%x == 0)return false;}return true;}
bool isPerfectSquare(long double x){long double sr=sqrt(x);return((sr-floor(sr))==0);}
int gcd(int a, int b){if(a==0)return b;if(b==0) return a;if(a==b)return a;if(a>b)return gcd(a-b,b);return gcd(a,b-a);}
int32_t main()
{
	int a,b;
	cin >> a >> b;
	if(a < b)
		swap(a,b);
	for(int i = 0;i<a;i++)
		cout << b;
}

Measured memory_bytes: 3556
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 100005
#define oo 2000000007
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

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

int n, m, color[maxN], cntSingle, cntBipartite, cntNormal, cntVtx;
bool isBipartite;

vector<int> g[maxN];

void DFS(int u, int c) {
    color[u] = c;
    ++cntVtx;
    for(int v: g[u]) {
        if (color[v] == 0) DFS(v, 3-c);
        else if (color[v] != 3-c) isBipartite = false;
    }
}

int main () {
    scanf("%d%d", &n, &m);
    fto(i, 1, m) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].pb(v); g[v].pb(u);
    }

    fto(u, 1, n) {
        if (color[u] == 0) {
            isBipartite = true;
            cntVtx = 0;
            DFS(u, 1);

            if (cntVtx == 1) ++cntSingle;
            else if (isBipartite) ++cntBipartite;
            else ++cntNormal;
        }
    }

    ll ans = sqr(cntBipartite+cntNormal)+sqr(cntBipartite);
    ans += sqr(n)-sqr(n-cntSingle);
    cout << ans;

    return 0;
}


Measured memory_bytes: 9088
use proconio::{input, fastout};
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}


#[fastout]
fn main() {
    input!{
        n: usize,
        h: [usize;n],
    }
    let mut active = 0;
    let mut ans = 0;
    for i in 0..n {
        if active >= h[i] {
            active = h[i];
        } else {
            ans += h[i] - active;
            active = h[i];
        }
    }
    println!("{}", ans);
    
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
int f[12001];
int fi[12001];
int n, k;
int m(int a,int b){
	return (a * b)% mod;
}

int fp(int x,int y) {
	int res=1;
	while(y){
		if(y&1) res = res*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return res;
}
int iv(int x){
	return fp(x, mod - 2);
}
int c(int x, int y){
	return m(f[y],m(fi[x],fi[y - x]));
}
int ck(int x,int y){
	return c(y - 1,x + y - 1);
}
signed main(){
	cin >> n >> k;
	f[0] = 1;
	for(int i = 1 ; i <= 10000 ; i ++) f[i] = m(f[i - 1], i);
	fi[10000] = iv(f[10000]);
	for(int i = 9999 ; i >= 0 ; i --) fi[i] = m(fi[i + 1], (i + 1));
//	cout << "db\n";
//	cout << ck(3,1) << endl;
//	cout << c(0,3) << endl;
//	cout << "edb\n";
	
	for(int i = 1 ; i <= k ; i ++){
		if(n - k - (i + 1 - 2) < 0) cout << "0\n";
		else cout << m(ck(k - i,i), ck(n - k - (i + 1 - 2), i + 1)) << endl;
	}
	
			
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    vector<string> s(100, string(100, '#'));
    rep(i, 50) rep(j, 100) s[i][j] = '.';

    int cnt = 0;
    for (int i = 0; i < 50; i += 2) {
        if (cnt == b - 1) break;
        for (int j = 0; j < 100; j += 2) {
            if (cnt == b - 1) break;
            s[i][j] = '#';
            cnt++;
        }
    }

    cnt = 0;
    for (int i = 51; i < 100; i += 2) {
        if (cnt == a - 1) break;
        for (int j = 0; j < 100; j += 2) {
            if (cnt == a - 1) break;
            s[i][j] = '.';
            cnt++;
        }
    }

    printf("100 100\n");
    for (auto &line: s) cout << line << endl;

}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int n, a;               //n == givenPrice, a == the number of 1 yen
  cin >> n >> a;
  
  int reminder = n % 500;
 
  if(reminder > a)
    cout << "No";
  
  else
    cout << "Yes";
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cnt = 0

for i in range(n):
    if a[i] > b[i]:
        k = a[i] - b[i]
        b[i] += k
        cnt += k

for i in range(n):
    if a[i] < b[i]:
        k = (b[i] - a[i]) // 2
        a[i] += 2 * k
        cnt -= k
        if a[i] < b[i]:
            a[i] += 2
            b[i] += 1

print('Yes') if cnt <= 0 else print('No')



Measured memory_bytes: 74176
program name
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64)::n,k,r,s,p,i,ans
    character(:),allocatable:: t
    logical,allocatable:: w(:)

    read*, n,k
    read*, r,s,p
    allocate(character(n):: t)
    read*, t
    allocate(w(n))

    ans=0
    do i=1,k
        ans=ans+win(t(i:i))
    end do
    w(1:k) = .true.
    w(k+1:) = .false.
    do i=k+1,n
        if (t(i:i)==t(i-k:i-k) .and. w(i-k)) cycle
        ans=ans+win(t(i:i))
        w(i) = .true.
    end do
    print'(i0)', ans

contains
    function win(ss) result(ret)
        character(1):: ss
        integer(int64):: ret

        select case(ss)
            case('r')
                ret=p
            case('s')
                ret=r
            case('p')
                ret=s
        end select
    end function
end program name

Measured memory_bytes: 1000
#include <stdio.h>

int main(int argc, const char* argv[])
{
	int sheepNum, wolfNum;
	scanf("%d %d", &sheepNum, &wolfNum);

	// If there are more(or equal) wolves than sheeps, program will print unsafe. In other case it will print safe.
	if (wolfNum >= sheepNum)
	{
		printf("unsafe");
	}
	else
	{
		printf("safe");
	}

	return 0;
}

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

int main(){
  int N;
  vector<int> H;
  cin>>N;
  
  for(int i=0;i<N;i++){
    int x;
    cin>>x;
    H.push_back(x);
  }
  
  int max=0;
  int answer=0;
  
  for(int i=0;i<N;i++){
    if (max<=H.at(i)) {
      max=H.at(i);
      answer++;
    }
  }
  
  cout<<answer<<endl;
}
    

Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    
    int cnt = 0;
    
    for(int i=0;i<str.length();i++) {
      if(str.substring(i, i+1).equals("1")) {
        cnt += 1;
      }
    }
    System.out.println(cnt);
  }
}

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

int main(){
    for(int i = 0; ; i++){
        int x,y;
        cin >> x >> y;
        if(x == 0 && y == 0){
            break;
        }
        for(int j = 0; j < x; j++){
            for(int k = 0; k < y; k++){
                if((j+k) % 2 == 0){
                    cout << '#';
                }else{
                    cout << '.';
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 3104
/*
 root (x1-x2)^2 + (y1-y2)^2 = ((x1-x2) + (y1-y2))^2 - 2*(x1-x2)*(y1-y2)

 (x1-x2)*(y1-y2) = 0
 x1 = x2  
 or
 y1 = y2

 a = (x1 == x2)

 b = (y1 == y2)

 c = (x1==x2 && y1 == y2)

 c = c*(c-1)/2;


 a * b - c;
*/

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

int main(void)
{
	int n;int k;
	cin>>n>>k;
	int h[n+1];
	for(int i=1;i<=n;i++)
		cin>>h[i];
	int dp[n+1];
	dp[1]=0;
	dp[2] = abs(h[1]-h[2]);

	for(int i = 3;i<=n;i++){
		dp[i] =INT_MAX;
		for(int j = 1;j<=min(i-1,k);j++)
		dp[i] = min((dp[i-j]+abs(h[i]-h[i-j])),dp[i]);
	}
cout<<dp[n]<<endl;
}



Measured memory_bytes: 1024
def main():
    t = list(map(int, input().split()))
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    diff_0 = a[0]-b[0]
    diff_1 = a[1]-b[1]

    if diff_0*diff_1 > 0:
        return 0
    
    d_one_iter = diff_0*t[0]+diff_1*t[1]

    if diff_0*d_one_iter > 0:
        return 0
    if diff_0*d_one_iter == 0:
        return 'infinity'
    
    if abs(diff_0*t[0])%abs(d_one_iter) == 0:
        return 2*abs(diff_0*t[0])//abs(d_one_iter)
    else:
        return 2*(abs(diff_0*t[0])//abs(d_one_iter))+1

if __name__ == "__main__":
    print(main())

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i =0;i<n;++i) cin >> a.at(i);
  int ans = 0;
  while(true){
    bool odd = false;
    for(int i = 0;i<n;++i){
      if(a.at(i) % 2 == 1) odd = true;
    }
    if(odd) break;
    for(int i = 0; i < n; ++i){
      a.at(i) /= 2;
    }
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

ans = float("inf")
for i in range(n):
    if(a[i] % 2 == 1):
        ans = 0
        break
    else:
        tmp = a[i]
        count = 0
        while(tmp % 2 == 0):
            tmp /= 2
            count += 1
        if(count < ans):
            ans = count
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 100000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    vector<int>num;
	num.push_back(0);
    for(int i=0;i<s.size();){
       int j=i;
       while(s[j]==s[i] and j<s.size()){
          j++;
       }
       num.push_back(j-i);
       i=j;
       
    }
    int ans=0;
    for(int i=1;i<num.size();i++)num[i]+=num[i-1];
    if(s[0]=='0'){
    	for(int i=1;i<num.size();i++){
    		int l,r;
    		if(i%2==1){
    			r=i;l=(i-2*k>=0?i-2*k:0);
    			ans=max(ans,num[r]-num[l]);
			}
			else{
				r=i;l=(i-2*k-1>=0?i-2*k-1:0);
				ans=max(ans,num[r]-num[l]);
			}
			//cout<<l<<" "<<r<<endl;
		}
	}
    if(s[0]=='1'){
    	for(int i=1;i<num.size();i++){
    		int l,r;
    		if(i%2==0){
    			r=i;l=(i-2*k>=0?i-2*k:0);
    			ans=max(ans,num[r]-num[l]);
			}
			else{
				r=i;l=(i-2*k-1>=0?i-2*k-1:0);
				ans=max(ans,num[r]-num[l]);
			}
			//cout<<l<<" "<<r<<endl;
		}
	}
	cout<<ans<<endl;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;

int main() {
    string s,t;
    cin>>s>>t;
    int s1=s.size(),s2=t.size();
    int dp[s1+1][s2+1];
    memset(dp,0,sizeof(dp));
    for (int i=1;i<s1+1;i++){
        for (int j=1;j<s2+1;j++){
            if (s[i-1]==t[j-1]){
                dp[i][j]=max(dp[i-1][j-1]+1,max(dp[i-1][j],dp[i][j-1]));
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
            //cout<<dp[i][j]<<" ";
        }
      //cout<<endl;
    }
    string ans="";
    int num1=s1,num2=s2;
    int num=dp[s1][s2];
    while (num>0){
        if (s[num1-1]==t[num2-1]){
            ans=s[num1-1]+ans;
            num1--;
            num2--;
            num--;
        }
        else{
            if (dp[num1][num2-1]>dp[num1-1][num2]){
                num2--;
            }
            else{
                num1--;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
//const long long MOD = 998244353;
const long long INF_LL = 1e18+11; const int INF_int = 1e9+11;
#define ll long long
#define mp std::make_pair
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto x:a) cout << x << " ";cout << endl;
#define pii pair<int,int>
int main(){
    int h,w;
    cin >> h >> w;
    char field[h+4][w+4];
    int sx,sy,gx,gy;
    cin >> sx >> sy;
    cin >> gx >> gy;
    sx++;sy++;gx++;gy++;
    rep(i,h+4) rep(j,w+4) field[i][j]='#';
    rep(i,h) rep(j,w) cin >> field[2+i][2+j];
    bool visited[h+4][w+4];
    rep(i,h+4) rep(j,w+4) visited[i][j] =  false;
    queue<pii> que;
    que.push(mp(sx,sy));
    visited[sx][sy] = true;
    bool fl = false;
    int ans = 0;
    int dx[4] = {0,0,1,-1};
    int dy[4] = {1,-1,0,0};
    while(!que.empty()){
        vector<pii> vec;
        while(!que.empty()){
            pii now = que.front();
            que.pop();
            int nowx = now.first;int nowy = now.second;
            vec.push_back(now);
            if(nowx==gx && nowy==gy){
                fl = true;
                break;
            }
            rep(i,4){
                int tox = nowx+dx[i];int toy = nowy+dy[i];
                if(!visited[tox][toy] && field[tox][toy]=='.'){
                    que.push(mp(tox,toy));
                    visited[tox][toy] = true;
                }
            }
        }
        if(fl) break;
        rep(i,vec.size()){
            int nowx = vec[i].first;int nowy = vec[i].second;
            rep(j,5) rep(k,5){
                if(!visited[nowx+j-2][nowy+k-2] && field[nowx+j-2][nowy+k-2]=='.'){
                    que.push(mp(nowx+j-2,nowy+k-2));
                    visited[nowx+j-2][nowy+k-2]=true;
                }
            }
        }
        ans++;
    }
    if(fl) cout << ans << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 5696
import java.util.Scanner;
import java.util.Arrays;
public class Main {

	public static void main(String[] args) {
		 Scanner sc = new Scanner(System.in);
		 double n = sc.nextLong();
		 long[]m = new long[5];
	    
		 for(int i=0; i<5; i++) {
			  m[i] = sc.nextLong();
		  }
		  sc.close();
		  Arrays.sort(m);
		 long ans = (long)Math.ceil(n/m[0])+4;
		 
	  System.out.println(ans);
   }
}


Measured memory_bytes: 22864
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
    	var sc = new Scanner();
    	string s =　sc.NextString();
    	int wb = 0;
    	int bw = 0;
    	for (int i = 1; i < s.Length; i++)
    	{
    		if (s[i] == 'W' && s[i - 1] == 'B') bw++;
    		if (s[i] == 'B' && s[i - 1] == 'W') wb++;
    	}
    	Console.WriteLine(wb + bw);
    }
    
    static long Gcd(long a, long b)
    {
        if (a < b) return Gcd(b, a);
        if (b == 0) return a;
        return Gcd(b, a % b);
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }
        
    public long NextLong()
    {
    	CheckNext();
    	return long.Parse(buf[index++]);
    }
    
    public double NextDouble()
    {
    	CheckNext();
    	return double.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}

Measured memory_bytes: 13108
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
  int n, i;
  string a, b;
  bool f;
  cin >> n;
  while (n--) {
    cin >> a >> b;
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    if (b.size() > a.size()) a.swap(b);
    for (i = f = 0; i < a.size(); i++) {
      int n = (a[i] - '0') + f;
      if (i < b.size()) n += b[i] - '0';
      a[i] = (n % 10) + '0';
      f = n > 9;
    }
    if (f) a += "1";
    reverse(a.begin(), a.end());
    if (a.size() > 80) {
      cout << "overflow" << endl;
    } else {
      cout << a << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1204
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		String S=stdIn.next();
		int N=S.length();
		int z=0;
		long y=1,ans=0;
		while(z<N){
			if(S.charAt(z)=='W'){
				ans+=(z+1)-y;
				y++;
			}
			z++;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 26532
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = (a), i_len = (b); i < i_len; ++i)

int main()
{
    string S;
    cin >> S;
    REP(i, 0, S.size()) if(S[i] == ',') S[i] = ' ';
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
r, s, p = 0,0,0
for i in range(N):
	if i-K >= 0 and T[i-K] == T[i]:
		T[i] = None
	elif T[i] == 'r':
		p += 1
	elif T[i] == 's':
		r += 1
	elif T[i] == 'p':
		s += 1
print(r*R+s*S+p*P)

Measured memory_bytes: 4084
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

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 I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def intersection(a1, a2, b1, b2):
    x1,y1 = a1
    x2,y2 = a2
    x3,y3 = b1
    x4,y4 = b2

    ksi = (y4 - y3) * (x4 - x1) - (x4 - x3) * (y4 - y1)
    eta = (x2 - x1) * (y4 - y1) - (y2 - y1) * (x4 - x1)
    delta = (x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3)
    if delta == 0:
        return None
    ramda = ksi / delta;
    mu = eta / delta;
    if ramda >= 0 and ramda <= 1 and mu >= 0 and mu <= 1:
        return (round(x1 + ramda * (x2 - x1), 9), round(y1 + ramda * (y2 - y1), 9))

    return None

def main():
    rr = []

    def f(n):
        def _f(l):
            return [(l[0],l[1]), (l[2],l[3])]
        a = [_f(LI()) for _ in range(n)]
        r = 1 + n
        itc = collections.defaultdict(int)
        for i in range(n):
            a1,a2 = a[i]
            for j in range(i+1,n):
                it = intersection(a1,a2,a[j][0],a[j][1])
                if not it:
                    continue
                if max(it) == 100 or min(it) == -100:
                    continue
                itc[it] += 1

        # print('itc',itc)

        for v in itc.values():
            if v <= 1:
                r += v
                continue
            for i in range(101):
                if v == i * (i+1) / 2:
                    r += i
                    break

        return r

    while 1:
        n = I()
        if n == 0:
            break
        rr.append(f(n))

    return '\n'.join(map(str,rr))


print(main())



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

int main() {
    int N; cin >> N;
    vector<string> S(N); for (auto &s : S) { cin >> s; }
    int ans = 0, A = 0, B = 0, BA = 0;
    for (string s : S) {
        int sz = s.length();
        for (int i = 0; i < sz-1; i++) {
            if (s[i] == 'A' && s[i+1] == 'B') ans++;
        }
        if (s[0] == 'B' && s[sz-1] == 'A') BA++;
        if (s[0] == 'B' && s[sz-1] != 'A') B++;
        if (s[0] != 'B' && s[sz-1] == 'A') A++;
    }
    if (A == 0 && B == 0 && BA == 0) { cout << ans << endl; return 0; }
    if (BA == 0) { cout << ans+min(A, B) << endl; return 0; }
    ans += (BA+1);
    if (A == 0) ans--;
    if (B == 0) ans--;
    A = max(A-1, 0); B = max(B-1, 0);
    ans += min(A, B);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <string>

using namespace std;

int main(){

    int N;
    cin >> N;
    string S;
    cin >> S;

    int ans = 1;
    char color = S.front();
    for(int i = 1; i < N; i++) {
        if(color != S.at(i)) {
            ans++;
            color = S.at(i);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,d,n,ans;
    cin >> a >> b >> c >> d ;
    cin >> n;
    b=min(2*a,b);
    c=min(2*b,c);
    d=min(2*c,d);
    ans=0;
   // cout << c << " " << d << "\n";
    if(n%2==0)
        ans=d*n/2;
    else
        ans=((d*(n-1))/2) + c;
    cout << ans << "\n";

    return 0;
}


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

const int maxn = 1e5+5, M = 1e9+7;
int N;
vector<int> adj[maxn];

ll dp[2][maxn]; //0 = white, 1 = black
//dp[0] means parent is white

int sum(int a, int b) {
    return (a+b) % M;
}

ll f(int t, int i, int p) {
    if (dp[t][i] != -1) return dp[t][i];
    dp[t][i] = 1;
    for (int j: adj[i]) {
        if (j == p) continue;
        if (t == 0) {
            dp[t][i] = (1LL*dp[t][i]*sum(f(0,j,i),f(1,j,i))) % M;
        }
        else {
            dp[t][i] = (1LL*dp[t][i]*f(0,j,i)) % M;
        }
    }
    return dp[t][i];
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
        int x, y; cin >> x >> y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    memset(dp,-1,sizeof dp);
    ll ans = (f(0,1,1) + f(1,1,1)) % M;
    cout << ans << '\n';

    return 0;
}



Measured memory_bytes: 15616
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

long long eval(vector<string> vals)
{
    long long ans = 0;
    for (auto str : vals) {
        string tmp;
        for (auto c : str) {
            if (c == '+') {
                ans += stoll(tmp);
                tmp.clear();
                continue;
            }
            tmp += c;
        }
        ans += stoll(tmp);
        tmp.clear();
    }
    return ans;
}

int main()
{
    string S; cin >> S;
    vector<string> vals;
    for (int bit = 0; bit < (1 << S.size()-1); ++bit) {
        string s;
        for (int i = 0; i < S.size(); ++i) {
            s += S[i];
            if (bit & (1 << i)) s += '+';
        }
        vals.push_back(s);
    }
    cout << eval(vals) << endl;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll H1, M1, H2, M2, K;
    ll dH, dM;
    ll tim;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    dH = H2 - H1;
    dM = M2 - M1;
    tim = dH * 60 + dM;
    cout << tim - K << endl;
    return 0;
}


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

using namespace std;

int main() {
	int N;
	cin >> N;
	int n = N % 10;
	if (3 == n) {
		cout << "bon" << endl;
	}
	else if((0 == n)||(1 == n)||(6 == n)||(8 == n)){
		cout << "pon" << endl;
	}
	else {
		cout << "hon" << endl;
	}
	return 0;
}

Measured memory_bytes: 3592
import java.io.*;

class Main{
	
	public static void main(String args[]) throws IOException{
		BufferedReader br 
			= new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		
		int i=1;
		int x;
		while(true){
			x = i;
			
			if(x%3==0){
				System.out.print(" "+i);
			} else {
			
				while(x != 0){
					if(x%10==3){
						System.out.print(" "+i);
						break;
					}
					
					x/=10;
				}
				
			} 
			
			if(++i > n)break;
		}
		
		System.out.print("\n");
	}
	
}

Measured memory_bytes: 26612
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans,p=0,-1
for i in b:ans+=i
for i in a:
    if i-p==1:ans+=c[p-1]
    p=i
print(ans)


Measured memory_bytes: 38256
#include<stdio.h>
#include<string.h>
typedef long long int ll;
#define MX 200009
int A[MX];
ll ans;
int main() {
	int i, n, mx = 0;
	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		scanf("%d", &A[i]);
		if (mx < A[i]) {
			mx = A[i];
		}
		else {
			ans += ((ll)mx - (ll)A[i]);
		}
	}
	printf("%lld", ans);
}

Measured memory_bytes: 2468
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.nextString();
            int n = s.length();

            for (int i = 1; i < n; i++) {
                int len = n - i;
                if (len % 2 == 1) continue;

                if (s.substring(0, len / 2).equals(s.substring(len / 2, len))) {
                    out.println(len);
                    return;
                }
            }
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 23220
#include <bits/stdc++.h>
#define ll long long
#define ps pair<string, string>
using namespace std;

string sed(string a, string b, string c) {
    string res = "";
    for (int i = 0; i < a.size(); i++) {
        if (a.substr(i).find(b) == 0) {
            res += c;
            i += b.size() - 1;
        } else {
            res += a[i];
        }
    }
    return res;
}

int main() {
    int n;
    while (cin >> n, n) {
        vector<ps> v;
        for (int i = 0; i < n; i++) {
            string a, b;
            cin >> a >> b;
            v.push_back(ps(a, b));
        }
        string y, z;
        cin >> y >> z;
        map<string, int> mp;
        queue<string> que;
        mp[y] = 0;
        que.push(y);
        while (!que.empty()) {
            string c = que.front();
            que.pop();
            if (c.size() > z.size()) continue;
            if (c == z) break;
            for (int i = 0; i < n; i++) {
                string nx = sed(c, v[i].first, v[i].second);
                if (mp.find(nx) == mp.end()) {
                    mp[nx] = mp[c] + 1;
                    que.push(nx);
                }
            }
        }
        if (mp.find(z) == mp.end()) {
            cout << -1 << endl;
        } else {
            cout << mp[z] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pp pair<ll,ll>
#define vi vector<pair<pp,pp> >
#define pq_min priority_queue<ll,vector<ll>,greater<ll> >
#define pq_max priority_queue<ll>
#define forx(i,a,b) for(ll i=0;i<a;i++)
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define ld long double
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef pair<pp,pp> ppll;
const ll mod=1e9 + 7;

int main()
{
	fast;
	string s;
	cin>>s;
	for(ll i=0;i<s.length();i++)
	{
		cout<<"x";
	}
}

Measured memory_bytes: 256
S = input()
yes = True

for num in range(len(S)):
    if S[num] != S[len(S)-num-1]:
        yes = False

S = S[:(len(S) - 1) // 2]

for num in range(len(S)):
    if S[num] != S[len(S)-num-1]:
        yes = False

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


Measured memory_bytes: 3060