akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

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

  char turn = 'a';
  string a, b, c;
  int i = 0, j = 0, k = 0;
  cin >> a >> b >> c;

  while (i <= a.size() && j <= b.size() && k <= c.size()) {
    if (turn == 'a') {
      turn = a[i++];
    } else if (turn == 'b') {
      turn = b[j++];
    } else {
      turn = c[k++];
    }
  }

  if (i > a.size()) cout << "A" << "\n";
  else if (j > b.size()) cout << "B" << "\n";
  else cout << "C" << "\n";
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define forn(i, n) for (long long i = 0; i < (long long)(n); ++i)
#define for1(i, n) for (long long i = 1; i <= (long long)(n); ++i)
#define fore(i, l, r) for (long long i = (long long)(l); i <= (long long)(r); ++i)
#define fordn(i, n) for (long long i = (long long)(n) - 1; i >= 0; --i)
#define ford1(i, n) for (long long i = (long long)(n); i >= 1; --i)
#define all(x) (x).begin(), (x).end()
#define PI 3.141592653589793
using namespace std;
using ll = long long;
using ld = long double;

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int a, b;
    cin >> a >> b;
    cout << (a + b + 1) / 2 << endl;
}

Measured memory_bytes: 256
numero = int(input())

digito_1 = numero % 10

if digito_1 == 2 or digito_1 == 4 or digito_1 == 5 or digito_1 == 7 or digito_1 == 9:
    print("hon")
elif digito_1 == 0 or digito_1 == 1 or digito_1 == 6 or digito_1 == 8:
    print("pon")
elif digito_1 == 3:
    print("bon")


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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] a = new int[3];
        a[0] = in.nextInt();
        a[1] = in.nextInt();
        a[2] = in.nextInt();
        Arrays.sort(a);

        int ans = 0;
        if ((a[1] - a[0]) % 2 == 1) {
            a[0]++;
            a[2]++;
            ans++;
        }

        ans += (a[1] - a[0]) / 2;
        ans += a[2] - a[1];
        System.out.println(ans);
    }
}

Measured memory_bytes: 35684
def calc_simultaneeous(args)
  x = y = 0
  args.each_cons(6) do |a, b, c, d, e, f|
    y = (f - d * c / a) / (e - (d * b / a))
    x = (c - b * y) / a
  end
  printf "%.3f %.3f", x, y
end

while input = gets
  puts calc_simultaneeous(input.chomp.split(' ').map! { |elm| elm.to_f })
end

Measured memory_bytes: 6144
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> divisor(int n) {
    vector<int> ret;
    for(int i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}
int main() {
    int N, M;
    cin >> N >> M;
    auto div = divisor(M);
    auto itr = upper_bound(div.begin(), div.end(), M / N) - 1;
    cout << *itr << endl;
}


Measured memory_bytes: 256
## C Many Requirements
import itertools
N, M, Q = map(int, input().split() )
X = [list( map( int,input().split() ) ) for x in range(Q)]

listd = []
A = list( itertools.combinations_with_replacement( [i for i in range(1, M+1) ], N ) )
for a in A:
    sumd = 0
    for q in range(Q):
        if a[X[q][1]-1] - a[X[q][0]-1] == X[q][2]:
            sumd += X[q][3]
    listd.append(sumd)
print( max(listd) )

Measured memory_bytes: 25252
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

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

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

    int H, W;
    cin>>H>>W;
    vector<vector<bool>> grid(H, vector<bool>(W));
    int i, j;
    char c;
    rep(i, H) {
        rep(j, W) {
            cin>>c;
            if (c == '.') grid[i][j] = true;
            else grid[i][j] = false;
        }
    }

    vector<vector<int>> comb(H + 1, vector<int>(W + 1));
    comb[0][1] = 1;
    rep(i, H) {
        rep(j, W) {
            if (!grid[i][j]) {
                comb[i + 1][j + 1] = 0;
                continue;
            }

            comb[i + 1][j + 1] = (comb[i][j + 1] + comb[i + 1][j]) % 1000000007;
        }
    }
    cout<<comb[H][W]<<endl;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
 
#define si(x) scanf("%d",&x)
#define sf(x) scanf("%lf",&x)
#define sl(x) scanf("%lld",&x)
#define pr(x) printf("%d\n",x)
#define prll(x) printf("%lld\n",x)
 
#define ll long long int
#define ull unsigned long long int
#define F first
#define S second
 
#define rep(i,x,y) for(int i=x;i<y;i++)
#define ii pair<int,int> 
#define pll pair<ll,ll> 
#define vi vector<int> 
#define vvi vector< vi > 
#define vl vector<long long int>
#define vvl vector< vl >
#define vii vector< ii >
#define vvii vector< vii >
#define priority_queue pq;
#define sz(a) ll((a).size()) 
#define pb push_back 
#define mp make_pair
 
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)
#define SET(a,b) memset(a,b,sizeof(a))
#define all(c) (c).begin(),(c).end() 
#define tr(i,c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ison(x,i) (((x) >> (i)) & 1)	//checks if ith bit is on
#define set0(x,i) (x & ~(1 << i))		//set ith bit in x to be zero
#define clr(a) memset(a,0,sizeof(a))
 
#define MOD 1000000007
#define INF 4000000000000000000
#define MAX 100000+5
using namespace std;



int main()
{
	string s;
	cin>>s;
	if(s.length()>=4)
	{
		if(s[0]=='Y' && s[1]=='A' && s[2]=='K' && s[3]=='I')
		{
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	return 0;
}

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



namespace CSharpSample01
{

    
    class Program
    {

        

        static void Main(string[] args)
        {
            //入力1(N, K)
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);

            Dictionary<long, long> cost = new Dictionary<long, long>();

            //入力2(cost)
            for(int i = 0; i < N; i++)
            {
                input = Console.ReadLine().Split(' ');
                long a = int.Parse(input[0]);
                long b = int.Parse(input[1]);
                if (!cost.ContainsKey(b))
                {
                    cost[b] = a;
                }
                else
                {
                    cost[b] += (long)a;
                }
            }

            long time = 0;

            foreach(var s in cost.OrderBy(x => x.Key))
            {
                time += s.Value;
                if (time > s.Key)
                {
                    Console.WriteLine("No");
                    return;
                }
            }

            Console.WriteLine("Yes");
            
        }
    }

}

Measured memory_bytes: 30904
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	int L, R, d;
	cin >> L >> R >> d;

	int ans = R/d - (L-1)/d;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3564
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Scan()
	s, _ := strconv.Atoi(sc.Text())
	a := 0
	for x := s; x > 0; x /= 10 {
		a += x % 10
	}
	if s%a == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using vi = vector<int>;
using vd = vector<double>;
using pi = pair<int, int>;
using i64 = int64_t;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
void print(vector<T> &v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

void dijkstra(vector<vector<pi>> &adj) {
  auto n = adj.size();
  priority_queue<pi> PQ;
  vi d(n, INF);
  vector<bool> visited(n, false);
  d[0] = 0;
  PQ.push(make_pair(0, 0));
  while (!PQ.empty()) {
    auto f = PQ.top();
    PQ.pop();
    auto u = f.second;
    visited[u] = true;
    if (d[u] < -f.first) continue;
    REP(i, adj[u].size()) {
      auto v = adj[u][i].first;
      auto new_cost = d[u] + adj[u][i].second;
      if (!visited[v] && new_cost < d[v]) {
        d[v] = new_cost;
        PQ.push(make_pair(-d[v], v));
      }
    }
  }
  REP(i, n) cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
}

int main() {
  int n;
  cin >> n;
  vector<vector<pi>> adj(n);
  int k, c, u, v;
  REP(i, n) {
    cin >> u >> k;
    REP(j, k) {
      cin >> v >> c;
      adj[u].push_back(make_pair(v, c));
    }
  }
  dijkstra(adj);
}


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

int main() {

  string S, T, res = "UNRESTORABLE";
  string R;

  cin >> S;
  cin >> T;
  int k = 0;
  for (int i = 0; i < S.length() - T.length() + 1; i++) {
    int count = 0;
    for (int j = 0; j < T.length(); j++) {
      if (S[i + j] == T[j] || S[i + j] == '?')
        count++;
    }
    if (count == T.length()) {
      R =  S.substr(0, i) + T.substr(0, T.length()) + S.substr(i + T.length(), S.length() - i);
      k++;
    }
  }

  for (int i = 0; i < R.length(); i ++) {
    if (R[i] == '?') R[i] = 'a';
  }
  if (R != "")
    cout << R << endl;
  else
    cout << "UNRESTORABLE" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(){
	int x,y;
	std::cin >> x >> y;
	while(!((x==0)&&(y==0))){
		if(x<y) std::cout << x << " " << y << std::endl;
		else std::cout << y << " " << x << std::endl;
		std::cin >> x >> y;
	}
	return 0;
}


Measured memory_bytes: 3040
#include<bits/stdc++.h>
#include <cctype>
#define ll          long long int
#define PB          push_back
#define GO          ll t; cin>>t; while(t--)
#define G(t)        cin>>t; while(t--)
#define ALLR(x)     x.rbegin(), x.rend()
#define PII         pair<ll ,ll >
#define VI          vector<ll >
#define ALL(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define PI          3.141592653589793238
#define SZ(x)       (ll )x.size()
#define hell2        998244353
#define hell        1000000007
#define FO(i,a,b)    for(i=a;i<b;i++)
#define FOREV(i,a,b)    for(i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define BS          binary_search
#define MP          make_pair
#define ARR(n,i,a)    ll n,i;cin>>n;ll a[n];FO(i,0,n)cin>>a[i];
#define ARRK(k,n,i,a) int n,k,i;scanf("%d%d",&n,&k);ll a[n];FO(i,0,n)scanf("%lld",&a[i]);
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(0);
int main()
{
    fio
    int i,n,s=0;
    cin>>n;
  int a[n+1];
  FO(i,1,n+1){cin>>a[i];if(i%2==1&&a[i]%2==1)s++;}
    cout<<s;
    
return 0;
}

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

int main(void){
  int a[6];
  rep(i,6) cin >> a[i];
  for(int i = 0; i < 5; i++){
    for(int j = i+1; j < 6; j++){
      if(a[j]-a[i] > a[5]){
        cout << ":(" << endl;
        return 0;
      }
    }
  }
  cout << "Yay!" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>
#include <functional>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool isprime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}
ll rpow(ll x, ll n) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) k *= x;
        x *= x;
    }
    return k * x;
}
ll modpow(ll x, ll n, ll mod) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) (k *= x) %= mod;
        (x *= x) %= mod;
    }
    return k * x % mod;
}
ll modcomb(ll n, ll r, ll mod) {
    if (r < 0 || n < r) return 0;
    chmin(n - r, r);
    ll mul = 1, div = 1;
    for (ll i = 0; i < r; i++) {
        (mul *= n - i) %= mod;
        (div *= i + 1) %= mod;
    }
    return mul * modpow(div, mod - 2, mod) % mod;
}

/*------------------------------------------------------------------------*/

constexpr ll INF = 1e9;

void solve();

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

    solve();
}
void solve() {
    ll h, n;
    std::cin >> h >> n;

    vll dp(h + 1, INF);
    dp[h] = 0;
    for (ll i = 0; i < n; i++) {
        ll a, b; std::cin >> a >> b;
        for (ll j = h; j > 0; j--)
            chmin(dp[j] + b, dp[std::max(0LL, j - a)]);
    }

    std::cout << dp[0] << '\n';
}


Measured memory_bytes: 3692
#include<iostream>
using namespace std; 
int main()
{
  int a,b,n,x[5],k,i,j,Ans,l;
  cin >> n >> a >> b;
  for(j=1;j<=n;j++){
    k=0;
    l=j;
    for(i=0;i<5;i++){
      x[i]=l%10;l/=10;
      k+=x[i];
    }
    if(a<=k&&k<=b)Ans+=j;
  }
printf("%d",Ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define Yes(n) cout << ((n) ? "YES" : "NO") << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))

vector<string> split(string,string);

//template<typename T>
//void swap(T*,T*);
//char ToUpper (char cX) { return toupper(cX); }

int main()
{
    string s;cin >>s;
    cout << (s[0] == s[2] ? "Yes" : "No");
}


Measured memory_bytes: 256
import sys
import numpy as np
N, A = map(int, input().split())
X = np.array(list(map(int, input().split())))
x = X - A
R = 5001
dp = np.zeros([N, R], np.int64)
dp[0][(R-1)//2] += 1
dp[0][(R-1)//2 + x[0]] += 1

for i in range(1,N):
	for j in range(R):
		if 0 <= j-x[i] <= R-1:
			dp[i][j] = dp[i-1][j] + dp[i-1][j-x[i]]
		else:
			dp[i][j] = dp[i-1][j]
print(dp[N-1][(R-1)//2]-1)


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

Measured memory_bytes: 580
N, M, V, P = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)

def isOk(n):
    if n < P:
        return True
    b = A[n] + M

    cnt = (P - 1) * M + (N - n) * M
    for a in A[P - 1: n]:
        cnt += max(0, b - a)

    if b >= A[P - 1] and cnt >= V * M:
        return True
    return False

ok = -1
ng = N
while ng - ok > 1:
    mid = (ng + ok) // 2
    if isOk(mid):
        ok = mid
    else:
        ng = mid

print(ng)

Measured memory_bytes: 14964
#include <iostream>
using namespace std;
int main(void){
   // Your code here!
   int i,n,t,k,c,b;
   while(1){
       cin >> n;
       if (n==0) break;
       int a[35]={0};
       a[0]={1};
       a[1]={1};
       a[2]={2};
       for(i=3;i<=n;i++){
           a[i]=a[i-3]+a[i-2]+a[i-1];
       }
       c=a[n]/10;
       b=a[n]%10;
       if(b != 0){
           c=c+1;
       }
       k= c / 365;
       t= c % 365;
       if(t != 0){
           k=k+1;
       }
       cout << k;
       cout << endl;
}
}


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

int b[1<<20];
int a[1<<20];
int main(){
	int n;cin>>n;
	rep(i,1<<n)scanf("%d",&a[i]),b[i]=a[i];
	rep(i,n)rep(j,1<<n){
		if(!(j>>i&1)){
			a[j|1<<i]+=a[j];
		}
	}
	int cnt=0;
	rep(i,1<<n){
		if(b[i]&&a[i]==1){
			cnt++;
		}
		if(b[i]==0&&a[i]){
			puts("-1");return 0;
		}
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 11432
#include<bits/stdc++.h>
using namespace std;
int main(){
  long int n,w;
  cin>>n>>w;
  vector<long int> weight(n+1);
  vector<long int> value(n+1);
  for(long int i=1;i<=n;i++){
    cin>>weight[i]>>value[i];
  }
  vector<vector<long int>> dp(n+1,vector<long int>(w+1));
  for(long int i=0;i<=n;i++) dp[i][0]=0;
  for(long int i=0;i<=w;i++) dp[0][i]=0;
  for(long int i=1;i<=n;i++){
    for(long int j=1;j<=w;j++){
      if(j>=weight[i]) dp[i][j]=max(dp[i-1][j],dp[i-1][j-weight[i]]+value[i]);
      else dp[i][j]=dp[i-1][j];
    }
  }
  cout<<dp[n][w];
  return 0;
}
                                                      

Measured memory_bytes: 80256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7
#main code here!
#https://note.nkmk.me/python-union-find/

    class UnionFind():
        def __init__(self, n):
            self.n = n
            self.parents = [-1] * n
    
        def find(self, x):
            if self.parents[x] < 0:
                return x
            else:
                self.parents[x] = self.find(self.parents[x])
                return self.parents[x]
    
        def union(self, x, y):
            x = self.find(x)
            y = self.find(y)
    
            if x == y:
                return
    
            if self.parents[x] > self.parents[y]:
                x, y = y, x
    
            self.parents[x] += self.parents[y]
            self.parents[y] = x
    
        def size(self, x):
            return -self.parents[self.find(x)]
    
        def same(self, x, y):
            return self.find(x) == self.find(y)
    
        def members(self, x):
            root = self.find(x)
            return [i for i in range(self.n) if self.find(i) == root]
    
        def roots(self):
            return [i for i, x in enumerate(self.parents) if x < 0]
    
        def group_count(self):
            return len(self.roots())
    
        def all_group_members(self):
            return {r: self.members(r) for r in self.roots()}
    
        def __str__(self):
            return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
    n,m=MI()
    uf=UnionFind(n)
    for i in range(m):
        a,b=MI()
        a-=1
        b-=1
        uf.union(a,b)
    print(uf.group_count()-1)
    
    








if __name__=="__main__":
    main()



Measured memory_bytes: 73792
#!/usr/bin/perl

my ($n,$m) = map { $_ - 0 } split(/\s+/,<STDIN>);
my $s = <STDIN>;
my $t = <STDIN>;

my $l = $n * $m / &gcd($n,$m);
my $s_n = $l / $n;
my $s_m = $l / $m;

my $pos_n = 0;
my $pos_m = 0;
my $pos_no = 0;
my $pos_mo = 0;

my $res = $l;
while( $pos_n < $l and $pos_m < $l ){
  if( $pos_n == $pos_m ){
    my $s1 = substr($s,$pos_no,1);
    my $t1 = substr($t,$pos_mo,1);
    if( $s1 ne $t1 ){
      $res = -1;
      last;
    }
    $pos_no++;
    $pos_mo++;
    $pos_n += $s_n;
    $pos_m += $s_m;
  } else {
    if( $pos_n < $pos_m ){
      $pos_no++;
      $pos_n += $s_n;
    } else {
      $pos_mo++;
      $pos_m += $s_m;
    }
  }
}

print "$res\n";

exit(0);

sub gcd {
  my $mm = shift;
  my $nn = shift;
  while($nn != 0){
    my $rr = $mm % $nn;
    $mm = $nn;
    $nn = $rr;
  }
  return $mm;
}



Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <math.h>
#include <stdio.h>
#define INF 1000000000
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long int ll;
using namespace std;

int main() {

	int n, d; cin >> n >> d;
	vector<vector <double> > x(n, vector<double>(d));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j++) {
			cin >> x[i][j];
		}
	}
	
	int ans = 0;

	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
		
			double way = 0;
			for (int k = 0; k < d; k++) {
				way += pow(fabs(x[i][k] - x[j][k]), 2);
			}
			way = sqrt(way);
			if (fmod(way,1) == 0) { ans++; }

		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#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 <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

void clear_m(vector<string> &d, int H, int W) {
    for (int k = 0; k < 32; k++) {
        for (int i = H - 1; i >= 1; i--) {
            for (int j = 0; j < W; j++) {
                if (d[i][j] == '0') {
                    swap(d[i][j], d[i - 1][j]);
                }
            }
        }
    }
}

bool is_update(vector<string> &d, int H, int W, int K) {
    bool update = false;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (d[i][j] != '0') {
                int c = 0;
                char ch = d[i][j];
                while (j < W && d[i][j] == ch)j++, c++;
                if (c >= K)update = true;
                j--;
            }
        }
    }
    return update;
}

long long calc_m(vector<string> &d, int H, int W, int K) {
    long long sum = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (d[i][j] != '0') {
                int c = 0;
                char ch = d[i][j];
                int k = j;
                while (k < W && d[i][k] == ch)k++, c++;
                if (c >= K) {
                    sum += (ch - '0') * c;
                    k = j;
                    while (k < W && d[i][k] == ch) d[i][k] = '0', k++;
                }
            }
        }
    }
    return sum;
}

int main() {

    int H, W, K;
    cin >> H >> W >> K;

    vector<string> c(H);
    for (int i = 0; i < H; i++) cin >> c[i];

    long long ans = LONG_LONG_MIN;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            long long sum = 0;
            vector<string> d = c;
            d[i][j] = '0';
            //for(int i = 0;i<H;i++) SHOW_VECTOR(d[i]);
            //cout << endl;
            clear_m(d, H, W);
            //for(int i = 0;i<H;i++) SHOW_VECTOR(d[i]);
            int cnt = 0;
            while (true) {
                if (!is_update(d, H, W, K)) break;
                long long ret = calc_m(d, H, W, K);
                sum += pow(2, cnt) * ret;
                clear_m(d, H, W);
                cnt++;
            }
            ans = max(ans, sum);
        }
    }

    cout << ans << endl;

}



























Measured memory_bytes: 256
N = int(input())
A = [int(hoge) for hoge in input().split()]
B = [int(hoge) for hoge in input().split()]
#Aiの総和を変えずに、なるべく少ない量のAiを変えて全部合格を目指す
if sum(B) > sum(A):
    print(-1)
else:
    diff = 0
    points = []
    ans = 0
    for i in range(N):
        a = A[i]
        b = B[i]
        if a < b:
            diff += b - a
            ans += 1
        elif a > b:
            points.append(a-b)
    for p in sorted(points,reverse = True):
        if diff <= 0:
            print(ans)
            exit()
        diff -= p
        ans += 1 
    print(ans)              

Measured memory_bytes: 81968
#include<bits/stdc++.h>
using ll = long long;
const ll INF_LL = 1000000000000;
#define fir first
#define sec second

int main()
{
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    for(int i = 0; i < n; i++)std::cin >> a[i];
    std::multiset<int> set;
    for(int i = 0; i < n; i++){
        auto itr = set.lower_bound(a[i]);//もしa[i]が小さくて先頭になってしまったら
        if(itr == set.begin()){
            set.insert(a[i]);
        }else{
            itr--;
            set.erase(itr);
            set.insert(a[i]);
        }
    }
    std::cout << set.size() << std::endl;
}


Measured memory_bytes: 5376
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();  
        int[] a = r.ii();
        int p1 = a[0]*a[1];
        int p2 = a[2];
        println(Math.min(p1, p2));
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    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 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;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long(ss[j]);            
            return ll;
        }
    }
}


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

int main()
{
  int64_t A, B, C, D, t = 0;
  cin >> A >> B >> C >> D;
  while (A > 0 && C > 0)
  {
    if (t % 2)
    {
      A -= D;
    }
    else
    {
      C -= B;
    }
    t++;
  }
  cout << ((t % 2) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3600
def check(cms, hp):
	cms.sort(reverse=True)
	tls = 0
	for cm in cms:
		tls += cm
		if tls >= hp:
			return 'Yes'
	return 'No'

hp, _ = map(int, input().split())
attack_commands = list(map(int, input().split()))
print(check(attack_commands, hp))

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int L = nextInt();
  int R = nextInt();
  if (R - L >= 5000) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = 2019;
  for (int i = L; i <= R; i++) {
    for (int j = i + 1; j <= R; j++) {
      ll p = (ll)i * (ll)j;
      chmin(ans, p % 2019);
    }
  }
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
main(){
  
  int x,y,i,a;
  
  for(i = 0 ; 1 ; i++){
    scanf("%d%d",&x,&y);
    if(x == 0 && y == 0) break;
    
    if(x > y){
      a = x;
      x = y;
      y = a;
    }
    printf("%d %d\n",x,y);
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define scd(t) scanf("%d",&t)
#define scld(t) scanf("%ld",&t)
#define sclld(t) scanf("%lld",&t)
#define scc(t) scanf("%c",&t)
#define scs(t) scanf("%s",t)
#define scf(t) scanf("%f",&t)
#define sclf(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define ffor(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define rfor(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define rep(i, j) ffor(i, 0, j, 1)
#define rrep(i, j) rfor(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define mp make_pair
#define pb push_back
//#define f first
//#define s second
#define inf (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define trace1(x)                     cout <<#x<<": "<<x<< endl;
#define trace2(x, y)                 cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)              cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)           cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)        cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
const double pi=acos(-1.0);
typedef pair<long long int,long long int> pii;
typedef long long ll;
typedef vector<long long int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<long long int,long long int> mpii;
typedef set<long long int> sei;
typedef multiset<long long int> msei;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
ll dp[100001]={0};
ll vis[100001]={0};
ll maxi=0;
vector<ll> v[100001];
void dfs(ll cur)
{
    ll i,j;
    vis[cur]=1;
    for(i=0;i<v[cur].size();i++)
    {
        if(vis[v[cur][i]]==0)
        {
            dfs(v[cur][i]);
        }
        dp[cur]=max(dp[cur],dp[v[cur][i]]+1);
    }
    maxi=max(maxi,dp[cur]);
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    ll i,j,n,m;
    cin>>n>>m;
    for(i=1;i<=m;i++)
    {
        ll x,y;
        cin>>x>>y;
        v[x].pb(y);
    }
    for(i=1;i<=n;i++)
    {
        if(vis[i]==0)
        {
            dfs(i);
        }
    }
    cout<<maxi;
    return 0;
}

Measured memory_bytes: 9344
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,ans;
      long long int val;
    cin>>a>>b>>c;
    if(c>=b)
    {
      val = b-1;
    }
    else
    {
         val = c;
    }
    cout<< (val*a)/b - a*(val/b)<<endl;
}

Measured memory_bytes: 3552
#![allow(clippy::needless_range_loop)]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::*;

struct Memoized {
    memo: std::collections::BTreeMap<usize, usize>,
}

impl Memoized {
    fn func(&mut self, x: usize, a: usize, b: usize, c: usize, d: usize) -> usize {
        if let Some(&memo) = self.memo.get(&x) {
            return memo;
        }

        if x <= 1 {
            return d * x;
        }

        let &ans = [
            x.saturating_mul(d),
            self.func(x / 2, a, b, c, d) + x % 2 * d + a,
            self.func((x + 1) / 2, a, b, c, d) + (2 - x % 2) % 2 * d + a,
            self.func(x / 3, a, b, c, d) + x % 3 * d + b,
            self.func((x + 2) / 3, a, b, c, d) + (3 - x % 3) % 3 * d + b,
            self.func(x / 5, a, b, c, d) + x % 5 * d + c,
            self.func((x + 4) / 5, a, b, c, d) + (5 - x % 5) % 5 * d + c,
        ]
        .iter()
        .min()
        .unwrap();
        self.memo.insert(x, ans);
        ans
    }

    fn new() -> Self {
        Self {
            memo: std::collections::BTreeMap::new(),
        }
    }
}

fn main() {
    input! {
        testcases: [(usize, usize, usize, usize, usize)],
    }

    for &(n, a, b, c, d) in &testcases {
        let mut memo = Memoized::new();
        println!("{}", memo.func(n, a, b, c, d));
    }
}


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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,N) for(int i=0; i<N; i++)
#define cinv(v,N) vector<int> v(N); for(int i=0; i<N; i++){ cin >> v[i]; }
#define mt make_tuple
const ll MOD2 = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N; cin >> N;
  //main
  
  
  // output
  cout << N*N << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//get the biggest element.
template<typename KeyType, typename ValueType>
std::pair<KeyType,ValueType> get_max( const std::map<KeyType,ValueType>& x ) {
  using pairtype=std::pair<KeyType,ValueType>;
  return *std::max_element(x.begin(), x.end(), [] (const pairtype & p1, const pairtype & p2) {
        return p1.second < p2.second;
  });
}
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;

int main() {
  vector<char> alp = {'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'};
  char s;
  cin >> s;
  if (find(alp.begin(), alp.end(), s) != alp.end()) {
    cout << 'a' << endl;
  } else {
    cout << 'A' << endl;
  }
  return 0;
}


Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        String arr02[] = mylist.get(1).split(" ");
        int n = Integer.valueOf(arr01[0]);
        int m = Integer.valueOf(arr01[1]);

        int mysum = 0;

        for (String s : arr02) {
            mysum += Integer.valueOf(s);
        }

        Stream<String> stream = Arrays.stream(arr02);
        int arr03[] = stream.mapToInt(Integer::parseInt).toArray();
        Arrays.sort(arr03);

//        System.out.println(Arrays.toString(arr03));

        Boolean chkflg = true;
        double data = (double) 1 / (4 * m);

        for (int j = n - 1; j >= n - m; j--) {
            double temp = (double) arr03[j] / mysum;
            //            System.out.println(temp + " " + data);

            if (temp < data) {
                chkflg = false;
                break;
            }

        }

        System.out.println(chkflg ? "Yes" : "No");

    }

}

Measured memory_bytes: 26708
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
struct node
{
    int a,b,c,d;
}re[10000];
int a[1005][1005];
int main()
{
    int h,w;
    scanf("%d%d",&h,&w);
    for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++)
        cin>>a[i][j];
    int cnt=0;
    for(int i=1;i<h;i++)
        for(int j=1;j<=w;j++)
        if(a[i][j]%2==1) a[i][j]--,a[i+1][j]++,re[cnt].a=i,re[cnt].b=j,re[cnt].c=i+1,re[cnt].d=j,cnt++;
    for(int j=1;j<w;j++)
        if(a[h][j]%2==1) a[h][j]--,a[h][j+1]++,re[cnt].a=h,re[cnt].b=j,re[cnt].c=h,re[cnt].d=j+1,cnt++;
    printf("%d\n",cnt);
    for(int i=0;i<cnt;i++)
        printf("%d %d %d %d\n",re[i].a,re[i].b,re[i].c,re[i].d);
}


Measured memory_bytes: 6144
#include<iostream>
#include<cstdio>
using namespace std;
int M[101][101];
int main(){
  int n,u,k,v;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(int j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(j) printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }
  return 0;
}



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

int main() {
	int n, m;
	cin >> n >> m;
	int count_ball[100000];
	for (int i = 0; i < n; ++i)count_ball[i] = 1;
	bool red[100000] = { false };
	red[0] =  true;
	for (int i = 0; i < m; ++i) {
		int x, y;
		cin >> x >> y;
		--x; --y;
		if (red[x]) {
			--count_ball[x];
			++count_ball[y];
			red[y] = true;
			if (count_ball[x] == 0) {
				red[x] = false;
			}
		}
		else {
			--count_ball[x];
			++count_ball[y];
		}
	}
	int ans = 0;
	for (bool i : red) {
		ans += i ? 1 : 0;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 768
import java.util.Scanner;
  
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
while(true){
int H=sc.nextInt();
int W=sc.nextInt();
if(H==0 && W==0){
break;
}
for(int i=0;i<H;i++){
 for(int j=0;j<W;j++){
  int sum=i+j;
  if(sum%2==0){
   System.out.printf("#");
   }else{
   System.out.printf(".");
   }
 }
 System.out.printf("\n");
}
System.out.printf("\n");
}
}
} 

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K,T; cin >> K >> T;
    vector<int> a(T);
    int M=0;
    for (int i=0;i<T;++i) cin >> a[i],M=max(M,a[i]);
    cout << max(0,2*M-K-1) << '\n';
}

Measured memory_bytes: 256
//インクルード(アルファベット順)
#ifndef TEMPLATE
#define TEMPLATE
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<ctime>
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI acos(-1.0)
#define answer(ans) cout<<ans<<endl;
#define input(N) cin >> N ;

#endif // TEMPLATE




signed main() {
ll a,b,c,d,ans;
cin >> a >> b >> c >> d;
ll ac =a*c;
ll ad = a*d;
ll bc = b*c;
ll bd = b*d;

ans = ac;
ans = max(ans,ad);
ans = max(ans,bc);
ans = max(ans,bd);




answer(ans);
return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
typedef long long ll;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int n, h, w;
    cin >> n >> h >> w;
    int ans = 0;
    for(int i=0; i<n; i++){
        int a, b;
        cin >> a >> b;
        if(a >= h && b >= w){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	int weight;
	int i,j;
	int ans[10];
	int flag;
	
	for(;cin >> weight;)
	{
		for(i=0;i<10;i++)
			ans[i]=0;
			
		for(i=0;weight>0;weight/=2,i++)
		{
			ans[i]=weight%2;
			if(weight%2==1)
				flag=i;
		}
		
		for(i=0,j=1;i<10;i++,j*=2)
		{
			if(ans[i]==1 && i<flag)
				cout << j << " " ;
			if(i==flag)
				cout << j ;
				
		}
		cout << endl;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include <math.h>
#include <cmath>
#include <limits>
#include <iostream>
#include <assert.h>

#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=10000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	int x,y,cost;
};
int main(){

	ll h,w;
	ll t;
	cin>>h>>w;
	if(h%3==0||w%3==0){
		cout<<"0"<<endl;
		return 0;
	}
	t=min(h,w);
	ll t2=10000000001;
	for(int i=1; i<w; i++){
		ll s=min(i*h,h/2*(w-i));
		s=min(s,(h/2+h%2)*(w-i));
		ll s2=max(i*h,h/2*(w-i));
		s2=max((h/2+h%2)*(w-i),s2);
		t2=min(t2,s2-s);
	}
	t=min(t,t2);
	t2=10000000001;
	for(int i=1; i<h; i++){
		ll s=min(i*w,w/2*(h-i));
		s=min(s,(w/2+w%2)*(h-i));
		ll s2=max(i*w,w/2*(h-i));
		s2=max((w/2+w%2)*(h-i),s2);
		t2=min(t2,s2-s);
	}
	t=min(t,t2);
	cout<<t<<endl;
	return 0;

}




Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

const pii Dir[8] = { //?????????
	{ 0,1 },{ 0,-1 },{ 1,0 },{ -1,0 },
	{ 1,1 },{ 1,-1 },{ -1,-1 },{ -1,1 }
};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}

signed main() {
	int n, m;
	scanf("%d %d", &n, &m);
	vector<pii> px(n);
	vector<pii> py(n);
	vector<int> pxynum(n);
	REP(i, n) {
		scanf("%d %d", &px[i].first, &px[i].second);
		py[i] = { px[i].second,px[i].first };
	}
	sort(ALL(px));
	sort(ALL(py));
	int cou = 0;
	for (auto cur : px) {
		auto itr = lower_bound(ALL(py), make_pair( cur.second,cur.first ));
		pxynum[cou] = itr - py.begin();
		cou++;
	}

	REP(i, m) {
		int a, b, c, d;
		scanf("%d %d %d %d", &a, &b, &c, &d);

		auto s = lower_bound(ALL(px), make_pair( a,-INT_MAX ));
		auto f = upper_bound(s,px.end(), make_pair(c, INT_MAX));
		int ys = lower_bound(ALL(py), make_pair(b, -INT_MAX))-py.begin();
		int yf = upper_bound(py.begin()+ys,py.end(), make_pair(d, INT_MAX))-py.begin();
		int ans = 0;
		for (int i = s-px.begin(); i < f-px.begin(); i++) {
			if (RANGE(pxynum[i], ys, yf - 1)) {
				ans++;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

int main(){
  int n,k,a,s;
  while(cin>>n>>k,n||k){
    int m=-10001;a=0;
    queue<int> q;
    n-=k;
    while(k--){
      cin>>s;
      a+=s;q.push(s);
    }
    m=max(m,a);
    while(n--){
      cin>>s;
      q.push(s);
      a=a+s-q.front();
      q.pop();
      m=max(m,a);
    }
    cout<<m<<endl;
  }
  return 0;
}

Measured memory_bytes: 1348
/*
 ALLAH is Almighty....
*/
#include <bits/stdc++.h>
using namespace std;

#define pi                            acos(-1.0)
#define fastio                        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cout << setprecision(12)
#define rep(i,a,n)                    for (ll i=a;i<n;i++)
#define per(i,a,n)                    for (ll i=n-1;i>=a;i--)
#define pb                            push_back
#define all(x)                        (x).begin(),(x).end()
#define fi                            first
#define se                            second
#define SZ(x)                         ((ll)(x).size())
#define cin1(x)                       cin >> x
#define cin2(x, y)                    cin >> x >> y
#define cin3(x, y, z)                 cin >> x >> y >> z
#define cin4(x, y, z, _)              cin >> x >> y >> z >> _
#define cin5(x, y, z, p, q)           cin >> x >> y >> z >> p >> q
#define cin6(x, y, z, p, q, r)        cin >> x >> y >> z >> p >> q >> r
#define cou(x)                        cout << x
#define cous(x)                       cout << x << " "
#define coul(x)                       cout << x << "\n"
#define ret(x)                        return x
#define MAX                           1000007
#define start                         int main() {   fastio
#define finish                        ret(0); }
#define Test                          ll _t; cin1(_t); rep(w, 0, _t)
#define fans(x)                       if ( x  ) coul("YES");  else coul("NO")


typedef long long ll;
const ll mod=1000000007;
const ll mx = 3e5 + 7;
const double eps = 1e-7;

// head collected
// Don't use variable name as --> prev, time, _t, w, y1
// Don't use ceil and pow function


ll n, a, b, _, ans, c, _1, _2, m, an, k, need, shuru, _3, _c, _a, _b, way, _0, mex, q;
double d;
ll ar[ mx ], co[ mx ];
string st, st1, st2, isGood;
vector < pair < ll, ll > > vs;
map < string, ll > mm;
set < string > ss;
pair < ll, ll > pr;
bool ok;
char ch;
vector <ll> sie;
ll spf[ MAX + 7 ];
ll prime[ MAX ], ultraPrime[ MAX ], sumOfPrimeArray[ MAX ];



void helpPlz( )
{
    cin1( n );

    rep( i, 1, n + 1 ) {
        cin1( _ );
        if ( _ & 1 && i & 1 )
            ans++;
    }

    coul( ans );
}


start;         // Md. Inzamam-ul Haque

    helpPlz();


finish






Measured memory_bytes: 3648