akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

    int n;
    cin >> n;
    int minr = 2 * pow(10, 9);
    int ret = - pow(10, 9);
    for (int i = 0; i < n; i++) {
        int R;
        cin >> R;
        ret = max(ret, R - minr);
        minr = min(minr, R);
    }
    cout << ret << endl;

    return 0;
}



Measured memory_bytes: 3176
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int mod = 1e+9 + 7;

//マクロ
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main()
{
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << "\n";
  return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=5010;
const ll mod=1e9+7;


int main(){
  int r; cin >> r;
  cout << 3*r*r << endl;
  return 0;
}


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

using namespace std;


int N;
vector<int> H;

int main()
{

	cin >> N;
	H = vector<int>(N);

	for (int i = 0; i < N; i++) {
		cin >> H.at(i);
	}

	int count = 0;
	int max_c = 0;

	for (int i = 1; i < N; i++) {
		if (H.at(i - 1) >= H.at(i)) {
			count++;
		}
		else {
			max_c = max(max_c,count);
			count = 0;
		}
	}
	max_c = max(max_c, count);
	cout << max_c << endl;

	return 0;
}


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

#define int long long int
#define double long double
#define pb push_back
#define fi first
#define se second
#define vii vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define pq priority_queue<int>
#define test int tcase; cin>>tcase; for(int tc = 1; tc <= tcase; tc++)
#define inp(a,n,f) int a[n+f];for(int hh=f;hh<n+f;hh++)cin>>a[hh];
#define prdec(k) cout<<fixed<<setprecision(k);
#define mem(a,k) memset(a,k,sizeof(a))
#define ub upper_bound
#define lb lower_bound
#define mii map<int,int>
#define all(v) v.begin(),v.end()
#define inf LLONG_MAX


signed main()
{
	#ifndef ONLINE_JUDGE
   		freopen("input.txt","r",stdin);
   		freopen("output.txt","w",stdout);   
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

   	int n,x,t;
   	cin>>n>>x>>t;
   	int m=n/x;
   	if(n%x!=0)
   		m++;
   	cout<<m*t;
	return 0;
}


Measured memory_bytes: 3648
s = input()

sum = 0
tmp = 2 ** (len(s) -1)

for i in range(tmp):
    format_spec = '0{}b'.format(len(s)-1)
    flag = format(i, format_spec)
    my_sum = 0
    before = 0
    for j in range(len(s) - 1):
        if flag[j] == '1':
            my_sum += int(s[before:j+1])
            before = j+1
    my_sum += int(s[before:])
    sum += my_sum

print(sum)

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

using namespace std;
using ll = long long int;

ll dp[86];

ll ryuka(int num){
  if(dp[num] != 0) return dp[num];
  if(num == 0) return 2;
  if(num == 1) return 1;
  return dp[num] = ryuka(num-1) + ryuka(num-2);
}

int main(void){
  int n;
  cin >> n;
  cout << ryuka(n) << endl;
}

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

int main(){
    string a; cin >> a;
    int b = 0, c = 0, f = 0;
    char pre = '2';
    for(int i = 0; i < a.size(); i++){
        if(a[i] == '0'){
            if(pre == '1'){f = 1;}
            b++; pre = '0';
        }
        else{
            if(pre = '0'){f = 1;}
            c++; pre = '1';
        }
    }
    if(f == 0){
        cout << 0 << endl;
    }else{
        cout << a.size() - abs(b-c) << endl;
    }
}

Measured memory_bytes: 512
#include <stdio.h>

int main() {
	int n,m,noofways;
	scanf("%d",&n);
	scanf("%d",&m);
	if(n+m<2)
	printf("0");
	else 
	 noofways= (n*(n-1))/2 +(m*(m-1))/2;
	printf("%d\n",noofways);
	return 0;
	  
}

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

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

int main() {
    string s;
    cin >> s;
    rep(i,s.length()) cout << "x";
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc079/tasks/abc079_c
#include <bits/stdc++.h>
using namespace std;

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

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

  rep(bit, 1 << (S.size() - 1)) {
    int ans = S[0] - '0';
    string s;
    s += S[0];
    rep(i, 3) {
      char n = S[i + 1];
      if (bit & (1 << i)) {
        ans += n - '0';
        s += '+';
      } else {
        ans -= n - '0';
        s += '-';
      }
      s += n;
    }
    if (ans == 7) {
      cout << s << "=7" << endl;
      return 0;
    }
  }

  return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> height(N);
  for (int i = 0; i < N; i++) {
    cin >> height.at(i);
  }
  vector<pair<int, int>> way(M);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    way.at(i) = make_pair(a, b);
  }
  vector<bool> good(N, true);
  for (int i = 0; i < M; i++) {
    if (height.at(way.at(i).first - 1) == height.at(way.at(i).second - 1)) {
      good.at(way.at(i).first - 1) = false;
      good.at(way.at(i).second - 1) = false;
    }
    else if (height.at(way.at(i).first - 1) < height.at(way.at(i).second - 1)) {
      good.at(way.at(i).first - 1) = false;
    }
    else {
      good.at(way.at(i).second - 1) = false;
      
    }
  }
  int total = 0;
  for (int i = 0; i < N; i++) {
    if (good.at(i)) {
      total += 1;
    }
  }
  cout << total << endl; 
}

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

int main() {
  int N;
  cin >> N;
  int s1 = (N-N%1000)/1000;
  int s2 = (N%1000-N%100)/100;
  int s3 = (N%100-N%10)/10;
  int s4 = N%10;
  if (s1==s2 && s2==s3)
    cout << "Yes" << endl;
  else if (s2==s3 && s3==s4)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);

#define endl '\n'
#define D(x) cout << #x << " = " << (x) << endl;

int main() { IO;
  int n;
  cin >> n;

  long double ans = 0;
  for (int i = 1; i <= n; ++i) {
    long double x;
    string type;
    cin >> x >> type;

    if (type == "BTC") {
      x *= 380000;
    }

    ans += x;
  }

  cout << fixed << setprecision(9) << ans << endl;

  return 0;
}


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

int	main()
{
  int		N;
  int		flag;
  
  cin >> N;
  
  flag = 0;
  while(N-- > 0)
  {
    string	S;
    cin >> S;
    if (S == "Y")
    {
      flag = 1;
      break;
    }
  }
  if (flag)
    cout << "Four" << endl;
  else
    cout << "Three" << endl;
  return (0);
}


Measured memory_bytes: 256
import math as m
N,M = map(int,input().split())
mod = 10**9 + 7
if not abs(N-M) <= 1:
    print(0)
    exit()
if N == M:
    num = pow(m.factorial(N),2,mod)
    ans = pow(2*num,1,mod)
else:
    num1 = pow(m.factorial(N),1,mod)
    num2 = pow(m.factorial(M),1,mod)
    ans = pow(num1*num2,1,mod)
print(ans)

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

int main()
{
  int N;
  cin >> N;
  int t[N], x[N], y[N];
  for(int i = 0; i < N; ++i){
    cin >> t[i] >> x[i] >> y[i];
  }
  
  int nx, ny, nt;
  nx = ny = nt = 0;

  int d, td;
  for(int i = 0; i < N; ++i){
    td = t[i]-nt;
    d = abs(x[i]-nx)+abs(y[i]-ny);
    if(td < d){
      cout << "No" << endl;
      return 0;
    }
    
    if( ((td & 1) && (d & 1)) || ((td%2 == 0) && (d%2 == 0))){
    }else{
      cout << "No" << endl;
      return 0;
    }
    
    nx = x[i];
    ny = y[i];
    nt = t[i];
  }

  cout << "Yes" << endl;
}

Measured memory_bytes: 1408
h, w, k = map(int, input().split())
s = []
for i in range(h):
    s.append(list(input()))
for i in range(h):
    s.append(s[-1-i])
berry = 1
num = 1
total = 0
for i in range(h):
    if "#" not in s[i]:
        num += 1
        continue
    else:
        place = [-1]
        for j in range(len(s[i])):
            if s[i][j] == "#":
                place.append(j)
        row = []
        for j in range(len(place) - 1):
            for k in range(place[j + 1] - place[j]):
                row.append(str(berry))
            berry += 1
        for j in range(w - len(row)):
            row.append(str(berry - 1))
        for j in range(num):
            print(" ".join(row))
        total += num
        num = 1
for i in range(h - total):
    print(" ".join(row))

Measured memory_bytes: 4340
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.*;

public class Main{
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int m = sc.nextInt();
		PriorityQueue<Long> queue = new PriorityQueue<>(Collections.reverseOrder());
		for (int i = 0; i < n; i++) {
			queue.add(sc.nextLong());
		}
		while (m > 0) {
			queue.add(queue.poll() / 2);
			m--;
		}
		long ans = 0;
		for (long k :
				queue) {
			ans += k;
		}
		System.out.println(ans);
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 29056
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define ll long long

int main(){
  int a,b;cin>>a>>b;
  if(a-2*b>=0)
    cout<<a-2*b;
  else
    cout<<0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
// template<class T> T gabs(const T& x) { return max(x, -x); }
// #define abs gabs

int main() {
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import Counter
n=int(input())
v=[int(i) for i in input().split()]

v1=v[::2]
v2=v[1::2]
dic1=Counter(v1)
dic2=Counter(v2)
dic1=sorted(dic1.items(),key=lambda x:x[1],reverse=True)
dic2=sorted(dic2.items(),key=lambda x:x[1],reverse=True)

if n==2:
    if v[0]==v[1]:
        ans=1
    else:
        ans=0

elif dic1[0][0]!=dic2[0][0]:
    ans=len(v1)-dic1[0][1]
    ans+=(len(v2)-dic2[0][1])

elif dic1[0][0]==dic2[0][0] and len(v1)==dic1[0][1] and len(v2)==dic2[0][1]:
    ans=len(v2)

elif dic1[0][0]==dic2[0][0] and len(v1)==dic1[0][1] and len(v2)!=dic2[0][1]:
    ans=len(v2)-dic2[1][1]
    
elif dic1[0][0]==dic2[0][0] and len(v1)!=dic1[0][1] and len(v2)==dic2[0][1]:
    ans=len(v1)-dic1[1][1]
    
elif dic1[0][0]==dic2[0][0]:
    ans = min(len(v1)-dic1[0][1]+len(v2)-dic2[1][1],len(v1)-dic1[1][1]+len(v2)-dic2[0][1])
print(ans)


Measured memory_bytes: 19032
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

const int INF = 1000000000;

int main(){

	int m,n;
	while(cin >> m && m != 0){
		vector<pair<int,int> > seiza;
		set<pair<int,int> > pict;
		for(int i = 0; i < m; i++){
			pair<int,int> se;
			cin >> se.second >> se.first;
			seiza.push_back(se);
		}
		cin >> n;
		for(int i = 0; i < n; i++){
			pair<int,int> po;
			cin >> po.second >> po.first;
			pict.insert(po);
		}
		int minCost = INF;
		pair<int,int> dPoint;

		for(set<pair<int,int> >::iterator pit = pict.begin(); pit != pict.end(); pit++){
			// seiza[0]Ì_ðpitÉÚ®µ½àÌÆ¼èµÄvZ·é
			pair<int,int> diff;
			diff.first = -seiza[0].first + pit->first;
			diff.second = -seiza[0].second + pit->second;

			bool f = false;
			for(int i = 1; i < seiza.size(); i++){
				// »ê¼êðdiffªÀsÚ®µAÚ®ãÌêÉÀWª¶ÝµÄ¢é©ðmF
				pair<int,int> aftp;
				aftp.first = seiza[i].first + diff.first;
				aftp.second = seiza[i].second + diff.second;
				// ÀWª¶Ý
				if(pict.find(aftp) != pict.end()){

				}
				else{
					f = true;
					break;
				}
			}
			if(!f){
				if(minCost > abs(diff.first) + abs(diff.second)){
					minCost = min(minCost,abs(diff.first) + abs(diff.second));
					dPoint = diff;
				}
			}
		}
		cout << dPoint.second << " " << dPoint.first << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
    long double a,b,c;
    cin >> a >> b >> c;
    long double eps=1e-15;
    if(sqrt(a)+sqrt(b)+eps<sqrt(c)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, q;
    cin>>n>>q;
    string s;
    cin>>s;

    vl em;
    rep(i, n - 1) {
        if (s[i] == 'A' && s[i + 1] == 'C') em.push_back(i);
    }
    rep(i, q) {
        ll l, r;
        cin>>l>>r; l--; r--;
        auto lit = lower_bound(rng(em), l);
        auto rit = lower_bound(rng(em), r);
        cout<<rit - lit<<endl;
    }
}

Measured memory_bytes: 1480
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
	string S;
	cin>>S;
	char ans = '1';
	int K;
	cin>>K;
	rep(i,K){
		if(S[i]!='1'){
			ans = S[i];
			break;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
using namespace std;

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <stack>
#include <bitset>

int main() {

	int N;
	cin >> N;

	vector<int> l(N), r(N);

	rep(i, N) {
		cin >> l.at(i) >> r.at(i);
	}

	int ans = 0;

	rep(i, N) {
		ans = ans + r.at(i) - l.at(i) + 1;	
	}

	cout << ans << endl;
}

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

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

    /*
    (N)*(N+1) >= Tか調べる
    式変形して、N = (-1+sqrt(1+8t))
    */

    int t=1;

    while(1){
        if(t*(t+1)/2 >= X){
            cout<<t<<endl;
            break;
        }
        t++;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n, m, n2, m2;
	int max, x, y, flag;
	
	scanf("%d", &n);
	scanf("%d", &m);
	
	max = m;
	y = 0;
	flag = 0;
	for (x = 0; x < n; x++) {
		scanf("%d %d", &n2, &m2);
		m += (n2 - m2);
		if (max < m) {
			max = m;
		}
		if (m < 0) {
			flag = 1;
		}
	}
	max = (flag == 1) ? 0 : max;
	printf("%d\n", max);
	
	return (0);
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
const long long INF=1e15;
int n,a[200000];
long long sum=0;
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        sum=sum+a[i];
    }
    long long an=INF;
    long long snuke=0;
    for(int i=0;i<n-1;i++){
        snuke=snuke+a[i];
        an=min(an,abs(snuke*2-sum));
    }
    printf("%lld\n",an);
    return 0;
}

Measured memory_bytes: 1024
/*
    @uthor: Amit Kumar
    user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll    long long
#define ld    long double
#define ull   unsigned long long
#define all(vec) vec.begin(),vec.end()
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"Case #"<<x<<":"
#define pi 3.14159265358979323846264338327950L

const ll mod = 1e9+7;
const ll inf = 1e18;


void virus(){
          ll len;
          cin>>len;
          vector<ll> one, two;
          for(auto i=0; i<len; i++){
              ll x,y;
              cin>>x>>y;
              one.push_back(x+y); two.push_back(x-y);
          }
          cout<<max(abs(*min_element(all(one)) - *max_element(all(one))) , abs(*min_element(all(two)) - *max_element(all(two))));
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    ll t = 1;
    //cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
           cerr << "\n Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

Measured memory_bytes: 6744
a=list(input().replace("a",""))
b=list(input().replace("b",""))
c=list(input().replace("c",""))
t=0
while 1:
    if t==0:
        if len(a)==0:
            print("A")
            break
        else:
            t=ord(a.pop(0))-97
    elif t==1:
        if len(b)==0:
            print("B")
            break
        else:
            t=ord(b.pop(0))-97
    elif t==2:
        if len(c)==0:
            print("C")
            break
        else:
            t=ord(c.pop(0))-97

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

int combination(int n, int r) {
	int a;
	for (int i = 1; i <= r; i++) {
		a *= (n - i + 1) / i;
	}
	return a;
}

int main() {
	int n;
	long int total = 0;
	int lsd, msd;
	int pair[10][10] = { 0 };
	int count[11][11][200] = { 0 };
	scanf("%d", &n);
	//printf("%d\n", n);
	for (int i = 1; i <= n; i++) {
		//printf("i=%d", i);
		lsd = i % 10;
		if (lsd != 0) {
			msd = i;
			for (int j = 0; msd >= 10; j++) {
				msd /= 10;
			}
			pair[msd][lsd]++;
		}
		int a = pair[msd][lsd];
		count[msd][lsd][a] = i;
		//printf("%d:pair[%d][%d]=%d\n",i, msd, lsd, pair[msd][lsd]);
	}

	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			total += pair[i][j] * pair[j][i];
			/*
			printf("\n\npair[%d][%d]=%d\n", i, j, pair[i][j]);
			for (int k = 1; k <= pair[i][j]; k++) {
				//if(count[i][j][k]>0)
				//printf("count[%d][%d][%d]=%d   ", i, j, k,count[i][j][k]);
			}
			*/
		}
	}
	printf("%ld", total);
	return 0;
}

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

int main() {
	string S;
	cin>>S;
	int countA=0,countB=0;
	for(int i=0; i<S.size(); i++){
		if(S[i]=='A') countA++;
		else          countB++;
	}
	if(countA==3||countB==3) cout<<"No"<<endl;
	else                     cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
import Foundation

func readInts() -> [Int] {
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let lrd = readInts()
    let (l,r,d) = (lrd[0],lrd[1],lrd[2])
    var ans = 0
    for i in l...r {
        if i % d == 0{
            ans += 1
        }
    }
    print(ans)
}


main()


Measured memory_bytes: 13508
import math  # noqa: F401
from collections import deque  # noqa: F401
from typing import Deque, Dict, List, Optional, Tuple, Union  # noqa: F401


def main(N: int, S: List[str]):
    ac = 0
    wa = 0
    tle = 0
    re = 0

    for s in S:
        if s == "AC":
            ac += 1
        elif s == "WA":
            wa += 1
        elif s == "TLE":
            tle += 1
        elif s == "RE":
            re += 1

    print(f"AC x {ac}")
    print(f"WA x {wa}")
    print(f"TLE x {tle}")
    print(f"RE x {re}")


if __name__ == "__main__":
    N = int(input())
    S: List[str] = []
    for _ in range(N):
        S.append(input())
    main(N, S)


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  int N, W; cin >> N >> W;
  vi64 lst[4];
  int w, v; cin >> w >> v;
  lst[0].push_back(v);
  i64 w0 = w;
  rep(i, N - 1) {
    cin >> w >> v;
    lst[w - w0].push_back(v);
  }
  rep(i, 4) sort(all(lst[i])), lst[i].push_back(0), reverse(all(lst[i]));
  rep(i, 4) rep(j, lst[i].size() - 1) lst[i][j + 1] += lst[i][j];
  i64 ans = 0;
  rep(i, N + 1) rep(j, N + 1) rep(k, N + 1) rep(l, N + 1) {
    if (w0 * i + (w0 + 1) * j + (w0 + 2) * k + (w0 + 3) * l > W) break;
    if (i >= lst[0].size() || j >= lst[1].size() || k >= lst[2].size() || l >= lst[3].size()) break;
    amax(ans, lst[0][i] + lst[1][j] + lst[2][k] + lst[3][l]);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    string s; cin >> s;
    int a=s[0]-'0', b=s[1]-'0', c=s[2]-'0', d=s[3]-'0';
    if(a+b+c+d==7)cout << a << '+' << b << '+' << c << '+' << d << '=' << 7 << endl; 
    else if(a+b+c-d==7)cout << a << '+' << b << '+' << c << '-' << d << '=' << 7 << endl; 
    else if(a+b-c+d==7)cout << a << '+' << b << '-' << c << '+' << d << '=' << 7 << endl; 
    else if(a+b-c-d==7)cout << a << '+' << b << '-' << c << '-' << d << '=' << 7 << endl; 
    else if(a-b+c+d==7)cout << a << '-' << b << '+' << c << '+' << d << '=' << 7 << endl; 
    else if(a-b+c-d==7)cout << a << '-' << b << '+' << c << '-' << d << '=' << 7 << endl; 
    else if(a-b-c+d==7)cout << a << '-' << b << '-' << c << '+' << d << '=' << 7 << endl; 
    else if(a-b-c-d==7)cout << a << '-' << b << '-' << c << '-' << d << '=' << 7 << endl; 
}

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

public class Main {
    static int[] w = new int[100010];
    static int[] v = new int[100010];
    static int[][] dp = new int[110][100010];
    static int k;

    static int chmin(int a, int b) {
        if (a > b) {
            a = b;
            return a;
        }
        return a;
    }

    static int chmax(int a, int b) {
        if (a < b) {
            a = b;
            return a;
        }
        return a;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println((sc.nextInt() - sc.nextInt()) % sc.nextInt());
    }
}


Measured memory_bytes: 79956
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1e9;
const int MOD = 1e9+7;

int main() {
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());

    while (true) {
        int h; cin >> h;
        if(!h) break;

        vector<string> a(h);
        rep(i, h) {
            string tmp;
            rep(j, 5) {
                char x; cin >> x;
                tmp += x;
            }
            a[i] = tmp;
        }

        int ans = 0;
        bool fin = false;
        while (!fin) {
            fin = true;
            rep(i, h) {
                string row = a[h-i-1];
                FOR(num, 1, 10) {
                    if (count(all(row), num+'0')==5) {
                        ans += (num)*5;
                        fin = false;
                        rep(j, 5) a[h-i-1][j] = 'x';
                    } else if (count(all(row), num+'0')==4) {
                        bool found = false;
                        rep(j, 2) {
                            if (row[j+0]==row[j+1] && row[j+1]==row[j+2] && row[j+2]==row[j+3]) {
                                ans += num*4;
                                fin = false;
                                found = true;
                                rep(k, 4) a[h-i-1][j+k] = 'x';
                            }
                        }
                        if (!found) {
                            rep(j, 3) {
                                if (row[j+0]==row[j+1] && row[j+1]==row[j+2]) {
                                    ans += num*3;
                                    fin = false;
                                    rep(k, 3) a[h-i-1][j+k] = 'x';
                                }
                            }
                        }
                    } else if (count(all(row), num+'0')==3) {
                        rep(j, 3) {
                            if (row[j+0]==row[j+1] && row[j+1]==row[j+2]) {
                                ans += num*3;
                                fin = false;
                                rep(k, 3) a[h-i-1][j+k] = 'x';
                            }
                        }
                    }
                }
            }
            if (!fin) {
                rep(_, h) {
                    for(int i=h-1;i>0;i--) rep(j, 5) {
                        if (a[i][j]=='x' && a[i-1][j]!='x') swap(a[i][j], a[i-1][j]);
                    }
                }
            }
        }
        cout << ans << endl;
    }
}


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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef char* String;

String string_input(void){
    int i,len;
    char buf[100001];
    String str;
    scanf("%s",buf);//buf=入力した文字列が入るchar型の配列
    
    len=strlen(buf);//len=文字列の長さを表すint型変数
    NEW(str,len+1);//strはただのポインタだから、ここでNEWを使ってメモリを確保しなくちゃいけない
    for(i=0;i<len;i++){
        str[i]=buf[i];
    }
    str[len]=0;
    
    return str;
}

int main(void){
    String S=string_input();
    int N=strlen(S);

    int ans=0;
    int g=0;
    int p=0;
    for(int i=0;i<N;i++){
        if(g==p){
            if(S[i]=='p') ans--;
            g++;
        }
        else{
            if(S[i]=='g') ans++;
            p++;
        }
    }
    printf("%d\n",ans);

    return 0;
}

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

#define ll long long
#define mod 1e9+7
#define pll pair<long long,long long>
#define pdd pair<long double,long double>
#define vll vector<ll>
#define rep(i,j,n) for(int i=j;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define inf 1e17
priority_queue<pll,vector<pll>,greater<pll> >pq;
priority_queue<ll,vector<ll>,greater<ll> >pq1;

ll n;
double dp[301][301][301];
ll arr[301];

double solve(ll a,ll b,ll c){
	//cout<<a<<" "<<b<<" "<<c<<"\n";
	if(a<0||b<0||c<0)
		return 0;
	if(a==0 && b==0 && c==0)
		return 0;
	
	if(dp[a][b][c] != -1)
		return dp[a][b][c];

	double p=(1.0)*(a+b+c);

	dp[a][b][c] = 0.0;
	
	dp[a][b][c]=(a/p)*solve(a-1,b,c)+(b/p)*solve(a+1,b-1,c)+(c/p)*solve(a,b+1,c-1)+(double)n/p;
	return dp[a][b][c];	
}

int main(){
	// freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //ll n;
    cin>>n;
    ll a=0,b=0,c=0;
    
    for(int i=0;i<n;i++){
    	cin>>arr[i];
    	if(arr[i]==1)
    		a++;
    	else if(arr[i]==2)
    		b++;
    	else
    		c++;
    }
    for(int i=0;i<301;i++){
    	for(int j=0;j<301;j++){
    		for(int k=0;k<301;k++)
    			dp[i][j][k]=-1.0;
    	}
    }
    //memset(dp,-1.00,sizeof(dp));
    //dp[0][0][0]=(1.0);
    //dp[1][0][0]=(1.0);
    double ans=solve(a,b,c);
    cout<<setprecision(27)<<ans;
    return 0;
}


Measured memory_bytes: 213376
N, M = map(int, input().split())
s = []
e = []
for i in range(M):
  a, b = map(int, input().split())
  if a == 1:
    s.append(b)
  if b == N:
    e.append(a)
if set(s) & set(e):
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')


Measured memory_bytes: 21836
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try(Scanner scn = new Scanner(System.in)) {
            int r, c;
            while((r = scn.nextInt()) > 0 | (c = scn.nextInt()) > 0) {
                System.out.println(r * c % 2 > 0 ? "no" : "yes");
            }
        }
    }
}

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

int main (void){
  
  int N,A,B,train=0,taxi=0;
  scanf("%d%d%d",&N,&A,&B);
  
  train = A*N;
  taxi = B;
    
  if (train<=taxi) printf("%d",train);
  else printf("%d",taxi);
  
  return 0;
}

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

int main() {
  int N; cin >> N;
  int ans = 0;
  int M = 0;
  for (int i = 1; i <= N; i++) {
    int n = i;
    int c = 0;
    while (n % 2 == 0) {
      n /= 2;
      c++;
    }
    if (c >= M) {
      M = c;
      ans = i;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

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

	int n;
	cin >> n;
	double ans = 0;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		ans += 1 / (double)a;
	}
	ans = 1 / ans;
	printf("%.6f\n", ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 200001

using namespace std;

int main(void)
{
 //   cin.tie(NULL); ios_base::sync_with_stdio(false);
    int a, b, c; scanf("%d/%d/%d", &a, &b, &c);
    
    if(a >= 2019)
    {
        if(b > 4)
        {
            printf("TBD");
            return 0;
        }

    }
    printf("Heisei");
    
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (ll (i) = (s); (i) < (e); ++(i))
#define per(i, s, e) for (ll (i) = (s); (i) >= (e); --(i))
#define all(x) x.begin(),x.end()
 
int main(void) {
    int a, b; cin >> a >> b;
    if (a >= 10 || b >= 10) cout << -1 << endl;
    else cout << a * b << endl;

}


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

#define endl "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first 
#define ss second 
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vii vector<pii>
#define vvi vector<vi>
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

//#define int int64_t
//int a[N+2];

int32_t  main(){
	IOS;
  string s;cin>>s;
  int n=s.size();
  for(int i=0;i+1<n;++i){
    if(s[i]==s[i+1]){
      cout<<i+1<<" "<<i+2<<endl;
      return 0;
    }
  }
  for(int i=0;i+2<n;++i){
    set<char>ss;
    ss.insert(s[i]);
    ss.insert(s[i+1]);
    ss.insert(s[i+2]);
    if(ss.size()==2){
      cout<<i+1<<" "<<i+3<<endl;
      return 0;
    }
  }
  cout<<"-1 -1\n";
  return 0;
}



Measured memory_bytes: 512
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//入力
		int n = sc.nextInt();
		int[] a = new int[n];
		
		for (int i = 0; i < n - 1; i++){
			int index = sc.nextInt();
			a[index - 1] = a[index - 1] + 1;
		}
		
		for (int i = 0; i < n; i++){
			System.out.println(a[i]);
		}
	}
}

Measured memory_bytes: 62024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int N;
vector<int> p;
int main() {
  cin >> N;
  p.resize(N);
  rep(i, N) cin >> p[i];

  int ans = 0;
  for (int i = 1; i <= N; ++i) {
    if (p[i - 1] == i) {
      ans++;
      if (i <= N && p[i] == i + 1) ++i;
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
n = int(input())
score = []
for i in range(n):
    a, b = list(input().split())
    tmp = [a, int(b)]
    tmp.append(i)
    score.append(tmp)

score.sort(key=lambda x: (x[0], -x[1]))


for i in range(n):
    print(score[i][2]+1)


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

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	string S;
	cin >> S;
	if (S == "BBB" || S == "AAA")
	{
		cout << "No" << '\n';
	}
	else
	{
		cout << "Yes"<<'\n';
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
int n,a,b,c;
int mem[41][1<<16];
int dp(int id, int mask){
    if (id == n) return 1;
    if (mem[id][mask] != -1) return mem[id][mask];
    int res = 0;
    for (int i = 1; i <= 10; i++){
        int newmask = (mask<<i)|(1<<(i-1));
        /*for (int j = 0; j < 16; j++){
            printf("%d",(mask>>j)&1);
        }
        printf(" -> ");
        for (int j = 0; j < 16; j++){
            printf("%d",(newmask>>j)&1);
        }
        printf("\n");*/
        if ( ((newmask>>(a+b+c-1))&1) && ((newmask>>(b+c-1))&1) && ((newmask >> (c-1))&1) ) continue;
        else {
            res += dp(id+1,newmask&((1<<16)-1));
            if (res >= mod) res -= mod;
        }
    }
    return mem[id][mask] = res;
}
int main(){
    scanf("%d%d%d%d",&n,&a,&b,&c);
    memset(mem,-1,sizeof(mem));
    ll ans = 1;
    for (int i = 0; i < n; i++){
        ans = (ll)(ans*10)%mod;
    }
    ans = (ans+mod-dp(0,0))%mod;

    printf("%lld",ans);

}


Measured memory_bytes: 10752
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll solve(ll i,ll k,ll a[],ll n,vector<ll> &dp)
{
	if(dp[i]!=-1)
	{
		return dp[i];
	}
	ll c=LONG_LONG_MAX;
	for (ll j=1;j<=k;j++)
	{	
		if(i<n-j)
		{
			c=min(c,abs(a[i]-a[i+j])+solve(i+j,k,a,n,dp));
		}
	}
	dp[i]=c;
	return dp[i];
}
int main()
{
	ll n,k;
	cin>>n>>k;
	ll a[n];
	for (ll i=0;i<n;i++)
	{
		cin>>a[i];
	}
	vector<ll> dp(n,-1);
	dp[n-1]=0;
	dp[n-2]=abs(a[n-1]-a[n-2]);
	cout<<solve(0,k,a,n,dp);
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
 int N;
 cin >> N;
 vector<int> Vs(N);
  vector<int> Cs(N);
 for(int i = 0; i < N;i++){
   cin >> Vs.at(i);
 }
   for(int i = 0; i < N;i++){
   cin >> Cs.at(i);
 }
  
 int sum = 0;
  for(int i = 0; i < N;i++){
    if(Vs.at(i) - Cs.at(i) > 0){
      sum += Vs.at(i) - Cs.at(i);
    }
  }
  cout << sum <<  endl;

  
 
 return 0; 
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

int main() {
    string S, T;
    cin >> S >> T;
    int ans = 10000;
    rep(l,0,S.length()-T.length()+1) {
        int tmp = 0;
        rep(i,l,l+T.length()) {
            if (S[i] != T[i-l]) tmp++;
        }
        ans = min(ans,tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <iostream>

using namespace std;

const int mod = 1'000'000'007;

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

int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + mod : a;
}

int mul(int a, int b) {
  return (int)((long long)a * b % mod);
}

int pw(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b /= 2;
  }
  return res;
}

int f[100'009];

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int ans = 0;
  for (int i = m; i >= 1; --i) {
    f[i] = pw(m / i, n);
    for (int j = i * 2; j <= m; j += i) {
      f[i] = sub(f[i], f[j]);
    }
    ans = add(ans, mul(f[i], i));
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 4148
#include <bits/stdc++.h>
#include <vector>
#include<math.h>
#include<string.h>
using namespace std;
#define MAX 600005
#define MOD 1000000007
#define INF 1000000000000000000
#define EPS 0.0000000001
#define CHAINS 18
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
char s[1005];
int main()
{
    int i,n;
    char c;
    for(i=0;;i++)
    {
        scanf("%c",&c);
        if(!('a'<=c&&c<='z')) break;
        s[i]=c;
    }
    n=i;
    for(i=0;i<n;i++)
    {
        printf("%c",s[i]);
    }
    if(s[n-1]=='s') printf("e");
    printf("s");
    return 0;
}


Measured memory_bytes: 3804
#include<iostream>
#include<set>
using namespace std;
int main()
{
  int t,n,k,x,y,sum;
  multiset<int>ms;
  multiset<int>::reverse_iterator it;
  cin>>t;
  while(cin>>n>>k){
    ms.clear();
    cin>>y;
    while(--n>0){
      cin>>x;
      ms.insert(x-y);
      y=x;
    }
    sum=0;
    for(it=ms.rbegin();it!=ms.rend();it++){
      if(--k>0)continue;
      sum+=*it;
    }
    cout<<sum<<endl;
  }
}

Measured memory_bytes: 3252
#include <bits/stdc++.h>
 
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))
 
typedef long long ll;

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n,m;
  cin>>n>>m;
  
  int suma=0;
  
  rep(i,m) {
    int a;
    cin>>a;
    
    suma+=a;
  }
  
  int res=n-suma;
  
  if(res>=0) {
    cout<<res;
  }else{
    cout<<-1;
  }

  return 0;
}

Measured memory_bytes: 3604
#include<stdio.h>

int main(){
    int n;
    scanf("%d", &n);
    int a[n], b[n], c[n-1];
    for(int i=0; i<n; i++){
        scanf("%d", &a[i]);
        a[i]--;
    }
    for(int i=0; i<n; i++){
        scanf("%d", &b[i]);
    }
    for(int i=0; i<n-1; i++){
        scanf("%d", &c[i]);
    }
    int sum = b[a[0]];
    int p = a[0];
    for(int i=1; i<n; i++){    
        sum += b[a[i]];
        if(p + 1 == a[i]){
            sum += c[p];
        }
        p = a[i];
    }
    printf("%d", sum);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn = 3000050;
using namespace std;
typedef long long ll;
int a[10];
int main()
{
	int x;
	for(int i=0;i<5;i++){
		cin>>x;
		a[x]=1;
	}
	for(int i=1;i<6;i++){
		if(!a[i]){
			cout<<i;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3632
# -*- coding: utf-8 -*-

N = int(input())
S = input()

# 初期値設定
cnt = S[1:].count("E")
ans = cnt
# 結局自分と1個前しか変化しない
for i in range(1, N):
    if S[i] == "E":
        cnt -= 1
    if S[i-1] == "W":
        cnt += 1
    ans = min(ans, cnt)

print(ans)

Measured memory_bytes: 3672
import math
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")


N = I()
ans = 0

for i in range(1,N+1):
    if i%3==0 or i%5==0:
        continue
    ans +=i

print(ans)

Measured memory_bytes: 9024
#include <deque>
#include <iostream>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;

ull costFor(
	ull const& n, ull const& N, ull const& A, ull const& B, ull const& C, ull const& D, unordered_map<ull, ull>& memo);

inline ull costWithFloorAndCeilFor(
	int const& mag, ull const& cost, ull const& n, ull const& N, ull const& A, ull const& B, ull const& C, ull const& D,
	unordered_map<ull, ull>& memo) {
	auto const r = n % mag;
	auto const f = n / mag;
	auto const c = r == 0 ? n / mag : n / mag + 1;
	// f(floor(n/mag)) + cost + D*x
	auto const lower = costFor(f, N, A, B, C, D, memo) + cost + (n - f * mag) * D;
	// f(ceil(n/mag)) + cost + D*x
	auto const upper = costFor(c, N, A, B, C, D, memo) + cost + (c * mag - n) * D;
	return min(lower, upper);
}

ull costFor(
	ull const& n, ull const& N, ull const& A, ull const& B, ull const& C, ull const& D, unordered_map<ull, ull>& memo) {
	if (memo.count(n) > 0) return memo.at(n);

	return memo[n] = min({
			   costFor(1, N, A, B, C, D, memo) + (n - 1) * D,
			   costWithFloorAndCeilFor(2, A, n, N, A, B, C, D, memo),
			   costWithFloorAndCeilFor(3, B, n, N, A, B, C, D, memo),
			   costWithFloorAndCeilFor(5, C, n, N, A, B, C, D, memo),
		   });
}

inline ull test(ull const& N, ull const& A, ull const& B, ull const& C, ull const& D) {
	unordered_map<ull, ull> memo{{0, 0}, {1, D}};
	return costFor(N, N, A, B, C, D, memo);
}

int main() {
	ull T, N, A, B, C, D;
	cin >> T;

	for (int t = 0; t < T; ++t) {
		cin >> N >> A >> B >> C >> D;
		cout << test(N, A, B, C, D) << endl;
	}

	return 0;
}


Measured memory_bytes: 3924
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REPR(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define FOR(i, x, n) for (int i = x; i < (int)(n); ++i)
#define ALL(n) begin(n), end(n)
#define ll long long
#define INF 1e9
int main() {
    int l, r, d;
    cin >> l >> r >> d;
    cout << r / d - (l - 1) / d << endl;
    return 0;
}

Measured memory_bytes: 3528
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		scn.nextLine();
		char[] str = scn.nextLine().toCharArray();
		boolean[] num = new boolean[10];
		boolean[][] num2 = new boolean[10][10];
		boolean[][][] num3 = new boolean[10][10][10];
		for(int i = 0;i < N;i++) {
			int now = (int)(str[i]-'0');
			for(int a = 0;a < 10;a++) {
				for(int b = 0;b < 10;b++) {
					if(num2[a][b])num3[a][b][now] = true;
				}
				if(num[a])num2[a][now] = true;
			}
			num[now] = true;
		}
		int ans = 0;
		for(int a = 0;a < 10;a++) {
			for(int b = 0;b < 10;b++) {
				for(int c = 0;c < 10;c++) {
					if(num3[a][b][c])ans++;
				}
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 23764