akhauriyash/Code-Regression huggingface dataset:
import sys
from collections import deque


def bfs():
    while len(bfs_q)>0:
        u = bfs_q.popleft()
        for v in adj_list[u]:
            if flag_list[v] == 0:
                group_list[v] = g
                flag_list[v] = 1
                bfs_q.append(v)
        flag_list[u] = 2


if __name__ == "__main__":
    input = sys.stdin.readline
    n, m = map(int, input().split())
    adj_list = [[] for _ in range(n)]
    for _ in range(m):
        s, t = list(map(int, input().split()))
        adj_list[s].append(t)
        adj_list[t].append(s)

    group_list = [0]*n
    flag_list = [0]*n # 0: 未到達, 1: 処理中, 2: 完了
    bfs_q = deque([])
    g = 0
    for i in range(n):
        if flag_list[i] == 0:
            group_list[i] = g
            flag_list[i] = 1
            bfs_q.append(i)
            bfs()
            g += 1

    q = int(input())
    for _ in range(q):
        s, t = map(int, input().split())
        if group_list[s] == group_list[t]:
            print('yes')
        else:
            print('no')



Measured memory_bytes: 24988
#include<bits/stdc++.h>
#define REP(n)    for(int i = 0; i < (n); ++i)
#define RREP(n)   for(int i = (n); i >= 0; --i)
#define FOR(m, n) for(int i = (m); i < (n); ++i)
#define SZ(x)       ( (int)(x).size() )
#define BIT(n)      ( 1LL << (n) )
#define EXIST(x)    ( (x).find()		!= (x).end() )
#define DEBUG(n)    cerr << #n << " : " << n << '\n';
#define PB  push_back
#define UB  upper_bound			//k <
#define LB  lower_bound			//k	<= 
#define F   first
#define S   second
#define INF 1.0e9


using namespace std;

typedef long long			ll;
typedef pair<int, int>		pii;
typedef pair<long			long, long long>   pll;
typedef vector<int>			vi;
typedef vector<double>		vd;
typedef vector<long long>   vll
;

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

int r_up(const int a, const int b){ return (a + b - 1) / b; }

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

struct UFT{
  vi	p;
  UFT(){}
  UFT(int N)       { p.resize( N, -1 ); }
  int	par(int a)   { if( p[a] >= 0 ){ p[a]  = par( p[a] ); return p[a]; } return a;  }
  int size(int a)  { return -p[par(a)]; }
  bool	same(int a, int b) { return par(a)	 == par(b); }
  void unite(int	a, int b){
	a													  = par(a);  b = par(b);
	if( a == b ) return;
	if( size(a) < size(b) ) swap(a,b);
	p[a]												 -= size(b);
	p[b]												  = a;
  }
};

string s;

int rec(int n,const string st){
  if(n<0)return 0;
  int res=0;  
  int c[10]={};
  REP(SZ(st))c[st[i]-'0']++;
  if(c[3]&&c[5]&&c[7]&&(st<=s||SZ(st)<SZ(s))){
	DEBUG(n);
	DEBUG(st);
	res++;
  }
  res+= rec(n-1,st+'3')+rec(n-1,st+'5')+rec(n-1,st+'7');
  return res;
}

int main(){
  cin>>s;
  int k=SZ(s);
  cout<<rec(k,"")<<endl;
  return 0;
}


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

int main(){
	int a, b, c, k;

	cin >> a >> b >> c >> k;

	int ans = 0;
	if(k <= a){
		ans = k;
	}else{
		ans += a;
		k -= a;
		if(b <= k){
			k -= b;
			ans -= k;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3632
S = str(input())
t = len(S)
ans =0
for i in range(1<<t-1):
    k=S[0]
    for x in range(t-1):
        if i & 1<<x:
            k=k+'+'+S[x+1]
        else:
            k+=S[x+1]
    ans +=eval(k)
print(ans)

Measured memory_bytes: 3060
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,T = I()
t = l()
ans = T
for i in range(N-1):
    ans += min(t[i+1]-t[i],T)
print(ans)

Measured memory_bytes: 31604
A, B, C = map(int, input().split())
K = int(input())
i = 0
while i < K:
  if A >= B:
    B *= 2
    i += 1
  else:
    break
while i < K:
  if B >= C:
    C *= 2
    i += 1
  else:
    break
#print(i)
#print(A, B, C)
if A < B and B < C:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9196
#include<iostream>
using namespace std;
main()
{
    int K,M;
    cin>>K>>M;
    int i,j,ans=0;
    for(i=0;i<=K;i++)
    {
        for(j=0;j<=K;j++)
        {
            int Z=M-j-i;
            if(0<=Z && Z<=K && i+j+Z==M)
                ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val S = readLine()!!.toInt()
    var list = mutableSetOf(S)
    var last = S
    for (i in 2..1000000) {
        if (last%2 == 0) {
            last /= 2
        } else {
            last = last*3 + 1
        }
        if (list.contains(last)) {
            println(i)
            break
        }
        list.add(last)
    }
 }

Measured memory_bytes: 34376
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	An := make([]int, N)
	var maxAn, ans int
	for i := range An {
		An[i] = nextInt()
		if maxAn < An[i] {
			maxAn = An[i]
		}
	}
	// 普通の配列だといらないところを数えてしまうので、mapを使う
	AnCnt := make(map[int]int)
	for _, Ai := range An {
		AnCnt[Ai]++
	}
	for i, cnt := range AnCnt {
		if cnt > i {
			ans += cnt - i
		} else if cnt < i {
			ans += cnt
		}
	}
	fmt.Println(ans)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


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

using namespace std;

#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 All(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1e9;

int main(){
   int n,k;
   string s;
   cin >> n >> s >> k;
   char target = s[k-1];
   rep(i,n){
      if(target != s[i])s[i] = '*';
   }
   cout << s;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n, k;
	cin >> n >> k;
	double p[n];
	zep(i, 0, n){
		cin >> p[i];
		p[i] = (p[i]+1)/2;
	}
	
	double now = 0;
	zep(i, 0, k){
		now += p[i];
	}
	//print(now)
	double ans = now;
	rep(i, 1, n-k){
		now -= p[i-1];
		//print(now)
		now += p[i+k-1];
		//print(now)
		ans = max(now, ans);
	}
	cout << setprecision(10) << fixed<< ans << endl;
	return 0;
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

int a[100005];
int b[100005];

int wari[100005][3];

int main() {
  int ans;
  int amax = 100005;
  int bmax = 100005;
  int A,B,M;
  cin >> A >> B >> M;
  rep(i,A) {cin >> a[i];amax=min(amax,a[i]);}
  rep(i,B) {cin >> b[i];bmax=min(bmax,b[i]);}
  ans = amax + bmax;
  rep(i,M){
    rep(j,3) {
      int x,y,c;
      cin >> x  >> y >> c;
      int p=a[x-1]+b[y-1]-c;
      ans = min (ans,p);
    }
  }
cout << ans;

}

Measured memory_bytes: 1024
N, S = map(int, input().split())

A = list(map(int, input().split()))
mod = 998244353

dp = [0] * (S+1)
dp[0] = 1

for a in A:
    for j in range(S, -1, -1):
        if j-a >= 0:
            dp[j] = dp[j]*2 + dp[j-a]
        else:
            dp[j] = dp[j]*2

print(dp[S]%mod)

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N, K;
  cin >> N >> K;
  int ans = 0;
  int x;
  REP(i, N) {
    cin >> x;
    ans += min(x * 2, abs(K - x) * 2);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
from collections import Counter
from itertools import combinations
def main():
    n = int(input())
    L = list(map(int, input().split()))
    c = Counter(L)
    ans = 0
    for e in combinations(c.keys(), 3):
        i, j, k = sorted(list(e))
        if k < i + j:
            ans += c[i] * c[j] * c[k]
    print(ans)




if __name__ == '__main__':
    main()


Measured memory_bytes: 9452
import Data.Char

main = getContents >>= putOut.formatOut.solve.formatIn
  where putOut s | null s || last s == '\n' = putStr s
                 | otherwise                = putStrLn s
  
formatIn :: String -> [[Int]] 
formatIn = map (map digitToInt).takeWhile (/="0").lines

formatOut :: [Int] -> String
formatOut = unlines.map show

solve :: [[Int]] -> [Int]
solve = map sum

Measured memory_bytes: 4092
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u * v / gcd(u, v);
}

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

    int N;
    cin >> N;

    vector<vector<int>> F(N, vector<int>(10));
    cin >> F;

    vector<vector<int>> P(N, vector<int>(11));
    cin >> P;

    ll ans = -INF;
    //全日に対して開けるか開けないか
    FOR(i, 1, 1024) {
        //両方が営業している日をカウント
        vector<int> c(N);
        REP(j, 10) {
            int open = i & (1 << j);
            REP(k, N) {
                if (F[k][j] == 1 && open) {
                    c[k]++;
                }
            }
        }
        ll p = 0;
        REP(j, N) {
            p += P[j][c[j]];
        }
        ans = max(ans, p);
    }

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

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace _3_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var li1 = new List<int>();
            var li2 = new List<int>();
            while(true)
            {
                var ab = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                var a = ab[0];
                var b = ab[1];
                if (a == 0 && b == 0) break;
                if(a<b)
                {
                    li1.Add(a);
                    li2.Add(b);
                }
                if(a>=b)
                {
                    li1.Add(b);
                    li2.Add(a);
                }
            }
            for(var i=0;i<li1.Count;i++)
            {
                Console.WriteLine("{0} {1}", li1[i], li2[i]);
            }
        }
    }
}



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

using namespace std;
typedef long long ll;
typedef pair<int,int>pa;

const int N=2e5+100;

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    int x;cin>>x;
    if(x<=599) cout<<8<<endl;
    else if(x<=799) cout<<7;
    else if (x<=999) cout<<6;
    else if (x<=1199) cout<<5;
    else if (x<=1399) cout<<4;
    else if (x<=1599) cout<<3;
    else if (x<=1799) cout<<2;
    else cout<<1;
    return 0;
}



Measured memory_bytes: 3648
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;

int degitcount(long long int n)
{
    int degit = 0;
    while(n != 0)
    {
        n /= 10;
        degit++;
    }
    return degit;
}

int main()
{
    long long int N;
    int D;
    cin >> N; //入力値N
    D = degitcount(N);    // Nの桁数 
    int c = N / pow(10, D - 1); //最高桁の数字
    int S = c + 9 * (D - 1); //求める最大値を暫定
    long long int num = c * pow(10, D - 1);
    for (int i = D - 2; i >= 0; i--)
    {
        num = num + 9 * pow(10, i);
    }
    if (num > N)
    {
        S = S - 1;
    }
    cout << S << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    static List<int> b;
    static int[] his;
    
    public static void Main()
    {
	int n = int.Parse(ReadLine());
	var tmp = ReadIntArray();

	b = new List<int>();
	for (int i = 0; i < n; i++) b.Add(tmp[i]);

	his = new int[n];
	
	if(sim(n))
	{
	    for(int i = 0; i < n; i++) WriteLine(his[i]);
	}
	else
	{
	    WriteLine(-1);
	}
    }

    static bool sim(int n)
    {
	if (n == 0) return true;
	
	for (int i = n; i >= 1; --i)
	{
	    if (b[i-1] == i)
	    {
		his[n-1] = i;
		b.RemoveAt(i-1);
		return sim(n-1);
	    }
	}
	return false;
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;
template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

const int MOD = 1000000007;

long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}

// 二項係数計算
long long COM(int n, int k) {
  ll ans = n;
  for (ll i = 1; i < k; i++) {
    ans *= ((n - i) % MOD) * modpow(i + 1, MOD - 2) % MOD;
    ans %= MOD;
  }
  return ans % MOD;
}

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll t = (modpow(2, n) - 1 - COM(n, a) - COM(n, b)) % MOD;
  cout << (t >= 0 ? t : t + MOD) << endl;
  return 0;
}

Measured memory_bytes: 256
def f(N, X):
  m = 2 ** (N + 1) - 1
  if X <= N:
    return 0
  elif N == 0:
    return 1
  elif X < m:
    return f(N-1, X-1)
  else:
    return 2 ** N + f(N-1, X-m)

N, X = map(int, input().split())
print(f(N, X))

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

int main() {
  string c;
  cin >> c;
  if (c == "a" || c == "i" || c == "u" || c == "e" || c == "o") {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    for i in range(1, 3501):
        for j in range(i, 3501):
            a = N * i * j
            b = 4*i*j - N*(i+j)
            if b == 0:
                continue
            if a%b == 0 and a//b > 0:
                print(a//b, i, j)
                exit()

if __name__ == '__main__':
    main()

Measured memory_bytes: 39664
while(<>){
	chomp;
	if($. == 1){
		$n = $_;
	}else{
		$s = $_;
	}
}

$cnt = 1;
$pre = "";
for $c (split(//, $s)){
	$cnt++ if(($pre ne "") and ($c ne $pre));
	$pre = $c;
}

print "$cnt\n";


Measured memory_bytes: 9216
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			long answer = 0;
			for(int i = 1; i < N; i++) {
				answer += i;
			}
			
			System.out.println(answer);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))

typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
//#define int long long

int n,m,a,b,c;
string str;


inline void solve(){
  cin >>a >> b>>c;
  
  cout << (a*c < b ? c: b/a) 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<bits/stdc++.h>
using namespace std;
long long n,ans,a[201001],b[201001],nxt[201001],pre[201001];
priority_queue<pair<long long,int> >q;
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&b[i]);
		q.push(make_pair(b[i],i));
	}
	for(int i=1;i<=n;i++)
	{
		pre[i]=i-1;
		nxt[i]=i+1;
	}
	pre[1]=n;
	nxt[n]=1;
	while(!q.empty())
	{
		int x=q.top().second;
		q.pop();
		if(b[x]==a[x])continue;
		int l=pre[x],r=nxt[x];
		if(b[x]-b[l]-b[r]<a[x])
		{
			printf("-1");
			return 0;
		}
		int tmp=(b[x]-a[x]),t=tmp/(b[l]+b[r]);
		ans+=t;
		b[x]-=t*(b[l]+b[r]);
		if(b[x]==a[x])continue;
		q.push(make_pair(b[x],x));
	}
	printf("%lld",ans);
}

Measured memory_bytes: 10608
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;

int main(){
  string s; cin >> s;
  cout << s[0];
  cout << s.size()-2;
  cout << s[s.size()-1] << endl;
  return 0;
}


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

int main(){
  int64_t a,b,k;
  cin >> a >> b >> k;
  if(a>k){
    cout << a-k << " " << b << endl;
  }else{
    k-=a;
    if(b>k){
      cout << 0 << " " << b-k << endl;
    }else{
      cout << 0 << " " << 0 << endl;
    }
  }
  return 0;
}


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

int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	rep(i,n){
		cin >>a[i];
		--a[i];
	}
	vector<int> b(n);
	rep(i,n) cin>>b[i];
	vector<int> c(n-1);
	rep(i,n) cin>>c[i];
	int ans = 0;
	rep(i,n){
		ans += b[a[i]];
		if(i>0 && a[i]==a[i-1]+1) ans += c[a[i-1]];
	}
	cout<<ans<<endl;
	return 0;		
}

Measured memory_bytes: 256
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.8.2)

import math
import statistics
import numpy as np
import queue
import itertools
import functools 

# define
TBMod = int(1e+9 + 7)

s = input()
t = input()
ls, lt = len(s), len(t)

ans = ls
for i in range(ls - lt + 1):
	cnt = lt
	for j in range(lt):
		if s[i + j] == t[j]:
			cnt -= 1
	ans = min(ans, cnt)
print(ans)


Measured memory_bytes: 27360
using System;
using System.Collections.Generic;
using System.Linq;

class E
{
    static void Main()
    {
        var line = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int A = line[0];
        int B = line[1];

        List<int> l = new List<int>();
        l.Add(A * B);
        l.Add(A + B);
        l.Add(A - B);
        Console.WriteLine(l.Max());
    }
}


Measured memory_bytes: 13396
#include<iostream>
using namespace std;int h,w,m,D[1401][1401]={m=0},f,i;
main(){cin>>h>>w;for(i=0;i<h*w;i++){cin>>f;m=max(m,D[i/w+1][i%w+1]=(min(D[i/w][i%w],min(D[i/w+1][i%w],D[i/w][i%w+1]))+1)*(!f));}cout<<m*m<<endl;}


Measured memory_bytes: 10740
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String args[])throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String line;
		String[] input = new String[3];
		double[] data = new double[3];
		boolean noOutput = true;
		
		while(true){
			line = br.readLine();
			if(line==null || line.isEmpty()){
				break;
			}
			input= line.split(",");
			for(int i=0;i<3;i++){
				data[i] = Double.parseDouble(input[i]);
			}
			
			if(data[1]/(data[2]*data[2]) >= 25.0){
				System.out.println((int)data[0]);
				noOutput = false;
			}
		}
		
		if(noOutput){
			System.out.println("該当なし");
		}
	}
}

Measured memory_bytes: 16916
function Main(input) {
  var helix = {
    "A": "T",
    "T": "A",
    "C": "G",
    "G": "C"
  };
  console.log(helix[input]);
}

process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(data){
  Main(data.trim());
});

Measured memory_bytes: 7500
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		final int H = sc.nextInt();
		final int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();

		int ans = (H - h) * (W - w);

		System.out.println(ans);

		sc.close();
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;

int main() {
    int n; cin >> n;
    cout << (n/2)*((n+1)/2) << endl;
}

Measured memory_bytes: 256
def read_input():
    n, m = map(int, input().split())

    cond = []
    for _ in range(m):
        cond.append(tuple(map(int, input().split())))

    return n, cond


def submit():
    n, cond = read_input()

    digit = [-1 for _ in range(n)]
    for idx, x in cond:
        if digit[idx - 1] == -1:
            digit[idx - 1] = x
        elif digit[idx - 1] != x:
            print(-1) # 条件を満たすことは不可能
            return

    if n == 1:
        if digit[0] == -1:
            # 指定なし
            print(0)
        else:
            print(digit[0])
    else:
        if digit[0] == 0:
            # 先頭が0はNG
            print(-1)
        else:
            if digit[0] == -1:
                digit[0] = 1
            
            for i in range(1, n):
                if digit[i] == -1:
                    digit[i] = 0
            print(''.join(map(str, digit)))


if __name__ == "__main__":
    submit()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
long long a,b,x;
long long s,e;
int main(){
    scanf("%lld%lld%lld",&a,&b,&x);
    if(a%x==0)s=a/x;
    else s=a/x+1;
    e=b/x;
    printf("%lld\n",e-s+1);
    return 0;
}


Measured memory_bytes: 256
/***********************************************************
 *This code By @1353055672(Ligen)                          *
 *[Warning]You're not excepted to understand this code!    *
 *CSP-S 2019 RP++                                          *
 ***********************************************************/
//#pragma GCC optimize(3)
#define ADD_STACK int size = 512 << 20;\
	char *pp = (char*)malloc(size) + size;  \
	__asm__("movl %0, %%esp\n" :: "r"(pp))
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<fstream>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<bitset>
#include<ctime>
#include<vector>
#define ll long long
#define ull unsigned long long
#define mn 200020
#define Max(x,y) (((x)>(y))?(x):(y))
#define Min(x,y) (((x)<(y))?(x):(y))
#define Abs(x) (((x)<(0))?(-(x)):(x))
#define infll (ll)(1e18)
#define infint (1<<30)
#define mod (int)(1e9+7)
#define FOR(a,b,c) for (register int a=b;a<=c;++a)
#define FORD(a,b,c) for (register int a=b;a>=c;--a)
using namespace std;
//char buf[1<<20],*p1=buf,*p2=buf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
inline ll read(){
	ll x=0,f=1;char c;
	for(c=getchar();c<'0'||c>'9';f=((c=='-')?-1:f),c=getchar());
	for(;c>='0'&&c<='9';x=x*10+c-'0',c=getchar());
	return x*f;
}
template<typename T>
inline void write(T a){
	if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int h=0;
	while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
}
inline void write_(){return;}
template<typename T,typename... Args>
inline void write_(T a,Args... b){write(a);putchar(' ');write_(b...);}
inline void writeln(){putchar('\n');return;}
template<typename T,typename... Args>
inline void writeln(T a,Args... b){write(a);putchar(' ');writeln(b...);}
//need c++11

//inline void write(ll a){
//    if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int h=0;
//    while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
//}
//inline void write_(ll a){write(a);putchar(' ');}
//inline void writeln(ll a){write(a);putchar('\n');}
inline ll gcd(ll a,ll b){return a==0?b:gcd(b%a,a);}
inline ll lcm(ll a,ll b){return 1ll*a/gcd(a,b)*b;}
inline ll Pow(ll n,ll a){ll b=1;while(a){if(a&1)b=1ll*b*n%mod;n=1ll*n*n%mod;a>>=1;}return b;}
//---------------------Head Files--------------------------//
char s[1020];
signed main(){
#ifdef LOCAL_LIGEN
	// freopen("0.in","r",stdin);
	// freopen("0.out","w",stdout);
	double be=clock();
#endif
	scanf("%s",s+1);
	if(s[1]=='S')puts("Cloudy");else 
	if(s[1]=='C')puts("Rainy");else puts("Sunny");
#ifdef LOCAL_LIGEN
	double en=clock();
	printf("Time: %.0lfms\n",en-be);
	fclose(stdin);fclose(stdout);
#endif
	return 0;
}

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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

//const i64 mod = 1'000'000'000ll + 7;
const i64 smod = 998244353ll;
//const i64 inf = 1'000'000'000'000'000'000ll + 7;
//const i64 inf = 1'000'000'007;

const long double eps = 1e-8;

const i64 MAXN = 1'000'000 + 6;
//const i64 MAXN = 1'000 + 6;

i64 n, m, k;

i64 gcdex(i64 a, i64 b, i64 & x, i64 & y) {
    if (a == 0) {
        x = 0; y = 1;
        return b;
    }
    i64 x1, y1;
    i64 d = gcdex(b%a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}

i64 rev(i64 a, i64 m) {
    i64 x, y;
    i64 g = gcdex(a, m, x, y);
    return x = (x % m + m) % m;
}

i64 binpow(i64 a, i64 n) {
    i64 res = 1;
    while (n) {
        if (n & 1) {
            res *= a;
            res %= smod;
        }
        a *= a;
        a %= smod;
        n >>= 1;
    }
    return res % smod;
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n >> m >> k;

    i64 nom = n;
    i64 den = 0;

    i64 P = 1;
    i64 S = 0;
    for (i64 i = 0; i <= k; i++) {
        i64 t = binpow(m - 1, n - 1 - i);
        t *= m;
        t %= smod;

        S += (P * t) % smod;
        S %= smod;

        nom -= 1;
        den += 1;

        P *= nom;
        P %= smod;
        P *= rev(den, smod);
        P %= smod;
    }

    //i64 t = binpow(m, n - k);
    //S *= t;
    //S %= smod;

    cout << S << endl;

    return 0;
}

Measured memory_bytes: 3656
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const list = input.trim().split('\n');
let [ n, m ] = list[0].split(' ');
n = Number(n);
m = Number(m);
let cm = list[1].trim().split(' ');
cm = cm.map(c => Number(c));

const dp = new Map();
dp.set(n, 0);
for (let yen = n, min = 0; yen >= 0; yen--) {
  if (!dp.has(yen)) {
    continue;
  }

  min = Math.min(dp.get(yen), min);
  dp.set(yen, min);
  if (yen === 0) {
    break;
  }

  min = min + 1;
  for (let i = 0; i < m; i++) {
    const afterYen = yen - cm[i];
    if (afterYen < 0) {
      continue;
    }
    const afterMin = dp.has(afterYen) ? Math.min(dp.get(afterYen), min) : min;
    dp.set(afterYen, afterMin);
  }
}

console.log(dp.get(0));



Measured memory_bytes: 21780
#include<string>
#include<iostream>
using namespace std;
int main()
{
	int a, b, c, d;
	string a1, b1, c1, d1;
	string s;
	while (cin >> s)
	{
		a1 = s.substr(0, 1);
		b1 = s.substr(1, 1);
		c1 = s.substr(2, 1);
		d1 = s.substr(3, 1);
		a = atoi(a1.c_str());
		b = atoi(b1.c_str());
		c = atoi(c1.c_str());
		d = atoi(d1.c_str());
		if (a + b + c + d == 7)
			cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
		else if (a + b + c - d == 7)
			cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
		else if (a + b - c + d == 7)
			cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
		else if (a + b - c - d == 7)
			cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
		else if (a - b + c + d == 7)
			cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
		else if (a - b + c - d == 7)
			cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
		else if (a - b - c + d == 7)
			cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
		else if (a - b - c - d == 7)
			cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
	}
	return 0;
}

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


const int Mx = 1000005;

int main() {
	int res=0;
	int nn;
	cin >> nn;
	vector<int> aa(nn);
	vector<int> cnt(Mx);
	rep(i,nn) cin >> aa[i];
	
	sort(aa.begin(),aa.end());
	
	for(int a : aa){
		if(cnt[a]>=2) continue;
		for(int i=a;i<Mx;i+=a){
			cnt[i]++;
		}
	}
	
	rep(i,nn){
		if(cnt[aa[i]]==1) res++;
	}
	
	
	cout << res << endl;
	
	

}

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

int main() {
  int h,n;
  string ans="No";
  int pow=0;

  cin >> h >> n;

  vector<int> a(n,0);

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

  if(pow>=h) {ans="Yes";}
  else {ans="No";}

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<math.h>
long long primeFactorization(long long a,int num,int count[10000]){ //素因数分解を出力するプログラム
    long long i,sq;
    if(a%2==0){ //偶数の場合
      while(a%2==0){
        count[num]++;
        a/=2;
      }
      num+=1;
      return primeFactorization(a,num,count); //2で割った値で再帰
    }
    sq = sqrt(a);
    for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
        if(a%i==0){
          while(a%i==0){
            count[num]++;
            a/=i;
          }
          num+=1;
          return primeFactorization(a,num,count); //割れた値で再帰
        }
    }
    //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
    if(a!=1){ //aが1でないなら、a自身は素数
        count[num]=1;
        num+=1;
    }
    return num;
}
int main(){
    long long a;
    int num=0,sum=0,i,j,count[10000];
    scanf("%lld",&a);
    for(i=0;i<10000;i++)
      count[i]=0;
    num=primeFactorization(a,num,count);
    for(i=0;i<num;i++){
      j=1;
      while(count[i]-j>=0){
        sum++;
        count[i]-=j;
        j++;
      }
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 2192
function Main(input) {
  const lines = input.split('\n');
  const zoro_count = lines[0];
  for(var i=1; i< lines.length; i++){
    const me = lines[i].split(' ');
    if (me[0] == me[1]){
      lines[i] ="zoro";
    }else{
      lines[i] ="";
    }
  }
  for(var i=1; i< (lines.length-2); i++){
    if ( (lines[i] == "zoro") && (lines[i+1] == "zoro") && (lines[i+2]=="zoro")){
        console.log("Yes");
        return;
    }
  }
  console.log("No");
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29632
n=int(input())
seq=input().split()
nseq=[]
for i in range(n):
    nseq.append(int(seq[i]))
M=max(nseq)
m=min(nseq)
hp=(M-m)*(M-m)*n
for i in range(m,M+1):
    s=0
    for j in range(n):
        s+=(nseq[j]-i)*(nseq[j]-i)
    hp=min(hp,s)
print(hp)

Measured memory_bytes: 38640
fun main(array: Array<String>) {
    var x = 0
    readLine()!!
    val s = readLine()!!
    var temp = 0
    repeat(s.length) {
        if(s[it] == 'I') {
            temp++
        }
        else {
            temp--
        }
        if(x <= temp) x = temp
    }
    print(x)
}

Measured memory_bytes: 31404
#include <bits/stdc++.h>
using namespace std;
int main(){
	int64_t N,ans=0,sum=0,che=0;
    cin>>N;
    vector <int64_t>A(N+1),B(N+1),S(N+2);
    for(int i=0;i<=N;i++){
    	cin>>A[i]; 
        B[i]=0;
        sum+=A[i];
    }
    int64_t s=1,p,q;
    S[0]=1;
    for(int i=N;i>=0;i--){
    	if(i==N) B[i]=A[i];
        else B[i]=A[i]+B[i+1];
    }
    for(int i=0;i<=N;i++){
        if(A[N]==0){
        che=1;
        break;
        }
        if(A[0]==1&&N==0){
        	che=2;
            break;
        }
    	if(s<A[i]) {
          			che=1;
                    break;
        			}
        if(i!=N&&s==A[i]) {
          che=2;
          p=i; 
          break;
        }
      	if(s>A[i]){
        	s=(s-A[i])*2;
            if(i!=N&&s>=B[i+1]){
              q=i+1;
              che=3;
              break;
            }
            if(i==N) {
              s=A[i];
            }
            S[i+1]=s;
        }
    }
	if(che==1) cout<<-1;
    if(che==2) {
    	if(N==0) cout<<1;
        else cout<<-1;
    }
    if(che==3){
    	for(int j=0;j<q;j++){
        	ans+=S[j];
        }
        for(int j=q;j<=N;j++){
        	ans+=B[j];
        }
    	cout<<ans;
    }  
    if(che==0){
    	for(int j=0;j<=N;j++){
        	ans+=S[j];
            
        }
        cout<<ans+1;
    }
  
}


Measured memory_bytes: 5636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

bool comp(pair<int,int> u, pair<int,int> v) {
    return (u.second - u.first) < (v.second - v.first);
}

int main() {
    int N, x; cin >> N >> x;
    vector<int> a(N+5); rep(i, N) cin >> a[i];

    ll ans = 0;
    rep(i, N) {
        if (a[i] > x) {
            ans += a[i] - x;
            a[i] = x;
        }
    }
    rep(i, N) {
        if (a[i] + a[i + 1] > x) {
            ans += a[i] + a[i + 1] - x;
            a[i + 1] = x - a[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <ios>
#include <iomanip>

using namespace std;

bool check(string s){
    int a[3];
    for(int i = 0; i < 3; i++){
        a[i] = 0;
    }
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '3'){
            a[0] = 1;
        }
        if(s[i] == '5'){
            a[1] = 1;
        }
        if(s[i] == '7'){
            a[2] = 1;
        }
        if(a[0] == 1 && a[1] == 1 && a[2] == 1){
            return true;
        }
    }
    return false;
}

int r(int k, string s, int n){
    if(k == 10){
        if(check(s)){
            if(stoi(s) <= n){
                return 1;
            }else{
                return 0;
            }
        }else{
            return 0;
        }
    }
    int ans = 0;
    if(s[s.size() - 1] == '0'){
        ans += r(k + 1, s + '0', n);
    }
    ans += r(k + 1, s + '3', n);
    ans += r(k + 1, s + '5', n);
    ans += r(k + 1, s + '7', n);
    return ans;
}

int main(){
    int n;
    cin >> n;
    cout << r(1, "0", n);
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <queue>
#include <string>

#define REP(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = (s); i < (n); i++)
#define ALLOF(c) c.begin(), c.end()
#define RANGEOF(c,i,n) c.begin() + (i), c.begin() + (i) + (n)
#define EPS 1e-9
#define INF 1000000000
using namespace std;

template <class T> T read() { T t; cin >> t; return t; }
template <class T> vector<T> read(int n) { vector<T> v; REP(i,n) { v.push_back(read<T>()); } return v; }
template <class T> vector<vector<T>> read(int n, int m)
{
	vector<vector<T>> v;
	REP(i,n) { v.push_back(read<T>(m)); }
	return v;
}

template <class T> void write(const T &t) { cout << t << endl; }
template <class T> void write(const T &t, const T &t2) { cout << t << ' ' << t2 << endl; }
template <class T> void write(const vector<T> &v)
{
	ostringstream ss; 
	for (auto x : v) ss << x << ' ';
	auto s = ss.str();
	cout << s.substr(0, s.length() - 1) << endl;
}

struct _Reader { template <class T> _Reader operator ,(T &rhs) { cin >> rhs; return *this; } };
#define READ(t,...) t __VA_ARGS__; _Reader(), __VA_ARGS__

void solve();
int main() { solve(); return 0; }

/// template end ///



void solve()
{
	while (true)
	{
		READ(int, N);
		if (!N) { break; }
		READ(int, W, H); W++; H++;
		vector<vector<int>> field(W, vector<int>(H));
		REP(i,N) { auto s = read<int>(2); field[s[0]][s[1]]++; }

		//REP(i,W) write(field[i]);
		REP(j,H) REP(i, W - 1) field[i+1][j] += field[i][j];
		REP(i,W) REP(j, H - 1) field[i][j+1] += field[i][j];
		//write("");
		//REP(i,W) write(field[i]);

		READ(int, S, T);
		int maxValue = 0;
		REP(i, W-S)
			REP(j, H-T)
				maxValue = max(maxValue, 
					field[i+S][j+T] + field[i][j]
					- field[i][j+T] - field[i+S][j]);

		write(maxValue);
	}
}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int A,B,C,X;
  cin >> A >> B >> C >> X;
  int ans = 0;
  for (int i = 0; i <= A; i++) {
    for (int j = 0; j <= B; j++) {
      for (int k = 0; k <= C; k++) {
        if (500 * i + 100 * j + 50 * k == X) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

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; }

void Main(){
    int N; cin >> N;
    VL L(N); REP(i,N) cin >> L[i]; SORT(L);

    int ans = 0;
    REP(i,N-2)FOR(j,i+1,N-1)FOR(k,j+1,N){
        if(L[i]==L[j] || L[i]==L[k] || L[j]==L[k]) continue;
        if(L[k] < L[i]+L[j]) ans++;
    }
    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <stdlib.h>
#define MAX 100

int main(){
  int G[MAX+1][MAX+1], n, vertex, degree, adj, i, j;
  for(i = 1; i <= MAX; i++){
    for(j = 1; j <= MAX; j++){
      G[i][j] = 0;
    }
  }

  scanf("%d",&n);
  for(i = 1; i <= n; i++){
    scanf("%d %d",&vertex,&degree);
    for(j = 1; j <= degree; j++){
      scanf("%d",&adj);
      G[vertex][adj] = 1;
    }
  }

  for(i = 1; i <= n; i++){
    for(j = 1; j <= n; j++){
      printf("%d",G[i][j]);
      if( j != n ) printf(" ");
    }
    printf("\n");
  }
  
  return 0;
}



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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



string s;
void solve(){
	cin >> s;
	int n = s.size();
	
	vector<char> v;
	for(int i = 0; i < n; i++){
		if(s[i] == 'B') {if(!v.empty()) v.pop_back();}
		else v.push_back(s[i]);
	}
	for(int i = 0; i < v.size(); i++){
		cout << v[i];
	}
	cout << endl;
}

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


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

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

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

int H, W;
char maze[20][20];
int dx[4] = { -1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};

int run(int sx, int sy) {
    int res = 0;
    queue< pair<int, int> > q;
    vector< vector<int> > ok(H, vector<int>(W, mod) );
    ok[sy][sx] = 0;
    q.push(make_pair(sx, sy));

    while(!q.empty()) {
        pair<int, int> p = q.front(); q.pop();
        rep(i, 4) {
            int x = p.first, y = p.second;
            int nx = x + dx[i], ny = y + dy[i];
            if (nx < 0 || W <= nx || ny < 0 || H <= ny) continue;
            if (maze[ny][nx] == '#') continue;
            if (ok[ny][nx] > ok[y][x] + 1) {
                ok[ny][nx] = ok[y][x] + 1;
                chmax(res, ok[ny][nx]);
                q.push(make_pair(nx, ny));
            }
        }
    }
    return res;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> H >> W;
    rep(i, H) rep(j, W) {
        cin >> maze[i][j];
    }
    int ans = 0;
    rep(y, H) rep(x, W) {
        if (maze[y][x] == '#') continue;
        ans = max(ans, run(x, y));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256