akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
void extgcd(int a, int b, int &x, int &y) {
	if (b) extgcd(b, a % b, y, x), y -= (a / b) * x;
	else x = 1, y = 0;
}
int a, b, x, y;
int main() {
	cin >> a >> b;
	extgcd(a, b, x, y);
	cout << x << ' ' << y << endl;
}

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

int main(){
  int n;
  string s;
  cin >> n >> s;
  vector<int> r(n);
  vector<int> g(n);
  vector<int> b(n);
  for(int i=0;i<n;i++){
    if(i){
      r[i]=r[i-1];
      g[i]=g[i-1];
      b[i]=b[i-1];
    }
    if(s[i]=='R') r[i]++;
    else if(s[i]=='G') g[i]++;
    else b[i]++;
  }
  
  long long ans=0;
  
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n-1;j++){
      if(s[i]!=s[j]){
        if(s[i]=='R'){
          if(s[j]=='G'){
            ans+=b[n-1]-b[j];
            int l=j*2-i;
            if(l<n){
              if(s[l]=='B') ans--;
            }
          }
          else{
            ans+=g[n-1]-g[j];
            int l=j*2-i;
            if(l<n){
              if(s[l]=='G') ans--;
            }
          }
        }
        else if(s[i]=='G'){
          if(s[j]=='B'){
            ans+=r[n-1]-r[j];
            int l=j*2-i;
            if(l<n){
              if(s[l]=='R') ans--;
            }
          }
          if(s[j]=='R'){
            ans+=b[n-1]-b[j];
            int l=j*2-i;
            if(l<n){
              if(s[l]=='B') ans--;
            }
          }
        }
        else{//B
          if(s[j]=='G'){
            ans+=r[n-1]-r[j];
            int l=j*2-i;
            if(l<n){
              if(s[l]=='R') ans--;
            }
          }
          if(s[j]=='R'){
            ans+=g[n-1]-g[j];
            int l=j*2-i;
            if(l<n){
              if(s[l]=='G') ans--;
            }
          }
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3652
// B - Minor Change
#include <bits/stdc++.h>
using namespace std;

int main(){
    string s, t;
    cin >> s >> t;
    int cnt = 0;
    for(int i=0; i<s.size(); i++){
        if(s[i] != t[i]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

int main(){
  int N,M;cin >> N >> M;
  vector<int>X(M);
  for (auto&x : X)cin >> x;
  if (M == 0) {
    cout << 0 << endl;
    return 0;
  }
  if (M <= N){
    cout << 0 << endl;
    return 0;
  }
  vector<int>L(M-1);
  sort(X.begin(),X.end());
  for (int _=1;_<M;_++){
    L[_-1] = X[_] - X[_-1];
  }
  sort(L.begin(),L.end());
  int ans = 0;
  for (int _=0;_<M-N;_++){
    ans += L[_];
  }
  cout << ans << endl;
  return 0;

}

Measured memory_bytes: 1024
// " --- IN THE NAME OF ALLAH --- " // ;)
// ------------sphr_agz------------ // ;)

#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <math.h>
#include <cmath>
#include <list>
#include <stack>
#include <bitset>
#include <ctime>
using namespace std;

typedef long double ld;
typedef long long int lli;
#define pb(x) push_back(x)
#define recout(x) return cout << (x), 0
#define fr first
#define sc second
#define fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define stp(x) cout << setprecision(x) << fixed
#define mk make_pair
const lli N = 102, K = 1e5 + 10, N2 = 5e3, delta = 46639, mod = 1e9 + 7, oo = 1e16;
const ld PI = 3.141592653589793;

lli a[N];
char dp[K];

int main(){
	lli n, k;
	cin >> n >> k;
	for (lli i = 0; i < n; i++)
		cin >> a[i];
	for (lli i = 0; i < n + 1; i++) {
		if (i == 0) {
			for (lli j = 0; j < a[0]; j++)
				dp[j] = '2';
			dp[a[0]] = '1';
		}
		else if (i < n) {
			for (lli j = a[i - 1] + 1; j < a[i]; j++) {
				bool mark = false;
				for (lli u = 0; u < i; u++) {
					if (dp[j - a[u]] == '2') {
						mark = true;
						break;
					}
				}
				if (mark)
					dp[j] = '1';
				else
					dp[j] = '2';
			}
			dp[a[i]] = '1';
		}
		else {
			for (lli j = a[n - 1] + 1; j <= k; j++) {
				bool mark = false;
				for (lli u = 0; u < i; u++) {
					if (dp[j - a[u]] == '2') {
						mark = true;
						break;
					}
				}
				if (mark)
					dp[j] = '1';
				else
					dp[j] = '2';
			}
		}
	}
	if (dp[k] == '1')
		return cout << "First", 0;
	cout << "Second";
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, m;
    cin >> n >> m;
    if (n == m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
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(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	debug("debug test\n");
   	int n,m;cin>>n>>m;
	ll ans = 0;
	rep(i, n){
		int h;
		cin>>h;
		if(h >= m)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
void solve(){
	string s ;
	cin>> s ;
	ll n = s.length();
	for(ll i=0;i<n ;i++){
		if(s[i]=='?')s[i]='D';
	}
	cout<<s<<endl;
}
int main(){
	//mahakal(),fast;
	ll t=1 ;
	// cin>> t;
	while(t--)solve();

	return 0;
}

Measured memory_bytes: 3736
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>

#define MAX_N 1000

int
main(int argc, char **argv)
{
	bool used[MAX_N];
	int n, m;
	int i, j, k;

	while (true)
	{
		scanf("%d %d", &n, &m);
		if (n == 0 && m == 0)
			break;

		for (i = 1; i <= n; ++i)
			used[i] = false;

		k = n;
		for (i = 0; i < n; ++i)
		{
			for (j = 0; j < m;)
			{
				k++;
				if (k > n)
					k = 1;

				if (!used[k])
					j++;
			}

			used[k] = true;
		}

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

	return 0;
}

Measured memory_bytes: 600
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    string S;
    cin >> S;
    int s_i = 0;
    REP(i, S.length()){
        if(S[i]=='A'){
            s_i = i;break;
        }
    }
    REPR(i, S.length()-1){
        if(S[i]=='Z'){
            cout << i-s_i+1 << el;return;
        }
    }
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if(a==1){
    a=14;
  }
  if(b==1){
    b=14;
  }
  if(a>b){
    cout << "Alice";
  }
  if(b>a){
    cout << "Bob";
  }
  if(a==b){
    cout << "Draw";
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
typedef long long ll;
#define MOD 1000000007
int main()
{
    ll N;
    cin >> N;
    vector<ll> A;
    for (int i = 0; i < N; ++i)
    {
        ll temp;
        cin >> temp;
        A.push_back(temp);
    }
    ll ans = 0;
    for (int i = 1; i < N; ++i)
    {

        ll temp = max((ll)0, A[i - 1] - A[i]);
        ans += temp;
        A[i] += temp;
    }
    cout << ans << endl;
}


Measured memory_bytes: 5372
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    ans = ['Odd', 'Even']
    print(ans[(a*b)%2-1])
    return

#B
def B():
    a, b = map(str,input().split())
    a = a + b
    if math.sqrt(int(a)).is_integer():
        print("Yes")
    else:
        print("No")
    return

#C
def C():
    n = II()
    pre = (0, 0, 0)
    for _ in range(n):
        t,x,y = LI()
        dist = abs(pre[0] - x) + abs(pre[1] - y)
        if dist <= t - pre[2] and dist % 2 == (t - pre[2]) % 2:
            pre = (x, y, t)
            continue
        print("No")
        return
    print("Yes")
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()


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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int x = (a + d - 1)/d;
    int y = (c + b - 1)/b;
    cout << (x >= y ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

vector<vector<P>> G(100010);
vector<bool> visited(100010);
vector<int> ans(100010, -1);

void dfs(int cv){
    visited[cv] = true;

    for(auto i : G[cv]){
        int nv, cost;
        tie(nv, cost) = i;

        if(!visited[nv]){
            if(cost % 2){
                if(ans[cv] == 0){
                    ans[nv] = 1;
                }
                else{
                    ans[nv] = 0;
                }
            }
            else{
                ans[nv] = ans[cv];
            }

            dfs(nv);
        }
    }

    return ;
}

int main(){
    int n; cin>>n;
    for(int i=0; i<n-1; i++){
        int u, v, c; cin>>u>>v>>c;
        u--, v--;
        G[u].eb(P(v, c));
        G[v].eb(P(u, c));
    }

    ans[0] = 1;
    dfs(0);

    for(int i=0; i<n; i++){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 8448
N = STDIN.gets.to_i

positions = []
N.times do
	positions << STDIN.gets.chomp.split(' ').map(&:to_i)
end

positions.each_with_index do |p, i|
  angs = positions.reject.each_with_index{|_, j| i == j }.map{|p2| Math.atan2(p2[1] - p[1], p2[0] - p[0])}.sort
  m = angs.map.with_index { |ang, j| (angs[j + 1] || (angs[0] + 2 * Math::PI)) - ang }.max
  puts m > Math::PI ? (m - Math::PI) / (2 * Math::PI) : 0
end


Measured memory_bytes: 2300
#include <stdio.h>          // printf(), scanf()

int
main(int argc, char** argv)
{
	int a, b, c;

	int c_rect = 0;
	int c_lozen = 0;
	while (scanf("%d,%d,%d", &a, &b, &c) != EOF)
	{
		if (a * a + b * b == c * c)
			c_rect++;
		else if (a == b)
			c_lozen++;
	}

	printf("%d\n", c_rect);
	printf("%d\n", c_lozen);
	return 0;
}

Measured memory_bytes: 596
input_1 = input()
input_2 = input()
term, work_cnt = input_1.split(' ')
works = input_2.split(' ')

play_days = int(term)
for i in range(int(work_cnt)):
  play_days -= int(works[i])

if play_days < 0:
  play_days = -1

print(play_days)

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

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll n,m,s,ans,p,q;
ll seg[1<<18];
void add(int a,int b,int r,int l,int k,ll x){
    if(a<=r&&l<=b)seg[k]+=x;
    else if(r<=b&&a<=l){
        add(a,b,r,(r+l-1)/2,k*2+1,x);
        add(a,b,(r+l+1)/2,l,k*2+2,x);
    }
}
void ini(int k,int r,int l){
    if(l-r>0){
        seg[k*2+1]+=seg[k];
        seg[k*2+2]+=seg[k];
        ini(k*2+1,r,(r+l-1)/2);
        ini(k*2+2,(r+l+1)/2,l);
    }
}
int main(void){
    cin>>n>>m>>p;
    p--;
    for(int i=0;i<n-1;i++){
        cin>>q;
        q--;
        if(p<q){
            if(q-p>1){
                add(p+2,q,0,(1<<17)-1,0,-1);
                if(q+1<m)add(q+1,q+1,0,(1<<17)-1,0,q-p-1);
            }
            s+=q-p;
        }else{
            if(!(p==m-1&&q==0)){
                if(p+2<m)add(p+2,m-1,0,(1<<17)-1,0,-1);
                if(0<q)add(1,q,0,(1<<17)-1,0,-1);
                add(q+1,q+1,0,(1<<17)-1,0,m-p+q-1);
            }
            s+=q+1;
        }
        p=q;
    }
    ini(0,0,(1<<17)-1);
    ans=s;
    for(int i=1;i<m;i++){
        s+=seg[i+(1<<17)-1];
        ans=min(ans,s);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define M 1000000007

int main() {
	int n;
	cin >> n;
	vector<int> d(n);
	bool h = true;
	for (int i = 0; i < n; i++) {
		cin >> d[i];
		if (n % 2 == 0 && d[i] % 2 == 1) {
		} else if (n % 2 == 1 && d[i] % 2 == 0) {
		} else {
			h = false;
		}
	}
	sort(d.begin(), d.end());
	if (n % 2 == 0) {
		int a = 1;
		for (int i = 0; i+1 <= n-1; i += 2) {
			if (d[i] == a && d[i+1] == a) {
				a += 2;
			} else {
				h = false;
			}
		}
	} else {
		if (d[0] == 0) {
			int a = 2;
			for (int i = 1; i+1 <= n-1; i += 2) {
				if (d[i] == a && d[i+1] == a) {
					a += 2;
				} else {
					h = false;
				}
			}
		} else {
			h  = false;
		}
	}
	if (h) {
		if (n % 2 == 0) {
			long long int ans = 1;
			for (int i = 0; i < n/2; i++) {
				ans *= 2;
				ans %= M;
			}
			cout << ans << endl;
		} else {
			long long int ans = 1;
			for (int i = 0; i < n/2; i++) {
				ans *= 2;
				ans %= M;
			}
			cout << ans << endl;
		}
	} else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <algorithm>

#define rep(i,n) for(int i=0; i < n; i++)
using namespace std;
#define PI 3.14159265358979

int main()
{
    int n, m, hw = 0;
    cin >> n >> m;
    
    rep(i, m)
    {
        int a;
        cin >> a;
        hw += a;
        if (hw > n) {
            hw = n+1;
            break;
        }
    }
    cout << n-hw << endl;
    return 0;
}

Measured memory_bytes: 3636
N = gets.to_i
P = gets.split(" ").map(&:to_i)
Q = gets.split(" ").map(&:to_i)

ary = (1..N).to_a.permutation.to_a
i, j = 0, 0
loop do
    if ary[i] == P
    break
    else
        i += 1
    end
end

loop do
    if ary[j] == Q
    break
    else
        j += 1
    end
end

puts (i - j).abs

Measured memory_bytes: 6780
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var nk = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
            Console.WriteLine(Console.ReadLine().Split(' ').Select(num => int.Parse(num))
                .OrderBy(x => x).Take(nk[1]).Sum());
        }
    }
}

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

int main(){
    int a, b;
    cin >> a >> b;
    if(a >= 13) cout << b << endl;
    else if(a >= 6 && a <= 12) cout << b/2 << endl;
    else cout << 0 << endl;
    return 0;
}

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

ll g1(ll n, int p) {
    if (n == 0) return 0;
    return n/p + g1(n/p, p);
}

ll g2(ll n, int p) {
    if (n%2 == 1) {
        return g1(n,p) - g2(n-1,p);
    }
    ll res = g1(n/2,p);
    if (p == 2) res += n/2;
    return res;
}

int main() {
    ll n;
    cin >> n;
    ll ans = min(g2(n,2), g2(n,5));
    cout << ans << endl;
    return 0;
}

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


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, k;
    cin >> n >> k;
    int ans = 0;
    while (1) {
        if (n <= 0) {
            cout << ans << endl;
            return 0;
        }
        if (ans == 0) {
            ans++;
            n -= k;
        } else {
            ans++;
            n -=(k-1);
        }
    }
    
    return 0;
}





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

using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    vector<int> v;
    for(int i=0;i<n;++i){
        int a;
        cin >> a;
        v.push_back(a);
    }
    i64 ans = v[0] - 1;
    int mini = 2;
    for(int i=1;i<n;++i){
        if(v[i] == mini){
            mini++;
            continue;
        }
        ans += (v[i]+(mini-1))/mini - 1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = (int)1e7;  
using  p = pair<int,int>;

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

   auto c = 0;
   for (int i = 0; i < n-1; i++)
   {
      c+= s[i]==s[i+1] ? 1:0;
   }
   
   cout << min(c+k*2,n-1);
   
}
  
  

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

int main()
{
  string a,b;
  int i,kazu=0;
  int s[27]={};
  int t[27]={};
  int s_kazu[200001]={};
  int t_kazu[200001]={};
  bool flag=true;
  
  cin>>a>>b;

  kazu=a.size();
  
  
  for(i=0;i<kazu;i++){
    s[ a[i]-'a']++;

    t[ b[i]-'a']++;
    
  }

  for(i=0;i<int('z'-'a'+1);i++){
    s_kazu[s[i]]++;
    t_kazu[t[i]]++;
  }

  for(i=0;i<200001;i++){
    if(s_kazu[i]==t_kazu[i]) continue;
    flag=0;
    break;
  }
  
  if(flag) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


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

int main()
{
  int n, x, Tlong, Hlong;
  int a = 0, b = 0, sh;
  string Taro, Hana;
  cin >> n;
    
  for(int i = 0; i < n; i++)
  {
    x = 0;

    cin >> Taro >> Hana;

    Tlong = Taro.size();
    Hlong = Hana.size();

    if(Tlong < Hlong)
    {
      sh = Tlong;
    }
    else
    {
      sh = Hlong;
    }

    while(1)
    {
      //花子の勝ち
      if(Taro[x] < Hana[x])
      {
        b += 3;
        break;
      }
        
      //太郎の勝ち
      if(Hana[x] < Taro[x])
      {
        a += 3;
        break;
      }
      
      //単語の長さが違うとき
      if(x == sh)
      {
        //花子の勝ち
        if(Tlong < Hlong)
        {
          b += 3;
          break;
        }
        //太郎の勝ち
        if(Hlong < Tlong)
        {
          a += 3;
          break;
        }
        //引き分け
        if(Tlong == Hlong)
        {
          a++;
          b++;
          break;
        }
      }
      x++;
    }
  }

  cout << a << " " << b << endl;

  return 0;
}


Measured memory_bytes: 3140
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007L

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val H = ni()
    val W = ni()
    val K = ni()
    val g = Array(H){ns()}
    val sum = g.map{it.count { it == '#' }}.sum()
    var ans = 0
    for (h in 0 until (1 shl H)) {
      for (w in 0 until (1 shl W)) {
        var cnt = 0
        for (i in 0 until H) {
          for (j in 0 until W) {
            if ((h shr i and 1) == 0 && (w shr j and 1) == 0) {
              if (g[i][j] == '#') cnt++
            }
          }
        }
        if (cnt == K) ans++
      }
    }
    out.println(ans)
  }













































  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}

Measured memory_bytes: 36408
import sys
N = int(input())
a = [int(input()) for i in range(N)]
d = [0] * N
b = 0
c = 0
while True:
    if b == 1:
        print(c)
        sys.exit()
    c += 1
    b = a[b] - 1
    if d[b] == 1:
        print('-1')
        sys.exit()
    d[b] = 1


Measured memory_bytes: 7888
n = int(input())
lis = ["3","5","7"]
i = 0
while i < 9:
    X = []
    for L in lis:
        if int(L) < 10**(i):
            pass
        else:
            x3 = "".join([L]+["3"])
            X.append(x3)
            x5 = "".join([L]+["5"])
            X.append(x5)
            x7 = "".join([L]+["7"])
            X.append(x7)
    i += 1
    for x in X:
        lis.append(x)
lis2 = []
for A in lis:
    if "3" in A:
        if "5" in A:
            if "7" in A:
                lis2.append(A)
for i in range(len(lis2)):
    lis2[i] = int(lis2[i])
lis2 = sorted(lis2)
ans = 0
for A in lis2:
    if int(A) > n:
        break
    else:
        ans += 1
print(ans)

Measured memory_bytes: 13720
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,k;cin>>n>>k;
  V<ll> cnt(n,0);
  rep(i,0,k){
    ll d;cin>>d;
    rep(j,0,d){
      ll tmp;cin>>tmp;tmp--;
      cnt[tmp]++;
    }
  }

  ll ans=0;
  rep(i,0,n)if(cnt[i]==0)++ans;

  cout<<ans<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 3648
int compare(const void *a,const void *b) {
    return *(int*)b - *(int*)a;
}

int main(void) {
    int n,count = 1;
    scanf("%d",&n);
    int a[n];
    for (int i = 0; i < n; i++) {
        scanf("%d",&a[i]);
    }
    qsort(a, n, sizeof(int), compare);
    for (int i = 0; i < n - 1; i++) {
        if (a[i] != a[i + 1]) {
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}

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

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

    int A, B, K;
    cin >> A >> B >> K;
    int gcd_AB = __gcd(A, B);
    vector<int> divisor;

    for (int i = 1; i <= gcd_AB / 2; i++) {
        if (gcd_AB % i == 0) {
            divisor.push_back(i);
        }
    }
    divisor.push_back(gcd_AB);
    reverse(divisor.begin(), divisor.end());
    cout << divisor.at(K - 1) << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
const int maxx=10010;
const int infinity=1<<30;

int main() {
	int n,a,b,c,e;
	vector<pair<int, int> > A[maxx];
	bool flag[maxx];
	int d[maxx];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		for(int j=0;j<b;j++){
			cin>>c>>e;
			A[a].push_back(make_pair(c,e));
		}
	}
	for(int i=0;i<n;i++){
		flag[i]=false;
		d[i]=infinity;
	}
	priority_queue<pair<int,int> > PQ;
	d[0]=0;
	PQ.push(make_pair(0, 0));
	while(PQ.empty()==0){
		pair<int, int> u=PQ.top();
		PQ.pop();
		//cout<<u.first<<" "<<d[u.first]<<endl;
		flag[u.second]=true;
		int len=A[u.second].size();
		for(int i=0;i<len;i++){
			int v=A[u.second][i].first;
			if(flag[v]==false && d[u.second]+A[u.second][i].second<d[v]){
				d[v]=d[u.second]+A[u.second][i].second;
				PQ.push(make_pair(d[v]*(-1),v));
			}
		}
	}

	for(int i=0;i<n;i++) cout<<i<<" "<<(d[i]==infinity ? -1 : d[i])<<endl;

	return 0;
}


Measured memory_bytes: 7988
#include <bits/stdc++.h>
using namespace std;
#define int long long

int N,M;
int p[100000];
string S[100000];

bool solved[100000];
int wa[100000];

signed main() {
  cin >> N >> M;
  for(int i=0; i<M; i++) cin >> p[i] >> S[i];

  int AC=0;
  int WA=0;

  for(int i=0; i<M; i++) {
    if(S[i] == "AC") {
      if(!solved[p[i]]) {
        solved[p[i]] = true;
        WA+=wa[p[i]];
        AC++;
      }
    }
    else {
      if(!solved[p[i]]) {
        wa[p[i]]++;
      }
    }
  }
  cout << AC << " " << WA << endl;
}


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

int main(){
    string s;
    cin>>s;
    int cnt=0,ans=0;
    int n=s.length();

    for(int i=0; i<n+1; i++){
        if(s[i]=='A' || s[i] =='C' || s[i] == 'G' || s[i] == 'T'){
            cnt++;
        }else{
            if(cnt>ans){
                ans=cnt;
                cnt=0;
            }
        }
    }
    cout<<ans<<endl;
}


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

int main()
{
  int x;

  cin >> x;

  if(x == 7 || x == 5 || x==3){
    cout << "YES";
  }
  else
  {
    cout << "NO";
  }
}


Measured memory_bytes: 3476
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> void mmax(T &m, const T q) { if (m < q) m = q; }
template<typename T> void mmin(T &m, const T q) { if (m > q) m = q; }
template<typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;


int main()
{
    lint N;
    cin >> N;
    vector<lint> h(N + 1);
    REP(i, N){ cin >> h[i + 1]; }

    int ans = 0;
    REP(i, N) ans += max(h[i + 1] - h[i], 0LL);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iomanip>
#include <string>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;
const int INF = 1001001001;
int main(){
 long long int l,r;cin >> l >> r;
  int ans=4000;
  if(r-l>=2018){
    cout << "0";
  }
  else{
    for(long long int i=l;i<r;i++){
      for(long long int j=l+1;j<=r;j++){
        if((i*j%2019)<ans){
          ans=(i*j)%2019;
        }
      }
    }
    cout << ans <<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,k,mx=0,a,g,flag=0;
int Gcd(int a,int b)
{
    if(a<b)swap(a,b);
    return b==0?a:Gcd(b,a%b);
}
int main()
{
    scanf("%d%d",&n,&k);
    scanf("%d",&a);
    g=a;mx=a;
    if(k==a)flag=1;
    for(int i=2;i<=n;i++)
    {
        scanf("%d",&a);
        g=Gcd(g,a);
        mx=max(mx,a);
        if(k==a)flag=1;
    }
    if(flag)
    {
        printf("POSSIBLE\n");
        return 0;
    }
    if(k>mx)
    {
        printf("IMPOSSIBLE\n");
    }else
    {
        if(k%g==0)printf("POSSIBLE\n");
        else printf("IMPOSSIBLE\n");
    }
    return 0;
}


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

signed main()
{
  int X, N;
  cin >> X >> N;
  vector<int> p(N);
  REP(n,N) {
    cin >> p[n];
  }

  int diff = 1000000;
  int ans = 0;
  REP(x,10000) {
    bool flag = true;
    REP(i,N) {
      if (p[i] == x) {
        flag = false;
        break;
      }
    }

    if (flag && diff > abs(X-x)) {
      diff = abs(X-x);
      ans = x;
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
    string s, t, ans = "No";
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<char>());
    if (s < t) ans = "Yes";
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit


def main(readline=stdin.readline):
    leap_year = [not y % 4 and y % 100 or not y % 400 for y in range(3001)]
    separator = ''
    while 1:
        a, b = (int(s) for s in readline().split())
        if not a and not b:
            exit()

        print(separator, end='')

        result = 'NA\n'
        for year, leap in enumerate(leap_year[a:b+1], a):
            if leap:
                print(year)
                result = ''

        print(result, end='')
        separator = '\n'


main()

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

int main() {
    int m, k; cin >> m >> k;
    if (k >= 1<<m) { cout << "-1\n"; return 0; }
    if (m == 0) { cout << "0 0\n"; return 0; }
    if (m == 1 && k == 0) { cout << "0 0 1 1\n"; return 0; }
    if (m == 1 && k == 1) { cout << "-1\n"; return 0; }
    for (int i = 0; i < 1<<m; i++) if (i != k) cout << i << ' ';
    cout << k;
    for (int i = (1<<m)-1; i >= 0; i--) if (i != k) cout << ' ' << i;
    cout << ' ' << k << endl;
}


Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Darshan
 */
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);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a, b;
            a = in.nextInt();
            b = in.nextInt();
            if (a > 8 || b > 8) {
                out.println(":(");
            } else
                out.print("Yay!");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



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

public class Main {

    int[] a;

    void solve() {
	String N = sc.next();
	int idx = -1;
	String ans = "";

	for (int i = 0; i < N.length(); i++) {
	    switch (N.charAt(i)) {
	    case '0':
		ans = ans + "0";
		idx++;
		break;
	    case '1':
		ans = ans + "1";
		idx++;
		break;
	    case 'B':
		if (ans.length() > 0) {
		    ans = ans.substring(0, ans.length()-1);
		}
		break;
	    }
	}
	System.out.println(ans);
    }

    void print(int[] a) {
	out.print(a[0]);
	for (int i = 1; i < a.length; i++) out.print(" " + a[i]);
	out.println();
    }

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

    MyScanner sc = null;
    PrintWriter out = null;
    public void run() throws Exception {
	sc = new MyScanner(System.in);
	out = new PrintWriter(System.out);
	for (;sc.hasNext();) {
	    solve();
	    out.flush();
	}
	out.close();
    }

    class MyScanner {
	String line;
	BufferedReader reader;
	StringTokenizer tokenizer;

	public MyScanner(InputStream stream) {
	    reader = new BufferedReader(new InputStreamReader(stream));
	    tokenizer = null;
	}
	public void eat() {
	    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
		try {
		    line = reader.readLine();
		    if (line == null) {
			tokenizer = null;
			return;
		    }
		    tokenizer = new StringTokenizer(line);
		} catch (IOException e) {
		    throw new RuntimeException(e);
		}
	    }
	}
	public String next() {
	    eat();
	    return tokenizer.nextToken();
	}
	public String nextLine() {
	    try {
		return reader.readLine();
	    } catch (IOException e) {
		throw new RuntimeException(e);
	    }
	}
	public boolean hasNext() {
	    eat();
	    return (tokenizer != null && tokenizer.hasMoreElements());
	}
	public int nextInt() {
	    return Integer.parseInt(next());
	}
	public long nextLong() {
	    return Long.parseLong(next());
	}
	public double nextDouble() {
	    return Double.parseDouble(next());
	}
	public int[] nextIntArray(int n) {
	    int[] a = new int[n];
	    for (int i = 0; i < n; i++) a[i] = nextInt();
	    return a;
	}
    }
}


Measured memory_bytes: 8148
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
    double x1, x2, y1, y2;

    cin >> x1 >> y1 >> x2 >> y2;

    double d = sqrt((x1- x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));

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



Measured memory_bytes: 3212
H, W = map(int, input().split())
grid = [list(input()) for _ in range(H)]

h = []
for x in range(H):
    if all(a == '.' for a in grid[x]):
        h.append(x)
w = []
for y in range(W):
    if all(grid[x][y] == '.' for x in range(H)):
        w.append(y)


for x in range(H):
    if x in h:
        continue
    ans = []
    for y in range(W):
        if y not in w:
            ans.append(grid[x][y])
    print(*ans, sep='')


Measured memory_bytes: 4596
#pragma warning(disable: 4996)
#include <iostream>
#include <unordered_map>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

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

	int N, num;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> num;
		A[num - 1] = i + 1;
	}

	cout << A[0];
	for (int i = 1; i < N; i++) {
		cout << " " << A[i];
	}
	cout << endl;
	return 0;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> d(N);
    for (int i = 0; i < N; i++) cin >> d[i];
    vector<int> number;
    for (int i = 0; i < N; i++) {
        for (int l = 1; l < 9; l++) {
            if (i + l - 1 >= N) continue;
            int now = 0;
            int ten = 1;
            for (int j = i + l - 1; j >= i; j--) {
                now += d[j] * ten;
                ten *= 10;
            }
            number.push_back(now);
        }
    }
    sort(number.begin(), number.end());
    number.erase(unique(number.begin(), number.end()), number.end());
    int now = 0;
    while (true) {
        if (number[now] != now) {
            cout << now << endl;
            return 0;
        }
        now++;
    }
    return 0;
}


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

int main() {
  int N,M=1;
  cin>>N;
  for(int i=0;i<N;i++){
    M*=2;
  }
  vector<int> p(M);
  for(int i=0;i<M;i++){
    cin>>p[i];
  }
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  vector<int> seen(M);
  seen[0]=1;
  vector<int> q;
  q.push_back(p[0]);
  int L=1,Z=1;
  for(int i=0;i<N;i++){
    int A=0,B=0;
    while(A<M&&B<L){
      if(seen[A]==0&&q[B]>p[A]){
        q.push_back(p[A]);
        seen[A]=1;
        B+=1;
      }
      A++;
    }
    if(B==L){
      L*=2;
      sort(q.begin(),q.end());
      reverse(q.begin(),q.end());
    }
    else{
      Z=0;
      break;
    }
  }
  if(Z){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

int mp[105][105];

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

    int a, b;
    cin >> a >> b;
    for( int i = 51; i <= 100; ++i ) {
        for( int j = 1; j <= 100; ++j ) {
            mp[i][j] = 1;

        }
    }

    int black = 1, white = 1;
    int he = 1, wi = 1;
    // 0 : white  1: black
    while( he <= 49 && black != b ) {
        wi = 1;
        while( wi <= 100 && black != b ) {
            mp[he][wi] = 1;
            ++black;
            wi += 2;
        }
        he += 2;
    }

    he = 100; wi = 1;
    while( he >= 51 && white != a ) {
        wi = 1;
        while( wi <= 100 && white != a ) {
            mp[he][wi] = 0;
            ++white;
            wi += 2;

        }
        he -= 2;

    }

    cout << "100 100" << endl;
    for( int i = 1; i <= 100; ++i ) {
        for( int j = 1; j <= 100; ++j ) {
            if( mp[i][j] == 1 ) {
                cout << '#';

            } else {
                cout << '.';

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



Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int i = scanner.nextInt();
		int result = cubic(i);
		System.out.println(result);
		scanner.close();
	}
	public static int cubic(int i){
		return (int)(Math.pow(i, 3));
	}
}

Measured memory_bytes: 26092
#include <iostream>
#include<algorithm>
#include<cmath>
#include<numeric>
#include<vector>
using namespace std;

int main() 
{
	
  long long int n1;
  vector <long long int> v; 
  long long int n=4;
  while(n--)
  {
      cin>>n1;
      v.push_back(n1);
  }
  sort(v.begin(),v.end());
  if(v[0]==1 && v[1]==4 && v[2]==7 && v[3]==9)
  {
      cout<<"YES"<<endl;
  }
  else
  cout<<"NO"<<endl;
  
	return 0;
}


Measured memory_bytes: 256