akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

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

        if (k < a) {
            System.out.println(String.format("%d %d",a-k,b));
        } else if (k <= a+b) {
            long c = b - (k-a);
            System.out.println(String.format("0 %d",c));
        } else {
            System.out.println("0 0");
        }
    }
}

Measured memory_bytes: 23892
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int ans = 0;

		while(true) {
			int a = sc.nextInt();
			String op = sc.next();
			int b = sc.nextInt();
			if(op.equals( "?")) {
				break;
			}
			switch(op) {
			case "+":
				ans = a+b;
			break;
			case "-":
				ans = a-b;
			break;
			case "*":
				ans = a*b;
			break;
			case "/":
				ans = a/b;
			break;

			}

			System.out.println(ans);
		}



    }

}



Measured memory_bytes: 26228
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <math.h>
#include <iomanip>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int static const b_max = 200;

int N,M,C;
int a;
int b[b_max];

int main(){
  cin>>N>>M>>C;
  rep(i,M)cin>>b[i];

  int res_count = 0;

  rep(i,N){
    int sum = 0;
    rep(j,M){
      cin>>a;
      sum += a * b[j];
    }
    sum += C;
    if(sum > 0) res_count++;
  }
  cout<< res_count << endl;
}

Measured memory_bytes: 256
import sys

def divisors(n):
  res = set()
  for i in range(1, int(n ** 0.5) + 1):
    if n % i: continue
    res.add(i)
    res.add(n // i)
  return res

x = int(sys.stdin.readline().rstrip())

def f(a, b): return pow(a, 5) - pow(b, 5)

def ternary_search(d):
    lo, hi = -1, 10 ** 18
    while lo + 1 < hi:
        a = (lo + hi) // 2 
        b = a - d 
        bl = a >= abs(b)
        bl2 = f(a, b) >= x
        if bl ^ bl2: lo = a
        else: hi = a
    return hi, hi - d

def main():
    diffs = divisors(x)
    for d in diffs:
        a, b = ternary_search(d)
        if f(a, b) == x:
            print(a, b)
            return 

if __name__ == '__main__':
    main()

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

int main(){

    int A[3][3];
    for (size_t i = 0; i < 3; i++)
    {
        for (size_t j = 0; j < 3; j++)
        {
            cin >> A[i][j];
        }
        
    }

    int N;
    cin >> N;
    int b[N];
    for (size_t i = 0; i < N; i++)
    {
        cin >> b[i];
        for (size_t j = 0; j < 3; j++)
        {
            for (size_t k = 0; k < 3; k++)
            {
                if(b[i]==A[k][j])A[k][j]=0;
            }
            
        }
    }

    for (size_t i = 0; i < 3; i++)
    {
        if((A[i][0] == A[i][1] && A[i][1] == A[i][2]) || (A[0][i] == A[1][i] && A[1][i] == A[2][i])){
            cout << "Yes" <<endl;
            return 0;
        }
    }

    if((A[0][0] == A[1][1] &&  A[1][1] == A[2][2]) || (A[0][2] == A[1][1] && A[1][1] == A[2][0])){
        cout << "Yes" <<endl;
        return 0;
    }

    cout << "No" <<endl;
        
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    cout << fixed << setprecision(10);
    ll N; cin >> N;
    vector<ld> x(N), y(N);
    vector<ll> v(N);
    rep(i, N) {
        cin >> x[i] >> y[i];
        v[i] = i + 1;
    }

    ld pcnt = 0, sum = 0;
    do {
        rep(i, N - 1) {
            sum += sqrt(pow((x[v[i] - 1] - x[v[i + 1] - 1]), 2) + pow((y[v[i] - 1] - y[v[i + 1] - 1]), 2));
        }
        pcnt++;
    } while (next_permutation(v.begin(), v.end()));
    ld ans = sum / pcnt;
    cout << ans << endl;
}

Measured memory_bytes: 3820
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define ssd ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>


int main()
{
	ssd
	#define task "TASK"
	 //freopen(task".inp","r",stdin);
    //freopen(task".out","w",stdout);
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    for(ll i=0;i<n;i++)
    {
        if(i==k-1)
        {
            cout<<((char)tolower(s[i]));
        }
        else
        {
            cout<<s[i];
        }
    }

	return 0;
}


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

typedef long long ll;

const ll INF = 1e9+7;
const int LIMN = 102;
const int LIMP = 1002;

ll pd[2][LIMN*LIMP];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int N, W;
    cin >> N >> W;
    
    for(int i=0; i<2; i++){
        for(int j=0; j<LIMN*LIMP; j++) pd[i][j] = INF;
    }
    pd[0][0] = 0;
    
    int lv = 0;
    for(int i=0, v, w; i<N; i++){
        cin >> w >> v;
        
        for(int j=0; j<=lv; j++){
            pd[1][j+v] = min(pd[1][j+v], pd[0][j]+w);
            pd[1][j] = min(pd[1][j], pd[0][j]);
        }
        
        lv += v;
        
        for(int j=0; j<=lv; j++){
            pd[0][j] = pd[1][j];
            pd[1][j] = INF;
        }
    }
    
    for(int j=lv; j>=0; j--){
        if(pd[0][j] <= W){
            cout << j;
            break;
        }
    }
    
	return 0;
}

Measured memory_bytes: 1920
a,b = list(map(int,input().split()))

if a>0:
    out = "Positive"
elif a<=0 and 0<=b:
    out = "Zero"
else:
    C = b-a
    if C%2==1:
        out = "Positive"
    else:
        out = "Negative"
print(out)


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

int main(){
  int N,Y;
  cin >>N>>Y;
  int A = -1,B=-1,C=-1;
  for(int a =0;a<=N;a++){
    for(int b=0;b<=N-a;b++){
      int c = (Y-10000*a-5000*b)/1000;
      if(a+b+c==N){
        A=a;B=b;C=c;
      }
    }
  }
  cout<<A<<" "<<B<<" "<<C<<endl;
}

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

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int n=Integer.parseInt(bu.readLine());
        int i,l=0; boolean oc=false;
        for(i=0;i<n;i++)
        {
            String s[]=bu.readLine().split(" ");
            int d1=Integer.parseInt(s[0]),d2=Integer.parseInt(s[1]);
            if(d1==d2) l++;
            else
            {
                if(l>=3) oc=true;
                l=0;
            }
        }
        if(l>=3) oc=true;
        if(oc) sb.append("Yes\n");
        else sb.append("No\n");
        System.out.print(sb);
    }
}


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

int main() {
	int n;
	cin >> n;
	int a[100];
	for (int i=0;i!=n;i++){
		cin >>a[i];
	}
	int answer;
	for (int i=0;i!=n;i++){
		if(a[i]==a[i+1]){
			answer+=1;
			a[i+1]+=1;
			if(a[i+1]==a[i+2]){
				a[i+1]+=1;
			}
		}
	}
        cout << answer <<endl;
}


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

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

    int n,res; cin>>n;
    vector<int> a(n);
    for(int i=0; i<n; i++) {
        cin>>a[i];
        cout<<a[i]<<(i==n-1 ? '\n' : ' ');
    }
    for(int i=1; i<n; i++) {
        for(int j=0; j<i; j++) {
            if(a[j]>a[i]) {
                res = a[i];
                a.erase(a.begin()+i);
                a.insert(a.begin()+j,res);
                break;
            }
        }
        for(int j=0; j<n; j++) cout<<a[j]<<(j==n-1 ? '\n' : ' ');
    }
}


Measured memory_bytes: 3240
/*
    ____        __
   / __ \____  / /_  ____ _____ ___
  / /_/ / __ \/ __ \/ __ `/ __ `__ \
 / _, _/ /_/ / / / / /_/ / / / / / /
/_/ |_|\____/_/ /_/\__,_/_/ /_/ /_/
*/
#include<bits/stdc++.h>

typedef long long ll ;

#define pll pair<ll , ll >
#define X   first
#define Y   second
#define mp  make_pair
#define pii pair<int , int>
#define vec vector
#define vpii vector<pair<int , int>>
#define i_n   int i = 0 ; i< n ; i++
#define cn  int n ; cin>>n
#define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define cina int a[n] ; for(int i = 0 ; i < n ; i++) cin>>a[i]
#define pb push_back

using namespace std;
const int maxn = 1000*100+5 ;
const ll inf = 9223372036854775807 ;

int n , sum , k , a[maxn] ; 

int main()
{
	migmig ;
cin>>k>>n ; 
for(int i = 1 ; i <= n ; i++ )
{
	int x ; 
	cin>>x ; 
	sum += x ; 
}
if(sum >= k) cout<<"Yes" ; 
else cout<<"No" ; 

}
//////
////////
///////////




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

using namespace std;

int main() {
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> vec(n, 0);

  for (int i = 0; i < q; ++i) {
    int a;
    cin >> a;
    ++vec[a - 1];
  }

  for (auto &v : vec) {
    bool flag = k - q + v > 0;
    cout << (flag ? "Yes" : "No") << endl;
  }
}

Measured memory_bytes: 1024
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

struct unionfind {
	vi data, rank;
	// Initialize
	unionfind(int size) {
		REP(i, size) {
			data.push_back(i);
			rank.push_back(0);
		}
	}
	// Find root
	int find(int x) {
		return (data[x] == x) ? x :	data[x] = find(data[x]);
	}
	// Unite
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if(x == y) return;
		if(rank[x] < rank[y]) {
			data[x] = y;
		} else {
			data[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}
	// Whether x and y belong to the same set
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

int main() {
	vi f(1001);
	f[0] = 1;
	f[1] = 2;
	FOR(i, 2, 1000) {
		f[i] = (f[i-1] + f[i-2])%1001;
	}

	int N, d;
	while(cin >> N >> d) {
		unionfind uf(N+1);

		FOR(i, 1, N) {
			FOR(j, i+1, N) {
				if(abs(f[i]-f[j]) < d) {
					uf.unite(i, j);
				}
			}
		}

		int ans = 0;
		vi memo(N+1, 0);
		FOR(i, 1, N) {
			int root = uf.find(i);
			if(memo[root] == 0) {
				memo[root] =1;
				ans++;
			}
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1236
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
#define MAX_N 100001
#define MAX_M 100001
#define MP make_pair
using namespace std;
typedef pair<int, int> PA;

vector<PA> pref_seq[MAX_N];
PA number_seq[MAX_M];

int main() {
    int N, M, P, Y;
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> P >> Y;
        pref_seq[P].push_back(MP(Y, i));
    }
    for (int i = 1; i <= N; i++) {
        sort(pref_seq[i].begin(), pref_seq[i].end());
        for (int j = 0; j < pref_seq[i].size(); j++) {
            number_seq[pref_seq[i][j].second] = MP(i, j + 1);
        }
    }
    for (int i = 0; i < M; i++) {
        int zero_count1 = 0, zero_count2 = 0, number1 = number_seq[i].first, number2 = number_seq[i].second;
        while (number1 > 0) {
            zero_count1++;
            number1 /= 10;
        }
        while (number2 > 0) {
            zero_count2++;
            number2 /= 10;
        }
        for (int j = 0; j < 6 - zero_count1; j++) cout << 0;
        cout << number_seq[i].first;
        for (int j = 0; j < 6 - zero_count2; j++) cout << 0;
        cout << number_seq[i].second << endl;;
    }
    return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int cnt[100005];

int main() {
  int n;
  cin >> n;
  rep(i, n) {
    int d;
    cin >> d;
    cnt[d]++;
  }
  rep(i, 100000) cnt[i + 1] += cnt[i];

  int ans = 0;
  rep(i, 100001) {
    if (n - cnt[i] == cnt[i]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
string s,t;
short n,m,dp[3009][3009],pres[3009][3009],pret[3009][3009];
bool cho[3009][3009];
void print(int ss,int tt) {
	if(!ss&&!tt) {
		if(cho[0][0]) cout<<s[0];
		return;
	}
	print(pres[ss][tt],pret[ss][tt]);
	if(cho[ss][tt]) cout<<s[ss];
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>s>>t;
	n=s.size();
	m=t.size();
	if(s[0]==t[0]) {
		dp[0][0]=1;
		cho[0][0]=1;
	}
	for(short i=1;i<n;i++) {
		dp[i][0]=dp[i-1][0];
		pres[i][0]=i-1;
		pret[i][0]=0;
		if(s[i]==t[0]&&dp[i][0]<1) {
			dp[i][0]=1;
			pres[i][0]=0;
			pret[i][0]=0;
			cho[i][0]=1;
		}
	}
	for(short i=1;i<m;i++) {
		dp[0][i]=dp[0][i-1];
		pres[0][i]=0;
		pret[0][i]=i-1;
		if(s[0]==t[i]&&dp[0][i]<1) {
			dp[0][i]=1;
			pres[0][i]=0;
			pret[0][i]=0;
			cho[0][i]=1;
		}
	}
	for(short i=1;i<n;i++)
		for(short j=1;j<m;j++) {
			if(dp[i-1][j]>dp[i][j-1]) {
				dp[i][j]=dp[i-1][j];
				pres[i][j]=i-1;
				pret[i][j]=j;
			}
			else {
				dp[i][j]=dp[i][j-1];
				pres[i][j]=i;
				pret[i][j]=j-1;
			}
			if(s[i]==t[j]&&dp[i][j]<dp[i-1][j-1]+1) {
				dp[i][j]=dp[i-1][j-1]+1;
				pres[i][j]=i-1;
				pret[i][j]=j-1;
				cho[i][j]=1;
			}
		}
	print(n-1,m-1);
	return 0;
}

Measured memory_bytes: 62336
#include <iostream>

using namespace std;

int a,b,c;
int main()
{
    cin >> a >> b;
    if (a == 1 || a== 2) {
        if (b == 1 || b == 2) {
            c = 3;
        }
    }
    if (a == 1 || a== 3) {
            if (b == 1 || b == 3) {
                c = 2;
        }
    }
    if (a == 2 || a== 3) {
            if (b == 2 || b == 3) {
                c = 1;
        }
    }
    cout << c;
    return 0;
}


Measured memory_bytes: 256
open Scanf
open Printf
open String;;

(* sscanf (read_line ()) "%d %d" 
   (fun x y -> printf "%d" ((x-1)*(y-1)));; *)



(* let abb s = (sub s 0 1) 
            ^ (string_of_int (length s - 2))
            ^ (sub s (length s - 1) 1);;

sscanf (read_line ()) "%s"
          (fun s -> printf "%s" (abb s));; *)

let judge l =
  let len = List.length l in
  let f l = List.fold_left 
              (fun (x,l') y -> if y mod 4==0 then (x+1,l') else (x,y::l')) (0,[]) l in
  let g l = List.fold_left (fun x y -> x + if y mod 2!=0 then 1 else 0) 0 l in
  let (four, fourl) = f l in
  if four >= len/2 then true else
    if g fourl <= four then true else false

let usage n = 
  let list = ref [] in
  for i = 1 to n do
    list := (scanf (if i < n then "%d " else "%d") (fun x -> x))::!list
  done; !list;;

sscanf (read_line ()) "%d" 
   (fun x -> printf "%s" (if judge (usage x) then "Yes" else "No"));;



Measured memory_bytes: 6656
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt();

		int sum = 0;
		int boundtime = 1;
		int i=0;
		do {
			i++;
			sum+=sc.nextInt();
			if(sum <= X) {
				boundtime++;
			}
		}while(i < N);
		sc.close();
		System.out.println(boundtime);
	}

}


Measured memory_bytes: 23508
# coding: utf-8
# Your code here!
import sys
import itertools

def main():
    n = int(sys.stdin.readline())
    
    ans_count = 0
    for i in range(1, n+1, 2):
        count = 1 # 自分自身を含む
        for j in range(1, i//2):
            count = count + 1 if i % j == 0 else count
        ans_count = ans_count + 1 if count==8 else ans_count
    print(ans_count)
            
                
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
#define mod 1000000007
//#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT{
    __INIT(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout<<fixed<<setprecision(15);
    }
}__init;

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll t1 = a*c;
    ll t2 = a*d;
    ll t3 = b*c;
    ll t4 = b*d;
    cout<<(ll)(max({t1,t2,t3,t4}))<<endl;
    return 0;
}

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

int dfs(int x, int y, int t) {
	if (!t) {
		for (int i = 1; i <= x/2; i++) {
			if (dfs(x - i * 2, y + i, !t) == 0) return 0;
		}
		for (int i = 1; i <= y/2; i++) {
			if (dfs(x + i, y - i * 2, !t) == 0) return 0;
		}
		return 1;
	} else {
		for (int i = 1; i <= x/2; i++) {
			if (dfs(x - i * 2, y + i, !t) == 1) return 1;
		}
		for (int i = 1; i <= y/2; i++) {
			if (dfs(x + i, y - i * 2, !t) == 1) return 1;
		}
		return 0;
	}
}

int main() {
	
		long long X, Y;
	cin >> X >> Y;
	if (abs(X - Y) <= 1) printf("Brown\n");
	else printf("Alice\n");
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin>>n;
  int l[2*n+1]={};
  for(int i=0;i<2*n;i++) cin>>l[i];

  sort(l,l+2*n);
  int sum=0;
  for(int i=0;i<2*n;i+=2){
    sum+=l[i];
  }
  cout<<sum<<endl;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
*A, = map(int, input().split())
b = [0] * N
for i in range(N-1, -1, -1):
   chk = sum(b[i:N:i+1])
   if chk % 2 ^ A[i]:
       b[i] = 1

print(sum(b))
ans = []
for i, v in enumerate(b):
    if v == 1:
        ans.append(i+1)
print(*ans)

Measured memory_bytes: 14140
/*
    ____        __
   / __ \____  / /_  ____ _____ ___
  / /_/ / __ \/ __ \/ __ `/ __ `__ \
 / _, _/ /_/ / / / / /_/ / / / / / /
/_/ |_|\____/_/ /_/\__,_/_/ /_/ /_/
*/
#include<bits/stdc++.h>

typedef long long ll ;

#define pll pair<ll , ll >
#define X   first
#define Y   second
#define mp  make_pair
#define pii pair<int , int>
#define vec vector
#define vpii vector<pair<int , int>>
#define i_n   int i = 0 ; i< n ; i++
#define cn  int n ; cin>>n
#define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define cina int a[n] ; for(int i = 0 ; i < n ; i++) cin>>a[i]
#define pb push_back

using namespace std;
const int maxn = 1000*100+5 ;
const ll inf = 9223372036854775807 ;

int  mark[maxn] , n , m , h[maxn] , ans , outd[maxn] , dp[maxn]; 
vec<int> adj[maxn] , sink[maxn]; 
void dfs(int root)
{
	mark[root] = 1 ; 
	for(auto u : adj[root])
	{
		if(mark[u] == 0)
		{
			h[u] = h[root] + 1 ; 
			dfs(u) ; 
		}
	}
}

int pd(int v)
{
//	cout<<v<<" " ;
	if(dp[v] == -1)
	{
		for(auto u : adj[v])
		{
			if(pd(u) + 1 > dp[v])
			{
			//	cout<<" dp u was bigger "<< u << " dp u = "<<pd(u) << endl ; 
				dp[v] = pd(u) + 1 ;
			//	cout<<"dp "<< v<< " become  "<< dp[v] << endl ; 
			}
		}
	}
	//	cout<<endl<<v << " dp = "<<dp[v] << endl ; 	
	return dp[v] ;
 
}
int main()
{
	migmig ;
	cin>>n>>m ; 
	for(int i = 1 ; i <= m ; i ++ )
	{
		int u , v ; 
		cin>>u>>v; 
		adj[u].pb(v)  ;
		outd[u] ++ ; 
	}
	for(int i = 1 ; i <= n ; i ++ )
	{
		dp[i] = -1 ; 
		if(outd[i] == 0) 
		{
		//	cout<<i<<" - > sink" << endl ; 
			dp[i] = 0 ; 
		}
	}
	
	for(int i = 1 ; i <= n ; i ++ )
	{
		ans = max(ans , pd(i)) ;
	//	cout<<"dp["<<i << "] = "<< dp[i] << endl ;  
	}
	//pd(1) ; 
	cout<<ans ; 
	
}
//////
////////
///////////




Measured memory_bytes: 11520
void main() {
	auto ip = readAs!(ulong[]), N = ip[0], K = ip[1];
	auto A = readAs!(ulong[]);
	
	auto c = new ulong[](64);
	foreach(v; A) foreach(i; v.bitsSet) c[i]++;
	debug c.writeln;
	ulong res;
	if(K == 0) {
		writeln(A.sum);
		return;
	}
	foreach(i; 0..K.log2.ceil.to!ulong) {
		if(!(K & (1UL << i))) continue;
		ulong X = K;
		X &= ~(1UL << i);
		foreach(j; 0..i) {
			if(c[j] > N-c[j]) {
				X &= ~(1UL << j);
			} else X |= (1UL << j);
		}
		ulong tmp;
		foreach(v; A) {
			tmp += v ^ X;
		}
		// debug writefln("%b", X);
		debug tmp.writeln;
		res = max(res, tmp);
	}
	ulong tmp;
	foreach(v; A) {
		tmp += v ^ K;
	}
	debug tmp.writeln;
	res = max(res, tmp);
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 4732
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using bint = boost::multiprecision::cpp_int;


bint powerTwo(int n) {
    bint ret = 1;
    for (int i = 0; i < n; i++) {
        ret *= 2;
    }
    return ret;
}

int main()
{
    int N;
    bint K;
    std::cin >> N >> K;
    std::vector<int> bits(40);
    for (int i = 0; i < N; i++) {
        bint a;
        std::cin >> a;
        for (size_t j = 0; j < 40; j++) {
            bits.at(j) += (boost::multiprecision::bit_test(a, j) ? 1 : 0);
        }
    }

    std::vector<bint> sums{};
    bint sum = 0;
    for (int i = 0; i < 40; i++) {
        sum += (boost::multiprecision::bit_test(K, i) ? N - bits.at(i) : bits.at(i)) * powerTwo(i);
    }
    sums.emplace_back(sum);
    for (int i = 0; i < 40; i++) {
        if (not boost::multiprecision::bit_test(K, i)) {
            continue;
        }
        std::cerr << i << std::endl;
        bint sum = 0;
        for (int j = 39; j > i; j--) {
            sum += (boost::multiprecision::bit_test(K, j) ? N - bits.at(j) : bits.at(j)) * powerTwo(j);
        }
        sum += bits.at(i) * powerTwo(i);
        for (int j = i - 1; j >= 0; j--) {
            sum += std::max({bits.at(j), N - bits.at(j)}) * powerTwo(j);
        }
        sums.emplace_back(sum);
    }
    sum = 0;
    for (int i = 0; i < 40; i++) {
        sum += bits.at(i) * powerTwo(i);
    }
    sums.emplace_back(sum);

    std::cout << *std::max_element(sums.begin(), sums.end()) << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,res=0,i,sum=0,p=0;
cin>>n;
p=n;
while(n>0)
{
res=n%10;
sum=sum+res;
n=n/10;
}
//cout<<sum<<endl;
if(p%sum==0)
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}


}


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

using namespace std;

struct union_find
{
	int par[200000];
	union_find(int n)
	{
		for (int i = 0; i < n; i++)
			par[i] = i;
	}
	int find(int x)
	{
		if (par[x] == x)
			return x;
		else
			return par[x] = find(par[x]);
	}
	int unite(int x, int y)
	{
		x = find(x);
		y = find(y);
		if (x == y)
			return 0;
		if (x > y)
			par[y] = x;
		else
			par[x] = y;
		return 0;
	}
};

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	union_find uf(n + m);
	for (int i = 0; i < k; i++)
	{
		int t;
		cin >> t;
		if (t == 1)
		{
			int a, b;
			cin >> a >> b;
			a--;
			b--;
			a = uf.find(a);
			b = uf.find(b);
			if (a >= n && b >= n && a != b)
			{
				cout << i + 1 << endl;
				return 0;
			}
			uf.unite(a, b);
		}
		else
		{
			int c, x;
			cin >> c >> x;
			c--;
			x--;
			c = uf.find(c);
			if (c >= n && c != x + n)
			{
				cout << i + 1 << endl;
				return 0;
			}
			uf.unite(c, x + n);
		}
	}
	cout << 0 << endl;

	return 0;
}



Measured memory_bytes: 3872
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
#define MOD 998244353

int main() {
	ll A, B, C, K;
	cin >> A >> B >> C >> K;
	if (K < A + B) {
		cout << K << endl;
	}
	else {
		K -= A + B;
		cout << A - K << endl;
	}
}


Measured memory_bytes: 3632
N = int(input())
s = [input() for _ in range(N)]
 
import collections
sortedList = [''.join(sorted(x)) for x in s]
countNum = list(collections.Counter(sortedList).values())
 
import sys
sys.setrecursionlimit(100000000)
 
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
  
count = 0
memo = [0]*10**6
for n in countNum:
    if n!=1:
        if memo[n] == 0:
            memo[n] = cmb(n, 2)
        count += memo[n]
        
print(count)

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

bool is_prime[50001];
int main() {
	memset(is_prime, 1, sizeof(is_prime));
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= 50000; i++) {
		if (is_prime[i]) {
			for (int j = i * 2; j <= 50000; j += i)is_prime[j] = false;
		}
	}
	int n;
	while (cin >> n, n) {
		int cnt = 0;
		for (int i = 2; i <= n / 2; i++) {
			if (is_prime[i] && is_prime[n - i])cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}



Measured memory_bytes: 3128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main {

    public static void main(String[] args) throws Exception {
        //利子率
        final BigDecimal TAX_RATE = new BigDecimal("0.05");

        //端数を切り上げる際に使用する
        final int ROUND_UP_FRACTION = 1000;

        //残り借金、初期値は10万
        int deptLeft = 100000;

        BufferedReader reader = new BufferedReader(new InputStreamReader(
                System.in));
        int countWeeks = Integer.parseInt(reader.readLine());

        //1週間経過ごとに残り借金に利子を加えた金額を計上する
        for (int count = 1; count <= countWeeks; count++) {
            deptLeft = BigDecimal.valueOf(deptLeft)
                    .add(BigDecimal.valueOf(deptLeft).multiply(TAX_RATE))
                    .intValue();

            //1000円未満を切り上げる処理
            int fraction = deptLeft % ROUND_UP_FRACTION;
            if (fraction != 0) {
                deptLeft = deptLeft + (ROUND_UP_FRACTION - fraction);
            }
        }
        System.out.println(deptLeft);
    }
}

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

int main(){
	int a,b,c;
	double s,l,h,rad;
	scanf("%d %d %d",&a,&b,&c);
	rad=c*atan(1)/45.;
	s=0.5*a*b*sin(rad);
	l=a+b+sqrt(a*a+b*b-2*a*b*cos(rad));
	h=2*s/a;
	printf("%f %f %f\n",s,l,h);
	return 0;
}

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

struct Edge{
	  int tgt_;
	  Edge(int t){
			tgt_ = t;
	  }
};

typedef vector<vector<Edge> > Adj_list;

vector<int> topological_sort(Adj_list G){

	  const int V = G.size();

	  vector<int> S; // ??\?????????????????????
	  vector<int> inorder(V,0); // ??\?????????????????????
	  
	  for(int i=0; i<V; i++) for(Edge& e : G[i]) inorder[e.tgt_]++;
	  for(int i=0; i<V; i++) if(inorder[i] == 0) S.push_back(i);

	  assert(S.size() > 0);

	  vector<int> topological_order;
	  while(S.size()){
			int v = S[S.size()-1]; S.pop_back();
			topological_order.push_back(v);

			for(int i=G[v].size()-1; i>=0; i--){
				  Edge e = G[v][i];	// G[v].pop_back();
				  inorder[ e.tgt_ ]--; 

				  if( inorder[e.tgt_] == 0) 	S.push_back( e.tgt_ );
			}
	  }
	  for(int i=0; i<V; i++) assert(inorder[i]==0);
	  return topological_order;
}


int main(){

	  int V,E; cin >> V >> E;
	  Adj_list G(V);
	  for(int i=0; i<E; i++){
			int s,t; cin >> s >> t;
			G[s].push_back( Edge(t) );
	  }
	  
	  vector<int> ans = topological_sort(G);
	  for(int i=0; i<V; i++)
			cout << ans[i] << endl;

}

Measured memory_bytes: 4140
import java.util.*;

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

        String s = sc.next();
        String t = sc.next();

        String ss = s.substring(0, s.length());
        String ts = t.substring(0, s.length());

        if(ss.equals(ts) && s.length()+1 == t.length()){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


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

#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset((a), v, sizeof(a))

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

int main() {
	string S; cin >> S;
	bool ans = false;
	for (int i = 0; i < (int)S.length(); i++) {
		if (S[i] == '7') {
			ans = true;
		}
	}
	if (ans) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 3628
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Program
{
    public class ABC084D
    {
        static public void Main(string[] args)
        {
            var prime = new HashSet<int>(Prime(100000));
            var sumary = new int[100001];
            for (int i = 1; i <= 100000; ++i)
            {
                if (prime.Contains(i) && prime.Contains((i + 1) / 2))
                {
                    sumary[i] = 1;
                }
                sumary[i] += sumary[i - 1];
            }

            var Q = NextInt;
            for (int i = 0; i < Q; ++i)
            {
                var l = NextInt;
                var r = NextInt;
                Console.WriteLine(sumary[r] - sumary[l - 1]);
            }
        }

        static class Console_
        {
            private static Queue<string> param = new Queue<string>();
            public static int NextInt() => int.Parse(NextString());
            public static long NextLong() => long.Parse(NextString());
            public static string NextString()
            {
                if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item);
                return param.Dequeue();
            }
        }
        static int NextInt => Console_.NextInt();
        static long NextLong => Console_.NextLong();
        static string NextString => Console_.NextString();

        static IEnumerable<int> Prime(int x)
        {
            if (x < 2) yield break;
            yield return 2;
            var table = new bool[x + 1];
            var max = (int)Math.Sqrt(x);
            for (int i = 3; i <= max; i += 2)
            {
                if (!table[i])
                {
                    yield return i;
                    for (int j = i * i; j <= x; j += i)
                    {
                        table[j] = true;
                    }
                }
            }
            for (int i = max + 1; i <= x; i += 2)
            {
                if (!table[i]) yield return i;
            }
        }
    }
}


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

// ll f(ll n) {
//   if (n < 2) return 1;
//   return n * f(n - 2);
// }

ll count_d(ll n, ll d) {
  ll res = 0, dd = d;
  while (dd <= n) {
    res += n / d;
    dd *= d;
  }
  return res;
}

int main() {
  ll n;
  cin >> n;
  //   rep(i, 10) cout << f(i) << endl;
  if (n % 2 == 1) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = 0, d = 10;
  while (d <= n) {
    ans += n / d;
    d *= 5;
  }

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


Measured memory_bytes: 3580
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	Scanner sc = new Scanner(System.in);

	int INF = 1 << 28;

	int n, m, bMax;
	int[] us, vs, ws, xs;

	void run() {
		for (;;) {
			n = sc.nextInt();
			m = sc.nextInt();
			bMax = sc.nextInt();
			if (n == 0 && m == 0 && bMax == 0) {
				break;
			}
			us = new int[m];
			vs = new int[m];
			ws = new int[m];
			xs = new int[m];
			for (int i = 0; i < m; i++) {
				us[i] = sc.nextInt() - 1;
				vs[i] = sc.nextInt() - 1;
				ws[i] = sc.nextInt();
				xs[i] = sc.nextInt();
			}
			solve();
		}
	}

	void solve() {
		@SuppressWarnings("unchecked")
		ArrayList<E>[] es = new ArrayList[n];
		for (int i = 0; i < n; i++) {
			es[i] = new ArrayList<E>();
		}
		for (int i = 0; i < m; i++) {
			es[us[i]].add(new E(vs[i], ws[i], xs[i]));
			es[vs[i]].add(new E(us[i], ws[i], xs[i]));
		}

		PriorityQueue<P> que = new PriorityQueue<P>();
		que.offer(new P(0, bMax, 0));
		int[][] d = new int[n][bMax + 1];
		for (int i = 0; i < n; i++) {
			fill(d[i], INF);
		}

		for (; !que.isEmpty();) {			
			P p = que.poll();
			if (p.cost > d[p.v][p.b]) {
				continue;
			}
			// debug(p.v,p.b,p.cost);
			for (E e : es[p.v]) {
				if (p.b - e.w >= 0) {
					P q = new P(e.to, p.b - e.w, p.cost);
					if (q.cost < d[q.v][q.b]) {
						que.offer(q);
						d[q.v][q.b]=q.cost;
					}
				}
				{
					P q = new P(e.to, p.b, p.cost + e.x);
					if (q.cost < d[q.v][q.b]) {
						que.offer(q);
						d[q.v][q.b]=q.cost;
					}
				}
			}
		}
		for (int i = 0; i < n; i++) {
			// debug(i, d[i]);
		}
		int min = INF;
		for (int i = 0; i <= bMax; i++) {
			min = min(min, d[n - 1][i]);
		}
//		debug(min);
		println(min+"");
	}

	class E {
		int to, w, x;

		E(int to, int w, int x) {
			this.to = to;
			this.w = w;
			this.x = x;
		}
	}

	class P implements Comparable<P> {
		int v, b, cost;

		P(int v, int b, int cost) {
			this.v = v;
			this.b = b;
			this.cost = cost;
		}

		@Override
		public int compareTo(P p) {
			return cost - p.cost;
		}
	}

	void debug(Object... os) {
		System.err.println(deepToString(os));
	}

	void println(String s) {
		System.out.println(s);
	}

	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 64844
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

int N;

signed main(){
    cin >> N;
    cout << (N+999)/1000*1000 - N << endl;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  char ch;
  cin >> ch;
  if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }

  return 0;
};


Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.math.BigDecimal;

public class Main{

    public static void main(String[] args){
        //START

        Scanner sc=new Scanner(System.in);

        int X=sc.nextInt();
        int Y=sc.nextInt();

        int i=0;

        for(i=0;i<=X;i++){
            int calc=i*2+(X-i)*4;

            if(calc==Y){
                System.out.println("Yes");
                break;
            }
            if(i==X){
                System.out.println("No");
            }
        }
        //END
    }
}




Measured memory_bytes: 35748
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}
ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }



void solve()
{
    double x, y, a, b;
    cin >> x >> y >> a >> b;
    cout << (x*y)/2 << " ";
    cout << ((x/2 == a && y/2 == b ) ? "1" : "0");
}

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

int gcd(int a,int b){
  if(a<b) swap(a,b);
  if(b!=0) return gcd(b,a%b);
  else return a;
}


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,k;
  cin>>n>>k;
  int a[100000];
  int mx=0;
  rep(i,n){
    cin>>a[i];
    mx=max(mx,a[i]);
  }
  int gg=a[0];
  repi(i,1,n){
    gg=gcd(gg,a[i]);
  }
  if(mx<k || k%gg!=0) cout<<"IMPOSSIBLE"<<endl;
  else cout<<"POSSIBLE"<<endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <list>

using namespace std;

#define MAX_N  200000

int n;
list<int> a;
list<int>::iterator itr;

void solve() {
    int tmp1, tmp2;
    if(n%2 == 1) {
        cin >> tmp1;
        a.push_back(tmp1);
    }
    for(int i = 0; i < n/2; i++) {
        cin >> tmp1 >> tmp2;
        a.push_back(tmp1);
        a.push_front(tmp2);
    }
    int j = 0;
    for(itr = a.begin(); itr != a.end(); itr++) {
        cout << *itr;
        j++;
        if(j != n) cout << " ";  
    }
    cout << endl;
}

int main() {
    cin >> n;
    solve();
 
}

Measured memory_bytes: 8448
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <list>
#include <iomanip>
#include <numeric>

using namespace std;
typedef long long ll;
ll mod = 1000000007;

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	int h, a;
	cin >> h >> a;
	int ans = 0;
	while (0 < h) {
		h -= a;
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
   int n,a,i;
    int  min = 1000000;
    int  max = -1000000;
    long int sum = 0;
  
  scanf("%d",&i);
   
   for (n=1; n<=i; n++){
   
   scanf("%d",&a);
   
   if(a < min) {
    min = a;
    }
    
  
   if(a > max) {
    max = a;
    }
    
    sum = sum + a;
   }
    
    printf("%d %d %lld\n",min, max, sum);
   
    return 0;
    
     
}




Measured memory_bytes: 2104
h,w = map(int,input().split())
s = ["."*(w+2) for _ in range(h+2)]
road = []
setroad = set([])

for i in range(1, h+1):
	s[i] = "." + input() + "."

for i in range(h+2):
	for j in range(w+2):
		if s[i][j] == "#":
			setroad.add((i,j))
			road.append((i,j))

def isnotland(n, m):
	if not (n, m) in setroad:
		return True
	else:
		return False

ans = 1

for x, y in road:
	if isnotland(x, y+1) and isnotland(x, y-1) and isnotland(x-1, y) and isnotland(x+1, y):
		ans = 0

print(["No","Yes"][ans])

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n%2==0) return false;

  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int H,W;
char temp;
char c[210][210];
int main(){
    cin >> H >> W;
    for(int i = 0; i < H*2; i=i+2){
        for(int j = 0; j < W; ++j){
            cin >> temp;
            c[i][j] = c[i+1][j] = temp;
        }
    }
    for(int i = 0; i < H*2; ++i){
        for(int j = 0; j < W; ++j){
            cout << c[i][j];
        }
        cout << endl;
    }
        
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,r;
    cin>>n;
    r=n%10;
    if(r==3)
        cout<<"bon"<<endl;
    else if(r==2 || r==4 || r==5 ||r==7 || r==9)
        cout<<"hon"<<endl;
    else
        cout<<"pon"<<endl;
    return 0;
}


Measured memory_bytes: 3620
H,W = map(int,(input().split()))
a = [[] for _ in range(H)]
for i in range(H):
    a[i] = list(map(int,(input().split())))

ans = []
for i in range(H):
    for j in range(W-1):
        if a[i][j] %2 == 1:
            a[i][j+1] += 1
            ans.append([i+1,j+1,i+1,j+2])

for i in range(H-1):
    if a[i][W-1] %2 == 1:
        a[i+1][W-1] += 1
        ans.append([i+1,W,i+2,W])

print(len(ans))
for i in range(len(ans)):
    print(*ans[i])

Measured memory_bytes: 69340
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<vector>

using namespace std;

int main(){
	int n,k;
	cin >> n >> k;
	string s;
	cin >> s;
	// vector<pair<char,int> > vs;
	// char c = 'n';
	// int cnt = 0;
	// for(int i = 0;i < n;i++){
	// 	if(c == 'n'){
	// 		c = s[i];
	// 	}
	// 	if(s[i] != c){
	// 		vs.push_back(make_pair(c,cnt));
	// 		c = 'n';
	// 		cnt = 0;
	// 		i--;
	// 	}else{
	// 		cnt++;
	// 	}
	// }
	// vs.push_back(make_pair(c,cnt));
	// for(int i = 0;i < vs.size();i++){
	// 	cout << vs[i].first << " " << vs[i].second << endl;
	// }
	// banpei
	int ans = 0;
	int l = 0;
	int r = 1;
	int kc = 0;
	while(true){
		
		if(s[r] != s[r-1] || r == n){
			char tar = s[r-1];
			if(tar == '1'){
				// do nothing
			}else{
				// '0'
				if(kc == k){
					while(true){
						if(s[l] == '0')break;
						l++;
					}
					while(true){
						if(s[l] == '1')break;
						l++;
					}
					kc--;
				}
				kc++;
			}
			ans = max(ans,r-l);
		}
		if(r == n)break;
		r++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 512