akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    int X, Y, Z;
    cin >> X >> Y >> Z;

    cout << Z << " " << X << " " << Y << endl;
}


Measured memory_bytes: 256
N, X = map(int, input().split())
a = max(N - X, X)
b = min(N - X, X)
ans = N
while b != 0:
    q = a // b
    r = a % b
    ans += 2 * b * q
    if r == 0:
        ans -= b
    a = b
    b = r
print(ans)


Measured memory_bytes: 3064
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
   
//#include <x86intrin.h>
#include <bits/stdc++.h>   
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n;
ll k;

inline int add (int a, int b) {
   a += b;
   if (a >= mod) a -= mod;
   return a;
}

inline int mult (int a, int b) {
   return 1ll * a * b % mod;
}

struct Matrix {
   int a[55][55];
   Matrix () {
      memset (a, 0, sizeof a);
   }
   void one () {
      for (int i = 1; i <= n; i ++)
         a[i][i] = 1;
   }
}a;

Matrix operator * (const Matrix &a, const Matrix &b) {
   Matrix c;
   for (int i = 1; i <= n; i ++)
      for (int j = 1; j <= n; j ++)
         for (int k = 1; k <= n; k ++)
            c.a[i][j] = add (c.a[i][j], mult (a.a[i][k], b.a[k][j]));
   return c;
}

inline Matrix binpow (Matrix a, ll b) {
   Matrix res;
   res.one ();
   while (b) {
      if (b & 1) res = res * a;
      a = a * a;
      b >>= 1;
   }
   return res;
}

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> n >> k;
   for (int i = 1; i <= n; i ++)
      for (int j = 1; j <= n; j ++)
         cin >> a.a[i][j];
   a = binpow (a, k);
   int res = 0;
   for (int i = 1; i <= n; i ++)
      for (int j = 1; j <= n; j ++)
         res = add (res, a.a[i][j]);
   cout << res;                        
}

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}
                          

Measured memory_bytes: 384
N = int(input())
A = list(map(int,input().split()))
ans = "APPROVED"
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 != 0 and A[i] % 5 != 0:
            ans = "DENIED"
            break
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N;
  set<int> s;
  cin>>N;
  for(int i = 0;i < N;i++){
    int a;
    cin>>a;
    s.insert(a);
  }
  if(s.size() != N){
    cout<<"NO"<<'\n';
  }else{
    cout<<"YES"<<'\n';
  }
}

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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
ll tmp;
ll ret = 0;
string S, T;

void input() {
  IN(S);
  IN(T);
}

void solve() {
  REP(i, 3) {
    if (S[i] == T[i]){
      ret++;
    }
  }
  PRINT(ret);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
import java.util.Scanner

object Primes {
  val primes = new Array[Int](1001)
  for(i <- 2 to 1000){
    var flag = true
    for(k <- 2 to i-1)
      if(i % k == 0)
        flag = false
    primes(i) = 1
  }
}

object Main extends App{
  import Primes._

  val MOD = 1e9.toInt + 7

  val sc = new Scanner(System.in)
  val n = sc.nextInt()

  for(k <- 2 to n){
    var rest = k
    for(i <- 2 to 1000) {
      if(primes(i) > 0){
        while(rest % i == 0){
          rest /= i
          primes(i) += 1
        }
      }
    }
  }

  var ans = 1L
  for(i <- 2 to 1000) {
    if(primes(i) > 1) {
      ans *= primes(i)
      ans %= MOD
    }
  }

  println(ans)
}


Measured memory_bytes: 26808
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

int tbl[2][100100];

struct node {
	int val;
	int idx;
	node *left,*rgt;
};

struct ei {
	pair<int,int> val;
	pair<int,int> idx;
	int ll, rr;
};

bool operator<(const ei &a, const ei &b) {
	return a.val>b.val;
}

priority_queue<ei> qq;

node* build(int l,int r,int tree) {
	node* tmp = new node();
	if (l+1==r) {
		tmp->val=tbl[tree][l];
		tmp->idx=l*2+tree;
		tmp->rgt=0;
		tmp->left=0;
		return tmp;
	}
	int m=(l+r)>>1;
	node* ll = build(l,m,tree);
	node* rr = build(m,r,tree);
	if (ll->val<rr->val) {
		tmp->val=ll->val;
		tmp->idx=ll->idx;
	} else {
		tmp->val=rr->val;
		tmp->idx=rr->idx;
	}
	tmp->left=ll;
	tmp->rgt=rr;
	//printf("%d %d %d %d %d\n",tree,l,r,tmp->val,tmp->idx);
	return tmp;
}

node* root[4];

int getElem(int idx) {
	return tbl[idx%2][idx/2];
}

pair<int,int> trQuery(node *idx,int ll,int rr,int ql,int qr) {
	if (ql<=ll&&qr>=rr) return {idx->val,idx->idx};
	if (qr<=ll) return {2e9,2e9};
	if (ql>=rr) return {2e9,2e9};
	int mm=(ll+rr)>>1;
	if (ql>=mm) return trQuery(idx->rgt,mm,rr,ql,qr);
	if (qr<=mm) return trQuery(idx->left,ll,mm,ql,qr);
	auto l = trQuery(idx->left,ll,mm,ql,qr);
	auto r = trQuery(idx->rgt,mm,rr,ql,qr);
	if (l.first<r.first) return l;
	return r;
}

int n;


ei query(int ll,int rr) {
	//printf("call %d %d\n",ll,rr);
	if (rr-ll==2) {
		return {{getElem(ll),getElem(ll+1)},{ll,ll+1},ll,rr};
	}
	int tr=ll%2;
	auto left = trQuery(root[tr],0,n/2,ll/2,rr/2);
	int leftId = left.second+1;
	auto rgtt = trQuery(root[!tr],0,n/2,leftId/2,(rr+1)/2);
	
	return {{left.first,rgtt.first},{left.second,rgtt.second},ll,rr};
	//query(ll,left.second,dep);
	//query(left.second+1,rgtt.second,dep+1);
	//query(rgtt.second+1,rr,dep);


	//anss.push_back({dep,{left.first,rgtt.first}});
}

int main () {
	scanf("%d",&n);
	for (int i=0;i<n;i++) {
		scanf("%d",&tbl[i%2][i/2]);
	}
	//for (int i=0;i<n;i++) {
		//printf("%d,%d ",tbl[0][i],tbl[1][i]);
	//}
	//printf("\n");
	root[0]=build(0,n/2,0);
	root[1]=build(0,n/2,1);
	
	auto fst = query(0,n);
	qq.push(fst);
	while (!qq.empty()) {
		auto cur = qq.top();
		qq.pop();
		ei tmp;
		printf("%d %d ",cur.val.first,cur.val.second);
		if (cur.ll!=cur.idx.first) {
			tmp=query(cur.ll,cur.idx.first);
			qq.push(tmp);
		}
		if (cur.idx.first+1!=cur.idx.second) {
			tmp = query(cur.idx.first+1,cur.idx.second);
			qq.push(tmp);
		}
		if (cur.idx.second+1!=cur.rr) {
			tmp = query(cur.idx.second+1,cur.rr);
			qq.push(tmp);
		}
			//query(ll,left.second,dep);
			//query(left.second+1,rgtt.second,dep+1);
			//query(rgtt.second+1,rr,dep);
	}
	printf("\n");
	return 0;
}


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

d=int(input())
C=list(map(int,input().split()))
S=[list(map(int,input().split())) for _ in range(d)]

DP=[0]*26
for i in range(d):
    index,num=0,0
    for j in range(26):
        if S[i][j]>num:
            num=S[i][j]
            index=j
    print(index+1)

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

/*
   AtCoder contests
   coder : yoichion
 */

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int sum = 0;
        int max = 0;
        for(int n=0;n<N;n++){
            int p = sc.nextInt();
            sum += p;
            max = Math.max(max,p);
        }
        System.out.println(sum-max/2);
    }
}

Measured memory_bytes: 23508
from heapq import heappop, heappush
import numpy as np



def dijkstra(graph, n, vst=0):
    distance = [float('inf')] * n
    distance[vst] = 0
    checked_v = [0] * n
    route = [''] * 10
    route[vst] = str(vst)
    dist = [float('inf')] * n
    dist[vst] = 0
    q = []
    heappush(q, (0, vst))
    for _ in range(n):
        while True:
            min_dist, search_v = heappop(q)
            if checked_v[search_v] == 0:
                break
        checked_v[search_v] = 1
        for to_v in range(n):
            if checked_v[to_v] == 0:
                cost = graph[search_v][to_v]
                if dist[search_v] + cost < dist[to_v]:
                    dist[to_v] = dist[search_v] + cost
                    route[to_v] = route[search_v] + str(to_v)
                    heappush(q, (dist[to_v], to_v))
    return dist


h, w = map(int, input().split())
graph = np.array([np.array(list(map(int, input().split()))) for _ in range(10)])
graph = np.transpose(graph)
dist = dijkstra(graph, 10, vst=1)


wall_num = []
for i in range(h):
    wall_num += list(map(int, input().split()))



ret = 0
for num in wall_num:
    if num != -1:
        ret += dist[num]


print(ret)

Measured memory_bytes: 19180
import java.util.*;

import java.util.Map.Entry;

import java.lang.*;

import java.math.*;



public class Main {

	Scanner sc = new Scanner(System.in);



	class E {

		int x;

		int y;

		int c;

		E(int x, int y,int c) {

			this.x = x;

			this.y = y;

			this.c = c;

		}

	}



	void run() {

		for (;;) {

			int w = sc.nextInt();

			int h = sc.nextInt();

			if ((w | h) == 0)

				break;

			boolean[][] down = new boolean[h - 1][w];

			boolean[][] right = new boolean[h][w - 1];

			for (int j = 0; j < w - 1; j++) {

				right[0][j] = sc.nextInt() == 0;

			}

			for (int i = 0; i < h - 1; i++) {

				for (int j = 0; j < w; j++) {

					down[i][j] = sc.nextInt() == 0;

				}

				for (int j = 0; j < w - 1; j++) {

					right[i + 1][j] = sc.nextInt() == 0;

				}

			}

			int [][] cost = new int[h][w];

			boolean[][] visited = new boolean[h][w]; 

			LinkedList<E> l = new LinkedList<Main.E>();

			l.add(new E(0,0,1));

			visited[0][0] = true;

			cost[0][0] = 1;

			for(;!l.isEmpty();){

//				System.out.println(l.size());

				E e = l.pollLast();

				if(e.x+1 < w && right[e.y][e.x]){

					if(!visited[e.y][e.x+1]){

						visited[e.y][e.x+1] = true;

						cost[e.y][e.x+1]=e.c+1;

						l.addFirst(new E(e.x+1,e.y,e.c+1));

					}

				}

				if(e.x-1 >= 0 && right[e.y][e.x-1]){

					if(!visited[e.y][e.x-1]){

						visited[e.y][e.x-1] = true;

						cost[e.y][e.x-1]=e.c+1;

						l.addFirst(new E(e.x-1,e.y,e.c+1));

					}

				}

				if(e.y+1 < h && down[e.y][e.x]){

					if(!visited[e.y+1][e.x]){

						visited[e.y+1][e.x] = true;

						cost[e.y+1][e.x]=e.c+1;

						l.addFirst(new E(e.x,e.y+1,e.c+1));

					}

				}

				if(e.y-1 >= 0 && down[e.y-1][e.x]){

					if(!visited[e.y-1][e.x]){

						visited[e.y-1][e.x] = true;

						cost[e.y-1][e.x]=e.c+1;

						l.addFirst(new E(e.x,e.y-1,e.c+1));

					}

				}

			}

			System.out.println(cost[h-1][w-1]);

		}



	}



	public static void main(String[] args) {

		Main m = new Main();

		m.run();

	}

}

Measured memory_bytes: 13000
#include<string>
#include<set>
using namespace std;

typedef long long LL;

LL GCD(LL a,LL b)  
{  
    return !(b)?a:GCD(b,a%b);  
} 

int main()
{
	int n;
	scanf("%d",&n);
	
	LL temp;
	scanf("%lld",&temp); 
	LL LCM=temp;
	for(int i=1;i<n;i++)
	{
		scanf("%lld",&temp);
		LCM=LCM/GCD(LCM,temp)*temp;
	}
	
	printf("%lld",LCM);
	
	return 0;
} 

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:1024000000")
#pragma warning( disable : 6031)
#pragma warning( disable : 4244)
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <chrono>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef vector<ll> vl;
typedef vector<vector<long long>> vvl;
typedef tuple<int, int, int> tiii;
const long long mod = int(1e9) + 7;
const int INF = 1e9;


int main() {
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int n, k;
	int r, s, p;
	string t;
	cin >> n >> k >> r >> s >> p >> t;
	map<char, int> points = { {'r', r}, {'s', s}, {'p', p} };
	map<char, char> win_c = { {'r', 'p'}, {'p', 's'}, {'s', 'r'} };
	int res = 0;
	for (int i = 0; i < k; i++)
	{
		char p = 0;
		for (int j = i; j < n; j += k)
		{
			char cwin = win_c[t[j]];
			if (cwin != p)
			{
				res += points[cwin];
				p = cwin;
			}
			else
				p = 0;
		}
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 512
n = int(input())
lst = [int(input()) for _ in range(5)]

def calcu(a, b):
    if a % b == 0:
        return a//b
    else:
        return a//b + 1

ans = calcu(n, lst[0])
pace = min(n, lst[0])

for i in range(1,5):
    if pace > lst[i]:
        ans = calcu(n, lst[i]) + i
        pace = lst[i]
    else:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int A[500000],H;

void maxheaplify(int *A,int i){
int r,l,lrgst,tmp;
l = 2*i;
r = 2*i+1;

if(l<=H && A[l] > A[i]) lrgst = l;
else lrgst = i;

if(r<=H && A[r] > A[lrgst]) lrgst = r;

if(lrgst != i){
tmp = A[i];
A[i] = A[lrgst];
A[lrgst] = tmp;
maxheaplify(A,lrgst);
}
}

void buildMaxHeap(A){
    int i;
    for(i=H/2;i>=1;i--) maxheaplify(A,i);
}
int main(){

int h,i,j;

scanf("%d",&H);

for(i=1;i<=H;i++){
scanf("%d",&A[i]);

}
buildMaxHeap(A);

for(i=1;i<=H;i++) printf(" %d",A[i]);
printf("\n");
    return 0;
}


/*「節点のキーがその親のキー以下である」という max-ヒープ条件を満たすヒープを、max-ヒープと呼びます。max-ヒープでは、最大の要素が根に格納され、ある節点を根とする部分木の節点のキーは、その部分木の根のキー以下となります。親子間のみに大小関係があり、兄弟間に制約はないことに注意してください。

例えば、下図はmax-ヒープの例です。



与えられた配列から以下の疑似コードに従ってmax-ヒープを構築するプログラムを作成してください。

m
a
x
H
e
a
p
i
f
y
(
A
,
i
)
 は、節点 
i
 を根とする部分木が max-ヒープになるよう 
A
[
i
]
 の値を max-ヒープの葉へ向かって下降させます。ここで 
H
 をヒープサイズとします。

1  maxHeapify(A, i)
2      l = left(i)
3      r = right(i)
4      // 左の子、自分、右の子で値が最大のノードを選ぶ
5      if l ≤ H and A[l] > A[i]
6          largest = l
7      else 
8          largest = i
9      if r ≤ H and A[r] > A[largest]
10         largest = r
11
12     if largest ≠ i　// i の子の方が値が大きい場合
13         A[i] と A[largest] を交換
14         maxHeapify(A, largest) // 再帰的に呼び出し
次の buildMaxHeap(A) はボトムアップに maxHeapify を適用することで配列 
A
 を max-ヒープに変換します。

1 buildMaxHeap(A)
2    for i = H/2 downto 1
3        maxHeapify(A, i)
入力
入力の最初の行に、ヒープのサイズ 
H
 が与えられます。続いて、ヒープの節点の値を表す 
H
 個の整数が節点の番号が 1 から 
H
 に向かって順番に空白区切りで与えられます。

出力
max-ヒープの節点の値を節点の番号が 1 から 
H
 に向かって順番に１行に出力してください。各値の直前に１つの空白文字を出力してください。

制約
1
≤
H
≤
500
,
000
−
2
,
000
,
000
,
000
≤
節
点
の
値
≤
2
,
000
,
000
,
000
入力例 1
10
4 1 3 2 16 9 10 14 8 7
出力例 1
 16 14 10 8 7 9 3 2 4 1 */


Measured memory_bytes: 3700
#include <iostream>

#define rep(i, n) for(int i=0; i<n; i++)

using namespace std;

int main() {
    int n;
    cin >> n;
    
    int c[n], a[n-1], cnt=0;
    rep(i, n) {
        cin >> c[i];
        if(i>0) {
            if(c[i-1]<c[i]) {
                a[i-1] = 1;
            } else {
                a[i-1] = -1;
            }
            
            if(i>1) {
                if(a[i-1]==a[i-2]) cnt++;
            }
        }
    }
    
    cout << cnt << endl;

    return 0;
    
}

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

int main(){

  int in;

  cin >> in;
  for(int i = 0; i < in; i++){

    string num;

    cin >> num;

    sort(num.begin(), num.end());

    stringstream ss(num);
    int a;
    ss >> a;

    reverse(num.begin(), num.end());

    stringstream aa(num);
    int b;
    aa >> b;

    cout << b-a << endl;
    
  }
  return 0;
}

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

#define watch(x) cout << (#x) << " is " << (x) << endl
#define fr(i,n) for(int i=0; i<n; i++)
#define rep(i, st, en) for(int i=st; i<=en; i++)
#define repn(i, st, en) for(int i=st; i>=en; i--)
#define sq(a) (a*a)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll mod = 1e9+7;

ll gcdll(ll a, ll b){
    if(!b) return a;
    return gcdll(b, a%b);
}

void seive(int n){
    vector<bool> is_prime(n+1, true);
    is_prime[0] = is_prime[1] = false;

    for(int i=2; i*i<=n; i++){
        if(is_prime[i]){
            for(int j=i*i; j<=n; j+=i){
                is_prime[j] = false;
            }
        }
    }
}

vector<int> constructZFunc(string s){
    int n = s.size();
    vector<int> z(n);
    int l, r;
    l = r = 0;
    z[0] = 0;
    rep(i, 1, n-1){
        z[i] = 0;
        if(i<=r){
            z[i] = min(r-i+1, z[i-l]);  /// initialization, req. for linear time approach.
        }
        while(i+z[i] < n && s[z[i]] == s[i+z[i]])
            ++z[i];
        if(i+z[i]-1 > r){
            r = i+z[i]-1;
            l = i;
        }
    }
    return z;
}

void solve(){
    ll n, m, x;
    cin>>n>>m;
    ll days = 0ll;
    fr(i, m) {
        cin>>x;
        days += x;
    }
    cout<<((days > n) ? -1 : (n - days));
}

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

    ll t = 1;
    //  cin>>t;
    while(t--){
        solve();
    }

    return 0;
}



Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<ll>a(n);
    ll ans=1e18,sum1=0;
    rep(i,n){
        cin>>a[i];
        sum1+=a[i];
    }
    ll sum2=0;
    rep(i,n){
        sum2+=a[i];
        ans=min(ans,abs(sum1-sum2*2));
    }
    cout<<ans<<endl;
}


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

// one-based numbering
struct UnionFind {
    vector<int> data;
    // i: (data[i] < 0) -> group size, (data[i] > 0) -> parent;
    UnionFind(int n) {
        data.resize(n+1, -1);
    }
    int find(int x) {
        if(data[x] < 0) return x;
        else return data[x] = find(data[x]);
    }
    int size(int x) {
        return -data[find(x)];
    }
    bool unite(int x, int y) {
        x = find(x); y = find(y);
        if(x == y) return false;
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }
    bool same(int x, int y) {
        x = find(x); y = find(y);
        return x == y;
    }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    vector<vector<int>> e(n+1);
    vector<bool> vis(n+1, 1);
    vector<int> col(n+1, -1);
    UnionFind uf(n);
    for (int i = 0; i < m; i++) {
        int u, v; cin >> u >> v;
        e[u].emplace_back(v);
        e[v].emplace_back(u);
        uf.unite(u, v);
    }
    long long sx[3] = {0, 0, 0};
    long long num[3] = {0, 0, 0};
    auto calc = [&](int s) {
        bool ok = true;
        col[s] = 0;
        long long sum[2] = {0, 0};
        auto f = [&](auto f, int curr, int prev) -> void {
            sum[col[curr]]++;
            for (auto &to: e[curr]) {
                if (prev == to) continue;
                if (col[to] == -1) {
                    col[to] = 1 - col[curr];
                    f(f, to, curr);
                } else {
                    if (col[to] != 1 - col[curr]) ok = false;
                }
            }
        };
        f(f, s, -1);
        if (sum[0] + sum[1] == 1) return;
        if (ok) {
            sx[0] += sum[0], sx[1] += sum[1];
            num[0] += sum[0] > 0LL, num[1] += sum[1] > 0LL;
        } else {
            sx[2] += sum[0] + sum[1];
            num[2] += (sum[0] + sum[1]) > 0LL;
        }
    };
    long long ans = (long long) n * n;
    for (int i = 1; i <= n; i++) {
        int x = uf.find(i);
        if (vis[x]) {
            calc(i);
            vis[x] = 0;
        }
    }
    ans -= max(0LL, (sx[0] + sx[1]) * (sx[0] + sx[1]) - num[0] * num[0] * 2);
    ans -= max(0LL, sx[2] * sx[2] - num[2] * num[2]);
    ans -= max(0LL, sx[2] * (sx[0] + sx[1]) * 2 - num[0] * num[2] * 2);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 10112
#include <time.h>

#include <stdlib.h>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <numeric>

using namespace std;
int32_t **a;
int32_t **b;
int32_t n,Z,W;
int main(){
	cin>>n>>Z>>W;
	vector<int32_t> l;
	l.reserve(n);
	for(int32_t i1=0;i1<n;i1++){
		int32_t temp;
		cin>>temp;
		l.push_back(temp);
	}
	a=new int32_t*[n];
	b=new int32_t*[n];
	for(int32_t i1=0;i1<n;i1++){
		a[i1]=new int32_t[n+1];
		b[i1]=new int32_t[n+1];
	}
	for(int32_t i1=0;i1<n;i1++){
		a[n-1][i1]=labs(l[i1]-l[n-1]);
		b[n-1][i1]=labs(l[i1]-l[n-1]);

	}
	a[n-1][n]=labs(W-l[n-1]);
	b[n-1][n]=labs(Z-l[n-1]);
	for(int32_t i1=n-2;i1>=0;i1--){
		for(int32_t i2=0;i2<=n;i2++){
			a[i1][i2]=max(a[i1+1][i2],b[i1+1][i1]);
			b[i1][i2]=min(b[i1+1][i2],a[i1+1][i1]);
		}
	}
	cout<<a[0][n]<<endl;

}

Measured memory_bytes: 31616
import java.util.*;

class Main{

    void solve(){
        Scanner sc = new Scanner(System.in);

        double d = sc.nextDouble();
        while(d!=-1.0){
            d *= 16.0;
            int d2 = (int)d;
            if(d>d2){
                System.out.println("NA");
                d = sc.nextDouble();
                continue;
            }

            String ans = "";
            while(d2>0){
                if(d2%2==1) ans = "1" + ans;
                else ans = "0" + ans;
                d2 /= 2;
            }


            String ans1 = ans.substring(0, ans.length()-4);
            String ans2 = ans.substring(ans.length()-4, ans.length());
            while(ans1.length()<8) ans1 = "0" + ans1;
            while(ans2.length()<4) ans2 += "0";
            ans = ans1 + "." + ans2;
            if(ans.length()>13){
                System.out.println("NA");
                d = sc.nextDouble();
                continue;
            }
            System.out.println(ans);
            d = sc.nextDouble();
        }
    }

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

Measured memory_bytes: 27952
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
using namespace std;

typedef long long ll;
ll MOD = 1e9+7;

int n;
int x[100];
int y[100];
ll h[100];

bool fff(int cx,int cy,ll ch)
{
	for(int i=0;i<n;i++)
	{
		ll ih=max(ch-abs(cx-x[i])-abs(cy-y[i]),0LL);
		if(ih!=h[i])
			return false;
	}
	return true;
}

int main()
{
	int ans=0;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>x[i]>>y[i]>>h[i];
	
	//最大高さを調べる
	ll mh=0;
	for(int i=0;i<n;i++)
		mh=max(mh,h[i]);

	//それぞれの座標ごとにmh+200まで調べる
	for(int i=0;i<101;i++)
	{
		for(int j=0;j<101;j++)
		{
			for(ll k=0;k<201;k++)
			{
				if(fff(i,j,k+mh))
				{
					cout<<i<<" "<<j<<" "<<k+mh<<endl;
					return 0;
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2e5+5;
const ll MOD=1e9+7;
ll n,dp[N],a[N];
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n;
    for(ll i=1;i<=n;i++)cin>>a[i];
    dp[0]=1;
    for(ll i=1;i<=n;i++)if(dp[a[i]-1])dp[a[i]]=1;
    for(ll i=N-1;i>0;i--)if(dp[i])return cout<<n-i , 0;
    cout<<-1;
}


Measured memory_bytes: 3328
<?php
fscanf(STDIN, "%d%d", $n, $m);

$list = explode(" ", trim(fgets(STDIN)));

$all = array_sum($list);

$limit = $all/(4*$m);

$count = 0;
foreach($list as $value){
    if($value >= $limit){
        $count++;
    }
}
if($count >= $m){
    echo "Yes";
}else{
    echo "No";
}

Measured memory_bytes: 4604
N=int(input())
ans='Yes'
odd=0
four=0
for x in map(int,input().split()):
    if x%2==1:
        odd+=1
    elif x%4==0:
        four+=1
if four+1<odd:
    ans='No'
elif four+1==odd and odd+four<N:
    ans='No'
print(ans)

Measured memory_bytes: 11480
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#include <complex>
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
using namespace std;
typedef long long ll;

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    if(a>b){
        cout << 0 << endl;
        return 0;
    }
    else{
        cout << max(0ll,(n-2)*(b-a)+1) << endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <math.h>
#include <stack>
#include <tuple>
#include <cstring>
#include <chrono>
#include <bitset>
#include <list>
#include <stdlib.h>
#include <iomanip>
#include <bitset>
#include <chrono>
 
using namespace std;
 
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
 
bool comparator(const pair<ll, ll> &x, const pair<ll, ll> &y)
{
    return x.second - x.first < y.second - y.first;
}
 
ll gcd(ll x, ll y)
{
    return y == 0LL ? x : gcd(y, x % y);
}
 
struct interval {
    int len;
    ll value;
};

 
int main()
{
    std::ios::sync_with_stdio(false);
 
    int h, w;
    cin >> h >> w;
    
    set<int> roads;
    
    vector<string> d(h);
    forn (i, h) {
        cin >> d[i];
        forn (j, w) {
            if (d[i][j] == '.') {
                roads.insert(i * w + j);
            }
        }
    }
    
    vector< vector<int> > adj(roads.size(), vector<int>());
    for (set<int>::iterator it = roads.begin(); it != roads.end(); it++) {
        int road = *it;
        
        if (((road + 1) % w) != 0) {
            set<int>::iterator jt = roads.find(road + 1);
            if (jt != roads.end()) {
                int d1 = distance(roads.begin(), it);
                int d2 = distance(roads.begin(), jt);
                adj[d1].push_back(d2);
                adj[d2].push_back(d1);
            }
        }
        
        if (road + w < h * w) {
            set<int>::iterator jt = roads.find(road + w);
            if (jt != roads.end()) {
                int d1 = distance(roads.begin(), it);
                int d2 = distance(roads.begin(), jt);
                adj[d1].push_back(d2);
                adj[d2].push_back(d1);
            }
        }
    }
    
    int sol = -1;
    
    for (int i = 0; i < adj.size(); i++) {
        int inf = 1000;
        vector<int> distance(adj.size(), inf);
        vector<char> color(adj.size(), 'w');
        distance[i] = 0;
        color[i] = 'g';
        
        queue<int> q;
        q.push(i);
        
        while (!q.empty()) {
            int v = q.front();
            q.pop();
            forn (j, adj[v].size()) {
                int nv = adj[v][j];
                if (color[nv] == 'w') {
                    color[nv] = 'g';
                    distance[nv] = distance[v] + 1;
                    q.push(nv);
                }
            }
            color[v] = 'b';
        }
        
        forn (j, distance.size()) {
            sol = max(sol, distance[j]);
        }
        
    }
    
    cout << sol << endl;
    
    return 0;
}


Measured memory_bytes: 256
S=input()
T=input()

if T in S:
  print(0)
  exit()

def f(s1,s2):
  r=0
  for i,j in zip(s1,s2):
    if i != j: r += 1
  return r

a=len(S)
for i in range(len(S)-len(T)+1):
  r = f(S[i:i+len(T)],T)
  if a > r: a = r

print(a)

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

int main(){

  int a[3][3];
  bool ch[3][3];
  int n;
  int b[n];
  
  rep(i,3){
    rep(j,3){
      cin >> a[i][j];
      ch[i][j] = false;
    }
  }
  cin >> n;
  
  rep(i,n)cin >> b[i];
  
  rep(i,3){
    rep(j,3){
      rep(k,n){
        if(a[i][j] == b[k]){
          ch[i][j] = true;
        }
      }
    }
  }
  
  rep(i,3){
    if(ch[i][0]&ch[i][1]&ch[i][2]){
      cout << "Yes" << endl;
      return 0;
    }
    
    if(ch[0][i]&ch[1][i]&ch[2][i]){
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  if(ch[0][0]&ch[1][1]&ch[2][2]){
      cout << "Yes" << endl;
      return 0;
    }
  
  if(ch[0][2]&ch[1][1]&ch[2][0]){
      cout << "Yes" << endl;
      return 0;
    }
  
  cout << "No" << endl;
  
    return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)

char field[9];

bool ok(char c){
	bool res = false;
	bool f;
	rep(i, 3){
		f = true;
		rep(j, 3) if(field[i*3+j]!=c) f = false;
		if(f) res = true;
	}
	rep(i, 3){
		f = true;
		rep(j, 3) if(field[i+j*3]!=c) f = false;
		if(f) res = true;
	}
	if(field[0] == c && field[4] == c && field[8] == c) res = true;
	if(field[2] == c && field[4] == c && field[6] == c) res = true;
	return res;

}

int main(){
	while(cin >> field[0] && field[0] != '0'){
		rep2(i, 1, 9) cin >> field[i];
		bool b = ok('b');
		bool w = ok('w');
		if(b) cout << 'b' << endl;
		else if(w) cout << 'w' << endl;
		else cout << "NA" << endl;
	}
	return 0;
}

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

using namespace std;

/*

        Bismillahir Rahmanir Rahim
        Problem :
        Problem Link :
        Topics :
        Solver : Masud Parves
        I Love Code More than Sharks Love Blood <3
*/


#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define SZ(a)           (int)a.size()
#define all(a)  a.begin(), a.end()
#define allr(a)  a.rbegin(), a.rend()


#define sf(a)           scanf("%d",&a)
#define sff(a,b)        scanf("%d %d",&a,&b)
#define sfff(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)

#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define TEST_CASE(t) for(int zz=1 ; zz<=t ; zz++)
#define PRINT_CASE printf("Case %d: ",zz)
#define Debug(x)            cout<<#x " = "<<(x)<<endl
#define NOT_VISITED 0
#define IS_VISITED 1
#define WHITE 0
#define GRAY 1
#define BLACK 2



int fx[4]= {1,-1,0,0};
int fy[4]= {0,0,1,-1};

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N  (1<<pos);}
//int Reset(int N,int pos){return N= N & ~(1<<pos);}
//bool Check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/


const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = (int)2e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<int, ll> pill;


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

    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
def main():
    # input
    MAX = 1000000007
    n = int(input())
    a = list(map(int, input().split()))

    li = [0 for _ in range(100002)]
    li[-1] = 3

    ans = 1
    cap = [0, 0, 0]
    for i in a:
        ans *= li[i-1]-li[i]
        ans = ans%MAX
        li[i] += 1
    print(ans)


    # calc


if __name__ == '__main__':
    main()


Measured memory_bytes: 14020
#[allow(unused_imports)]
use std::cmp::*;

#[allow(unused_imports)]
use std::collections::*;

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_line<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}


#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read_line::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn check(s: String) -> bool {
    if s.contains("AGC") {
        return false;
    }
    for i in 0..s.len()-1 {
        let mut c: Vec<char> = s.chars().collect();
        let c0 = c[i];
        let c1 = c[i+1];
        c[i] = c1;
        c[i+1] = c0;
        let tmp_s = c.iter().fold("".to_string(), |acc, x| format!("{}{}", acc, x));
        if tmp_s.contains("AGC") {
            return false;
        }
    }
    true
}

fn dfs(d: i32, N: i32, last_s: String, hm: &mut HashMap<(i32, String), i32>) -> i32 {
    if d == N {
        return 1
    }
    if hm.contains_key(&(d, last_s.clone())) {
        return hm.get(&(d, last_s.clone())).unwrap().clone();
    }
    let mut tmp_cnt = 0;
    let chars = ["A".to_string(), "G".to_string(), "C".to_string(), "T".to_string()];
    for c in chars.iter() {
        let s: String = format!("{}{}", last_s.clone(), c.clone());
        if check(s) {
            let mut next_s = last_s.clone();
            next_s.remove(0);
            let next_s: String = format!("{}{}", next_s, c.clone());
            tmp_cnt = (tmp_cnt + dfs(d+1, N, next_s, hm)) % 1000000007;
        }
    }
    hm.insert((d, last_s), tmp_cnt);
    tmp_cnt
}

#[allow(non_snake_case)]
fn main() {
    let N: u32 = read();

    println!("{}", dfs(0i32, N as i32, "TTT".to_string(), &mut HashMap::new()));
}


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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  int n;
  cin >> n;
  deque<int> A;
  map<int,int> num_cnt;
  rep(i,n){
    int input;
    cin >> input;
    A.push_back(input);
    num_cnt[input]++;
  }
  int over_num = 0;

  for(auto x: num_cnt){
    if(x.second > 1){
      over_num += x.second-1;

    }
  }

  cout << n - 2*((over_num+1) / 2) << endl;
  return 0;
}


Measured memory_bytes: 5376
using System;

    class Program
    {
        static void Main(string[] args)
        {
            int h, w;

            while (true)
            {
                string[] num = Console.ReadLine().Split(' ');
                h = int.Parse(num[0]);
                w = int.Parse(num[1]);

                if (h == 0 && w == 0)
                {
                    break;
                }

                for (int i = 1; i <= h; i++)
                {
                    for (int j = 1; j <= w; j++)
                    {
                        if (j == 1 || i == 1 || j == w || i == h)
                        {
                            Console.Write("#");
                        }
                        else
                        {
                            Console.Write(".");
                        }
                    }
                    Console.WriteLine("");
                }
                Console.WriteLine("");
            }
        }
    }



Measured memory_bytes: 8836
#include <stdio.h>

int main(){
  long int x,y;
  scanf("%ld %ld",&x,&y);
  int answer = 1;
  long int a = x;
  while(1){
    a *= 2;
    if(a > y) break;
    answer++;
  }
  printf("%d\n",answer);
  return 0;
}

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

int main()
{
    string n;
    cin >> n;
   if(n[0]==n[1]&&n[1]==n[2]||n[1]==n[2]&&n[2]==n[3]){
       cout << "Yes" << endl;
   }else{
       cout << "No" << endl;
   }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
int x;
int r[100005];
int y[100005];
int ans;
using namespace std;
int main() {
	cin>>x;
	for(int i=1;i<=x;i++) scanf("%d",&r[i]);
	for(int i=x-1;i>0;i--) 
		if(r[i]>=r[i+1]) y[i]=y[i+1]+1;
		else y[i]=0;
	for(int i=1;i<=x;i++) ans=max(ans,y[i]);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
H, W = map(int, input().split())

if H == 1 or W == 1:
    print(1)
elif W % 2 == 0:
    print(H * W // 2)
else:
    if H % 2 == 0:
        print(H * W // 2)
    else:
        print((W + 1) // 2 + (H - 1) * W // 2)


Measured memory_bytes: 2940
import math
N = int(input())

li = [0 for i in range(N)]

for x in range(1, 100):
    for y in range(x, 100):
        for z in range(y, 100):
            ans = x**2+y**2+z**2+x*y+y*z+x*z
            if ans <= N:
                if x < y < z:
                    li[ans-1] += 6
                elif x == y == z:
                    li[ans-1] += 1
                else:
                    li[ans-1] += 3
for l in li:
    print(l)


Measured memory_bytes: 9420
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#つまりlist[i] < x となる i の個数
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#つまりlist[i] <= x となる i の個数
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと！

n = I()
ans = 0
for i in range(1,10**6+5):
    q = n//i
    r = n%i
    if r == 0:
        ans += q-1
    else:
        ans += q
print(ans)
        


Measured memory_bytes: 10048
#include<bits/stdc++.h>
using namespace std;
int dp[81][81][6400 * 2 + 1];
// because max distance that we can travel is to first go form start, go to last column in first row and then in last column, go till last
// row till we reach our destination, all other path distance will be less as they kind of form diagnal path.
int find_it(int dif_sum , int i , int j , int &n , int &m , vector<vector<pair<int , int>>> & matrix){
    if(i == n - 1 && j == m - 1){
        return min(abs(dif_sum + matrix[i][j].first - matrix[i][j].second) , abs(dif_sum + matrix[i][j].second - matrix[i][j].first));
    }
    if(dp[i][j][dif_sum] != -1){
        return dp[i][j][dif_sum];
    }
    int minvalue = INT_MAX;
    int ff = abs(dif_sum + matrix[i][j].first - matrix[i][j].second);
    int ss = abs(dif_sum + matrix[i][j].second - matrix[i][j].first);
    // abs because suppose till i & j , we have got k sum and -k sum possible, what is the meaning of keeping of both k and -k as from now on 
    // they both are going to have same all possible path till n - 1 & m - 1, so so reduce time , we can just use one value that is k
    // and as problem mentions we only care about dif , so it means absolute
    if(i + 1 < n){
        minvalue = min(minvalue , find_it(ff , i + 1 , j , n , m , matrix));
        minvalue = min(minvalue , find_it(ss , i + 1 , j , n , m , matrix));

    }
    if(j + 1 < m){
        minvalue = min(minvalue , find_it(ff , i , j + 1 , n , m , matrix));
        minvalue = min(minvalue , find_it(ss , i , j + 1 , n , m , matrix));
    }
    return dp[i][j][dif_sum] = minvalue;

}
int main(){

    int n , m;
    cin >> n >> m;
    vector<vector<pair<int , int> > > matrix(n , vector<pair<int , int>> (m));

    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> matrix[i][j].first;
        }
    }
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> matrix[i][j].second;
        }
    }
    memset(dp , -1 , sizeof(dp));
    cout << find_it(0 , 0 , 0 , n , m , matrix);


return 0;
}


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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vli;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define I cin
#define O cout
#define EN endl
#define ln cout<<endl
#define pb(a) push_back(a)
#define x first
#define y second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
  return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
  return a / gcd(a, b) * b;
}

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

llint kj(llint a)
{
  llint rec = 1;
  for(int i = 1; i <= a; i++) rec = rec * i % MOD;

  return rec;
}

int main()
{
  llint n, m;
  I >> n >> m;

  if(abs(n - m) > 1) {
    O << 0 << EN;
  } else {
    llint a = kj(n) * kj(m) % MOD;
    
    if(n == m) O << a * 2 % MOD << EN;
    else       O << a << EN;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

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

  ll n;
  cin >> n;
  vector<ll> a(n);
  ll total = 0;
  repr(i, n, 0) {
    cin >> a[i];
    total ^= a[i];
  }

  for (int i = 0; i < n; ++i) {
    cout << (total xor a[i]) << " ";
  }
}

Measured memory_bytes: 4780