akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        

        Scanner sc = new Scanner(System.in);

        String S =sc.next();
        String [] List = S.split("");
        int i=0;
        int[] ans =new int[4];
        int answer=0;
        int tmp =0;
        for(i=0;i<List.length;i++){
            
            ans[i]=Integer.parseInt(List[i]);
            
        }
        
        if(ans[0]+ans[1]+ans[2]+ans[3]==7){
            answer=ans[0]+ans[1]+ans[2]+ans[3];
            System.out.println(ans[0]+"+"+ans[1]+"+"+ans[2]+"+"+ans[3]+"="+answer);
            return;
            
        }else if(ans[0]-ans[1]+ans[2]+ans[3]==7){
            
            answer=ans[0]-ans[1]+ans[2]+ans[3];
            System.out.println(ans[0]+"-"+ans[1]+"+"+ans[2]+"+"+ans[3]+"="+answer);
            return;
            
        }else if(ans[0]+ans[1]-ans[2]+ans[3]==7){
            
            answer=ans[0]+ans[1]-ans[2]+ans[3];
            System.out.println(ans[0]+"+"+ans[1]+"-"+ans[2]+"+"+ans[3]+"="+answer);
            return;
            
        }else if(ans[0]+ans[1]+ans[2]-ans[3]==7){
            
            answer=ans[0]+ans[1]+ans[2]-ans[3];
            System.out.println(ans[0]+"+"+ans[1]+"+"+ans[2]+"-"+ans[3]+"="+answer);
            return;
            
        }else if(ans[0]-ans[1]-ans[2]+ans[3]==7){
            
            answer=ans[0]-ans[1]-ans[2]+ans[3];
            System.out.println(ans[0]+"-"+ans[1]+"-"+ans[2]+"+"+ans[3]+"="+answer);
            return;
            
        }else if(ans[0]-ans[1]+ans[2]-ans[3]==7){
            
            answer=ans[0]-ans[1]+ans[2]-ans[3];
            System.out.println(ans[0]+"-"+ans[1]+"+"+ans[2]+"-"+ans[3]+"="+answer);
            return;
            
        }else if(ans[0]+ans[1]-ans[2]-ans[3]==7){
            
            answer=ans[0]+ans[1]-ans[2]-ans[3];
            System.out.println(ans[0]+"+"+ans[1]+"-"+ans[2]+"-"+ans[3]+"="+answer);
            return;
            
        }else if(ans[0]-ans[1]-ans[2]-ans[3]==7){
            
            answer=ans[0]-ans[1]-ans[2]-ans[3];
            System.out.println(ans[0]+"-"+ans[1]+"-"+ans[2]+"-"+ans[3]+"="+answer);
            return;
            
        }
        
    }
    
} 


Measured memory_bytes: 39744
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

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; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

int calc(vector<int>& x, int idx) {
  auto itr = upper_bound(ALL(x), idx);
  if (itr == x.end()) return 0;
  int pos = itr - x.begin();
  int ans = x.size() - pos;
  return ans;
}

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

  int n;
  cin >> n;
  string s;
  cin >> s;

  vector<int> r;
  vector<int> g;
  vector<int> b;
  rep(i, s.size()) {
    if (s[i] == 'R') r.push_back(i);
    else if (s[i] == 'G') g.push_back(i);
    else if (s[i] == 'B') b.push_back(i);
  }

  ll ans = 0;

  for (int i = 0; i < s.size() - 3; i++) {
    for (int j = i+1; j < s.size() -1; j++) {
      if (s[i] == s[j]) continue;
      int badidx = j + (j-i);
      if (s[i] != 'B' && s[j] != 'B') {
        ans += calc(b, j);
        if (badidx < s.size() && s[badidx] == 'B') ans--;
      } else if (s[i] != 'G' && s[j] != 'G') {
        ans += calc(g, j);
        if (badidx < s.size() && s[badidx] == 'G') ans--;
      } else if (s[i] != 'R' && s[j] != 'R') {
        ans += calc(r, j);
        if (badidx < s.size() && s[badidx] == 'R') ans--;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3660
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

N, X = map(int, input().split())
V = list(map(int, input().split()))
V.append(X)
V.sort()
vD = {V[i+1]-V[i] for i in range(len(V)-1)}

res = min(vD)
for d in vD:
    res = gcd(res, d)
    if res <= 1:
        break
print(res)

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

//a,b x
int main(){
	ll N,A,B; cin>>N>>A>>B;
	if(N==1){
		cout<<(A==B?1:0);
	}
	else{
		if(A>B) cout<<0;
		else if(A==B) cout<<1;
		else{
			cout<<(2-N)*A+(N-2)*B+1;
		}
	}
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int My_Inf=2147483647;
const long long int My_LInf=9223372036854775807;
//左辺に底　右辺に真数
long double mlog(const long double base, const long double anti) {
	return log(anti) / log(base);
}
int main() {
	int N; cin >> N;
	int a = mlog(3, N) - 1e-11;
	cout << a + 1 << endl;
	return 0;
}

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010;
const double eps = 1e-6;

int stk[N], tt = 0;
string s;

int main()
{
    cin >> s;
    for(int i = 0; i < s.size(); i++)
    {
        char c = s[i];
        if(!tt || stk[tt] == c) stk[++tt] = c;
        else tt--;
    }

    cout << s.size() - tt << endl;
    return 0;
}


Measured memory_bytes: 896
#include<iostream>
using namespace std;
int main()
{
  int N,K,count=0;
  cin>>N;
  cin>>K;
  int ht[N];
  for(int i=0;i<N;i++)
  {
    cin>>ht[i];
  }
  for(int j=0;j<N;j++)
  {
    if(ht[j]>K||ht[j]==K)
    {
      count=count+1;
    }
  }
  cout<<count;
  return 0;
}

Measured memory_bytes: 640
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
N,Q = map(int,input().split())
 
AB = [[int(x) for x in input().split()] for _ in range(N-1)] 
PX = [[int(x) for x in input().split()] for _ in range(Q)]

ki = [[]for _ in range(N)]
for a,b in AB:
    a-=1
    b-=1
    ki[a].append(b)
    ki[b].append(a)
point = [0]*(N)
for p,x in PX:
    p-=1
    point[p]+=x
def dfs(now, last ,add):
    point[now]+= add
    for x in ki[now]:
        if (x == last):continue
        dfs(x,now,point[now])
dfs(0,0,0)
print(*point)
    
    

Measured memory_bytes: 297164
N = int(input())
a = list(map(int, input().split()))

color = [0] * 9
for i in range(N):
  if a[i] < 400:
    color[0] += 1
  elif a[i] < 800:
    color[1] += 1
  elif a[i] < 1200:
    color[2] += 1
  elif a[i] < 1600:
    color[3] += 1
  elif a[i] < 2000:
    color[4] += 1
  elif a[i] < 2400:
    color[5] += 1
  elif a[i] < 2800:
    color[6] += 1
  elif a[i] < 3200:
    color[7] += 1
  else:
    color[8] += 1
#print(color)
tmp = 0
for i in range(8):
  if color[i] > 0:
    tmp += 1
color_min = max(tmp, 1)
color_max = tmp + color[8]
print("{0} {1}".format(color_min, color_max))

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

using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)for(auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); blockTime.second;debug("%s: %.5lf s\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()/1000.0), blockTime.second = false)

template <typename T>std::string NumberToString ( T Number ){std::ostringstream ss; ss << Number;return ss.str(); } // Usages NumberToString(3)
template <typename T>T StringToNumber ( const string &Text ){istringstream ss(Text);T result;return ss >> result ? result : 0;} // StringToNumber<int>("3")

string StrCpy(string str, long long int start, long long int end){string temp = "";for(long long int i=start; i<=end; i++){temp += str[i];}return temp;}

#define ull unsigned long long int
#define ll long long int 
#define gcd(a, b)  __gcd(a, b)
#define lcm(a, b)  ((a*b)/gcd(a, b))




int solve(){

    int n,k;
    int snak[1000];
    cin >> n >> k;
    for (int i = 0; i < k; i++)
    {
        int m;
        int d;
        cin >> m;
        for(int j=0; j<m;j++){
            cin >> d;
            snak[d] = -1;
        }

    }
    int cnt = 0;
    for(int i=1; i<=n; i++){
        if(snak[i] != -1) cnt++;
    }

    cout << cnt << endl;
    
    
    return 0;
}

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

    time__("programm time"){
        solve();
	}
    return 0;

}

Measured memory_bytes: 3780
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
	ll n;
	cin >> n;
	cout << 0 << endl;
	string s;
	cin >> s;
	ll d;
	if (s[0] == 'M') {
		d = 0;
	}
	else if (s[0] == 'F') {
		d = 1;
	}
	else {
		return 0;
	}
	long long low = 0;
	long long high = (n - 1) / 2;

	while (low < high) {
		long long mid = (high + low) >> 1;
		cout << mid * 2 << endl;
		cin >> s;
		ll d1;
		if (s[0] == 'M') {
			d1 = 0;
		}
		else if (s[0] == 'F') {
			d1 = 1;
		}
		else {
			return 0;
		}
		if (d != d1) {
			high = mid;
		}
		else {
			low = mid + 1;
		}
	}
	cout << low*2 << endl;
	cin >> s;
	if (s[0] == 'M') {
		d = 0;
	}
	else if (s[0] == 'F') {
		d = 1;
	}
	else {
		return 0;
	}
	cout << low*2-1 << endl;
	cin >> s;
	if (s[0] == 'M') {
		d = 0;
	}
	else if (s[0] == 'F') {
		d = 1;
	}
	else {
		return 0;
	}
	return 0;
}

Measured memory_bytes: 852
#include<stdio.h>
#include<math.h>

int main(){
    
    double r, are, circ;
    
    scanf("%lf", &r);
    
    are = r * r * M_PI;
    circ = 2 * r * M_PI;
    
    printf("%.6f %.6f\n", are, circ);
    
    return 0;
}


Measured memory_bytes: 2760
#pragma region include
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 4e18;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())input(f[i]); input(r...); }
#pragma endregion
 
int main() {
    string s; cin >> s;
    vector<int> ans(s.size(),0);
    REP(i, s.size()) {
        int cnt = 0;
        while (s[i] == 'R') {
            cnt++;
 
            i++;
        }
        ans[i - 1] += (cnt + 1) / 2;
        ans[i] += cnt / 2;
        cnt = 0;
        int t = i;
        while (s[i] == 'L') {
            if (cnt % 2 == 0) {
                ans[t]++;
            }
            else {
                ans[t - 1]++;
            }
            cnt++;
            i++;
        }
        i--;
    }
    REP(i, ans.size()) {
        cout << ans[i] << endl;
    }
    getchar(); getchar();
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 1e9+7;


int main(){
    int X, Y; cin >> X >> Y;
    if(Y % 2 == 0 && 2*X <= Y && Y <= 4*X) cout << "Yes" << endl;
    else cout << "No" << endl;

}

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

const ll MAXN = 200000;

ll N, M, ans=0, tmp=0;
vector<ll> A(MAXN, 0);

void yakusuu() {
    for(int i=1;i*i<=M;i++) {
        if(M%i==0&&i*N<=M) ans = max(ans, i);
        if(M%i==0&&M/i*N<=M) ans = max(M/i, ans);
    }
}

signed main(){
    cin >> N >> M;
    yakusuu();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt(), b = in.nextInt(), x = in.nextInt();
        if(a <= x && x <= a + b) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[n];
  map<int,int> mp;
  rep(i,n){
    cin>>a[i];
    mp[a[i]]++;
  }
  map<int,int> mn;
  int ans=0;
  for(auto itr=mp.begin();itr!=mp.end();itr++){
    int num=itr->S;
    mn[itr->F]=(num - 1);
    ans+=(num*(num-1))/2;
  }
  rep(i,n){
    cout<<ans-mn[a[i]]<<endl;
  }

  return 0;
}


Measured memory_bytes: 18944
(let* ((n (read))
       (s (make-array `(,(1+ n))))
       (p (make-array `(,(1+ n))))
       (j (make-array `(,n))))
  ; read
  (loop :for i :from 1 :to n
        :do (progn 
              (setf (aref j (1- i)) i)
              (setf (aref s i) (string-downcase (symbol-name (read))))
              (setf (aref p i) (read))))
  ;
  (setf j (sort j (lambda (a b)
                    (or (string< (aref s a) (aref s b))
                        (and (string= (aref s a) (aref s b))
                             (> (aref p a) (aref p b)))))))
  (loop :for i :across j
        :do (format t "~A~%" i)))


Measured memory_bytes: 24652
#include <stdio.h>          // printf(), scanf()
#include <stdlib.h>         // qsort()
#include <stdbool.h>

#define MAX_N 1000
#define MAX_V 10000
#define min(a, b) ((a) < (b) ? a : b)

int a[MAX_N];
int n;

int
cmp_func(const void *l_, const void *r_)
{
	const int* l = (const int*) l_;
	const int* r = (const int*) r_;

	if (*l < *r)
		return -1;

	if (*l > *r)
		return 1;

	return 0;
}

int
solve()
{
	int b[MAX_N];
	int t[MAX_V + 1];
	bool v[MAX_N];
	int i;

	int ans = 0;
	for (i = 0; i < n; ++i)
	{
		b[i] = a[i];
		v[i] = false;
	}

	qsort(b, n, sizeof(int), cmp_func);
	for (i = 0; i < n; ++i)
		t[b[i]] = i;

	for (i = 0; i < n; ++i)
	{
		if (v[i])
			continue;

		int cur = i;
		int s = 0;
		int m = MAX_V;
		int an = 0;
		while (true)
		{
			v[cur] = true;
			an++;
			int u = a[cur];
			if (u < m)
				m = u;

			s += u;
			cur = t[u];
			if (v[cur])
				break;
		}

		ans += min(s + (an - 2) * m, s + m + (an + 1) * b[0]);
	}

	return ans;
}

int
main(int argc, char** argv)
{
	int i;

	scanf("%d", &n);
	for (i = 0; i < n; ++i)
		scanf("%d", &a[i]);

	printf("%d\n", solve());
	return 0;
}

Measured memory_bytes: 664
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a,b;
    cin>>a>>b;
    for(int i=0;i<a.size();i++){
        string tmp="";
        for(int j=i;j<a.size();j++){
            tmp+=a[j];
        }
        for(int j=0;j<i;j++){
            tmp+=a[j];
        }
        if(b==tmp){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}


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

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(2 * n);
    int s = 0;
    for (int i = 0; i < 2 * n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < 2 * n; i += 2) {
        s += a[i];
    }
    cout << s << '\n';
    return 0;
}


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

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const int  MOD=1000000007;
const int  INF= int(1e9);
const int  MAX = 1000000;
int dp[MAX],n,m,coin[50];



int main()
{
	ios_base::sync_with_stdio(false);
    cin>>n>>m;
    for(int i=0;i<MAX;i++) {
        dp[i]=INF;
    }
    for(int i=0;i<m;i++) {
        cin>>coin[i];
        dp[coin[i]]=1;
    }
    for(int i=1;i<=n;i++) {
        for(int j=0;j<m;j++) {
            if(i-coin[j] >= 0)
            dp[i] = min(dp[i-coin[j]]+1,dp[i]);

        }
    }
    cout<<dp[n]<<"\n";




	return 0;

}

Measured memory_bytes: 5100
import Data.List

main = do
  n <- readLn :: IO Int
  xs <- getLine >>= return . map read . words :: IO [Int]
  
  let
    ys = sort xs
    a = ys !! (div n 2 - 1)
    b = ys !! (div n 2)
    
  mapM_ print $ map (\x -> if x <= a then b else a) xs


Measured memory_bytes: 102140
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,L;
    cin >> N >> L;
    int S=0;
    for(int i=0; i<N; i++) S+=L+i;
     if (L<=0 && L+N-1>=0) cout << S;
     else if (abs(L)<abs(L+N-1)) cout << S-L;
       else cout << S-(L+N-1);
}

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

using namespace std;

typedef long long ll;
typedef long long ull;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<ll, ll> pll;

const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;

#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = ll(b)-1; i >= (a); i--)
#define MAPIT(i,c,k) for (auto i = (c).equal_range((k)).first; i!= (c).equal_range((k)).second; i++)

#define sz(c) ll((c).size())
#define all(c) (c).begin(), (c).end()
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define xx first
#define yy second
#define has(c, i) ((c).find(i) != (c).end())
#define DBG(X) ({ if(1) cerr << "DBGDO: " << (#X) << " = " << (X) << endl; })


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

	ll A, B, H;

	cin >> A >> B >> H;

	cout << ((A + B) * H) / 2 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>


int main()
{
    int n;
    scanf("%d",&n);
   long long int a[n],ans=100000000000;
    long long int sum=0,ln=0;
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        sum+=a[i];
    }
    for(int i=0;i<n-1;i++)
    {
        ln+=a[i];
        sum-=a[i];
       long long int k=fabs(sum-ln);
        if(k<ans)
            ans=k;
    }
    printf("%lld",ans);

}

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

int main() {
    int N;
    cin >> N;
    int64_t ans = 0;
    for (int i = 1; i <= N; ++i) {
        if (i % 3 != 0 && i % 5 != 0) {
            ans += i;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3632
n, k = map(lambda x: int(x), input().split(' '))
sunukes = [0] * int(n)
for i in range(1, k + 1):
    d = input()
    A = map(lambda x: int(x), input().split(' '))
    for a in A:
        sunukes[a - 1] = 1
result = sunukes.count(0)
print(result)


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

using namespace std;

typedef double D;
typedef long long int LL;

#define st first
#define nd second
#define pb push_back
#define PLL pair <LL, LL>
#define PII pair <int, int>

const int N = 1e6 + 7;
const int MX = 1e9 + 7;
const LL INF = 1e18 + 9LL;

int n;
int last = -1;
int cnt = N;

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

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
lis = [0] * (n+1)
lis[-1] = a[-1]
for i in range(2, n+2):
    lis[-i] = lis[-i + 1] + a[-i]
now = 1
ans = 0
for i in range(n+1):
    if a[i] > now:
        print(-1)
        exit()
    node = min(now, lis[i])
    ans += node
    node -= a[i]
    now = 2 * node
print(ans)

Measured memory_bytes: 83444
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int D,N;
	cin>>D>>N;
	if (D==0){
		if (N<100){
			cout<<N<<endl;
		}else{
			cout<<101<<endl;
		}
		return 0;
	}
	int d=100;
	for (int i=1;i<=D-1;i++){
		d*=100;
	}
	if (N<100){
		d*=N;
	}else{
		d*=(N+1);
	}
	cout<<d<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	std::string s,t;
	std::cin >> s >> t;
	std::cout << ((s==t.substr(0,s.l_ength()))?"Yes":"No") << std::endl;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#include<map>
#include<iomanip>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using pdd = pair<double,double>;
using vvi = vector<vector<int> >;
using vvll =  vector<vector<ll> >;

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
    string S,T; 
    cin>>S; cin>>T;
    int ss = S.length();
    int st = T.length(); //ss >= st
    int ans = 0;
    REP(i,ss - st + 1){
        int now = 0;
        REP(k,st){
            if(S[i + k] == T[k])now++;
        }
        ans = max(ans,now);
    }

    cout << st - ans << endl;
    
}



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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

vector<ll> prime(ll n){
  vector<bool> isprime(n+1,false);
  rep(i,sz(isprime)) if(i%7 == 1 or i%7 == 6) isprime[i] = true;
  isprime[1] = false;
  
  vi ans;
  FOR(i,2,n+1)
    if(isprime[i]){
      ans.pb(i);
      for(int j = 2 * i; j <= n; j += i) isprime[j] = false;
    }
  return ans;
}

int main(){
#define int ll
  vi p = prime(300000);
  dump(p);
  
  while(1){
    int n; cin >> n; if(n == 1) break;
    cout << n << ":";
    int i = 0;
    while(1){
      if(p[i] <= n and n % p[i] == 0) cout << " " << p[i];
      else if(p[i] > n) break;
      i++;
      if(i >= sz(p)) break;
    }
    cout << endl;
  }
}


Measured memory_bytes: 3348
import java.util.Scanner;
public class Main{

 public static void main(String[] args)
 {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int least = a - b;
        if(least > c){
            System.out.println(0);
            }else{
            System.out.println(c - least);
         }
        
}

}


Measured memory_bytes: 22352
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define rand rund
#define pb push_back
#define eb emplace_back

using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef unsigned long long int ull;
int MOD=1000000007;
int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void yes() {cout<<"YES"<<en; exit(0);}
void no() {cout<<"NO"<<en; exit(0);}
inline int rund() {int x576363482791fuweh=rng();return abs(x576363482791fuweh)%RAND_MAX;}
template<class T>
void prVec(vector<T> w)
{
	cout<<w.size()<<endl;
	for (int i=0;i<int(w.size())-1;++i) cout<<w[i]<<' ';
	if (w.size()) cout<<w[w.size()-1]<<endl;
}

void M998()
{
	swap(MOD,MOD2);
}

ll raand()
{
	ll a=rand();
	a*=RAND_MAX;
	a+=rand();
    return a;
}

ll raaand()
{
	return raand()*(MOD-7)+raand();
}

string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}

string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

ll sti(string a)
{
	ll k=0;
	for (int i=0;i<(int)a.size();++i)
	{
		k*=10;
		k+=a[i]-'0';
	}
	return k;
}

string its(ll k)
{
	if (k==0) return "0";
	string a;
	while (k)
	{
		a.push_back((k%10)+'0');
		k/=10;
	}
	reverse(a.begin(),a.end());
	return a;
}

ll min(ll a,int b)
{
	if (a<b) return a;
	return b;
}

ll min(int a,ll b)
{
	if (a<b) return a;
	return b;
}

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

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

ll gcd(ll a,ll b)
{
	if (b==0) return a;
	return gcd(b,a%b);
}

ll lcm(ll a,ll b)
{
	return a/gcd(a,b)*b;
}

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

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

inline int pot(int n,int k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

int divide(int a,int b)
{
	return mult(a,pot(b,MOD-2));
}

inline int sub(int a,int b)
{
	if (a-b>=0) return a-b;
	return a-b+MOD;
}

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

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

ll has(string x)
{
	ll h1=0,h2=0;
	x=to_lower(x);
	for (char a: x)
	{
		h1*=bases[0];
		h1+=a-'a';
		h1%=bases[3];
		h2*=bases[1];
		h2+=a-'a';
		h2%=bases[4];
	}
	return h1*(MOD+13893829)+h2;
}

const int N=300010;
int n;
priority_queue<ll> q;
ll res;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	for (int i=0;i<10;++i) bases.push_back((raand()%MOD+13893829)%MOD);
	while (cin>>n)
	{
		for (int i=0;i<n;++i)
		{
			ll a;
			cin>>a;
			q.push(a);
		}
		while (q.top()+res>=n)
		{
			ll e=q.top()+res;
			ll a=e/n;
			res+=a;
			q.pop();
			q.push(e-res-a*n);
		}
		cout<<res<<endl;
		while (q.size()) q.pop();
		res=0;
	}
}



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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(lint i = x ; i < n ; ++i)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; --i)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

int main(){
    lint x;
    cin >> x;
    lint ans;
    if(x % 11LL == 0LL){
        ans = x / 11LL;
        ans *= 2;
    }else if(x % 11LL <= 6LL){
        ans = x / 11LL;
        ans *= 2;
        ++ans;
    }else{
        ans = x / 11LL;
        ans *= 2;
        ans += 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int N;
int A[200005];
vector <int> V[25];
void Read()
{
    cin >> N;
    for(int i = 1; i <= N; i++)
        cin >> A[i];
}

void Solve()
{
    long long ans = 0;
    for(int i = 1; i <= N; i++)
    {
        int Max = 0;
        for(int j = 0; j < 20; j++)
        {
            if((A[i] & (1 << j)) != 0)
            {
                V[j].push_back(i);
            }
            if(V[j].size() >= 2)
                Max = max(Max, V[j][V[j].size() - 2]);
        }
        ans += i - Max;
    }
    cout << ans << "\n";
}
int main()
{
    Read();
    Solve();
    return 0;
}


Measured memory_bytes: 9024
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()

X_distance = []
for i in range(M-1):
    X_distance.append(X[i+1]-X[i])
X_distance.sort(reverse = True)

cnt = 0
for i in range(N-1, M-1):
    cnt += X_distance[i]
print(cnt)

Measured memory_bytes: 13968
#include<bits/stdc++.h>
using namespace std;
#include<math.h>
#define ll long long
#define ld long double
#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 ) ;
  string s;
  cin>>s;
  string ans( s.begin() , s.begin()+3 );
  cout<<ans;



  return 0;

}


Measured memory_bytes: 3648
#include<stdio.h>
int main (){
int A,B,C,D,sum1,sum2;
int Right,Left,Balanced;
scanf("%d%d%d%d",&A,&B,&C,&D);
sum1=A+B;
sum2=C+D;
if(sum1>sum2){
printf("Left\n");
}
else if(sum1<sum2){
printf("Right\n");
}
else if(sum1=sum2){
printf("Balanced\n");
}
return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
  long double n, m, d;
  cin >> n >> m >> d;
  double ans = 0;
  if(d == 0)
  {
    ans = 1/n * (m-1);
  }
  else
  {
    ans = 2.0*(n-d) * (m-1) / n / n;
  }
  printf("%.10lf", ans);
}

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

using namespace std;

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

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

	sort(inputs.begin(), inputs.end());
	inputs.erase(unique(inputs.begin(), inputs.end()), inputs.end());

	cout << inputs.size() << endl;
}

Measured memory_bytes: 256
N = int(input())

def divisors(n):
    re = 0
    for i in range(1,int(n**0.5)+1):
        if n % i == 0:
            if n == i**2:
                re += 1
            else:
                re += 2
    return re
ans = 0
for i in range(1,N+1,2):
    if divisors(i) == 8:
        ans += 1
print(ans)

Measured memory_bytes: 38384
#include<iostream>
#include<algorithm>

using namespace std;

int main(void){

  int n,a[31];

  fill(a,a+31,0);
  a[0]=a[1]=1,a[2]=2;

  for(int i=3;i<31;i++)
    for(int j=1;j<4;j++)
      a[i]+=a[i-j];
  
  while(cin >> n,n){
    int m=!(a[n]%365>0)?:1;
    cout << a[n]/3650+m << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars,
        t: Chars,
    }
    println!(
        "{}",
        s.windows(t.len())
            .map(|w| w
                .iter()
                .zip(t.iter())
                .fold(0, |d, (wi, ti)| d + (wi != ti) as usize))
            .min()
            .unwrap()
    );
}


Measured memory_bytes: 2164
s = sorted(list(input()))
t = sorted(list(input()), reverse=True)

s = "".join(s)
t = "".join(t)

if s == t:
    print("No")
else:
    l = sorted([s,t])
    if l[0] == s:
        print("Yes")
    else:
        print("No")

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

int main() {
    string N;
    cin >> N;
    if (N.at(0) == '7' || N.at(1) == '7') {
        cout << "Yes" << endl;
    }
    else if(N.at(2) == '7') {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3600
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, vector<T>& v){ for(auto& e : v){ out << e << d; } return out; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> as(n); cin >> as;
    // 1 3 -4 2 2 -2
    // 1 4 0  2 4 2
    vector<ll> accs(n + 1);
    for(int i = 1; i <= n; i++){
        accs[i] = accs[i - 1] + as[i - 1];
    }
    map<ll, ll> mp;
    for(auto& acc : accs){
        mp[acc]++;
    }
    ll ans = 0;
    for(auto& p : mp){
        ans += p.second * (p.second - 1) / 2;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 15104
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7
#main code here!
    n=I()
    lis=LI()
    nums=[i for i in range(10**6+1)]
    spf=[-1 for i in range(10**6+1)]
    i=2
    while i<=10**3:
        if spf[i]>=0:
            i+=1
        for j in range(1,(10**6)//i+1):
            if spf[i*j]==-1:
                spf[i*j]=i
        i+=1
    #print(spf[10**5:10**5+100])
    for i in range(10**6+1):
        if spf[i]<0:
            spf[i]=i
    #print(spf[10**5:10**5+100])
    dic=defaultdict(lambda :0)
    for i in range(n):
        x=lis[i]
        key=set()
        while x>1:
            u=spf[x]
            x//=u
            key.add(u)
        for z in key:
            dic[z]+=1
    flag=True
    #print(dic)
    for z in dic.keys():
        if dic[z]==n:
            print("not coprime")
            sys.exit()
        if dic[z]>1:
            flag=False
        
    if flag==True:
        print("pairwise coprime")
        sys.exit()
    print("setwise coprime")
                
        
            
        
            
            

            
            
            

    
            
            
            
            
        
        
        
    
        
            
        
if __name__=="__main__":
    main()


Measured memory_bytes: 217480
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    std::string s; std::cin >> s;
    std::map<char, int> m;
    for (char c : s) m[c]++;
    if (m.size() != 2) std::cout << "No" << std::endl;
    else {

        for (auto p : m) {
            if (p.second != 2) {
                std::cout << "No" << std::endl;
                return 0;
            }
        }
        std::cout << "Yes" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>

using namespace std;
typedef long long ll;

int main() {
  int N,A,bA=0,bf=0;
  cin >> N;
  ll total = 0;
  while(N--) {
    cin >> A;
    if (A < bA + bf) {
      bf = bA + bf - A;
      total += bf;
    } else {
      bf = 0;
    }
    bA = A;
  }
  cout << total << endl;
  return 0;
}


Measured memory_bytes: 3628
import sys
import numpy as np
N,M=map(int,input().split())
A=np.zeros((N,N))
B=np.zeros((M,M))
for i in range(N):
    temp=input()
    temp=temp.replace('.',"0")
    temp=temp.replace('#',"1")
    A[i] = list(map(int,list(temp)))
for i in range(M):
    temp=input()
    temp=temp.replace('.',"0")
    temp=temp.replace('#',"1")
    B[i] = list(map(int,list(temp)))

for i in range(N-M+1):
    for j in range(N-M+1):
        if np.all(B == A[i:i+M,j:j+M]):
            print("Yes")
            sys.exit()
else:
    print("No")

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

vector<int>E[100];
int d[100];
int main(){
	int n;cin>>n;
	rep(i,n){
		int u,k;cin>>u>>k;u--;
		rep(i,k){
			int v;cin>>v;v--;
			E[u].push_back(v);
		}
	}
	memset(d,0x3f,sizeof(d));
	queue<P>que;
	d[0]=0;que.push(P(0,0));
	while(!que.empty()){
		P p=que.front();que.pop();
		for(int u:E[p.second]){
			if(d[u]>p.first+1){
				d[u]=p.first+1;
				que.push(P(d[u],u));
			}
		}
	}
	rep(i,n){
		if(d[i]==INF)cout<<i+1<<" -1"<<endl;
		else cout<<i+1<<' '<<d[i]<<endl;
	}
}

Measured memory_bytes: 3136
#include <stdio.h>
#define INFTY 2000000000
 
void Merge(int*, int, int, int);
void MergeSort(int*, int, int);
 
int count=0;
 
int main(){
  int i, n=5, A[500000];
 
  for(i=0; i<n; i++){
    scanf("%d",&A[i]);
  }
  MergeSort(A,0,n);
  for(i=n-1;i>=0;i--){
    printf("%d",A[i]);
    if(i) printf(" ");
  }
  printf("\n");
   
  return 0;
}
 
void Merge(int *A, int left, int mid, int right){
  int i, j, k, n1, n2;
  int L[250002], R[250002];
  n1 = mid - left;
  n2 = right - mid;
  for(i=0;i<n1;i++)
    L[i] = A[left+i];
  for(i=0;i<n2;i++)
    R[i] = A[mid+i];
  L[n1]=INFTY;
  R[n2]=INFTY;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
      count++;
    }
    else{
      A[k]=R[j];
      j++;
      count++;
    }
  }
}
 
void MergeSort(int *A, int left, int right){
  int mid;
  if (left+1<right){
    mid = (left + right)/2;
    MergeSort(A, left, mid);
    MergeSort(A, mid, right);
    Merge(A, left, mid, right);
  }
}

Measured memory_bytes: 616
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {

	int n; cin >> n;

	int s[100], sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> s[i]; sum += s[i];
	}

	if (sum % 10 != 0) {
		cout << sum << endl; return 0;
	}

	int r = sum % 10;
	int min = 1000;
	for (int i = 0; i < n; i++) {
		if (s[i] < min && s[i] % 10 != 0) min = s[i];
	}

	if (min == 1000) { cout << 0 << endl; return 0; }

	cout << sum - min << endl;



	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#include <atcoder/all>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

ll op(ll a, ll b) {
    return max(a, b);
}

ll e() {
    return -1;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    vll vec(300010, 0);
    segtree<ll, op, e> seg(vec);
    REP(i, 0, N) {
        ll a;
        cin >> a;
        seg.set(a, seg.prod(max(0ll, a - K), min(300005ll, a + K + 1)) + 1);
    }
    cout << seg.all_prod();
}


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


int main() {
  int n;
  cin >> n;
  long ans=0;
  rep2(i,1,n+1){
    if(i%3!=0&&i%5!=0){
      ans+=i;
    }
  }
  
  
    cout<<ans<<endl;
  
  
}








Measured memory_bytes: 3620
'use strict';
function main(input) {
  input = input.split(' ');
  const a = parseInt(input[0], 10);
  const b = parseInt(input[1], 10);

  const sum = (a > 1 ? a * (a - 1) / 2 : 0) + (b > 1 ? b * (b - 1) / 2 : 0)

  console.log(sum);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>
#include <unordered_set>

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

    int year  = std::stoi(S.substr(0, 4));
    int month = std::stoi(S.substr(5, 2));
    int day   = std::stoi(S.substr(8, 2));

    if (year <= 2018) {
        std::cout << "Heisei" << std::endl;
    } else if (2019 < year) {
        std::cout << "TBD" << std::endl;
    } else {
        if (month <= 4) {
            std::cout << "Heisei" << std::endl;
        } else {
            std::cout << "TBD" << std::endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        
        String weather = sc.next();

        if (weather.equals("Sunny")) {
            System.out.println("Cloudy");
        } else if (weather.equals("Cloudy")) {
            System.out.println("Rainy");
        } else if (weather.equals("Rainy")) {
            System.out.println("Sunny");
        }
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

int main() {
	ll N;
	cin >> N;
	if(N%2==1){
		cout << 0 << endl;
		return 0;
	}
	N /= 2;
	ll ans=0;
	while(N>0){
		ans += N/5;
		N /= 5;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val as = List.fill(n)(sc.nextInt())
  var max = as.head
  var ans = 0L
  for (a <- as) {
    if (a < max) {
      ans += max - a
    } else {
      max = a
    }
  }

  println(ans)
}


Measured memory_bytes: 66176
/*AGC*/
#include<stdio.h>

int exchangesCount(int a,int b, int c){
    int as,bs,cs,i=0;
    while(a%2==0 && b%2==0 && c%2==0){
        as=(b+c)/2;
        bs=(c+a)/2;
        cs=(a+b)/2;
        i++;
        a=as;
        b=bs;
        c=cs;
    
        if(i>1000000)return -1;
    }
    return i;
}

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    
    printf("%d\n",exchangesCount(a,b,c));
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
int main(){
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int N,K,R,S,P;
    string T;
    cin >> N >> K;
    cin >> R >> S >> P;
    cin >> T;
    int ans = 0;
    for(int i = 0; i<N; i++){
        if(T[i]=='r'){
            ans+=P;

        }else if(T[i]=='s'){
            ans+=R;

        }else if(T[i]=='p'){
            ans+=S;

        }
        if(i+K<=N){
            if(T[i]==T[i+K]){
                T[i+K] = 'u';
            }
        }
    }
    cout << ans << endl;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;


int main() {
    string s;
    int h, w;
    cin >> h >> w;
    rep(i, h) {
        cin >> s;
        cout << s << endl;
        cout << s << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct book
{
    int index;
    string s;
    int p;
};
bool compareInterval(struct book i1,struct book i2)
{
    if(i1.s==i2.s)
        return(i1.p>i2.p);
    else
        return(i1.s<i2.s);
}
int main()
{
    int n,i;
    cin>>n;
    struct book a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i].s>>a[i].p;
        a[i].index=i+1;
    }
    sort(a,a+n,compareInterval);
    for(i=0;i<n;i++)
        cout<<a[i].index<<endl;
    return 0;
}


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

int main()
{
    long long t;
    map<string,long long>m;
    cin>>t;
    for(long long i=0;i<t;i++)
    {
        long long query;
        cin>>query;
        if(query==0)
        {
            long long data;
            string key;
            cin>>key>>data;
            m[key]=data;
        }
        else if(query==1)
        {
            string key;
            cin>>key;
            cout<<m[key]<<endl;
        }
    }
    return 0;
}


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

using namespace std;

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

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

    if(s.size()%2 == 0)
    {
        for(int i=1;i<s.size();i+=2)
        {
            if(s[i] != s[i-1])
            {
                cout << "No" << endl;
                return 0;
            }
        }

        cout << "Yes" << endl;
    }
    else
        cout << "No" << endl;

}

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

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

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

Measured memory_bytes: 384
import sys
def input():
	return sys.stdin.readline().strip()

N = int(input())
A = list(map(int, input().split()))

sum_A = [0]
for i in range(N):
	sum_A.append(sum_A[-1] + A[i])

min_cost = 1000000000000000000000
for i in range(N + 1):
	min_cost = min(min_cost, abs(sum_A[-1] - sum_A[i] - sum_A[i]))

print(min_cost)

Measured memory_bytes: 92580