akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#define rep(i,n) for(int i=0;i<n;++i)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
int main() {
	int H, W; cin >> H >> W;
	vector<string> s(H);
	rep(i, H)cin >> s[i];
	for (int i = 1; i < H - 1; ++i) {
		for (int j = 1; j < W - 1; ++j) {
			if (s[i - 1][j] != s[i][j] && s[i + 1][j] != s[i][j] && s[i][j - 1] != s[i][j] && s[i][j + 1] != s[i][j]) {
				if (s[i][j] == '#') {
					no;
					return 0;
				}
			}
		}
	}
	yes;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define M_PI  3.1415926535
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define Summon_Tourist ios::sync_with_stdio(false);cin.tie(0);
ll gcd(ll a , ll b) { return b==0?a: gcd( b, a%b); }
ll lcm(ll a , ll b) { return a/gcd(a,b) * b ; }
ll inf = 1e9 + 7;
ll modexp( ll base ,ll power)
 {
     if( power == 0  ) return 1;
     if( power & 1) return base*modexp( base , power-1 )%inf;
     return modexp(base*base%inf,power/2);
 }
int main()
{
  Summon_Tourist
  //freopen("input.txt" , "r" , stdin ) ;
  ll t = 1;
  //cin>>t;
  while(t--)
  {
      string s,t ;
      cin>>s>>t ;
      ll ans = inf ;
      for( ll i= 0 ; i<(s.length()-t.length()+1) ; i++ ){
        ll temp = 0 ;
        for( ll j = i ; j<i+t.length(); j++ ){
            if( s[j] != t[j-i] ) temp++ ;
        }
        ans = min( ans , temp ) ;
      }
      cout<<ans<<endl;

  }
return 0;


}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <string>
#include <vector>
/* 変数i を n回繰り返すマクロ */
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
int main()
{
    cout << fixed << setprecision(10);//小数点以下10桁出力
    string s,t;
    int a,b;
    string u;

    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if(s == u){
        a--;
    }else{
        b--;
    }

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

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

using namespace std;

int n,m;
long long sum;
map<int ,int > mp;

int main(){
	ios::sync_with_stdio(0);
	cin>>n>>m;
	for(int i=0;i<n;i++){
		int tmp;
		cin>>tmp;
		sum+=tmp;
		mp[tmp]++;
	}
	for(int i=0;i<m;i++){
		map<int ,int >::iterator it=mp.end();it--;
		int tmp=it->first;
		sum-=(tmp-tmp/2);
		if(mp[tmp]==1) mp.erase(it);
		else mp[tmp]--;
		mp[tmp/2]++;
	}
	cout<<sum;
}

Measured memory_bytes: 4992
N = int(input())
C = [0] * (N-1)
S = [0] * (N-1)
F = [0] * (N-1)
for i in range(N-1):
    C[i], S[i], F[i] = list(map(int, input().split()))
T = [0] * N
Time = 0
for i in range(N-1):#situation that some passengers are in the station i+1
    for j in range(0, i+1):#passenger moves from the station j to j+1
        tmp = 0
        if T[j] < S[i]:
            T[j] = S[i] + C[i]
        else:
            tmp = -(-(T[j] - S[i]) // F[i])
            T[j] = S[i] + F[i] * tmp + C[i]
for i in range(N):
    print(T[i])


Measured memory_bytes: 3188
a_list = [[] for _ in range(3)]
for i in range(3):
    a_list[i] = list(map(int, input().split()))
n = int(input())
b_list = [int(input()) for _ in range(n)]

for b in b_list:
    for i, line in enumerate(a_list):
        for j, ele in enumerate(line):
            if ele == b:
                a_list[i][j] = -1
f = False
for i in range(3):
    if a_list[i][0] + a_list[i][1] + a_list[i][2] == -3:
        f = True
    elif a_list[0][i] + a_list[1][i] + a_list[2][i] == -3:
        f = True
if a_list[0][0] + a_list[1][1] + a_list[2][2] == -3:
    f = True
elif a_list[0][2] + a_list[1][1] + a_list[2][0] == -3:
    f = True

if f:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()

a = int(input())
b = int(input())
h = int(input())

print(((a+b)*h)//2)

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

int main() {
  int sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  int dx=tx-sx,dy=ty-sy;
  cout << string(dy,'U') << string(dx,'R');
  cout << string(dy,'D') << string(dx,'L');
  cout << 'L' << string(dy+1,'U') << string(dx+1,'R') << 'D';
  cout << 'R' << string(dy+1,'D') << string(dx+1,'L') << 'U';
  cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 2e3+1;

char c[N][N];
int n,m,a,b;

bool ck(int x,int y){
	if(x>=n-2&&y>=m-2)return 1;
	return 0;
}

bool solve(){
	if(a<2&&b<2||n<3||m<3)return 0;
	for(int i=1;i<=n;++i)
	for(int j=1;j<=m;++j)
	c[i][j]='.';
	c[n-2][m-2]='<';c[n-2][m-1]='>';c[n-2][m]='^';
	c[n-1][m-2]='^';c[n-1][m-1]='.';c[n-1][m]='v';
	c[n][m-2]='v';c[n][m-1]='<';c[n][m]='>';
	a-=2;b-=2;
	if(n&1){
		int tn=min(a,(m-3)/2);
		a-=tn;
		for(int i=1;i<=tn;++i)c[n][i*2-1]='<',c[n][i*2]='>';
	}
	if(m&1){
		int tm=min(b,(n-3)/2);
		b-=tm;
		for(int i=1;i<=tm;++i)c[i*2-1][m]='^',c[i*2][m]='v';
	}
	bool flag=1;
	for(int i=1;i<=n-(n&1);i+=2)
	for(int j=1;j<=m-(m&1);j+=2){
		if(a>=2){
			if(!ck(i,j)&&!ck(i,j+1))c[i][j]='<',c[i][j+1]='>',a--;
			if(!ck(i+1,j)&&!ck(i+1,j+1))c[i+1][j]='<',c[i+1][j+1]='>',a--;
		}
		else if(b>=2){
			if(!ck(i,j)&&!ck(i+1,j))c[i][j]='^',c[i+1][j]='v',b--;
			if(!ck(i,j+1)&&!ck(i+1,j+1))c[i][j+1]='^',c[i+1][j+1]='v',b--;
		}
		else if(a){
			if(!ck(i,j)&&!ck(i,j+1))c[i][j]='<',c[i][j+1]='>',a--;
		}
		else if(b){
			if(!ck(i,j)&&!ck(i+1,j))c[i][j]='^',c[i+1][j]='v',b--;
		}
	}
	if(a||b)return 0;
	return 1;
}

int main(){
	cin>>n>>m>>a>>b;
	int a1=a,b1=b;
	for(int i=1;i<=n;++i)
	for(int j=1;j<=m;++j)
	c[i][j]='.';
	if(n&1){
		int tn=min(a,m/2);
		a-=tn;
		for(int i=1;i<=tn;++i)c[n][i*2-1]='<',c[n][i*2]='>';
	}
	if(m&1){
		int tm=min(b,n/2);
		b-=tm;
		for(int i=1;i<=tm;++i)c[i*2-1][m]='^',c[i*2][m]='v';
	}
	int n1=n,m1=m;
	n=n-(n&1),m=m-(m&1);
	if(n*m<2*(a+(a&1))+2*(b+(b&1))){
		n=n1;m=m1;
		a=a1;b=b1;
		if(solve()){
			printf("YES\n");
			for(int i=1;i<=n1;++i){
				for(int j=1;j<=m1;++j)putchar(c[i][j]);
				cout<<endl;
			}
		}
		else printf("NO\n");
		return 0;
	}
	bool flag=1;
	for(int i=1;i<=n-(n&1);i+=2)
	for(int j=1;j<=m-(m&1);j+=2){
		if(a>=2){
			c[i][j]='<',c[i][j+1]='>',a--;
			c[i+1][j]='<',c[i+1][j+1]='>',a--;
		}
		else if(b>=2){
			c[i][j]='^',c[i+1][j]='v',b--;
			c[i][j+1]='^',c[i+1][j+1]='v',b--;
		}
		else if(a){
			c[i][j]='<',c[i][j+1]='>',a--;
		}
		else if(b){
			c[i][j]='^',c[i+1][j]='v',b--;
		}
	}
	printf("YES\n");
	for(int i=1;i<=n1;++i){
		for(int j=1;j<=m1;++j)putchar(c[i][j]);
		cout<<endl;
	}
}
/*
1000 1000 500000 500000
*/

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

struct Card { char suit, value; };

void bubble(struct Card c[], int N){
    struct Card t;
    for ( int i=0; i<N; i++){
        for ( int j=N-1; j>i; j-- ){
            if ( c[j-1].value > c[j].value ){
                t = c[j-1];
                c[j-1] = c[j];
                c[j] = t;
            }
        }
    }
}

void print(struct Card c[], int N){
    for ( int i=0; i<N; i++ ){
        if ( i > 0 ) cout << " ";
        cout << c[i].suit << c[i].value;
    }
    cout << endl;
}

void selection(struct Card c[], int N){
    int min_j;
    struct Card t;
    for ( int i=0; i<N; i++){
        min_j = i;
        for ( int j=i+1; j<N; j++ ){
            if ( c[min_j].value > c[j].value ){
                min_j = j;
            }
        }
        t = c[i];
        c[i] = c[min_j];
        c[min_j] = t;
    }
}

bool isStable(struct Card C1[], struct Card C2[], int N){
    for ( int i=0; i<N; i++){
        if ( C1[i].suit != C2[i].suit ){
            return false;
        }
    }
    return true;
}

int main(){
    Card C1[100], C2[100];
    int N;
    char ch;
    
    cin >> N;
    for ( int i=0; i<N; i++ ){
        cin >> C1[i].suit >> C1[i].value;
        C2[i] = C1[i];
    }
    bubble(C1, N);
    selection(C2, N);
    print(C1, N);
    cout << "Stable" << endl;
    
    print(C2, N);
    if ( isStable(C1, C2, N) ){
        cout << "Stable" << endl;
    }
    else{
        cout << "Not stable" << endl;
    }
    
    return 0;
    
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n;cin>>n;
    std::vector<double> dp(n+1,1);
    for (int i = 1; i <= n; ++i)
    {
    	double x;cin>>x;
    	double p=dp[0];
    	dp[i]=dp[i-1]*x;
    	dp[0]*=(1.0-x);
    	for (int j=1;j<i; ++j)
    	{
    		double y=dp[j];
    		dp[j]=p*x+dp[j]*(1.0-x);
    		p=y;
    	}
    }
    double sum=0.0;
    for (int i = (n+1)/2; i <= n; ++i)
    {
    	sum+=dp[i];
    }
    printf("%0.11lf",sum);
}


Measured memory_bytes: 256
//Let's join Kaede Takagaki Fan Club !!
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
template<class T>
void dmp(T a){
	rep(i,a.size()) cout << a[i] << " ";
	cout << endl;
}
template<class T>
bool chmax(T&a, T b){
	if(a < b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
bool chmin(T&a, T b){
	if(a > b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}
//ios::sync_with_stdio(false);
const ll mod = 1000000007;//998244353
template<class T>
void add(T&a,T b){
	a+=b;
	if(a >= mod) a-=mod;
}

int main(){
	set<string>S;
	int n; cin >> n;
	rep(i, n){
		string str; cin >> str;
		S.insert(str);
	}
	cout << S.size() << endl;
}

Measured memory_bytes: 19220
/********************************************
 *Author*        :ZZZZone
 *Created Time*  : 一  3/26 10:54:23 2018
 * Ended  Time*  : 一  3/26 11:03:05 2018
*********************************************/

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

inline void OPEN(string s){
	freopen((s + ".in").c_str(), "r", stdin);
	freopen((s + ".out").c_str(), "w", stdout);
}

int main()
{
	int n;
	scanf("%d", &n);
	vector<int> a(n), b(n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	for(int i = 0; i < n; i++) scanf("%d", &b[i]);
	vector<int> c, d;
	int ans = 0;
	int pow_2 = 1;
	for(int i = 0; i <= 28; i++){
		c = a, d = b;
		for(int j = 0; j < n; j++){
			c[j] %= 2 * pow_2;
			d[j] %= 2 * pow_2;
		}
		sort(c.begin(), c.end());
		sort(d.begin(), d.end());
		int l, r, sum = 0;
		for(int j = 0; j < n; j++){
			l = lower_bound(d.begin(), d.end(), pow_2 - c[j]) - d.begin();
			r = lower_bound(d.begin(), d.end(), 2*pow_2 - c[j]) - d.begin() - 1;
			sum += (r-l+1);
			l = lower_bound(d.begin(), d.end(), 3*pow_2 - c[j]) - d.begin();
			r = lower_bound(d.begin(), d.end(), 4*pow_2 - c[j]) - d.begin() - 1;
			sum += (r-l+1);
		}
		if(sum & 1) ans += pow_2;
		pow_2 *= 2;
	}
	printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 3328
#import<bits/stdc++.h>
#define sorted(vector) sort(vector.begin(),vector.end())
#define append(a) push_back(a)
#define int(a) stoi(a)
#define str(a) to_string(a)
using namespace std;

int main(void){
    int n,k;
    cin>>n>>k;
    cout<<n-(k-1);
    
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    int H, W;
    vector<vector<char> > vvc;

    void input() {
        cin >> H >> W;
        vvc.resize(H + 2, vector<char>(W + 2));
        rep(i, 1, H + 1) {
            rep(j, 1, W + 1) {
                cin >> vvc[i][j];
            }
        }

    }

    void solve() {
        input();
        for (int i = 1; i <= H; ++i) {
            for (int j = 1; j <= W; ++j) {
                if (vvc[i][j] == '#') {
                    bool flag = false;
                    int di[] = {1, 0, -1, 0};
                    int dj[] = {0, 1, 0, -1};

                    rep(k, 0, 4) {
                        int I = i + di[k];
                        int J = j + dj[k];
                        if(vvc[I][J] == '#'){
                            flag = true;
                        }
                    }
                    if(!flag){
                        cout << "No" << endl;
                        exit(0);
                    }
                }
            }
        }
        cout << "Yes" << endl;

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))

bc = [list(map(int, input().split())) for _ in range(m)]

bc.sort(reverse=True, key=lambda x: x[1])

count = 0

for b, c in bc:
    count += b
    if count > n:
        add = n - count + b
        a.extend([c] * add)
        break
    else:
        a.extend([c] * b)
        
print(sum(sorted(a, reverse=True)[:n]))

Measured memory_bytes: 36036
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
	 public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        long N = sc.nextLong();
	        
	        long ans= (N/500) *1000;
	        ans=ans+((N%500)/5) *5;	        
        	System.out.println(ans);
	        	        
	 }
}

Measured memory_bytes: 23892
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;


namespace atcorder2
{
    class Program
    {
        public static long Read()
        {

            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

       
        public static long gcd(long a,long b)
        {
            if (a < b) gcd(b, a);
            while (b > 0)
            {
                long z = b;
                b = a % b;
                a = z;
            }
            return a;
        }
        public static long lcm(long a,long b)
        {
            return a * b / gcd(a, b);
        }




        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var nm = Reads();
            var n = nm[0];
            var m = nm[1];
            var s = ReadLine().ToArray();
            var t = ReadLine().ToArray();

            bool f = true;
            long g = lcm(n, m);
            long a = g / n;
            long b = g / m;
            long ab = lcm(a, b);
            long c = 1;

            long i = 0;
            long j = 0;
            f = false;
            while (i < n && j < m)
            {
                if (s[i] != t[j]) f = true;
                i += b;
                j += a;
            }


            WriteLine(f ? -1 : g);
            




            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 13152
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;

ll a,b;

int main(){FIN

    ll n,m;cin>>n>>m;
    vector<P> v;
    REP(i,m){
        cin>>a>>b;
        v.push_back(make_pair(a,b));
    }
    VSORT(v);
    ll start = v[0].first;
    ll end = v[0].second;
    ll ans = 1;
    FOR(i,1,m-1){
        a=v[i].first;
        b=v[i].second;
        if (a>=end){
            ans++;
            start = a;
            end=b;
        }
        else{
            start=a;
            end=min(b,end);
        }
        // cout<<start<<end<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);

  rep(i, n) cin >> a[i];
  vector<ll> d;

  rep(i, n) {
    auto itr = lower_bound(d.rbegin(), d.rend(), a[i]);
    if (itr == d.rbegin())
      d.emplace_back(a[i]);
    else
      *--itr = a[i];
  }
  cout << d.size() << endl;
  return 0;
}

Measured memory_bytes: 5040
#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
using namespace std;
inline int read(){
	int v=0,f=1;
	char c=getchar();
	while (c<'0' || c>'9'){
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9'){
		v=v*10+c-'0';
		c=getchar();
	}
	return v*f;
}
const int Maxn=6005;
const int B=3000;
int n,mod;
int dp[Maxn][9005];
void Add(int &x,int y){
	x+=y;
	if (x>=mod) x-=mod;
}
int main(){
	scanf("%d %d",&n,&mod);
	dp[0][B]=1;
	
	for (int i=0;i<3*n;i++){
		for (int j=0;j<=9000;j++){
			if (dp[i][j]){
			//	cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
				Add(dp[i+1][j+1],dp[i][j]);
				Add(dp[i+2][j-1],1ll*dp[i][j]*(i+1)%mod);
				Add(dp[i+3][j],1ll*dp[i][j]*(i+2)*(i+1)%mod);
			}
		}
	}
	int ans=0;
	for (int j=B;j<=9000;j++) Add(ans,dp[3*n][j]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 209664
(* --------------Encoder-------------- *)
(* -----function----- *)
(*
let encoder = 0
*)

(* -------test------- *)
(* ----------------------------------- *)

(* --------------Decoder-------------- *)
(* -----function----- *)
(*
let decoder ans = ""
*)

(* -------test------- *)
(* ----------------------------------- *)

(* --------------Processor-------------- *)
(* -----function----- *)
(*
let processor dat = 0
*)

(* -------test------- *)
(* ----------------------------------- *)


(* ----------------main---------------- *)
(*
let () = print_endline (decoder (processor encoder))
*)
(* ------------------------------------ *)
let () = Scanf.scanf "%d %d" (fun a b -> print_endline @@
    if a * b mod 2 = 0 then
        "Even"
else
        "Odd")


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/

int main()
{
	ll k;
	cin >> k;

	int n = 50;
	ll a[50];

	ll num = k / n;
	ll rem = k % n;




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


	cout << n << endl;
	for (ll i = 0; i < n; i++) {
		cout << a[i];
		if (i != n) {
			cout << " ";
		}
	}


	return 0;
}

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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

vi g[100010];
int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    ll n, m; cin >> n >> m;
    rep(i,m){
        int u, v; cin >> u >> v;
        g[u].push_back(v);
    }

    int s,t; cin >> s >> t;
    vvi d(n+1, vi(3, INF));
    queue<pii> Q;
    Q.emplace(s, 0);
    d[s][0] = 0;
    while(!Q.empty()){
        pii p = Q.front(); Q.pop();
        int v = p.fi, c = p.se;
        int nc = (c + 1) % 3;
        for(auto u : g[v]){
            if(d[u][nc] == INF){
                d[u][nc] = d[v][c] + 1;
                Q.emplace(u, nc);
            }
        }
    }

    if(d[t][0] == INF) cout << -1 << endl;
    else cout << d[t][0]/3 << endl;
    return 0;
}

Measured memory_bytes: 14256
#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;

typedef long long int ll;
typedef pair<ll,ll> pp;
typedef long double ld;
typedef vector<pp> vpl;
//typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 

 
const ll N = 200001;
const ll mod = 998244353;
const long long int inf = 10000000000;

#define MP make_pair
#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++) 
#define trace(i,a) for(auto i=a.begin();i!=a.end();i++) 
#define mtrace(i,a) for(auto i=a.begin();i!=a.end();i++)  cout<<i->first<<" "<<i->second<<endl;   
 
const ld pi = 3.14159265359;

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

 
void fastIO(void);
void decimal(int);
inline ll modmulti(ll, ll);
inline ll modadd(ll, ll);
ll modpower(ll, ll);
ll gcd(ll, ll );
ll modinv(ll);



ll rem[2][2019];
int main(){
	fastIO();
	ll n;
	string s;
	cin>>s;
	n = s.size();
	rem[0][s[0]-'0']++;
	ll res;
	res = 0;
	
	rep1(i,n){
		rep(j,2019){
			
			rem[i&1][(j*10+s[i]-'0')%2019] = rem[!(i&1)][j];
		}
		rem[i&1][s[i]-'0']++;
		res += rem[i&1][0];
		//cout<<"i = "<<i<<" res = "<<res<<endl;
	}
	cout<<res<<endl;
	
}
	


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}
 
void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
inline ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
inline ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a){
   return modpower(a,mod-2);
}

Measured memory_bytes: 3796
import java.io.*;
import java.nio.CharBuffer;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int n = scanner.nextInt();
        int[] a = new int[n + 1];
        int[] b = new int[n];
        for (int i = 0; i <= n; ++i)
            a[i] = scanner.nextInt();
        for (int i = 0; i < n; ++i)
            b[i] = scanner.nextInt();
        long ans = 0;
        int t;
        for (int i = 0; i < n; ++i) {
            t = Math.min(a[i], b[i]);
            ans += t;
            a[i] -= t;
            b[i] -= t;
            t = Math.min(b[i], a[i + 1]);
            ans += t;
            a[i + 1] -= t;
            b[i] -= t;
        }
        writer.println(ans);
        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

        int nextInt() {
            return Integer.valueOf(next());
        }

        long nextLong() {
            return Long.valueOf(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 46856
using System;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            int W, H, x, y, r;
            string[] numbers;

            numbers = Console.ReadLine().Split(' ');

            W = int.Parse(numbers[0]);
            H = int.Parse(numbers[1]);
            x = int.Parse(numbers[2]);
            y = int.Parse(numbers[3]);
            r = int.Parse(numbers[4]);

            if (solve(W, H, x, y, r))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }

        static bool solve(int W, int H, int x, int y, int r)
        {
            if ((x + r <= W && x - r >= 0) && (y + r <= H && y - r >= 0))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}

Measured memory_bytes: 8756
#include<cstdio>
#include<iostream>
#include<vector>
#include<tuple>
#include<queue>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>

using namespace std;

int main(int argc, char* argv[]){
  int n;
  cin >> n;
  string s;
  long long int march[5]={};
  for(int i=0;i<n;i++){
    cin >> s;
    switch(s[0]){
      case 'M':
        march[0]++;
        break;
      case 'A':
        march[1]++;
        break;
      case 'R':
        march[2]++;
        break;
      case 'C':
        march[3]++;
        break;
      case 'H':
        march[4]++;
        break;
      default:
        break;
    }
  }
  unsigned long long int ans = 0;
  ans = march[0]*march[1]*march[2]+
        march[0]*march[1]*march[3]+
        march[0]*march[1]*march[4]+
        march[0]*march[2]*march[3]+
        march[0]*march[2]*march[4]+
        march[0]*march[3]*march[4]+
        march[1]*march[2]*march[3]+
        march[1]*march[2]*march[4]+
        march[1]*march[3]*march[4]+
        march[2]*march[3]*march[4];
  cout << ans << endl;
  return 0;
}

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

int main() {
	// your code goes here
	int b,r,g,c,s,t;
	while(cin >> b >> r >> g >> c >> s >>t && t!=0){
		int sum=0;
		sum+=15*(b+r)+16*(b*5+r*3)+g*7+c*2+s*3-t*3+100;
		cout << sum << endl;
	}
	return 0;
}

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

def f(n):
    r = []
    import math
    max_i = int(math.sqrt(n))
    for i in range(2, max_i + 1):
        while n % i == 0:
            n /= i
            r.append(i)
    if n != 1:
        r.append(n)
    return r
    

a = set(f(A))
b = set(f(B))

a_and_b = a & b
# print(a_and_b)
print(len(a_and_b) + 1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int sum[500010];
int main(){
  string s;
  cin>>s;
  for(int i=0;i<s.size();++i){
    if(s[i]=='<') sum[i+1]=sum[i]+1;
  }
  for(int i=s.size()-1;i>=0;--i){
    if(s[i]=='>') sum[i]=max(sum[i],sum[i+1]+1);
  }
  long long ans = 0;
  for(int i=0;i<s.size()+1;i++) ans+=sum[i];
  cout<<ans<<endl;
}

Measured memory_bytes: 5864
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define MAX 200005
#define INF 200005

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

ll lcm(ll i,ll j){
  if(i<j){
    swap(i, j);
  }
  ll r=i%j;
  ll x=i*j;
  while(r!=0){
    i=j;
    j=r;
    r=i%j;
  }
  return x/j;
}

int main(){
  ll a, b;
  cin >> a >> b;
  cout << lcm(a, b) << endl;
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split(' '))
A = list(map(int, input().split()))

all_A = sum(A)
limit = all_A / 4.0 / M

count = 0
for a in A:
  if a >= limit:
    count += 1
    
if count >= M:
  print('Yes')
else:
  print('No')

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

#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=12+1;
int n,m;
char s[N][N];
int dy[N];

bool same(int c1,int c2)
{
	rep(r,0,n-1)
	if(s[r][c1]!=s[dy[r]][c2])return 0;
	return 1;
}
void check()
{
	bool can=m%2;
	bool have[N]={};
	rep(c,0,m-1)
	if(!have[c])
	{
		rep(c2,c+1,m-1)
		if(same(c,c2))
		{	
			have[c]=have[c2]=1;
			break;
		}
		if(!have[c])
		{
			if(!can||!same(c,c))return ;
			have[c]=1;
			can=0;
		}
	}
	puts("YES");
	exit(0);
}

void dfs(int x,bool can)
{
	if(x>=n){check();return ;}
	if(dy[x]!=-1){dfs(x+1,can);return ;}
	if(can){dy[x]=x;dfs(x+1,0);}
	int y=x;
	while(++y<n)
	if(dy[y]==-1)
	{
		dy[x]=y;
		dy[y]=x;
		dfs(x+1,can);
		dy[y]=-1;
	}
	dy[x]=-1;
}

int main()
{
	cin>>n>>m;
	rep(i,0,n-1)scanf("%s",s[i]);
	rep(i,0,n-1)dy[i]=-1;
	dfs(0,n%2);
	puts("NO");
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <list>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS * max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x * x + y * y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;


const ll MOD = 1e9 + 7;


int main()
{
	int N;
	cin >> N;

	map <string, ll> mp;
	vector <char> vc = { 'a', 'c', 'g', 't' };

	mp[""] = 1;

	for (int i = 0; i < N; ++i)
	{
		map <string, ll> next;
		for (const auto& a : mp)
		{
			for (char c : vc)
			{
				string s = a.first + c;
				if (SZ(s) > 4)
				{
					s = s.substr(SZ(s)-4,4);
				}

				if (s=="aagc" || s == "acgc" || s == "aggc" || s == "atgc")
				{
					continue;
				}

				if (s == "agac" || s == "agcc" || s == "aggc" || s == "agtc")
				{
					continue;
				}

				if (SZ(s) >= 3)
				{
					string suffix3 = s.substr(SZ(s) - 3, 3);

					if (suffix3 == "agc" || suffix3 == "acg" || suffix3 == "gac")
					{
						continue;
					}
				}

				next[s] += a.second;
				next[s] %= MOD;
			}
		}

		mp = next;
	}

	ll ret = 0;
	for (const auto& a : mp)
	{
		ret += a.second;
		ret %= MOD;
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>

#define MAX_K 2000

using namespace std;

int K;

void put(int val, int px, int py, int (*map)[MAX_K]){
    int x=px,y=py;
    if(x>=2*K || y>=2*K) return;
    if(x<0) x=0;
    if(y<0) y=0;
    map[x][y]+=val;
}

void putsq(int x,int y,int (*map)[MAX_K]){
    put(1,x,y,map);
    put(-1,x+K,y,map);
    put(-1,x,y+K,map);
    put(1,x+K,y+K,map);
}

void mark(int x, int y, int (*point)[MAX_K]){
    if((x<K) == (y<K)){
        int px=x%K,py=y%K;
        putsq(px+1,py+1,point);
        putsq(px+1-K,py+1-K,point);
        putsq(px+1-K,py+1+K,point);
        putsq(px+1+K,py+1-K,point);
        putsq(px+1+K,py+1+K,point);
    }else{
        int px=x%K,py=y%K;
        putsq(px+1+K,py+1,point);
        putsq(px+1,py+1-K,point);
        putsq(px+1,py+1+K,point);
        putsq(px+1-K,py+1,point);
    }
}


int main(){
    int N;
    cin >> N >> K;

    int point[MAX_K][MAX_K];
    for(int i=0;i<2*K;i++){
        for(int j=0;j<2*K;j++){
            point[i][j]=0;
        }
    }

    for(int i=0;i<N;i++){
        int x,y;
        char c;
        cin >> x >> y >> c;
        if(c=='B') x+=K;
        x=x%(2*K);
        y=y%(2*K);

        mark(x,y,point);
    }

    for(int i=0;i<2*K;i++){
        for(int j=1;j<2*K;j++){
            point[i][j]+=point[i][j-1];
        }
    }
    for(int i=1;i<2*K;i++){
        for(int j=0;j<2*K;j++){
            point[i][j]+=point[i-1][j];
        }
    }

    int max=0;
    for(int i=0;i<2*K;i++){
        for(int j=0;j<2*K;j++){
            if(max<point[i][j]){
                max=point[i][j];
            }
        }
    }
    cout << max << endl;
    
    return 0;
}

Measured memory_bytes: 15872
import std.stdio,std.conv, std.algorithm, std.container,std.array,std.range,std.string,std.typecons,std.numeric;
const dx = [1,0,-1,0], dy = [0,1,0,-1];
const readMixin = q{ auto line = readln().split(); if (line.length < args.length) return;foreach(i,ref arg; args) arg = line[i].to!(typeof(arg));};
void read(T...)  (auto ref T args){ mixin(readMixin);}
void readArray(T)(auto ref T args){ mixin(readMixin);}
string toargs(string f,string a, int len){auto res = f ~ "(";for(int i;i < len ; ++i ,res ~= i != len ? ",":"")res ~= a ~ "[" ~ i.to!string ~ "]";return res ~ ")";}
//------------------------------
const coin = [10,50,100,500];
void main(){
	int total;
	for(read(total); total ; read(total), write(total ? "\n":"")){
		auto have = new int[4];
		readArray(have);
		int howMany = int.max; 
		auto uses = new int[4];
		auto haves = have.map!("iota(a+1)"); 
		foreach (I;mixin(toargs("cartesianProduct","haves",4))){
			auto tmpuses = I.array;
			auto pay = coin.dotProduct(tmpuses);	
			if (pay < total) continue;
			int tmpHowMany = have.sum + howManyCoins(pay - total) - tmpuses.sum;
			if (tmpHowMany < howMany ){
				howMany = tmpHowMany;
				uses = tmpuses;
			}
		}
		foreach(i,u;uses){if(u >0)writeln(coin[i]," ",u);}
	}
}
int howManyCoins(int pay){
	int res;
	foreach_reverse(c;coin){
		while(pay >= c){ 
			pay -= c;res ++;
		}
	} 
	return res;
}

Measured memory_bytes: 3196
#include<iostream>
#include<vector>
using namespace std;
vector<int> A,M;
int n,q;
bool solve(int p,int t){
	if(t==0)	return true;
	if(p>=n)	return false;
	if(solve(p+1,t - A.at(p))||solve(p+1,t))
				return true;
	else
				return false;
}
int main(){
	int temp;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> temp;
		A.push_back(temp);
	}
	cin >> q;
	for(int i=0;i<q;i++){
		cin >> temp;
		M.push_back(temp);
		if(solve(0,temp))
			cout<< "yes" << endl;
		else
			cout<< "no" << endl;
	}
	
	return 0;
}

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

double H;

signed main(){
    cin >> H;
    H = log2(H)+1;
    //cout << H << endl;
    ll L = H;
    //cout << L << endl;
    ll X = pow(2.0, L)-1;
    cout << X << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int n, m;
        cin >> n >> m;
        for(int i = 1; i <= m; i++){
            int u, v;
            cin >> u >> v;
            g[u].pb(v);
            g[v].pb(u);
        }
        vector<int> d(n + 1, INF);
        vector<int> ans(n + 1);
        queue<int> q;
        q.push(1);
        d[1] = 0;
        while(!q.empty()){
            int v = q.front();
            q.pop();
            for(int u : g[v]){
                if(d[u] > d[v] + 1){
                    d[u] = d[v] + 1;
                    ans[u] = v;
                    q.push(u);
                }
            }
        }
        for(int i = 1; i <= n; i++){
            if(d[i] == INF){
                cout << "No\n";
                return 0;
            }
        }
        cout << "Yes\n";
        for(int i = 2; i <= n; i++){
            cout << ans[i] << '\n';
        }
    }
}


Measured memory_bytes: 42552
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


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

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

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


    vector<int> just(n);
    for (int i = 0; i < n; i++) {
        just[i] = a[i] - b[i];
    }


    ll ans = 0;
    for (ll e : just) {
        if (e >= 0) {
            ans += e;
        }

    }

    cout << ans;






}

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

int main(){
	int i, ans = 0;
	string S, T = "CODEFESTIVAL2016";
	cin >> S;
	for(i = 0; i < S.size(); i++){
		if(S[i] != T[i]){
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#define D(x) (x*x)
using namespace std;
int main(){
	while(1){
		int l[4],r,n;
		double m;
		for(int i=0; i<3; i++) cin >> l[i];
		if(l[0]+l[1]+l[2]==0) break;
		sort(l, l+3);
		m = sqrt(D(l[0])+D(l[1]))/2;
		cin >> n;
		while(n--){
			cin >> r;
			if(r>m) cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
	return(0);
}

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

int main(){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);

    if( (a+b>c && b+c>a && c+a>b) && (a==b && b==c) ){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n;
	cin >> n;
	vector<int> p(n);
	for(int i=0;i<n;i++){
		cin >> p.at(i);
	}
	int c;
	c=0;
	for(int i=0;i<n-2;i++){
		if(p.at(i+1)<max(p.at(i),p.at(i+2))&&p.at(i+1)>=min(p.at(i),p.at(i+2))){
			c++;
		}
	}
	cout << c <<endl;
}

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

class Main {

	void solve() {
		
		out.println((char)(inchar()+1));
		
	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

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

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}

	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

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

#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll,ll> 
#define ld long double

const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);

ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T, U> &p)
{ 
    return os<<'('<<p.F<< ","<<p.S<<')'; 
}

const int N = 300005;

vector<int> v[N];

struct node
{
	ll mx;
}fake={-INF};
	// base value is assigned to fake node
struct SEGTREE
{
	ll a[N];
	SEGTREE(){ mem0(a); }
	node tree[4*N];
	ll lazy[4*N];
	inline node combine(node a,node b)
	{
		node ret;
		ret.mx=max(a.mx,b.mx);
		return ret;
	}
	inline node make_node(ll val)
	{
		node ret;
		ret.mx=val;
		return ret;
	}
	void buildTree(ll v,ll st,ll en)
	{
		if(st==en)
		{
			tree[v]=make_node(a[st]);
			return ;
		}
		ll mid=(st+en)>>1;
		buildTree(v<<1,st,mid);
		buildTree(v<<1 | 1,mid+1,en);
		tree[v]=combine(tree[v<<1],tree[v<<1 | 1]);
	}
	void update(ll v,ll st,ll en,ll in,ll val)
	{
		ll mid=(st+en)>>1;
		if(st==en)
		{
			tree[v]=make_node(val+a[st]);
			a[st]+=val;
			return ;
		}
		if(in<=mid)
			update(v<<1,st,mid,in,val);
		else
			update(v<<1 | 1,mid+1,en,in,val);
		tree[v]=combine(tree[v<<1],tree[v<<1 | 1]);
	}
	node query(ll v,ll st,ll en,ll l,ll r)
	{
		if(en<l || st>r)
			return fake;
		if(st>=l && en<=r)
			return tree[v];
		ll mid=(st+en)>>1;
		return combine(query(v<<1,st,mid,l,r),query(v<<1 | 1,mid+1,en,l,r));
	}
}seg;

int _runtimeTerror_()
{
	int h,w,m;
	cin>>h>>w>>m;
	for(int i=0;i<=w;++i)
		seg.a[i]=0;
	for(int i=0;i<m;++i)
	{
		int x,y;
		cin>>x>>y;
		v[x].pb(y);
		seg.a[y]++;
	}
	seg.buildTree(1,0,w);
	ll ans = 0;
	for(int i=1;i<=h;++i)
	{
		for(int j:v[i])
			seg.update(1,0,w,j,-1);
		amax(ans,v[i].size()+seg.query(1,0,w,0,w).mx);
		for(int j:v[i])
			seg.update(1,0,w,j,1);
	}
	cout<<ans<<"\n";
	return 0;
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#ifdef runSieve
		sieve();
	#endif
	#ifdef NCR
		initialize();
	#endif
	int TESTS=1;
	//cin>>TESTS;
	while(TESTS--)
		_runtimeTerror_();
	return 0;
}

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

int n, c[499], s[499], f[499], ans;

int main() {
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        scanf("%d %d %d", &c[i], &s[i], &f[i]);
    }
    for (int i = 0; i < n; i++) {
        ans = 0;
        for (int j = i; j < n - 1; j++) {
            if (ans <= s[j]) {
                ans = s[j];
            } else if (ans % f[j] != 0) {
                ans = ans + f[j] - ans % f[j];
            }
            ans += c[j];
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe
    
int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
int n,l,ans =0;
cin >> n >> l;
if (l>0)
{   int i;
    for(i=2;i<n+1;i++){
        ans += l+i-1;
    }
    cout << ans << endl;
}else if (l<=0 && (l+n-1)>=0)
{   int i;
    for( i=1;i<n+1;i++){
        ans += l+i-1; 
    }
    cout << ans << endl;
}else if(l<0 && (l+n-1)<0)
{   int i;
    for( i=1;i<n;i++){
        ans += l+i-1;
    }
    cout << ans << endl;
}


//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <iostream>
#include<map>
#include<vector>
#include<cmath>
#include<cstring>
#include<climits>
#include<queue>
#include<unordered_set>
#include<algorithm>
#include<iomanip>
#include <set>
#define ll long long int
using namespace std;
const ll mod=1e9+7;
double pi=3.1415926535;

ll gcd(ll a,ll b){if(b == 0){return a;} return gcd(b, a % b);}
ll power(ll a,ll n){ll res=1;while(n){if(n%2){res=res*a;}n=n/2;a=a*a;}return res;}
bool checkprime(ll n){for(ll i=2;i*i<=n;i++){if(n%i==0){return false;}}return true;}
ll mpow(ll a,ll n){ll res=1;while(n){if(n%2){res=(res*a)%mod;}a=(a*a)%mod;n=n/2;}return res;}


void solve()
{
	ll n,d,cnt=0;
	cin>>n>>d;
	while(n--){
		ll p,q;
		double s;
		cin>>p>>q;
		s=p*p+q*q;
		s=sqrt(s);
		if(s<=d){
			cnt++;
		}
	}
	cout<<cnt<<endl;
}
int main()
{
	
	ll t=1;
    //cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}


	//for(int i=1;i<=ma;i++){cout<<dp[i]<<" ";if(dp[i]==1){cnt++;}}
	//cout<<endl;

Measured memory_bytes: 3612