akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
  
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <tuple>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <cassert>
#include <numeric>
#include <math.h>
#include <bitset>
#include <random>
#include <regex>

using namespace std;
  
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,f,n) for(int i=f;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(14)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
constexpr int dy[] = {0,1,0,-1,1,-1,-1,1};
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class A, class B> inline A updiv(const A a,const B b){ return (a + b - 1) / b; }
template <class A, class B> inline A gcd(const A a,const B b){ return b ? gcd(b,a % b) : a; }
template <class A, class B> inline A lcm(const A a,const B b){ return a / gcd(a,b) * b; }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A,class B> using umap = unordered_map<A,B>;

signed main(void){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int k;
    string s;
    
    cin >> k >> s;

    if(s.size() <= k){
        cout << s << '\n';
    }else{
        cout << s.substr(0, k) << "...\n";
    }

    return 0;
}

Measured memory_bytes: 3652
import bisect

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

a = sorted(a)
b = sorted(b)
c = sorted(c)

ans = 0

for x in b:
    aa = bisect.bisect_left(a,x)
    cc = len(c) - bisect.bisect_right(c,x)
    ans += aa * cc

print(ans)

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

using namespace std;

#ifdef LOCAL
#include "/Users/thakchir/Desktop/CP/Library/Debug/Debug.cpp"
#else
#define debug(...) 42
#endif

void RunTestCase() {
  int n;
  cin >> n;
  vector<pair<int, int>> points(n);
  for (auto &[x, y] : points) {
    cin >> x >> y;
  }
  sort(points.begin(), points.end());
  int sum = INT_MIN, diff = INT_MIN;
  int best = INT_MIN;
  for (int i = n - 1; i >= 0; --i) {
    int curr_sum = points[i].first + points[i].second;
    int curr_diff = points[i].first - points[i].second;
    if (i != n - 1) {
      best = max({best, sum - curr_sum, diff - curr_diff});
    }
    sum = max(sum, curr_sum);
    diff = max(diff, curr_diff);
  }
  cout << best << "\n";
}

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

Measured memory_bytes: 4772
import sys
import math
from collections import Counter
import itertools
import fractions
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################
 
X=II()
ans=0
x=100
while True:
    ans+=1
    x=int(x*1.01)
    if x >= X:
        print(ans)
        exit()


Measured memory_bytes: 10464
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;

int main(){
  ll a, b, k;
  scanf("%lld %lld %lld", &a, &b, &k);
  if (a >= k){
    a -= k;
  }else if (a < k && a + b >= k){
    b = a + b - k;
    a = 0;
  }else if (a + b < k){
    a = b = 0;
  }
  printf("%lld %lld\n", a, b);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <set>
#include <vector>
#include <queue>
#include <map>
using namespace std;
#define maxn 10100
long long int a[100010],b[100010];
long long int minn;
int main()
{
   int n;
   while(cin>>n)
   {
       int pos;
       minn=-1;
       for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
        long long int ans=0;
        for(int i=0;i<n;i++)
        {
            if(a[i]>minn)
            {
                minn=a[i];
                pos=i;
            }
        }
//        cout<<pos<<" "<<minn<<endl;
//        cout<<b[pos]<<endl;
        ans+=minn+b[pos];
        cout<<ans<<endl;
   }

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const ll MOD = 1000000007LL;
/*メモ XOR問題のまとめ
性質 1「交換則、結合則が成り立つ」
　　 2「a xor a = 0」
　　 3「ある数xのb番目のビットが1である <=> x mod 2^(b+1) ≧ 2^b」
　　 4「0≦aのとき、4a, 4a+1, 4a+2, 4a+3のxor和は0」
方針 
!!!!!1「xor計算は各ビットで独立なので別々に計算」
　　 2「trieを使ったxorの最大最小探索がある解説」
*/
long long modpow(long long a, long long n, long long mod) { //累乗の余剰
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
    string s;
    std::cin >> s;
    int n=s.size();
    ll ans=0;
    ll po=0;
    rep(i,n){
        if(s[i]=='1'){
            ans+=(modpow(3,n-i-1,MOD)*modpow(2,po,MOD))%MOD;
            ans+=(2*modpow(2,po-1,MOD))%MOD;
            po++;
        }
        ans%=MOD;
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 512
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // テストケース数
        int n = sc.nextInt();
        // AC or WA or TLE or RE
        String[] s = new String[n];

        int acCount = 0;
        int waCount = 0;
        int tleCount = 0;
        int reCount = 0;
        for (int i = 0; i < n; i++) {
            s[i] = sc.next();
            if (s[i].equals("AC")) {
                acCount++;
            } else if (s[i].equals("WA")) {
                waCount++;
            } else if (s[i].equals("TLE")) {
                tleCount++;
            } else if (s[i].equals("RE")) {
                reCount++;
            }
        }
        System.out.println("AC x " + acCount);
        System.out.println("WA x " + waCount);
        System.out.println("TLE x " + tleCount);
        System.out.println("RE x " + reCount);
    }
}


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

#define lli long long int
#define pb push_back
#define pii pair <int, int>
#define pll pair <lli, lli>
#define _F first
#define _S second
#define mset(x) memset(x, 0, sizeof(x))
#define fastio() ios_base::sync_with_stdio(0)

using namespace std;

int main()
{
	lli n, k;
	cin >> n >> k;

	lli max_n = 1e5 + 5;
	lli A[max_n];
	mset(A);

	while(n--)
	{
		lli x, y;
		cin >> x >> y;

		A[x] += y;
	}

	for(lli i=0; i<max_n; i++)
	{
		k -= A[i];

		if(k <= 0)
		{
			cout << i << endl;
			return 0;
		}
	}
	return (0-0);	
}

Measured memory_bytes: 1024
h, w = map(int, raw_input().split())
pic0 = []
for i in range(h):
    pic0.append(raw_input().rstrip())

pic = [["#" for i in range(w + 2)] for j in range(h + 2)]
for i in range(h):
    for j in range(w):
        pic[i + 1][j + 1] = pic0[i][j]

for i in range(h+2):
    line = "".join(pic[i])
    print line


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

int a(int c){
    int s = pow(c+1,2);
    return s;
}

int main(){
    int n;
    cin >> n;
    int ans;
    rep(i,n){
        int b = a(i);
        if(n >= b) ans = b;
        else break; 
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int main(void) {
  int n;
  scanf("%d", &n);
  int res = 0;
  REP(i, n) {
    int v;
    scanf("%d", &v);
    res += v-1;
  }
  printf("%d\n", res);
  return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
int M,N;
int a[200004], ball[200004];

int main(){
  cin >> N;
  cin.ignore();
  rep(i, N) cin >> a[i];

  for (int i=N; i>0; --i){
    int ballcnt=0;
    for(int j=2*i; j<=N; j+=i) ballcnt += ball[j-1];
    if(ballcnt%2 != a[i-1]) ball[i-1] = 1;
  }

  rep(i, N) M+=ball[i];

  cout << M << endl;

  rep(i, N){
    if(!ball[i]) continue;
    cout << i+1 << " ";
  }
  return 0;
}

Measured memory_bytes: 2432
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
int a,b,n;
int h;
bool ans[4010];
vector<int>v;
bool check()
{
	return (int)v.size()>b;
}
int main()
{
	scanf("%d%d",&a,&b);
	n=a+b;
	if(a<=b)
	{
		printf("Impossible");
		return 0;
	}
	for(int i=0;i<n;i++)
	{
		if(v.empty())
		{
			v.push_back(i);
			if(check())break;
		}
		else
		{
			char op;
			printf("? %d %d\n",i,v.back());
			cin>>op;
			if(op=='Y')
			{
				v.push_back(i);
				if(check())break;
			}
			else
			{
				v.pop_back();
				b--;
			}
		}
	}
	h=v[0];
	for(int i=0;i<n;i++)
	{
		if(!a)break;
		if(i==h)
		{
			a--;
			ans[h]=true;
			continue;
		}
		if(n-i==a)
		{
			for(int j=i;j<n;j++)ans[j]=true;
			break;
		}
		char op;
		printf("? %d %d\n",h,i);
		cin>>op;
		if(op=='Y')
		{
			a--;
			ans[i]=true;
		}
	}
	printf("! ");
	for(int i=0;i<n;i++)printf(ans[i]?"1":"0");
	return 0;
} 

Measured memory_bytes: 724
#include <vector> 
#include <list> 
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <complex>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

const LL mod = 1000000007;


#define Yes_ cout<<"Yes"<<endl; return 0;
#define No_ cout<<"No"<<endl; return 0;


#define YES_ cout<<"YES"<<endl; return 0;
#define NO_ cout<<"NO"<<endl; return 0;

LL dp[51][51][2501];//x1,...,xj から k 枚選んで xi の合計を s にするような選び方の総数
int main() {

	CLR(dp);
	int N,A;
	cin >> N>>A;
	VI X(N+1);
	FOR(i,1, N+1) { cin >> X[i]; }
	dp[0][0][0] = 1;
	FOR(j,1, N+1)FOR(k,0, N+1)REP(s, 2501) {

		if (j >= 1 && s < X[j]) {//j番目を使えない
			dp[j][k][s] = dp[j - 1][k][s];
		}
		else if (j >= 1 && s >= X[j] && k >= 1) {//j番目を使える
			dp[j][k][s] = dp[j - 1][k][s]+ dp[j - 1][k-1][s-X[j]];
		}
		//if (dp[j][k][s] != 0) { cerr << j << " " << k << " " << s << endl; debug(dp[j][k][s]); }
		//debug(s);
	}
	LL ans = 0;
	FOR(k, 1, N + 1) {
		ans += dp[N][k][k*A];
	}
	cout << ans << endl;
}

Measured memory_bytes: 51072
import java.util.*;
import java.util.Collections;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    List<Integer> list = new ArrayList<Integer>();
    List<Integer> list1 = new ArrayList<Integer>();
    int total = 0;
    for (int i = 0; i < N; i++) {
      list.add(sc.nextInt());
    }
    for (int i = 0; i < N; i++) {
      int K = sc.nextInt();
      if (list.get(i) > K) {
        total += list.get(i) - K;
      }
    }
    System.out.println(total);
  }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    for(ll i=1; i<=3500; i++){
        for(ll j=1; j<=3500; j++){
            ll tmp = (4*i*j)-(n*j)-(n*i);
            if(tmp == 0) continue;
            double k = (1.0*n*i*j)/tmp;
            if(k == floor(k) && k >= 1){
                cout << i << " " << j << " " << (ll)k << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
map<int ,int >s;
int cmp(int ss,int s1)
{
    return s[ss]>s[s1];
}
int main()
{
    int n,k,i,kk=0;
    int a[200001]={0},b[200001],c[200001];
    scanf("%d%d",&n,&k);
    for(i=0;i<n;i++){
        scanf("%d",&b[i]);
        if(s[b[i]]==0){
            c[kk++]=b[i];
        }
        s[b[i]]++;
    }
    //printf("%d\n",kk);
    if(kk<=k){
        puts("0");
    }else {
        sort(c,c+kk,cmp);
        int ans=0;
        for(i=k;i<kk;i++){
            ans+=s[c[i]];
        }
        printf("%d\n",ans);
    }
}


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

public class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    String m=s.toUpperCase();
    if(s.equals(m))
      System.out.println("A");
    else
       System.out.println("a");
  }
}

Measured memory_bytes: 35408
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0297

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    N = int(input())
    for _ in range(N):
        K, P = map(int, input().split())
        ans = K % P
        if ans == 0:
            ans = P
        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
    

Measured memory_bytes: 7728
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
 #define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        3e18
 #define sm         -2e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("gin.txt", "r", stdin);
    freopen("gout.txt", "w", stdout);
   
    #endif
}
 

void solve()
{
 
int n;
cin >> n;

string s;
cin >> s;

int vl = 0 ;
char  pr= '0';
forf(i,0,n)
{
 if(s[i]!=pr)
 {
  pr=s[i];
  vl++;
 }

}

cout<<vl;

}


int32_t main()
{
  pr_init();
  fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
   // cout << "Time taken by function: "
   //       << duration.count() << " microseconds" << endl; 

 }
      
      

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n, t, ans = 1001;
	cin >> n >> t;

	for(int i=0;i<n;i++){
		int cost, time;
		cin >> cost >> time;
		if(t>=time && cost<ans) ans = cost;
	}
	if(ans<1001) cout << ans << endl;
	else cout << "TLE" << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int H = int.Parse(str[0]);
		int W = int.Parse(str[1]);
		int[,]A = new int[H,W];
		for(var i=0;i<H;i++){
			string str2 = Console.ReadLine();
			for(var j=0;j<W;j++){
				if(str2.Substring(j,1)=="#"){
					A[i,j]=1;
				}
			}
		}
		int[,]W1 = new int[H,W];
		int[,]W2 = new int[H,W];
		int[,]H1 = new int[H,W];
		int[,]H2 = new int[H,W];
		for(var i=0;i<H;i++){
			int ct = 0;
			int z = 0;
			for(var j=0;j<W;j++){
				if(A[i,j]==0){
					ct++;
					W1[i,j] = z;
					if(j==W-1){
						W2[i,z] = ct;
					}
				} else {
					W2[i,z] = ct;
					z = j+1;
					ct = 0;
				}
				
			}
		}
		for(var j=0;j<W;j++){
			int ct = 0;
			int z = 0;
			for(var i=0;i<H;i++){
				if(A[i,j]==0){
					ct++;
					H1[i,j] = z;
					if(i==H-1){
						H2[z,j] = ct;
					}
				} else {
					H2[z,j] = ct;
					z = i+1;
					ct = 0;
				}
			}
		}
		long ans = 1;
		for(var i=0;i<H;i++){
			for(var j=0;j<W;j++){
				int a = H2[H1[i,j],j]+W2[i,W1[i,j]];
				ans = Math.Max(a,ans);
			}
		}
		Console.WriteLine(ans-1);
	}
}

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

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

int main() {
  string s;
  cin >> s;
  map<char, int> m;
  rep(i, s.size()) m[s[i]]++;
  rep(i, 26) {
    if (m['a' + i] == 0) {
      cout << char('a' + i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 3696
answers = dict()
def gcd(a,b):
    ab = tuple(sorted([a,b]))
    if b == 0:
        if ab not in answers:
            answers[ab] = a
        return a
    else:
        if ab in answers:
            return answers[ab]
        else:
            answers[ab] = gcd(b,a%b)
            return answers[ab]

K = int(input())

result = 0
for i in range(1,K+1):
    for j in range(i,K+1):
        ijgcd = gcd(i,j)
        for k in range(j,K+1):
            U = len(set([i,j,k]))
            ab = tuple(sorted([ijgcd,k]))
            if ab in answers:
                ijkgcd = answers[ab]
            else:
                ijkgcd = gcd(ijgcd,k)
            if U == 1:
                result += ijkgcd
            elif U ==2:
                result += ijkgcd*3
            elif U ==3:
                result += ijkgcd*6
print(result)

Measured memory_bytes: 10972
module ABC095

	! <module>s to import
	use, intrinsic :: iso_fortran_env


	! require all variables to be explicitly declared
	implicit none


	! accessibility of <subroutine>s and <function>s in this <module>
	public :: ABC095_A


	! constants for this <module>
	character(len=1, kind=1), parameter, private :: chr_added  = 'o'
	integer( kind=INT32 ),    parameter, private :: num_topped = 3
	integer( kind=INT32 ),    parameter, private :: val_base   = 700
	integer( kind=INT32 ),    parameter, private :: val_topped = 100


	! contained <subroutine>s and <function>s are below
	contains


	subroutine ABC095_A

		! variables for this <subroutine>
		character(len=num_topped, kind=1) :: buffer
		integer( kind=INT16 )             :: itr, val_total

		! STEP.01
		! read out the target positive integers
		read *, buffer

		! STEP.02
		! count the number of the `1`
		val_total = val_base
		if( ichar( buffer(1:1) ) .eq. ichar(chr_added) ) val_total = val_total+val_topped
		if( ichar( buffer(2:2) ) .eq. ichar(chr_added) ) val_total = val_total+val_topped
		if( ichar( buffer(3:3) ) .eq. ichar(chr_added) ) val_total = val_total+val_topped

		! STEP.03
		! output the result
		write( unit=OUTPUT_UNIT, fmt='(I0)', advance='yes' ) val_total

		! STEP.END
		return

	end subroutine ABC095_A

end module ABC095


program main

	! <module>s to import
	use, non_intrinsic :: ABC095

	! require all variables to be explicitly declared
	implicit none

	call ABC095_A

end program main


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

int main()
{
	int a,b;
	string s,t,u;
	cin>>s>>t;
	cin>>a>>b;
	cin>>u;
	if(u==s)cout<<a-1<<" "<<b<<endl;
	else cout<<a<<" "<<b-1<<endl;
    return 0;
}

Measured memory_bytes: 256
//https://blog.csdn.net/weixin_38686780/article/details/100107472
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int dp[50+1][50+1][2500+10];// dp[i][j][k] 已经匹配到前i个，有j个没有匹配，当前已知的value是k
void Add(int &a,int b){
	a += b;
	if(a >= mod)
		a -= mod;
}
int main(void)
{
    int N,K;
    cin>>N>>K;
    dp[0][0][0] = 1;
    for(int i  = 1;i <= N;++i){
    	for(int j = 0;j <= i; ++j){
    		for(int k = 2*j;k <= K; ++k){
    			int &a = dp[i][j][k];
    			Add(a,1ll*(2*j+1)*dp[i-1][j][k-2*j]%mod);// i1,i2 匹配，或者i1与一个未匹配的匹配，或者i2与一个没匹配的匹配,没有匹配的个数不变
    			Add(a,1ll*(j+1)*(j+1)*dp[i-1][j+1][k-2*j]%mod);// i1,i2 匹配一个非 i2,i1 的，未匹配的数量-1
    			if(j)
    				Add(a,dp[i-1][j-1][k-2*j]);// i1,i2 不匹配，未匹配的数量+1
    		}
    	}
    }
    cout<<dp[N][0][K]<<endl;
   return 0;
}

Measured memory_bytes: 23808
#include <stdio.h>
 
int main(void)
{
    int i, m, n, sum, f;
    int d[1000];
     
    while (scanf("%d %d", &n, &m), m + n != 0){
        for (i = 0; i < n; i++){
            d[i] = 1;
        }
         
        i = sum = f = 0;
        while (1){
            sum += d[i];
            if (sum == m){
                d[i] = 0;
                sum = 0;
                f++;
            }
            if (f == n) break;
            if (i == n - 1){
                i = 0;
                continue;
            }
            i++;
        }
        printf("%d\n", i + 1);
    }
     
    return 0;
}

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

#define rep(i,n) for (int i=0;i<(n);++i)
#define rep2(i,a,b) for (int i=(a);i<(b);++i)
#define rrep(i,n) for (int i=(n)-1;i>=0;--i)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;--i)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(_v) cout<<(#_v)<<":";for(auto(_x):(_v)){cout<<" "<<(_x);}cout<<endl;
#define printVS(vs) cout<<(#vs)<<":"<<endl;for(auto(s):(vs)){cout<<(s)<< endl;}
#define printVV(vv) cout<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;}
#define printP(p) cout<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cout<<(#vp)<<":"<<endl;for(auto(p):(vp)){cout<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cout << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cout << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1e9;
const int mod = 1e9 + 7;
// using Graph = vector<vector<int>>;

// 15:41-

struct edge {
    int to, cost;
    edge(){}
    edge(int _to, int _cost) : to(_to), cost(_cost) {}
};
using Graph = vector<vector<edge>>;

int dijkstra(const Graph& G, int s, int g) {
    int n = G.size();
    using State = pair<int, int>;
    priority_queue<State, vector<State>, greater<State>> pq;   // cost, vertex
    vector<int> d(n, inf);
    d[s] = 0;
    pq.push(State(0, s));

    while (!pq.empty()) {
        auto p = pq.top(); pq.pop();
        int v = p.second;
        if (v == g) break;
        if (d[v] < p.first) continue;
        for (const auto& e : G[v]) {
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                pq.push(State(d[e.to], e.to));
            }
        }
    }
    return d[g];
}

int n;
int p[100000];
int a[100000]; // a[i] = ??????i????????£?????¨???????????????
bool visited[100000];

int dfs(int i) {
    if (p[i] == 0) return a[i] = i;
    if (a[i] != -1) return a[i];
    if (visited[i]) return inf;
    visited[i] = true;
    return a[i] = dfs(i + p[i]);
}

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

    cin >> n;
    rep(i, n) cin >> p[i];

    memset(a, -1, sizeof(a));
    rep(i, n) {
        if (a[i] == -1) {
            dfs(i);
        }
    }

    Graph G(n);
    rep(i, n) {
        rep2(j, 1, 6 + 1) {
            if (i + j >= n) {
                G[i].emplace_back(n - 1, 1);
            }
            else if (a[i + j] != inf) {
                G[i].emplace_back(a[i + j], 1);
            }
        }
    }

    cout << dijkstra(G, 0, n - 1) << endl;
}

Measured memory_bytes: 22956
#include<stdio.h>
#include<math.h>

int main(){
	double x[4];
	double y[4];
	double temp;
	double a[2];
	double b[2];
	double c[2];
	double xp,yp,r;
	int n;
	int i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf",&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
		a[0] = 2*(x[2] - x[1]);
		a[1] = 2*(x[3] - x[1]);
		b[0] = 2*(y[2] - y[1]);
		b[1] = 2*(y[3] - y[1]);
		c[0] = x[1]*x[1] - x[2]*x[2] + y[1]*y[1] - y[2]*y[2];
		c[1] = x[1]*x[1] - x[3]*x[3] + y[1]*y[1] - y[3]*y[3];
		temp = a[0]*b[1] - a[1]*b[0];
		xp = (b[0]*c[1] - b[1]*c[0])/temp;
		yp = (a[1]*c[0] - a[0]*c[1])/temp;
		r = hypot(xp-x[1],yp-y[1]);
		temp = xp * pow(10,4);
		temp = (double)(int)(temp+0.5);
		xp = temp * pow(10,-4);
		temp = yp * pow(10,4);
		temp = (double)(int)(temp+0.5);
		yp = temp * pow(10,-4);
		temp = r * pow(10,4);
		temp = (double)(int)(temp+0.5);
		r = temp * pow(10,-4);
		printf("%-.3f %-.3f %-.3f\n",xp,yp,r);
	}
	return 0;
}

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

#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define fo(i, a, b, k) for(int i = a; i <= b; i += k)
#define _fo(i, a, b, k) for(int i = a; i >= b; i -= k)
#define foa(i, a) for (auto &i : a)
#define fod(i, a) for(int i = 1; i*i <= a; i++)
#define sz(a) ((int) a.size())
#define all(a) begin(a), end(a)
#define fi first
#define se second
#define pb(x) push_back(x)
#define mk(x, y) make_pair(x, y)  
#define log2i(x) (31-__builtin_clz(x))
#define log2ll(x) (63-__builtin_clzll(x)) 
#define msz(x) __builtin_popcount(x) 
#define mszll(x) __builtin_popcountll(x) 
#define fom(i, a, b) for(int i = a; i < (1<<b); i++)
#define ifon(i, mask) if(mask&(1<<i))
#define ss(i, mask) while(i=(i-mask)&mask)
#define ifss(i, mask) if(i > (mask^i)) 

typedef int64_t ll;

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, cnt = 0;
	
	cin >> n;
	fo(i, 1, n, 1) {
		int val;
		cin >> val;
		if(val != i) cnt++;
	}
	if(cnt <= 2) cout << "YES";
	else cout << "NO";
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define int long long
#define ld double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD =1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1LL;}return res%p;}
const int N=2*1e5+2,M=20;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ordered_set s;
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	// freopen("out10.txt","w",stdout);
	#endif
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	vector<pii> v;
	for(int i=0;i<n;i++)
	{
		v.pb({a[i],i});
	}
	sort(all(v));
	set<int> s;
	s.insert(-1);
	s.insert(n);
	int ans=0;
	for(int i=0;i<n;i++)
	{
		int x=v[i].se;
		auto lol=s.upper_bound(x);
		int r=*lol;
		lol--;
		int l=*lol;
		ans+=(r-x)*(x-l)*v[i].fi;
		s.insert(v[i].se);
	}
	cout<<ans;
}
// a1,a2,a3,a4.....
//     

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

const int MAX=510000;
const ll MOD=1000000007;


ll modpow(ll a,ll n,ll m){
  ll res=1;
  while(n>0){
    if(n&1){
      res=(res*a)%m;
    }
    a=(a*a)%m;
    n/=2;
  }
  return res;
}

ll modinv(ll a,ll m){
  return modpow(a,m-2,m);
}

ll comb(ll n,ll k,ll m){
  ll a=1;
  for(ll i=0;i<k;++i){
    a=a*(n-i)%m;
  }
  return a;
}

ll kai(ll a){
  ll an=1;
  for(ll i=1;i<=a;++i){
    an=an*i%MOD;
  }
  return an;
}
int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  ll ans=modpow(2,n,MOD);
  ll A=modpow(kai(a),MOD-2,MOD);
  ll B=modpow(kai(b),MOD-2,MOD);
  ll X=comb(n,a,MOD);
  ll x=comb(n,b,MOD);
  ans=(ans-X*A%MOD)%MOD;
  ans=(ans-x*B%MOD)%MOD;
  if(ans<0){
    ans=ans+MOD;
  }
  ans--;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

        n = n - 2;
        if (n < 0) {
            n = 1;
        }
        m = m - 2;
        if (m < 0) {
            m = 1;
        }

        System.out.print(n * m);
    }
}


Measured memory_bytes: 21844
#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>;

const ll MX = 1e18;

int main(){
    int n;
    cin >> n;
    ll ans = 1;
    bool ng = false;
    rep(i,n) {
        ll a;
        cin >> a;
        if (a == 0) {
            cout << 0 << endl;
            return 0;
        }
        if (ng || MX/ans < a) {
            ng = true;
        }
        ans *= a;
    }
    if (ng) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3580
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	private static int n, m;
	private static int[] a, b;
	private static int[][] dp;
	
	public static void main(String[] args) {
		inputData();
		solve();
	}
	
	private static void inputData() {
		try (Scanner scan = new Scanner(System.in)) {
			n = scan.nextInt();
			a = new int[n];
			for(int i=0; i<n; i++) a[i] = scan.nextInt();
			m = scan.nextInt();
			b = new int[m];
			for(int i=0; i<m; i++) b[i] = scan.nextInt();
		}
		dp = new int[n+1][2000+1];
		for(int[] row : dp) Arrays.fill(row, -1);
	}
	
	private static void solve() {
		for(int i=0; i<m; i++) {
			if(serchNumber(0, b[i]) == 1) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}
		}
	}
	
	private static int serchNumber(int i, int m) {
		if(m < 0) return 0;
		if(dp[i][m] != -1) return dp[i][m];
		     if(m == 0)                        dp[i][m] = 1;
		else if(i == n)                        dp[i][m] = 0;
		else if(serchNumber(i+1, m) == 1)      dp[i][m] = 1;
		else if(serchNumber(i+1, m-a[i]) == 1) dp[i][m] = 1;
		else                                   dp[i][m] = 0;     
		return dp[i][m];     
	}
}



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

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

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

  string s,t;
  cin >> s >> t;
  REP(i,sz(s)) {
    string ss = s[sz(s)-1] + s.substr(0,sz(s) - 1);
    if (ss == t) {
      cout << "Yes" << endl;
      return 0;
    }
    s = ss;
  }
  cout << "No" << endl;
  return 0;
}


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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}

int main(){
    int N,M;
    cin>>N>>M;
    vector<int> bg(N,0),ed(N,0);
    REP(i,M){
        int a,b;
        cin>>a>>b;
        a--;b--;
        if(a==0)bg[b]=1;
        if(b==N-1)ed[a]=1;
    }
    bool ok=false;
    FOR(i,1,N-1)if(bg[i]==1&&ed[i]==1)ok=true;
    if(ok)cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    int n; std::cin >> n;
    std::vector<int> a(n);
    for (int i = 0; i < n; i++) std::cin >> a[i];
    int m = std::accumulate(a.begin(), a.end(), 0);
    std::vector<int> cnt(m + 2);
    cnt[0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = m - a[i]; j >= 0; j--) {
            cnt[j + a[i]] += cnt[j];
        }
    }
    int ans = 0;
    for (int i = 0; i <= m; i++) {
        if (i % 10 == 0 || cnt[i] == 0) continue;
        ans = i;
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<time.h>
#include<climits>
#include<string>
//#define IONAME "cttf"
//#define E_DEBUG
//#define TIMECOMP

int n,W;
long long dp[111000];

void marota(){
    std::cin>>n>>W;
    int mxv=0;
    for (int i=1;i<=100100;i++){
        dp[i]=1e18+123;
    }
    int ans=0;
    for (int i=1;i<=n;i++){
        long long w,v;
        std::cin>>w>>v;
        mxv+=v;
        for (int j=mxv;j>=v;j--){
            dp[j]=std::min(dp[j-v]+w,dp[j]);
            if (dp[j]<=W) ans=std::max(ans,j);
        }
    }   
    std::cout<<ans;
}

int main(){
    #ifdef TIMECOMP
    clock_t tStart = clock();
    #endif
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout.tie(0);
    #if defined(IONAME)
    freopen(IONAME".INP","r",stdin);
    freopen(IONAME".OUT","w",stdout);
    #endif
    marota();
    #ifdef TIMECOMP
    printf("Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    #endif
    return 0;
}

Measured memory_bytes: 4424
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <bits/stdc++.h>

using namespace std;
using ll = long long ;
const int INF = 1001001001;

int main() {

    ll a;
    double b ;
    cin >> a >> b;
    ll ib = b*100+0.5 ;
    a*=ib;
    a/=100;
    printf("%lld\n",a);
    return 0 ;
}

Measured memory_bytes: 3784
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

const lint MOD = pow(10, 9) + 7;

lint gcd(lint a, lint b) {
	//aとbの最大公約数を返す
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(a % b, b);
}

lint lcm(lint a, lint b) {
	//aとbの最小公倍数を返す
	return a / gcd(a, b) * b;
}

/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/


int main() {
	int N, H, W;
	cin >> N >> H >> W;
	vector<int>A(N);
	vector<int>B(N);
	rep(i, N) {
		cin >> A[i] >> B[i];
	}
	int cnt = 0;
	rep(i, N) {
		if (A[i] >= H && B[i] >= W) {
			cnt++;
		}
	}
	cout << cnt << endl;
}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            out.println(in.nextInt() % in.nextInt() == 0 ? 0 : 1);
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



Measured memory_bytes: 23252
#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector <ll>
#define vii vector <int>
#define vpii vector <pii>
#define vpll vector <pll>
#define ff first
#define ss second
#define matrix vector <vll>
#define all(v) v.begin(),v.end()
#define PQ priority_queue
using namespace std;
ll pow(ll a, ll b){
	ll res = 1;
	while(b > 0){
		if(b&1) res*=a;
		b/=2;
		a*=a;
	}
	return res;
}
int main()
{
	//ios::sync_with_stdio(0);
	//cin.tie(0);
	int n;
	cin >> n;
	vll v(n+1), a(n);
	for(int i = 0; i <= n; i++) cin >> v[i];
	for(int i = 0; i < n; i++) cin >> a[i];
	ll cnt = 0;
	for(int i = 0; i < n; i++){
		if(a[i] >= v[i]){
			cnt+=v[i];
			a[i]-=v[i];
			v[i] = 0;
			if(a[i] >= v[i+1]){
				cnt+=v[i+1];
				a[i]-=v[i+1];
				v[i+1] = 0;
			}
			else{
				v[i+1]-=a[i];
				cnt+=a[i];
			}
		}
		else{
			v[i]-=a[i];
			cnt+=a[i];
		}
	}
	cout << cnt << "\n";
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int num;
    cin>>num;
    string s1,s2;
    cin>>s1>>s2;
    for(int i=0;i<num;i++){
        cout<<s1[i]<<s2[i];
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD (ll)(998244353)
#define MAX (ll)(1e5 + 4)
#define INF (ll)(1e17)
using namespace std;
using ll =  long long;
using ld = long double;


int main () {
	int a, b;
	cin >> a >> b;
	string s1, s2;
	for (int i = 0; i < a; i++) {
		s1.push_back (b + '0');
	}
	for (int i = 0; i < b; i++) {
		s2.push_back (a + '0');
	}
	if (s1 < s2) {
		cout << s1 << "\n";
	}
	else {
		cout << s2 << "\n";
	}
}		
	


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
cnt = 0
for i in reversed(range(N)):
    cnt += min(A[i+1],B[i])
    B[i] = B[i]-A[i+1]
    if(B[i] >= 0):
        cnt += min(A[i],B[i])
        A[i] = max(0,A[i]-B[i])
print(cnt)

Measured memory_bytes: 19156
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX+1];

void maxHeapify(int i){
  int l, r, largest;
  l = 2 * i;
  r = 2 * i + 1;

  if(l <= H && A[l] > A[i]) largest = l;
  else largest = i;
  if(r <= H && A[r] > A[largest]) largest = r;

  if(largest != i){
    swap(A[i],A[largest]);
    maxHeapify(largest);
  }
}

int extract(){
  int maxv;
  if(H < 1) return -INFTY;
  maxv = A[1];
  A[1] = A[H--];
  maxHeapify(1);

  return maxv;
}

void increaseKey(int i, int key){
  if(key < A[i]) return;
  A[i] = key;
  while(i > 1 && A[i/2] < A[i]){
    swap(A[i], A[i/2]);
    i = i / 2;
  }
}

void insert(int key){
  ++H;
  A[H] = -INFTY;
  increaseKey(H, key);
}

int main(){
  int key;
  char com[10];

  while(true){
    scanf("%s", com);
    if(com[0] == 'e' && com[1] == 'n') break;
    if(com[0] == 'i'){
      scanf("%d", &key);
      insert(key);
    }
    else{
      printf("%d\n", extract());
    }
  }


  return 0;
}



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

struct Node {
    int key;
    struct Node *right, *left, *parent;
};
typedef struct Node Node;

Node *root, *NIL;

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z->key   = k;
    z->left  = NIL;
    z->right = NIL;
    
    while(x != NIL) {
        y = x;
        if(z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }
    
    z->parent = y;
    if(y == NIL) {
        root = z;
    } else {
        if( z->key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inorder(Node *u) {
    if(u == NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node *u) {
    if(u == NIL) return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}

Node *find(Node *u, int k){
    while(u != NIL && k != u->key){
        if(k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}
    
int main(void) {
    int n, i, x;
    char com[16];
    scanf("%d",&n);
    
    for(i=0;i<n;i++) {
        scanf("%s",com);
        if(com[0] == 'f') {
            scanf("%d",&x);
            Node *t = find(root,x);
            if(t != NIL) printf("yes\n");
            else printf("no\n");
        } else if(!strcmp(com,"insert")) {
            scanf("%d",&x);
            insert(x);
        } else if(!strcmp(com,"print")) {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}



Measured memory_bytes: 20448
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;
int n, A, B, C;
vector<int> l;

int dfs(int cur, int a, int b, int c) {
  if (cur == n) {
    return min({a, b, c}) <= 0 ? INF
                               : abs(a - A) + abs(b - B) + abs(c - C) - 30;
  }

  int ret0 = dfs(cur + 1, a, b, c);
  int ret1 = dfs(cur + 1, a + l[cur], b, c) + 10;
  int ret2 = dfs(cur + 1, a, b + l[cur], c) + 10;
  int ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10;
  return min({ret0, ret1, ret2, ret3});
}

int main() {
  cin >> n >> A >> B >> C;
  l.resize(n);
  for (int i = 0; i < n; i++) cin >> l[i];

  cout << dfs(0, 0, 0, 0) << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

int d_hp(int x, float p){

    return (x - p)*(x - p);
}

int main(){
    int N;
    cin >> N;
    vector<int> Nx(N);
    for(int i = 0; i<N; i++){
        cin >> Nx.at(i);
    }

    float sum = 0;

    for(int i = 0; i<N; i++){
        sum += Nx.at(i);
    }
    float m = round(sum/N);
    sum = 0;
    for(int i = 0; i<N; i++){
        sum += d_hp(Nx.at(i), m);
    }
	
  	sum = round(sum);
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 384