akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
        int n; cin>>n;
        int a[n]; for(int i=0;i<n;i++) cin>>a[i];
        int vis[(int)1e6+5]; memset(vis,0,sizeof(vis));
        for(int i=0;i<n;i++) vis[a[i]]++; int cnt=0;
        for(int i=0;i<n;i++) {
                if(vis[a[i]]>1) continue;
                if(a[i]==1){ cnt++; continue;}
                int flag=0;
                for(int j=1;j*j<=a[i];j++){
                	if(j==1) { if(vis[j]){flag=1; break;}  }
                    else if(!(a[i]%j)&&(vis[j]||vis[a[i]/j])) {flag=1; break;}
                }
                if(!flag)cnt++;
        }
        cout<<cnt<<endl;
}


Measured memory_bytes: 8228
n,k=list(map(int,input().split()))
result=0


if k==0:
    print(n**2)
else:
    for b in range(k+1,n+1):
        amari=n%b
        if amari>=k and amari<b:
            result+=(amari-k+1)*((n//b)+1)+(b-amari-1)*((n//b))
        elif amari>=k:
            result+=(b-k)*((n//b)+1)
        else:
            result+=(b-k)*((n//b))
    print(result)

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

int main(){
    int n, sum = 0;
    cin >> n;
    int A[n];
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
        sum += A[i];
    }
    cout << sum - n  << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <queue>

int main() {
  unsigned N;
  std::cin >> N;
  std::vector<std::vector<unsigned>> G(N);
  std::vector<std::vector<unsigned>> G0(N);
  for (unsigned i = 0; i < N - 1; ++i) {
    unsigned x, y;
    std::cin >> x >> y;
    --x;
    --y;
    G0[x].push_back(y);
    G0[y].push_back(x);
  }
  unsigned K;
  std::cin >> K;
  std::vector<std::pair<int, int>> color(N);
  for (auto &i : color) {
    i.first = std::numeric_limits<int>::min() / 2;
    i.second = std::numeric_limits<int>::max() / 2;
  }
  unsigned valid_index = 0;
  for (unsigned i = 0; i < K; ++i) {
    unsigned x, y;
    std::cin >> x >> y;
    valid_index = --x;
    color[x] = std::make_pair(y, y);
  }
  std::queue<unsigned> queue;
  std::vector<unsigned> order(N);
  std::vector<unsigned> rev_order(N);
  std::vector<bool> used(N, false);
  queue.push(valid_index);
  unsigned o = 0;
  while (!queue.empty()) {
    auto x = queue.front();
    used[x] = true;
    rev_order[x] = o;
    order[o++] = x;
    queue.pop();
    for (auto &e : G0[x]) {
      if (!used[e]) { queue.push(e); }
    }
  }
  for (unsigned i = 0; i < N; ++i) {
    for (auto &e : G0[i]) {
      if (rev_order[i] < rev_order[e]) {
        G[i].push_back(e);
      }
    }
  }
  std::vector<int> odd(N);
  odd[order[0]] = color[order[0]].first % 2;
  for (unsigned t = 0; t < N; ++t) {
    auto i = order[t];
    for (auto e : G[i]) { odd[e] = odd[i] == 1 ? 0 : 1; }
  }
  for (unsigned t = N; t-- > 0;) {
    auto i = order[t];
    for (auto e : G[i]) {
      color[i].first = std::max(color[i].first, color[e].first - 1);
      color[i].second = std::min(color[i].second, color[e].second + 1);
    }
    if (color[i].first % 2 != odd[i]) { ++color[i].first; }
    if (color[i].second % 2 != odd[i]) { --color[i].second; }
    if (color[i].first > color[i].second) {
      std::cout << "No" << std::endl;
      return 0;
    }
  }
  std::vector<int> ans(N);
  ans[order[0]] = color[order[0]].first;
  for (unsigned t = 0; t < N; ++t) {
    auto i = order[t];
    for (auto e : G[i]) {
      if (color[e].first <= ans[i] - 1) {
        ans[e] = ans[i] - 1;
      } else if (ans[i] + 1 <= color[e].second) {
        ans[e] = ans[i] + 1;
      } else {
        std::cout << "No";
        return 0;
      }
    }
  }
  std::cout << "Yes" << std::endl;
  for (unsigned i = 0; i < N; ++i) {
    std::cout << ans[i] << std::endl;
  }
  return 0;
}

Measured memory_bytes: 14208
#include <stdio.h>
#include <math.h>
int abs(int n){
    if(n > 0){
        return n;
    } else {
        return -n;
    }
}

int min(int a, int b){
    if(a > b){
        return b;
    } else {
        return a;
    }
}


int main(){
  int a, b, k;
  scanf("%d %d %d", &a, &b, &k);
  int n[min(a, b)];
  int count=0;
  for(int i = 1; i <= min(a, b); i++){
      if(a%i==0 && b%i==0){
          n[count]=i;
      //    printf("%d ", n[count]);
          count++;
      }
  }
  printf("%d", n[count-k]);
  return 0;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
/*#define vector<ll> vli
#define vector<int> vii
#define vector<char> vch
#define vector<string> vst*/
#define F(i,j,k,in) for(ll i=j;i<k;i+=in)
#define DF(i,j,k,in) for(ll i=j;i>=k;i-=in)
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define Dforeach(it,l) for(auto it = l.end()-1;l.begin()-1;it--)
#define PB push_back
#define ub upper_bound
#define lb lower_bound
#define ins insert
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
using namespace std;
int main()
{
    ll n;
    cin>>n;
    ll m;
    cin>>m;
    ll A[m];
    F(i,0,m,1)
    cin>>A[i];
    ll sum=0;
    F(i,0,m,1)
    sum+=A[i];
    if(n<sum)
        cout<<"-1";
    else
    {
        cout<<n-sum;
    }

}


Measured memory_bytes: 3708
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld inf=pow(10,10);
const ld pi=acosl((ld)1);
//const ll mod = 1000000007;
const ll mod = 1000003;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

ll get(ll n,ll k){
  string s=to_string(n);
  return (s[k]-'0');
}

void solve(){
  ll n,m;cin>>n>>m;
  ll s[m];
  ll c[m];
  rep(j,m){
    cin>>s[j]>>c[j];
    s[j]--;
  }
  for(ll i=0;i<pow(10,4);i++){
    if(to_string(i).size()!=n)continue;
    bool isOK=true;
    rep(j,m){
      if(get(i,s[j])!=c[j])isOK=false;
    }
    if(isOK){
      cout<<i<<endl;
      return;
    }
  }
  cout<<-1<<endl;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	solve();
}

Measured memory_bytes: 512
s=[]
p=0
N,M=map(int,input().split())
if M==0:
    print(0)
    exit()
for i in range(N):
    a,b,c=map(int,input().split())
    s.append((a,b,c))
t=[1,-1]
from itertools import product
for ii,jj,kk in list(product(t,repeat=3)):
    u=[]
    for a,b,c in s:
        u.append(ii*a+jj*b+kk*c)
    ans=sum(sorted(u)[-M:])
    p=max(ans,p)
print(p)        
        


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


int main(){
    int n;
    cin >> n;
    /* s,h,c,d */
    vector< vector<int> > card;
    card.resize(4);
    for (int i=0;i<4;i++){
        card[i].resize(13);
        for (int j=0;j<13;j++){
            card[i][j] =0;
        }
    }

    char mark;
    int  mark_n;
    int  number;
    for (int i=0;i<n;i++){
        cin >> mark >> number;
        switch ( mark ){
            case 'S':
                mark_n = 0;
                break;
            case 'H':
                mark_n = 1;
                break;
            case 'C':
                mark_n = 2;
                break;
            case 'D':
                mark_n = 3;
                break;
            default:
                cout << "error! " << mark;
                return 1;
        }
        card[mark_n][number-1] = 1;
    }

    for (int i=0;i<4;i++){
        switch (i) {
            case 0:
                mark = 'S';
                break;
            case 1:
                mark = 'H';
                break;
            case 2:
                mark = 'C';
                break;
            case 3:
                mark = 'D';
                break;
        }
        for (int j=0;j<13;j++){
            if (card[i][j]==0){
                cout << mark << " " << j+1 << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <map>

using namespace std;

void solve()
{
	int a[5];
	while(~scanf("%d,%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]))
	{
		map<int, int> Map;
		for(int i = 0; i < 5; ++i)
		{
			++Map[a[i]];
		}
		if(Map.size() == 2)
		{
			int Max = 0;
			for(map<int, int>::iterator Ite = Map.begin(); Ite != Map.end(); ++Ite)
			{
				if(Max < Ite->second)
				{
					Max = Ite->second;
				}
			}
			if(Max == 3)
			{
				cout << "full house" << endl;
			}
			else
			{
				cout << "four card" << endl;
			}
		}
		else if(Map.size() == 3)
		{
			int Max = 0;
			for(map<int, int>::iterator Ite = Map.begin(); Ite != Map.end(); ++Ite)
			{
				if(Max < Ite->second)
				{
					Max = Ite->second;
				}
			}
			if(Max == 3)
			{
				cout << "three card" << endl;
			}
			else
			{
				cout << "two pair" << endl;
			}
		}
		else if(Map.size() == 4)
		{
			cout << "one pair" << endl;
		}
		else
		{
			map<int, int>::iterator Ite = Map.begin();
			map<int, int>::iterator IteNext = Map.begin();
			++IteNext;
			map<int, int>::iterator IteEnd = Map.end();
			IteEnd--;
			if(IteEnd->first - Ite->first == 4 || IteNext->first - Ite->first == 9)
			{
				cout << "straight" << endl;
			}
			else
			{
				cout << "null" << endl;
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long i=0; i<(int)n; i++)
#define rep2(i,a,n) for(long long i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const ll mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

ll N, M, K, H, W, L, R, X;
string S, T;

int main(){
  cin >> N;
  map<string, ll> mp;
  ll ans = 0;
  rep(i,N){
    string s; cin >> s;
    sort(all(s));
    mp[s]++;
  }
  for(auto itr : mp){
    ans += itr.second*(itr.second-1)/2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 11400
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int count = 0;
    String w = sc.nextLine();
    while(true) {
      String[] str = sc.nextLine().split(" ");
      if(str[0].equals("END_OF_TEXT")) {
        break;
      } else {
        for(int i = 0; i < str.length; i++) {
          if(str[i].toLowerCase().equals(w)) {
            count++;
          }
        }
      }
    }
    sc.close();
    System.out.println(count);
  }
}



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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1e9+7;

int main() {
	long long n, k;
	cin >> n >> k;
	long long ans = k;
	rep(i, n-1) ans *= k-1;

	cout << ans << endl;

}


Measured memory_bytes: 256
/*
    ( ´-ω･)︻┻┳══━一一一一一一一				(× _ ×)
	
	Stay Low. Go Fast
	Kill First. Die Last
	One Shot. One Kill
	No Luck. Pure Skill 
*/

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

/*************************** MACROS **************************/
#define ld long double
#define ll long long  
#define ull unsigned long long
#define loop(i,x,y) for(ll i=x;i<y;i++)
#define rloop(i,x,y) for(ll i=x;i>=y;i--)
#define vll vector<ll>
#define pb push_back
#define S second
#define F first
#define B begin()
#define E end()
#define W(x) while(x--)
#define pll pair< ll,ll >
#define vpll vector< pll >
#define qll queue<ll>
#define dqll deque<ll>
#define qpll queue<pll>
#define dqpll deque<pll>
#define pqll priority_queue<ll>
#define pqpll priority_queue<pll>
#define Line cout<<"\n**************************\n\n";

/*************************** CONST ******************************/

const ll MOD = 1000000007;
const ll MOD1 = 998244353;
const ll MIN_LL = -1e18;
const ll MAX_LL = 1e18;
const int MAX_INT = 1e9;
const int MIN_INT = -1e9;
const ld pie = 3.1415926535;
 
/************************** POW UTIL *****************************/
 
ll fpow(ll n,ll p){;ll m=1;while(p){if(p%2)m*=n;p>>=1;n*=n;}return m;}
ll mfpow(ll n,ll p,ll M){ll m=1;n%=M;while(p){if(p%2)m=(m*n)%M;n=(n*n)%M;p>>=1;}return m%M;}
 
/************************* PRINT UTIL *****************************/

template<class T> inline ostream& operator<<(ostream& o,vector<T> v){for(auto i:v)o<<i<<" ";return o;};
template<class T> inline ostream& operator<<(ostream& o,set<T> s){for(auto i:s)o<<i<<" ";return o;}
template<class T> inline ostream& operator<<(ostream& o,multiset<T> s){for(auto i:s)cout<<i<<" ";return o;}
template<class T1,class T2> inline ostream& operator<<(ostream& o,pair<T1,T2> p){o<<p.F<<" "<<p.S<<"\n";return o;}
template<class T1,class T2> inline ostream& operator<<(ostream& o,map<T1,T2> m){for(auto p:m)o<<p.F<<" "<<p.S<<"\n";return o;}

/*************************** VARIABLES **************************/

const vll days={31,28,31,30,31,30,31,31,30,31,30,31};
 
bool br,br1,br2; 
char ch,ch1,ch2;
 

ll n,m,k,x,y,z,mini,maxi,l,r,sum,t,w;
pll p,p1,p2;

string s,s1,s2;

set<ll> st,st1,st2;
multiset<ll> mst; 

map<ll,ll> mp;

/**************************** FXNS ****************************/

ll spf[(int)1e7+100];

void solve()
{

	loop(i,0,5)
	{
		cin>>x;

		if(x == 0)y = i+1;
	}

	cout<<y<<endl;

}
 
/*************************** MAIN ****************************/
 
int main(){
 
 
	// #ifndef ONLINE_JUDGE
	        // freopen("input.txt", "rt", stdin);
	        // freopen("output.txt", "wt", stdout);
	// #endif
 
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);cout.tie(NULL);

	solve();
 
	return 0;
}


Measured memory_bytes: 3544
using System;
using System.Collections.Generic;

namespace ABC177
{
    public class Program
    {
        public static void Main()
        {
            string S = Console.ReadLine();
            string T = Console.ReadLine();

            int min = T.Length;

            for (var i = 0; i < S.Length - T.Length + 1; i++)
            {
                int diff = 0;
                string part = S.Substring(i, T.Length);
                for (var j = 0; j < part.Length; j++)
                {
                    if (!part[j].Equals(T[j]))
                    {
                        diff++;
                    }
                }
                if (diff <= min)
                {
                    min = diff;
                }
            }
            Console.WriteLine(min);
        }
    }
}



Measured memory_bytes: 26152
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<functional>
#include<bits/stdc++.h>
using namespace std;

int main()
{
	int x,y,a,b,c,v;
	long long int sum =0;
	cin>>x>>y>>a>>b>>c;
	vector <int> red(a),green(b),colour(c);
	for(auto &i:red)
		cin>>i;
	for(auto &i:green)
		cin>>i;
	for(auto &i:colour)
		cin>>i;
		
	sort(red.begin(),red.end(),greater<int>());
	sort(green.begin(),green.end(),greater<int>());
	sort(colour.begin(),colour.end(),greater<int>());
	vector <int> final(x+y);
	int id =0;
	for(int i =0;i<x;i++)
		final[id++] = red[i];
	for(int i =0;i<y;i++)
		final[id++] = green[i];
	sort(final.begin(),final.end());
	id =0;
	for(int i=0;i<colour.size()&&id<x+y;i++)
	{
		if(final[id]<colour[i])
		{
			final[id] =colour[i];
			id++;
		}
	}
	
for(auto i:final)
	sum += i;
cout<<sum;
	return 0;
}




Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> napsack(vector<ll>np) {
	ll total = 0;
	for (int i = 0; i < np.size(); i++)total += np.at(i);
	vector<vector<ll>>dp(np.size()+1, vector<ll>(total+1,0));
	dp.at(0).at(0) = 1;
	for (int i = 0; i < np.size(); i++) {
		for (int j = 0; j < total + 1 - np.at(i); j++) {
			dp.at(i + 1).at(j) += dp.at(i).at(j);
			dp.at(i + 1).at(j + np.at(i)) += dp.at(i).at(j);
		}
	}
	return dp.at(np.size());
}

int main() {
	int n, a; cin >> n >> a;
	vector<ll>x(n);
	for (int i = 0; i < n; i++) {cin >> x.at(i); x.at(i) -= a;}
	ll zr = 0; vector<ll>mi; vector<ll>pl;
	for (int i = 0; i < n; i++) {
		if (x.at(i) == 0)zr++;
		else if (x.at(i) < 0)mi.push_back(-x.at(i));
		else pl.push_back(x.at(i));
	}
	vector<ll>mis = napsack(mi); vector<ll>pls = napsack(pl);
	ll ans = 0;
	for (int i = 0; i < min(mis.size(), pls.size()); i++) ans += mis.at(i) * pls.at(i);
	ans *= pow(2, zr);
	cout << ans - 1<< endl;
}

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

typedef long long ll;

ll fact[110];
void gen(int n) {
    fact[0] = fact[1] = 1;
    for(int i = 2; i <= n; i++) {
        fact[i] = i * fact[i - 2];
    }
}

int trailing(ll x) {
    string t = to_string(x);

    reverse(t.begin(), t.end());

    int res = 0;

    for(int i = 0; i < t.size(); i++) {
        if(t[i] == '0') res++;
        else return res;
    }

    return res;
}

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

    if(n & 1) {
        cout << 0 << endl;
    }
    else {
        ll ans = 0;
        ll p = 10;

        for(int i = 0; i < 26; i++) {
            ans += n / p;
            p *= 5;
        }

        cout << ans << endl;
    }


//    gen(n);
//
//    for(int i = 0; i < n; i++) {
//        cout << i << " " << fact[i] << " " << trailing(fact[i]) << endl;
//    }

}


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

int main()
{
    llong H, W;
    while (true) {
        cin >> H >> W;
        if (H == 0 && W == 0) {
            break;
        }
        REP(i,H){
            if (i == 0 || i == H-1) REP(j,W) cout << "#";
            else {
                cout << "#";
                REP(j,W-2) cout << ".";
                cout << "#";}
            cout << endl;
        }
        cout << endl;
    }


    return 0;
}

Measured memory_bytes: 3088
#include <iostream>
using namespace std ;
int main (){
string S,T,U;
int A,B;

cin>>S>>T;
cin>>A>>B;
cin>>U;
int na=A; int nb=B;

if (S==U){
  A-=1;
}else{
  B-=1;
}
cout<<A<<' ' <<B<<endl;


}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long long n;
    scanf("%lld",&n);
    long long sum =0;
    for(long long i=1;i<=n;i++)
    { if(i%15!=0 && i%3!=0 && i%5!=0)
     {
         sum=sum+i;
     }
    }
    printf("%lld",sum);
}


Measured memory_bytes: 1716
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include<stack>
#include <unordered_map>

using namespace std;

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

int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	for (int i = 0, a; i < N; i++) {
		cin >> a;
		A[i] = a-1;
	}

	int b=0;
	for (int i = 0; i < N; i++) {
		b = A[b];
		if (b == 2-1) {
			cout << i+1;
			return 0;
		}
	}
	cout << -1;
	return 0;
}


Measured memory_bytes: 640
use proconio::{input, fastout};

macro_rules! echo {
  ($val:expr) => {
    println!("{}", $val);
  }
}

#[fastout]
fn main() {
  input!{
    n: usize,
    xl: [(i64, i64);n]
  };

  let mut xl = xl;
  // xl.sort_by_cached_key(|t| t.0 + t.1); // -> 32ms
  // xl.sort_by_key(|t| t.0 + t.1);        // -> 36ms
  xl.sort_unstable_by_key(|t| t.0 + t.1);  // -> 
  let mut idx = std::i64::MIN;
  let mut ans = 0;
  for (x, l) in xl {
    if idx <= x - l {
      idx = x+l;
      ans += 1;
    }
  }
  echo!(ans);
}


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

class Main {

	void solve () {

		System.out.println(Math.max(in.nextInt()-in.nextInt()*2, 0));
		
	}

	public static PrintWriter out = new PrintWriter(System.out);
	public static Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define MOD 1000000007
#define MOD2 1000000006
#define TEMPMOD1 998244353
#define TEMPMOD2 998244352
#define INF 1000000000000000007
#define NEGINF -1000000000000000007
#define vll vector<ll> 
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define plll pair<ll,pll>
#define vpll vector<pll>
using namespace std;
typedef long long int ll;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    priority_queue<ll> pq1;
    ll n,m;
    cin>>n>>m;
    ll store;
    while(n--)
    {
        cin>>store;
        pq1.push(store);
    }
    ll top;
    while(m--)
    {
        top=pq1.top();
        pq1.pop();
        top=top/2;
        pq1.push(top);
    }
    ll ans=0;
    while(!pq1.empty())
    {
        ans+=pq1.top();
        pq1.pop();
    }
    cout<<ans;
    return 0;
}
    

Measured memory_bytes: 1400
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	string s;
	cin >> s;
	for (int i = s.size() - 1; i >= 0; --i) {
		if (i % 2)
			continue;
		if (s.substr(0, i / 2) == s.substr(i / 2, i / 2)) {
			cout << i << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const ll INF = 2 * 1e18;

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> a(n, vector<int>(m));
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  ll ans = INF;
  for (int bit = 0; bit < (1 << n); ++bit) {
    ll p = 0;
    vector<int> acc(m, 0);
    for (int i = 0; i < n; ++i) {
      if (bit & (1 << i)) {
        p += c[i];
        for (int j = 0; j < m; j++) {
          acc[j] += a[i][j];
        }
      }
    }
    bool flag = true;
    for (int i = 0; i < m; i++) {
      if (acc[i] < x) {
        flag = false;
        break;
      }
    }
    if (flag) ans = min(ans, p);
  }
  cout << (ans == INF ? -1 : ans) << endl;
  return 0;
}

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

int main() {
    ll N; cin >> N;
    vector<ll> v(N);
    map<ll, ll> m;
    for (int i = 0; i < N; i++){
        cin >> v[i];
        m[v[i]]++;
    } 

    ll ans = 0;
    for(auto i:m){
        ans += i.second*(i.second-1)/2;
    }

    for (int i = 0; i < N; i++)
    {
        cout << ans - m[v[i]]*(m[v[i]]-1)/2 + (m[v[i]]-1)*(m[v[i]]-2)/2 << endl;
    }

}

Measured memory_bytes: 11008
#include <cstring>
#include <cstdio>
int fa[200005], val[200005], nxt[200005], ban;
int lst[200005], to[200005], pre[200005], tot; 
bool vis[200005];
inline void add_edge(int u, int v)
{
	to[tot] = v; 
	pre[tot] = lst[u];
	lst[u] = tot++; 
}
int getfa(int u)
{
	if (u == fa[u])
		return u; 
	return fa[u] = getfa(fa[u]); 
}
void dfs(int u)
{
	if (u == ban || lst[u] == -1)
		return; 
	for (int i = lst[u]; ~i; i = pre[i])
		dfs(to[i]); 
	for (int i = lst[u]; ~i; i = pre[i])
		vis[val[to[i]]] = true; 
	for (val[u] = 0; vis[val[u]]; val[u]++); 
	for (int i = lst[u]; ~i; i = pre[i])
		vis[val[to[i]]] = false; 
}
int main()
{
	// freopen("ARC079-F.in", "r", stdin); 
	memset(lst, -1, sizeof(lst)); 
	int n, rt; 
	scanf("%d", &n); 
	for (int i = 0; i < n; i++)
		fa[i] = i; 
	for (int i = 0; i < n; i++)
	{
		scanf("%d", nxt + i); 
		nxt[i]--; 
		if (getfa(i) == getfa(nxt[i]))
			rt = i; 
		else
		{
			fa[getfa(i)] = getfa(nxt[i]); 
			add_edge(nxt[i], i); 
		}
	}
	ban = -1;
	dfs(rt); 
	if (val[rt] == val[nxt[rt]])
	{
		ban = nxt[rt]; 
		val[nxt[rt]]++; 
		dfs(rt); 
		if (val[rt] != val[nxt[rt]] - 1)
		{
			puts("IMPOSSIBLE"); 
			return 0; 
		}
	}
	puts("POSSIBLE"); 
	return 0; 
}


Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x;
	cin >> x;
	if(x >= 30 && x <= 40){
		cout << "Yes" << endl;
	}
	else if(x >= -40 && x < 30){
		cout << "No" << endl;
	}
	return 0;
 } 

Measured memory_bytes: 3612
#include <iostream>
#include <vector>

using namespace std;

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

    long long k = 0;
    for (long long i = 0; i <= n; i++) {
        long long c = i * (i + 1) / 2;
        if (c > n) {
            cout << "No" << endl;
            return 0;
        } else if (c == n) {
            k = i + 1;
            break;
        }
    }

    int num = 1;
    vector<vector<int>> ans(k);
    for (int i = 0; i < k - 1; i++) {
        for (int j = i + 1; j < k; j++) {
            ans[i].emplace_back(num);
            ans[j].emplace_back(num);
            num++;
        }
    }

    cout << "Yes" << endl;
    cout << k << endl;
    for (int i = 0; i < k; i++) {
        cout << ans[i].size() << " ";
        for (int j = 0; j < k - 1; j++) {
            cout << ans[i][j] << (j == k - 2 ? "\n" : " ");
        }
    }

    return 0;
}

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

flag = True
for i in range(n):
    if a[i]%2==0:
        if a[i]%3!=0 and a[i]%5!=0:
            flag = False

if flag == True:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int count_ab(string s) {
  //cout<<"count_ab("<<s<<")\n";
  vector<int> pos_a, pos_b;
  rep(i, s.length()) if (s[i] == 'a') pos_a.pb(i);
  rep(i, s.length()) if (s[i] == 'b') pos_b.pb(i);

  int ctr = 0, lp = -1;
  rep(i, pos_a.size()) if (lp < pos_a[i]) {
    ctr++;
    lp = pos_b[i];
  }
  return ctr;
}

string solve_ba(string s) {
  vector<int> pos_a, pos_b;
  rep(i, s.length()) if (s[i] == 'a') pos_a.pb(i);
  rep(i, s.length()) if (s[i] == 'b') pos_b.pb(i);
  int num = pos_a.size();
  string m = "";
  rep(offset, num) {
    int a = offset, b = offset;
    string o = "";
    while (a < num || b < num) {
      if (a < num && (b == num || pos_a[a] < pos_b[b])) a++, o += 'a';
      else b++, o += 'b';
    }
    m = max(m, o);
  }
  //cout<<"solve_ba("<<s<<") = "<<m<<"\n";
  return m;
}

int N;
string S;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> S;
  vector<string> block_list;

  int a = 0, b = 0;
  string buf = "";
  rep(i, 2*N) {
    buf += S[i];
    if (S[i] == 'a') a++;
    else b++;
    if (a == b) {
      a = b = 0;
      block_list.pb(buf);
      buf = "";
    }
  }
  assert(buf.empty());

  vector<string> list2;
  rep(i, block_list.size()) {
    string s = block_list[i];
    if (s[0] == 'b') {
      list2.pb(solve_ba(s));
    }
  }
  string out = "";
  for (int i=list2.size()-1; i>=0; i--) out = max(out, list2[i]+out);

  int add = 0;
  while (!block_list.empty() && block_list.back()[0] == 'a') {
    add += count_ab(block_list.back());
    block_list.pop_back();
  }
  rep(_, add) out += "ab";
  cout << out << "\n";
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define INF 2147483647
#define fi first
#define se second
int abs(int a,int b){
  int c=max(a,b)-min(a,b);
  return c;
}
int gcd(int a,int b){
  int c=a%b;
  while(true){
    if(c==0) break;
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}
bool IsPrime(int num){
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;
  double sqrtNum = sqrt(num);
  for(int i=3;i<=sqrtNum;i+=2){
    if(num%i==0){
      return false;
    }
  }
  return true;
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b=1;
  cin>>a;
  for(int i=1;i<=9;i++){
   for(int j=1;j<=9;j++){
     if(i*j==a){
       b=0;
       break;
     }
   }
  }
  if(b) cout<<"No";
  else cout<<"Yes";
  cout<<"\n";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner scan = new Scanner(System.in)) {
            String inData;
            while ((inData = scan.nextLine()) != null) {
                String[] inDataList = inData.split(" ");
                int sum = Integer.parseInt(inDataList[0]) + Integer.parseInt(inDataList[1]);
                System.out.println(String.valueOf(sum).length());
            }
        } catch (Exception e) {
            System.exit(0);
        }
    }
}

Measured memory_bytes: 26376
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int ab, bc, ca;
	cin >> ab >> bc >> ca;
	cout << ab*bc / 2 << "\n";
	
	return 0;
}

Measured memory_bytes: 256
N,M=[int(i) for i in input().split()]
PY=[[] for _ in range(N)]
py=[]

for i in range(M):
    p,y=[int(i) for i in input().split()]
    PY[p-1].append((y,i))

ans=[None]*M
for j,py in enumerate(PY): #jが県番号
    py.sort()
    for k,(y,i) in enumerate(py):
        ans[i]=str(j+1).zfill(6) + str(k+1).zfill(6)

print(*ans,sep="\n")

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

public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    long[] res;
    ArrayList<Integer>[] tree;
    public static void main(String[] args) throws IOException {
        Main main = new Main();
//        main.solve();
        out.println(main.solve());
        out.flush();
    }
    long solve(){
        long a = sc.nextLong(), b = sc.nextLong(), n = sc.nextLong();
        long x = Math.min(b-1,n);
        long up = a*(x%b)-(a%b)*(x%b)%b;
        return up/b;
    }
}



Measured memory_bytes: 35924
h,w,d = map(int, input().split())

dp= [0]*(h*w+1)

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

for i in range(h):
    for j in range(w):
        s = ab[i][j]
        dp[s] =[i,j]
        
dpp= [0]*(h*w+1)

for k in range(d+1,h*w+1):
#    print(k)
    dpp[k] = dpp[k-d] + abs(dp[k][0]-dp[k-d][0]) +abs(dp[k][1]-dp[k-d][1])
    
q = int(input())

for x in range(q):
    a,b = map(int, input().split())
    print(dpp[b]-dpp[a])

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

int main()
{
  int result = 0, i;
  char a;
  for (i = 0; i < 4; i++)
  {
    scanf("%c", &a);
    if (a == '+')
      result += 1;
    else
      result -= 1;
  }

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

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define int long long int
#define vi vector<int>
#define vvi vector < vi >
#define pii pair<int,int>
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define tr(k,st,en) for(int k = st; k <= en ; ++k)
using namespace std;

int32_t main()
{
    std::ios::sync_with_stdio(false);
    int n,w;
    cin>>n>>w;
    vi dp(w+1); // 0... w;
    tr(i,1,n){
        int wt,val;
        cin>>wt>>val;
        tr(weight_already,0,w - wt){
            dp[weight_already] = max(dp[weight_already], dp[weight_already + wt]  + val);
        }
    }
    int ans = 0;
    tr(i,0,w){
        ans = max(ans, dp[i]);
    }
    std::cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4032
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ユニークなvectorにする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

long getDigit(long num){
  long digit = 0;
  while (num != 0){
      num /= 10;
      digit++;
  }
  return digit;
}

int main() {
  long N;
  cin >> N;
  double r = sqrt(N);
  long minResult = INF;

  // r から試し割
  long divider = r;
  while (divider > 0) {
    if (N % divider == 0) {
      long result = max(getDigit(divider), getDigit(N / divider));
      minResult = min(result, minResult);
      // DEBUG(divider);
      // DEBUG(minResult);
    }
    divider--;
  }

  cout << minResult << endl;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();    
    int cnt =  0;
    int max = 0;
      
    for(int i = 0; i < S.length(); i++){
      if(S.charAt(i) == 'A' || S.charAt(i) == 'C'|| S.charAt(i) == 'G' || S.charAt(i) == 'T'){
        //引数にある文字を返す S.charAt(X);
        cnt++;
      }else{
        cnt=0;
      }
      if(max<cnt){
        max = cnt;
      }
    }
    System.out.println(max);
  }
}

Measured memory_bytes: 23636
/**
 *    +--+--+--++--++--In the name of ALLAH--++--++--+--+--+
 *
 *    author:  skmonir
 *    created: 19-Apr-2020 18:39:53
**/

#include <bits/stdc++.h>

using namespace std;

#define endl                '\n'
#define TN                  typename
#define mod                 1000000007LL
#define len(x)              (int) x.size()
#define all(x)              x.begin(), x.end()
#define rall(x)             x.rbegin(), x.rend()
#define mem(x, y)           memset(x, y, sizeof x)
#define FOR(x, l, r)        for (int x = l; x <= r; ++x)
#define ROF(x, l, r)        for (int x = l; x >= r; --x)

template <TN T> inline void Int(T &n) {
    n = 0; int f = 1; register int ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
    n = n * f;
}

template <TN T> T gcd(T a, T b) {return !b ? a : gcd(b, a % b);}
template <TN T> inline void umin(T &a, T b) {a = a < b ? a : b;}
template <TN T> inline void umax(T &a, T b) {a = a > b ? a : b;}
template <TN T, TN W> inline void Int(T &x, W &y) {Int(x), Int(y);}
template <TN T, TN W, TN Q> inline void Int(T &x, W &y, Q &z) {Int(x, y), Int(z);}

const int N = 1e5 + 7;
const int inf = 1e9 + 7;


int solve() {
    int n; Int(n);
    vector<int> deg(n);
    for (int i = 1; i < n; ++i) {
        int x; Int(x); --x;
        ++deg[x];
    }

    FOR (i, 0, n - 1) {
        printf("%d\n", deg[i]);
    }

    return 0;
}

int main() {
    int tests = 1, CaseNo = 0; //Int(tests);
    while (tests--) {
        //printf("Case %d: ", ++CaseNo);
        solve();
    }
    return 0;
}

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

using namespace std;

long long mem[105][100005];
int n,ww;
int w[105],v[105];

long long go(int i,int ww)
{
	if(ww<0) return -(1LL<<50);
	if(i>=n) return 0;
	if(mem[i][ww]!=-1) return mem[i][ww];
	return mem[i][ww]=max(go(i+1,ww),go(i+1,ww-w[i])+v[i]);
}

int main()
{
	cin >> n >> ww;
	for(int i=0;i<n;i++)
	{
		cin >> w[i] >> v[i];
	}
	memset(mem,-1,sizeof mem);
	cout << go(0,ww) << endl;
}

Measured memory_bytes: 82304
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
#ifndef ONLINE_JUDGE
    scanf("%lld", &a);
#else
    scanf("%I64d", &a);
#endif
    return a;
}

int main() {
    printf((gi()*gi())%2 ? "Yes\n" : "No\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
signed main(){
  int a;
  cin>>a;
  vector<int> b(a);
  rep(i,a)
    cin>>b[i];
  int c=INF,e=0;
  rep(i,a){
    if(c>b[i])
      e++;
  c=min(b[i],c);
  }
  cout<<e<<endl;
}

Measured memory_bytes: 1920
import numpy as np
import sys
import math

N , M , X = map(int,input().split())
data = []
[data.append(list(map(int,input().split()))) for _ in range(N)]
ten = 1000000 * 12
ans = 1000000 * 12
for x in range(2**N):
    bi = bin(x)[2::][::-1]
    tmp = [0] * M
    cost = 0
    for index , b in enumerate(bi) :
        if b == "1":
            cost += data[index][0]
            for i , d in enumerate(data[index][1::]):
                tmp[i] += d
    flag = 0
    for tt in tmp :
        if tt < X:
            flag = 1
            break
    if flag == 0:
        ans = min(cost , ans)

if ans == ten :
    ans = -1
print(ans)






Measured memory_bytes: 27148
#include <stdio.h>
int main(void){
    // Your code here!
    int n,k;
    scanf("%d %d",&n,&k);
    int max = -1;
    
    k -= 1;
    if( k!= 0) max = n-k-1;
    else max = 0;
    
    printf("%d\n",max);
    
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
using namespace std;
int main(){
    int n;
    cin >> n;
    char s[100],t[100];
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    for(int i=0;i<n;i++){
        cin >> t[i];
    }
    for(int i=0;i<n;i++){
        cout << s[i] << t[i];
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<28;
const long long MOD =1000000000+7;
void solve(int a){cout<<( a?"YES":"NO")<<endl;}

int main()
{
	int n;
	cin >>n;
	int ans=0;
	int re=0;
	vector<int>s(n,0);
	for(int i=0;i<n;i++){
		cin >>s[i];
		ans+=s[i];
	}
	sort(s.begin(),s.end());
	if(ans%10==0){
		while(s[re]%10==0){
			re++;
			if(re >=s.size()){
				re=0;
				s[re]=ans;
				break;
			}
		}
		ans-=s[re];
	}

	cout << ans << endl;
}


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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int H, W, K;

bool calc(int from, int to, vector<int> v){
    int sz = v.size();
    if(from != to){
        if(v[min(from, to)]){
            bool ok = true;
            rep(i, sz-1) if(v[i] == 1 && v[i+1] == 1) ok = false;
            return ok;
        }
        else return false;
    }
    else{
        //v[from]とv[from-1]は1だと駄目
        if((from < sz && v[from] == 1) || (0 <= from-1 && v[from-1] == 1)) return false;
        else{
            bool ok = true;
            rep(i, sz-1) if(v[i] == 1 && v[i+1] == 1) ok = false;
            return ok;
        }
    }
}

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> H >> W >> K;
    ll keisuu[W][W]; rep(i, W) rep(j, W) keisuu[i][j] = 0;
    int loop = (1 << (W-1));
    rep(i, W){
        rep(j, W){
            if(abs(i-j) > 1) keisuu[i][j] = 0;
            else{
                rep(i2, loop){
                    int val = i2;
                    vector<int> work;
                    rep(j2, W-1){
                        work.push_back(val%2);
                        val/=2;
                    }
                    if(calc(i, j, work)) keisuu[i][j]++;
                }
            }
        }
    }
    K--;
    //dp[H+2][W]で(i, j)に高さiでjにたどり着くあみだくじの個数
    //移動するなら棒の場所は一意に定まる
    //そうでなければ空いてる本数分かける
    ll dp[H+2][W]; rep(i, H+2) rep(j, W) dp[i][j] = 0;
    dp[0][0] = 1;
    for(int i = 0; i <= H; i++){
        for(int j = 0; j < W; j++){
            for(int dx = -1; dx <= 1; dx++){
                int nx = j+dx;
                if(dx == 0){
                    if(j == 0 || j == W-1){
                        dp[i+1][nx] = (dp[i+1][nx] + dp[i][j]*keisuu[j][nx]) % mod;
                    }
                    else dp[i+1][nx] = (dp[i+1][nx] + dp[i][j]*keisuu[j][nx]) % mod;
                }
                else if(0 <= nx && nx <= W-1){
                    dp[i+1][nx] = (dp[i+1][nx] + dp[i][j]*keisuu[j][nx]) % mod;
                }
            }
        }
    }
    /*
    rep(i, H+2){
        rep(j, W){
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    if(W > 1) cout << dp[H][K] << endl;
    else cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define teto(a, b) ((a+b-1)/(b))
using namespace std;

const int MAX = 200000;
const int MOD = 1000000007;
const int INF = 1e8;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-7;

// Extra
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
//

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

    if(a >= 13) {
        cout << b << endl;
    }
    else if(6 <= a and a < 13) {
        cout << b/2 << endl;
    }
    else {
        cout << 0 << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>

int main() {
  int n;
  scanf("%d", &n);
  std::vector<int> a(n), deg(n);
  std::set<int> left;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    ++deg[--a[i]];
    left.insert(i);
  }

  int forbid = -1;
  
  auto check = [&](int x) {
    if (x == forbid) return false;
    int y = a[x];
    if (!left.count(y)) {
      if (left.size() == 3) {
        int u = -1, v = -1;
        for (auto &e: left) if (e != x) {
          if (u == -1) u = e;
          else v = e;
        }
        if (a[u] == v && a[v] == u) return false;
      }
      return true;
    } else {
      return deg[y] != left.size() - 1;
    }
  };

  std::vector<int> b(n, -1);
  for (int i = 0; i < n; ++i) {
    for (auto it = left.begin(); it != left.end(); ++it) {
      if (check(*it)) { b[i] = *it; break; }
    }
    if (b[i] == -1) break;
    forbid = a[b[i]];
    --deg[forbid];
    left.erase(b[i]);
  }
  if (b.back() == -1) {
    assert(n <= 3);
    puts("-1");
  }
  else {
    for (auto &x: b) printf("%d ", x + 1);
    puts("");
  }
  return 0;
}


Measured memory_bytes: 6656
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

const int N = (int) 0, mod = (int) 0;

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    int cnt = 1, cur = 0;
    do {
        cur += cnt;
        cnt++;
    } while (cur <= n);
    int sum = (cnt - 1) * cnt / 2;
    for (int i = 1; i < cnt; ++i) {
        if (sum - i == n) {
            for (int j = 1; j < cnt; ++j) if (i != j)
                cout << j << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 384