akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int n,a[1001][1000];
int d[1001][1001];
int z[1001];
bool f[1001];
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	rep(i,n)
	rep(j,n-1){
		cin>>a[i][j];
		a[i][j]--;
		d[i][a[i][j]]=j;
	}
	int nw=0,ans=0;
	while(nw<n*(n-1)){
		int nnw=0;
		zero(f);
		rep(i,n){
			if(f[i]||f[a[i][z[i]]])
			continue;
			if(d[a[i][z[i]]][i]-z[a[i][z[i]]]==0){
				nnw+=2;
				f[i]=true;
				f[a[i][z[i]]]=true;
				z[a[i][z[i]]]++;
				z[i]++;
			}
		}
		if(nnw==0){
			cout<<-1;
			re 0;
		}
		nw+=nnw;
		ans++;
	}
	cout<<ans;
	re 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>                                                                              
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define VS vector<string>
int main(void) {
    int x,y,s;
    while(1) {
        cin >> x >> y >> s;
        int ans=0;
        int max=0;
        if(x==0&&y==0&&s==0) break;
        FOR(i,1,s-1) {
            FOR(j,1,s-1) {
                if(i*(100+x)/100+j*(100+x)/100 == s) {
                    ans = i*(100+y)/100 + j*(100+y)/100;
                    max = fmax(max, ans);
                }
            }
        }
        cout << max << endl;
    }
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6+7;
typedef long long ll;
int n, m, k;

int main()
{
    scanf("%d%d", &n, &m);
    if(n == 1 || m == 1){
        printf("1\n");
    }
    else{
        printf("%lld\n", (1LL * n * m + 1) / 2);
    }


    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]
# print(sc)
for i in range(10**n):
  i2=str(i)
#   print(i2)
  if len(i2)==n and all([i2[s-1]==str(c) for s,c in sc]):
      print(i2)
      exit()
print(-1)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 1e9 + 7;

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 1;
	rep(i, n - 1)
	{
		if (s[i + 1] != s[i])ans++;
	}
	co(ans);
	return 0;
}


Measured memory_bytes: 512
X, N = (int(x) for x in input().split())
p = list(map(int, input().split()))

if N == 0 or p.count(X) == 0: #整数列pが空行のとき、または、Xのカウント回数が0(整数列pにXが含まれない)とき
    print(X)
else:
    for i in range(60): #整数列pとXの絶対値での比較
        i += 1 #iは0から始まるので、あらかじめ+1しておく
        A = X - i
        B = X + i
        if p.count(A) == 0 and p.count(B) == 0: #AもBもカウント回数が0(整数列pにAもBも含まれない)とき
            print(A)
            break
        elif p.count(A) == 0:
            print(A)
            break
        elif p.count(B) == 0:
            print(B)
            break

Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
const int INF = 1e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }

vector<vector<int>> g;
vector<int> d;
vector<int> visited;
int res = 0;

// for d[]
void dfs(int pre, int cur, int depth) {
    d[cur] = depth;
    for(int to : g[cur]){
        if (to == pre) continue;
        dfs(cur, to, depth + 1);
    }
}

void escape(int pre, int cur, int turn) {
    if (visited[cur]) return;
    visited[cur] = true;
    if (turn <= d[cur]) {
        res = max(res, turn);
    }
    if (turn >= d[cur]) return;

    for(int to : g[cur]){
        if (to == pre) continue;
        escape(cur, to, turn + 1);
    }
    if ((int)g[cur].size() == 1) {
        res = max(res, d[g[cur][0]]);
    }
}

int main(void){
    int n, u, v;
    cin >> n >> u >> v;
    u--,v--;
    g.resize(n);
    visited.resize(n);
    d.resize(n);
    rep(i,n-1){
        int x,y;
        cin >> x >> y;
        x--,y--;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    dfs(-1,v,0);
    escape(-1,u,0);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 10624
#include <iostream>
#include <cstring>

#include <string>
#include <vector>
#include <algorithm>

#include <cassert>

using namespace std;

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

#define MAXM 100004
llong N, nblocks;
int K;
VI A;

int MM;
char B[7][MAXM];

int ncomps;
int C[7][MAXM];
void flood_fill(int r, int c) {
   if (r < 0 || r >= MM || c < 0 || c >= 7) return;
   if (B[c][r] == '#') return;
   if (C[c][r]) return;
   C[c][r] = ncomps;

   flood_fill(r-1, c);
   flood_fill(r, c-1);
   flood_fill(r, c+1);
   flood_fill(r+1, c);
}

int dfs(const VVI& adj, VI& vis, int u) {
   int res = 1;
   vis[u] = 1;
   for (int v : adj[u]) {
      if (!vis[v])
         res += dfs(adj, vis, v);
   }
   return res;
}

llong solve() {
   MM = (K % 7) ? K : K/7;

   //cerr << "MM: " << MM << endl;

   for (int rem : A) {
      for (; rem < 7*MM; rem += K) {
         int r = rem / 7;
         int c = rem % 7;
         B[c][r] = '#';
      }
   }

   /*
   REP(r, MM) {
      REP(c, 7)
         cerr << B[c][r];
      cerr << endl;
   }
   */

   REP(r, MM) {
      REP(c, 7) {
         if (B[c][r] != '#' && C[c][r] == 0) {
            ++ncomps;
            flood_fill(r, c);
         }
      }
   }

   /*
   REP(r, MM) {
      REP(c, 7)
         cerr << C[c][r] << ' ';
      cerr << endl;
   }
   */
   
   VVI adj(ncomps);
   REP(c, 7) {
      int u = C[c][0] - 1, v = C[c][MM-1] - 1;
      if (u >= 0 && v >= 0) {
         adj[u].push_back(v);
         if (u != v)
            adj[v].push_back(u);
      }
   }

   llong nblocks = N / MM;
   //cerr << "Number of blocks = " << nblocks << endl;
   llong res = 0;
   VI vis(ncomps);
   REP(u, ncomps) {
      if (vis[u]) continue;
      if (adj[u].empty())
         res += nblocks;
      else {
         bool self = find(adj[u].begin(), adj[u].end(), u) != adj[u].end();
         int cnt = dfs(adj, vis, u);
         if (self)
            ++res;
         else {
            FOR(len, 1, cnt-1) {
               if (nblocks >= len)
                  res += 2;
            }
            res += max(nblocks - cnt + 1, 0LL);
         }
      }
   }

   return res;
}


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

   int Q;
   cin >> N >> K >> Q;
   memset(B, '.', sizeof(B));

   A = VI(Q);
   REP(j, Q)
      cin >> A[j];

   llong res = solve();
   cout << res << endl;

   return 0;
}


Measured memory_bytes: 15616
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int n;

int a[30];
int b[30];
int c[30];

int main()
{
	scanf("%d", &n);
	
	for (int i = 1 ; i <= n ; i++)
		scanf("%d", &(a[i]));

	for (int i = 1 ; i <= n ; i++)
		scanf("%d", &(b[i]));

	for (int i = 1 ; i <= n - 1 ; i++)
		scanf("%d", &(c[i]));
	
	long long sum = 0;
	int lastDish = -1;
	int curDish;
	for (int i = 1 ; i <= n ; i++)
	{
		curDish = a[i];
		
		sum = sum + b[curDish];
		
		if ((lastDish + 1) == (curDish))	//impossible to xxx
		{
			sum = sum + c[lastDish];
		}
		
		lastDish = curDish;
	}
	
	printf("%lld\n", sum);
		
	return 0;
}


Measured memory_bytes: 128
import queue

q = queue.Queue()
H,W = map(int, input().split())
memo = [[-1]*W for _ in range(H)]
board = [input() for _ in range(H)]
wall=0
direction = [(1, 0), (-1, 0), (0, 1), (0, -1)]


def bfs():
    memo[0][0] = 0
    q.put((0, 0))
    while not q.empty():
        y,x= q.get()
        for (dy, dx) in direction:
            if 0<=y+dy<=H-1 and 0<=x+dx<=W-1 and board[y+dy][x+dx] == '.' and memo[y+dy][x+dx] == -1:
                q.put((y + dy, x + dx))
                memo[y + dy][x + dx] = memo[y][x] + 1
                if (y+dy, x+dx) == (H-1, W-1):
                    return memo[H-1][W-1]
    return -1


for s in board:
    wall+=s.count('#')

min_dist=bfs()
print(H*W-wall-(min_dist+1) if min_dist>0 else -1)

Measured memory_bytes: 3948
import numpy as np

string = list(input())

stack = []

for s in string:
  if (s == '0' or s == '1'):
    stack.append(s)
  else:
    if len(stack) > 0:
      stack.pop()
    else:
      pass

answer = ''
for t in stack:
  answer += t

print(answer + '\n')

Measured memory_bytes: 12388
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

int solve(int x){
    int res = 0;

    int d = 2;

    while( d <= 2 * x){
        int kosuu = 0;
        kosuu += int(d/ 2) * int( x/ d);
        kosuu += max(llong(0) , int(x % d) - int(d / 2) + 1);
        res += int(kosuu % 2) * int(d/2); 
        d *= 2;
    }
    return res;
}


signed main(){
    int a,b;
    cin >> a >> b;
    a --;
    int tmpa,tmpb;
    tmpa = solve(a);
    tmpb = solve(b);
    cout << (tmpa xor tmpb) << endl;
}

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

using namespace std;

struct comp {
  double re, im;

  comp(double x = 0, double y = 0) : re(x), im(y) {}

  comp operator+(const comp& a) { return comp(re + a.re, im + a.im); }
  comp operator-(const comp& a) { return comp(re - a.re, im - a.im); }
  comp operator*(const comp& a) { return comp(re * a.re - im * a.im, re * a.im + im * a.re); }
};

const double pi = acos(-1);

void fft(vector<comp>& x) {
  int n = x.size();
  for (int i = 1, k = 0; i < n; ++i) {
    for (int bit = n >> 1; (k ^= bit) < bit; bit >>= 1) {}
    if (i < k) {
      swap(x[i], x[k]);
    }
  }
  for (int k = 1; k < n; k <<= 1) {
    comp wlen(cos(pi / k), sin(pi / k));
    for (int i = 0; i < n; i += (k << 1)) {
      comp w(1);
      for (int j = 0; j < k; ++j) {
        comp tmp = w * x[i + j + k];
        x[i + j + k] = x[i + j] - tmp;
        x[i + j] = x[i + j] + tmp;
        w = w * wlen;
      }
    }
  }
}

template<class T> vector<T> mul(vector<T> a, vector<T> b) {
  int n = max(a.size(), b.size());
  int lg = 31 - __builtin_clz(n);
  n = 1 << (lg + 1 + (n != (1 << lg)));
  vector<comp> fa(n), fb(n), fc(n);
  for (int i = 0; i < a.size(); ++i) {
    fa[i] = a[i];
  } for (int i = 0; i < b.size(); ++i) {
    fb[i] = b[i];
  }
  fft(fa);
  if (a == b) {
    fb = fa;
  } else {
    fft(fb);
  }
  for (int i = 0; i < n; ++i) {
    fc[i] = fa[i] * fb[i];
  }
  fft(fc);
  reverse(fc.begin() + 1, fc.end());
  vector<T> c(n);
  for (int i = 0; i < n; ++i) {
    c[i] = (T)(fc[i].re / n + (fc[i].re > 0 ? 0.5 : -0.5));
  }
  return c;
}

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

  int n;
  long long m;
  cin >> n >> m;
  vector<long long> cnt((int)1e6 + 1);
  while (n--) {
    int x;
    cin >> x;
    ++cnt[x];
  }
  cnt = mul(cnt, cnt);
  long long ans = 0;
  for (int i = cnt.size() - 1; m > 0 and i >= 0; --i) {
    ans += i * min(cnt[i], m);
    m -= min(cnt[i], m);
  }
  cout << ans;

  return 0;
}

Measured memory_bytes: 138496
import sys
input = sys.stdin.readline

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

import bisect
a.sort()
c.sort()
ans = 0

for i in b:
    ans += bisect.bisect_left(a, i) * (len(c) - bisect.bisect_right(c, i))

print(ans)

Measured memory_bytes: 92004
#include <bits/stdc++.h>
using namespace std;
inline void rd(int &x) {
	char ch; for(;!isdigit(ch=getchar()););
	for(x=ch-'0';isdigit(ch=getchar());)x=x*10+ch-'0';
}
typedef long long LL;
const int MAXN = 300005;
int n, cnt[MAXN];
LL sum[MAXN];
int ans[MAXN];

inline bool chk(int k, int x) { return sum[x] >= 1ll*k*x; }

int main() {
	rd(n);
	for(int i = 1, x; i <= n; ++i) rd(x), ++cnt[x], ++sum[cnt[x]];
	for(int i = 1; i <= n; ++i) sum[i] += sum[i-1];
	int now = 0;
	for(int k = n; k >= 1; --k) {
		while(now < n && chk(k, now+1)) ++now;
		ans[k] = now;
	}
	for(int i = 1; i <= n; ++i) printf("%d\n", ans[i]);
}

Measured memory_bytes: 5504
import java.util.*;
import java.util.Collections;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String X = sc.next();
    String Y = sc.next();
    StringBuffer A = new StringBuffer(X);
    String B = A.reverse().toString();
    if (B.equals(Y)) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
}


Measured memory_bytes: 23252
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b,c,k=LI()
  ans=0
  if k<a:
    ans=k
  elif k<a+b:
    ans=k
  else:
    ans=a
    ans-=(k-(a+b))
  return ans

# main()
print(main())


Measured memory_bytes: 10764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 4e5+1;

int pos[N],a[N],n,ans[N],cnt;
struct ndd{int w,l,r;}res[N];
bool operator <(ndd a,ndd b){return a.w>b.w;}
priority_queue<ndd>q;
struct nd
{
	int l[N*2],r[N*2],mx[N*2];
	void init(){memset(mx,0x3f,sizeof(mx));}
	void up(int x)
	{
		mx[x]=min(mx[x*2],mx[x*2+1]);
	}
	void build(int x,int l1,int r1,bool tag)
	{
		l[x]=l1;r[x]=r1;
		if(l1==r1)
		{
			if(!tag&&l1%2==0)mx[x]=a[l1];
			else if(tag&&l1%2==1)mx[x]=a[l1];
			return;
		}
		int mid=l1+r1>>1;
		build(x*2,l1,mid,tag);
		build(x*2+1,mid+1,r1,tag);
		up(x);
		return;
	}
	int get(int now,int x,int y)
	{
		if(x>y)return 0;
		int l1=l[now],r1=r[now];
		if(x<=l1&&r1<=y)return mx[now];
		int mid=l1+r1>>1;
		int ret=0x7fffffff;
		if(x<=mid)ret=min(ret,get(now*2,x,y));
		if(y>mid)ret=min(ret,get(now*2+1,x,y));
		return ret;
	}
}t,t1;

int main()
{
	cin>>n;
	for(int i=1;i<=n;++i)cin>>a[i],pos[a[i]]=i;
	t.init();t1.init();
	t.build(1,1,n,0);t1.build(1,1,n,1);
	int x;
	if((n-x)%2==1)x=t.get(1,1,n-1);
	else	x=t1.get(1,1,n-1);
	ndd a1;
	a1.w=x;a1.l=1,a1.r=n;
	q.push(a1);
	while(!q.empty())
	{
		a1=q.top();q.pop();
		int l=a1.l,r=a1.r,x=pos[a1.w];
		if(l>r)continue;
		int y;
		if(x%2==1)	y=t.get(1,x+1,r);
		else			y=t1.get(1,x+1,r);
		y=pos[y];
		ans[++cnt]=a[x];ans[++cnt]=a[y];
		if(l<x-1)
		{
			int ret1;
			if(l%2==0)ret1=t.get(1,l,x-1);
			else	ret1=t1.get(1,l,x-1);
			a1.w=ret1,a1.l=l,a1.r=x-1;
			q.push(a1);
		}
		if(x+1<y-1)
		{
			int ret1;
			if((x+1)%2==0)ret1=t.get(1,x+1,y-1);
			else	ret1=t1.get(1,x+1,y-1);
			a1.w=ret1,a1.l=x+1,a1.r=y-1;
			q.push(a1);
		}
		if(y+1<r)
		{
			int ret1;
			if((y+1)%2==0)ret1=t.get(1,y+1,r);
			else	ret1=t1.get(1,y+1,r);
			a1.w=ret1,a1.l=y+1,a1.r=r;
			q.push(a1);
		}
	}
	for(int i=1;i<=n;++i)cout<<ans[i]<<" ";
}

Measured memory_bytes: 27384
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
using namespace std;

int main(){
  int m;
  cin >> m;
  
  string s;
  for(int i=0; i<m; i++){
    cin >> s;
    set<string> S;
    S.insert(s);
    for(int j=0; j<s.size(); j++){
      string t1 = s.substr(0, j+1), t2 = s.substr(j+1);
      string t1_ = t1;
      S.insert(t2 + t1);
      reverse(t1.begin(), t1.end());
      S.insert(t1 + t2);
      S.insert(t2 + t1);
      reverse(t2.begin(), t2.end());
      S.insert(t1_ + t2);
      S.insert(t2 + t1_);
      S.insert(t1 + t2);
      S.insert(t2 + t1);
    }
    cout << S.size() << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3196
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long sum = 0;
		Integer H[] = new Integer[N];

		for (int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		sc.close();

		Arrays.sort(H, Collections.reverseOrder());

		if (N <= K) {
			System.out.println(0);
		} else {

			for (int i = 0; i < K; i++) {
				H[i] = 0;
			}
			for (int i = 0; i < N; i++) {
				sum += H[i];
			}
			System.out.println(sum);
		}
	}
}


Measured memory_bytes: 95148
#include <bits/stdc++.h>
using namespace std;
int main(){
    int W, H;
    cin>>W>>H;
    
    int x, y, r;
    cin>>x>>y>>r;
    
    if(x+r<=W && y+r<=H && x-r>=0 && y-r>=0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
}


Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>

using namespace std;
 
typedef long long i64;
typedef pair<i64, i64> P;

template<class T>
const T INF = numeric_limits<T>::max();
template<class T>
const T SINF = numeric_limits<T>::max() / 10;
static const i64 MOD = 1000000007;

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//int dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//int dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge {
	i64 from, to, cost;
	edge(i64 to, i64 cost) : from(-1), to(to), cost(cost) {}
	edge(i64 src, i64 to, i64 cost) : from(src), to(to), cost(cost) {}
};

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);
}

//-----end of template-----//

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    i64 ans = 0, cnt =  0;
    for(int i = 0; i < s.length(); ++i){
        if(s[i] == 'B') cnt++;
        else ans += cnt;
    }
    cout << ans << endl;
}

Measured memory_bytes: 720
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int a,b,c,d;
  cin >> a >> b >> c >> d;

  int x = c-a, y = d-b;

  cout << c-y SP d+x SP c-y-x SP d+x-y << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

// https://atcoder.jp/contests/abc145/tasks/abc145_b
public class Main {

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

		Character[] alphabet = new Character[26];
	    char c = 'A';
	    for (int i = 0; i < 26; i++){
	        alphabet[i] = c;
	        c++;
	    }

	    List<Character> list = Arrays.asList(alphabet);
	    for(int i=0;i<S.length();i++) {
	    	int index = (list.indexOf(S.charAt(i))+N)%26;
	    	System.out.print(alphabet[index]);
	    }


	}
}


Measured memory_bytes: 27580
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<string>
#include<sstream>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
#include<queue>
#include<utility>
using namespace std;

#define i64 long long int

#define ran 111

int n, goal;
int t[ran], cnt[ran], award[ran];

int chk(int mask) {
	int res = 0, score = 0;
	for(int i=0;i<n;i++)
		if (mask&(1<<i)) {
			res+=cnt[i];
			score+=cnt[i]*(i+1)*100 + award[i];
		}
	for(int i=n-1;i>=0;i--) 
		if (score < goal && !(mask&(1<<i))) {
			while(cnt[i]>0 && score<goal) {
				cnt[i]--; res++;
				score += (i+1)*100;
			}
		}
	if (score<goal) return -1;
	return res;
}

int main() {
	scanf("%d%d", &n, &goal);
	for(int i=0;i<n;i++) scanf("%d%d", &cnt[i], &award[i]);
	int ans = -1;
	for(int i=0;i<(1<<n);i++) {
		for(int j=0;j<n;j++) t[j] = cnt[j];
		int x = chk(i);
		if (x>0 && (ans<0 || ans>x)) ans = x;
		for(int j=0;j<n;j++) cnt[j] = t[j];
	}
	printf("%d\n", ans);
	
	return 0;
}	



Measured memory_bytes: 256
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define ull unsigned long long
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
int INF = 1001001001;
const int MOD=1e9+7;

int main() {
  int n;
  in n;
  long long int ans=1,MAX=pow(10,18);
  vector<long long int>a(n);
  rep(i,n)
  {
    in a[i];
    if(a[i]==0)
    {
      cout<<0<<endl;
      return 0;
    }
  }
  rep(i,n)
  {
    if(a[i]<=MAX/ans)
    {
      ans*=a[i];
    }
    else
    {
      cout<<-1<<endl;
      return 0;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 4000
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> vec(n, 0);
	for(int i = 0; i < n - 1; ++i){
		cin>>vec[i];
	}
	int r = vec[0];
	for(int i = 0; i < n - 1; ++i){
		if(vec[i + 1] >= vec[i]){
			r += vec[i];
		}
		else{
			r += vec[i + 1];
		}
	}
	r += vec[n - 2];
	cout<<r<<endl;	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	int r;
	cin >> r;

	cout << r * r;

	return 0;
}


Measured memory_bytes: 3596
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n, max int
	var s string
	fmt.Scan(&n, &s)
	for i := 1; i < len(s)-1; i++ {
		m := make(map[string]int)
		for _, v := range s[0:i] {
			m[string(v)]++
		}
		var t int
		for k := range m {
			if strings.Index(s[i:], k) != -1 {
				t++
			}
		}
		if t > max {
			max = t
		}
	}
	fmt.Println(max)
}


Measured memory_bytes: 768
#include <iostream>
#include <cfenv>
#include <cmath>
using namespace std;
int main(void)
{
	double X, Y;
	
	Y=100;
	cin >> X;
	
	for(int i=1;;i++)
	{
		Y += floor(Y/100);
		if(X<=Y)
		{
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 3724
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

int main()
{
	int b, f, r, v;;
	int house[5][4][11];
	int i, n;

	for (b = 1; b <= 4; b++) {
		for (f = 1; f <= 3; f++) {
			for (r = 1; r <= 10; r++) house[b][f][r] = 0;
		}
	}
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d%d%d%d", &b, &f, &r, &v);
		house[b][f][r] += v;
	}

	for (b = 1; b <= 4; b++) {
		for (f = 1; f <= 3; f++) {
			for (r = 1; r <= 10; r++) printf(" %d", house[b][f][r]);
			putchar('\n');
		}
		if (b < 4) puts("####################");
	}
	return 0;
}



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



//defines...
#define ll long long
#define tata return;
#define pb push_back
#define mp make_pair
#define in insert
#define run ios_base::sync_with_stdio(false);cin.tie(NULL);
#define yes cout<<"Yes"<<endl;
#define no cout<<"No"<<endl;
#define vec vector<ll>
#define setl set<ll>
#define mapl map<ll,ll>
#define shunno cout<<0<<endl;
#define pi 2*acos(0.0)1
#define hobena cout<<-1<<endl;




//typedefs...
typedef pair<ll,ll>pll;

//const..
const ll fx[]={0,1,0,-1};
const ll fy[]={1,0,-1,0};
const ll mod=1e9+7;

/*ll ncr(ll n, ll k)
{
    ll res = 1;


    if (k > n - k)
        k = n - k;

    for (int i = 0; i < k; ++i) {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}
*/
//to remove suffix of a number from a set of string
/*
for(int k=1; k<j.size(); k++)
                if(temp.count(string(j.begin()+k,j.end())))
					temp.erase(string(j.begin()+k,j.end()));
 */
 ll ans(ll x,ll y)
 {
     return((x-y)*(x-y));
 }

void oka()
{
    ll i,j,n,mn=1e10,s=0;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    for(j=-100;j<=100;j++)
    {
        for(i=0;i<n;i++)
        {
            s+=ans(a[i],j);


        }
        mn=min(s,mn);
        s=0;
    }
    cout<<mn<<endl;




}
/*I'll paint it on the walls
     cause I'm the one at fault
    I'll never fight again and
         this is how it ends .*/






int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    run

    oka();




}

Measured memory_bytes: 3648
#include  <stdio.h>
#define MAX 45

int result[MAX];

int Fib(int n){
    int i;

    result[0] = result[1] = 1;

    for(i = 2; i <= n; i++)
        result[i] = result[i-1] + result[i-2];

    return result[n];
}

int main() {
    int i;
    int n;
    int ans;

    scanf("%d", &n); 
    printf("%d\n", Fib(n));

    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define int long long
#define fo(i, n) for(int i = 1; i <= (n); i ++)
#define out(x) cerr << #x << " = " << x << "\n"
#define type(x) __typeof((x).begin())
#define foreach(it, x) for(type(x) it = (x).begin(); it != (x).end(); ++ it)
using namespace std;
// by piano
template<typename tp> inline void read(tp &x) {
  x = 0;char c = getchar(); bool f = 0;
  for(; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
  for(; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if(f) x = -x;
}
const int N = 1e6 + 233;
int n, a[N], f1[N], f2[N], ans[N];
main(void) {
  read(n);
  for(int i = 0; i < (1 << n); i ++)
    read(a[i]), f1[i] = a[i];
  for(int i = 0; i < n; i ++)
    for(int st = 0; st < (1 << n); st ++)
      if(st >> i & 1) {
        int c[5];
        c[1] = f1[st]; c[2] = f2[st];
        c[3] = f1[st ^ (1 << i)];
        c[4] = f2[st ^ (1 << i)];
        sort(c + 1, c + 4 + 1);
        f1[st] = c[4]; f2[st] = c[3];
      }
  for(int i = (1 << n) - 1; ~i; i --)
    ans[i] = f1[i] + f2[i];
  for(int i = 1; i < (1 << n); i ++) {
    if(i) ans[i] = max(ans[i], ans[i - 1]);
    cout << ans[i] << "\n";    
  }
}


Measured memory_bytes: 19456
#include<iostream>
using namespace std;
int main(){
  int n,y,i,j,k;cin >> n >> y;
  for(i=0;i<=n;i++){
    for(j=0;j<=n-i;j++){
      k = n-i-j;
      if(10000*i+5000*j+1000*k==y){
        cout << i << " " << j << " " << k << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
  return 0;
}

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

typedef long long ll;
typedef vector<long long> vl;
typedef pair<long , long> pll;
typedef vector< pll > vll;
typedef set<ll> sl;
typedef map<string, int> msi;

#define pb push_back
#define mp make_pair
#define f first
#define s second
#define inf 0x3f3f3f3f
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))

const ll md = 1000000007;
//void mod(ll &x){if (x >= md) x -= md; if (x < 0) x += md;}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n,i,j,ans;
	cin>>n;
	ll abc[n+1][4];
	ll dp[n+1][4];
	for(i=1;i<=n;i++){
		for(j=1;j<=3;j++){
			cin>>abc[i][j];
		}
	}
	dp[1][1] = abc[1][1];
	dp[1][2] = abc[1][2];
	dp[1][3] = abc[1][3];
	for(i=2;i<=n;i++){
		dp[i][1] = abc[i][1] + max(dp[i-1][2],dp[i-1][3]);
		dp[i][2] = abc[i][2] + max(dp[i-1][1],dp[i-1][3]);
		dp[i][3] = abc[i][3] + max(dp[i-1][1],dp[i-1][2]);
	}
	ans = max(dp[n][1],max(dp[n][2],dp[n][3]));
	cout<<ans;
    return 0;
}




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

int main(void)
{
    int n;
    int s;
    char str[128];
    int i, j;

    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%d", &s);
        printf("Case %d:\n", i + 1);
        for (j = 0; j < 10; j++){
            sprintf(str, "%08d", s * s);
            str[6] = '\0';
            s = atoi(&str[2]);
            printf("%d\n", s);
        }
    }

    return (0);
}

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

int main()
{
    int n;
    cin>>n;
    int arr[n-1],ans[n+1]={0};
    for(int i=0;i<n-1;i++)
    {
        cin>>arr[i];
        ans[arr[i]]++;
    }
    for(int i=1;i<=n;i++)
    {
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 5184
N = gets.to_i
 
if N < 10
  if N == 2 || N == 4 || N == 5 || N == 7 || N == 9
    print "hon"
  elsif N == 0 || N == 1 || N == 6 || N == 8
    print "pon"
  elsif N == 3
    print "bon"
  end
elsif N >= 10 && N <= 99
  nn = N % 10
  if nn == 2 || nn == 4 || nn == 5 || nn == 7 || nn == 9
    print "hon"
  elsif nn == 0 || nn == 1 || nn == 6 || nn == 8
    print "pon"
  elsif nn == 3
    print "bon"
  end
elsif N >= 100 && N <= 999
  nnn = N % 100 % 10
  if nnn == 2 || nnn == 4 || nnn == 5 || nnn == 7 || nnn == 9
    print "hon"
  elsif nnn == 0 || nnn == 1 || nnn == 6 || nnn == 8
    print "pon"
  elsif nnn == 3
    print "bon"
  end
end

Measured memory_bytes: 14348
use std::io::*;
use std::i64;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


//main function
fn main() {
    let n: usize = read();
    let m: i64 = read();
    let mut v: Vec<i64> = Vec::with_capacity(n+1);
    let mut flag: Vec<bool> = Vec::with_capacity(n+1);
    unsafe{
	v.set_len(n+1);
	flag.set_len(n+1);
    }
    for i in 0..n+1{
	if i == 1 && n!=1{
	    v[i as usize] = 1;
	}
	else {
	    v[i as usize] = 0;
	}
	flag[i as usize] = true;
    }
    for _i in 0..m{
	let s: usize = read();
	let m: i64 = read();
	if !flag[s] && v[s] != m{
	    println!("-1");
	    return;
	}
	if s==1 && m==0 && n!=1{
	    println!("-1");
	    return;
	}
	v[s] = m;
	flag[s] = false;
    }
    for i in 1..n+1 {
	print!("{}",v[i as usize]);
    }
    println!("");
    
}


Measured memory_bytes: 4352
input()
h = list(map(int, input().split()))
h.append(-1)
ans = 0
state = "up"
for i, j in zip(h[:-1], h[1:]):
    if state == "up" and i > j:
        ans += i
        state = "down"
    if state == "down" and i < j:
        ans -= i
        state = "up"
print(ans)

Measured memory_bytes: 8980
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		scan.close();
		System.out.println((b-a==c-b)? "YES":"NO");
	}
}

Measured memory_bytes: 21716
import sys
input = sys.stdin.readline

INF = float('inf')
N, M = map(int, input().split())

class Edge():
    def __init__(self, start, end, cost):
        self.start = start
        self.end = end
        self.cost = cost
    def __str__(self):
        return 'Edge: {} -> {}, cost {}'.format(self.start, self.end, self.cost)

def bellman_ford(n, es, s):
    dist = [INF] * n
    dist[s] = 0
    # 更新が止まるまで繰り返す O(V*E)
    # i度目の更新までにsを始点として0~i個の辺からなる経路が探索され、その時点の最短経路が計算される
    # 最短経路は最大でもV-1個の頂点しか通らないため、最悪でもv-1回で収束する
    cnt = 0
    while True:
        update = False
        # 辺をすべて見る
        for e in es:
            # aに到達可能かつa経由の方が近ければ更新する
            if dist[e.start] != INF and dist[e.end] > dist[e.start] + e.cost:
                dist[e.end] = dist[e.start] + e.cost
                update = True
                if cnt == n-1 and e.end == n-1:
                  print('inf')
                  sys.exit()
        cnt += 1
        # 一度も更新されなければ終了
        if not update or cnt == n:
            break
    return dist

es = []

for i in range(M):
  a, b, cost = map(int, input().split())
  es.append(Edge(a-1, b-1, -cost))
  # es.append(Edge(b-1, a-1, -cost))


print(-bellman_ford(N, es,0)[N-1])


Measured memory_bytes: 68784
#!/usr/bin/env python3
import sys


def solve(x_s: int, y_s: int, x_t: int, y_t: int, N: int, x: "List[int]", y: "List[int]", r: "List[int]"):
    import numpy as np
    from scipy.sparse import csr_matrix, coo_matrix
    from scipy.sparse.csgraph import dijkstra
    x.extend([x_s, x_t])
    y.extend([y_s, y_t])
    r.extend([0, 0])
    p = np.column_stack((x, y))
    diff = np.expand_dims(p, axis=1) - np.expand_dims(p, axis=0)
    dist = np.sqrt(np.sum(diff ** 2, axis=-1))
    mat = ((dist - r).T - r).clip(min=1e-20)    
    return '{:.10f}'.format(dijkstra(csr_matrix(mat), indices=N)[N+1])

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    x_s = int(next(tokens))  # type: int
    y_s = int(next(tokens))  # type: int
    x_t = int(next(tokens))  # type: int
    y_t = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    r = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
        r[i] = int(next(tokens))
    print(solve(x_s, y_s, x_t, y_t, N, x, y, r))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 100408
N, A, B = map(int, input().split())

a = 0
b = 0

S = input()
for s in S:
  if s == "a":
    if a + b < A + B:
      a += 1
      print("Yes")
    else:
      print("No")
  elif s=="b":
    if a + b < A + B and b < B:
      b += 1
      print("Yes")
    else:
      print("No")
  else:
    print("No")

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

a, b = map(int, input().split())

if a > 0:
    print('Positive')
    sys.exit(0)
if a == 0:
    print('Zero')
    sys.exit(0)
if a < 0:
    if b >= 0:
        print('Zero')
        sys.exit(0)
    if b < 0:
        diff = (b - a) + 1
        if diff % 2 == 0:
            print('Positive')
        else:
            print('Negative')


Measured memory_bytes: 61928
def main():
  N,M = map(int,input().split())
  a = [int(input()) for i in range(M)]
  m = 10**9+7
  
  stair = [0]*(N+1)
  for i in a:
    stair[i] = -1
  
  dp = [0]*(N+1)
  dp[0] = 1
  if 1 not in a:
    dp[1] = 1
  for i in range(2,N+1):
    if stair[i] == 0:
      dp[i] = dp[i-1] + dp[i-2]
      dp[i] %= m
  print(dp[N])

if __name__ == '__main__':
  main()

Measured memory_bytes: 8616
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const ll inf=1e9+7;

int main()
{
  ll n,a,x[50];
  cin>>n>>a;
  rep(i,n) cin>>x[i];

  ll dp[n+1][n+1][2501];
  rep(i,2501) dp[0][0][i]=0;
  dp[0][0][0]=1;

  rep(i,n)
  rep(j,i+1)
  rep(k,n*50+1)
  {
    if(k-x[i]<0) dp[i+1][j][k]=dp[i][j][k];
    else dp[i+1][j+1][k]=dp[i][j+1][k]+dp[i][j][k-x[i]];
  }

  ll ans=0;
  for(int i=1;i<=n;i++) ans+=(dp[n][i][i*a]);
  cout<<ans<<endl;
}

Measured memory_bytes: 51072
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
 
using namespace std;
using namespace __gnu_pbds;
 
#define debug(s) cout << #s << " = " << s << endl
#define all(v) (v).begin(), (v).end()
#define mem(a,val) memset(a, val, sizeof a)
 
#define maxn 300010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;
 
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int mod = 1e9 + 7;

int n;
ll arr[maxn], b[2][62];
ll ans;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> arr[i];
    if (i != 1) {
      for (int j = 0; j <= 60; ++j) {
        if (arr[i] & (1LL << j)) b[1][j]++;
        else b[0][j]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= 60; ++j) {
      if (arr[i] & (1LL << j)) {
        if (i != 1) b[1][j]--;
        ans = (ans + (b[0][j] * ((1LL << j) % mod)) % mod) % mod;
      }
      else {
        if (i != 1) b[0][j]--;
        ans = (ans + (b[1][j] * ((1LL << j) % mod)) % mod) % mod;
      }
    }
  }
  cout << ans << endl;
}





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

int main(){
  int p, q, r; cin >> p >> q >> r;
  int s; s=p+q;
  if(s>q+r){
    s=q+r;
  }
  if(s>r+p){
    s=p+r;
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int N;
vector<int> p;
int main(){
  cin >> N;
  p.resize(N);
  for(int i=0;i<N;i++){
    cin >> p[i];
  }
  sort(p.begin(),p.end(),greater<int>());
  int ans = 0;
  for(int i = 0;i<N;i++){
    if(i==0){
      ans += p[i]/2;
    }
    else{
      ans += p[i];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define INF 10000000
#define MAX_V 100
using namespace std;
int n,m;
int cost[MAX_V][MAX_V];
int mincost[MAX_V];
bool used[MAX_V];
int prim(){
  int res = 0;
  fill(mincost,mincost + n,INF);
  fill(used,used + n,false);

  mincost[0] = 0;
  while(1){

    int v = -1;

    for(int u = 0 ; u < n ; u++ ){
      if(!used[u] && (v == -1 || mincost[u] < mincost[v]))v = u;
    }
    if(v == -1)break;
    used[v] = true;
    res += mincost[v];
    for(int i = 0 ; i < n ; i++ ){
      mincost[i] = min(mincost[i],cost[i][v]);
    }
  }
  return res;
}

int main(){

  char ch;
  while(cin >> n,n){
    cin >> m;
    for(int i = 0 ; i < n ; i++ ){
      for(int j = 0 ; j < n ; j++ ){
	cost[i][j] = INF;
      }
    }
    for(int i = 0 ; i < m ; i++ ){
      int a,b,c;
      cin >> a >> ch >> b >> ch >> c;
      cost[a][b] = cost[b][a] = (c-100)/100;
    }
    cout <<  prim() << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>

using namespace std;

const int MAX = 123456 * 2 + 1;

int main (int argc, char *argv[]) {
    int n;
    vector<bool> v(MAX, true);
    for (int i = 2; i < sqrt(MAX); ++i) {
        if (v[i]) {
            for (int j = 0; i*(j+2) < MAX; ++j) {
                v[i*(j+2)] = false;
            }
        }
    }
    while (cin>>n, n) {
        int ans = 0;
        for (int i = n+1; i <= 2*n; ++i) {
            if (v[i]) ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<stdio.h>
using namespace std;
 
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1<<25
 
int main()
{
	int n;
	cin >> n;
	if (n == 25)
		cout << "Christmas" << endl;
	else if (n == 24)
		cout << "Christmas Eve" << endl;
	else if(n == 23)
		cout << "Christmas Eve Eve" << endl;
	else if(n == 22)
		cout << "Christmas Eve Eve Eve" << endl;


	return 0;
}

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

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

    string ans;

    if (s == "ABC")
    {
        ans = "ARC";
    }
    else
    {
        ans = "ABC";
    }

    cout << ans << endl;
}

Measured memory_bytes: 3628
package main

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

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func gcd2(a []int, min int) int {
	for i := min; i > 1; i-- {
		num := 0
		for _, n := range a {
			if n%i != 0 {
				num++
				if num >= 2 {
					break
				}
			}
		}
		if num < 2 {
			return i
		}
	}
	return 1
}

func main() {
	io := NewIo()
	defer io.Flush()

	N := io.NextInt()

	A := make([]int, N)
	min := 999999999999
	min2 := 999999999999

	for i := 0; i < N; i++ {
		A[i] = io.NextInt()
		if A[i] < min2 {
			if A[i] < min {
				min = A[i]
			} else {
				min2 = A[i]
			}
		}
	}

	io.PrintLn(gcd2(A, min2))

}


Measured memory_bytes: 6912
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int xvec = x2 - x1;
	int yvec = y2 - y1;
	int x3 = x2 - yvec;
	int y3 = y2 + xvec;
	int x4 = x3 - xvec;
	int y4 = y3 - yvec;
	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin>>N;
    N=N%10;

    if(N==2||N==4||N==5||N==7||N==9)
    {
        cout<<"hon";
    }
    else if(N==0||N==1||N==6||N==8)
    {
        cout<<"pon";

    }
    else if(N==3)
    {

     cout<<"bon";}
     return 0;
}


Measured memory_bytes: 3596
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<malloc.h>

int my_gets(char *buf,int nBuf,FILE *fp){
    int ch;

    while(--nBuf >0){
        ch=getc(fp);
        if(ch==EOF || ch=='\n')
            break;
        *(buf++)=(char)ch;
    }
    *(buf)='\0';

    return nBuf;
}

int main(void){
    int ch;

    do{
        ch=getchar();
        putchar((ch==',')?' ':(ch));
    }while(ch!='\n');
    return 0;
}

Measured memory_bytes: 128