akhauriyash/Code-Regression huggingface dataset:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(n):
  if b[i]<=a[i]:
    ans+=b[i]
  elif b[i]>a[i] and b[i]<=a[i]+a[i+1]:
    ans+=b[i]
    a[i+1]-=b[i]-a[i]
  elif b[i]>a[i] and b[i]>a[i]+a[i+1]:
    ans+=a[i]+a[i+1]
    a[i+1]=0
print(ans)

Measured memory_bytes: 90076
#include<bits/stdc++.h>
using namespace std;
int main()
{   int a,n;
    cin>>n;
    a=n%10;
    if(a==2 || a==4 || a==5 || a==7 || a==9)
        cout<<"hon\n";
    else if(a==0 || a==1 || a==6 || a==8)
        cout<<"pon\n";
    else if(a==3)
       {
          cout<<"bon\n";
       }
        return 0;
}

Measured memory_bytes: 3584
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

ll MOD = 1e9 + 7;

int main(){
    int N;
    cin >> N;
    int c[N];
    for(int i = 0; i < N; i++) cin >> c[i];

    vector<int> a;
    a.push_back(c[0]);
    for(int i = 1; i < N; i++){
        if(c[i - 1] != c[i]) a.push_back(c[i]);
    }

    int sz = a.size();

    ll col[200001]; //色iがでたときに足すべき値
    fill(col, col + 200001, 0);

    vector<ll> dp(sz, 0);

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

        dp[i] %= MOD;
        col[a[i]] %= MOD;
    }

    cout << dp[sz - 1] << endl;
    return 0;
}


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

typedef pair<int, int> P;
namespace std {
	P operator+(P a, P b) { return P(a.first + b.first, a.second + b.second); }
}

const int DEPTH = 17;

struct SegMax {
	P d[1 << (DEPTH + 1)];	//(max-length, max-sum)
	
	SegMax() {
		int i;
		for (i = 0; i < (1 << (DEPTH + 1)); i++) {
			d[i] = P(0, 0);
		}
	}
	
	void update(int pos, P x) {
		pos += (1 << DEPTH) - 1;
		d[pos] = x;
		while (pos > 0) {
			pos = (pos - 1) / 2;
			d[pos] = max(d[pos * 2 + 1], d[pos * 2 + 2]);
		}
	}
	
	P getMax(int l, int r, int a = 0, int b = (1 << DEPTH), int id = 0) {
		if (a >= r || b <= l) return P(0, 0);
		if (l <= a && b <= r) return d[id];
		P u = getMax(l, r, a, (a + b) / 2, id * 2 + 1);
		P v = getMax(l, r, (a + b) / 2, b, id * 2 + 2);
		return max(u, v);
	}
};

int n;
int a[100000];
SegMax seg;

signed main() {
	int i;
	
	cin >> n;
	rep(i, n) cin >> a[i];
	
	rep(i, n) {
		seg.update(a[i], seg.getMax(0, a[i]) + P(1, a[i]));
	}
	
	P ans = P(0, 0);
	rep(i, n) {
		P res = seg.getMax(a[i], a[i] + 1);
		ans = max(ans, res);
	}
	cout << ans.second << endl;
	return 0;
}


Measured memory_bytes: 7988
a = [0] * 5
a_kuriage = [0] * 5
min_waste = 10
for i in range(5):
    a[i] = int(input())
    if a[i] % 10 != 0:
        a_kuriage[i] = a[i] + 10 - a[i] % 10
        if a[i] % 10 < min_waste:
            min_waste = a[i] % 10
    else:
        a_kuriage[i] = a[i]

print(sum(a_kuriage) - 10 + min_waste)


Measured memory_bytes: 3060
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
const int N=1e5+5;
vector<int>ve[N];
priority_queue<int>q;
int main()
{
	int n,m;
	cin>>n>>m;
	int a,b;
	for(int i=0;i<n;i++)
	{
		cin>>a>>b;
		if(m-a+1<1)
		continue;
		ve[m-a+1].push_back(b);
	}
	int anx=0;
	for(int i=m;i>=1;i--)
	{
		for(int j=0;j<ve[i].size();j++)
		{
			q.push(ve[i][j]);
		}
		if(!q.empty())
		{
			anx+=q.top();
			q.pop();
		}
	}
	cout<<anx<<endl;
}

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

using namespace std;

int main(int argc, char *argv[]) {
    string b;
    cin >> b;

    for (int i = 0; i < b.size(); i++) {
        if (b[i] == 'A') {
            b[i] = 'T';
        }
        else if (b[i] == 'C') {
            b[i] = 'G';
        }
        else if (b[i] == 'G') {
            b[i] = 'C';
        }
        else if (b[i] == 'T') {
            b[i] = 'A';
        }
    }
    cout << b << endl;

    return 0;
}


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

#define vi vector<int>
#define tests int t; cin>>t; while(t--)
#define ll long long
#define vll vector<long long>
#define srt(v) sort(v.begin(), v.end())
#define srtg(v) sort(v.begin(), v.end(), greater<int> ())
#define FOR(k, n) for(int k=0; k<n; k++)
#define pb push_back


using namespace std;
using namespace std::chrono;

char nums[10] = { '0','1','2','3','4','5','6','7','8','9' };
char alphsl[26] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
const int MOD = 1000000007;
char alphs[26] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };


void solve() {

    char c;
    cin>>c;
    
    int a=c-'A';
    if(0<=a&&a<=25){
        cout<<"A"<<endl;
        return;
    }
    cout<<"a"<<endl;
    return;
    
    
}


int main() {

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

        
        solve();


    return 0;
}

Measured memory_bytes: 3632
N = int(input())
a = list(map(int, input().split()))
max = -float('inf')
min = float('inf')
sum = 0
for i in range(N):
    
    if a[i] > max:
        max = a[i]
    if a[i] < min:
        min = a[i]
    sum += a[i]
    
print(min, max, sum) 

Measured memory_bytes: 8684
#include <bits/stdc++.h>
typedef long long ll;
#define INF 1000000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int d;
    cin>>d;
    if(d==25){
        cout<<"Christmas"<<endl;
    }else if(d==24){
        cout<<"Christmas Eve"<<endl;
    }else if(d==23){
        cout<<"Christmas Eve Eve"<<endl;
    }else{
        cout<<"Christmas Eve Eve Eve"<<endl;
    }
 return 0;   
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    char a,b,c;
    a=getchar();
    getchar();
    getchar();
    getchar();
    getchar();
    b=getchar();
    getchar();
    getchar();
    getchar();
    getchar();
    c=getchar();
    printf("%c%c%c",a,b,c);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define fin <<'\n'
typedef long long ll;


inline void solve(){

  ll n;
  cin >> n;
  ll ans = 0;
  for(ll i = 1; i*(1+i) < n; i++){
    if(n%i==0)
      ans += n/i-1;
  }

  cout << ans fin;

}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

	int a = 0, t, count = 0;
	cin >> t;
	for (int i = 1; i < n; ++i) {
		cin >> a;
		if (a == t) {
			++count;
			t = 0;
		} else {
			t = a;
		}
	}
	
	cout << count << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char s[100010];
int main()
{
    scanf("%s",s);
    int ls=strlen(s);
    int ans=ls;
    for(int i=1;i<ls;i++)
    {
        if(s[i]!=s[i-1])
            ans=min(ans,max(i,ls-i));
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
import sys

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

l = [a,b,c,d,e]

for i in range(4):
	for j in range(i+1,5):
		if l[j] - l[i] > k:
			print(':(')
			sys.exit()
print('Yay!')


Measured memory_bytes: 3060
n = int(input())
count = [0]*5
for i in range(n):
    s = input()
    if s[0] == "M":
        count[0] += 1
    if s[0] == "A":
        count[1] += 1
    if s[0] == "R":
        count[2] += 1
    if s[0] == "C":
        count[3] += 1
    if s[0] == "H":
        count[4] += 1

ans = 0
for i in range(5):
    for j in range(i+1,5):
        for k in range(j+1,5):
            ans += count[i]*count[j]*count[k]

print(ans)

Measured memory_bytes: 45288
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long d = sc.nextLong();
		long d2 = d * d;
		long count = 0;
		for(int i = 1 ; i <= n ; i++) {
			long x = sc.nextLong();
			long y = sc.nextLong();
			if(x * x + y * y <= d2) {
				count++;
			}
		}

		sc.close();
		System.out.println(count);

	}
}



Measured memory_bytes: 59184
#include <stdio.h>

int main(void){
    int n, k, cnt = 0;
    int h[100001];

    scanf("%d%d", &n, &k);
    for(int i = 1; i <= n; ++i){
        scanf("%d", h + i);
        if(h[i] >= k){
            cnt++;
        }
    }
    printf("%d\n", cnt);
    
    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>

#define for0(i, n)    for (int i = 0  ; i <  (n); ++i)
#define for1n(i, n)   for (int i = 1  ; i <= (n); ++i)
#define for1(i, n)    for (int i = 1  ; i <  (n); ++i)
#define forn(i, n)    for (int i = 0  ; i <= (n); ++i)
#define forx(i, n, x) for (int i = (x); i <  (n); ++i)

using namespace std;

typedef long long ll;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll> ,greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;

ll H[100000];

bool b[100000];

int main(void){
    int N;
    
    cin >> N;

    for0(i, N){
        cin >> H[i];
    }

    for0(i, N - 1){
        b[i] = H[i] >= H[i + 1];
    }
    ll k = 0, l = -1;
    
    for0(i, N - 1){
        if (b[i]) {
            ++k;
        } else {
            l = max(k, l);
            k = 0;
        }
    }
    
    cout << max(k, l);

    return 0;
}


Measured memory_bytes: 1152
N = gets.chomp.to_i
P = gets.chomp.split(" ").join
Q = gets.chomp.split(" ").join

list = (1..N).to_a.permutation(N).map do |a|
  a.join
end

list.sort! do |a, b|
  a <=> b
end

puts (list.index(P) - list.index(Q)).abs

Measured memory_bytes: 12120
/*
Wai u read my code xD
*/
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vi vector <ll> 
#define qu queue <ll>
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;


void solve()
{
    string s; cin >> s;
    int arr[26] = {0};
    for (int i = 0; i < s.size(); i++) arr[s[i]-'A']++;
    if ((arr[18]>0&&arr[13]>0||arr[18]==0&&arr[13]==0)&&(arr[4]>0&&arr[22]>0||arr[4]==0&&arr[22]==0)) nout("Yes");
    else nout("No");
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    ll n,a;
    cin >> n >> a;
    ll dp[51][2510]={};
    dp[0][0]=1;
    ll ans=0;
    rep(i,n){
        ll x;
        cin >> x;
       	for(int j=49;j>=0;j--){
            rep(k,2451){
                dp[j+1][k+x]+=dp[j][k];
                if((j+1)*a==k+x)ans+=dp[j][k];
            }
        }
      	debug(ans);
    }
    cout << ans;

    
}

Measured memory_bytes: 1280
S = list(input())

c = 0
check = 0

for i in range(2, len(S)-1):
  if S[i] == 'C':
    c += 1

for i in range(len(S)):
  if not S[i].islower():
    check += 1

if S[0] != 'A':
  print('WA')
elif c == 1 and check == 2:
  print('AC')
else:
  print('WA')

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

const bool DEBUG = false;

int main(int argc, char const *argv[]) {
  int N;
  cin >> N;
  if (N > 81) {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 1; i <= 9; i++) {
    if ((N % i == 0) && (N / i <= 9)) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl
#define dv(name, value) cerr << (name) << " is " << (value) << endl
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C, long long D){
  double AP = ceil((double)A / D);
  double TP = ceil((double)C / B);
  cout << (TP <= AP ? YES : NO) << endl;
}

signed main(){
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  long long C;
  scanf("%lld",&C);
  long long D;
  scanf("%lld",&D);
  solve(A, B, C, D);
}


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

    class Program
    {
        static void Main(string[] args)
        {
            string[] strInputArray;
            List<int> inputList = new List<int>();
            string output = "";
            do
            {
                strInputArray = Console.ReadLine().Split(' ');
                if (!strInputArray[0].Equals("0") && !strInputArray[1].Equals("0"))
                {
                    inputList.Add(int.Parse(strInputArray[0]));
                    inputList.Add(int.Parse(strInputArray[1]));
                }
            } while (!strInputArray[0].Equals("0") && !strInputArray[1].Equals("0"));

            for (int i = 1; i <= (inputList.Count / 2); i++)
            {
                output = "";

                for (int n = 1; n <= inputList[(i * 2) - 1]; n++)
                {
                    output = output + '#';
                }
                for (int m = 1; m <= inputList[(i * 2) - 2]; m++)
                {
                    Console.WriteLine(output);
                }
                Console.WriteLine();
            }

            Console.ReadLine();
        }
    }


Measured memory_bytes: 15964
#include<string>
using namespace std;
#include <stdio.h>
#include <limits.h>
#include "bits/stdc++.h"
int a, b, ans1;
int main()
{
	cin >> a >> b;
	ans1 = a;
	if (a>b) {
		ans1 -= 1;
	}
	cout << ans1;
	return 0;

}


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

int main() {
    
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    
    double theta;
    theta = abs((30*h) + (0.5*m) - (m*6));
    theta = min(theta,360-theta);
    theta *= (M_PI);
    theta /= 180.00000000000000000000;
    
    cout << fixed;
    cout << setprecision(20);
    double result = (double)sqrt(a*a + b*b - 2*a*b*cos(theta));
    cout<<result<<endl;
	return 0;
}

//4.56425719433005567605

Measured memory_bytes: 4228
//#include<bits/stdc++.h>
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>

using namespace std;

const int N = 1e5 + 5;
vector<int> graph[N];
int dp[N];
int a[N];
int h[N];
int g[N];
int p;
bool mark[N];
int n, k; 
int ans;

void dfs(int v, int par)
{
	mark[v] = true;
	dp[v] = 1;
	for (int i = 0; i < graph[v].size(); i++)
	{
		int u = graph[v][i];
		if (!mark[u])
		{
			dfs(u, v);
			dp[v] = max(dp[v], dp[u] + 1);
		}
	}
	if (dp[v] == k && par != 0)
	{
		ans++;
		dp[v] = 0;
	}
}

int main() 
{
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		int v;
		cin >> v;
		a[i] = v;
		v--;
		graph[v].push_back(i);
	}
	if (a[0] != 1)
	{
		ans++;
		a[0] = 1;
	}
	dfs(0, 0);
	cout << ans << endl;




}



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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define ALL(V) (V).begin(),(V).end()
#define endl "\n"

using namespace std;
typedef long long ll;

const double PI = 3.1415926535897932384626;
const ll MODN = 1000000007;
const ll MODN2 = 998244353;
const double EPS = 1e-10;

int main(){

    string s;
    cin >> s;

    int n = s.size() + 1;

    vector<ll> v(n);

    rep(i, n - 1){
        if(s[i] == '<'){
            v[i + 1] = max(v[i + 1], v[i] + 1);
        }
    }

    rep(i, n - 1){
        if(s[n - 2 - i] == '>'){
            v[n - 2 - i] = max(v[n - 2 - i], v[n - 1 - i] + 1);
        }
    }

    ll ans = 0;

    rep(i, n){
        ans += v[i];
    }

    cout << ans << endl;


    return 0;
}
/*
Sを左からなめていき<のみチェックして
右から舐めて>をチェックする
大きいほうの値をとるようにする
*/

Measured memory_bytes: 7636
while True:
    X,Y=map(int,raw_input().split())
    if X==Y==0:break
    C=[[0]+map(int,raw_input().split())+[0] for i in range(Y)]
    C.append([0]*(X+2))
    dp=[[0]*(X+2) for i in range(Y+1)]
    for i in range(1,X+1):
        if C[0][i]!=1:
            dp[0][i]=1
    for i in range(Y-1):
        for j in range(1,X+1):
            if C[i][j]==0:
                if C[i+1][j]!=1:
                    dp[i+1][j]+=dp[i][j]
                if C[i+1][j+1]!=1 and C[i+1][j+1]!=2:
                    dp[i+1][j+1]+=dp[i][j]
                if C[i+1][j-1]!=1 and C[i+1][j-1]!=2:
                    dp[i+1][j-1]+=dp[i][j]
            if C[i][j]==2 and C[i+2][j]!=1:
                dp[i+2][j]+=dp[i][j]
    print sum(dp[-1][1:-1])+sum(dp[-2][1:-1])

Measured memory_bytes: 4276
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//typedef tree < int , null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> TREE;
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pss pair<short,short>
#define pld pair<long double,long double >
#define ld long double
#define piii  pair<pii,int>
#define vii vector<pair<int,int> >
#define st first
#define nd second
#define pll pair<ll,ll>
#define speed ios::sync_with_stdio(false);cin.tie();cout.tie();
#define M_PI 3.14159265358979323846
//#define int long long
const int mod=1000000007;
//const int mod=1009;
//const int mod=998244353;
const int inf=1000000009;
const long long INF=1000000000000000009;
const long long big=1000000000000000;
const long double eps=0.000000000000000000001;
using namespace std;
int main()
{
    speed
    ll n;
    cin>>n;
    ll wynik=0,d=1;
    while(n!=0)
    {
        wynik+=d;
        n/=2;
        d*=2;
    }
    cout<<wynik;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define int long long
signed main(){
    int n,k;
    cin>>n>>k;
    cout<<(int)(k*pow(k-1,n-1))<<endl;
    return 0;
}




Measured memory_bytes: 256
s = input()[::-1]
i = 0
while i<len(s):
    if s[i:i+5] in ['maerd', 'esare']:
        i += 5
    elif s[i:i+6] == 'resare':
        i += 6
    elif s[i:i+7] == 'remaerd':
        i += 7
    else:
        print('NO')
        break
else:
    print('YES')

Measured memory_bytes: 3188
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class B
{
	public static void Main()
	{
		int N = GetInt();
		int A = GetInt();
		int B = GetInt();
		string S = GetString();
		
		var sb = new StringBuilder();
		int numA = 0;
		int numB = 0;
		for(int i = 0; i < N; i++)
		{
			switch(S[i])
			{
				case 'a':
					if(numA + numB < A + B)
					{
						sb.Append("Yes\n");						
						numA++;
					}
					else
						sb.Append("No\n");
					break;

				case 'b':
					if((numA + numB < A + B) && (numB < B))
					{						
						sb.Append("Yes\n");
						numB++;
					}
					else
						sb.Append("No\n");
					break;

				case 'c':
					sb.Append("No\n");
					break;
			}
		}
		Console.Write(sb);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


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

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<lli, lli> pi;

lli dp[100020][15], mod = 1000000007;

int main()
{
    string s;
    cin >> s;
    dp[0][0] = 1;
    for(int i=0; i<s.size(); i++){
        if(s[i] == '?'){
            for(int j=0; j<10; j++){
                for(int k=0; k<13; k++){
                    int ind = (k*10+j) % 13;
                    dp[i+1][ind] = (dp[i][k]+dp[i+1][ind]) % mod;
                }
            }
        }
        else{
            for(int j=0; j<13; j++){
                int x = s[i]-'0';
                int ind = (j*10+x)%13;
                dp[i+1][ind] = (dp[i][j]+dp[i+1][ind]) % mod;
            }
        }
    }

    lli ans = dp[s.size()][5];

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 12160
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdio>

using namespace std;

struct Node {
    int key;
    Node *left = nullptr, *right = nullptr;

    Node(int _key) {
        key = _key;
    }
};

Node *root = nullptr;

void Insert(int key) {
    Node *node = new Node(key);

    Node *y = nullptr;
    Node *x = root;

    while (x != nullptr) {
        y = x;
        if (key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    if (y == nullptr) {
        root = node;
    } else if (key < y->key) {
        y->left = node;
    } else {
        y->right = node;
    }
}

void InOrder(Node *node) {
    if (node == nullptr) {
        return;
    }

    InOrder(node->left);
    cout << " " << node->key;
    InOrder(node->right);
}

void PreOrder(Node *node) {
    if (node == nullptr) {
        return;
    }

    cout << " " << node->key;
    PreOrder(node->left);
    PreOrder(node->right);
}

bool Find(Node *node, int key) {
    while (node != nullptr && node->key != key) {
        if (key < node->key) {
            node = node->left;
        } else {
            node = node->right;
        }
    }

    return node != nullptr;
}

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

    for (int i = 0; i < n; ++i) {
        string ops;
        int key;
        cin >> ops;

        if (ops == "insert") {
            cin >> key;
            Insert(key);
        } else if (ops == "find") {
            cin >> key;
            if (Find(root, key)) {
                cout << "yes";
            } else {
                cout << "no";
            }
            cout << endl;
        } else {
            InOrder(root);
            cout << endl;
            PreOrder(root);
            cout << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 15580
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String inputS = scanner.next();

		if(hasSameChar(inputS)) {
			System.out.println("no");
		}else {
			System.out.println("yes");
		}


		scanner.close();

	}

	public static boolean hasSameChar(String inputS) {
		List<String> dataset=new ArrayList<String>();

		for(int i=0;i<inputS.length();i++) {

			String buf=inputS.substring(i, i+1);

			if(dataset.contains(buf)) {
				return true;
			}

			dataset.add(buf);

		}

		return false;

	}



}


Measured memory_bytes: 23764
#問題 D
import numpy as np
N, W = map(int,input().split())
#普通に書くとTLEだったのでNumpy化
dp = np.zeros(W+1,dtype=int)
for i in range(N):
    w,v = map(int,input().split())
    dp[w:] = np.maximum(dp[w:],dp[:-w]+v)
print(int(dp[-1]))


#dpをN*(W+1)配列とかにしてもnumpyなら間に合う。コピーに時間がかかるのかな？

# numpy化してもやっぱりTLEなので、どうもコピーが悪かったらしい
# N, W = map(int,input().split())
# VAL = np.zeros(W+1)
# val = np.zeros(W+1)
# for n in range(N):
#     w,v = map(int,input().split())
#     for weight in range(w,W+1):
#         val[weight] = max(VAL[weight],VAL[weight-w]+v)
#     VAL = np.copy(val)
# print(int(VAL[W]))

# VAL = [0]*(W+1)
# val = [0]*(W+1)
# for n in range(N):
#     w,v = map(int,input().split())
#     for weight in range(w,W+1):
#         val[weight] = max(VAL[weight],VAL[weight-w]+v)
#     VAL = val[:]
#print(VAL[W])
    # listをコピーするときは注意　https://qiita.com/utgwkk/items/5ad2527f19150ae33322
    # listへのアクセスは重いらしい。 https://qiita.com/pegasusBS15/items/620985fdc21c75ad8026

Measured memory_bytes: 15472
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n = input_int()
    d = {}
    # n以下のaで始まり、bで終わる整数のそれぞれ求める
    # 計算量: O(log_n)
    for a in range(1, 10):
        for b in range(1, 10):
            cnt = 0
            # 1桁の整数が条件を満たすケース
            if a == b and a <= n:
                cnt += 1
            # 2桁以上の整数で条件を満たすケース
            i = 1
            while True:
                _min = a * (10**i) + b  # 整数が a0000b

                _max = a * (10**i) + b
                _i = i - 1
                while _i > 0:
                    _max += 9 * (10**_i)  # 整数が a999b
                    _i -= 1
                if _max <= n:
                    cnt += 10**(i - 1)
                    i += 1
                    continue
                elif _min > n:
                    break
                else:  # a0..0b <= n < a9..9b
                    cnt += ((n - _min) // 10) + 1
                    break
            d[10 * a + b] = cnt
    ans = 0
    for a in range(1, 10):
        for b in range(1, 10):
            ans += d[a * 10 + b] * d[b * 10 + a]
    print(ans)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 62624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
/* END OF TEMPLATE */

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

Measured memory_bytes: 256
def linearSearch(A, key):
    i = 0
    A.append(key)
    while A[i] != key:
        i += 1
    if i == len(A)-1:
        A.pop()
        return 'Not_found'
    A.pop()
    return i

if __name__ == '__main__':
    c = 0
    n = int(input())
    hoge1 = [int(x) for x in input().split()]
    q = int(input())
    for key in (int(x) for x in input().split()):
        if linearSearch(hoge1, key) == 'Not_found':
            continue
        else:
            c += 1
    print (c)


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n;
  cin >> n;
  set<string> se;
  rep(i, n) {
    string s;
    cin >> s;
    se.insert(s);
  }
  cout << sz(se) << endl;
}

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

string s;
int ans[100010];

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

    for(int i=0; i<s.size(); ) {
        int j = i;
        while(s[j] == s[i]) j++;

        if(s[i] == 'R') {
            ans[j-1] += (j-i) - (j-i)/2;
            ans[j] += (j-i)/2;
        }
        else {
            ans[i] += (j-i) - (j-i)/2;
            ans[i-1] += (j-i)/2;
        }
        i = j;
    }

    for(int i=0; i<s.size(); i++) {
        cout << ans[i] << " ";
    }
}


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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer a = nil->next;
  while(1)
  {
   if(a == nil || a->key == key) break;
   a = a->next;
  }
 return a;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  NodePointer prevt = t->prev;
  NodePointer nextt = t->next;
  prevt-> next = nextt;
  nextt-> prev = prevt;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
 NodePointer t = nil->prev;;
 if(t == nil)  return;
 deleteNode(t); 
}

void delete(int key){
 NodePointer t = listSearch(key);
 if(t == nil) return;
 deleteNode(t); 
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  x->next = nil->next;
  x->next->prev = x;
  x->prev = nil;
  nil->next = x;

}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}


Measured memory_bytes: 32980
s = input()
n = len(s)
def palindrome(s):
    ret = True
    for i in range(len(s)//2):
        if s[i] != s[-i-1]:
            ret = False
            break
    return ret

check_1 = palindrome(s)
check_2 = palindrome(s[:(n)//2])
check_3 = palindrome(s[(n+2)//2:])

if check_1 and check_2 and check_3:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 78920
#include <iostream>
using namespace std;
#define MAX 1001

bool book[MAX];

int main() {
    for (int i = 0; i < MAX; i++) {
        book[i] = false;
    }
    int a, b;
    cin >> a >> b;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int s, f;
        cin >> s >> f;
        for (int j = s; j < f; j++) {
            book[j] = true;
        }
    }

    for (int i = a; i < b; i++) {
        if (book[i]) {
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3072
shared void main(){
  assert(exists sve=process.readLine());
  value tve=sve.split();
  assert(exists e=parseInteger(tve.last));
  for(_ in 0:e){
    process.readLine();
  }
  assert(exists stmax=process.readLine());
  assert(exists tmax=parseInteger(stmax));
  for(_ in 0:tmax){
    print(-1);
  }
}

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

int main() {
    ll N;
    cin >> N;
    ll ans = N * (N - 1) / 2;
    cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
    int N;
    cin >> N;
    vector<int> D(N),D1(N);
    int check=0;
    for(int i=0; i<N; i++){
        cin >> D.at(i) >> D1.at(i);
    }
    for(int i=0; i<N; i++){
        if(D.at(i)==D1.at(i)) check++;
        if(D.at(i)!=D1.at(i)) check=0;
        if(check==3) break;
    }
    if(check==3) cout << "Yes" << endl;
    else cout << "No"<< endl;
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int main(){
    int H,W;
    while(1){
        cin >> H >> W;
        if(H==0 && W==0)break;
        
        for(int i=0;i<H;i++){
            if(i==0 || i==H-1){
                for(int j=0;j<W-1;j++){
                    cout << "#";
                }cout << "#" << endl;
            }else{
                cout << "#";
                for(int j=0;j<W-2;j++){
                    cout << ".";
                }cout << "#" << endl;
            }
        }cout << endl;
    }return 0;
}


Measured memory_bytes: 3016
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

int X[100001];

struct Square{
  P d[300001];
  int n,m;
  
  void init(int _n){
    m = (int)sqrt(_n);
    n = m*m; while( _n > n ) n+= m;
    for(int i=0;i<_n;i++)
      d[i] = P(X[i],i);
    for(int i=_n;i<n;i++)
      d[i] = P(0,i);
    for(int i=0;i<n;i+=m)
      sort(d+i,d+i+m);
  }

  int all_queryU(int a,int b,int x){
    int st = a, ed = b-1, r = b;
    while( st <= ed ){
      int h = (st + ed )/2;
      if( d[h].first > x ){
	r = min( h, r );
	ed = h - 1;
      } else {
	st = h + 1;
      }
    }
    return b - r;
  }

  int part_queryU( int a,int b,int l,int r,int  x){
    int ret = 0;
    for(int i=a;i<b;i++)
      if( l <= d[i].second && d[i].second <= r &&
	  d[i].first > x ) ret ++;
    return ret;    
  }

  int queryU(int l,int r,int x){
    int ret = 0;
    for(int i=0;i<n;i+=m){
      if( l <= i && i + m - 1 <= r )
	ret += all_queryU(i,i+m,x);
      else if( ( i <= l && l <= i + m - 1 )
	       || ( i <= r && r <= i + m - 1 ) )
	ret += part_queryU(i,i+m,l,r,x);
    }
    return ret;
  }


  int all_queryD(int a,int b,int x){
    int st = a, ed = b-1, r = a-1;
    while( st <= ed ){
      int h = (st + ed )/2;
      if( d[h].first < x ){
	r = max( h, r );
	st = h + 1;
      } else {
	ed = h - 1;
      }
    }
    return r - a + 1;
  }

  int part_queryD( int a,int b,int l,int r,int  x){
    int ret = 0;
    for(int i=a;i<b;i++)
      if( l <= d[i].second && d[i].second <= r &&
	  d[i].first < x ) ret ++;
    return ret;    
  }

  int queryD(int l,int r,int x){
    int ret = 0;
    for(int i=0;i<n;i+=m){
      if( l <= i && i + m - 1 <= r )
	ret += all_queryD(i,i+m,x);
      else if( ( i <= l && l <= i + m - 1 )
	       || ( i <= r && r <= i + m - 1 ) )
	ret += part_queryD(i,i+m,l,r,x);
    }
    return ret;
  }

};

int D,Q;
Square s;
int main(){
  cin >> D;
  for(int i=0;i<D;i++) cin >> X[i];
  s.init(D);
  cin >> Q;
  for(int i=0;i<Q;i++){
    int l,r,e;
    cin >> l >> r >> e;
    l--; r--;
    int a = min( X[l],X[r] ), b = max( X[l],X[r] );
    int res = s.queryU(l,r,b+e) + s.queryD(l,r,a-e);
    cout << res << endl;
  }
}

Measured memory_bytes: 3896
<?php
//error_reporting(0);
list($N,$K) =  explode(" ",trim(fgets(STDIN)));
$S = trim(fgets(STDIN));
//$H=explode(" ",trim(fgets(STDIN)));
$len = strlen($S);
$now = 1;
$cnt = 0;
$Nums = array();
for($i=0;$i<$N;$i++) {
  if ($S[$i]==$now?"1":"0") {
    $cnt++;
  }
  else {
    $Nums[]=$cnt;
    $now = 1 - $now;;
    $cnt=1;
  }
}
if ($cnt != 0) {
  $Nums[]=$cnt;
}
if ((count($Nums)%2)==0){
  $Nums[]=0;
}
$Add = 2 * $K + 1;
$ans = 0;
$left  = 0;
$right = 0;
$tmp = 0;
for($i=0;$i<count($Nums);$i+=2)
{
  $Nextleft = $i;
  $Nextright = min($i + $Add,count($Nums));
  while($Nextleft > $left) {
    $tmp -= $Nums[$left];
    $left++;
  }
  while($Nextright > $right) {
    $tmp += $Nums[$right];
    $right++;
  }
  $ans = max($tmp,$ans);
}
printf("%d\n",$ans);


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

int main()
{
  while (true)
  {
    int x, y;
    cin >> x >> y;
    if (x == 0 && y == 0)
      break;
    else
    {
      if (x > y)
        swap(x, y);
      cout << x << " " << y << endl;
    }
  }
}


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

int main() {
	int n,x;
    cin >> n >> x;
    int l[n];
    int sum = 0;
    for(int i=0;i<n;i++){
        cin >> l[i];
        sum = sum + l[i];
        if(sum > x){
             cout << i+1 << endl;
             break;
          }
       else if(i==n-1){
             cout << n+1 << endl;
          }
    }
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 666666
int n,p[SZ],t[SZ],rv[SZ];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%d",p+i),rv[p[i]]=i;
	int ans=0;
	for(int i=1;i<=n;++i)
	{
		if(rv[p[i]-1]<=i&&p[i]-1)
			t[i]=t[rv[p[i]-1]]+1;
		else t[i]=1; ans=max(ans,t[i]);
	}
	printf("%d\n",n-ans);
}

Measured memory_bytes: 5120
n=int(input())
l=[[] for i in range(n)]
for i  in range(n):
    l[i]=list(map(int,input().split()))
xy=[[] for i in range(101**2)]
k=0
for x in range(101):
    for y in range(101):
        xy[k]=[x,y]
        k+=1
for i in l:
    for j in l:
        tmp=[]
        if i==j:
            continue
        for z in xy:
            if abs(i[0]-z[0])-abs(j[0]-z[0])+abs(i[1]-z[1])-abs(j[1]-z[1])==j[2]-i[2] and i[2]!=0 and j[2]!=0:
                tmp.append(z)
            elif abs(i[0]-z[0])-abs(j[0]-z[0])+abs(i[1]-z[1])-abs(j[1]-z[1])>=j[2]-i[2] and i[2]==0:
                tmp.append(z)
            elif abs(i[0]-z[0])-abs(j[0]-z[0])+abs(i[1]-z[1])-abs(j[1]-z[1])<=j[2]-i[2] and j[2]==0:
                tmp.append(z)
        xy=tmp[:]
        if len(xy)==1:
            break
    if len(xy)==1:
            break
for i in l:
    if i[2]!=0:
        H=i[2]+abs(i[0]-xy[0][0])+abs(i[1]-xy[0][1])
print(xy[0][0],xy[0][1],H)

Measured memory_bytes: 4244
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
	    int a = scan.nextInt();
	    int b = scan.nextInt();

	    
	    if (a < b) {
	    	System.out.println( "a < b" );
		} 
	    else if(a > b){
	    	System.out.println( "a > b" );
		}
	    else /*if(a == b)*/{
	    	System.out.println( "a == b" );
		}
	}

}

Measured memory_bytes: 25972
using System;

class ITP1_7_A
{
  static void Main()
  {
    while (true)
    {
      string[] inputs = Console.ReadLine().Split(' ');
      int m = int.Parse(inputs[0]);
      int f = int.Parse(inputs[1]);
      int r = int.Parse(inputs[2]);

      if (m == -1 && f == -1 && r == -1) break;
      if (m == -1 || f == -1)
      {
        Console.WriteLine("F");
        continue;
      }

      int sum = m + f;
      if (sum >= 80) Console.WriteLine("A");
      else if (sum >= 65 && sum < 80) Console.WriteLine("B");
      else if (sum >= 50 && sum < 65) Console.WriteLine("C");
      else if (sum >= 30 && sum < 50)
      {
        if (r >= 50) Console.WriteLine("C");
        else Console.WriteLine("D");
      }
      else Console.WriteLine("F");
    }
  }
}



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

int main()
{
    long int n;
    int i,sum=0,temp;
    string s;
    cin >> n;
    cin >> s;
    temp=s[0];
    for(i=0; i<=n-1; i++)
    {   if(s[i+1]==s[i])
            continue;
        else
        {
            temp=s[i+1];
            sum++;
        }


    }
    cout <<sum;

    return 0;
}

Measured memory_bytes: 512
gets
buf=""
cnt=0
gets.chomp.chars{|x|
  if(x=="(") then
    cnt+=1
    buf	<< "("
  else
    if cnt == 0
      buf = "(" << buf << ")"
    else
      cnt-=1
      buf << ")"
    end
  end
#  p [buf,"#{cnt}"]
}

puts buf << ")"*cnt

Measured memory_bytes: 1788
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Set<Character> set = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            set.add(s.charAt(i));
        }
        StringBuilder sb = new StringBuilder(s);
        if (s.length() < 26) {
            for (int i = 0; i < 26; i++) {
                char c = (char) (i + 'a');
                if (set.contains(c)) {
                    continue;
                }
                sb.append(c);
                System.out.println(sb);
                return;
            }
        }

        for (int i = 0; i < 26; i++) {
            char c = sb.charAt(sb.length() - 1);
            set.remove(c);
            sb.delete(sb.length() - 1, sb.length());
            for (int j = c - 'a' + 1; j < 26; j++) {
                char ch = (char) (j + 'a');
                if (set.contains(ch)) {
                    continue;
                }
                sb.append(ch);
                System.out.println(sb);
                return;
            }
        }
        System.out.println(-1);
    }

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
//#define inf 0x3f3f3f3f3f3f3f3f
#define inf 0x3f3f3f3f
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define inv(x) Power(x, mod - 2)
#define fi first
#define se second
#define MP make_pair
#define PB push_back

using namespace std;
typedef pair<int,int> Pair;
typedef long double ld;
typedef long long ll;

const int mod = 998244353, MAX = 1e5, N = 50005;
//template{{{
const long double Pi = 3.14159265358979323846l;
inline int add(int x, int y) { x += y; return x >= mod ? x - mod : x; };
inline void inc(int &x, int y) { x += y; x -= (x >= mod ? mod : 0); }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline int Power(int x, int y) {
	int ans = 1;
	while (y) {
		if (y & 1) ans = mul(ans, x);
		x = mul(x, x), y >>= 1;
	} return ans;
}

/*char buf[1<<23],obuf[1<<23],*p1=buf,*p2=buf, *O = obuf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
void print(int x) {
    if(x > 9) print(x / 10);
    *O++=x%10+'0';
} */

template <class T> inline T	input() {
	T x; char ch; bool flag = false;
	while (!isdigit(ch = getchar())) flag |= ch == '-';
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return flag ? -x : x;
}

template <class T> inline bool chkmin(T &x, T y) { x = x < y ? x : y; return x == y; }
template <class T> inline bool chkmax(T &x, T y) { x = x > y ? x : y; return x == y; }
template <class T> inline T gcd(T x, T y) { return !y ? x : gcd(y, x % y); }
template <class T> inline T sqrm(T x) { return (ll) x * x % mod; }
template <class T> inline T sqr(T x) { return x * x; }

struct {
	inline operator int () { return input<int>(); }
	inline operator long long () { return input<long long>(); }
	template <class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read; //}}}

int n;

int main() {
#ifdef local
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	freopen("log", "w", stderr);
#endif

	ll ans = 0;
	cin >> n;
	for (int a = 1; a <= n; ++a)
		for (int b = 1; b <= n; ++b)
			for (int c = 1; c <= n; ++c)
				ans += gcd(a, gcd(b, c));
	printf("%lld\n", ans);
	return 0;
}


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

sunuke = [0] * N
for i in range(K):
    _ = input()
    kasi_moti = map(int, input().split())
    for j in kasi_moti:
        sunuke[j - 1] = 1

count = 0
for k in sunuke:
    if k == 0:
        count += 1
print(count)

Measured memory_bytes: 9184