akhauriyash/Code-Regression huggingface dataset:
from sys import stdin
import fractions

n = int(stdin.readline().rstrip())

li = [stdin.readline().rstrip() for _ in range(n)]
k = len(li)
lin = list(set(li))

if len(lin) != k:
    print("No")
    exit()

for i in range(len(li)-1):
    if li[i][-1] != li[i+1][0]:
        print("No")
        exit()
print("Yes")


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

int main()
{
	long long int n, m, ans;
	cin >> n >> m;
	
	if(m >= 2*n)
		ans = n;
	else
		ans = m/2;
	
	if(m > 2*n)
		ans += (m-2*n)/4;
	
	cout <<  ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
r = 0
mx = 0
for l in range(N):
	if r < N-1:		
		while H[r] >= H[r+1]:
			r += 1
			if r == N-1: break	
	mx = max(mx, r-l)

	if l == r and r < N-1: r += 1
print(mx)

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

// 座標に関する問題は位置関係の制約をよく確認する

signed main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	const int dx = tx - sx, dy = ty - sy;

	cout << string(dx, 'R');

	cout << string(dy, 'U');

	cout << string(dx, 'L');

	cout << string(dy, 'D');

	cout << 'D' << string(dx + 1, 'R');

	cout << string(dy + 1, 'U') << 'L';

	cout << 'U' << string(dx + 1, 'L');

	cout << string(dy + 1, 'D') << 'R';

	cout << endl;
}

Measured memory_bytes: 256
open Scanf
open Printf

let id a = a
let pair a b = a, b
let triplet a b c = a, b, c

let rec scan_list = function
  | 1 -> scanf "%d" (fun k -> [k])
  | n -> scanf "%d " (fun k -> k :: scan_list (n-1))

let f n k = let a = 1 + int_of_float (ceil ((n -. k)/.(k -. 1.)))
  in printf "%d\n" a

let () = scanf "%f %f\n" f

Measured memory_bytes: 512
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H == 0 && W == 0){
                break;
            }
            else{
                for(int i = 0; i < H; i++){
                    for(int j = 0; j < W; j++){
                        if(i%2 == 0){
                            if(j%2 == 0){
                                System.out.print("#");
                            }
                            else{
                                System.out.print(".");
                            }
                        }
                        else{
                            if(j%2 == 0){
                                System.out.print(".");
                            }
                            else{
                                System.out.print("#");
                            }
                        }
                    }
                    System.out.println("");
                }
                System.out.println("");
            }
        }
    }
}


Measured memory_bytes: 33268
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    N = ir()
    edges = [[] for _ in range(N)]
    for i in range(N-1):
        a, b = lr()
        edges[a-1].append(b-1)
        edges[b-1].append(a-1)
    one = N//3+min(1, N%3)
    two = N//3+N%3//2
    thr = N//3
    ans = [0]*N
    ball = [0]*N
    cnt = 0
    dist = [-1]*N
    s = [0]
    dist[0] = 0
    while len(s) > 0:
        v = s.pop()
        for j in edges[v]:
            if dist[j] == -1:
                dist[j] = dist[v]+1
                if dist[j]%2 == 1:
                    ball[j] = 1
                    cnt += 1
                s.append(j)
    if cnt > N/3 and N-cnt > N/3:
        for i in range(N):
            if ball[i] == 1:
                ans[i] = 3*one-2
                one -= 1
            else:
                ans[i] = 3*two-1
                two -= 1
        for i in range(N):
            if ans[i] <= 0:
                ans[i] = 3*thr
                thr -= 1
    elif cnt <= N/3:
        for i in range(N):
            if ball[i] == 1:
                ans[i] = 3*thr
                thr -= 1
        for i in range(N):
            if ans[i] <= 0:
                if thr > 0:
                    ans[i] = 3*thr
                    thr -= 1
                elif two > 0:
                    ans[i] = 3*two-1
                    two -= 1
                else:
                    ans[i] = 3*one-2
                    one -= 1
    else:
        for i in range(N):
            if ball[i] == 0:
                ans[i] = 3*thr
                thr -= 1
        for i in range(N):
            if ans[i] <= 0:
                if thr > 0:
                    ans[i] = 3*thr
                    thr -= 1
                elif two > 0:
                    ans[i] = 3*two-1
                    two -= 1
                else:
                    ans[i] = 3*one-2
                    one -= 1
    print(*ans, sep=' ') 
resolve()

Measured memory_bytes: 95948
#include<bits/stdc++.h>
#define ll long long 
#define F first 
#define S second 
#define pb push_back 
#define mp make_pair 
#define f(i,n) for(int i=0;i<n;i++) 
#define fr(i,a,b) for(int i=a;i<b;i++) 
using namespace std; 

void test(){
	ll n;
	cin>>n;
	ll a[n];
	f(i,n)cin>>a[i];
	bool f = true;
	f(i,n){
		if(a[i]%2==0){
			if(a[i]%3!=0 and a[i]%5!=0){
				f = false;
				break;
			}
		}
	}
	if(f)cout<<"APPROVED";
	else cout<<"DENIED\n";;
}

int main(){
	int t=1;
//	cin>>t;
	while(t-->0){
		test();
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){fastio
    ll x,k,d;cin>>x>>k>>d;
    ll a=abs(x)/d;
    if(a>k){
        if(x<0){
            cout<<abs(x+d*k)<<endl;
        }else{
            cout<<abs(x-d*k)<<endl;
        }
    }else{
        ll now,sum;
        if(x<0){
            sum=a+1;
            now=x+d*(sum);
        }else{
            sum=a;
            now=x-d*sum;
        }
        if((k-sum)%2==0){
            cout<<abs(now)<<endl;
        }else{
            cout<<abs(now-d)<<endl;
        }
    }

    return 0;
}





Measured memory_bytes: 3612
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);


int gcd(int a,int b) {
    if (a<b) swap(a,b);
    while (b>0) {
        int tmp=b;
        b=a%b;
        a=tmp;
    }
    return a;
}


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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> l(n),r(n);
    l[0]=a[0];
    r[n-1]=a[n-1];
    rep(i,n-1) l[i+1]=gcd(l[i],a[i+1]);
    invrep(i,n-1) r[i]=gcd(r[i+1],a[i]);
    int ans=max(l[n-2],r[1]);
    rep(i,n-2) ans=max(ans,gcd(l[i],r[i+2]));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4584
L, R = map(int, input().split())

if R - L >= 2018: # R - L + 1 >= 2019
  out = 0
else:
  l = L%2019
  r = R%2019
  if r >= l:
    out = 2018
    for i in range(l, r+1):
      for j in range(i+1, r+1):
        out = min(out, i*j%2019)
        
  else:
    out = 0

print(out)

Measured memory_bytes: 3060
from itertools import combinations
from math import sqrt

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
combs = combinations(X, 2)

cnt = 0

for comb in combs:
    in_sqrt = 0
    for i in range(D):
        in_sqrt += (comb[0][i] - comb[1][i]) ** 2
    dist = sqrt(in_sqrt)
    if dist.is_integer():
        cnt += 1
print(cnt)


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

const int maxn = 100005;

inline int gi()
{
	char c = getchar();
	while (c < '0' || c > '9') c = getchar();
	int sum = 0;
	while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar();
	return sum;
}

int n;

struct seg 
{
	int l, r;
} p[maxn];

int pre1[maxn], pre2[maxn], suf1[maxn], suf2[maxn];

int len(int l, int r)
{
	if (l > r) return 0;
	return r - l + 1;
}

int main()
{
	n = gi();
	for (int i = 1; i <= n; ++i) p[i].l = gi(), p[i].r = gi();
	
	sort(p + 1, p + n + 1, [](const seg &a, const seg & b) {return a.r < b.r;});

	pre2[0] = suf2[n + 1] = 1e9 + 1;
	for (int i = 1; i <= n; ++i) {
		pre1[i] = max(pre1[i - 1], p[i].l);
		pre2[i] = min(pre2[i - 1], p[i].r);
	}
	for (int i = n; i >= 1; --i) {
		suf1[i] = max(suf1[i + 1], p[i].l);
		suf2[i] = min(suf2[i + 1], p[i].r);
	}

	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		ans = max(ans, len(max(pre1[i - 1], suf1[i + 1]), min(pre2[i - 1], suf2[i + 1])) + len(p[i].l, p[i].r));
		if (i != n) ans = max(ans, len(pre1[i], pre2[i]) + len(suf1[i + 1], suf2[i + 1]));
	}
	printf("%d\n", ans);
	
	return 0;
}


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

int main() {
  ll W, H, x1, y1;
  cin >> W >> H >> x1 >> y1;

  ll x2 = abs(W - x1);
  ll y2 = abs(H - y1);

  ll x_diff = max(x1, x2) - min(x1, x2);
  ll y_diff = max(y1, y2) - min(y1, y2);

  if (x_diff == 0 && y_diff == 0) {
    printf("%.6f %d\n", W * H / 2.0, 1);
    return 0;
  }

  printf("%.6f %d\n", W * H / 2.0, 0);
  return 0;
}


Measured memory_bytes: 3664
n = input()
nums = input().split(' ')

nums = [int(num) for num in nums]
cnt=0

for i in range(1,len(nums)-1):
  if nums[i-1] < nums[i] and nums[i] < nums[i+1]:
    cnt += 1
  if nums[i+1] < nums[i] and nums[i] < nums[i-1]:
    cnt += 1
      
print(cnt)
  

Measured memory_bytes: 3060
from operator import itemgetter

N, M = map(int, input().split())
a = []
for i in range(N):
    a.append(list(map(int, input().split())))

a.sort(key=itemgetter(0))
count = int(M)
price = 0
for i in range(N):
    if count - int(a[i][1]) > 0:
        count -= int(a[i][1])
        price += int(a[i][1]) * int(a[i][0])
    else:
        price += int(a[i][0]) * count
        break

print(price)


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

string s[1010];

int num(string s, int idx){
	int ret = 0;
	for(int i = idx; i < s.size(); i++){
		if(isdigit(s[i])){
			ret = ret * 10 + (s[i] - '0');
		}
		else break;
	}
	return ret;
}

bool f(string s, string t){
	for(int i = 0; i < min(s.size(), t.size()); i++){
		if(isdigit(s[i]) && isdigit(t[i])){
			int n1 = num(s, i), n2 = num(t, i);
			if(n1 != n2) return n1 <= n2;
		}
		else if(s[i] != t[i]){
			return s[i] <= t[i];
		}
	}
	return s.size() <= t.size();
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

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

	for(int i = 1; i < N; i++){
		if(f(s[0], s[i])) cout << "+" << endl;
		else cout << "-" << endl;
	}
}



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

int main()
{
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    if (i < k)
    {
      ans += x;
    }
    else
    {
      ans += y;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) (flag)?1:0
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

constexpr int MOD=1e9+7;

int main(void){
  vec<int> g{1,0,1,2,1,2,1,1,2,1,2,1};
  int x,y; cin>>x>>y;
  if(g[x-1]==g[y-1]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}













Measured memory_bytes: 256
#include <stdio.h>

int main(){
	long int N, M;
	scanf("%ld %ld",&N, &M);

	long int a[N], b[N];
	int flag[2][N];
	int k = 0;
	for(int i = 0; i < N; i++){
		flag[0][i] = 0;
		flag[1][i] = 0;
	}
	for(int i = 0; i < M; i++){
		long long int buf1, buf2;
		scanf("%ld %ld", &buf1, &buf2);
		if(buf1 == 1){
			a[k] = buf1;
			b[k] = buf2;
			flag[0][b[k]-1] = 1;
			k++;
		} else if(buf2 == N) {
			a[k] = buf1;
			b[k] = buf2;
			flag[1][a[k]-1] = 1;
			k++;
		}
	}

	for(int i = 0; i < M; i++){
		if(flag[0][i] == 1 && flag[1][i] == 1){
			printf("POSSIBLE\n");
			return 0;
		}
	}

	printf("IMPOSSIBLE\n");

	return 0;
}

Measured memory_bytes: 4864
// atcoder/abc145/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

lli extgcd(lli a, lli b, lli& x, lli& y)
{
  lli g = a;
  x = 1;
  y = 0;
  if (b != 0) {
    g = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  }
  return g;
}

lli mod_inverse(lli a, lli m)
{
  lli x, y;
  extgcd(a, m, x, y);
  return (m + x % m) % m;
}

constexpr lli mod = 1e9 + 7;
constexpr int N = 2 * 1e6 + 5;
lli fact[N]; // P.263

template<typename T, typename U>
T mod_fact(T n, U p, U &e)
{
  e = 0;
  if (n == 0) return 1;

  T res = mod_fact(n / p, p, e);
  e += n / p;
  if (n / p % 2 != 0) return res * (p - fact[n % p]) % p;
  return res * fact[n % p] % p;
}

// nCk mod P O(n log p )
lli mod_comb(lli n, lli k, lli p = mod)
{
  if (n < 0 || k < 0 || n < k) {
    return 0;
  }
  lli e1, e2, e3;
  lli a1 = mod_fact(n, p, e1);
  lli a2 = mod_fact(k, p, e2);
  lli a3 = mod_fact(n - k, p, e3);
  if (e1 > e2 + e3) {
    return 0;
  }
  return a1 * mod_inverse(a2 * a3 % p, p) % p;
}

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

  fact[0] = 1;
  for (int i = 1; i < N; ++i) {
    fact[i] = (fact[i - 1] * i) % mod;
  }


  lli x, y;
  while (cin >> x >> y) {
    int a, b;
    a = b = -1;
    for (int i = 0; i <= x; ++i) {
      lli p = x - i;
      lli q = y - 2 * i;
      if (0 <= q && p == q * 2) {
        a = i;
        b = q;
      }
    }
    if (a == -1) {
      cout << 0 << endl;
    } else {
      cout << mod_comb(a + b, a) << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 16000
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String A = sc.next();
        String B = sc.next();
        String C = sc.next();
        StringBuilder sb = new StringBuilder();
        sb.append("A");
        sb.append(B.charAt(0));
        sb.append("C");
        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep( i, begin, end ) for( int i = begin; i < end; i++ )
using namespace std;
 
int main() {
    int n, m, answer;
    bool infected[20000];
    pair< int, pair < int, int > > packet[20000];
    while( cin >> n >> m, n ) {
        memset( infected, false, sizeof( infected ) );
        infected[ 0 ] = true;
        rep( i, 0, m ) {
            int t, s, d;
            cin >> t >> s >> d;
            packet[ i ] = make_pair( t, make_pair( s, d ) );
        }
        sort( packet, packet + m );
        rep( i, 0, m ) {
            int a, b;
            a = packet[ i ].second.first - 1;
            b = packet[ i ].second.second - 1;
            if( infected[ a ] ) 
                infected[ b ] = true;
        }
        answer = 0;
        rep( i, 0, n ) {
            answer += infected[ i ];
        }
        cout << answer << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3248
N=int(input())
S1=input()
S2=input()
c=1

if(S1[0]==S2[0]):
    c*=3
    i=1
    t=0
else:
    c*=6
    i=2
    t=1
while i<N:
    if(S1[i]==S2[i]):
        if(t==0):
            c*=2
            t=0
        else:
            c*=1
            t=0
        i+=1
    else:
        if(t==0):
            c*=2
            t=1
        else:
            c*=3
            t=1
        i+=2
print(c%1000000007)

Measured memory_bytes: 3316
n=int(input())
t,a=map(int,input().split())
l=list(map(int,input().split()))

tmp=10**10
num=0
for i in range(n):
    if abs(a-(t-l[i]*0.006)) < tmp:
        num=i+1
        tmp=abs(a-(t-l[i]*0.006))
    else:
        continue

print(num)



Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

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

void solve() {
    int n,m;
    cin >> n >> m;
    set<int> s;
    int in;
    REP(i,0,m) {
        cin >> in;
        s.insert(in);
    }
    VLL dp(n+2);
    dp[0] = 1;
    REP(i,0,n) {
        if (s.count(i) > 0) continue;
        dp[i+1] += dp[i];
        if (dp[i+1] >= MOD) dp[i+1] -= MOD;
        dp[i+2] += dp[i];
        if (dp[i+2] >= MOD) dp[i+2] -= MOD;
    }
    cout << dp[n] << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 5760
#include <stdio.h>
int main()
{
    int H,N,A,i,sum=0;
    scanf("%d",&H);
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&A);
        sum+=A;

    }
    if((H==sum)||(H<sum)){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
        return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key) return u;
  if(k < u->key)
    return treeSearch(u->left, k);
  else return treeSearch(u->right, k);
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while(x != NIL) {
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;

  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}

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

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

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
  Node t;

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    }
    else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }
    else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}



Measured memory_bytes: 20488
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
	cin.tie(0);ios::sync_with_stdio(false);
	ll n, d, x; cin >> n >> d >> x;
	vector<vector<ll>> p(d + 1, vector<ll>(n + 1, 0));
	for (int i = 1; i <= d;i++) for (int j = 1; j <= n;j++) cin >> p[i][j];
	vector<ll> dp(100050, 0);
	ll Max;
	for (int i = 1; i < d;i++) {
		Max = x;
		for (int j = 0; j <= x;j++) dp[j] = j;
		for (int j = 1;j <= n;j++) {
			for (int k = 0; k <= x;k++) {
				if (k - p[i][j] < 0) continue;
				dp[k] = max(dp[k], dp[k - p[i][j]] + p[i + 1][j]);
				Max = max(Max, dp[k]);
			}
		}
		x = Max;
	}
	cout << Max << endl;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    string S; cin >> S;
    int K; cin >> K;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'a') continue;
        int t = S[i] - 'a';
        if (26 - t <= K) {
            K -= 26 - t;
            S[i] = 'a';
        }
    }
    S[S.size()-1] += K % 26;
    cout << S << endl;
    return 0;
}

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

long long mod=1e9+7;

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    long long zb=0,r=0;
    cin >> n;
    vector<long long> v(n);
    for (int i=0;i<n;i++)
    {
        cin >> v[i];
        zb+=v[i];
    }
    for (int i=n-1;i>=0;i--)
    {
        zb-=v[i];
        r=(r+v[i]*(zb%mod))%mod;
    }
    cout << r%mod;
}


Measured memory_bytes: 4768
#include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;

int main() {
    int n, m;
    while(cin >> n >> m, n) {
        vector <vector <int>> G(n);
        rep (i, m) {
            int a, b;
            cin >> a >> b;
            a--, b--;
            G[a].push_back(b);
            G[b].push_back(a);
        }

        queue <pair <int, int>> que;
        vector <int> used(n, false);
        que.emplace(0, 0);
        used[0] = true;
        while(!que.empty()) {
            if (que.front().second == 2) {
                que.pop();
                continue;
            }
            for (auto & to : G[que.front().first]) {
                if (used[to]) continue;
                used[to] = true;
                que.emplace(to, que.front().second + 1);
            }
            que.pop();
        }

        int cnt = 0;
        range (i, 1, n) cnt += used[i];
        cout << cnt << endl;
    }
    return 0;
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	int n;
	cin>>n;
	int count=0;
	int k=sqrt(n);
	int maxi=1;
	for(int i=1; i<n; i++){
		for(int j=2; j<n; j++){
			if(pow(i,j)<=n){
			count=pow(i,j);
			maxi=max(count,maxi);
		//	cout<<i<<" "<<j<<" "<<maxi<<endl;
		}
	}}
	cout<<maxi;
}

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

string s[10000];

bool compare( string a, string b)
{
	return a+b < b+a ;
}


int main()
{
	int n,l; cin>>n>>l;

	
	for(int i=0;i<n;i++)
	cin>>s[i];
	
	sort( s, s+n ,compare);
//	sort(s, s+n) ;
	
	string ans="";
	
	for( int i=0;i<n;i++) 
	ans= ans + s[i];
	
	cout<<ans<<endl;
	
}

Measured memory_bytes: 3932
a = [1, 2, 4]
MAX_N = 30
for i in xrange(3, MAX_N+1):
    a.append(a[i-3] + a[i-2] + a[i-1])

while True:
    n = input()
    if n == 0:
        break
    else:
        print a[n-1] / 3650 + 1

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

using ll = long long;

const int K = 100005;
const ll INF = ll(1e18);

int n, w;
ll d[K];

int main(){
    scanf("%d%d", &n, &w);
    fill(d + 1, d + K, INF);
    for(int x, y; n--; ){
        scanf("%d%d", &y, &x);
        for(int i = K - 1; i >= x; i--) d[i] = min(d[i], d[i - x] + y);
    }
    for(int i = K - 1; ; i--) if(d[i] <= w){ printf("%d\n", i); break; }
}

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

int main()
{
  ll n; cin>>n;
  vector<ll> h(n);
  rep(i, n) cin>>h[i];
  vector<ll> d(n);

  ll ans = 0;
  for (int i=0; i<100; i++) {
    for (int j=0; j<n; j++) {
      if (h[j] <= d[j]) continue;
      while (h[j] > d[j]) {
        d[j]++;
        j++;
      }
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>

#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)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = INT32_MAX / 3;
const ll MOD = 1e9 + 7;

int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };


/******************************************************************************************/

vector<int> G[200005];
int cost[200005];
int flag[200005];
int ans[200005];

void solve() {

	
	

	
	queue<pii> que;
	que.push(pii(0, cost[0]));
	ans[0] = cost[0];

	while (!que.empty()) {

		
		pii tmp = que.front();
		que.pop();
		flag[tmp.first] = 1;

		//cout << "now =" << tmp.first << endl;

		for (auto itr : G[tmp.first]) {

			if (flag[itr] == 0) {
				//まだ訪れていない
				ans[itr] = tmp.second + cost[itr];
				flag[itr] = 1;
				que.push(pii(itr, tmp.second + cost[itr]));
			}
		}
	}
}

int main() {

	int n, q;
	cin >> n >> q;
	
	for (int i = 0; i < n-1; i++)
	{
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		if (a > b) {
			swap(a, b);
		}

		G[a].push_back(b);
		G[b].push_back(a);
	}

	for (int i = 0; i < q; i++)
	{
		int p, x;
		cin >> p >> x;
		p--;
		cost[p] += x;
	}


	solve();
	

	for (int i = 0; i < n; i++)
	{
		if (i == 0) {
			cout << ans[i];
		}
		else
		{
			cout << " " << ans[i];
		}
	}
	cout << endl;


	return 0;
}


Measured memory_bytes: 15988
import Data.List

main = do
  [n,m,x] <- map read . words <$> getLine :: IO [Int]
  al <- map read . words <$> getLine :: IO [Int]
  print $ solve al x

solve al x =
  let (f,s) = (span (< x) al) in
    minimum $ map (length) [f,s]

Measured memory_bytes: 892
#include <iostream>
using ll = long long;
int main()
{
	int N;
	std::cin >> N;
	auto ans = [&](auto&& self, const ll n, const int ok)->int {
		if (n > N) { return 0LL; }
		return (ok==7?1:0) + self(self, n * 10 + 3, ok | 4) + self(self, n * 10 + 5, ok | 2) + self(self, n * 10 + 7, ok | 1);
	};
	std::cout << ans(ans, 0, 0) << std::endl;
	return 0;
}

Measured memory_bytes: 384
#include<iostream>

using namespace std;

int main() {
	int a[5];
	int count, count2 = 0;
	int result = 0;
	int b, point = 0;

	cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];

	for (int i = 0; i < 5; i++) {
		b = a[i];
		count = 0;
		while (b % 10 != 0) {
			b++;
			count++;
		}
		if (count > count2) {
			point = i;
			count2 = count;
		}
	}

	for (int i = 0; i < 5; i++) {
		if (i == point) result += a[i];
		else {
				while (a[i] % 10 != 0) {
					a[i]++;
				}
				result += a[i];
		}
	}

	cout << result << endl;
}

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

int main(){
	string x;
	while (cin >> x, x != "0"){
		int ans = 0;
		int l = x.length();
		for (int i = 0; i < l; ++i){
			ans += x[i] - 48;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
//Int mod = 998244353;
Int INF = 1e18;
double EPS = 0.00000001;

int main() {
    string s;
    cin >> s;
    if (s == "Sunny") {
        dump("Cloudy");
    }
    else if (s == "Cloudy") {
        dump("Rainy");
    }
    else {
        dump("Sunny");
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define rep(i,a,n) for( int i = a ; i < n ; i++ )
#define prep( i, a , n ) for ( int i = a ; i>= n ; i--)
#define   pr pair<int,int>
const int N = 1e5 + 5 , M=N,inf=(int)1e9;
const int mod=1e9+7;
int fastAbs(int n) { return (n ^ (n >> 31)) - (n >> 31); }
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
ll ans ;
map< pair<int,int> ,
 int > mp;
const int dx[4] = {1,0,0,-1};
const int dy[4] = {0,-1,1,0};
vector < int > h[N];
int solve(){
   ll n , w ;
   cin >> n >> w ;
   vector < pair < ll , ll> > a(n);
   for( int i = 0 ; i < n ; i++)    cin >> a[i].ff >> a[i].ss ;
   vector < vector < ll  > > dp(2,vector<ll>(w+1,0));
   int f = 1 ;
   dp[0][a[0].ff] = a[0].ss ;
   for(int i = 1 ; i< n;  i++){
        for( int j = 0 ; j <= w ; j++){
            if(j==a[i].ff)
                dp[f][j] = max(a[i].ss,dp[f^1][j]);
            else if(j>a[i].ff && dp[f^1][j-a[i].ff]!= 0){
                dp[f][j] = max(dp[f^1][j],dp[f^1][j-a[i].ff]+a[i].ss) ;
            }
            else{
                dp[f][j] = dp[f^1][j];
            }
            //cout << dp[f][j] <<" " ;
        }
        //cout << "\n";
        f^=1;
   }
   ll ans = 0 ;
   for( int i = w ; i>=0 ; i--){
        ans = max ( ans , dp[f^1][i]);
   }
   cout << ans ;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q = 1;
    //cin >> q;
    while(q--)
        solve();
}
/*
    ---------------- lemmas-----------------------------------
   1)
   2)
   3)

*/


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef signed long long ll;
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main(){
	long n;
	int i, j, k;
	cin >> n;
	long x[105], y[105], h[105];

	int is_h = 0;
	rep(i, n){
		cin >> x[i] >> y[i] >> h[i];
		if(h[i] > 0) is_h = i;
	}
	
	rep(i, 101){
		rep(j, 101){
			bool f = true;
			long H = abs(x[is_h] - i) + abs(y[is_h] - j) + h[is_h];
			rep(k, n){
				if(max(H - abs(x[k] - i) - abs(y[k] - j), 0l) != h[k]){
					f = false;
					break;
				}
			}
			if(f){
				cout << i << " " << j << " " << H << endl;
			}
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

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

	vector<pair<char, int>> list;
	for (auto i = 0; i < (int)s.length(); ++i)
	{
		if (s[i] != 'x')
		{
			list.push_back({ s[i], i });
		}
	}

	auto valid = true;
	auto len = (int)list.size();
	for (auto i = 0; i < len / 2; ++i)
	{
		if (list[i].first != list[len - i - 1].first)
		{
			valid = false;
		}
	}

	auto ans = -1;
	if (valid)
	{
		ans = 0;
		if (len > 0)
		{
			auto left = len / 2;
			auto right = len / 2;
			if (len % 2 == 0)
			{
				--left;
			}
			left = list[left].second;
			right = list[right].second;
			while (left >= 0 || right < (int)s.length())
			{
				if (left < 0)
				{
					++ans;
					++right;
				}
				else if (right >= (int)s.length())
				{
					++ans;
					--left;
				}
				else if (s[left] == s[right])
				{
					++right;
					--left;
				}
				else if (s[left] == 'x')
				{
					--left;
					++ans;
				}
				else
				{
					++right;
					++ans;
				}
			}
		}
	}
	cout << ans << endl;

	return 0;
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

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

  int n, k;
  while (cin >> n >> k) {
    int x = 1;
    while (n--) {
      x = min(x * 2, x + k);
    }
    cout << x << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

using Graph = vector<vector<ll>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

#define MAX_N 2010

const long long INF = 1LL << 60;

//境界値に注意！！！

int main() {
    ll a,b,c,x,ans=0;
    cin >> a >> b >> c >> x;
    for (ll i=0;i<=a;i++){
        for (ll j=0;j<=b;j++){
            for (ll k=0;k<=c;k++){
                if (500*i+100*j+50*k==x)ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;
  
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n;
  cin >> n;
  int nasu = 1;
  while(nasu * 2 <= n){
    nasu *= 2;
  }
  cout << nasu << '\n';
  return 0;
}


Measured memory_bytes: 256
#D
from collections import deque
#import bisect
#import math
#import heapq
#import sys
#input = sys.stdin.readline

#inf = float("inf")
#mod = 10**9 + 7
#mod = 998244353

#list(map(int,input().split()))

N = int(input())
AB = []
for i in range(N-1):
    a,b = map(int,input().split())
    AB.append([a,b,i])

K = [0]*N
for ab in AB:
    a,b,i = ab
    K[a-1]+=1
    K[b-1]+=1
k = max(K)
print(k)
AB.sort()
C = [0]*N
D = deque(AB)
flag = 0
visited = [-1]*N
ans = [0]*(N-1)
while D:
    a,b,i = D.popleft()
    if visited[a-1] == -1 and visited[b-1] == -1:
        if flag == 0:
            flag = 1
            visited[a-1] = 0
            visited[b-1] = 0
            ans[i] = 1
            C[a-1] = 1
            C[b-1] = 1
        else:
            D.append([a,b,i])
    else:
        if visited[b-1] == -1:
            if C[a-1] == k:
                ans[i] = 1
                C[a-1] = 1
                C[b-1] = 1
            else:
                ans[i] = C[a-1]+1
                C[a-1]+=1
                C[b-1] = C[a-1]
            visited[b-1] = 0
        else:
            visited[a-1] = 0
            if C[b-1] == k:
                ans[i] = 1
                C[a-1] = 1
                C[b-1] = 1
            else:
                ans[i] = C[b-1]+1
                C[b-1]+=1
                C[a-1] = C[b-1]
                
for a in ans:
    print(a)


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

int main() {
  int N, sum=0;
  cin >> N;
  
  for(int i=0;i<N;i++) {
    int l, r;
    cin >> l >> r;
    sum += (r-l)+1;
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 764
n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

mod = 10**9+7

sidex, sidey = 0,0

for i in range(1,n):
  sidex += (x[i]-x[i-1])*i*(n-i)%mod

for i in range(1,m):
  sidey += (y[i]-y[i-1])*i*(m-i)%mod

print (sidex*sidey%mod)

Measured memory_bytes: 24388
#include <stdio.h>

int main()
{
	int data1[100],data2[100],i=0,j=0;
	while(scanf("%d",&data1[i])!=EOF){
		if(data1[i]==0){
			i--;
			data2[j]=data1[i];
			j++;
		}
		else i++;
	}
	for(i=0;i<j;i++){
		printf("%d\n",data2[i]);
	}
	return 0;
}

Measured memory_bytes: 600
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define REP(i, start, end) for (ll i = start, i##Len = (end); i < i##Len; ++i)
#define REPR(i, start, end) for (ll i = start, i##Len = (end); i > i##Len; --i)
using ll = long long;
using namespace std;

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

    const ll mod = 1e9 + 7;
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, 0, n)
    cin >> a[i];

    ll left = a[0], ans = 0;
    REP(i, 1, n)
    {
        ans = (ans + left * a[i]) % mod;
        left = (left + a[i]) % mod;
    }

    cout << ans << endl;
}

Measured memory_bytes: 4784
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    ll W,H,x,y;
    cin >> W >> H >> x >> y;
    double ans1 = (double)(W*H)/2;
    int ans2 = 0;
    if(2*x == W && 2*y == H) ans2 = 1;
    printf("%.10f",ans1);
    cout << " " << ans2 << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		if (i % 2 == 0)cout << s[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 512
import collections

def binomial(n, k):
    if 0 <= k <= n:
        numer = 1
        denom = 1
        for t in range(1, min(k, n - k) + 1):
            numer *= n
            denom *= t
            n -= 1
        return numer // denom
    else:
        return 0

N = int(input())
A = list(map(int, input().split()))

cumsum = [0]
for a in A:
    cumsum.append(a + cumsum[-1])
    
count = collections.defaultdict(int)
for c in cumsum:
    count[c] += 1

ans = 0

for c in count.values():
    if c >= 2:
        ans += binomial(c, 2)
        
print(ans)

Measured memory_bytes: 41728
import java.util.Scanner;


public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		for(; scanner.hasNext(); )
		{
			long a = scanner.nextLong();
			long b = scanner.nextLong();
			if(a < b)
			{
				long buf = a;
				a = b;
				b = buf;
			}
			
			System.out.println(getGCD(a, b)+" "+getLCM(a, b));
		}
	}
	
	private static long getGCD(long a, long b)
	{
		for(;;)
		{
			if(a > b)
			{
				a = a % b;
				if(a == 0)
					return b;
			}
			else
			{
				b = b % a;
				if(b == 0) 
					return a;
			}
		}
	}
	
	private static long getLCM(long a, long b)
	{
		for(long n=b; ; n+=b)
		{
			if(n%a==0 && n%b==0)
			{
				return n;
			}
		}
	}
}

Measured memory_bytes: 26168
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    cout << n / 3 << endl;
    return 0;
}


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

int main(){
	char a,c,b;
	int satu;
	cin >> a >> b;
	if(a == 'H')
		cout << b;
	else
		if(b == 'H')
			cout << 'D';
		else
			cout << 'H';
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = (ll)1e9+7;
const double PI = 3.141592653589793238463;
const int MAXN = 200005;
vector<int> v[MAXN];
bool vis[MAXN];
int cnt=0;
void dfs(int a){
    vis[a]=1;
    for(int i=0;i<v[a].size();i++){
        if(!vis[v[a][i]]){
            cnt++;
             dfs(v[a][i]);
        }
    }
}
int main() {
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    int mx=0;
    for(int i=1;i<=n;i++){
        if(!vis[i]){
            dfs(i);
            mx=max(mx,cnt+1);
            cnt=0;
        }
    }
    cout<<mx<<endl;
    
    
    return 0;
}


Measured memory_bytes: 20952
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::{Write, BufWriter};

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

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

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

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

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

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

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

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

fn main() {
    input! {
        n: i32,
        l: i32,
    }
    let mut sum = 0;
    for i in 0..n {
        sum += l + i;
    }

    if l < 0 {
        if l + n - 1 >= 0 {
            println!("{}", sum);
        }
        else {
            println!("{}", sum - l - n + 1);
        }
    }
    else {
        println!("{}", sum - l);
    }
}

Measured memory_bytes: 4352