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

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

#define MAX_N 200002
#define INF   0x7f7f7f7f

int a[MAX_N];
int w[MAX_N/2+2];

long long number_of_inversions(int low, int high) 
{ 
	int i, j, k, p, mid;
	long long ans = 0;

	if (low < high) {
		mid = (low + high) >> 1;
		ans += number_of_inversions(low,   mid);
		ans += number_of_inversions(mid+1, high);

		p = mid-low+1;
		memcpy(w, a+low, p << 2);
		i = mid+1, j = 0; k = low;

		w[p] = INF;
		while (i <= high) {
			if (w[j] <= a[i]) a[k++] = w[j++];
			else              a[k++] = a[i++], ans += i-k;
		}
		memcpy(a+k, w+j, (p-j) << 2);
	}
	return ans;
}

int main()
{
	int n, i;
	
	n = in(); for (i = 0; i < n; i++) a[i] = in();
	printf("%lld\n", number_of_inversions(0, n-1));
	return 0;
}



Measured memory_bytes: 3008
//#define _CRT_SECURE_NO_WARNINGS
//#include<stdio.h>
#include <stdlib.h>
#include<iostream>
#include<math.h>

using namespace std;

long long int n;

int main(void) {
	cin >> n;
	for ( int i = int(sqrt(n)); i > 0; i--) {
		if (n % i == 0) {
			cout << (n/i) + i - 2;
			exit(0);
		}
	}
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
        int month, day;
        try {
            while (true) {
                String[] input = br.readLine().split(" ");
                month = Integer.parseInt(input[0]);
                day = Integer.parseInt(input[1]);
                if (month < 1) break;
                for (; month > 1; month--) {
                    day += 31;
                    switch(month) {
                        case 3:
                            day--;
                        case 5:
                        case 7:
                        case 10:
                        case 12:
                            day--;
                        break;
                    }
                }
                String[] weekday = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
                System.out.println(weekday[day%7]);
            }
        } finally {
            br.close();
        }
    }
}

Measured memory_bytes: 24148
def partition(a, p, r):
    q = p
    for i in range(p, r):
        if a[i][1] <= a[r][1]:
            a[q], a[i] = a[i], a[q]
            q += 1
    a[q], a[r] = a[r], a[q]
    return q 
   
def quicksort(a, p, r):
    if p < r:
        q = partition(a, p, r)
        quicksort(a, p, q-1)
        quicksort(a, q+1, r)
   
def check_stable(a):
    for i in range(1, len(a)):
        if a[i - 1][1] == a[i][1]:
            if a[i - 1][2] > a[i][2]:
                return 'Not stable'
    return 'Stable'
       
import sys
n = int(sys.stdin.readline())
a = []
for i in range(n):
    suit, num = sys.stdin.readline().split()
    a += [[suit, int(num), i]]
   
quicksort(a, 0, len(a) - 1)
print(check_stable(a))
   
for line in a:
    print(line[0],line[1])


Measured memory_bytes: 22000
import sys
import copy

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
P = MAP()
P_S = copy.deepcopy(P)
P_S.sort()

count = 0
for p, p_s in zip(P, P_S):
	if p!=p_s: count+=1

if count>=3:
	print('NO')
else:
	print('YES')

Measured memory_bytes: 3444
program dm
    implicit none
    integer::K
    integer::KAZU(10,0:9)
    integer::SOWA(0:10)
    integer::i,j
    integer::KETA,CHECK
    read*,K
    KAZU(1,:)=1
    do i=2,10
        do j=0,9
            if(j==0)then
                KAZU(i,j)=KAZU(i-1,j)+KAZU(i-1,j+1)
            else if(j==9)then
                KAZU(i,j)=KAZU(i-1,j-1)+KAZU(i-1,j)
            else
                KAZU(i,j)=KAZU(i-1,j-1)+KAZU(i-1,j)+KAZU(i-1,j+1)
            endif
        end do
    end do
    SOWA(0)=0
    do i=1,10
        SOWA(i)=sum(KAZU(i,:))-KAZU(i,0)
    end do
    do i=1,9
        SOWA(i+1)=SOWA(i+1)+SOWA(i)
    end do
    do i=1,10
        if(K<=SOWA(i))then
            CHECK=SOWA(i-1)
            do j=1,9
                if(CHECK+KAZU(i,j)>=K)then
                    write(*,"(i0)",advance="no")j
                    call solve(K-CHECK,i-1,j)
                    stop
                endif
                CHECK= CHECK+KAZU(i,j)
            end do
        end if
    end do
contains
recursive subroutine solve(K,KU,MAE)
    integer::K,KU,MAE
    integer::tmp
    integer::i
    if(KU==0)then
        write(*,*)
        return
    endif
    tmp=0
    do i=max(0,MAE-1),min(9,MAE+1)
        if(tmp+KAZU(KU,i)>=K)then
            write(*,"(i0)",advance="no")i
            call solve(K-tmp,KU-1,i)
            stop
        endif
        tmp=tmp+KAZU(KU,i)
    end do
end subroutine
end program dm

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	n := len(s)
	a := make([]int, n+1)
	b := make([]int, n+1)
	for i := 0; i < n; i++ {
		if s[i] == '<' {
			a[i+1] = a[i] + 1
		}
		if s[n-i-1] == '>' {
			b[n-i-1] = b[n-i] + 1
		}
	}

	ans := 0
	for i := 0; i < len(a); i++ {
		ans += max(a[i], b[i])
	}
	fmt.Println(ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 13512
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <functional>
# include <utility>
# include <queue>
# include <stack>
# define MOD 1000000007
# define INF 9223372036854775806
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
int main() {
	int ans = 0, counter = 0, maxi = -1, mini = INF, pass = 0, sum = 0;
	//new
	string alp;
	int n;
	cin >> n>>alp;
	rep(i, alp.size()) {
		pass = alp[i] + n;
		if (pass > 90)pass -= 26;
		char c = ' ' + pass+'A'-'a';
		cout << c;
	}
	cout << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll H, W;
std::string c[310];

std::vector<std::vector<ll>> precompute( const std::string &S, const std::string &T ) {
  std::vector<std::vector<ll>> cost( H+10, std::vector<ll>( H+10, 0 ) );

  rep( i, H ) {
    cost[i][0] = 0;
    cost[0][i] = 0;

    for( ll j = 0; i+j < H; ++j ) {
      cost[i+j+1][j+1] = cost[i+j][j]+(S[i+j]==T[j] ? 1 : 0);
      cost[j+1][i+j+1] = cost[j][i+j]+(S[j]==T[i+j] ? 1 : 0);
    }
  }

  return cost;
}

ll solve( const std::string &S, const std::string &T ) {
  auto cost = precompute( S, T );

  std::vector<std::vector<ll>> dp( H+10, std::vector<ll>( H+10, INF ) );

  rep( i, H+1 )
    dp[i][0] = dp[0][i] = 0;

  rep( i, H+1 ) rep( j, H+1 ) {
    if( i-1 >= 0 )
      chmin( dp[i][j], dp[i-1][j]+cost[i][j] );
    if( j-1 >= 0 )
      chmin( dp[i][j], dp[i][j-1]+cost[i][j] );
  }

  return dp[H][H];
}

int main()
{
  std::cin >> H >> W;

  rep( j, W )
    c[j].resize( H );

  rep( i, H ) rep( j, W )
    std::cin >> c[j][i];

  ll ans = 0;

  rep( j, W-1 )
    ans += solve( c[j], c[j+1] );

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 4848
#include<stdio.h>
int main(void)
{
	int n,m,a[1001],i,j,w;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=1;i<m+1;i++){
		for(j=0;j<n-1;j++){
			if(a[j]%i>a[j+1]%i){
				w=a[j];
				a[j]=a[j+1];
				a[j+1]=w;
			}
		}
	}
	for(i=0;i<n;i++){
		printf("%d\n",a[i]);
	}	
	return 0;
}

Measured memory_bytes: 1028
#include<stdio.h>

int main(){
	int a, b, c, d, n, s;
	while(1){
		s = 0;
		if(scanf("%d", &n) == EOF){
			break;
		}
		for(a = 0; a < 10; a++){
			 for(b = 0; b < 10; b++){
				 for(c = 0; c < 10; c++){
					 for(d = 0; d < 10; d++){
						 if(n == a + b + c + d){
							 s++;
						}
					}
				}
			}
		}
		printf("%d\n", s);
    }
	return 0;
	
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define fi first
#define so second
#define ps push_back
#define pii pair<int,int>
#define mod 1000000007
#define TT int t;cin>>t;while(t--)

signed main()
{
    int n,m;
    cin>>n>>m;
    if(n==1 || m==1) {cout<<1;return 0;}
    int m1=(m/2)+(m%2);
    int m2=(m/2);
    int ans = ((n/2)+(n%2))*(m1);
    ans+=(n/2)*(m2);
    cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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) << " "; }

ll inf = 10000000000;

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

template <class T>
void warshall_floyd(vector< vector<T> > & cost, int N) {
  for (ll k = 0; k < N; ++k) {
    for (ll i = 0; i < N; ++i) {
      for (ll j = 0; j < N; ++j) {
        cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
      }
    }
  }
}

/* END */

/*
int main() {
  int h,w;
  cin >> h >> w;

  vector< vector<long long> > cost(10, vector<long long>(10));

  for (int i = 0; i < 10; ++i)
    for (int j = 0; j < 10; ++j)
      cin >> cost[i][j];

  int wall[h][w];
  for (int i = 0; i < h; ++i)
    for (int j = 0; j < w; ++j)
      cin >> wall[i][j];

  floyd_wardhall(cost, 10);

  ll ans = 0;
  for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) {
    if (wall[i][j] == -1 or wall[i][j] == 1) continue;
    ans += cost[wall[i][j]][1];
  }

  cout << ans << endl;
}*/

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

  int N,M,L;
  cin >> N >> M >> L;

  vector<ll> a(M), b(M), c(M);
  vector<vector<ll>> fuel(N+1, vector<ll>(N+1, inf));
  vector<vector<ll>> dist(N+1, vector<ll>(N+1, inf));
  for (int i = 0; i < N+1; ++i) {
    fuel[i][i] = 0;
    dist[i][i] = 0;
  }

  repr(i, M, 0) {
    cin >> a[i] >> b[i] >> c[i];

    fuel[a[i]][b[i]] = c[i];
    fuel[b[i]][a[i]] = c[i];
  }

  warshall_floyd(fuel, N+1);
  for (int i = 0; i < N+1; ++i) {
    for (int j = 0; j < N+1; ++j) {
      if (fuel[i][j] <= L) {
        dist[i][j] = 1;
      }
    }
  }

  warshall_floyd(dist, N+1);
  int Q;
  cin >> Q;
  repr(i, Q, 0) {
    int s, t;
    cin >> s >> t;
    if (dist[s][t] < inf) {
      cout << dist[s][t] - 1 << endl; // 最初から持っている燃料
    } else {
      cout << -1 << endl;
    }
  }
}

Measured memory_bytes: 5764
s=input()
l=len(s)
ans=0
p=0
a={}
b=-1
c=-1
d=-1
e=-1
q=1
for j in range(l)[::-1]:
    p=(p+int(s[j])*q)%2019
    q*=10
    q%=2019
    if p==0:
        ans+=1
    if a.get(p)!=None:
        ans+=a[p]
    if a.get(p)!=None:
        a[p]+=1
    else:
        a[p]=1
print(ans)

Measured memory_bytes: 9316
#include<iostream>
#include<cstdio>
using namespace std;
int main(void){
int a,dat=0;
	
	cin>>a;
	dat+=a*100;
	cin>>a;
	dat+=a*10;
	cin>>a;
	dat+=a;
	
	switch(dat){
	
		case 100:
		case 10:
		case 0:
			printf("Close");
			break;
		default:
			printf("Open");
	}
	cout<<endl;
}

Measured memory_bytes: 1164
#include<stdio.h>

int main(){
  int c1,c5,c10,c50,c100,c500,all;

  scanf("%d %d %d %d %d %d",&c1,&c5,&c10,&c50,&c100,&c500);

  all = c1+c5*5+c10*10+c50*50+c100*100+c500*500;

  if(all >= 1000){
    printf("1\n");
  }else{
    printf("0\n");
  }
  return 0;
}

Measured memory_bytes: 1804
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String taro, hanako, str;
        int st=0, sh=0;
        int n = scan.nextInt();
        while (n > 0) {
            taro = scan.next();
            hanako = scan.next();
            if(taro.compareTo(hanako) < 0) {
                sh += 3;
            }
            if(taro.compareTo(hanako) > 0) {
                st += 3;
            }
            if (taro.compareTo(hanako) == 0) {
                st++; sh++;
            }
            n--;
        }
        System.out.println(st + " " + sh);
    }
}

Measured memory_bytes: 29580
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

const int MAX_N=100100;

int par[MAX_N];
int ran[MAX_N];
int size[MAX_N];

void init(int n){
	for(int i=0;i<n;i++){
		par[i]=i;
		ran[i]=0;
		size[i]=1;
	}
}

int find(int x){
	if(par[x]==x){
		return x;
	}else{
		return par[x]=find(par[x]);
	}
}

void unite(int x,int y){
	x=find(x);
	y=find(y);
	if(x==y)return;
	
	if(ran[x]<ran[y]){
		par[x]=y;
	}else{
		par[y]=x;
		if(ran[x]==ran[y])ran[x]++;
	}
	size[x]=size[y]+size[x];
	size[y]=size[x];
}

bool same(int x,int y){
	return find(x)==find(y);
}


int n;

typedef struct Node{int N,x,y;}Node;
bool comp1(const Node& p1,const Node& p2){
	return p1.x<p2.x;
}
bool comp2(const Node& p1,const Node& p2){
	return p1.y<p2.y;
}

typedef struct edge{
	int cost,u,v;

}edge;


bool comp(const edge& e1,const edge& e2){
	return e1.cost<e2.cost;
}

vector<edge> es;


Node xy[100100];
Node yx[100100];
int main(){
	cin>>n;
	REP(i,n){
		int t,s;
		cin>>t>>s;
		Node xx={i,t,s};
		xy[i]=xx;
		yx[i]=xx;
	}
	sort(xy,xy+n,comp1);
	sort(yx,yx+n,comp2);
	for(int i=0;i<n-1;i++){
		es.push_back(edge{xy[i+1].x-xy[i].x,xy[i].N,xy[i+1].N});
	}	
	for(int i=0;i<n-1;i++){
		es.push_back(edge{yx[i+1].y-yx[i].y,yx[i].N,yx[i+1].N});
	}
	sort(es.begin(),es.end(),comp);
	/*for(auto it=es.begin();it!=es.end();it++){
		cout<<it->cost<<endl;
	}*/
	init(n+1);
	int res=0;
	for(int i=0;i<es.size();i++){
		edge ee=es[i];
		if(!(same(ee.u,ee.v))){
			unite(ee.u,ee.v);
			res+=ee.cost;
			//cout<<ee.u<<" "<<ee.v<<" "<<ee.cost<<endl;
		}
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 7284
package main

import (
	"fmt"
	"math"
)

func main() {
	var N int
	fmt.Scanf("%d\n", &N)

	var min int64 = 1e12 + 1

	for i := 1; i <= int(math.Sqrt(float64(N)))+1; i++ {
		if N%i != 0 {
			continue
		}
		x := int64(i)
		y := int64(N / i)
		if x-1+y-1 < min {
			min = x - 1 + y - 1
		}

	}
	fmt.Println(min)
}


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


void solve(long long N, std::vector<long long> B){
    ll ans = 0;
    for (int i = 1; i < N-1;i++) {
        ans += min(B[i-1], B[i]);
    }
    ans += B[0];
    ans += B[N - 2];

    cout << ans << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> B(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&B[i]);
    }
    solve(N, std::move(B));
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

int main(){
    string str;
    cin >> str;
    int length = 0;
    for(int i = 0; i < 20; i++){
        length = i;
        if (str[i] == '\0') break;
    }
    int count = 0;
    for(int j = 0; j < length; j++){
        if (str[j] == 'o') count++;
    }
    if(count+(15-length)>=8){
        cout << "YES" << "\0";
    }
    else cout << "NO" << "\0";
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cctype>
#include<vector>
using namespace std;
int main() {
	int n, k;
	string s;
	cin >> n >> k >> s;
	s[k-1]=tolower(s[k - 1]);
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<functional>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X <<":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const ll INF = 9e14;
typedef std::pair<ll,ll> P;
struct edge{ int to,cost; };
#define VMAX 100000

ll K,A[100010];
ll ans=0;
priority_queue<ll,vector<ll>,greater<ll>> Q;
    void DFS(ll k,ll a,ll b){
        if(k>10)return;
        if(k==1){
            EREP(i,9){
                Q.push(i);
                DFS(k+1,i,i);
            }
        }else{
            if(a-1>=0){Q.push(b*10+a-1);DFS(k+1,a-1,b*10+a-1);}
            Q.push(b*10+a);
            DFS(k+1,a,b*10+a);
            if(a+1<=9){Q.push(b*10+a+1);DFS(k+1,a+1,b*10+a+1);}
        }

    }

int main(){
    cin>>K;
    DFS(1,0,0);
    EREP(i,K){
        if(K==i)ans=Q.top();
        else Q.pop();
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 2420
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        char[] s = br.readLine().toCharArray();
        
        int[] black = new int[n + 1];
        int[] white = new int[n + 1];
        for(int i = 0; i < n; i++) {
            if(s[i] == '#') {
                black[i + 1] = black[i] + 1;
                white[i + 1] = white[i];
            }else {
                black[i + 1] = black[i];
                white[i + 1] = white[i] + 1;
            }
        }

        int ans = 1000000;
        for(int i = 0; i <= n; i++) {
            ans = Math.min(ans, black[i] + white[n] - white[i]);
        }
        System.out.println(ans);

        br.close();
    }
}

Measured memory_bytes: 29396
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.D_Challenge
{
    class ABC_098
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] array = ReadInts();
            var twice = new int[n][];
            for(int i = 0; i < n; i++)
            {
                twice[i] = new int[20];
                int val = array[i];
                int digit = 0;
                while (val > 0)
                {
                    twice[i][digit] = val % 2;
                    val /= 2;
                    digit++;
                }
                /*
                for(int j = 0; j < 20; j++)
                {
                    Console.Write(twice[i][j]);
                }
                Console.WriteLine();
                */
            }
            long res = 0;
            int r = 0;
            var sum = new int[20];
            for (int l = 0; l < n; l++)
            {
                bool sumed = false;
                for (; r < n; r++)
                {
                    for (int j = 0; j < 20; j++)
                    {
                        sum[j] += twice[r][j];
                        if (sum[j] > 1)
                        {
                            sumed = true;
                        }
                        //Console.Write(sum[j]);
                    }
                    //Console.WriteLine();
                    if (sumed)
                    {
                        break;
                    }
                }
                res += r - l;
                //Console.WriteLine(res);

                for (int j = 0; j < 20; j++)
                {
                    sum[j] -= twice[l][j];
                    if (r < n)
                    {
                        sum[j] -= twice[r][j];
                    }
                }
            }
            Console.WriteLine(res);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

struct UnionFind {
    vector<int> par; // par[i]: iの親の番号
    vector<int> par_num;

    UnionFind(int N) : par(N) { //最初はすべてが根であるとして初期化
        for (int i = 0; i < N; i++) par[i] = i;
        par_num.assign(N, 1);
    }

    int root(int x) { // データxが属する木の根を再帰で得る
        if (par[x] == x) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) { //2つのデータx，yが属する気が同じならtrueを返す
        return root(x) == root(y);
    }

    void merge(int x, int y) { // xとyの気を併合
        x = root(x); y = root(y);
        if (x == y) return; //xとyが同じ木にあるときはそのまま
        par[x] = y;
        par_num[root(x)] ++;
    }
};

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    UnionFind tree(N);
    vector<int> ans;
    ans.assign(N, 0);
    vector<vector<int>> graph(N, vector<int>());
    for (int i = 0; i < M; i++) {
        int a, b; cin >> a >> b; a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
        tree.merge(a, b);
    }

    for (int i = 0; i < K; i++) {
        int c, d; cin >> c >> d; c--; d--;
        if (!tree.issame(c, d)) continue;
        graph[c].push_back(d);
        graph[d].push_back(c);
    }

    vector<int> root_num(N, 0);
    for (int i = 0; i < N; i++) {
        root_num[tree.root(i)] ++;
    }

    for (int i = 0; i < N; i++) {
        ans[i] += root_num[tree.root(i)];
        ans[i] --;
        ans[i] -= graph[i].size();
    }
    for (int i = 0; i < N; i++) {
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}

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

int main(){
  string a;
  string b;
  
  cin >> a;
  cin >> b;
 
  if(a.size()!=b.size()){
    if(a.size()>b.size()){
      printf("GREATER\n");
    } else {
      printf("LESS\n");
    }
  } else {
    
    int f=1;
    for(int i=0;i<a.size();i++){
      if(a[i]>b[i]){
        printf("GREATER\n");
        f=0;
        break;
      }      
      if(a[i]<b[i]){
        printf("LESS\n");
        f=0;
        break;
      }
    }
    if(f==1){
      printf("EQUAL\n");
    }
  }
  
  return 0;
}

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

long long f(long long n, long long k) {
    long long rt = 0;
    while (n > 0) {
        rt += n % k;
        n /= k;
    }
    return rt;
}

int main() {
    long long n, s;
    cin >> n >> s;
    long long ans = -1;
    long long B = 0;
    for (long long i = 2; i * i <= n; i++) {
        if (f(n, i) == s) {
            //ans += i;
            cout << i << endl;
            return 0;
        }
        B = i;
    }

    for (long long i = 1; i * i <= (n - s); i++) {
        if ((n - s) % i == 0) {
            long long k = (n - s) / i + 1;
            if (k <= B|| k == 1) continue;
            if (f(n, k) == s) {
                ans = k;
            }
        }
    }
    if (ans == -1 && n == s) ans = n + 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<ll, pair<ll, ll> > p;
 
#define MOD 1000000007
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    int N, T;
    cin >> N >> T;

    vector<int> A(N + 2);
    vector<int> B(N + 2);

    for(int i = 1; i <= N; i++) {
        cin >> A[i] >> B[i];
    }

    vector<vector<int> > dp1(N + 2, vector<int>(T));
    vector<vector<int> > dp2(N + 2, vector<int>(T));

    for(int i = 1; i <= N; i++) {
        for(int j = 0; j < T; j++) {
            dp1[i][j] = dp1[i - 1][j];
            if(j - A[i] >= 0) {
                dp1[i][j] = max(dp1[i][j], dp1[i - 1][j - A[i]] + B[i]);
            }
        }
    }

    for(int i = N; i >= 1; i--) {
        for(int j = 0; j < T; j++) {
            dp2[i][j] = dp2[i + 1][j];
            if(j - A[i] >= 0) {
                dp2[i][j] = max(dp2[i][j], dp2[i + 1][j - A[i]] + B[i]);
            }
        }
    }

    int ans = 0;

    for(int i = 1; i <= N; i++) {
        for(int j = 0; j < T; j++) {
            ans = max(ans, dp1[i - 1][j] + dp2[i + 1][T - 1 - j] + B[i]);
        }
    }

    cout << ans << endl;
}

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

int main(){
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(m);
  vector<vector<int>> a(n, vector<int>(m));
  
  for(int i = 0; i < m; i++) {
  	cin >> b.at(i);
  }
  
  for(int i = 0; i < n; i++){
  for(int j = 0; j < m; j++){
  	cin >> a.at(i).at(j);
  }
  }
  
  int ans = 0;
  
  for(int i = 0; i < n; i++){
  	int sum = c;
  	for(int j = 0; j < m; j++){
    	sum += a.at(i).at(j)*b.at(j);
    }
  if(sum > 0){
  	ans++;
  }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n;
  double num=100000.0;
  cin>>n;
  for(int i=0;i<n;i++){
    num=num*1.05;
    if((int)num%1000>0){
      num=(int)num-(int)num%1000;
      num+=1000.0;
    }
  }
  cout<<(int)num<<endl;
  return 0;
}

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

int main() {
    map<int, bool> check;

    int n; cin >> n;
    while (n--) {
        int a; cin >> a;
        if (check[a]) {
            cout << "NO" << endl;
            return 0;
        }
        check[a] = true;
    }

    cout << "YES" << endl;
}



Measured memory_bytes: 12864
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int n,m,c;
	long long sum=0;
	priority_queue<int,vector<int>,greater<int>>qu;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>m;
		for(int j=0;j<m;j++){
			cin>>c;
			qu.push(c);
		}
		for(int j=0;j<m-1;j++){
			qu.pop();
		}
	}
	for(int i=0;i<n;i++){
		sum+=qu.top();
		qu.pop();
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 4944
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	int x, a, b;

	cin >> x >> a >> b;

	if (a >= b) {
		cout << "delicious" << endl;
	}else if(x >= b - a)
	{
		cout << "safe" << endl;
	}
	else {
		cout << "dangerous" << endl;

	}

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
template<typename A> using V = std::vector<A>;
using vi = V<int>;
using vvi = V<vi>;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
const int INF = 1000000000;
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vi c(m);
  rep(i, m) cin >> c[i];
  vi dp(n + 1, INF);
  dp[0] = 0;
  loop(i, 1, n + 1) {
    int mini = INF;
    rep(j, m) if (i - c[j] >= 0) cmin(mini, dp[i - c[j]] + 1);
    dp[i] = mini;
  }
  cout << dp[n] << endl;
}

Measured memory_bytes: 3204
#include<iostream>
#include<string>
typedef long long ll;
using namespace std;
int main() {
	ll c[10][10];
	ll a[10], b[10];
	for (ll i = 0; i < 3; i++) {
		cin >> c[i][0] >> c[i][1] >> c[i][2];
	}
     	a[0] == 0;
		a[1] = c[1][0] - c[0][0];
		a[2] = c[2][0] - c[0][0];
		b[0] = c[0][0];
		b[1] = c[0][1];
		b[2] = c[0][2];
  	if(
       c[0][0]== a[0]+b[0]&&
       c[0][1]== a[0]+b[1]&&
       c[0][2]== a[0]+b[2]&&
       c[1][0]== a[1]+b[0]&&
       c[1][1]== a[1]+b[1]&&
       c[1][2]== a[1]+b[2]&&
       c[2][0]== a[2]+b[0]&&
       c[2][1]== a[2]+b[1]&&
       c[2][2]== a[2]+b[2])
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<random>
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)
using namespace std;
 
int main(){
  int A,B,C;
  cin >> A >> B >> C;

  if (A == B && A != C){
    cout << "Yes" <<endl;
    return 0;
  }
  else if (A == C && A != B){
    cout << "Yes" <<endl;
    return 0;
  }
  else if (B == C && B != A){
    cout << "Yes" <<endl;
    return 0;
  }
  cout << "No" <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int N,M;
int P[100000],Y[100000]; vector<int> yd[100001];
int main () {
	scanf("%d%d",&N,&M);
	rep(i,M)scanf("%d%d",&P[i],&Y[i]),yd[P[i]].push_back(Y[i]);
	rep(i,N)sort(yd[i+1].begin(),yd[i+1].end());
	rep(i,M)printf("%012lld\n",ll(P[i])*1000000+int(lower_bound(yd[P[i]]. begin(),yd[P[i]].end(),Y[i])-yd[P[i]].begin())+1);
}


Measured memory_bytes: 7680
import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        boolean sa=false,sb=false;
        for(int i=0;i<s.length();i++)
        {
            if(s.charAt(i)=='A')
            sa=true;
            if(s.charAt(i)=='B')
            sb=true;
        }
        if(sa && sb)
        System.out.println("Yes");
        else
        System.out.println("No");
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long int
#define f first
#define s second
#define pb push_back
#define PII pair<ll,ll>
ll const MOD = 998244353;
ll const N = 1000005;
ll const LN = 20;
ll const inf = 8e18;
using namespace std;

ll n, m, a[N];

ll cnt[N];


ll fact[N];
ll ifact[N];
ll bexpo (ll x, ll n, ll m)
{
	ll r = 1;
	x = x % m;
	while (n > 0)
	{
		if (n % 2) { r = (r * x) % m; }
		x = (x * x) % m;
		n = n / 2;
	}
	return r;
}
ll ncr (ll n, ll r)
{
	if (r > n) { return 0; }
	ll ans = fact[n];
	ans = (ans * ifact[r]) % MOD;
	ans = (ans * ifact[n - r]) % MOD;
	return ans;
}
void pre()
{
	fact[0] = 1;
	ifact[0] = 1;
	for (ll i = 1; i < N; i++) { fact[i] = (fact[i - 1] * i) % MOD; }
	ifact[N - 1] = bexpo (fact[N - 1], MOD - 2, MOD);
	for (ll i = N - 2; i > 0; i--)
	{ ifact[i] = (ifact[i + 1] * (i + 1)) % MOD; }
}
int main()
{
	ios::sync_with_stdio (false);
	cin.tie (NULL);
	pre();
	ll n, k;
	cin >> k >> n;
	for (ll i = 2; i <= 2 * k; i++)
	{
		set<ll>st;
		for (ll j = 1; j <= k; j++)
		{
			if (j >= i)
			{
				continue;
			}
			ll oo = i - j;
			if (oo > k) { continue; }
			st.insert (oo);
			st.insert (j);
		}
		cnt[i] = (st.size() + 1) / 2;
	}
	for (ll i = 2; i <= 2 * k; i++)
	{
		if (1)
		{
			ll tot = ncr (n + k - 1, k - 1);
			for (ll j = 1; j <= cnt[i]; j++)
			{
				ll temp = ncr (cnt[i], j);
				temp *= ncr (n - 2 * j + k - 1, k - 1);
				temp %= MOD;
				if (j % 2) { tot -= temp; }
				else { tot += temp; }
				tot %= MOD;
				if (tot < 0) { tot += MOD; }
			}
			cout << tot << '\n';
		}
	}
	return 0;
}


Measured memory_bytes: 16768
#include<iostream>
#include<cstdio>
#include<map>
#include<queue>
#include<algorithm>
#include<deque>
#include<string.h>
#define ll long long
//#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        ll num[200005];
        for(int i=0; i<n; i++)
            scanf("%lld",&num[i]);
        int r=0;
        ll sum0 = 0,sum1 = 0,ans = 0;
        for(int l=0; l<n; l++)
        {
            //r=l;
            while((sum0^num[r])==(sum1+num[r])&&r<n)
            {
                sum0 ^= num[r];
                sum1 += num[r++];
            }
            ans+=(r-l);
            sum0 ^= num[l];
            sum1 -= num[l];
        }
        printf("%lld\n",ans);
    }
    return 0;
}


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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	if (S[2] == S[3] && S[4] == S[5]) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}
int gcd(int a, int b) {
	if (a%b == 0)return b;
	else return gcd(b,a%b);
}

signed main(void)
{
	int n;
	cin >> n;
	vector<string>w(n);
	bool ok = true;
	rep(i, n) {
		cin >> w[i];
		rep(j, i) {
			if (w[j] == w[i]) {
				ok = false;
			}
		}
	}
	rep(i, n - 1) {
		if (w[i][w[i].size() - 1] != w[i + 1][0]) {
			ok = false;
		}
	}
	if (ok)print("Yes");
	else print("No");
}

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

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


int main(){
    int N,AC=0,WA=0,TLE=0,RE=0;
    cin >> N;
  
    rep(i,N){
        string x;
        cin >> x;
        if(x=="AC"){
            AC++;
        }else if(x=="WA"){
            WA++;
        }else if(x=="TLE"){
            TLE++;
        }else if(x=="RE"){
            RE++;
        }
    }
    cout << "AC x " << AC << endl;
    cout << "WA x " << WA << endl;
    cout << "TLE x " << TLE << endl;
    cout << "RE x " << RE << endl;


}



Measured memory_bytes: 3628
#include <iostream>
using namespace std;
char mp[100][100];
int main(){
  int h,w;cin>>h>>w;
  for(int i = 0; h > i; i++){
    for(int j = 0; w > j; j++){
      cin>>mp[i][j];
    }
  }
  for(int i = 0; h > i; i++){
    for(int j = 0; w > j; j++){
      cout << mp[i][j];
    }
    cout << endl;
    for(int j = 0; w > j; j++){
      cout << mp[i][j];
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
import numpy as np

n = int(input())
h = list(map(int, input().split()))
D = np.diff(h)
max_cnt = cnt = 0
for i in range(len(D)):
    if D[i] <= 0:
        cnt += 1
    else:
        max_cnt = max(max_cnt, cnt)
        cnt = 0
ans = max(max_cnt, cnt)
print(ans)


Measured memory_bytes: 23372
#include <iostream>
#include <string>
#include <algorithm>
#define ll long long int

using namespace std;

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	ll * a = new ll[n];
	for(int i = 0; i < n; i++){
			cin >> a[i];
	}
	int count = 0;
	for(int i = 0; i < n; i++){
			while(a[i] % 2 == 0){
					count++;
					a[i] = a[i] / 2;
			}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 384
/*  AC祈願アンコウ
   　／￣＼
   ○    ／￣￣￣＼ヘ
    　 /・　 ・　 ＼>   
    ／￣￣￣＼　　  Ｖ| 
   ｜  ―――  ｜      ｜|
    ＼＿＿＿／　　  ∧|
    　　＼　　　　／
    　　　￣￣￣￣
*/

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

typedef int64_t ll;
//static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
#define ALL(x) (x).begin(),(x).end()
#define YESNO(x) puts((x)?"YES":"NO")
#define YesNo(x) puts((x)?"Yes":"No")

signed main(){
    int h,w;
    char field[600][600];

    cin >> h >> w;
    REP(i,h) scanf("%s",&field[i]);

    char red[600][600],blue[600][600];

    REP(i,h) REP(j,w) red[i][j] = blue[i][j] = '.';

    REP(i,h){
        if(i%2) REP(j,w) red[i][j] = '#';
        else REP(j,w) blue[i][j] = '#';
    }

    REP(i,h) red[i][0] = '.',red[i][w-1] = '#';
    REP(i,h) blue[i][0] = '#',blue[i][w-1] = '.';

    REP(i,h) REP(j,w){
        if(field[i][j]=='#') red[i][j] = blue[i][j] = '#';
    }

    REP(i,h){
        REP(j,w) printf("%c",red[i][j]);
        puts("");
    }
    puts("");

    REP(i,h){
        REP(j,w) printf("%c",blue[i][j]);
        puts("");
    }

    return 0;
}

Measured memory_bytes: 1664
#include <cstdio>

using namespace std;

int main() {
    int n, q;
    scanf("%d", &n);
    int s[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &s[i]);
    }
    scanf("%d", &q);
    int c = 0;
    for (int i = 0; i < q; i++) {
        int t;
        scanf("%d", &t);
        for (int j = 0; j < n; j++) {
            if (s[j] == t) {
                c++;
                break;
            }
        }
    }
    printf("%d\n", c);

    return 0;
}


Measured memory_bytes: 2736
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;

int main(void) {
	int N;
	scanf("%d", &N);
	int s[100];
	int sum = 0;
	for (int i = 0; i < N; i++) {
		scanf("%d", &s[i]);
		sum += s[i];
	}
	if (sum % 10 != 0) {
		printf("%d\n", sum);
		return 0;
	}
	sort(s, s + N);
	for (int i = 0; i < N; i++) {
		if (s[i] % 10 != 0) {
			printf("%d\n", sum - s[i]);
			return 0;
		}
	}
	printf("0\n");
	return 0;
}


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

int N;
int A[20];
int B[20];

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

    for (int i = 0; i < N; i++)
        cin >> B[i];

    int res = 0;

    for (int i = 0; i < N; i++) {
        if (A[i] > B [i]) {
            res+= A[i] - B[i];
        }
    }

    cout << res << endl;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
    unsigned long long a;
    string b;
    cin >> a >> b;
    if (a == 0 || b == "0") {
        cout << 0 << endl;
        return 0;
    }
    unsigned long long b_l = (b[0] - '0')*100 + (b[2] - '0')*10 + (b[3] - '0');
    cout << a * b_l / 100 << endl;

    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
long long i,j;
int fact(int n){ 
    return (n <= 1) ? 1 : n * fact(n - 1); 
}
int find(string str, int low, int high){ 
    int count = 0, i;
    for (i = low + 1; i <= high; ++i) 
        if (str[i] < str[low]) 
            ++count;
    return count; 
}
int findRank(string str) 
{ 
    int len = str.size(); 
    int mul = fact(len); 
    int rank = 1; 
    int count;
    int i; 
    for (i = 0; i < len; ++i) { 
        mul /= len - i;
        count = find(str, i, len - 1);
        rank += count * mul; 
    } 
  
    return rank; 
} 
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	int t,k,c=0,temp;
	string a="",b="";
	cin >> t;
	for(i=0;i<t;i++){
		cin>>temp;
		a+= to_string(temp);
	}
	for(i=0;i<t;i++){
		cin>>temp;
		b+=to_string(temp);
	}
	cout << abs(findRank(a)-findRank(b));
}

Measured memory_bytes: 256
using System;

class ITP1_6_A
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string[] Input = Console.ReadLine().Split(' ');

        int[] Output = new int[n];

        for (int i = 0; i < n; i++)
        {
            Output[i] = int.Parse(Input[n - 1 - i]);
            if (i != n - 1)
                Console.Write(Output[i] + " ");
            else
                Console.WriteLine(Output[i]);
        }
    }
}

Measured memory_bytes: 8980
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN (300006)
#define MAXK 26
#define MAXX 15000006
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph emplace
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n, k;
int main()
{
	cin>>n>>k;
	cout << (n-k+1) << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <deque>
using namespace std;

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

    int count = 0;
    for(int i = 0; i < n - 2; ++i)
    {
        int p1 = P[i];
        int p2 = P[i + 1];
        int p3 = P[i + 2];
        if((p1 > p2 && p2 > p3) || (p3 > p2 && p2 > p1))
        {
            ++count;
        }
    } 
    cout << count;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define ll long long int
using namespace std;

const int MAX = 1e5+5;

const int MOD = 1e9 + 7;

vector<int>vec[20];
int  n ,d;


bool ok(int x ,int y) {


    int tmp = 0;
    
    for(int i =0 ; i < d ; i++ ) {
        
        tmp += ( vec[x][i]  - vec[y][i] ) * ( vec[x][i]  - vec[y][i] );
    }
    
    int tmp1 = sqrt(tmp);
    return (tmp1 * tmp1 == tmp);
}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    cin>>n>>d;
    
    for(int i = 0 ; i < n ; i++ ) {
        
        for(int j =0 ; j < d ; j++ ) {
            
            int tmp;
            cin>>tmp;
            vec[i].push_back(tmp);
        }
    }
    
    int ans =0;
    for(int i = 0 ; i < n-1 ; i++ ) {
        for(int j = i+1 ; j <n ; j++ ) {
            
            if(ok(i,j) ) ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
   
}

Measured memory_bytes: 256
/*******************************\
   Name:    REAJUL HAQUE REAYZ  |
   School:  COMILLA UNIVERSITY  |
            CSE (5TH BATCH)     |
********************************/
#include<bits/stdc++.h>
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define mem(x,y) memset(x , y , sizeof(x))
using namespace std;
typedef long long ll;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;
const ll MOD = 1000000007;
const int MAX = 100005;

int n;
int a[MAX], b[MAX];
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n;
    for(int i=1; i<=n; i++) cin>>a[i];
    int ans=0;
    for(int i=1; i<=n; i++){
        while(a[i]%2==0){
            a[i]/=2;
            b[i]++;
        }
        //cout<<b[i]<<" ";
        ans += b[i];
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second
 
int main(int argc, char **argv) {
	ll n;
	cin >> n;
	FOR(i, 1, 3501) FOR(j, 1, 3501) {
		ll a = i, b = j, t = 4 * a * b - n * (a + b);
		if (t > 0 && n * a * b % t == 0) {
			cout << a << ' ' << b << ' ' << (n * a * b / t) << endl;
			return 0;
		}
	}
	return 0;
}
 

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int N,i,cnt=0;
    int a[101];
    
    scanf("%d",&N);
    
    for(i=1;i<=N;i++){
        scanf("%d",&a[i]);
    }
    
    for(i=1;i<=N;i=i+2){
        if(a[i]%2==1){
            cnt++;
        }
    }
    
    printf("%d\n",cnt);
    
    return 0;
}

Measured memory_bytes: 2128
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    long long A[N], B[N];
    long long sum = 0;
    for (int i = 0; i < N + 1; i++)
    {
        cin >> A[i];
        sum += A[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> B[i];
    }
    long long ans = 0;
    long long sum_a = 0;
    for (int i = 0; i < N; i++)
    {
        int d1 = min(A[i], B[i]);
        A[i] -= d1;
        B[i] -= d1;
        int d2 = min(A[i + 1], B[i]);
        A[i + 1] -= d2;
        B[i] -= d2;
        sum_a += A[i];
    }
    cout << sum - (sum_a + A[N]) << endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(void){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(W<x+r || H<y+r || 0>x-r || 0>y-r){
		printf("No\n");
	}else{
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
int a[33]={0 ,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main()
{
	int n;
	cin>>n;
	cout<<a[n];
}
 

Measured memory_bytes: 256