akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

public class Main {

    static int N;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();

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

    static int solve() {

        int min = Integer.MAX_VALUE;
        for (int a = 1; a <= N-1; a++) {
            int b = N-a;

            min = Math.min(calc(a) + calc(b), min);
        }
        return min;
    }

    static int calc(int a) {
        int sum = 0;
        while(a > 10) {
            int q = a / 10;
            int r = a % 10;
            sum += r;
            a = q;
        }
        return sum + a;
    }

    @SuppressWarnings("unused")
    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: 21332
import sys

N = int(input())
A = [int(x) for x in input().split()]

n4 = 0
n2 = 0
n1 = 0
for a in A:
    if a % 4 == 0:
        n4 += 1
    elif a % 2 == 0:
        n2 += 1
    else:
        n1 += 1

type = 4

for i in range(N):
    if type == 4:
        if n1 > 0:
            n1 -= 1
            type = 1
        elif n2 > 0:
            n2 -= 1
            type = 2
        elif n4 > 0:
            n4 -= 1
            type = 4
    elif type == 2:
        if n2 > 0:
            n2 -= 1
            type = 2
        elif n4 > 0:
            n4 -= 1
            type = 4
        else:
            print("No")
            sys.exit(0)
    else:
        if n4 > 0:
            n4 -= 1
            type = 4
        else:
            print("No")
            sys.exit(0)

print("Yes")


Measured memory_bytes: 14480
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < int(n); i++)
using namespace std;
 
int main() {
  int A,B,sum;
  cin >> A >> B;
  if(A > 12){
      cout << B << endl;
  } 
  else if(A < 13 && A > 5){
      cout << B/2 << endl;
  }
  else{
      cout << 0 << endl;
  }

}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	static FastScanner sc = new FastScanner();
	static PrintWriter out = new PrintWriter(System.out);

	static void solve() {
		int[] vx = { -1, 0, 1, 0 };
		int[] vy = { 0, 1, 0, -1 };
		while (true) {
			int N = sc.nextInt();
			if (N == 0) {
				System.exit(0);
			} else {
				int[] x = new int[N];
				int[] y = new int[N];
				for (int i = 1; i < N; i++) {
					int n = sc.nextInt();
					int d = sc.nextInt();
					x[i] = x[n] + vx[d];
					y[i] = y[n] + vy[d];
				}
				int minx = 0, maxx = 0, miny = 0, maxy = 0;
				for (int i = 1; i < N; i++) {
					int xi = x[i];
					minx = min(minx, xi);
					maxx = max(maxx, xi);
					int yi = y[i];
					miny = min(miny, yi);
					maxy = max(maxy, yi);
				}
				int width = maxx - minx + 1;
				int height = maxy - miny + 1;
				out.println(width + " " + height);
			}
			out.flush();
		}
	}

	public static void main(String[] args) {
		solve();
	}

	static int max(int a, int b) {
		return a < b ? b : a;
	}

	static int min(int a, int b) {
		return a < b ? a : b;
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}

	private static boolean isPrintableChar(int c) {
		return '!' <= c && c <= '~';
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		int n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

Measured memory_bytes: 25076
n, w_bag = map(int, input().split())
wv = [[int(x) for x in input().split()] for _ in range(n)]
v_sum = sum(x[1] for x in wv)
min_weight = [[0 for _ in range(n + 1)] for _ in range(v_sum + 1)] # min_weight[v][i] = not less valuable than v picked out from the former i

for v in range(1, v_sum + 1):
    min_weight[v][0] = w_bag + 1
    for i in range(1, n + 1):
        if v - wv[i - 1][1] >= 0:
            min_weight[v][i] = min(min_weight[v][i - 1],
                                   min_weight[v - wv[i - 1][1]][i - 1] + wv[i - 1][0])
        else:
            min_weight[v][i] = min_weight[v][i - 1]

endflag = False
for enum, m_w_v in enumerate(reversed(min_weight)):
    for m_w_v_i in m_w_v:
        if m_w_v_i <= w_bag:
            print(v_sum - enum)
            endflag = True
            break
    if endflag:
        break
if not endflag:
    print(0)

Measured memory_bytes: 130140
#include <iostream>
#include <algorithm>
#include <vector>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	vector <int> ve;
	ve.push_back(a);
	ve.push_back(b);
	ve.push_back(c);
	sort(ve.begin(),ve.end());
	
  	if(ve[0]+ve[1]==ve[2])
	{
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 3132
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=200000;
struct Z { int a; ll b; Z() {} Z(int a,ll b):a(a),b(b) {} ll eval(int x) { return (ll)a*x+b; } };

int n; ll jumpcost;
int h[MAXN];

Z z[MAXN+1]; int ztail,zhead;
ll dp[MAXN];

ll overtakes(const Z &p,const Z &q) {
	assert(p.a<q.a);
	// x>=(p.b-q.b)/(q.a-p.a)
	ll num=p.b-q.b,den=q.a-p.a;
	return num>=0?(num+den-1)/den:num/den;
}

ll solve() {
	ztail=zhead=0;
	dp[0]=0; z[zhead++]=Z(-2*h[0],(ll)h[0]*h[0]+dp[0]);
	FOR(i,1,n) {
		while(zhead-ztail>=2&&overtakes(z[ztail+1],z[ztail])<=h[i]) ++ztail;
		dp[i]=jumpcost+(ll)h[i]*h[i]+z[ztail].eval(h[i]);
		Z cur(-2*h[i],(ll)h[i]*h[i]+dp[i]);
		while(zhead-ztail>=2&&overtakes(z[zhead-1],z[zhead-2])>=overtakes(cur,z[zhead-1])) --zhead;
		z[zhead++]=cur;
	}
	return dp[n-1];
}

void run() {
	scanf("%d%lld",&n,&jumpcost);
	REP(i,n) scanf("%d",&h[i]);
	printf("%lld\n",solve());
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 5760
N,Y=map(int,input().split())
answer=-1,-1,-1
for x in range(N+1):
    for y in range(N-x+1):
        z=N-x-y
        if 0<=z<=2000 and 10000*x+5000*y+1000*z==Y:
            answer=x,y,z
            break
    else:
        continue
    break
print(*answer)

Measured memory_bytes: 9120
n = int(input())
versus = []
T_point = 0
H_point = 0

for i in range(n):

    Taro, Hanako = input().split()
    
    versus.append(Taro)
    versus.append(Hanako)
    
    versus.sort()
    
    if Hanako == Taro == versus[0]:
        T_point += 1
        H_point += 1
    
    elif versus[0] == Taro:
        H_point += 3
        
    else:
        T_point += 3
        
    versus.clear()
    
print(f"{T_point} {H_point}")


Measured memory_bytes: 5616
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define repr(i, n) for(int i=(n-1); 1<=i; i--)
#define repr2(i, from, to) for(int i=(from-1); (int)(to)<=i; i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define LLPair pair<ll, ll>
typedef long long ll;

using namespace std;

struct Point { int x, y; };
struct Edge { int to, cost; };
struct gNode { int from, to, cost; };
struct tNode { int value; int parent; vector<int> child; };


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

int gcd(int a, int b){ return a % b == 0 ? b : gcd(b, a%b); }
int lcm(int a, int b){ return a * b/ gcd(a, b); }
int extgcd(int a, int b, int& x, int& y){
	int d = a;
	if(b != 0){
		d = extgcd(b, a%b, y, x);
		y -= (a/b) * x;
	} else{
		x = 1; y = 0;
	}
	return d;
}
ll mod_pow(ll x, ll n){
	if(n == 0) return 1;
	ll res = mod_pow(x*x % MOD, n/2);
	if(n & 1) res = res * x % MOD;
	return res;
}

class UnionFind {
public:
	vector <ll> par; // 親
	vector <ll> rank; // 木の深さ
	ll numComponent; //集合の数
	void init(ll n) {
		par.resize(n);
		rank.assign(n, 1LL);
		for(ll i = 0; i < n; ++i) par[i] = i;
		numComponent = n;
	}

	ll findRoot(ll x) {
		if(par[x] == x) return x;
		else return par[x] = findRoot(par[x]);
	}

	bool unite(ll x, ll y) {
		x = findRoot(x);
		y = findRoot(y);
		if(x == y) return false;
		if(rank[x] < rank[y]) swap(x, y);
		rank[x] += rank[y];
		par[y] = x;
		numComponent--;
		return true;
	}

	bool same(ll x, ll y){
		return findRoot(x) == findRoot(y);
	}

	ll size(ll x) {
		return rank[findRoot(x)];
	}
};

int main(void){
	ll n, m; cin >> n >> m;
	vector<LLPair> ab(m);
	rep(i, m){
		ll a, b; cin >> a >> b;
		a--; b--;
		ab[i].first = a;
		ab[i].second = b;
	}

	UnionFind uf;
	uf.init(n);
	vector<ll> ans(m);
	ans[m-1] = (n*(n-1)) / 2;
	repr(i, m){
		ll a = ab[i].first;
		ll b = ab[i].second;
		if(!uf.same(a, b)){
			ans[i-1] = ans[i] - uf.size(a)*uf.size(b);;
		} else{
			ans[i-1] = ans[i];
		}
		uf.unite(a, b);

	}

	rep(i, m) cout << ans[i] << endl;

	return 0;
}

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

int LIS(vector<int> a){
	vector<int> dp;
	const int infi=1e9+7;
	int n = a.size();
	dp.resize(n);
	fill(dp.begin(),dp.end(),infi);
	for(int i=0;i<n;i++){
		*lower_bound(dp.begin(),dp.end(),a[i])=a[i];
	}
	int ans = lower_bound(dp.begin(),dp.end(),infi)-dp.begin();
	return ans;
}
  
  
int main(){
	int n;
	cin >> n;
	vector<int> v(n);
	for(auto &x:v)cin>>x;
	cout << LIS(v) << endl;
}


Measured memory_bytes: 3944
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
  ll n,k;cin >> n >> k;
  vl v(n);rep(i,n)cin >> v[i];
  vector<ll> ord(n-1);
  rep(i,n-1){
    if(v[i]<v[i+1])ord[i]=1;
    else ord[i]=0;
  }
  ll cost=0,now=0;
  bool use=false;
  rep(i,k-1)now+=ord[i];
  if(now==k-1)use=true;
  set<ll> st;
  rep(i,k)st.ins(v[i]);
  ll res=1;
  rep(i,n-k){
    bool check=false;
    if(*st.begin()!=v[i])check=true;
    st.erase(v[i]);
    if(*st.rbegin()>v[i+k])check=true;
    st.ins(v[i+k]);
    now+=ord[i+k-1];
    now-=ord[i];
    if(now==k-1&&use)check=false;
    if(!use&&now==k-1)use=true;
    if(check)res++;
    //cout << res <<endl;
  }
  cout << res <<endl;
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    int dp[n+1] = {0};
    
    for (int i = 0; i < m; ++i) {
        int a;
        cin >> a;
        dp[a] = -1;
    }
    dp[0] = 1;
    if(dp[1] != -1) dp[1] = 1;

    int MOD = 1000000007;

    for (int i = 2; i < n+1; ++i){
        if(dp[i] == -1) continue;

        if(dp[i-2] != -1 && dp[i-1] != -1) dp[i] = (dp[i-2]%MOD + dp[i-1]%MOD)%MOD;
        if(dp[i-2] == -1 && dp[i-1] != -1) dp[i] = dp[i-1];
        if(dp[i-2] != -1 && dp[i-1] == -1) dp[i] = dp[i-2];
        if(dp[i-2] == -1 && dp[i-1] == -1) dp[i] = 0;
    }

    cout << dp[n] << endl;
}

Measured memory_bytes: 640
//Life is inherently meaningless unless you find something which gives it meaning
 

#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll sieve[1000002];
int main(){
    ll n,ans=0;
    cin>>n;
    for1(i,n){
        for(ll j=i;j<=n;j+=i) sieve[j]++;
    }
    for(ll i=1;i<n;i++) ans+=sieve[i];
    cout<<ans;
}

Measured memory_bytes: 11408
#include<bits/stdc++.h>
using namespace std;
#define ll  long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD = 1000000007;
ll cnt =0,ans=0;
const int MAX = 510000;

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


Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;

int main() { 
    int n;
    cin >> n;
    vector<int> a(n);
    for(int& x : a) {
        cin >> x;
    }
    sort(a.begin(), a.end());
    cout << a[n / 2] - a[n / 2 - 1] << '\n';
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for (int i = a; i < (int)b; ++i)
#define rrep(i, n) for (int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if (a >= k) {
        cout << k << endl; 
    } else if (a < k && a + b >= k) {
        cout << a << endl;
    } else {
        cout << a - (k - (a + b)) << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3656
k=int(input())
print(int(k/2)*int((k+1)/2))
#Source code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 characters

Measured memory_bytes: 2940
#include<iostream>
#include<cstdio>
#include<cstring>
#include <fstream>
#include<string>
#include<sstream>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
#include <math.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1000000007;
const int INF = 1000000007;
const double EPS = 1e-10;
const double PI = 3.14159265359;
const int N = 100005;
//cout << fixed << std::setprecision(9)
//--------------------------

int n, k;
int a[102];
bool dp[N];//0-first, 1-second

int main()
{
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = 0; i < a[0]; i++) {
		dp[i] = 1;
	}

	for (int i = a[0]; i <= k; i++) {
		dp[i] = 1;
		for (int j = 0; j < n; j++) {
			int m = i - a[j];
			if (m < 0) break;
			if (dp[m] == 1) dp[i] = false;
		}
	}

	if (dp[k] == 0) cout << "First" << endl;
	else cout << "Second" << endl;

	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef vector<long> vec;
//配列の添字ズレに注意
//=に注意
long max(long a,long b){
if(a>b)return a;
  return b;
}
long min(long a,long b){
if(a<b)return a;
  return b;
}

int main(){
  long n,m,k,ans=0,memo,x,y; cin>>n>>m>>k;
  long a[n],b[m];
  vec A(n+1),B(m+1);
  
  rep(i,n)cin>>a[i];
  rep(i,m)cin>>b[i];
  
  A[0]=0;B[0]=0;
  rep(i,n)A[i+1]=A[i]+a[i];
  rep(i,m)B[i+1]=B[i]+b[i];
  
  rep(i,m)if(B[i+1]<k){ans=max(ans,i+1);}
  memo=ans;
  
  rep(i,n+1){
    if(A[i]>k)break;
    x=k-A[i];
    auto  iter =upper_bound(B.begin(), B.end(),x);
    long index = std::distance(B.begin(), iter);
    ans=max(ans,i+index-1);

  }

  cout<<ans<<endl;
}

Measured memory_bytes: 9592
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10,inf=1e9;
int n,dp[N][2];
char s[N];
int k;bool is[N];
int main(){
	//freopen("a.in","r",stdin);
	scanf("%d%s",&n,s+1);for(int i=1;i<=n;i++)is[i]=s[i]=='.'?0:1;
	dp[0][0]=0;dp[0][1]=inf;
	for(int i=1;i<=n;i++){
		if(is[i]){
			dp[i][1]=min(dp[i-1][0],dp[i-1][1]);
			dp[i][0]=dp[i-1][0]+1;
		}else{
			dp[i][0]=dp[i-1][0];
			dp[i][1]=min(dp[i-1][0],dp[i-1][1])+1;
		}
	}
	cout<<min(dp[n][0],dp[n][1]);
}


Measured memory_bytes: 2176
using System;
using System.Linq;

class C
{
	static int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();
	static void Main() => Console.WriteLine(string.Join("\n", new int[int.Parse(Console.ReadLine())].Select(_ => Solve())));

	static string Solve()
	{
		var h = Read();
		V p0 = new V(h[0], h[1]), p1 = new V(h[2], h[3]), p2 = new V(h[4], h[5]), p3 = new V(h[6], h[7]);
		V s1 = p1 - p0, s2 = p3 - p2;

		Func<V, V, double, double> getY = (q0, q1, x) => (double)(q1.Y - q0.Y) / (q1.X - q0.X) * (x - q0.X) + q0.Y;
		var m1 = (double)s1.Y / s1.X;
		var m2 = (double)s2.Y / s2.X;

		if (double.IsInfinity(m1)) return $"{p0.X:F9} {getY(p2, p3, p0.X):F9}";
		if (double.IsInfinity(m2)) return $"{p2.X:F9} {getY(p0, p1, p2.X):F9}";

		var x0 = (m1 * p0.X - m2 * p2.X + p2.Y - p0.Y) / (m1 - m2);
		return $"{x0:F9} {getY(p0, p1, x0):F9}";
	}
}

struct V
{
	public int X, Y;
	public V(int x, int y) { X = x; Y = y; }
	public override string ToString() => $"{X} {Y}";

	public static V operator -(V v) => new V(-v.X, -v.Y);
	public static V operator +(V v1, V v2) => new V(v1.X + v2.X, v1.Y + v2.Y);
	public static V operator -(V v1, V v2) => new V(v1.X - v2.X, v1.Y - v2.Y);

	public static bool IsParallel(V v1, V v2) => v1.X * v2.Y == v2.X * v1.Y;
	public static bool IsOrthogonal(V v1, V v2) => v1.X * v2.X == -v1.Y * v2.Y;
}



Measured memory_bytes: 18452
#include <iostream>
using namespace std;
int A,B,C,D;
int main()
{
	cin>>A>>B>>C>>D;
	cout<<endl;
	if(A<=B)
	{
		if(C<=D)
		cout<<A+C<<endl;
		else
		cout<<A+D<<endl;
	}
	else
	{
		if(C<=D)
		cout<<B+C<<endl;
		else
		cout<<B+D<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
/**
 * auther: moririn_cocoa
 */
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_)

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define fi first
#define se second

int main(int argc, char* argv[]) {
  
  int X;
  int Y;
  
  cin >> X;
  cin >> Y;
  
  cout << X + Y / 2 << endl;
  
  return 0;
}

Measured memory_bytes: 3616
R,C,K=map(int, input().split())
M=[[0 for i in range(C)]for i in range(R)]
for i in range(K):
  r,c,v=map(int, input().split())
  r-=1
  c-=1
  M[r][c]=v
dp0=[[0 for j in range(C)] for i in range(R)]
dp1=[[0 for j in range(C)] for i in range(R)]
dp2=[[0 for j in range(C)] for i in range(R)]
dp3=[[0 for j in range(C)] for i in range(R)]
dp1[0][0]+=M[0][0]
for r in range(R):
  for c in range(C):
    if 0<r:
      dp1[r][c]=max(max(dp1[r-1][c],dp2[r-1][c],dp3[r-1][c])+M[r][c],dp1[r][c])
      dp0[r][c]=max(max(dp1[r-1][c],dp2[r-1][c],dp3[r-1][c]),dp0[r][c])
    if 0<c:
      dp3[r][c]=max(dp2[r][c-1]+M[r][c],dp3[r][c],dp3[r][c-1])
      dp2[r][c]=max(dp1[r][c-1]+M[r][c],dp2[r][c],dp2[r][c-1])
      dp1[r][c]=max(dp0[r][c-1]+M[r][c],dp1[r][c],dp1[r][c-1])
      dp0[r][c]=max(dp0[r][c-1],dp0[r][c])
ans=0
for i in range(R):
  for j in range(C):
    ans=max(ans,dp1[i][j],dp2[i][j],dp3[i][j])
print(ans)

Measured memory_bytes: 473560
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;

public class Main  implements Runnable { //Runnableを実装する

    public static void main(String[] args) {

        new Thread(null, new Main(), "", 16 * 1024 * 1024).start(); //16MBスタックを確保して実行

    }

    public void run() {
		Scanner sc = new Scanner(System.in);
		//Scanner sc = new Scanner("3 2 9");
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int t = Integer.parseInt(sc.next());
		//int k = 0;
		//int k = Integer.parseInt(sc.next());
		//String str = sc.next();
		//char c[] = str.toCharArray();
		int ans = t/a*b;
		PrintWriter out = new PrintWriter(System.out);
		out.println(ans);
		out.flush();
	}
}

Measured memory_bytes: 22996
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int p[205][5];
int r[105];
int ans[205];
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<3;j++)
		{
			cin >> p[i][j];
		}
	}
	memset(ans,0,sizeof(ans));
	for(int i=0;i<3;i++)
	{
		memset(r,0,sizeof(r));
		for(int j=0;j<n;j++)
		{
			r[p[j][i]]++;
		}
		for(int j=0;j<n;j++)
		{
			if(r[p[j][i]]==1)ans[j]+=p[j][i];
		}
	}
	for(int i=0;i<n;i++)
	{
		cout << ans[i] << endl;
	}
	return 0;
}	

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

#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;

const long long max_n = 1011, inf = 1000111222;

int n, b[max_n], k;
vector<ll> v;

int get_bit(ll val, int bit) {
	return (val >> bit) & 1;
}

int main() {
	cin >> n >> k;
	for (int i = 0; i < n; ++i) {
		cin >> b[i];
		ll sum = 0;
		for (int q = i; q >= 0; --q) {
			sum += b[q];
			v.push_back(sum);
		}
	}
	ll ans = 0;
	for (int i = 50; i >= 0; --i) {
		int cnt = 0;
		for (int q = 0; q < v.size(); ++q) {
			cnt += get_bit(v[q], i);
		}
		if (cnt >= k) {
			for (int q = 0; q < v.size(); ++q) {
				if (!get_bit(v[q], i)) {
					swap(v[q], v.back());
					v.pop_back();
					--q;
				}
			}
			ans += 1LL << i;
		}
	}
	cout << ans << endl;
	return 0;
}


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

//template
#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 ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
//template end



int main(){
    int n,m; scanf("%d%d",&n,&m);
    int l; scanf("%d",&l);
    ll dist[310][310]; Fill(dist,INF);
    ll dist2[310][310]; Fill(dist2,INF);
    rep(i,0,n)dist[i][i]=dist2[i][i]=0;
    rep(i,0,m){
        int a,b,c; scanf("%d%d%d",&a,&b,&c);
        a--; b--;
        if(c<=l)dist[a][b]=dist[b][a]=c,dist2[a][b]=dist2[b][a]=1;
    }
    rep(k,0,n)rep(i,0,n)rep(j,0,n)chmin(dist[i][j],dist[i][k]+dist[k][j]);
    rep(i,0,n)rep(j,0,n)if(dist[i][j]!=INF){
        if(dist[i][j]<=l)dist2[i][j]=1;
    }
    rep(k,0,n)rep(i,0,n)rep(j,0,n)chmin(dist2[i][j],dist2[i][k]+dist2[k][j]);
    int q; scanf("%d",&q);
    rep(rot,0,q){
        int a,b; scanf("%d%d",&a,&b); a--; b--;
        printf(dist2[a][b]==INF?"-1\n":"%lld\n",dist2[a][b]-1);
    }
    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))
#define ps(x,noOfDecimal) fixed<<setprecision(noOfDecimal)<<x

using namespace std;

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    std::ios::sync_with_stdio(false);
    ll a;
    cin>>a;
    cout<<(a+a*a+a*a*a);
    return 0;
}

Measured memory_bytes: 3648
class Node():
    def __init__(self, key):
        self.key = key
        self.parent = None
        self.left = None
        self.right = None

class Tree():
    def __init__(self):
        self.root = None
        self.list = []

    def insert(self, node):
        y = None                 # x's parent    
        x = self.root
        while x is not None:
            y = x                # set parent
            if node.key < x.key:
                x = x.left
            else:
                x = x.right
        node.parent = y

        if y is None:
            self.root = node
        elif node.key < y.key:
            y.left = node
        else:
            y.right = node

    def find(self, key):
        node = self.root
        while node is not None and key != node.key:
            if key < node.key:
                node = node.left
            else:
                node = node.right
        return node

    def delete(self, node):
        target_node = None
        if node.left is None or node.right is None:
            target_node = node
        else:
            target_node = self.get_successor(node.right)

        target_child = None
        if target_node.left is not None:
            target_child = target_node.left
        else:
            target_child = target_node.right

        if target_child is not None:
            target_child.parent = target_node.parent

        if target_node.parent is None:
            self.root = target_child
        else:
            if target_node is target_node.parent.left:
                target_node.parent.left = target_child
            else:
                target_node.parent.right = target_child

        if target_node is not node:
            node.key = target_node.key

    def get_successor(self, node):
        if node.left is None:
            return node

        while node.left is not None:
            node = node.left
        return node

    def parse_inorder(self, node):
        if node is None:
            return 
        self.parse_inorder(node.left)
        self.list.append(node.key)
        self.parse_inorder(node.right)

    def parse_preorder(self, node):
        if node is None:
            return
        self.list.append(node.key)
        self.parse_preorder(node.left)
        self.parse_preorder(node.right)

N = int(input())
T = Tree()
for _ in range(N):
    order, *key = input().split()
    if order == "print":
        T.list = []
        T.parse_inorder(T.root)
        print(" " + " ".join(map(str, T.list)))
        T.list = []
        T.parse_preorder(T.root)
        print(" " + " ".join(map(str, T.list)))
    elif order == "find":
        # キーが見つかった時そのノードを返し、見つからなかった時はNoneを返す
        node = T.find(int(key[0]))
        if node is not None:
            print("yes")
        else:
            print("no")
    elif order == "delete":
        node = T.find(int(key[0]))
        if node is None:
            continue
        T.delete(node)
    else:
        node = Node(int(key[0]))
        T.insert(node)



Measured memory_bytes: 118480
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


t, x = LI()
t_a = t / x
print(t_a)


Measured memory_bytes: 9028
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
x ,y = map(int,input().split())
if x in a and y in a:
  print("Yes")
elif x in b and y in b:
  print("Yes")
elif x in c and y in c:
  print("Yes")
else:
  print("No")
  

Measured memory_bytes: 3060
n = int(input())
P = list(map(int,input().split()))
ans = 0
for i in range(1,n-1):
    P_comp = [P[i-1],P[i],P[i+1]]
    P_comp.sort()
    if P_comp[1] == P[i]:
        ans += 1
print(ans)

Measured memory_bytes: 3060
import java.util.*;

public class Main {

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] count = new int[n][10];
        char[] c = sc.next().toCharArray();
        count[0][c[0] - '0'] = 1;
        for(int i=1; i<n; i++) {
            int a = c[i] - '0';
            for(int j=0; j<10; j++) {
                count[i][j] = count[i-1][j];
                if(j == a) {
                    count[i][j]++;
                }
            }
        }

        int res = 0;
        for(int i=0; i<10; i++) {
            int a = find(count, -1, n, i, 1);
            if(a == n) continue;
            for(int j=0; j<10; j++) {
                int b = find(count, a, n, j, count[a][j] + 1);
                if(b==n) continue;
                for(int k=0; k<10; k++) {
                    if(count[n-1][k] > count[b][k]) res++;
                }
            }
        }
        System.out.println(res);

    }

    static int find(int[][] count, int l, int r, int num, int t) {
        int mid;
        while(r-l > 1) {
            //System.out.println(l + ":" + r);
            mid = (r+l)/2;
            if(count[mid][num] < t) {
                l = mid;
            } else {
                r = mid;
            }
        }
        return r;
    }
}


Measured memory_bytes: 26196
import java.util.*;
import java.io.*;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer t;

    static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    }

    static int ni() {
        return Integer.parseInt(sn());
    }

    static long nlo() {
        return Long.parseLong(sn());
    }

    public static void main(String args[]) {
        int t = 1;//ni();
        while (t-- > 0) {
            solve();
        }
        out.close();
    }

    static long mod = (long) 1e9 + 7;

    static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

    static int maxn = 200005;
    static int a[];
    static int n;
    static List<Integer> l[] = new ArrayList[maxn];
    static int lis[];

    static int bin(int a[], int l, int r, int val) {
        int ans = -1;
        while (l <= r) {
            int mid = (l + r) / 2;
            if (a[mid] >= val) {
                ans = mid;
                r = mid - 1;
            } else
                l = mid + 1;
        }
        return ans;
    }

    static void dfs(int s, int p, int t[], int len) {
        lis[s] = len;
        for (int v : l[s]) {
            if (v != p) {
                int cur = len;
                int ch = -1, id = -1;
                if (a[v] < t[0]) {
                    ch = t[0];
                    t[0] = a[v];
                } else if (a[v] > t[cur - 1])
                    t[cur++] = a[v];
                else {
                    id = bin(t, 0, cur - 1, a[v]);
                    ch = t[id];
                    t[id] = a[v];
                }
                dfs(v, s, t, cur);
                if (id == -1) {
                    if (ch != -1)
                        t[0] = ch;
                    else
                        t[len] = 0;
                } else
                    t[id] = ch;
            }
        }
    }

    static void solve() {
        n = ni();
        a = new int[n];
        lis = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = ni();
        for (int i = 0; i < n; i++)
            l[i] = new ArrayList<>();
        for (int i = 0; i < n - 1; i++) {
            int u = ni() - 1;
            int v = ni() - 1;
            l[u].add(v);
            l[v].add(u);
        }
        int t[] = new int[n];
        t[0] = a[0];
        dfs(0, -1, t, 1);
        for (int i = 0; i < n; i++)
            out.println(lis[i]);
    }
}

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

int main(){
  bool cheak = true;
  int n,count=0;
  cin >> n;
  int a[n] = {0};
  for(int i=0;i<n;i++) cin >> a[i];
  while(cheak){
    for(int i=0;i<n;++i){
      if(a[i]%2 == 0){ 
        a[i]/=2;
      }else{
        cheak = false;
        break;
      }
    }
    if(cheak) count++;
  }
  cout << count << endl;
}   
    

  


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to;
	ld cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
ll fact(ll x, ll k,ll p) {//最大値、個数
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
#define int long long
const long long inf = 4523372036854775807;
const int iinf = 1500000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n, k;
string s;
signed main() {
	cin >> s >> k;
	n = s.size();
	for (int i = 0; i < n; i++) {
		if (s[i] != 'a' && (int)'z' - s[i] + 1 <= k) {
			k -= (int)('z' - s[i]) + 1;
			s[i] = 'a';
		}
	}
	s[n - 1] = (char)(((int)(s[n - 1] - 'a') + k) % 26) + 'a';
	cout << s << endl;
	getchar(); getchar();
}

Measured memory_bytes: 576
#include <iostream>

using namespace std;


void solve(long long H, long long W, long long h, long long w){
    cout<< H*W-(H*w+W*h-w*h) << endl;
    return;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);
    long long h;
    scanf("%lld",&h);
    long long w;
    scanf("%lld",&w);
    solve(H, W, h, w);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string>
#include <iostream>
using namespace std;

bool isPrimeNumber(int x) {
	if (x == 2) return true;
	if (x % 2 == 0) return false;

	double dx = sqrt(x);
	for (int i = 3; i <= dx; i+=2) {
		if (x % i == 0) {
			return false;
		}
	}

	return true;
}

int main()
{
	int n, x, c = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x;
		if (isPrimeNumber(x)) {
			c++;
		}
	}

	cout << c << "\n";
}



Measured memory_bytes: 3104
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int S;
    int h,m,s;
    scanf("%d",&S);
    h = S / 3600;
    m = (S-h*3600) / 60;
    s = S - (h*3600 + m*60);
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}



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

int main() {
	int n,x1,x2,x3,x4;
	cin>>n;
	x1=n/1000;;
	x2=(n-1000*x1)/100;
	x3=(n-1000*x1-100*x2)/10;
	x4=n%10;
	if((x1==x2 && x2==x3 && x3==x1 || x2==x3 && x3==x4 && x4==x2)){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#pragma region include
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 4e18;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())input(f[i]); input(r...); }
#pragma endregion

int main() {
    ll A, B; input(A,B);
    if ((A + B) % 2 == 0) {
        cout << (A + B) / 2 << endl;
    }
    else {
        cout << "IMPOSSIBLE" << endl;
    }
    getchar(); getchar();
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>

using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
int N,A,B;






int main()
{

	cin >> N >> A >> B;
	cout << min(A*N,B);





}





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

using namespace std;

int main() {
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  int cmd, val;
  unordered_set<int> s;

  for (int i = 0; i < n; i++) {
    cin >> cmd >> val;
    if (cmd == 0) {
      s.insert(val);
      cout << s.size() << endl;
    } else {
      auto it = s.find(val);
      if (it != s.end()) {
        cout << 1 << endl;
      } else {
        cout << 0 << endl;
      }
    }
  }
}


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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int main() {
	int n, s[100];
	
	cin >> n;
	REP(i, n) scanf("%d", s + i);
	
	int ans = 0;
	REP(i, n) ans += s[i];
	
	sort(s, s + n);
	
	REP(i, n) {
		if (ans % 10 != 0) break;
		if ((ans - s[i]) % 10 != 0) {
			ans -= s[i];
			break;
		}
	}
	
	if (ans % 10 == 0) ans = 0;
	
	cout << ans << endl;
	
	return 0;
}

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

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

int sum(int HW[6][6], int H, int W){
    int num = 0;
    rep(i,H) rep(j,W) num += HW[i][j];
    return num;
}

int main(void){
    int H,W,K;
    scanf("%d %d %d", &H, &W, &K);

    int HW[6][6];
    rep(i,6) rep(j,6) HW[i][j] = 0;
    char tmp;
    rep(i,H) rep(j,W){
        scanf(" %c", &tmp);
        if(tmp == '#') HW[i][j] = 1;
    }

    int bit_max = 1;
    rep(i,H+W) bit_max *= 2;

    int copy[6][6];

    int ans = 0;
    int num, bit;
    rep(k,bit_max){
        rep(i,H) rep(j,W) copy[i][j] = HW[i][j];

        num = 0;
        bit = 1;
        rep(i,H){
            if(k&bit) rep(j,W) copy[i][j] = 0;
            bit *= 2;
        }
        rep(i,W){
            if(k&bit) rep(j,H) copy[j][i] = 0;
            bit *= 2;
        }
        if(sum(copy,H,W) == K) ans++;
    }

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

    return 0;
}

Measured memory_bytes: 1732
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define INF (2 << 28)
#define fr first
#define sc second
using namespace std;

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

int person[200000], next[200000], prev[200000];

int main(){
  
  int N, M, Q;
  
  cin >> N >> M >> Q;
  for(int i = 0; i < N; i++) 
    person[i] = 1, next[i] = (i + 1) % N, prev[i] = (i - 1 + N) % N;
  
  int now = 0;
  while(M--) {
    int a; cin >> a;
    if(a & 1) {
      for(int i = 0; i < a; i++)
        now = prev[now];
    } else {
      for(int i = 0; i < a; i++) 
        now = next[now];
    }
    person[now] = 0;
    next[prev[now]] = next[now];
    prev[next[now]] = prev[now];
    now = next[now];
  }
  
  for(int i = 0; i < Q; i++) {
    int q; cin >> q;
    cout << person[q] << endl;
  }
}

Measured memory_bytes: 3504
use strict;
use warnings;

my $line = <>;
my ($x, $y) = split(/ /, $line);
my $sum = 0;
for my $r ($x, $y) {
	$sum += 100000 * (4 - $r) if $r <= 3;
}
$sum += 400000 if $x == 1 && $y == 1;
print "$sum\n";

Measured memory_bytes: 640
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  	input = input.split(" ");
  	var a = parseInt(input[0],10);
  	var b = parseInt(input[1],10);
  	var seki = a*b
	//出力
  	if (seki % 2 === 0) {
		console.log('Even');
    } else {
    	console.log('Odd');
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    string s,t;
    cin >> s;
    cin >> t;
    int flag = 0;
    for(int i=0;i<s.size();i++){
        if(s[i] == t[i]) flag++;
    }

    if(s.size() == flag) cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}



Measured memory_bytes: 3608