akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int main(void){
	int A, B;
	cin >> A >> B;
	if((A%3==0)||(B%3==0)||((A+B)%3==0)){
		cout << "Possible" << endl;
	}else{
		cout << "Impossible" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int m[101];

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    FOR(i,0,n) {
        int d;
        cin >> d;
        m[d] = 1;
    }
    int ans = 0;
    FOR(i,0,101)
        if (m[i] == 1)
            ans ++;
    cout << ans << endl;
}



Measured memory_bytes: 256
// program hi;
// type
//     ref = (AC, WA, TLE, RE);

// var 
//     n, i: longint;
//     s: ref;
//     a: array[ref] of longint = (0, 0, 0, 0);

// begin
//     readln(n);
//     for i := 1 to n do begin
//         readln(s);
//         inc(a[s]);
//     end;
//     for s := AC to RE do 
//         writeln(s, ' x ', a[s])
// end.
program sad;
const
    ref: array[1..4] of string = ('AC', 'WA', 'TLE', 'RE');

var 
    n, i, j: longint;
    s: string;
    a: array[1..4] of longint = (0, 0, 0, 0);

begin
    readln(n);
    for i := 1 to n do begin
        readln(s);
        for j := 1 to 4 do
            if (s = ref[j]) then
                inc(a[j]) 
    end;
    for i := 1 to 4 do 
        writeln(ref[i], ' x ', a[i]);
end.

Measured memory_bytes: 1380
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a=n/1000;
	int b=(n-a*1000)/100;
	int c=(n-a*1000-b*100)/10;
	int d=n-a*1000-b*100-c*10;
	//cout<<a<<endl<<b<<endl<<c<<endl<<d;
	if(a+b+c+d==7){
		cout<<a<<"+"<<b<<"+"<<c<<"+"<<d;
	}
	else if(a+b+c-d==7){
		cout<<a<<"+"<<b<<"+"<<c<<"-"<<d;
	}
	else if(a+b-c+d==7){
		cout<<a<<"+"<<b<<"-"<<c<<"+"<<d;
	}
	else if(a+b-c-d==7){
		cout<<a<<"+"<<b<<"-"<<c<<"-"<<d;
	}
	else if(a-b+c+d==7){
		cout<<a<<"-"<<b<<"+"<<c<<"+"<<d;
	}
	else if(a-b+c-d==7){
		cout<<a<<"-"<<b<<"+"<<c<<"-"<<d;
	}
	else if(a-b-c+d==7){
		cout<<a<<"-"<<b<<"-"<<c<<"+"<<d;
	}
	else if(a-b-c-d==7){
		cout<<a<<"-"<<b<<"-"<<"-"<<d;
	}
	cout<<"="<<7<<endl;
	return 0;
}

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

#define ll long long

int main(){
   ll n , a , b; 
   cin >> n >> a >> b; 

   ll max = a + (n-1)*b;
   ll min = b + (n-1)*a;
   ll ans = max - min + 1;

   if(ans < 0){
     ans = 0;
   }

    cout << ans << endl;
}

Measured memory_bytes: 760
#include <iostream>
#include <cmath>

using namespace std;

int main() {
  
  long long int n;

  while (cin >> n && n) {

    int rt_n = sqrt(n);
    long long int ans = 1e12 + 10;

    for (int i = 1; i <= rt_n; i++) {
      if (n % i != 0) continue;
      long long int tmp = i + n/i - 2;
      if (ans > tmp) ans = tmp;
    }
    cout << ans << endl;
  }
}
      


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int a,b,c;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    if(a == b && b == c && c == a){
        printf("1");
    }
    else if(a!= b && b != c && c != a){
        printf("3");
    }
    else{
        printf("2");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int N=510;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1},n,wt[N][N],dis[N][N],ans;
int main() {
	cin>>n;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			wt[i][j]=1;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			dis[i][j]=min(i,min(n-1-i,min(j,n-1-j)));
	for(int i=0;i<n*n;i++){
		int x;
		cin>>x;
		x-=1;
		int u=x/n,v=x%n;
		ans+=dis[u][v];
		wt[u][v]=0;
		queue<pair<int,int>>q;
		q.push(make_pair(u,v));
		while(!q.empty()){
			int u=q.front().first,v=q.front().second;
			q.pop();
			for(int k=0;k<4;k++){
				int px=u+dx[k],py=v+dy[k];
				if(px>=0&&px<n&&py>=0&&py<n&&dis[px][py]>dis[u][v]+wt[u][v]){
					dis[px][py]=dis[u][v]+wt[u][v];
					q.push(make_pair(px,py));
				}
			}
		}
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

int main()
{
    int N;
    long long sum = 0;
    vector<long long> vec;
    cin >> N;
    for (int i = 0; i <= N; i++) {
        if (i == 0)
            vec.push_back(2);
        else if (i == 1)
            vec.push_back(1);
        else {
            sum = vec.at(i - 1) + vec.at(i - 2);
            vec.push_back(sum);
        }
    }
    cout << vec.at(N) << endl;
}


Measured memory_bytes: 256
n = gets.to_i
w = Array.new
1.step(n,1){ |i|
  w[i-1] = gets.chop
}

if w.uniq == w then
  r = true
else
  r = false
end

tmp = w[0]
ok = true
w.shift
w.each{ |i|
  unless tmp[-1] == i[0] then
    ok = false
    break
  end
  tmp = i
}

if r && ok then
  puts "Yes"
else
  puts "No"
end


Measured memory_bytes: 3836
n = int(input())
l = [int(i) for i in input().split()] 
count = 0
for i in range(1,len(l)-1):
  if (l[i-1] < l[i] and l[i] < l[i+1]) or (l[i-1] > l[i] and l[i] > l[i+1]):
    count = count + 1
print(count)

Measured memory_bytes: 3064
from itertools import product

a=int(input())

multi_5 = [0]
tmp = 0
c = 0

while 1:
    c += 1
    tmp = c**5

    if tmp - multi_5[-1] > 10**9:
        break

    multi_5.append(tmp)

# print(c)

minus_multi_5 = []

for i in multi_5:
    minus_multi_5.append(i*(-1))

# print(minus_multi_5)

multi_5.extend(minus_multi_5)

# print(len(multi_5))

for j,k in product(multi_5, multi_5):
    if j-k == a:
        if j >= 0:
            ansa = int(j**(1/5))
        else:
            ansa = int((j*(-1))**(1/5)) * (-1)

        if k >= 0:
            ansb = int(k**(1/5))
        else:
            ansb = int((k*(-1))**(1/5)) * (-1)

        
        print(ansa,ansb)
        break

Measured memory_bytes: 9396
#include <iostream>
using namespace std;
int main()
{
	int A,B,C;
	cin>>A>>B>>C;
	if(A==5&&B==5&&C==7){
		cout<<"YES"<<endl;
	}else if(A==5&&B==7&&C==5){
		cout<<"YES"<<endl;
	}else if(A==7&&B==5&&C==5){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;

int stTable0[N][20], stTable1[N][20];
int preLog2[N];

void st_prepare(int n, int *array){
	preLog2[1] = 0;
	for (int i = 2; i <= n; i++){
		preLog2[i] = preLog2[i - 1];
		if ((1 << preLog2[i] + 1) == i){
			++preLog2[i];
		}
	}
	for (int i = n; i >= 1; --i){
		stTable0[i][0] = stTable1[i][0] = array[i];
		for (int j = 1; (i + (1 << j) - 1) <= n; ++j){
			stTable0[i][j] = min(stTable0[i][j - 1], stTable0[i + (1 << j - 1)][j - 1]);
			stTable1[i][j] = max(stTable1[i][j - 1], stTable1[i + (1 << j - 1)][j - 1]);
		}
	}
}
int query_min(int l, int r){
	int len = r - l + 1, k = preLog2[len];
	return min(stTable0[l][k], stTable0[r - (1 << k) + 1][k]);
}
int query_max(int l, int r){
	int len = r - l + 1, k = preLog2[len];
	return max(stTable1[l][k], stTable1[r - (1 << k) + 1][k]);
}
int a[N];
int main(){
	int n, k;
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	st_prepare(n, a);	
	int l = 1, r = k;
	for (int i = 1; i <= k; i++){
		if (a[i] == query_min(i, k)) l = i + 1;
		else break;
	}
	for (int i = k; i >= 1; i--){
		if (a[i] == query_max(1, i)) r = i - 1;
		else break;
	}
	vector<pair<int, int > > ans;
	bool flag = false;
	if (l > r) flag = true;
	else ans.push_back({l, r}); 
	//printf("%d %d\n", l, r);
	for (int i = k + 1; i <= n; i++){
		while (l > i - k + 1 && a[i] < a[l - 1]) l --;
		l = max(l, i - k + 1);
		while (l <= i && a[l] == query_min(l, i)) l++;
		if (r == i){
			while (r >= i - k + 1 && a[r] == query_max(i - k + 1, r)) r--;
		} else {
			if (a[i] != query_max(i - k + 1, i)) r = i;
		}
		
		//printf("%d %d\n", l, r);
		if (l > r) flag = true;
		else ans.push_back({l, r}); 
	}
	int sum = flag;
	int len = ans.size();
	for (int i = 0; i < len; i++){
		if (i == 0 || ans[i] != ans[i - 1]) sum ++;
	}
	printf("%d", sum);
	return 0;
}

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

typedef long long lint;

const int MAX_N = 3e5+2;

struct Ant {
	int id;
	lint pos, speed;

	Ant(){};
	Ant(int id, lint pos, lint speed) {
		this->id = id;
		this->pos = pos;
		this->speed = speed;
	}
};

bool comparePosition(Ant a, Ant b) {
	return (a.pos < b.pos);
}

lint mod(lint x, lint m) {
	return ((x % m) + m) % m;
}

int ans[MAX_N];
std::vector< Ant > startPosition, endPosition;

int main() {
	int n;
	lint cycleLength, time;

	std::cin >> n >> cycleLength >> time;
	for(int i = 1; i <= n; i++) {
		int pos, dir;
		std::cin >> pos >> dir;
		pos++;
		startPosition.push_back( Ant(i, pos, (dir == 1) ? 1 : -1) );
	}

	std::sort(startPosition.begin(), startPosition.end(), comparePosition);
	for(int i = 0; i < (int)startPosition.size(); i++) endPosition.push_back(startPosition[i]);

	lint cyclicShift = 0;
	for(int i = 0; i < n; i++) cyclicShift += startPosition[i].speed;
	cyclicShift = mod(cyclicShift * (time / cycleLength), n);

	time %= cycleLength;
	for(int i = 0; i < n; i++) {
		endPosition[i].pos = mod((startPosition[i].pos-1) + time * startPosition[i].speed, cycleLength) + 1;
		if(startPosition[i].speed == 1) {
			if(endPosition[i].pos < startPosition[i].pos) cyclicShift++;
		}
		else {
			if(endPosition[i].pos > startPosition[i].pos) cyclicShift--;
		}
	}
	cyclicShift = mod(cyclicShift, n);

	std::sort(endPosition.begin(), endPosition.end(), comparePosition);
	for(int i = 0; i < n; i++) {
		endPosition[i].id = startPosition[mod(i-cyclicShift, n)].id;
		ans[endPosition[i].id] = endPosition[i].pos;
	}

	for(int i = 1; i <= n; i++) printf("%d ",ans[i]-1);
	printf("\n");

	return 0;
}

Measured memory_bytes: 8560
//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

#define MAXN 100000

int n, k;

int input() {
	if (scanf("%d %d", &n, &k) < 0) return 0;
	return 1;
}

void init() {
}

long solve() {
	return (n+1)/2 >= k;
}

void output(long ans) {
	printf("%s\n", ans? "YES":"NO");
}

void cleanup() {
}

int main() {
	while (input()) {
		init();
		output(solve());
		cleanup();
		//break;
	}
}





Measured memory_bytes: 128
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

typedef struct
{
  int n;
  double t;
} Runner;

class LessTime
{
public:
  bool operator() (const Runner& lhs, const Runner& rhs) const
  {
    return lhs.t < rhs.t;
  }
};

int main()
{
  vector<vector<Runner> > p(3, vector<Runner>(8));
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 8; ++j)
      scanf("%d %lf", &p[i][j].n, &p[i][j].t);
    sort(p[i].begin(), p[i].end(), LessTime());

    for (int j = 0; j < 2; ++j) {
      printf("%d %.2lf\n", p[i][0].n, p[i][0].t);
      p[i].erase(p[i].begin());
    }
  }

  vector<Runner> pp;
  for (int i = 0; i < 3; ++i)
    copy(p[i].begin(), p[i].end(), back_inserter(pp));
  sort(pp.begin(), pp.end(), LessTime());

  for (int i = 0; i < 2; ++i) {
    printf("%d %.2lf\n", pp[0].n, pp[0].t);
    pp.erase(pp.begin());
  }
  return 0;
}

Measured memory_bytes: 0
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,k=mp()
p=sorted(lmp())
print(sum(p[:k]))

Measured memory_bytes: 10564
function Main(input) {
  var input = input.split("\n");
  var x = parseInt(input[0]);
  var a = parseInt(input[1]);
  var b = parseInt(input[2]);
  var c = x - a;
  var d = Math.floor(c / b);
  var e = b * d;
  var result = c - e;
  console.log(result);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
from collections import deque
n, m = map(int, input().split())
route = [[] for i in range(n)]

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

next_queue = deque()
sign = [-1] * n
sign[0] = 999

next_queue.append(0)

while next_queue:
    current_number = next_queue.popleft()
    for room in route[current_number]:
        if sign[room] == -1:
            sign[room] = current_number
            next_queue.append(room)
print("Yes")
for i in range(1, n):
    print(sign[i] + 1)



Measured memory_bytes: 94664
#include<iostream>
using namespace std;
int n,ans,tmp;
int t[100];
int main(){
  while(cin>>n&&n){
    for(int i=0;i<n;i++)cin>>t[i];
    ans=0;
    for(int i=n-1;i>0;i--){
      for(int j=0;j<i;j++){
	if(t[j]>t[j+1]){
	  tmp=t[j];t[j]=t[j+1];t[j+1]=tmp;
	  ans++;
	}
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

int main(){
  map<string, string> mp;
  mp["1 0 0"] = "Close";
  mp["0 1 0"] = "Close";
  mp["1 1 0"] = "Open";
  mp["0 0 1"] = "Open";
  mp["0 0 0"] = "Close";
  string s;
  getline(cin, s);
  cout << mp[s] << endl;
  return 0;
}

Measured memory_bytes: 1180
#include<cstdio>

#define MAXN 1000
int N,cnt;
int X[MAXN+5],Y[MAXN+5],d[35];

int abs(int x){
    return x>0?x:-x;
}

void Print(int x,int y){
    for(int i=1;i<=cnt;i++){
        if(abs(x)>abs(y)){
            if(x>0) putchar('R'),x-=d[i];
            else putchar('L'),x+=d[i];
        }
        else{
            if(y>0) putchar('U'),y-=d[i];
            else putchar('D'),y+=d[i];
        }
    }
}

int main(){
    scanf("%d",&N);
    bool p[2]={0};
    for(int i=1;i<=N;i++){
        scanf("%d%d",X+i,Y+i);
        p[(abs(X[i])+abs(Y[i]))&1]=1;
    }
    if(p[0]&&p[1])
        return puts("-1"),0;
    for(int i=30;i>=0;i--)
        d[++cnt]=1<<i;
    if(p[0])
        d[++cnt]=1;
    printf("%d\n%d",cnt,d[1]);
    for(int i=2;i<=cnt;i++)
        printf(" %d",d[i]);
    for(int i=1;i<=N;i++)
        puts(""),Print(X[i],Y[i]);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    vector<vector<int>> ke(10, vector<int>(10, 0));
    for(int i = 1; i <= n; i++) {
        string tmp = to_string(i);
        int s = tmp[0] - '0';
        int t = tmp.back() - '0';
        ke[s][t]++;
    }
    for(int i = 1; i < 10; i++) {
        for(int j = 1; j < 10; j++) {
            ans += ke[i][j] * ke[j][i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	N := nextInt()

	for h := 1; h <= 3500; h++ {
		for n := h; n <= 3500; n++ {
			if x := 4*h*n - N*(h+n); x > 0 && (N*h*n)%x == 0 {
				puts(h, n, (N*h*n)/x)
				return
			}
		}
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> h(n);
    for(ll i = 0; i < n;i++){
        cin >> h[i];
    }
    ll l = 0,r = 0;
    ll max = 0;
    ll c = 0;
    for(int i = 0; i < n-1;i++){
        if(h[i] < h[i+1]){
            if(max < c) max = c;
            c=0;
        }else{
            c++;
        }
    }
    if(max < c) max = c;
   
    cout << max << endl;

    

    return 0;
}

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

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


Measured memory_bytes: 256
#define ll long long
#define dd long double
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mp make_pair
#define mt make_tuple
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
//#include<bits/stdc++.h>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<utility>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<bitset>
dd pi = acos(-1) ;
ll z =  1000000007 ;
ll inf = 100000000000000000 ;
ll p1 = 37 ;
ll p2 = 53 ;
ll mod1 =  202976689 ;
ll mod2 =  203034253 ;
ll fact[100] ;
ll gdp(ll a , ll b){return (a - (a%b)) ;}
ll ld(ll a , ll b){if(a < 0) return -1*gdp(abs(a) , b) ; if(a%b == 0) return a ; return (a + (b - a%b)) ;} // least number >=a divisible by b
ll gd(ll a , ll b){if(a < 0) return(-1 * ld(abs(a) , b)) ;    return (a - (a%b)) ;} // greatest number <= a divisible by b
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
ll e_gcd(ll a , ll b , ll &x , ll &y){ if(b > a) return e_gcd(b , a , y , x) ; if(b == 0){x = 1 ; y = 0 ; return a ;}
ll x1 , y1 ; e_gcd(b , a%b , x1 , y1) ; x = y1 ; y = (x1 - ((a/b) * y1)) ; return e_gcd(b , a%b , x1 , y1) ;}
ll power(ll a ,ll b , ll p){if(b == 0) return 1 ; ll c = power(a , b/2 , p) ; if(b%2 == 0) return ((c*c)%p) ; else return ((((c*c)%p)*a)%p) ;}
ll inverse(ll a ,ll n){return power(a , n-2 , n) ;}
ll max(ll a , ll b){if(a > b) return a ; return b ;}
ll min(ll a , ll b){if(a < b) return a ; return b ;}
ll left(ll i){return ((2*i)+1) ;}
ll right(ll i){return ((2*i) + 2) ;}
ll ncr(ll n , ll r){if(n < r|| (n < 0) || (r < 0)) return 0 ; return ((((fact[n] * inverse(fact[r] , z)) % z) * inverse(fact[n-r] , z)) % z);}
void swap(ll&a , ll&b){ll c = a ; a = b ; b = c ; return ;}
//ios_base::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);
using namespace std ;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
//__builtin_popcount(n) -> returns number of set bits in n
// ll seed;
//mt19937 rnd(seed=chrono::steady_clock::now().time_since_epoch().count()); // include bits


void solve()
{
    ll a , b , c , k ;
    cin >> a >> b >> c >> k ;
    while(b <= a)
    {
        b *= 2 ;
        k-- ;
    }
    while(c <= b)
    {
        c *= 2 ;
        k-- ;
    }
    if(k < 0)
    {
        cout << "No\n" ;
    }
    else
    {
        cout << "Yes\n" ;
    }
    return ;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif*/
    
    ll t ;
    //cin >> t ;
    t = 1 ;
   
    while(t--)
    {
        solve() ;
    }
   // cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
 
    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>

int  main()
{
    int a,b,c,d,e=0;

    scanf("%d%d%d",&a,&b,&c);
    d=b-(a-c);

    if(d<=0)
    {
        printf("%d\n",e);
    }
    else
        printf("%d\n",d);

    return  0;
}

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

#define MOD 1000000007
#define rep(i, N) for(int i = 0;i < N;i++)
#define ll long long

using namespace std;

int main(void) {
	int N, K; cin >> N >> K;
	long double p = 0;
	if (N >= K) {
		p = (double)(N - K + 1) / (double)N;
	}

	for (int i = 1; i <= K - 1 && i <= N ; i++) {
		int n = ceil(log2((double)K / (double)i));
		p += (1.0 / (double)N) * (1.0 / (pow(2, n)));
	}

	cout << fixed << setprecision(15) << p << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;

const int MAXN = 300;
const ll INF = 1e18;
ll a[MAXN + 1][MAXN + 1], d[MAXN + 1][MAXN + 1], b[MAXN + 1][MAXN + 1];
bool used[MAXN + 1][MAXN + 1];

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

    int n;
    cin >> n;
    if (n == 1) {
        cout << 0 << endl;
        return 0;
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            cin >> a[i][j];
            b[i][j] = a[i][j];
        }
    }
    ll ans = 0;
    for (int k=1; k<=n; ++k)
        for (int i=1; i<=n; ++i) {
            for (int j = 1; j <= n; ++j) {
                if (k != i && k != j && a[i][k] + a[k][j] == a[i][j]) {
                    a[i][j] = a[j][i] = INF;
                }
            }
        }
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            d[i][j] = a[i][j];
    for (int k=1; k<=n; ++k)
        for (int i=1; i<=n; ++i)
            for (int j=1; j<=n; ++j)
                if (d[i][k] < INF && d[k][j] < INF)
                    d[i][j] = min (d[i][j], d[i][k] + d[k][j]);
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            if (b[i][j] != d[i][j]) {
                cout << "-1\n";
                return 0;
            }
            if (j > i && a[i][j] != INF)
                ans += a[i][j];
        }
    }
    cout << ans << endl;
    return 0;
}

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

int n;
int Bool[100] = {0};
int A[100];
int p[100], q[100];
int vt1, vt2;
int dem = 0;
void xuatvt2()
{
    bool b = 1;
    for (int i = 1; i <= n; i++)
    {
        if (A[i] != q[i])
        {
            b=0;
            return;
        }
    }
    if (b == 1)
    {
        vt2 = dem;
        return;
    }
    return;
}

void xuatvt1()
{
    bool a = 1;
    for (int i = 1; i <= n; i++)
    {
        if (A[i] != p[i])
        {
            a=0;
            return;
        }
    }
    if (a == 1)
    {
        vt1 = dem;
        return;
    }
    return;
}

void thu(int k)
{
    for (int i = 1; i <= n; i++)
    {
        if (!Bool[i])
        {
            A[k] = i;
            Bool[i] = 1;
            if (k == n)
            {
                dem++;
                xuatvt1();
                xuatvt2();
            }
            else
                thu(k + 1);
            Bool[i] = 0;
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> p[i];
    }
    for (int i = 1; i <= n; i++)
    {
        cin >> q[i];
    }
    thu(1);
    cout << abs(vt1 - vt2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lld;
typedef unsigned long long int llu;
#define INF (lld)(9223372036854775807)
#define IINF (int)(2147483647)

using namespace std;

vector<lld> s;
map<lld, vector<lld>> c, d;
lld q = 0;

void se(lld prev, lld n) {
  set<lld> t, r;
  bool m = true;
  t.insert(prev);
  while (m ? t.size() : r.size()) {
    set<lld>& n = m ? r : t;
    set<lld>& x = m ? t : r;
    for (auto f: x) {
      for (auto i: c[f]) {
        if (s[i - 1] == -1) {
          s[i - 1] = f;
          n.insert(i);
          q++;
        }
      }
      for (auto i: d[f]) {
        if (s[i - 1] == -1) {
          s[i - 1] = f;
          n.insert(i);
          q++;
        }
      }
    }
    x.clear();
    m = !m;
  }
}

int main(void) {
  lld n, m, a, b;
  cin >> n >> m;
  for (lld i = 0; i < m; i++) {
    cin >> a >> b;
    c[a].push_back(b);
    d[b].push_back(a);
  }
  s = vector<lld>(n, -1ll);
  s[0] = 0;
  se(1, n);
  if (q != n - 1) {
    cout << "No\n";
    return 0;
  }

  cout << "Yes\n";
  for (lld i = 1; i < n; i++) {
    cout << s[i] << "\n";
  }
}

Measured memory_bytes: 30648
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int a,m,d,n,x[11],y[11],z[11],k;
main(){
	cin>>n>>a>>d>>m;
	r(i,m)cin>>x[i]>>y[i]>>z[i];
	cin>>k;
	for(int i=m-1;i>=0;i--){
		if(x[i]){if(y[i]==k)k=z[i];}
		else{
			if(y[i]==k)k=z[i];
			else if(z[i]==k)k=y[i];
		}
	}
	cout<<(k-1)*d+a<<endl;
}

Measured memory_bytes: 3124
n = int(input())
a_list = list(map(int, input().split()))
first = a_list[0]

l = 0
r = first
while l <= r:
    mid = (r + l) // 2
    m0 = mid * 2

    arr = [0] * (n + 1)
    arr[0] = m0
    for j in range(0, n):
        curr = arr[j]
        nxt = int((a_list[j] - curr / 2) * 2)
        arr[j + 1] = nxt
    
    mn = arr[n]
    if m0 == mn:
        print(*arr[:n])
        break
    elif mn > m0:
        l = mid + 1
    else:
        r = mid - 1

Measured memory_bytes: 75044
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// 標準入力からデータを読み込む準備
Scanner sc = new Scanner(System.in);
// 要素数nを読み込み、配列にn個の整数を読み込む 
int n = sc.nextInt();
int i;
int[] a = new int[n];
for (i = 0; i < a.length; i++) {
a[i] = sc.nextInt(); }
// 以下で配列aの中身を逆順に表示しよう
// 改行なしで表示する時は System.out.print(表示する値) を使おう // 改行だけを表示する時は System.out.println() を使おう
for(i=0; i<a.length; i++){
	System.out.print(a[a.length-1-i]);
	if(i != a.length-1){
		System.out.print(" ");
	}
}
System.out.println();
sc.close();
}
}


Measured memory_bytes: 26280
#include <vector>
#include <iostream>
#include <string>
class Image {
	enum Color : char {
		Black = '#', White = '.'
	};
public:
	Image(int n, std::istream &is);
	bool include_image(const Image &other) const;
private:
	std::vector<std::vector<Color>> color;
	Color at(int x, int y) const;
	int size() const;
	bool search_with_offset(int ox, int oy, const Image &other) const;
	void show() const;
};

Image::Image(int n, std::istream & is) :color(n, std::vector<Color>(n))
{
	for (std::string str; --n >= 0 && std::cin >> str; ) {
		for (auto i = 0; i < str.size(); ++i) {
			if (str[i] == '#') color[n][i] = Black;
			else color[n][i] = White;
		}
	}
}

bool Image::include_image(const Image & other) const
{
	for (auto ox = 0; ox <= size() - other.size(); ++ox) {
		for (auto oy = 0; oy <= size() - other.size(); ++oy) {
			if (search_with_offset(ox, oy, other)) return true;
		}
	}
	return false;
}

Image::Color Image::at(int x, int y) const
{
	return color[x][y];
}

int Image::size() const
{
	return color.size();
}

bool Image::search_with_offset(int ox, int oy, const Image & other) const
{
	for (auto x = 0; x < other.size(); ++x) {
		for (auto y = 0; y < other.size(); ++y) {
			if (at(ox + x, oy + y) != other.at(x, y)) return false;
		}
	}
	return true;
}

void Image::show() const
{
	for (const auto &line : color) {
		for (const auto &cell : line) {

			std::cout << static_cast<char>(cell);
		}
		std::cout << '\n';
	}
}

int main() {
	int n, m;
	std::cin >> n >> m;
	Image a(n, std::cin);
	Image b(m, std::cin);
	if (a.include_image(b)) std::cout << "Yes\n";
	else std::cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
  char s[10001];
  int n,i;
  while(1){
    fgets(s,10000,stdin);
    if(!strcmp(s,"END OF INPUT\n"))break;
    for(i=n=0;s[i]!=10;i++){
      if(s[i]==' '){
	printf("%d",n);
	n=0;
      }
      else n++;
    }
    printf("%d\n",n);
  }
  return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,k;
    cin>>n>>k;
    if(k%2)cout<<(n/k)*(n/k)*(n/k)<<endl;
    else cout<<(n/k)*(n/k)*(n/k)+((n+k/2)/k)*((n+k/2)/k)*((n+k/2)/k)<<endl;
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main(void){
	int n;
	int a[101];
	cin >> n;

	int num = 0;


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

	for (int i = 0; i < n - 1; i++){
		if (a[i] == a[i + 1]){
			num++;
			i++;
		}
	}

	cout << num << endl;
}

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

typedef short sh;
typedef unsigned short ush;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef unordered_set<int> usi;
typedef string str;
#define INF 1000000000
#define mv 1000000007
#define ln '\n'
#define max(a,b) ((a>=b)?a:b)
#define min(a,b) ((a<=b)?a:b)
#define itrip(s1,n) for(int i=s1;i<n;i++)
#define jtrip(s2,m) for(int j=s2;j<m;j++)
#define irip(s1,n) for(int i=s1;i>n;i--)
#define jrip(s2,m) for(int j=s2;j>m;j--)
#define pb push_back

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//cout<<fixed;
	//cout<<setprecision(6);

	sh n,m;
	cin>>n>>m;
	usi s,ts,fs;
	itrip(0,n) {
		int k;
		cin>>k;
		jtrip(0,k) {
			int temp;
			cin>>temp;
			if(!i)
				s.insert(temp);
			else {
				if(s.find(temp)!=s.end())
					ts.insert(temp);
			}
		}
		//cout<<s.size();
		if(i) {
		s.clear();
		usi::iterator it=ts.begin();
		for(;it!=ts.end();it++)
			s.insert(*it);
		//s.clear();
		//s=ts;
		ts.clear();
		}
		//s=fs;
		//fs.clear();
		//cout<<s.size();
	}
	cout<<s.size()<<ln;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

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

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

LL n,u,v;
LL ans = 0;
VVL link(100001);
vector<PLL> leaf1;
vector<PLL> leaf2;

VL visited1(100001, 0);
VL dist1(100001, 0);
void dfs1(LL x, LL d){
    visited1[x] = 1;
    dist1[x] = d;
    bool isLeaf = true;
    REP(i, link[x].size()){
        LL adj = link[x][i];
        if(!visited1[adj]){
            isLeaf = false;
            dfs1(adj, d + 1);
        }
    }
    if(isLeaf){
        leaf1.PB(MP(x, d));
    }
}

VL visited2(100001, 0);
VL dist2(100001, 0);
void dfs2(LL x, LL d){
    visited2[x] = 1;
    dist2[x] = d;
    bool isLeaf = true;
    REP(i, link[x].size()){
        LL adj = link[x][i];
        if(!visited2[adj]){
            isLeaf = false;
            dfs2(adj, d + 1);
        }
    }
    if(isLeaf){
        leaf2.PB(MP(x, d));
    }
}


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

    cin>>n>>u>>v;
    REP(i,n-1){
        LL a,b;
        cin>>a>>b;
        link[a].PB(b);
        link[b].PB(a);
    }

    dfs1(u, 0);
    dfs2(v, 0);

    REP(i, leaf2.size()){
        LL xv = leaf2[i].first;
        LL dv = leaf2[i].second;
        LL du = dist1[xv];
        if(du < dv){
            ans = max(ans, dv);
        }
    }

    PUTS(ans - 1);
}

Measured memory_bytes: 14716
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

H,W = map(int,input().split())
INF = 10**18
q = []

visited = [[True]*(W+2)]
visited += [[True] + [x == '#' for x in input().rstrip()] + [True] for _ in range(H)]
visited.append([True]*(W+2))
for i in range(1,H+1):
  for j in range(1,W+1):
    if visited[i][j]:
      q.append((i,j))

ans = -1
while q:
  qq = []
  ans += 1
  for x,y in q:
    if not visited[x-1][y]:
      visited[x-1][y] = True
      qq.append((x-1,y))
    if not visited[x+1][y]:
      visited[x+1][y] = True
      qq.append((x+1,y))
    if not visited[x][y-1]:
      visited[x][y-1] = True
      qq.append((x,y-1))
    if not visited[x][y+1]:
      visited[x][y+1] = True
      qq.append((x,y+1))
  q = qq
  
print(ans)

Measured memory_bytes: 109984
#include<iostream>
using namespace std;
int main(){
    int r, c;
    cin >> r >> c;
    
    //入力
    int M[r+1][c+1] = {};
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin >> M[i][j];
        }
    }
    
    //計算
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            M[i][c] += M[i][j];
        }
    }
    for(int j=0;j<c;j++){
        for(int i=0;i<r;i++){
            M[r][j] += M[i][j];
        }
    }
    for(int i=0;i<r;i++){
        M[r][c] += M[i][c];
    }
    
    //出力
    for(int i=0;i<r+1;i++){
        for(int j=0;j<c+1;j++){
            cout << M[i][j];
            if(j<c){
                cout << " ";
            }
        }
        cout << endl;
    }
    return 0;
}


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

#define rep(i,N) for(int i=0;i<(int)(N);++i)
#define rrep(i,N) for(int i=(int)(N)-1;i>=0;--i)
#define debug(x) cout<<#x<<"="<<x<<endl;
constexpr ll MOD=1000000007;
constexpr ll INF=1LL<<60;
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> void fail(T v){cout << v << endl;exit(0);}
//template end

void solve(){
    int N,M;
    while((cin>>N>>M,N|M)){
        vector<int> H(N),W(M);
        rep(i,N)cin>>H[i];
        rep(i,M)cin>>W[i];
        vector<int> ach(N+1),acw(M+1);
        rep(i,N)ach[i+1]=ach[i]+H[i];
        rep(i,M)acw[i+1]=acw[i]+W[i];
        vector<int> ct(2020202);
        rep(i,M+1)rep(j,i)ct[acw[i]-acw[j]]++;
        ll res=0;
        rep(i,N+1)rep(j,i)res+=ct[ach[i]-ach[j]];
        cout<<res<<endl;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    solve();
    return 0;
}


Measured memory_bytes: 10932
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#include<bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

int main(){
    ll a, b, k; cin >> a >> b >> k;
    for(int i=a; i <= min(b, a+k-1); i++) out(i);
    for(int i=max(b-k+1, a+k); i<=b; i++) out(i);
}

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

const int MAX = 1e5;
vector<int> to[MAX];
bool visit[MAX][4];
int N, M;
int S, T;

void dfs(queue<int> &que, int tmp, int depth) {
  if (depth == 3) {
    que.push(tmp);
    return;
  }
  for (int next : to[tmp]) {
    if (!visit[next][depth+1]) {
      visit[next][depth+1] = true;
      dfs(que, next, depth + 1);
    }
  }
}

void solve() {
  queue<int> que;
  que.push(S);
  visit[S][0] = true;
  int ans = 0;
  while (++ans) {
    queue<int> buf;
    while (!que.empty()) {
      int u = que.front();
      que.pop();
      dfs(buf, u, 0);
    }
    if (buf.empty()) {
      ans = -1;
      break;
    }
    if (visit[T][3]) break;
    swap(que, buf);
  }
  cout << ans << endl;
}

int main() {
  cin >> N >> M;
  rep(i, M) {
    int u, v;
    cin >> u >> v;
    --u; --v;
    to[u].push_back(v);
  }
  cin >> S >> T;
  --S; --T;
  solve();
  return 0;
}

Measured memory_bytes: 6144
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	nums := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&nums[i])
	}
	sort.Ints(nums)
	ans := 1
	for i := 0; i < n-1; i++ {
		if nums[i] < nums[i+1] {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
using System;

public class Hello
{
    public static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        string[] line = Console.ReadLine().Split();
        int count = 0;
        for (int i = 0; i < line.Length; i++)
        {
            int a = int.Parse(line[i]);
            while (a%2==0)
            {
                a /= 2;
                count++;
            }
        }
        Console.WriteLine(count);
    }
}

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

int main()
{
	int N;
	cin >> N;
	vector<ll> A(N);
	for (auto i = 0; i < N; ++i)
	{
		cin >> A[i];
	}

	map<ll, ll> mp;
	map<ll, ll> mm;
	for (auto i = 0; i < N; ++i)
	{
		auto j = i + 1;
		++mp[-j - A[i]];
		++mm[j - A[i]];
	}

	auto ans = 0ll;
	for (auto i = 0; i < N; ++i)
	{
		auto j = i + 1;
		ans += mp[A[i] - j];
		ans += mm[A[i] + j];
	}

	cout << ans / 2 << endl;

	return 0;
}

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

template <class T>
inline void read(T &res)
{
	char ch; bool flag = false; res = 0;
	while (ch = getchar(), !isdigit(ch) && ch != '-');
	ch == '-' ? flag = true : res = ch ^ 48;
	while (ch = getchar(), isdigit(ch))
		res = res * 10 + ch - 48;
	flag ? res = -res : 0;
}

template <class T>
inline void put(T x)
{
	if (x > 9)
		put(x / 10);
	putchar(x % 10 + 48);
}

template <class T>
inline void CkMax(T &x, T y) {x < y ? x = y : 0;}
template <class T>
inline void CkMin(T &x, T y) {x > y ? x = y : 0;}
template <class T>
inline T Max(T x, T y) {return x > y ? x : y;}
template <class T>
inline T Min(T x, T y) {return x < y ? x : y;}

const int N = 1005;
using std::string;
const string s3[3] = {"a..", "a..", ".bb"};
const string s4[4] = {"aabc", "ddbc", "bcaa", "bcdd"};
const string s5[5] = {"abbaa", "a.ccb", "bc..b", "bc..a", "aabba"};
const string s6[6] = {"aabbcc", "d.d.d.", "d.d.d.", ".d.d.d", ".d.d.d", "aabbcc"};
const string s7[7] = {".aabbcc", "aeef...", "af.f...", "bfee...", "b...eef", "c...f.f", "c...fee"};
char ans[N][N];
int now, n;

inline void solve(int x)
{
	if (x == 3)
	{
		for (int i = 0; i < 3; ++i)
			for (int j = 0; j < 3; ++j)
				ans[now + i][now + j] = s3[i][j];
		now += 3;
	}
	else if (x == 4)
	{
		for (int i = 0; i < 4; ++i)
			for (int j = 0; j < 4; ++j)
				ans[now + i][now + j] = s4[i][j];
		now += 4;
	}
	else if (x == 5)
	{
		for (int i = 0; i < 5; ++i)
			for (int j = 0; j < 5; ++j)
				ans[now + i][now + j] = s5[i][j];
		now += 5;
	}
	else if (x == 6)
	{
		for (int i = 0; i < 6; ++i)
			for (int j = 0; j < 6; ++j)
				ans[now + i][now + j] = s6[i][j];
		now += 6;
	}
	else if (x == 7)
	{
		for (int i = 0; i < 7; ++i)
			for (int j = 0; j < 7; ++j)
				ans[now + i][now + j] = s7[i][j];
		now += 7;
	}
}
int main()
{
	scanf("%d", &n);
	if (n <= 2)
		return puts("-1"), 0;
	int n1 = n >> 3, n2 = n & 7;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			ans[i][j] = '.';
	if (n == 3)
		solve(3);
	else if (n2 >= 4)
	{
		for (int i = 1; i <= n1; ++i)
		{
			solve(4);
			solve(4);
		}
		switch (n2)
		{
			case 3: solve(3); break;
			case 4: solve(4); break;
			case 5: solve(5); break;
			case 6: solve(6); break;
			case 7: solve(7); break;
		}
	}
	else
	{
		for (int i = 1; i < n1; ++i)
		{
			solve(4);
			solve(4);
		}
		n2 += 8;
		switch (n2)
		{
			case 8: solve(4); solve(4); break;
			case 9: solve(4); solve(5); break;
			case 10: solve(5); solve(5); break;
			case 11: solve(5); solve(6); break;
		}
	}
	for (int i = 0; i < n; ++i, putchar('\n'))
		for (int j = 0; j < n; ++j)
			putchar(ans[i][j]);

	return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ff first
#define ss second
#define LL long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define Pqi priority_queue<int>
#define Pqg priority_queue<int,vi,greater<int> >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define TC(x) while(x--)
#define pw(b,p)	pow(b,p) + 0.1
#define IOS	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


int32_t main() {
    
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;
}


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

int main(){
    int q, op, x, y;
    set<int> s;

    cin >> q;

    while(q-- > 0){
        cin >> op >> x;
        if(op == 0){
            s.insert(x);
            cout << s.size() << endl;
        }else if(op == 1){
            cout << (s.find(x) != s.end()) << endl;
        }else if(op == 2){
            s.erase(x);
        }else if(op == 3){
            cin >> y;
            auto l = s.lower_bound(x);
            auto r = s.upper_bound(y);
            for(; l != r; l++)  printf("%d\n", *l);
        }
    }

    return 0;
}


Measured memory_bytes: 12484
/*input
10
33 18 45 28 8 19 89 86 2 4
*/

#include <bits/stdc++.h>
using namespace std;

#define int long long int


signed main(){

    int n ; 
    cin >> n ; 
    vector<int> v(n);
    for ( int i = 0 ; i < n ; i++) cin >> v[i];
    map< int , int > m; 
    for ( int x : v){
         m[x]++;
    }
    set<int> s;
    for ( auto p : m ) s.insert( p.first);
    int mx = *s.rbegin();

    for ( int x : s){
        
        for ( int mul =x+x ; mul <= mx; mul += x){
            if ( s.find(mul) != s.end()){
                if ( m.count(mul)) m.erase( mul);
            }
        }
    }
    int ans =0 ; 
    for ( auto p:m) if ( p.second == 1) ans++;
    cout << ans;

}

Measured memory_bytes: 26600
/*
Author: Sagar Gupta
E mail: sagar.june97p@gmail.com
*/
#include <bits/stdc++.h>
#define newline ("\n")
#define deb(x) cerr << (#x) << " = " << (x) << '\n'
#define FOR(x, n) for (int x = 0; x < n; x++)
#define PI (3.141592653589)

#define MOD 1000000007
using namespace std;

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

    // Pikachu, I choose you
    int n,w;
    cin >> n >> w;
    long long weight[n+1], value[n+1];
    for(int i = 1;i<=n;i++)
    {
        cin >> weight[i];
        cin >> value[i];
    }
    long long dp[n+1][w+1];
    for(int i = 0;i<=n;i++)
    {
        for(int j = 0;j<=w;j++)
        {
            if(i == 0)
            {
                dp[i][j] = 0;
                continue;
            }
            if(j >= weight[i])
            {
                dp[i][j] = max(dp[i-1][j] , dp[i-1][j- weight[i]] + value[i]);
            }
            else
            {
                dp[i][j] = dp[i-1][j];
            }
        }
    }
    cout << dp[n][w];
    return 0;
}


Measured memory_bytes: 79232
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char* argv[]) {
  long long N, K, S;
  cin >> N >> K >> S;

  vector<long long> t(N);
  for (int i = 0; i < N; ++i) {
    if (K > 0) {
      t[i] = S;
      --K;
    } else
      if (S == 1000000000)
        t[i] = S - 1;
      else
        t[i] = S + 1;
  }

  for (int i = 0; i < N; ++i) {
    if (i != 0)
      cout << " ";
    cout << t[i];
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 2048
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	int n,m;
	cin>>n>>m;
	int sum =m;
	int ans =m;
	bool flag=true;
	rep(i, n){
		int in,out;
		cin>>in>>out;
		sum=sum+in;
		sum=sum-out;
		if(sum<0){
			flag =false;
		}
		ans =max(ans,sum);
	}
	if(flag)cout <<ans<<endl;
	else cout <<0<<endl;
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
using namespace std;
string st;
int main()
{
	cin>>st;
	if (st.size()<4||st.substr(0,4)!="YAKI")
	{
		cout<<"No";
		return 0;
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
ans=[]
a=0
for i in range(N):
    if i%2==0:
        a+=A[i]
    else:
        a-=A[i]
ans.append(a)
for j in range(N-1):
    if j==N-1:
        b=ans[0]
    else:
        b=ans[-1]
    ans.append(2*A[j]-b)
for i in ans:
    print(i,end=" ")
print()


Measured memory_bytes: 65764