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

#define mod 1000000007
#define MAX 100005
using namespace std; 

int findb(int b[],int i,int r){

	int ret=upper_bound(b,b+r,i)-b;
	if(ret==r)return -1;
	else return b[ret];

}  

int c2(int k){
	return(k*(k-1)/2);
}

int main(){

	int n;cin>>n;
	double p=n;
	if(n%2==0)p=1.0;
	else {p=(n+1);p=p/n;}
	p=p/2.0;
	cout<<p;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <utility>
#include <cmath>

std::string s;
size_t size;
long long dp[100005][5];
char abc[] = { 'A','B','C' };
constexpr long long mod = 1000000007;
int main() {
	std::cin >> s;
	size = s.size();

	dp[size][3] = 1;

	for (size_t i = size; i > 0; --i)
		for (int j = 3; j >= 0; --j) {
			if (j == 3) {
				int m;
				if (s[i - 1] == '?')
					m = 3;
				else
					m = 1;
				dp[i - 1][j] = m * dp[i][j] % mod;
			}
			else {
				int m1, m2;
				if (s[i - 1] == '?')
					m1 = 3;
				else
					m1 = 1;
				if (s[i - 1] == '?' || s[i - 1] == abc[j])
					m2 = 1;
				else
					m2 = 0;
				dp[i - 1][j] = (m1 * dp[i][j] + m2 * dp[i][j + 1]) % mod;
			}
		}
	std::cout << dp[0][0] << std::endl;
	return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int main(){
  string s;
  cin >> s;

  int ans = (s.size()+1)/2;
  if(s.size()%2==0){
    int i = s.size()/2-1;
    int j = s.size()/2;
    while(i >= 0 && s[i]==s[j]){
      ans++;
      i--; j++;
    }

  }else{
    int i = s.size()/2;
    FOR(j,1,s.size()/2+1){
      if(s[i-j]==s[i] && s[i+j] == s[i]){
        ans++;
      }else{
        break;
      }
    }
  }

  cout << ans << endl;
}



Measured memory_bytes: 512
n, k = map(int, input().split())
x = list(map(int, input().split()))
minX = abs(x[0]) * 2 + abs(x[len(x)-1])
for i in range(n-k+1):
    if x[i] * x[i+k-1] <= 0:
        minX = min(minX, min(abs(x[i]), abs(x[i+k-1]))
                   + abs(x[i]) + abs(x[i+k-1]))
    else:
        minX = min(minX, max(abs(x[i]), abs(x[i+k-1])))
print(minX)


Measured memory_bytes: 14780
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static ConsoleReader;

class Program
{
    static void Main(string[] args)
    {
        var n = Read<int>();
        var k = Read<int>();
        var p = ReadArray<int>(n);

        Array.Sort(p);
        Console.WriteLine(p.Take(k).Sum());
    }
}

public static class IntExtentions
{
    public static void Times(this int n, Action<int> action)
    {
        for (var i = 0; i < n; i++)
        {
            action(i);
        }
    }

    public static void Times(this (int n, int m) dimensions, Action<int, int> action)
    {
        var (n, m) = dimensions;
        n.Times(i => m.Times(j => action(i, j)));
    }
}

public static class ConsoleReader
{
    public static T Read<T>()
        where T : IConvertible
    {
        var inputBuffer = new StringBuilder();
        int currChar;

        while ((currChar = Console.Read()) != -1)
        {
            if (!char.IsWhiteSpace((char)currChar))
            {
                inputBuffer.Append((char)currChar);
            }
            else if (inputBuffer.Length != 0)
            {
                break;
            }
        }

        return (T)Convert.ChangeType(inputBuffer.ToString(), typeof(T));
    }

    public static T[] ReadArray<T>(int count)
        where T : IConvertible
    {
        if (count < 0)
        {
            throw new ArgumentOutOfRangeException(nameof(count), $"'{nameof(count)}' must be >= 0");
        }

        var result = new T[count];

        for (var i = 0; i < count; i++)
        {
            result[i] = Read<T>();
        }

        return result;
    }
}

Measured memory_bytes: 28428
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator sl
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define U (LL)0
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
ST<char>v;
int main()
{
    FAST;
    LL n,m,i,j,k,p,q,o,l,s,t,z;
    string a;
    cin>>a;
    k=0;
    for(i=0;a[i];i++)
    {
        if(v.EM)
        {
            v.PS(a[i]);
        }
        else
        {
            if(v.T!=a[i])
            {
                k+=2;
                v.PP;
            }
            else
            {
                v.PS(a[i]);
            }
        }
    }
    cout<<k<<endl;


    return 0;

}


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

const int maxn=1e5+10;
int dp[maxn],a[maxn];
vector<int>b[maxn];
queue<int>q;

int main()
{
    int n,m;
	int u,v,ans=0;
	cin>>n>>m;
    for(int i=1;i<=m;++i)
    {
    	cin>>u>>v;
		a[v]++;
		b[u].push_back(v);
	}
    for(int i=1;i<=n;++i)
	 if(!a[i])
	  q.push(i);
    while(!q.empty())
    {
    	int tmp=q.front();
    	q.pop();
    	int x=b[tmp].size();
    	for(int i=0;i<x;++i)
    	{
            dp[b[tmp][i]]=max(dp[b[tmp][i]],dp[tmp]+1);
            a[b[tmp][i]]--;
            if(a[b[tmp][i]]==0)
			 q.push(b[tmp][i]);
        }
    }
    for(int i=1;i<=n;++i)
	 ans=max(ans,dp[i]);
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 9740
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n; cin >> n;

    if (1 == n) {
        cout << 0 << endl;
        return 0;
    }

    long long ans = 0;
    for (int i = 1; i < n; i++) {
        ans += i;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()

for i in range(1, 10):
    if 100*i + 10*i + i >= n:
        print(100*i + 10*i + i)
        break

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String n = sc.nextLine();
        char[] c = n.toCharArray();
        int x = 0;
        if(c[0] == c[1] && c[1] == c[2]){
            System.out.println("Yes");
        }else if(c[2] == c[3] && c[1] == c[2]){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }

    }
}

Measured memory_bytes: 21844
import sys
sys.setrecursionlimit(10 ** 8)

from functools import lru_cache


S = int(input())


@lru_cache(None)
def dp(i):
    if i == 0:
        return 1
    elif i < 0:
        return 0
    else:
        res = 0
        for j in range(3, S + 1):
            res += dp(i - j)
            res %= M
        return res % M


M = 10 ** 9 + 7
print(dp(S))

Measured memory_bytes: 70780
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    n = int(input())
    a = list(map(int, input().split()))
    s = sum(a)
    t = [0] * n
    for i in range(n-1):
        t[i+1] = t[i] + a[i]
    print(min(abs(s-2*t[i]) for i in range(1, n)))


if __name__ == '__main__':
    main()


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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        // Read input
        String[] split = br.readLine().split(" ");
        int n = Integer.parseInt(split[0]);
        int k = Integer.parseInt(split[1]);
        split = br.readLine().split(" ");
        int[] stones = new int[n+1];
        for (int i = 0; i < n; i++) {
            stones[i+1] = Integer.parseInt(split[i]);
        }
        
        // Compute answer
        int[] dp = new int[n+1];
        Arrays.fill(dp, Integer.MAX_VALUE);
        dp[1] = 0;
        
        for (int i = 1; i < dp.length-1; i++) {

            int p = 1;
            while(p <= k && i + p < dp.length) {
                dp[i+p] = Math.min(dp[i+p], dp[i] + Math.abs(stones[i] - stones[i+p]));
                p++;
            }
    
        }

        // Print answer
        System.out.println(dp[n]);
    }
}

Measured memory_bytes: 34236
package main

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

func main() {
	var t string
	var s = bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)

	if s.Scan() {
		t = s.Text()
	}

	N, err := strconv.Atoi(t)
	if err != nil {
		return
	}

	if s.Scan() {
		t = s.Text()
	}

	M, err := strconv.Atoi(t)
	if err != nil {
		return
	}

	H := map[int]int{}
	for i := 1; i <= N; i++ {
		if s.Scan() {
			t = s.Text()
		}

		d, err := strconv.Atoi(t)
		if err != nil {
			return
		}

		H[i] = d
	}

	G := map[int]int{}
	for i := 1; i <= N; i++ {
		G[i] = 0
	}

	for i := 1; i <= M; i++ {
		if s.Scan() {
			t = s.Text()
		}

		A, err := strconv.Atoi(t)
		if err != nil {
			return
		}

		if s.Scan() {
			t = s.Text()
		}

		B, err := strconv.Atoi(t)
		if err != nil {
			return
		}

		if H[A] < H[B] {
			G[A]--
		} else if H[A] == H[B] {
			G[A]--
			G[B]--
		} else {
			G[B]--
		}
	}

	count := 0
	for i := 1; i <= N; i++ {
		if G[i] == 0 {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 12192
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

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

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n;
    cin >> n;
    vector<vector<ll>> z(n, vector<ll>(n));
    vector<ll>a(n);
    ll b = 0;
    ll t = n;
    while (t > 0) {
        t /= 2;
        b++;
    }
    for (int j = 0; j < n; j++) {
        a[j] = j;
    }
    for (int i = 1; i < b+1; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = j+1; k < n; k++) {
                if ((a[k] - a[j]) % 2 != 0&& z[j][k] == 0)z[j][k] = i;
            }
        }
        for (int j = 0; j < n; j++) {
            a[j]/=2;
        }
    }
    
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            cout << z[i][j] << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 5436
import math
n, k = map(int, input().split())
aas = list(map(int, input().split()))
diff = pow(10,-6)
left = 1
right = 10**9
def judge(mid):
    cut = 0
    for i in aas:
        cut += math.ceil(i / mid) - 1
    if cut <= k:
        return True
    else:
        return False
while left < right:
    mid = (left + right) / 2
    if (left <= right <= left + diff) or (right <= left <= right + diff):
        break
    elif judge(mid):
        right = mid
    else:
        left = mid
print(math.ceil(left))

Measured memory_bytes: 31076
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long int
#define phi 1.6180339
#define rep(i,n) for(auto i=0;i<(n);i++)
#define endl "\n"
#define For(i,a,b) for(auto i=(a);i<(b);i++)
#define op1 cin.tie(NULL)
#define op2 cout.tie(NULL)
#define op3 std::ios_base::sync_with_stdio(false)
#define MAXX 1000001
using namespace std;
vector<int> arr(MAXX);
void trozen()
{
    int summ=1+2+3;
    int a,b;
    cin>>a>>b;
    summ-=a;
    summ-=b;
    cout<<summ<<endl;
}
int32_t main()
{
    op1;op2;op3;
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    trozen();
    return 0;
}


Measured memory_bytes: 10924
from sys import stdin
from collections import deque

H, W = [int(x) for x in stdin.readline().rstrip().split()]
B = [list(stdin.readline().rstrip()) for _ in range(H)]

q = deque([])

for k in range(H):
    for l in range(W):
        if B[k][l] == '#':
            q.append((k, l, 0))

while len(q) > 0:
    h, w, t = q.popleft()
    if h > 0:
        if B[h - 1][w] == '.':
            B[h - 1][w] = '#'
            q.append((h - 1, w, t + 1))
    if h < H - 1:
        if B[h + 1][w] == '.':
            B[h + 1][w] = '#'
            q.append((h + 1, w, t + 1))
    if w > 0:
        if B[h][w - 1] == '.':
            B[h][w - 1] = '#'
            q.append((h, w - 1, t + 1))
    if w < W - 1:
        if B[h][w + 1] == '.':
            B[h][w + 1] = '#'
            q.append((h, w + 1, t + 1))
    if len(q) == 0:
        print(t)

Measured memory_bytes: 186716
ar = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(ar[k-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;

int N,M;
bool Graph[55][55];
int a[55];
int b[55];

bool DFS() {
  bool can[N][N];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      can[i][j] = false;
    }
  }
  for (int i = 0; i < N; i++) {
    stack<int> st;
    st.push(i);
    while (!st.empty()) {
      int a = st.top();
      st.pop();
      can[i][a] = true;
      for (int j = 0; j < N; j++) {
        if (Graph[a][j]) {
          if (!can[i][j]) {
            can[i][j] = true;
            st.push(j);
          } 
        }
      }
    }
  }
  bool res = true;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (res && can[i][j]) {
        res = true;
      } else {
        res = false;
      }
    }
  }
  return res;
}

int main() {
  int ans = 0;
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
    Graph[a[i]][b[i]] = true;
    Graph[b[i]][a[i]] = true;
  }

  for (int i = 0; i < M; i++) {
    Graph[a[i]][b[i]] = false;
    Graph[b[i]][a[i]] = false;
    if (!DFS()) {
      ans++;
    }
    Graph[a[i]][b[i]] = true;
    Graph[b[i]][a[i]] = true;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
N = int(input())
A = list(map(int, input().split(" ")))

judge = "APPROVED"
for i in range(N):
    if(A[i] % 2 == 0):
        if(A[i] % 3 != 0 and A[i] % 5 != 0):
            judge = "DENIED"

print(judge)

Measured memory_bytes: 3060
import math
A,B,N=map(int,input().split())
D=int(A*B/math.gcd(A,B))
maxi=0
if B-1<=N:
  print(int((B-1)%B*A/B-(A*(B-1))%B/B))
else:
  print(int(N%B*A/B-(A*N)%B/B))

Measured memory_bytes: 9100
#include<bits/stdc++.h>
#define REP(i, n) for (int i=0; i<n; ++i)
#define print(x) cout << x << endl;

using namespace std;

void solve() {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    vector<int> vec;
    int now = 1;
    int cnt = 0;
    REP(i, N) {
        if (S[i] == '0'+now) {
            ++cnt;
        } else {
            vec.push_back(cnt);
            cnt = 1;
            now = 1 - now;
        }
    }
    if (cnt != 0) vec.push_back(cnt);

    int ans = 0;
    int range = K*2 + 1;
    for (int i=0; i<vec.size(); i+=2) {
        int left = i;
        int right = min(i + range, (int)vec.size());
        int tmp = 0;
        for (int j=left; j<right; ++j) {
            tmp += vec[j];
        }
        ans = max(ans, tmp);
    }
    print(ans);

}   

int main() {

    solve();
    return 0;
}

Measured memory_bytes: 1020
#include <stdio.h>
#include <string>
#include <algorithm>
#include <map>
#include <iostream>
#include<math.h>
using namespace std;

int main() {
	int a[6],ans=0;
	for (int i = 0; i < 5; i++)cin >> a[i];
	int mi=9;
	int j;
	for (int i = 0; i < 5; i++) {
		if (mi >= a[i] % 10 && a[i] % 10 > 0) { mi = a[i] % 10; j = i; }
	}

	for (int i = 0; i < 5; i++) {
		if (i == j||a[i]%10==0)ans += a[i];
		else ans += (10 - a[i] % 10) + a[i];
	}
	cout<<ans<<endl;

}


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

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

    static class TaskB {
        public void solve(int testNumber, InputReader sc, PrintWriter w) {

            int n = sc.nextInt();

            int arr[] = new int[n];

            for (int i = 0; i < n; i++)
                arr[i] = sc.nextInt();

            Arrays.sort(arr);
            w.println(arr[n - 1] - arr[0]);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 23252
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <string>
#define LL long long
using namespace std;

string s[10];
int h, w, cnt;

int main() 
{
	cin >> h >> w;
	for(int i = 1; i <= h; i++) cin >> s[i];
	
	for(int i = 1; i <= h; i++)
		for(int j = 0; j < w; j++)
		{
			if(s[i][j] == '#') cnt++;
		}
	cout << (cnt == h+w-1 ? "Possible" : "Impossible") << endl;
	return 0;
}

Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ

int main(){
	int a,b,c,d;scanf("%d%d%d%d",&a,&b,&c,&d);
	if(a!=c)printf("1\n");else printf("0\n");
}


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



class Program
{
    const int MOD = 1000000007;
    const int INF = 1 << 30;
    static void Main(string[] args)
    {
        Solve();
    }




    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();

        int N = sc.intarr[0];

        var BX = new int[N];
        var BY = new int[N];
        var RX = new int[N];
        var RY = new int[N];

        int ans = 0;

        for (int i = 0; i < N; ++i)
        {
            var a = sc.intarr;
            RX[i] = a[0];
            RY[i] = a[1];
        }

        for (int i = 0; i < N; ++i)
        {
            var a = sc.intarr;
            BX[i] = a[0];
            BY[i] = a[1];
        }

        Array.Sort(BX, BY);
        for(int i = 0; i < N; ++i)
        {
            int ry = -1;
            int ryj = 0;
            for(int j = 0; j < N; ++j)
            {
                if (BX[i] > RX[j] && BY[i] > RY[j]&&RY[j]>=0)
                {
                    if (ry < RY[j])
                    {
                        ry = RY[j];
                        ryj = j;
                    }
                }
            }
            if (ry >= 0)
            {
                RY[ryj] = -1;
                ans++;
            }
        }

        wr.wri(ans);
    }
}
    




class Scan
{
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
    public char[] chararr => str.ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 13396
import bisect
N = int(input())
Ls = list(map(int, input().split()))
 
Ls = sorted(Ls)
cnt = 0
for i in range(N):
    l1 = Ls[i]
    for j in range(i+1, N):
        l2 = Ls[j]
        ind = bisect.bisect_left(Ls, l1 + l2)
        cnt += ind - j - 1
print(cnt)

Measured memory_bytes: 3188
N, K = map(int, raw_input().split())

M = 10**9+7

P = [0]*(N+1)
P[0] = 1
for i in range(1, N+1):
  P[i] = P[i-1]*i%M

def C(a, b):
  return P[a]*pow(P[b], M-2, M)*pow(P[a-b], M-2, M)%M

for i in range(1, K+1):
  if N-K+1>=i:
    print C(N-K+1, i)*C(K-1, i-1)%M
  else:
    print 0


Measured memory_bytes: 2692
#include <stdio.h>
#include <stdlib.h>
int compar(const void *a, const void *b)
{
     return *(int *)a - *(int *)b;
}

int main(){
 int i,k,N,K,h[100000],ans;
 scanf("%d%d",&N,&K);
 for(i=0;i<N;i++){
    scanf("%d",&h[i]);
 }

//quicksort
	qsort(h,N,4,compar);

//出力
ans=h[K-1]-h[0];
for(i=1;i+K-1<N;i++){
   if(ans>h[i+K-1]-h[i]){ans=h[i+K-1]-h[i];}
}
 printf("%d\n",ans);
 return 0;
}

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

int main(){
  int x,y,z;
  cin>>x>>y>>z;
  cout << z << " " << x << " " << y << endl;
}

Measured memory_bytes: 3608
#include<iostream>
using namespace std;
int main()
{
    long long int N,i,x;
    cin>>N;
    x=N;
    i=0;
    while(x)
    {
        i=i+x%10;
        x=x/10;
    }
    if(N%i==0)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long A, long long B){
  REP(10000){
    if(i*8/100==A&&i*1/10==B){
      cout<<i<<endl;
      return;
    }
  }
  cout<<-1<<endl;
  return;
}

int main(){
  cout<<setprecision(1000);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int a, b, c;
	int sum_5 = 0, sum_7 = 0;
	cin >> a >> b >> c;
	if( a == 5 )
		sum_5++;
	if( a == 7 )
		sum_7++;
	if( b == 5 )
		sum_5++;
	if( b == 7 )
		sum_7++;
	if( c == 5 )
		sum_5++;
	if( c == 7 )
		sum_7++;
	if( sum_5 == 2 and sum_7 == 1 )
		cout << "YES";
	else
		cout  << "NO";
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class ConnectNodeInfo{
	vector<vector<pair<ll,ll>>> graph;
public:
	ConnectNodeInfo(int node_num){
		graph.resize(node_num);
	}
	void AddNonDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
		graph[v].emplace_back(u,w);
	}
	void AddDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
	}
	vector<pair<ll,ll>>& operator[](ll index){
		return graph[index];
	}
	size_t size(){return graph.size();}
};

class WarshallFloyd{
	vector<vector<ll>> dist;
public:
	void CalcShortestPath(ConnectNodeInfo& connect){
		int V = connect.size();
		dist.resize(V,vector<ll>(V,1LL<<60));

		REP(i,V){
			dist[i][i]=0;
			int U = connect[i].size();
			REP(j,U){
				dist[i][connect[i][j].first] = connect[i][j].second;
			}
		}

		REP(k,V){
			REP(i,V){
				REP(j,V){
					if(dist[i][k]!=(1LL<<60) && dist[k][j]!=(1LL<<60)){
						dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
					}
				}
			}
		}
	}
	bool HasNegativeLoop(){
		bool flag = false;
		for(int i=0,ei=dist.size();i<ei;i++){
			if(dist[i][i]<0){
				flag = true;
				break;
			}
		}
		return flag;
	}
	ll CalcDiameter(){
		ll diameter = -(1LL<<60);
		int V = dist.size();
		REP(i,V){
			REP(j,V){
				if(dist[i][j]<1LL<<60){
					diameter = max(diameter,dist[i][j]);
				}
			}
		}
		return diameter;
	}
	ll GetDistance(int i,int j){
		return dist[i][j];
	}
};

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

	while(true){
		int N=in();
		if(!N) break;
		
		ConnectNodeInfo connect(10);
		REP(i,N){
			int u=in(),v=in(),w=in();
			connect.AddNonDirectionalConnection(u,v,w);
		}

		WarshallFloyd WF;
		WF.CalcShortestPath(connect);
		ll ansI,ansD=1LL<<60;
		REP(i,10){
			if(connect[i].empty()) continue;
			ll sum = 0;
			REP(j,10){
				auto dist = WF.GetDistance(i,j);
				if(dist<1LL<<60) sum+=dist;
			}
			if(sum<ansD){
				ansI = i;
				ansD = sum;
			}
		}
		out(ansI,ansD);
	}
	return 0;
}


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

#define SIZE 257

int table[256][256];

enum {
	RIGHT_DOWN = 0,
	DOWN,
	LEFT_DOWN
};

int current_counts[SIZE][3]; //1ツ篠淞：ツ暗環置ツ、2ツ篠淞：ツ古シツつォ
int next_counts[SIZE][3];
int max_count = 0;

void init_counts() {
	for (int i = 0; i < SIZE; ++i) {
		for (int j = 0; j < 3; ++j) {
			current_counts[i][j] = next_counts[i][j] = 0;
		}
	}
}

void check_max(int expect) {
	if(expect > max_count) {
		max_count = expect;
	}
}

int main() {
	while (true) {
		int n;
		cin >> n;
		if(n == 0) {
			break;
		}
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				char o;

				cin >> o;
				table[i][j] = o - '0';
			}
		}

		init_counts();
		max_count = 0;
		int cont_vertical = 0;

		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				if(table[i][j] == 1) {
					cont_vertical++;

					next_counts[j][DOWN] = current_counts[j][DOWN] + 1;
					if(j+1 < n) {
						next_counts[j+1][RIGHT_DOWN] = current_counts[j][RIGHT_DOWN] + 1;
					}
					else {
						check_max(current_counts[j][RIGHT_DOWN] + 1);
					}
					if(j > 0) {
						next_counts[j-1][LEFT_DOWN] = current_counts[j][LEFT_DOWN] + 1;
					}
					else {
						check_max(current_counts[j][LEFT_DOWN] + 1);
					}
				}
				else {
					check_max(cont_vertical);
					cont_vertical = 0;
					for (int k = 0; k < 3; ++k) {
						check_max(current_counts[j][k]);
					}
				}
			}
			check_max(cont_vertical);
			cont_vertical = 0;
			for (int j = 0; j < n; ++j) {
				for (int k = 0; k < 3; ++k) {
					current_counts[j][k] = next_counts[j][k];
					next_counts[j][k] = 0;
				}
			}
		}
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < 3; ++j) {
				check_max(current_counts[i][j]);
			}
		}

		cout << max_count << endl;
	}
	return 0;
}

Measured memory_bytes: 1128
import sys

import sys
N = int(input())
turn = 0
point = 0
out = 0
base = [0, 0, 0]

point_list = []
for idx, line in enumerate(sys.stdin):
    if line == 'HOMERUN\n':
        # print('homerun')
        cnt = 1
        if base[0] == 1:
            cnt += 1
        if base[1] == 1:
            cnt += 1
        if base[2] == 1:
            cnt += 1
        point += cnt
        # print('point: %s' % point)
        base = [0, 0, 0]

    if line == 'HIT\n':
        # print('hit')
        if base[2] == 1:
            base[2] = 0
            point += 1
            # print('point: %s' % point)
        if base[1] == 1:
            base[2] = 1
        if base[0] == 1:
            base[1] = 1
        if base[0] == 0:
            base[0] = 1
        # print(base)

    if line == 'OUT\n':
        # print('out')
        out += 1
        # print(out)
        if out == 3:
            # print('change')
            point_list.append(point)
            turn += 1
            point = 0
            base = [0, 0, 0]
            out = 0
            if turn == N:
                # print('gameset')
                break
            continue

for e in point_list:
    print(e)

Measured memory_bytes: 6748
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
#define MOD                 1000000007LL
#define EPS                 1e-9
#define io                  ios_base::sync_with_stdio(false);cin.tie(NULL);

const int MAXN = 1e5+5;

int main(){
	io;
	int a, b;
	cin >> a >> b;
	string s;
	cin >> s;
	if(s[a] != '-'){
		cout << "No" << endl;
		return 0;
	}
	if(s.size() != a+b+1){
		cout << "No" << endl;
		return 0;
	}
	for(int i = 0;i < s.size(); i++){
		if(i == a)
			continue;
		if(s[i] >= '0' && s[i] <= '9')
			continue;
		else{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def count_divisor(a, b, c):
    return b//c - a//c + (a%c == 0)
    
a, b, c, d = map(int, input().split())
ans = b - a + 1
lcm = int(c * d / gcd(c, d))
ans -= count_divisor(a, b, c)
ans -= count_divisor(a, b, d)
ans += count_divisor(a, b, lcm)
print(ans)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main() {
	long long n;
	cin >> n;
	if (n == 0) {
		long long ans=2;
		cout << ans << endl;
	}
	else if (n == 1) {
		long long ans_1 = 1;
		cout << ans_1 << endl;
	}
	else {
		long long a = 2;
		long long b = 1;
		long long c = 0;
		for (long long i = 0;i < n;i++) {
			c = a + b;
			a = b;
			b = c;

		}
		cout << a << endl;
	}



}

Measured memory_bytes: 256
// Sea the world.

#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <bitset>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

using namespace std;

// SELF TEMPLATE CODE BGEIN

#define SZ(x) ((int)((x).size()))
#define OUT(x) printf(#x" %d\n", x)
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repf(i,a,b) for (int i = (a); i <= (b); ++i)
#define repd(i,a,b) for (int i = (a); i >= (b); --i)
#define repcase int t, Case = 1; for (scanf ("%d", &t); t; --t)

typedef long long int64;
typedef pair<int, int> pii;

int sgn(double x) { return (x > 1e-8) - (x < -1e-8); }
int count_bit(int x) { return x == 0? 0 : count_bit(x >> 1) + (x & 1); }

template<class T> inline void to_min(T &a, const T b) { if (b < a) a = b; }
template<class T> inline void to_max(T &a, const T b) { if (b > a) a = b; }

// SELF TEMPLATE CODE END

const int maxn = 200 + 10;

int n, a[maxn];

int main() {
  ios::sync_with_stdio(false);

  while(cin >> n) {
    rep (i, 2 * n) {
      cin >> a[i];
    }
    sort(a, a + 2 * n);
    int ans = 0;
    for (int i = 0; i < 2 * n; i += 2) {
      ans += a[i];
    }
    printf("%d\n", ans);
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T> ostream& operator << (ostream& os, const set<T>& s) { for (auto e : s) os << e; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { (a += b % mod) %= mod; if (a < 0) a += mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12); // debuged
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  int a, b;
  cin >> a >> b;
  if (a >= 10 || b >= 10) cout << -1 << endl;
  else {
    cout << a * b << endl;
  }
}


Measured memory_bytes: 3624
package main

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

func main() {
	N := ReadInt()
	m := make(map[string]bool)
	for i := 0; i < N; i++ {
		m[ReadString()] = true
	}
	if len(m) == 4 {
		fmt.Println("Four")
	} else {
		fmt.Println("Three")
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1840
N = int(input())
A = sorted(list(map(int, input().split())))
mod = 10 ** 9 + 7
flag = True
if N % 2 == 0:
    for i in range(N // 2):
        if A[2 * i] != 2 * i + 1 or A[2 * i + 1] != 2 * i + 1:
            flag = False
else:
    if A[0] != 0:
        flag = False
    for i in range(1, N // 2 + 1):
        if A[2 * i - 1] != 2 * i or A[2 * i] != 2 * i:
            flag = False
if flag:
    print((2 ** (N // 2)) % mod)
else:
    print(0)


Measured memory_bytes: 52844
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    x, a = LI()
    if x < a:
        print(0)
    else:
        print(10)
    return

#B
def B():
    n, x = LI()
    L = LI()
    ans = 0
    c = 1
    for i in L:
        ans += i
        if ans <= x:
            c += 1
            continue
        break
    print(c)
    return

#C
def C():
    W, H, x, y = LI()
    a = W * H / 2
    b = 0
    if W/2 == x and H/2 == y:
        b = 1
    print(a,b)
    return

#D
def D():
    n, k = LI()
    a = LI()
    dp = [0] * (n)
    for i in range(n):
        dp[i] += dp[i - 1] + a[i]
    ans = 0
    dp.insert(0, 0)
    #print(dp)
    for i in range(1,n+1):
        ai = bisect_left(dp, k + dp[i-1])
        ans += n+1 - ai
        #print(ai, i, k + dp[i-1])
    print(ans)

    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    C()


Measured memory_bytes: 38640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define nn 102
#define lf double
char buf[nn][nn];
int dp[2][nn][nn][nn];
int n,m;
int sum[nn][nn];
int get(int x1,int y1,int x2,int y2)
{
	if(x1<1) x1=1;if(y1<1) y1=1;
	if(x2>n) x2=n;if(y2>m) y2=m;
	return sum[x2][y2]-sum[x1-1][y2]-sum[x2][y1-1]+sum[x1-1][y1-1];
}
void upd(int &x,int y)
{
	x=max(x,y);
}
int ex,ey;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%s",buf[i]+1);
	for(int i=1;i<=n;i++) 
		for(int j=1;j<=m;j++) 
			{
				sum[i][j]=sum[i][j-1]+sum[i-1][j]-sum[i-1][j-1]+(buf[i][j]=='o');
				if(buf[i][j]=='E') ex=i,ey=j;
			}
	int now=0;int ans=0;
	memset(dp,0x80,sizeof(dp));
	dp[0][0][0][0]=0;
	for(int up=0;up<=n;up++)
	{
		for(int down=0;down<=n;down++)
		{
			for(int left=0;left<=m;left++)
			{
				for(int right=0;right<=m;right++)
				{
				//	if(ex+down<=n-up and ex-up>down and ey+right<=m-left and ey-left>right) ;
				//		else continue;
					
					if(ey-left<1 or ex-up<1 or ex+down>n or ey+right>m) continue;

					int ct=dp[now][down][left][right];
				ans=max(ans,ct);int l,r;
			//	if(ct==4)	cout<<up<<" "<<down<<" "<<left<<" "<<right<<"\n";
					
					
					l=max(ey-left,ey+right-ey+1),r=min(ey+right,ey-left+m-ey);
					
					
					if(ex-up-1>down)
						upd(dp[!now][down][left][right],
						ct+get(ex-up-1,l,ex-up-1,r));
					
					
					if(ex+down+1<=n-up)
						upd(dp[now][down+1][left][right],
						ct+get(ex+down+1,l,ex+down+1,r));
					
					
					l=max(ex-up,ex+down-ex+1),r=min(ex+down,ex-up+n-ex);
					
					
					if(ey-left-1>right)
						upd(dp[now][down][left+1][right],
						ct+get(l,ey-left-1,r,ey-left-1));
					
					
					if(ey+right+1<=m-left)
						upd(dp[now][down][left][right+1],
						ct+get(l,ey+right+1,r,ey+right+1));
				}
			}
		}
		memset(dp[now],0x80,sizeof(dp[now]));
		now^=1;
	}
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 8576
A,B,M = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
d = []
ans = a[0]+b[0]
for i in range(M):
    d.append(list(map(int,input().split())))
for i in range(M):
    x = a[d[i][0]-1] + b[d[i][1]-1] - d[i][2]
    if x < ans:
        ans = x
a.sort()
b.sort()
print(min(a[0]+b[0],ans))

Measured memory_bytes: 81900
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int a,b,k;
	scanf("%d%d%d",&a,&b,&k);
	for(int i=a;i<=min(a+k-1,b);i++)
		printf("%d\n",i);
	for(int i=max(a+k,b-k+1);i<=b;i++)
		printf("%d\n",i);
	return 0;
}



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

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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int N; cin >> N;
    vector<string> s(N);
    for (int i = 0; i < N; ++i){
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
    }
    sort(s.begin(), s.end());

    ll ans = 0;
    for (ll i = 0; i < N;){
        ll j = i + 1;
        for(; j < N; ++j){
            if(s[i] != s[j]) break;
        }
        ans += (j - i) * (j - i - 1) / 2LL;
        i = j;
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 7296
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long ll;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
int main(void){
  int cnt[3];
  cnt[0]=0;
  cnt[1]=0;
  cnt[2]=0;
  string n;
  cin >> n;
  REP(i,n.size()){
    if(n[i]=='a') cnt[0]++;
    if(n[i]=='b') cnt[1]++;
    if(n[i]=='c') cnt[2]++;
  }
  REP(i,n.size()){
    if(cnt[i]>1){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;

}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for (int i = 0; i < N; i++) cin >> H.at(i);
  sort(H.rbegin(), H.rend());
  K = min(N, K);
  cout << accumulate(H.begin() + K, H.end(), 0L) << "\n";
}

Measured memory_bytes: 4020
#include <stdio.h>
    
int main(){
 int array[3],tmp,i,j;
 for(i=0;i<3;i++){
  scanf("%d",&array[i]);
 } 
 for(i=0;i<2;i++){
  for(j=0;j<2-i;j++){
   if(array[j]>array[j+1]){
    tmp=array[j];
    array[j]=array[j+1];
    array[j+1]=tmp;
   }
  }
 }
 printf("%d %d %d\n",array[0],array[1],array[2]);
 return 0;
}

Measured memory_bytes: 596
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

N,X = map(int,input().split())
x = list(map(int,input().split(" ")))


for i in range(N):
	x[i] = x[i]-X

print(abs(gcd_list(x)))


Measured memory_bytes: 16304
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000


int main(){
	
	int K;
	cin>>K;
	
	vector<long long> A(K);
	for(int i=0;i<K;i++){
		cin>>A[i];
	}
	
	long long ok1 = Inf;
	long long ng1 = 0;
	
	while(ok1-ng1>1){
		long long mid = (ok1+ng1)/2;
		long long k = mid;
		for(int i=0;i<K;i++){
			k = (k/A[i])*A[i];
		}
		if(k>=2)ok1=mid;
		else ng1=mid;
	}
	
	long long ok2 = 0;
	long long ng2 = Inf;
	
	while(ng2-ok2>1){
		long long mid = (ok2+ng2)/2;
		long long k = mid;
		for(int i=0;i<K;i++){
			k = (k/A[i])*A[i];
		}
		if(k>2)ng2=mid;
		else ok2=mid;
	}
	
	if(ok2>=ok1){
		cout<<ok1<<' '<<ok2<<endl;
	}
	else{
		cout<<-1<<endl;
	}
		
	
	return 0;
	
}


Measured memory_bytes: 1024