akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int n1,t;
int main()
{
	string c;
	int len,f=1;
	cin>>c;
 	len=c.length();
 	for(int i=0;i<len;i++)
  	{
  		if(c[i]!='A' && c[i]!='C')
			if(isupper(c[i]))
				f=0;
	}
	int count=0;
	for(int i=2;i<len-1;i++)
   		if(c[i]=='C')  
		   	count++;
	if(count!=1)
		f=0;
	if(c[0]!='A')
		f=0;
	if(f==1)
		cout<<"AC"<<endl;
	else
		cout<<"WA"<<endl;
  	return 0;
}


Measured memory_bytes: 256
import numpy as np
n = int(input())
temp0, avg = list(map(int, input().split(' ')))
height = list(map(int, input().split(' ')))

diff = [0]*n
for i in range(n):
  temp = temp0 - 0.006*height[i]
  diff[i] = abs(avg - temp)
print(np.argmin(diff)+1)
 



Measured memory_bytes: 27176
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>
#include<set>


#define MOD 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

typedef long long ll;

using namespace std;

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

int main(){
    int N;
    cin>>N;
    vector<int> A(N);
    rep(i,0,N)cin>>A[i];
    int s[2][2]={{-1,-1},{-1,-1}};
    

    rep(i,0,N){
        if(s[0][0]!=A[i] && s[0][1]==-1){
            s[0][0]=A[i];
            s[0][1]=1;
        }
        else if(s[0][0]==A[i]){
            s[0][1]++;
        }
        else if(s[1][0]!=A[i] && s[1][1]==-1){
            s[1][0]=A[i];
            s[1][1]=1;
        }
        else if(s[1][0]==A[i]){
            s[1][1]++;
        }
        else{
            cout<<"No"<<endl;
            return 0;
        }

    }
    bool ok=false;
    if(abs(s[0][0]-s[1][0])!=1 && s[1][0]!=-1){
        cout<<"No"<<endl;
        return 0;
    }

    if((s[0][0]-s[1][0])<0 && s[1][0]!=-1){
        swap(s[0][0],s[1][0]);
        swap(s[0][1],s[1][1]);
    }


    if(s[1][0]==-1){
        if(s[0][0]*2<=N || s[0][0]==N-1 || s[0][0]==1){
            cout<<"Yes"<<endl;
            return 0;
        }
        else{
            cout<<"No"<<endl;
            return 0;
        }
    }

    else{
        if((N-s[1][1])>=(s[0][0]-s[1][1])*2 && (s[0][0]-s[1][1])>0){
            cout<<"Yes"<<endl;
            return 0;
        }
        else{
            cout<<"No"<<endl;
            return 0;
        }
    }
    
    return 0;
}

Measured memory_bytes: 640
#N  個のリンゴがあります。
#これらはそれぞれリンゴ 1、リンゴ 2、リンゴ 3、...、リンゴ N と呼ばれており、リンゴ i の「味」は L+i−1 です。
#「味」は負になることもありえます。
#また、1 個以上のリンゴを材料として、アップルパイをつくることができます。
#その「味」は、材料となったリンゴの「味」の総和となります。
#あなたはこれらのリンゴを全て材料として、アップルパイをつくる予定でしたが、おなかがすいたので 1 個だけ食べることにしました。
#勿論、食べてしまったリンゴはアップルパイの材料にはできません。
#つくる予定だったアップルパイとできるだけ同じものをつくりたいので、N 個のリンゴ全てを材料としてできるアップルパイの「味」と、食べていない N−1 個のリンゴを材料としてできるアップルパイの「味」の差の絶対値ができるだけ小さくなるように、食べるリンゴを選ぶことにしました。
#このようにして選ばれたリンゴを食べた時、食べていない N−1 個のリンゴを材料としてできるアップルパイの「味」を求めてください。
#なお、この値は一意に定まることが証明できます。

N, L = map(int, input().split())
A = [L+x for x in range(N)]

min_abs = abs(A[0])
ate = A[0]

for i in range(len(A)):
    if min_abs > abs(A[i]):
        min_abs = abs(A[i])
        ate = A[i]
        
print(sum(A)-ate)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
int main()
{   int n,ac=0,tle=0,wa=0,re=0,i;
    cin>>n;
    while(n--)
    {
    char s[500];
    scanf("%s",s);
    for(i=0;s[i]!='\0';i++)
    {
        if( s[i]=='A' && s[i+1]=='C')
        {
            ac++;
        }
        else if(s[i]=='W'&& s[i+1]=='A')
        {
            wa++;
        }
        else if(s[i]=='T' && s[i+1]=='L'&& s[i+2]=='E')
        {
            tle++;
        }
        else if(s[i]=='R' && s[i+1]=='E')
        {
            re++;
        }
    }
    }
    cout<<"AC x "<<ac<<endl<<"WA x "<<wa<<endl<<"TLE x "<<tle<<endl<<"RE x "<<re;
}


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

int n;
string s;
stack<char>a;

int main(){
	cin>>n>>s;
	rep(i,n){
		if(a.empty())a.push(s[i]);
		else if(a.top()=='('&&s[i]==')')a.pop();
		else a.push(s[i]);
	}
	int as=0,ad=0;
	while(!a.empty()){
		if(a.top()==')')ad++;
		else as++;
		a.pop();
	}
	rep(i,ad)cout<<'(';
	cout<<s;
	rep(i,as)cout<<')';
	cout<<endl;
	return 0;
}


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

#define FOR(i,s,t) for(int i = s ; i < t ; i++)
using LL = long long; using ll = LL;
using PII = pair<int, int>; using pii = PII;
using PLL = pair<LL, LL>; using pll = PLL;
const int INF = 1e9;
const float EPS = 1e-9;


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

	int n;
	cin >> n;
	vector<pair<float, int>> a;
	vector<pair<int, int>> result(n);
	for (int i = 0; i < n; ++i) {
		pair<float, int> tmp;
		cin >> tmp.first;
		tmp.second = i;
		a.push_back(tmp);
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < n; ++i) {
		auto l = lower_bound(a.begin(), a.end(), pair<float, int>(a[i].first, -1)) - a.begin();
		auto r = upper_bound(a.begin(), a.end(), pair<float, int>(a[i].first, INF)) - a.begin();

		//cout << a[i].first << " " << a[i].second << " " << l << " " << r << endl;
		result[i].second = l * 3 + (r - l - 1) * 1;
		result[i].first = a[i].second;
	}
	sort(result.begin(), result.end());
	for (auto i : result) {
		cout << i.second << endl;
	}

	return 0;

}


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

int main(){
  string s;
  int c=0,t=0;
  cin>>s;
  for(int i=0;i<3;i++){
    if(s[i]=='R')
      c++,t=max(t,c);
  else c=0;
  }
  cout<<t<<endl;
}

Measured memory_bytes: 3628
def main():
	s = str(input())
	s_1_mae = list(s[:((len(s)-1) // 2)])

	s_2 = list(s[((len(s)+3)// 2) -1 :])

	if s_1_mae == list(reversed(s_1_mae)) and s_2 == list(reversed(s_2)) and list(s) == list(reversed(list(s))):
		print("Yes")
	else:
		print("No")

if __name__ == '__main__':
	main()

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

int main(void)
{
    int W,H,x,y,r;
    cin>>W>>H>>x>>y>>r;
    if(x>=r && x+r<=W && y>=r && y+r<=H){
        cout << "Yes"<< endl;
    
    }
    else{
        cout << "No"<< endl;
    }
}


Measured memory_bytes: 3088
#B
N = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
Cs = list(map(int, input().split()))
fm = 2 * N 
result = 0
for i in range(N):
    nm = As[i]
    result += Bs[As[i]-1]
    if nm -fm == 1:
        result += Cs[fm-1]
    fm = nm
print(result)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
static const double PI = 3.1415926535897932384626433;
static const ll LL_MAX = (ll)1 << 62;
static const ll MOD = 1000000007;

ll y_1[1000000];
ll x1[1000000];
ll y2[1000000];
ll x2[1000000];
ll a[501][501] = {};

int main() {
	ll h, w; cin >> h >> w;
	repe(i, 1, h)repe(j, 1, w)cin >> a[i][j];

	ll cnt = 0;
	repe(i, 1, h)rep(j, 1, w) {
		if (a[i][j] & 1) {
			a[i][j]--;
			a[i][j + 1]++;
			y_1[cnt] = i;
			x1[cnt] = j;
			y2[cnt] = i;
			x2[cnt] = j + 1;
			cnt++;
		}
	}

	rep(i, 1, h) {
		if (a[i][w] & 1) {
			a[i][w]--;
			a[i + 1][w]++;

			y_1[cnt] = i;
			x1[cnt] = w;
			y2[cnt] = i + 1;
			x2[cnt] = w;
			cnt++;
		}
	}
	cout << cnt << endl;
	rep(i, 0, cnt) {
		cout << y_1[i] << " " << x1[i] << " " << y2[i] << " " << x2[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 16384
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

// (num ^ x) % mod
LL pow_mod(LL num, LL x, LL mod)
{
	LL res = 1;
	while (x > 0)
	{
		if (x & 1)
		{
			res = (res * num) % mod;
		}
		num = (num * num) % mod;
		x >>= 1;
	}
	return res;
}

// ユークリッドの互除法
LL extgcd(LL a, LL b, LL& x, LL& y)
{
	LL g = a; x = 1; y = 0;
	if (b != 0)
	{
		g = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	return g;
}

// 逆元
LL mod_inverse(LL a, LL m)
{
	LL x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

// 階乗
std::vector<LL>fact;
void mod_fact(LL n, LL m)
{
	fact.resize(n + 1);
	fact[0] = 1;
	for (LL i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i % m;
}

const LL mod = 1000003;

int main()
{
	LL Q;
	in >> Q;
	std::vector<LL>x(Q), d(Q), n(Q);
	rep(i, Q) in >> x[i] >> d[i] >> n[i];

	mod_fact(2123456, mod);
	rep(i, Q)
	{
		LL ans;
		if (d[i] == 0) ans = pow_mod(x[i], n[i], mod);
		else
		{
			if (n[i] >= mod) ans = 0;
			else
			{
				LL X = x[i] * mod_inverse(d[i], mod) % mod;
				ans = fact[X + n[i] - 1] * mod_inverse(fact[X - 1], mod) % mod * pow_mod(d[i], n[i], mod) % mod;
			}
		}
		out << ans << std::endl;
	}
}


Measured memory_bytes: 19840
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;


int main(){
    VEC(int,a,3);
    sort(ALL(a));
    cout<<a[2]*10+a[1]+a[0];
}



Measured memory_bytes: 256
#include <stdio.h>
main(){
   int a,b,c,x,y,z;
   scanf("%d %d %d",&x,&y,&z);
   if(x>y){
        a=x;
        x=y;
        y=a;
   }
   if(x>z){
        c=x;
        x=z;
        z=c;
   }
   if(y>z){
        b=y;
        y=z;
        z=b;
   }
 
   printf("%d %d %d\n",x,y,z);
 
   return 0;
}

Measured memory_bytes: 1820
# coding: utf-8
N = int(input())
S, T = [], []
for i in range(N):
    s, t = input().split()
    t = int(t)
    S.append(s)
    T.append(t)
X = input()
start = S.index(X)
ans = 0
for i in range(start+1, N):
    ans += T[i]
print(ans)

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

class BIT {
private:
	int size;
	vector<int> bit;
	int mod;

public:
	BIT(int n, int m):size(n), bit(n + 1, 0), mod(m) {}

	void add(int i, int x) {
		while(i <= size) {
			bit[i] += x;
			bit[i] %= mod;
			i += i & -i;
		}
	}

	int sum(int i) const {
		long long s = 0;
		while(i > 0) {
			s += bit[i];
			i -= i & -i;
		}
		return s % mod;
	}
};

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

	for(int a, b, p; cin >> a >> b >> p && a;) {
		const int num = b - a + 2;

		vector<string> order;
		order.reserve(num);

		for(int i = a; i <= b; ++i) {
			order.emplace_back(to_string(i));
		}

		sort(order.begin(), order.end());

		BIT bit(num, p);
		bit.add(1, 1);

		for(const auto &s : order) {
			const int index = stoi(s) - a + 2;
			const auto tmp = bit.sum(index - 1);
			bit.add(index, tmp);
		}

		cout << (bit.sum(num) - 1 + p) % p << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 7064
import re

def test():
    s = input()
    m = list(set(re.findall(r"[A-Z]",s)))

    if len(m) == 2:
        if s.count(m[0]) == 2 and s.count(m[1]) == 2:
            print("Yes")
        else:
            print("No")
    else:
        print("No")


if __name__ == "__main__":
    test()


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

const int INF = 1001001001;

int main(){
  int n;
  cin >> n;
  if(n%2 == 0){
    cout << (n/2) - 1;
  }else{
    cout << n/2;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;


public class AtCoder {
    static int a, b, h;
    static void Main() {
        a = int.Parse(Console.ReadLine());
        b = int.Parse(Console.ReadLine());
        h = int.Parse(Console.ReadLine());
        Console.WriteLine((a + b) * h / 2);
    }
}

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

int main() {
    ios::sync_with_stdio(false);
    int a,b,n,c,d,ans=0;
    cin >> a >> b >> n;
    vector<bool> book(1000, false);
    rep(i,n) {
        cin >> c >> d;
        for (int j=c; j<d; j++) book.at(j) = true;
    }
    for (int i=a; i<b; i++) {
        if (book.at(i)) {ans++;break;}
    }
    cout << ans << endl;
}


Measured memory_bytes: 3168
let xn = readLine()!.split(separator: " ").map { Int($0)! }
let (x, n) = (xn[0], xn[1])
let p = readLine()!.split(separator: " ").map { Int($0)! }

for num in 0...1000 {
  let a = x - num
  if !p.contains(a) {
    print(a)
    break
  }
  let b = x + num 
  if !p.contains(b) {
    print(b)
    break
  }
}


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

int main() {

    int n;
    char s[10001];
    char t[10001];
    scanf("%d %s", &n, s);

    for (int i = 0; i < strlen(s); i++) {

        char c = s[i];

        if (c + n >= 91) {
            c += n - 26;
        } else {
            c += n;
        }

        t[i] = c;

        printf("%c", c);
        //printf("%c %c %d\n", c, c + n, c + n);
    }
    //printf("%s", t);


    return 0;

}


Measured memory_bytes: 128
import           Control.Exception           (assert)
import           Control.Monad
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

inf :: Int
inf = 10^18

main = do
  n <- getInt
  as <- getIntVec n

  d <- VM.new (n+1)
  VM.set d (0::Int)

  forM_ [0..(n-2)] $ \i -> do
    let ai = as V.! i
    t <- VM.read d ai
    VM.write d ai (t+1)

  forM_ [1..n] $ \i -> do
    x <- VM.read d i
    print x

Measured memory_bytes: 11472
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
int main()
{
  int n;
  string s;
  cin >> n >> s;
  vector<int> a(n);
  rep(i, n)
  {
    if (s[i] == 'R')
      a[i] = 0;
    if (s[i] == 'G')
      a[i] = 1;
    if (s[i] == 'B')
      a[i] = 2;
  }
  vector<ll> cnt(3);
  rep(i, n) cnt[a[i]]++;
  ll ans = 1;
  rep(i, 3) ans *= cnt[i];
  rep(j, n) rep(i, j)
  {
    int k = j + (j - i);
    if (k < n)
    {
      if (s.at(i) == s.at(j))
        continue;
      if (s.at(i) == s.at(k))
        continue;
      if (s.at(k) == s.at(j))
        continue;
      ans--;
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;
#define                     IO                                              ios_base::sync_with_stdio(0); cin.tie(0)

int main(){
    IO;
    int n;
    //cin >> n;
    scanf("%d",&n);
    int a[n + 1];
    int dp[n + 1];
    for(int i = 0; i < n; i++) scanf("%d",&a[i]);//cin >> a[i];
    /*
    dp[0] = a[0];
    dp[1] = a[0] + a[1];
    for(int i = 2; i <= n; i++){
        dp[i] = min(dp[i - 1] + a[i],dp[i - 2] + a[i]);
    }
    cout << dp[n - 1] << endl;
    */
    dp[0] = 0;
    dp[1] = abs(a[0] - a[1]);
    for(int i = 2; i <= n; i++){
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]),dp[i - 2] + abs(a[i] - a[i - 2]));
    }
    //cout << dp[n - 1] << endl;
    printf("%d\n",dp[n - 1]);
}

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FOR(i, j, 0)
#define INF (1 << 30)

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

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int dp[53];

int main() {
	int N;
	scanf("%d", &N);
	string s1, s2;
	cin >> s1 >> s2;
	string s;
	rep(i, N) {
		if(s1[i] == s2[i]) {
			s += "0";
		}
		else {
			s += "1";
			++i;
		}
	}

	ll res = (s[0] == '0') ? 1 : 2;;
	res *= 3;
	FOR(i, 1, s.size()) {
		if(s[i] == '0') {
			if(s[i - 1] == '0') res *= 2;
		}
		else {
			if(s[i - 1] == '0') res *= 2;
			else res *= 3;
		}
		res %= MOD;
	}
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll bg=pow(10,9)+7;
#define ff(i,n) for(i=0;i<n;i++)
#define gg1(n1) cin>>n1;
#define gg(n1,n2) cin>>n1>>n2;
#define gg3(n1,n2,n3) cin>>n1>>n2>>n3;
#define hh(n) cout<<n<<endl;
#define t top
#define p push
#define pb push_back
#define mp make_pair
map<ll,set<ll> >edges;
ll arr[100001];
ll fin(ll i)
{	 
	 if(edges.find(i)==edges.end())
     {
		arr[i]=0;
          return 0;
     }
     if(arr[i]!=-1)
	    return arr[i];
     ll maxdis=0,j;	
     set<ll>::iterator ss,kk;
	 for(ss=edges[i].begin();ss!=edges[i].end();ss++)
	     maxdis=max(maxdis,1+fin(*ss));	 
     return arr[i]=maxdis;
}
int main()
{
  ll i,j,n,k,m;
  cin>>n>>m;
  for(i=0;i<100001;i++)  arr[i]=-1;
  for(i=0;i<m;i++)
  {
       ll x,y;
       cin>>x>>y;
       x--;y--;
       if(edges.find(x)==edges.end())
       {
            set<ll>set1; set1.insert(y);
            edges.insert(mp(x,set1));
       }
       else
          edges[x].insert(y);
  }
  ll ans=0;
  for(i=0;i<n;i++)
  {
     if(arr[i]==-1)  
       fin(i);
     ans=max(arr[i],ans);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 18560
#include <iostream>
#include <algorithm>
#include <complex>
#include <cmath>
#include <vector>
using namespace std;
typedef complex<double> P;

const double eps = 1e-8;
bool equals(double a, double b) { return abs(a-b) < eps; }

namespace std {
  bool operator < (const P &a, const P &b) {
    if(!equals(a.real(),b.real())) return a.real() < b.real();
    if(!equals(a.imag(),b.imag())) return a.imag() < b.imag();
    return false;
  }
}

struct L : public vector<P> {
  L(P a, P b) {
    push_back(a);
    push_back(b);
  }
};

double dot(P a, P b)   { return a.real()*b.real()+a.imag()*b.imag(); }
double cross(P a, P b) { return a.real()*b.imag()-a.imag()*b.real(); }

int ccw(P p, P a, P b) {
  a -= p;
  b -= p;
  if(cross(a,b) > eps) return 1;
  if(cross(a,b) < -eps) return -1;
  if(dot(a,b) < -eps) return 2;
  if(norm(a) < norm(b)) return -2;
  return 0;
}

//----------------------------------------


const int MAX_M = 30010;

int N, M, W, H, S;
vector<P> Ps;
vector<L> Ls;
int num[MAX_M];
double A[MAX_M];

int search(P p) {
  int l, r, ans;
  l = 0, r = M, ans = -1;
  while(l < r) {
    int m = (l+r)/2;
    if(ccw(Ls[m][0],Ls[m][1],p) == 1) {
      l = m+1;
      ans = m;
    } else {
      r = m;
      ans = m-1;
    }
  }
  return ans+1;
}

void calcArea() {
  A[0] = 0;
  for(int i = 0; i+1 < Ls.size(); ++i) {
    double a = Ls[i+1][0].imag() - Ls[i][0].imag();
    double b = Ls[i+1][1].imag() - Ls[i][1].imag();
    A[i+1] = A[i] + (a+b)*W/2.0;
  }
}

int main() {
  while(cin >> N >> M >> W >> H >> S && (N|M|W|H|S)) {
    Ps.clear();
    Ls.clear();
    Ls.push_back(L(P(0,0),P(W,0)));
    for(int i = 0; i < M; ++i) {
      double l, r;
      cin >> l >> r;
      Ls.push_back(L(P(0,l),P(W,r)));
    }

    for(int i = 0; i < N; ++i) {
      P p;
      cin >> p.real() >> p.imag();
      Ps.push_back(p);
    }

    fill(num,num+MAX_M,0);
    for(int i = 0; i < Ps.size(); ++i)
      ++num[search(Ps[i])];
    for(int i = 1; i <= M; ++i) num[i] += num[i-1];

    calcArea();

    int T = W*H-S;
    int ans = 0;
    for(int i = 0, j = 1; i <= M && j <= M; ++i) {
      while(j <= M && A[j]-A[i] < T+eps) ++j;
      ans = max(ans,num[j-1]-num[i]);
    }
    cout << N-ans << endl;
  }
  return 0;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, double> pid;
typedef pair<double, int> pdi;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int dp[100010];

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

	int N;
	cin >> N;

	rep(i, 0, N + 1)dp[i] = i;
	rep(i, 1, 10)
	{
		int d = (int)pow(6, i);
		rep(j, 0, N + 1)
		{
			if (j + d > N)break;
			chmin(dp[j + d], dp[j] + 1);
		}
	}
	rep(i, 1, 10)
	{
		int d = (int)pow(9, i);
		rep(j, 0, N + 1)
		{
			if (j + d > N)break;
			chmin(dp[j + d], dp[j] + 1);
		}
	}

	cout << dp[N] << endl;

	return 0;
}

Measured memory_bytes: 1024
/* Author: Dhruv Rastogi */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int> 
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
const long double PI = acos(-1.0);

void solve(){  
    int n;
    cin>>n;
    cout<<(n-1)/2<<endl;  
}

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

Measured memory_bytes: 256
#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() {
    string S;
    cin >> S;
    int N = S.size();
    vector<bool> alpha(26, false);
    rep(i,N) alpha.at(S.at(i) - 'a') = true;
    if (count(alpha.begin(), alpha.end(), false) == 0) {
        int maxi = S.at(N-1) - 'a';
        rep(i,N) {
            int tmp = S.at(N-1-i) - 'a';
            if (tmp < maxi) {
                S.erase(N-1-i);
                for (int j = tmp; j < 26; ++j) if (alpha.at(j) == false) {
                    S.push_back('a' + j);
                    i = N;
                    break;
                }
            }
            maxi = max(maxi, tmp);
            alpha.at(tmp) = false;
            if (i == N - 1) S = "-1";
        }
    } else {
        rep(i,26) if (alpha.at(i) == false) {
        S.push_back('a' + i);
        break;
        }
    }
    cout << S << endl;
}


Measured memory_bytes: 3640
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class APoor {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int A, B, C;
        cin >> A >> B >> C;
        if (A == B && A != C) {
            cout << "Yes" << endl;
        } else if (B == C && A != B) {
            cout << "Yes" << endl;
        } else if (A == C && A != B) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }


    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    APoor solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std ;
#define rep( i, s, t ) for( register int i = s; i <= t; ++ i )
#define re register
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 20 + 5 ; 
int n, Ans, a[N][N], vis[N] ;
void check() {
	for( re int i = 1; i <= n; ++ i ) {
		for( re int j = 1; j <= n; ++ j ) {
			if( a[i][j] == -1 ) continue ;
			if( vis[i] == 1 && vis[j] == 1 && a[i][j] == 0 ) return ; 
			if( vis[i] == 1 && vis[j] == 0 && a[i][j] == 1 ) return ; 
		}
	}
	int ans = 0 ;
	for( re int i = 1; i <= n; ++ i ) ans += vis[i] ;
	Ans = max( Ans, ans ) ;
}
void dfs( int x ) {
	if( x == n + 1 ) {
		check() ; return ; 
	}
	vis[x] = 0, dfs( x + 1 ), vis[x] = 1, dfs( x + 1 ) ;
}
signed main()
{
	n = gi() ; int m ; 
	memset( a, -1, sizeof(a) ) ;
	rep( i, 1, n ) {
		m = gi() ; 
		rep( j, 1, m ) {
			int x = gi(), y = gi() ; 
			a[i][x] = y ; 
		}
	}
	dfs(1) ; printf("%d\n", Ans ) ;
	return 0 ;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var (
	H, W, N int
	a       [10100]int
	c       [100][100]int
	dx      = [4]int{0, 1, 0, -1}
	dy      = [4]int{1, 0, -1, 0}
	x, y    int
	dir     int
	color   int = 1
)

func main() {
	readVariables()
	for i := 0; i < H*W; i++ {
		fill()
		if !next() {
			turn()
		}
		proceed()
	}
	for i := 0; i < H; i++ {
		row := make([]string, W)
		for j := 0; j < W; j++ {
			row[j] = strconv.Itoa(c[i][j])
		}
		fmt.Println(strings.Join(row, " "))
	}
}

func next() bool {
	nextX := x + dx[dir]
	nextY := y + dy[dir]
	in := 0 <= nextX && nextX < H && 0 <= nextY && nextY < W
	if !in {
		return false
	}
	return c[nextX][nextY] == 0
}

func proceed() {
	x += dx[dir]
	y += dy[dir]
}

func fill() {
	if a[color] == 0 {
		color++
	}
	c[x][y] = color
	a[color]--
}

func turn() {
	dir = (dir + 1) % 4
}

func readVariables() {
	H, W, N = nextInt(), nextInt(), nextInt()
	for i := 0; i < N; i++ {
		a[i+1] = nextInt()
	}
}

/* Template */

var scanner *bufio.Scanner

func init() {
	Max := 1001001
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, Max), Max)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}

// MinInt returns minimum argument
func MinInt(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

//MaxInt returns maximum argument
func MaxInt(x, y int) int {
	if x < y {
		return y
	} else {
		return x
	}
}

//AbsInt returns |x| for x
func AbsInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//ModPow calculates integer power with modulo operation
//if modulo <= 1, it powers w/o module operation
//if base < 0, return value might be negative too.
func ModPow(base, exponent, modulo int) (result int) {
	result = 1
	for exponent > 0 {
		if exponent%2 == 1 {
			result *= base
			if modulo > 1 {
				result %= modulo
			}
		}
		base *= base
		if modulo > 1 {
			base %= modulo
		}
		exponent /= 2
	}
	return
}

//Gcd
func Gcd(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = gcd(result, vals[i])
	}
	return
}

func gcd(x, y int) int {
	x, y = AbsInt(x), AbsInt(y)
	for y > 0 {
		x, y = y, x%y
	}
	return x
}

//Lcm
func Lcm(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = lcm(result, vals[i])
	}
	return
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}


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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  vi v;
  while(n > 0) {
    v.push_back(n % 10);
    n /= 10;
  }
  vi ans;
  for(int i=0;i<3;++i) {
    if(v[i] == 1) {
      ans.push_back(9);
    } else if(v[i] == 9) {
      ans.push_back(1);
    } else {
      ans.push_back(v[i]);
    }
  }
  cout << ans[2] << ans[1] << ans[0] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 87;
double a[N];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    double ans = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        a[i] = (a[i] + 1) / 2;
        a[i] += a[i - 1];
        if (i >= k)
            ans = max(ans, a[i] - a[i - k]);
    }
    cout << fixed << setprecision(16) << ans << endl;
}


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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

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

int Vec_A[100][100], Vec_B[100];

int main() {
	int N, M;
	scanf("%d %d", &N, &M);
	rep(i, N) rep(j, M) scanf("%d", &Vec_A[i][j]);
	rep(i, M) scanf("%d", &Vec_B[i]);
	rep(i, N) {
		int ans = 0;
		rep(j, M) ans += Vec_A[i][j] * Vec_B[j];
		printf("%d\n", ans);
	} 
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll N;
    string temp;
    char last;
    map<string, ll> m;
    cin >> N;
    cin >> temp;
    m[temp]++;
    last = temp.back();
    for(ll i = 1;i < N;i++) {
        cin >> temp;
        m[temp]++;
        if(m[temp] > 1 || temp.front() != last) {
            cout << "No" << endl;
            return 0;
        }
        last = temp.back();
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 1000000000000000005
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
int s(int n){
	int ans=0;
	while(n){
		ans+=n%10;
		n/=10;
	}
	return ans;
}
int main(){
	int n;
	while(~getI(n)) printf("%s\n",n%s(n)==0?"Yes":"No");
}


Measured memory_bytes: 256
if __name__ == '__main__':
    N, A, B, C, D = map(int, input().split())
    S = str(input())
 
    answer = "-1"
 
    if C < D:
       if S[A:D:].count("##") >= 1:
           answer = "No"
       else:
           answer = "Yes"
    else:
       if S[B-2:D+1:].count("...") >= 1:
           answer = "Yes"
       else:
           answer = "No"
 
    print(answer)




Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=200005;
ll k,n,a[maxn],pos=1,cnt,res,vis[maxn],ans[maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>k;
	for(int i=1; i<=n; i++) {
		cin>>a[i];
	}

	while(true) {
		if(vis[pos]==2) break;
		if(!vis[pos]) {
			cnt++;
			if(k==cnt) return cout<<a[pos],0;
		} else {

			ans[res]=pos;
			res++;
		}
		vis[pos]++;
		pos=a[pos];
	}
	cout<<ans[(k-cnt+res)%res];
	return 0;
}

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

int N, M;
vector<vector<int>> A;

void dfs (vector<int> v, int d, int p) {
  if (d == N) {
    A.push_back(v);
    return;
  }
  for (int i = p; i <= M; i++) {
    vector<int> nv = v;
    nv.push_back(i);
    dfs(nv, d + 1, i);
  }
}

int main() {
  cin >> N >> M;
  vector<int> start;
  dfs(start, 0, 1);

  int Q;
  cin >> Q;
  vector<vector<int>> V(Q, vector<int>(4));
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> V.at(i).at(j);
    }
  }

  int ans = 0;
  for (auto a : A) {
    int sum = 0;
    for (auto v : V) {
      if (a.at(v.at(1) - 1) - a.at(v.at(0) - 1) == v.at(2)) {
        sum += v.at(3);
      }
    } 
    ans = max(ans, sum);
  }
  cout << ans << "\n";
}

Measured memory_bytes: 9792
// finish date: 2018/01/10
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int i=a;i<b;i++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long

bool isExist(char c, string str) {
    rep(i, str.length()) {
        if (c == str[i]) return true;
    }
    return false;
}

int fact(int n) {
    int ans = 1;
    FOR(i, 1, n + 1) {
        ans *= i;
    }
    return ans;
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b == c || b + c == a || c + a == b) cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var column int
	if sc.Scan() {
		tmp := strings.Split(sc.Text(), " ")
		column, _ = strconv.Atoi(tmp[1])
	}

	var lastRaw = make([]int, column+1)
	for sc.Scan() {
		var newRaw = make([]int, column+1)
		tmp := strings.Split(sc.Text(), " ")
		for i, v := range tmp {
			newRaw[i], _ = strconv.Atoi(v)
		}
		for i, v := range newRaw {
			if i != column {
				newRaw[column] += v
				lastRaw[i] += v
			}
		}
		lastRaw[column] += newRaw[column]
		fmt.Println(strings.Trim(strings.Join(strings.Fields(fmt.Sprint(newRaw)), " "), "[]"))
	}
	fmt.Println(strings.Trim(strings.Join(strings.Fields(fmt.Sprint(lastRaw)), " "), "[]"))
}



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

typedef long long ll;
const int maxn = 200010;
int n;
ll ans, a[maxn];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%lld", &a[i]), a[i] -= i;
    }
    sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; i++) {
        ans += abs(a[i] - a[(n + 1) >> 1]);
    }
    printf("%lld\n", ans);
    return 0;
}

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

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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define REREP(i,n) for(int i=int(n-1); i>=0; i--)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define REFOR(i,m,n) for(int i=int(n-1); i>=int(m); i--)
#define ALL(obj) (obj).begin(),(obj).end()
 
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>
 
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>
 
#define SUMI(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SUMD(obj) accumulate((obj).begin(), (obj).end(), 0.)
#define SUML(obj) accumulate((obj).begin(), (obj).end(), 0LL)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

#define PB push_back
#define Cout(str) cout << str << endl

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const ll EPS = (ll)1e-8;

int main(){
	int n,m;
	int a,b,c;
	int sum;
	string str;
	string s,t;
	char ch;
	VI vi;
	vector<char> vc;
	VS vs;
	int reserve_vi = 100;
	map<int, int> table; 
	string str2, str3;
	map<char, string> vowel;
	vector<char> vowel_vec = {'a', 'e', 'i', 'o', 'u'};

	//cin >> n >> m;
	//cin >> a >> b;
	//cin >> a >> b >> c;
	//cin >> str;
	//cin >> str >> str2 >> str3;
	//cin >> n;
	
	//cin >> s >> t;
	cin >> ch;

	REP(i, int('z')-int('a')+1){
		vowel[int('a')+i] = "consonant";
	}

	REP(i, vowel_vec.size()){
		vowel[vowel_vec[i]] = "vowel";
	}

	Cout(vowel[ch]);

	//cout << accumulate(vi.begin(), vi.begin()+n, 0) << endl;

	//swap(a, b);
	//vi.resize(N);
	//fill(vi.begin(), vi.end(), 1);
	//vi.reserve(reserve_vi);
	//vi.PB(n);

	//vc.resize(5);
	//vc[i] = (str[i]);

	//sort(vc.begin(), vc.end(), greater<char>());
	//sort(vc.begin(), vc.end());

	//for(auto itr = table.begin(); itr != table.end(); ++itr) {
	return 0;
}



Measured memory_bytes: 256
/* ex9_1
  terakura */

  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
  //スタックに格納するデータの最大数
  #define SIZE 100

  //スタックの定義
  typedef struct stack{
      int size;
      int count;
      char data[SIZE];
      char *top;
  } stack;

  //スタックの初期化
  void initialize_stack(stack *stk){
      stk->count = 0;
      stk->size = SIZE;
      stk->top = &(stk->data[SIZE]);
  }

  //データの追加
  void push(stack *stk, char elem){
      if(stk->count >= stk->size){
          fprintf(stderr, "Error: stack overflow. (x=%c)\n", elem);
          exit(1);
      }
      else{
          stk->top--;
          *(stk->top) = elem;
          stk->count++;
      }
  }

  //データの取り出し
  char pop(stack *stk){
      char latest;
      if(stk->count <= 0){
          fprintf(stdout, "Error: stack underflow.\n");
          exit(1);
      }
      else{
          latest = *(stk->top);
          stk->top++;
          stk->count--;
          return latest;
      }
  }

  void print_stack(stack *stk){
      int i;

      for(i=0; i < stk->count; i++){
          printf("%c", stk->data[SIZE-i-1]);
      }
      printf("\n");
  }

  int main(void){
      stack stk;
      char input[11];
      int i;
      //スタックを初期化（ポインタ渡しで関数にわたすこと）
      initialize_stack(&stk);

      scanf("%s", input);

      //input[i] != 'B'ならスタックにデータを追加
      for(i=0; i<strlen(input); i++){
          if(input[i] != 'B'){
              push(&stk, input[i]);
          }
          else if(stk.count > 0){
              pop(&stk);
          }
      }

      //出力
      print_stack(&stk);
      return 0;
  }


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

bool isok(ll a, ll b, ll c) {
    if (a + b > c && b + c > a && c + a > b) {
        if (a != b && b != c && c != a) return true;
        return false;
    }
    else return false;
}

int main() {
    ll n; cin >> n;
    vector<ll> v(n); for (int i = 0; i < n; ++i) cin >> v[i];

    ll count = 0;
    for (int i = 0; i < n - 2; ++i) {
        for (int j = i + 1; j < n - 1; ++j) {
            for (int k = j + 1; k < n; ++k) {
                ll a = v[i];
                ll b = v[j];
                ll c = v[k];
                // cout << a << " " << b << " " << c << endl;
                // cout << isok(a, b, c) << endl;
                if (isok(a, b, c)) count++;
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<ll,ll,ll>
#define pr(x) cout << x << endl;
using namespace std;
 
int main(){
  string s; cin >> s;
  int sl=s.length();
  rep(i,sl-1){
    if(s[i]==s[i+1]){
      cout << i+1 << ' ' << i+2 << endl;
      return 0;
    }
  }

  for(int i=0; i+2<sl; i++){
    if(s[i]==s[i+2]){
      cout << i+1 << ' ' << i+3 << endl;
      return 0;
    }
  }

  cout << -1 << ' ' << -1 << endl;
return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
 lint digit(lint);

int main(){

    int a, b;
    cin >> a >> b;

    int ans = -1;
    for(int i = 10; i <= 10000; ++i){
        if((int)(i*0.08) == a && (int)(i*0.1) == b){
            ans = i;
            break;
        }
    }
    cout << ans << endl;

}
lint digit(lint num){
    lint dig = 0;
    while(num){
        num /= 10;
        ++dig;
    }
    return dig;
}

Measured memory_bytes: 256
import sys

N = int(input())
A = list(map(int, sys.stdin.readline().rsplit()))
A.sort()

s = 0
res = 0

for i in range(N - 1):
    s += A[i]
    if s * 2 >= A[i + 1]:
        res += 1
    else:
        res = 0

print(res + 1)


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

int main() {
  int N, M;
  cin >> N >> M;
  map<int, int> s;
  int x, y;
  
  rep(i, M){
    cin >> x >> y;
    if(s.count(x)){
      if(s.at(x) != y){
       cout << -1 << endl;
       return 0;
      }
    }else s[x] = y;
  }
  if(N != 1 && s.count(1) && s.at(1)==0){
   cout << -1;
  }else{
    for(int i=1; i<=N; i++){
     if(s.count(i)) cout << s.at(i);
     else if(i==1 && N!=1) cout << 1;
     else cout << 0;
    }
  }
  cout << endl;
  return 0;
}




Measured memory_bytes: 3468
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

N = iin()
A = iln()

c = [0 for _ in range(N+1)]

for i in range(N):
    c[i+1] = c[i] + A[i]

counter = collections.Counter(c)

ans = 0
for v in counter.values():
    ans += v * (v-1) // 2
print(ans)



Measured memory_bytes: 43480
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <chrono>
#include <random>
#include <stack>
#include <ctime>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}

int vector_finder(vector<int> vec, int number) {
    auto itr = find(vec.begin(), vec.end(), number);
    size_t index = distance( vec.begin(), itr );
    if (index != vec.size()) { // 発見できたとき
        return 1;
    }
    else { // 発見できなかったとき
        return 0;
    }
}

const static int MAX_N = 100000;

int par[MAX_N], rank_t[MAX_N];

void init(int n) {
    for (int i = 0; i <= n; ++i) {
        par[i] = i;
        rank_t[i] = 0;
    }
}

int root(int x) {
    return par[x] == x ? x : par[x] = root(par[x]);
}

bool same(int x, int y) {
    return root(x) == root(y);
}

void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return;

    if (rank_t[x] < rank_t[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rank_t[x] == rank_t[y]) rank_t[x]++;
    }
}

int main() { // AtCoder Typical B
    int n, m, p[MAX_N], x, y;
    cin >> n >> m;
    init(n);
    rep(i, n) {
        cin >> p[i];
    }
    rep(j, m) {
        cin >> x >> y;
        unite(x, y);
    }

    llong cnt = 0;
    rep(i, n) {
        if (same(p[i], p[p[i] - 1])) ++cnt;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 1408