akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();
        int N = r.i();
        int[][] xyh = new int[N][3];
        for(int i = 0; i < N; i++) xyh[i] = r.ii();
        int x, y, h;
        {
            int j = -1;
            while(xyh[++j][2] == 0){}     
            int[] a = xyh[j];
            x = a[0];
            y = a[1];
            h = a[2];
        }
        for(int Cx = 0; Cx < 101; Cx++){
            loop: for(int Cy = 0; Cy < 101; Cy++){
                int H = Math.abs(Cx-x) + Math.abs(Cy-y) + h;
                for(int i = 0; i < N; i++){
                    int[] xyhi = xyh[i]; 
                    if(xyhi[2] != Math.max(H - Math.abs(Cx-xyhi[0]) - Math.abs(Cy-xyhi[1]), 0)) continue loop;
                }
                System.out.println(Cx + " " + Cy + " " + H);
                return;
            }
        }        
    }

    static void print(Object o){
        System.out.println(o.toString());
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }

        String s() throws IOException{
            return readLine();
        }

        String[] ss() throws IOException{
            return s().split(" ");
        }

        int Int(String s){
            return Integer.parseInt(s);
        }

        int i() throws IOException{
            return Int(s());
        }

        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
}


Measured memory_bytes: 37244
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ios>
using namespace std;

inline int parent(int i) {return i >> 1;}
inline int left(int i) {return i << 1;}
inline int right(int i) {return (i << 1) + 1;}


void maxHeapify(vector<int> & heap, int i){
    int H = heap.size() - 1;
    auto L = left(i);
    auto R = right(i);
    int largest = (L <= H && heap[L] > heap[i]) ? L : i;
    if (R <= H && heap[R] > heap[largest]) largest = R;
    if (largest != i){
        int tmp = heap[i];
        heap[i] = heap[largest];
        heap[largest] = tmp;
        maxHeapify(heap, largest);
    }
}

void insert(vector<int> & heap, int key){
    heap.push_back(key);
    int idx = heap.size() - 1;
    int pkey = heap[parent(idx)];
    while (idx > 1 && key > pkey){
        heap[idx] = pkey;
        idx = parent(idx);
        heap[idx] = key;
        pkey = heap[parent(idx)];
    }
}

int extractMax(vector<int> & heap){
    int maxval = heap[1];
    heap[1] = heap[heap.size() - 1];
    heap.pop_back();
    maxHeapify(heap, 1);
    return maxval;
}


void buildMaxHeap(vector<int> & heap){
    for (int i = (heap.size() - 1)/2; i != 0; --i) maxHeapify(heap, i);
}


int main()
{
    ios::sync_with_stdio(false);
    vector<int> heap = {0};
    string command;
    int key;
    while (cin >> command){
        if (command[0] == 'i'){
            cin >> key;
            insert(heap, key);
        }else if (command[1] == 'x'){
            cout << extractMax(heap) << endl;
        }else{
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 7072
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int N;
        cin >> N;

        vector<vector<ll> > abc(N, vector<ll>(3));

        for (int i = 0; i < N; ++i) {
            cin >> abc[i][0] >> abc[i][1] >> abc[i][2];
        }

        vector<vector<ll> > dp(N, vector<ll>(3));

        dp[0][0] = abc[0][0];
        dp[0][1] = abc[0][1];
        dp[0][2] = abc[0][2];

        for (int i = 1; i < N; ++i) {
            dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + abc[i][0];

            dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + abc[i][1];

            dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + abc[i][2];
        }

        ll ans = *max_element(all(dp[N - 1]));

        cout << ans << endl;

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vl;
 
const int N = 1e5 + 123;
int n, a[N], comp[N], dir[N], cnt;
 
int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	int cnt = 0;
	comp[1] = ++cnt;
	memset(& dir, -1, sizeof(dir));
	// -1 equal
	// 0 >=
	// 1 <=
	for (int i = 2; i <= n; i++) {
		if (dir[comp[i - 1]] == -1) {
			comp[i] = comp[i - 1];
			if (a[i] != a[i - 1]) {
				if (a[i - 1] < a[i]) {
					dir[comp[i]] = 1;
				}	else {
					dir[comp[i]] = 0;
				}
			}
		}	else {
			if (dir[comp[i - 1]] == 0) {
				if (a[i] > a[i - 1]) {
					comp[i] = ++cnt;
				}	else {
					comp[i] = comp[i - 1];
				}
			}	else {
				if (a[i] < a[i - 1]) {
					comp[i] = ++cnt;
				}	else {
					comp[i] = comp[i - 1];
				}
			}
		}
	}
	cout << cnt;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;++i)
#define REP(i,n) for (int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define read(x) scanf("%d",&x)
string s;
int main(){
	ios::sync_with_stdio(false);
	cin>>s;
	int n=s.size();
	int win=0;
	for (int i=0;i<n;++i) if (s[i]=='o') ++win;
	for (int i=n;i<15;++i) ++win;
	if (win>=8) cout<<"YES";
	else cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


int main()
{
	int t,p,r;
	while((cin >> t >> p >> r )&&t && p && r){
	
		int wrong[10][50] = {0};
		int tID,pID,time;
		int ansID[50];
		string msg;
		int memo[50] = {0};
		int cnt[50] = {0};

		for(int j=0;j<t;j++){
			ansID[j] = j+1;	
		}


		for(int i=0;i<r;i++){
			cin >> tID >> pID >> time >> msg;
			if(msg == "WRONG"){
				wrong[pID-1][tID-1]++;
			}else if(msg == "CORRECT"){
				memo[tID-1] += wrong[pID-1][tID-1] * 1200 + time;
				cnt[tID-1]++;
       		 	}
		}

		for(int i=0;i<t;i++){
			for(int j=i+1;j<t;j++){
				if(cnt[i] < cnt[j]){
					swap(ansID[i],ansID[j]);
					swap(cnt[i],cnt[j]);
					swap(memo[i],memo[j]);
				}
				else if(cnt[i] == cnt[j]){
					if(memo[i] > memo[j]){
						swap(ansID[i],ansID[j]);
						swap(cnt[i],cnt[j]);
						swap(memo[i],memo[j]);
					}else if(memo[i] == memo[j] && ansID[i] > ansID[j]){
						swap(ansID[i],ansID[j]);
						swap(cnt[i],cnt[j]);
						swap(memo[i],memo[j]);
					}
				}
			}
		}
		for(int i=0;i<t;i++){
			cout << ansID[i] << " " << cnt[i] << " " << memo[i] << endl;
		}
	}
	return 0;
}

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

#define ll long long
#define ar array
 
using namespace std;

int main() {

    int tam, b, temp = 0, j=0, k=0, l, chablau;
    
    string str;
    
    cin >> str;
	
	for(int i = 1; i<str.length(); i++){
		if(i%2){
			if(str[0] == str[i]){
				j++;
			}
		}else{
			if(str[0] != str[i]){
				j++;
			}
		}
	}
	
	cout << j << endl;
	

    return 0;
}

Measured memory_bytes: 512
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
//#define         ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         mp(a,b)                     make_pair(a,b)
#define         UNIQUE(v)                   v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define         mod                         1000000007
#define         INF                         2e18
#define         EPS                         1e-15
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;
//int dx[]={0,0,1,-1,1,1,-1,-1};
//int dy[]={1,-1,0,0,1,-1,1,-1};

#define lim 1005

int cnt[lim],track[lim];

void sieve(){
    for(ll i=1;i<=1e3;i++){
        track[i] = i;
        if( i%2==0 ) track[i] = 2;
    }
    for(ll i=3;i<=1e3;i+=2){
        if( track[i]==i ){
            for(ll j=i*i;j<=1e3;j+=2*i){
                track[j] = i;
            }
        }
    }
}

void F(ll n){
    ll res = 1,x=0,val;
    while(n>1){
        x=0;
        val = track[n];
        while(n>1 and n%val==0){
            x++;
            n /= val;
        }
        cnt[val] += x;
    }
}


int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    sieve();
    ll n,ans=1;
    sfl(n);
    for(ll i=2;i<=n;i++){
        F(i);
    }
    ll tmp;
    for(ll i=2;i<=n;i++){
        if( track[i]==i ){
            ans = (ans*(cnt[i]+1))%mod;
        }
    }
    pfl(ans);
    return 0;
}

Measured memory_bytes: 3808
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
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; }

struct edge { int to; int cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-12;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

double toRad(double x){
	return x*(PI/180.0);
}

int main(){
	double a,b,x;
	cin >> a >> b >> x;

	double l = 0,r = 90,m;
	while(abs(r-l) > EPS){
		m = (l+r)/2.0;
		bool ok = false;
		if(b*sin(toRad(90-m)) > a*sin(toRad(m))){
			if((a*b-a*a*tan(toRad(m))/2.0)*a > x) ok = true;
		}else{
			if((b*b*tan(toRad(90-m))/2.0)*a > x) ok = true;
		}
		if(ok){
			l = m;
		}else{
			r = m;
		}
	}

	cout << fixed << setprecision(10) << l << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = sum(b)
for i in range(1, n):
  if a[i] == a[i - 1] + 1:
    ans += c[a[i - 1] - 1]
print(ans)

Measured memory_bytes: 3064
#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-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

int main(){
    int n, k;
    cin>>n>>k;
    int l[n];
    REP(i, n){
        cin>>l[i];
    }
    sort(l, l+n, greater<>());
    int ans = 0;
    REP(i, k){
        ans+=l[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
x=[0]*n
y=[0]*n
h=[0]*n
for i in range(n):
  x[i],y[i],h[i]=map(int,input().split())
a=0
i=0
while h[i]==0:
  a=a+1
  i=i+1
for i in range(101):
  for j in range(101):
    H=abs(i-x[a])+abs(j-y[a])+h[a]
    b=0
    for k in range(n):
      if h[k]!=max(H-(abs(i-x[k])+abs(j-y[k])),0):
        break
      else:
        b=b+1
        if b==n:
          print(i,j,H)
    else:
      continue

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long  long ll;
int main()
{
    ll n,k;
    cin>>n>>k;
    ll arr[n];
    for(ll i=0;i<n;i++)
        cin>>arr[i];
    ll dp[n];

    dp[0]=0;
    for(ll i=1;i<n;i++)
    {
        ll ans=INT_MAX;
        ll p=i-k;
        if(p<0)
            p=0;
        for(ll j=i-1;j>=p;j--)
            ans=min(ans,abs(arr[i]-arr[j])+dp[j]);
        dp[i]=ans;
    }
    cout<<dp[n-1];








    return 0;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
using namespace std;

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	int n,d;
	scanf("%d %d",&n,&d);
	int cnt=0;
	for(int i=1;i<=n;i++)
		for(int j=10;j<=d;j++) {
			int d1=j%10,d10=j/10;
			if(d1<2||d10<2)continue;
			if(d1*d10==i)cnt++;
		}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
  int n;
  scanf("%d",&n);
  static int a[100000];
  for(int i=0;i<n;i++){
    scanf("%d",a+i);
  }
  long long S=0ll;
  for(int i=0;i<n;i++){
    int k=a[i]/2;
    S+=k;
    a[i]-=2*k;
    if(i+1<n){
      int m=min(a[i],a[i+1]);
      S+=m;
      a[i]-=m;
      a[i+1]-=m;
    }
  }
  printf("%lld\n",S);
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>  
using namespace std;
const int INF = 9999;

int N, M, b, Exit, mask;
int v[1 << 15];
int ret;
void rec(int digit, int cnt){
  if(cnt >= ret) return;
  if(digit == Exit || digit == ((~Exit) & mask)){
    ret = min( ret, cnt);
    return;
  } else if(v[digit & mask] <= cnt){
    return;
  } else {
    v[digit] = cnt;
    const int prev = digit;
    for(int i = 0; i < N - 1; ++i){
      digit &= ~(3 << i);
      digit |= ((prev >> i) & 1) << (i + 1);
      digit |= ((prev >> (i + 1)) & 1) << i;
      rec( digit, cnt + 1);
      digit = prev;
    }
  }
}

int main(){
  fill_n( v, 1 << 15, INF);
  ret = INF;

  cin >> N >> M;
  mask = (1 << N) - 1;
  for(int i = 0; i < N; ++i){
    bool d;
    cin >> d;
    b |= d << (N - i - 1);
  }
  int cnt = 0;
  bool flip = false;
  for(int i = 0; i < M; ++i){
    int p;
    cin >> p;
    while(p--){
      Exit |= (int)flip << (N - cnt - 1);
      ++cnt;
    }
    flip ^= 1;
  }
  rec(b, 0);
  cout << ret << endl;
}

Measured memory_bytes: 1532
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;	//using vi = vector<int>;

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

int main()
{
	string temp_s,temp_t;
	cin >> temp_s>>temp_t;
	vector<char> s(temp_s.size()), t(temp_t.size());
	for (int i = 0; i < temp_s.size(); i++) {
		s[i] = temp_s[i];
	}
	for(int i = 0; i < temp_t.size(); i++) {
		t[i] = temp_t[i];
	}

	sort(s.begin(), s.end());
	sort(t.rbegin(), t.rend());

	int min_size = min(temp_s.size(), temp_t.size());
	for (int i = 0; i < min_size; i++) {
		if (s[i] < t[i]) {
			cout << "Yes" << endl;
			return 0;
		}
		else if (s[i] > t[i]) {
			cout << "No" << endl;
			return 0;
		}
	}

	if (min_size == temp_s.size() && min_size != temp_t.size()) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <map>

std::map< std::int64_t, int > prime_factor(std::int64_t n) {
    std::map< std::int64_t, int > ret;
    for (std::int64_t i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

int main()
{
    long long n = 0;
    std::cin >> n;
    if (n <= 1)
    {
        std::cout << "0";
        return 0;
    }

    auto factors = prime_factor(n);

    int totalCount = 0;
    for (const auto &factor : factors)
    {
        auto count = factor.second;
        auto suber = 1;
        while (true)
        {
            count -= suber;
            if (count < 0)
            {
                break;
            }
            ++suber;
            ++totalCount;
        }
    }

    std::cout << totalCount;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
# define pb push_back
# define FOR(i,a,n) for(int i=a;i<n;i++)
# define mp make_pair
# define RFOR(i,a,n) for(int i=n;i>a;i--)
# define pii pair<long long int,long long int>
#define ub upper_bound
#define lb lower_bound
#define MOD 1000000007
typedef long long int ll;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll h,w;
	cin>>h>>w;
	char arr[h+1][w+1];
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		cin>>arr[i][j];
	}
	ll sum[h+2][w+2];
	for(int i=0;i<h+2;i++)
	{
		for(int j=0;j<w+2;j++)
		sum[i][j]=0;
	}
	sum[h][w]=1;
	for(int i=h;i>0;i--)
	{
		for(int j=w;j>0;j--)
		{
			if(i==h&&j==w)
			continue;
			if(arr[i][j]=='#')
			sum[i][j]=0;
			else
			sum[i][j]=(sum[i+1][j]+sum[i][j+1]);
			sum[i][j]=(sum[i][j])%MOD;
		}
	}
	/*for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		cout<<sum[i][j]<<" ";
		cout<<endl;
	}*/
	cout<<sum[1][1]<<endl;
}

Measured memory_bytes: 9088
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#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++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
vector<int> G[100000]; int k; int out = 0; int d[100000];
int dfs(int x) {
	int len = G[x].size();
	if (len == 0)return 1;
	int res = 0;
	rep(i, len) {
		int v = G[x][i];
		res = max(res, dfs(v));
	}
	if (res >= k-1 && d[x] > 1) {
		out++; return 0;
	}
	else return res + 1;
}
int main() {
	int n; cin >> n >> k;
	int a[100000];
	d[0] = 0;
	cin >> a[0]; 
	Rep(i,1, n) {
		cin >> a[i]; a[i]--;
		G[a[i]].push_back(i);
	}
	if (a[0] != 1)out++;
	if (k == 1) {
		Rep(i,1, n) {
			if (a[i] != 0)out++;
		}
		cout << out << endl;
	}
	else {
		queue<int> q; q.push(0);
		while (!q.empty()) {
			int x = q.front(); q.pop();
			int len = G[x].size();
			rep(j, len) {
				int v = G[x][j];
				d[v] = d[x] + 1;
				q.push(v);
			}
		}
		dfs(0);
		cout << out << endl;
	}
	return 0;
}


Measured memory_bytes: 11136
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF (long long) 1e18//1234567890987654321
#define INF 1234567890l
#define pb push_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN 300006
#define MAXK 26
#define MAXX 15000006
#define ll long long int
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ii++)
#define space " "
#define cbr cout << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define bg(ms) (*ms.begin())
#define ed(ms) (*prev(ms.end(), 1))
#define addedge(a, b, c, v) v[(a)].pb(pi((b), (c))); v[(b)].pb(pi((a), (c)))
#define ph push
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
string s; ll n;
int main()
{
	cin >> s;
	n = s.length();
	deque <char> dq;
	for(ll i = 0; i < s.length(); i++)
	{
		if(!dq.empty() && dq.back() != s[i]) dq.pop_back();
		else dq.pb(s[i]); 
	}
	cout << n - dq.size() << "\n";
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long

using namespace std;



	

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

	ll n;cin>>n;
	ll sum=0;

	for(ll i=1; i<=n; i++)
	{
		if(i%3 != 0 && i%5 != 0)
			sum += i;
	}

	cout<<sum;

	return 0;
	
}


Measured memory_bytes: 3596
N,K=list(map(int,input().split()))
mod=10**9+7

red=N-K
blue=K

place=red+1

combp=[1]*(place+1)
combb=[1]*(blue)

def invmod(x):
    return pow(x,mod-2,mod)

for r in range(1,place+1):
    combp[r]=(combp[r-1]*(place-r+1)*invmod(r))%mod

for r in range(1,blue):
    combb[r]=(combb[r-1]*(blue-r)*invmod(r))%mod

for i in range(1,K+1):

    if place<i:
        print(0)
        continue

    print((combp[i]*combb[i-1])%mod)

Measured memory_bytes: 68876
/*********বিসমিল্লাহির রাহমানির রাহিম**********/

#include <bits/stdc++.h>
#define ll long long
#define PI 2 * acos(0)
#define MAX 100000
#define M 10000007
using namespace std;

/*................OMI.................*/
int main()
{
   string s;
   cin >> s;

   if ((s[2] == s[3]) && (s[4] == s[5]))
      cout << "Yes" << endl;

   else
      cout << "No" << endl;
}


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

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

bool dp[100010];
int main() {
	int n,k;
	cin >> n >> k;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	rep(i,k+1) dp[i] = false;
	dp[0] = false;
	for(int i=1; i<=k; i++) {
		rep(j,n) {
			if(i - a[j] >= 0) {
				dp[i] |= !dp[i-a[j]];
			}
		}
	}
	if(dp[k]) cout << "First" << endl;
	else cout << "Second" << endl;

  return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;


vector<int> list[100];
int cost[100];

int saiki(int n){
	if(list[n].empty()==1){
		return cost[n];
	}
	int cont=0;
	for(int i=0;i<list[n].size();i++){
		cont+=saiki(list[n][i]);
	}
	return min(cont,cost[n]);
}

int main(){
	
	while(1){
		map<string,int> name;
		
		int n;
		scanf("%d",&n);
		
		if(n==0){
			break;
		}
		for(int i=0;i<n;i++){
			string a;int b;
			cin>>a>>b;
			cost[i]=b;
			name[a]=i;
		}
		for(int i=0;i<100;i++){
			list[i].clear();
		}
		int m;
		scanf("%d",&m);
		for(int i=0;i<m;i++){
			string a;int b;
			cin>>a>>b;
			int num=name[a];
			for(int j=0;j<b;j++){
				string c;
				cin>>c;
				list[num].push_back(name[c]);
			}
		}
		string a;
		cin>>a;
		
		printf("%d\n",saiki(name[a]));
		
	}
}

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

int main(){
	int a, b, c;
	int tmp;
	cin>> a >> b >> c;
	
	if(a > b){
		tmp = b;
		b = a;
		a = tmp;
	}
	
	if(b > c){
		tmp = c;
		c = b;
		b = tmp;
	}
	if(a > b){
		tmp = b;
		b = a;
		a = tmp;
	}
	
	cout << a << " " << b << " " << c << endl;
	
	return 0;
}

Measured memory_bytes: 3084
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_7_A&lang=jp
# Matching - Bipartite Matching

# 0=s, 1=t
class FordFulkerson
  def initialize(n)
    @n = n
    @flow = Array.new(n) { Array.new(n, 0) }
    @cap = Array.new(n) { Array.new(n, 0) }
  end

  def connect(s, t, w)
    @cap[s][t] = w
  end

  def calc
    inf = 2 ** 30
    sum = 0
    while true
      que = [0]
      prev = Array.new(@n, -1)
      prev[0] = 0
      while !que.empty? && prev[1] == -1
        u = que.shift
        @n.times do |i|
          if prev[i] == -1 && @cap[u][i] - @flow[u][i] > 0
            prev[i] = u
            que.push(i)
          end
        end
      end
      return sum if (prev[1] == -1)
      inc = inf
      c = 1
      while c != 0
        inc = [inc, @cap[prev[c]][c] - @flow[prev[c]][c]].min
        c = prev[c]
      end
      c = 1
      while c != 0
        @flow[prev[c]][c] += inc
        @flow[c][prev[c]] -= inc
        c = prev[c]
      end
      sum += inc
    end
  end
end

xn, yn, en = gets.split.map(&:to_i)
n = xn + yn + 2
g = FordFulkerson.new(n)

xn.times do |i|
  g.connect(0, 2 + i, 1)
end
yn.times do |i|
  g.connect(2 + xn + i, 1, 1)
end

en.times do
  x, y = gets.split.map(&:to_i)
  g.connect(2 + x, 2 + xn + y, 1)
end

puts g.calc



Measured memory_bytes: 9328
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=1e5+9;
int main()
{
    FASTINOUT;
    int x,y;
    cin>>x>>y;
    if (x>=10)
        cout<<y<<endl;
    else
        cout<<y+100*(10-x)<<endl;
    return 0;
}


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

int main(void){
  int N;
  unsigned long long D;
  cin>>N>>D;
  int ans=0;
  D = D*D;

  for(int i=0;i<N;i++){
    long long x,y;
    cin>>x>>y;
    if(x<0)x=-x;
    if(y<0)y=-y;
    long long d= x*x + y*y;

    if(D<d)continue;
    ans++;
  }
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef set<ll> sl;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

ll n, x;

int main(void) {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    cin >> n >> x;
    vl a(n);
    rep(i,0,n) {
        cin >> a[i];
    }
    vl b = a;
    ll ret = LLONG_MAX;
    rep(i,0,n) {
        rep(j,0,n) {
            b[j] = min(b[j], a[(j-i+n)%n]);
        }
        ll locret = 0;
        rep(j,0,n) {
            locret += b[j];
        }
        locret += i * x;
        ret = min(ret, locret);
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void solve()
{
    double a, b, c;
    cin >> a >> b >> c;
    if (a + b + 2 * sqrtl(a) * sqrtl(b) < c)
        cout << "Yes";
    else
        cout << "No";
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 51;
int a[N];
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }   
    int p = 0;
    for (int i = 0; i < n; ++i) {
        if (abs(a[i]) > abs(a[p])) p = i;
    }   
    vector <pair <int, int> > ans;
    if (a[p] < 0) {
        ans.push_back({p, n - 1});
        ans.push_back({p, n - 1});
        for (int i = n - 1; i; --i) {
            ans.push_back({i, i - 1});
            ans.push_back({i, i - 1});
        }
    }
    else {
        ans.push_back({p, 0});
        ans.push_back({p, 0});
        for (int i = 0; i + 1 < n; ++i) {
            ans.push_back({i, i + 1});
            ans.push_back({i, i + 1});
        }   
    }   
    cout << ans.size() << '\n';
    for (auto e : ans) cout << e.first + 1 << ' ' << e.second + 1 << '\n';
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}

int main (){
    int n;
    cin >> n;
    vi a(n);
    vi b(n);
    vi c(n);
    rep(i,n) cin >> a[i] >> b[i] >> c[i];
    int dp[n][3];
    rep(i,n){
        if(i==0){
            dp[i][0]=a[i];
            dp[i][1]=b[i];
            dp[i][2]=c[i];
        }
        else{
            dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
            dp[i][1]=max(dp[i-1][2]+b[i],dp[i-1][0]+b[i]);
            dp[i][2]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
        }
    }
    cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])) <<endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll n,m; cin>>n>>m;
    vector<ll> a(m);
    rep(i,m) cin>>a[i];
    rep(i,m) n-=a[i];
    if(n<0) cout<<-1<<endl;
    else cout<<n<<endl;
    return 0;
}

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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<string> S(N);
	int AC = 0, WA = 0, TLE = 0, RE = 0;
	for (int i = 0; i < N; i++) {
		cin >> S[i];
	}
	for (int i = 0; i < N; i++) {
		if (S[i] == "AC") AC++;
		if (S[i] == "WA") WA++;
		if (S[i] == "TLE") TLE++;
		if (S[i] == "RE") RE++;
	}
	cout << "AC" << " " << "x" << " " << AC << "\n";
	cout << "WA" << " " << "x" << " " << WA << "\n";
	cout << "TLE" << " " << "x" << " " << TLE << "\n";
	cout << "RE" << " " << "x" << " " << RE << "\n";
}

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

bool judge(int n, string &s, char a, char b, char c){
    bool t = false;
    int x, y;
    rep(i,n-2){
        if (s.at(i) == a){
            t = true;
            x = i;
            break;
        }
    }
    if (t){
        t = false;
        repp(j,n-1,x+1){
            if (s.at(j) == b){
                t = true;
                y = j;
                break;
            }
        }
        if (t){
            t = false;
            repp(k,n,y+1){
                if (s.at(k) == c){
                    t = true;
                    break;
                }
            }
            return t;
        }
        else {
            return t;
        }
    }
    else {
        return t;
    }
}

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    for (char a = '0'; a <= '9'; a++){
        for (char b = '0'; b <= '9'; b++){
            for (char c = '0'; c <= '9'; c++){
                if (judge(n,s,a,b,c)) ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits.h>
#include <climits>
#include <map>
#include <unordered_map>
#include <cmath>
#include <set>
#include <unordered_set>
#include <iterator>
#include <deque>
#include <assert.h>
#include <cstdlib>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
ull min(ull x, ull y){ if (x<y) return x; return y;}
ull max(ull x, ull y){ if (x<y) return y; return x;}
ll min(ll x, ll y){ if (x<y) return x; return y;}
ll max(ll x, ll y){ if (x<y) return y; return x;}
double min(double x, double y){ if (x<y) return x; return y;}
double max(double x, double y){ if (x<y) return y; return x;}
ull gcd(ull x, ull y){
    if (!x) return y;
    if (!y) return x;
    if (x>y) swap(x,y);
    return gcd(x, y%x);
}
ull inv(ull a, ull c){ // a,c are coprime and a<c
    if (a==1){
        return 1;
    }
    return ((c-(c/a))*inv(c%a,c))%c;
}

void f(int m, int i, vector<int> &cur, vector<vector<int> > &ans){
    if (i==-1){
        ans.push_back(cur);
        return;
    }
    for (int j = 1; j <= m; j++){
        cur[i] = j;
        f(j,i-1,cur,ans);
    }
}


int main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int n, m, q;
    cin>>n>>m>>q;
    int a[q], b[q], c[q], d[q];
    for (int i = 0; i < q; i++){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
    }
    vector<int> p(n,0);
    vector<vector<int> > all;
    f(m,n-1,p,all);
    ll ans = 0;
    for (int i = 0; i < all.size(); i++){
        ll cur = 0;
        for (int j = 0; j < q; j++){
            if (all[i][b[j]-1] - all[i][a[j]-1] == c[j]) cur += d[j];
        }
        ans = max(ans, cur);
    }
    cout<<ans<<"\n";
    return 0;
}


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

namespace ABC086_A.cs {
	class ABC086_A {
		static void Main(string[] args) {
			var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			Console.WriteLine((input[0]*input[1])%2 == 1 ? "Odd" : "Even");
		}
	}
}


Measured memory_bytes: 13268
use strict;
use warnings;

my ($s, $t, $K) = split /\s/, <>;
my $sum = $s + $t;

if ( $sum < $K ) {
    print "0 0";
} elsif ( $s >= $K ) {
    $s = $s - $K;
    print "$s $t";
} else {
    $t = $t - ( $K - $s );
    print "0 $t";
}



Measured memory_bytes: 640
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int N, A;

  std::cin >> N >> A;

  for (int i = 0; i < A; i ++)
    if ((N - i) % 500 == 0) {
      std::cout << "Yes" << std::endl;

      return 0;
    }

  std::cout << (N % 500 == 0 ? "Yes" : "No") << std::endl;

  return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

bool mizu[100000];
bool satou[100000];

int main()
{
	int a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f;
	
	REP(i,301)
	{
		REP(j,301)
		{
			mizu[min(5000,((a*i)+(b*j))*100)] = true;
			satou[min(5000,((c*i)+(d*j)))] = true;
		}
	}
	
	int retmizu=a*100,retsatou=0;
	double ma=0;
	
	REP(i,3001)
	{
		if(mizu[i])
		{
	//		cout << i << endl;
			REP(j,3001)
			{
				if(satou[j] && i+j <= f)
				{
					double A = i,B = j;
					if(e*(i/100) >= j && ((100*B)/(A+B)) > ma)
					{
//						cout << "    " << j << endl;

						retmizu = i;
						retsatou = j;
						ma = ((100*B)/(A+B));
					}
				}
			}
		}
	}
	
	cout << retmizu+retsatou << ' ' << retsatou << endl;
						
				
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
signed main() {
    int N,H,W;
    cin>>N>>H>>W;
    int A,B;
    int ans=0;

    for(int i=0;i<N;i++){
        cin>>A>>B;

        if(A>=H&&B>=W){
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#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 per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; 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 a, b, c, d; cin >> a >> b >> c >> d;
    cout << max(min(b, d)-max(a, c), 0LL) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < int(n); ++ (i))
#define REP_R(i, n) for (int i = int(n) - 1; (i) >= 0; -- (i))
#define ALL(x) begin(x), end(x)
using ll = long long;
using namespace std;
template <class T> inline void chmax(T & a, T const & b) { a = max(a, b); }

template <typename Monoid>
struct binary_indexed_tree { // on monoid
    typedef typename Monoid::underlying_type underlying_type;
    vector<underlying_type> data;
    Monoid mon;
    binary_indexed_tree(size_t n, Monoid const & a_mon = Monoid()) : mon(a_mon) {
        data.resize(n, mon.unit());
    }
    void point_append(size_t i, underlying_type z) { // data[i] += z
        for (size_t j = i + 1; j <= data.size(); j += j & -j) data[j - 1] = mon.append(data[j - 1], z);
    }
    underlying_type initial_range_concat(size_t i) { // sum [0, i)
        underlying_type acc = mon.unit();
        for (size_t j = i; 0 < j; j -= j & -j) acc = mon.append(data[j - 1], acc);
        return acc;
    }
};
struct max_monoid {
    typedef ll underlying_type;
    ll unit() const { return LLONG_MIN; }
    ll append(ll a, ll b) const { return max(a, b); }
};

ll solve1(int n, ll c, vector<ll> const & x, vector<int> const & v) {
    binary_indexed_tree<max_monoid> bit(n + 1);
    bit.point_append(0, 0ll);
    ll acc = 0;
    REP (i, n) {
        acc += v[i];
        bit.point_append(i + 1, acc - x[i]);
    }
    ll result = bit.initial_range_concat(n + 1);
    acc = 0;
    REP_R (i, n) {
        acc += v[i];
        chmax(result, acc - 2 * (c - x[i]) + bit.initial_range_concat(i + 1));
    }
    return result;
}

ll solve(int n, ll c, vector<ll> x, vector<int> v) {
    ll answer = LLONG_MIN;
    chmax(answer, solve1(n, c, x, v));
    REP (i, n) x[i] = c - x[i];
    reverse(ALL(x));
    reverse(ALL(v));
    chmax(answer, solve1(n, c, x, v));
    return answer;
}

int main() {
    int n; ll c; scanf("%d%lld", &n, &c);
    vector<ll> x(n);
    vector<int> v(n);
    REP (i, n) scanf("%lld%d", &x[i], &v[i]);
    ll answer = solve(n, c, x, v);
    printf("%lld\n", answer);
    return 0;
}


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

int main() {
	string S; cin >> S;
	int cnt = 0;
	if (S[0] == '1')cnt++;
	if (S[1] == '1')cnt++;
	if (S[2] == '1')cnt++;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define ll long long 
int main(){
    ll a,b,c;
    scanf("%lld%lld%lld",&a,&b,&c);
    ll p=c-a-b;
    if(p<0){
        printf("No\n");
        return 0;
    }
    ll q=4*a*b;
    ll r=p*p;
    if(q<r) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

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

int main() {
  int n;
  while (cin >> n) {
    int cnt = 0;
    rep (a, 10) rep (b, 10) rep (c, 10) rep (d, 10) if (a + b + c + d == n) ++cnt;
    cout << cnt << endl;
  }
  return 0;
}

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

bool prime[10000001];

void init_prime() {
    fill(prime, prime+10000001, true);
    prime[0] = prime[1] = false;
    for (int i = 3; i <= 3163; i += 2) {
        if (prime[i]) {
            for (int d = i * 2, j = i + d; j <= 10000000; j += d) {
                prime[j] = false;
            }
        }
    }
}

int main() {
    int n, x;
    
    init_prime();

    while (cin >> n, n) {
        for (int i = n - 1 + (n&1); i >= 13; i -= 2) {
            if (prime[i] && prime[i-2] && prime[i-6] && prime[i-8]) {
                cout << i << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 10924
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

map<string, int> value;
map<string, vector<string> > recipe;

int recur(string item)
{
	if (!recipe[item].size())
		return value[item];

	int s = 0;
	for (int i = 0; i < recipe[item].size(); ++i)
		s += recur(recipe[item][i]);
	return min(value[item], s);
}
int main()
{
	int n;
	while (cin >> n, n)
	{
		value.clear();
		recipe.clear();
		for (int i = 0; i < n; ++i)
		{
			string a;
			int v;
			cin >> a >> v;
			value[a] = v;
		}
		int m;
		cin >> m;
		for (int i = 0; i < m; ++i)
		{
			string a;
			int k;
			cin >> a >> k;
			for (int j = 0; j < k; ++j)
			{
				string b;
				cin >> b;
				recipe[a].push_back(b);
			}
		}

		string item;
		cin >> item;
		cout << recur(item) << endl;
	}

	return 0;
}

Measured memory_bytes: 0
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        restaurants: [(String, i32); n],
    }
    let mut restaurants = restaurants.iter().enumerate().collect::<Vec<_>>();
    restaurants.sort_by_key(|row| {
        let row = row.1;
        (row.0.clone(), -row.1)
    });
    for (i, _) in restaurants {
        println!("{}", i + 1);
    }
}


Measured memory_bytes: 4352
a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i
k = gets.chomp.to_i

array = [a, b, c, d, e]
array.each_with_index do |v, x|
  x = x+1
  x.upto(4) do |i|
    if array[i] - v > k
      puts ":("
      exit
    end
  end
end
puts "Yay!"

Measured memory_bytes: 3836