akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-9, pi = acos(-1.0);
namespace std {
    bool operator<(const Point &lhs, const Point &rhs) {
        if (lhs.real() < rhs.real() - eps) return true;
        if (lhs.real() > rhs.real() + eps) return false;
        return lhs.imag() < rhs.imag();
    }
}
Point input_point() {ld x, y; cin >> x >> y; return Point(x, y);} // ????????\???
bool eq(ld a, ld b) {return (abs(a - b) < eps);} // ????????????????????????
ld dot(Point a, Point b) {return real(conj(a) * b);} // ??????
ld cross(Point a, Point b) {return imag(conj(a) * b);} // ??????

// ??´????????????
class Line {
public:
    Point a, b;
    Line() : a(Point(0, 0)), b(Point(0, 0)) {}
    Line(Point a, Point b) : a(a), b(b) {}
    Point operator[](const int _num) {
        if (_num == 0)return a;
        else if (_num == 1)return b;
        else assert(false);
    }
};

// ????????????
class Circle {
public:
    Point p;
    ld r;
    Circle() : p(Point(0, 0)), r(0) {}
    Circle(Point p, ld r) : p(p), r(r) {}
};

// CCW
int ccw(Point a, Point b, Point c) {
    b -= a; c -= a;
    if (cross(b, c) > eps) return 1;   // a,b,c??????????¨???¨?????????????????¶
    if (cross(b, c) < -eps) return -1; // a,b,c???????¨???¨?????????????????¶
    if (dot(b, c) < 0) return 2;       // c,a,b???????????´???????????¶
    if (norm(b) < norm(c)) return -2;  // a,b,c???????????´???????????¶
    return 0;                          // a,c,b???????????´???????????¶
}

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    Point a = input_point(), b = input_point();
    int q; cin >> q;
    for(int i = 0; i < q;i++){
        Point c = input_point();
        int ret = ccw(a,b,c);
        switch(ret){
            case 1:
                cout << "COUNTER_CLOCKWISE" << endl; break;
            case -1:
                cout << "CLOCKWISE" << endl; break;
            case 2:
                cout << "ONLINE_BACK" << endl; break;
            case -2:
                cout << "ONLINE_FRONT" << endl; break;
            case 0:
                cout << "ON_SEGMENT" << endl; break;
        }
    }
    return 0;
}

Measured memory_bytes: 3360
#include <iostream>
using namespace std;
#define int long long
#define double long double

signed main() {
	int n;
	cin >> n;
	double arr[n];
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	double dp[n+1][n+1];
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		dp[0][i]=0;
	}
	for(int i=1;i<=n;i++){
		dp[i][0]=(dp[i-1][0])*(1.0L-arr[i-1]);
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(j>i){
				dp[i][j]=0;
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=i;j++){
			dp[i][j]=((dp[i-1][j-1]*arr[i-1])+(dp[i-1][j]*(1.0L-arr[i-1])));
		}
	}
	double ans=0;
	for(int i=0;i<=n;i++){
		if(i>(n-i)){
			ans+=dp[n][i];
		}
	}
	cout.precision(17);
	cout << fixed << ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 140928
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		int a[]=new int[11];
		while(in.hasNext()){
			Arrays.fill(a,0);
			for(int i=1;i<=4;i++)
				a[in.nextInt()]=i;
			int hit=0,blow=0;
			for(int i=1;i<=4;i++){
				int x=in.nextInt();
				if(a[x]==i)
					hit++;
				else if(a[x]!=0)
					blow++;
			}
				System.out.println(hit+" "+blow);
		}
		in.close();
	}
}

Measured memory_bytes: 26092
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });

            var ABM= Sarray();
            var A = ABM[0];
            var B = ABM[1];
            var M = ABM[2];
            var ai = Sarray();
            var bi = Sarray();
            var value = Mod;
            for (var i = 0; i < M; ++i)
            {
                var xyc = Sarray();
                var x = xyc[0];
                var y = xyc[1];
                var c = xyc[2];
                value = Min(value, ai[(int)x - 1] + bi[(int)y - 1] - c);
            }
            Array.Sort(ai);
            Array.Sort(bi);
            var ans = Min(ai[0] + bi[0], value);
            WriteLine(ans);
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 39388
## coding: UTF-8
#import random
import math

N = int(input())
A = list(map(int,input().split()))
#N = 9
#A = [1, 2, 3, 40, 50, 60, 100, 200, 300]


A = sorted(A, reverse = True)
#print(N, A)


score = 0
for i in range(1, N):
    index = math.floor(i/2)
    score += A[index]
    #print(i, index, A[index], score)

print(score)

Measured memory_bytes: 32820
module Main where

import Numeric
import Data.Functor

main :: IO ()
main =  do
  { [a,b] <- getInts
  ; putStrLn $ unwords $[show$a`div`b,show$a`mod`b,showFFloat Nothing (fromIntegral a/fromIntegral b :: Double) ""]
  }

getInts :: IO [Int]
getInts = map read . words <$> getLine

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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 200010, M = 45;

int n;
int cnt[N][M];
LL a[N];

bool check(int l, int r)
{
	for (int i = 0; i < M; i ++ )
		if (cnt[r][i] - cnt[l][i] >= 2)
			return false;
	return true;
}

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i ++ )
	{
		scanf("%lld", &a[i]);
		for (int j = 0; j < M; j ++ )
		{
			cnt[i][j] += (a[i] >> j) & 1;
			cnt[i][j] += cnt[i - 1][j];
		}
	}
	
	LL res = 0;
	for (int i = 1; i <= n; i ++ )
	{
		int l = 0, r = i - 1;
		while (l < r)
		{
			int mid = l + r >> 1;
			if (check(mid, i)) r = mid;
			else l = mid + 1;
		}
		res += i - r;
	}
	
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 36992
#include<bits/stdc++.h>
using namespace std;
int main(){
  int W,H,N,x,y,a,i; cin>>W>>H>>N;
  vector<pair<int,int>> M(2);
  M[0]=make_pair(0,0); M[1]=make_pair(W,H);
  for(i=0;i<N;i++){
    cin>>x>>y>>a;
    switch(a){
      case 1:
        M[0].first=max(M[0].first,x); break;
      case 2:
        M[1].first=min(M[1].first,x); break;
      case 3:
        M[0].second=max(M[0].second,y); break;
      case 4:
        M[1].second=min(M[1].second,y); break;
    }
  }
  W=M[1].first-M[0].first;
  H=M[1].second-M[0].second;
  cout<<(W>0?W:0)*(H>0?H:0);
}

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

int main(void){
    vector<vector<int>> vec(3,vector<int>(3));
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> vec.at(i).at(j);
        }
    }

    vector<int> x(3);
    vector<int> y(3);
    x.at(0) = 0;
    for(int i=0;i<3;i++) y.at(i) = vec.at(0).at(i) - x.at(0);
    for(int i=0;i<3;i++) x.at(i) = vec.at(i).at(0) - y.at(0);

    bool ok = true;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(x.at(i)+y.at(j)!=vec.at(i).at(j)) ok = false;
        }
    }

    if(ok) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long a = sc.nextLong();
		long b = sc.nextLong();
		String ans = "Negative";

		if (a < 0 && b < 0) {
			if ((b - a + 1) % 2 == 0) {
				ans = "Positive";
			}
		} else if (a <= 0 && b >= 0) {
			ans = "Zero";
		} else {
			ans = "Positive";
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll n; cin>>n;
    ll l; cin>>l;
    ll sum=0;
    rep(i,n) sum+=l+i;
    ll res=1e10;
    rep(i,n){
        if(abs(res-sum) > abs(l+i)){
            res=sum-l-i;
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
py = sorted([[i] + list(input().split()) for i in range(m)], key=lambda x: (int(x[1]), int(x[2])))

x = 1
a = 1
ans = []
for i, p, y in py:
    if x != int(p):
        x = int(p)
        a = 1
    
    ans.append([i, p.zfill(6)+str(a).zfill(6)])
    a += 1

for i, v in sorted(ans):
    print(v)

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

int main() {
    int a;cin>>a;
    int ans = a*a*a + a*a + a;
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define initdp(a, b)  for (int i = 0; i <= a; i++)   for (int j = 0; j <= b; j++) dp[i][j] = -1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n - 1; i >= 0; i--)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;
#define umapi unordered_map<ll, ll>
#define umapc unordered_map<char, int>
#define endl "\n"
using namespace std;

/*
            ॐ
    || Jai Shree Ram ||  
 
 */


void solve()
{
    int h,w,k,cnt,ans=0;
    cin>>h>>w>>k;
    vector<string> c(h);
    rep(i,h)cin>>c[i];
    rep(ii,1<<h)rep(jj,1<<w){
        cnt=0;
        rep(i,h)rep(j,w){
        if((ii>>i)&1)continue;
        if((jj>>j)&1)continue;
        if(c[i][j]=='#')cnt++;
        }
        if(cnt==k)ans++;
    }
    cout<<ans;




}
 
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
}




Measured memory_bytes: 3660
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MAXN 1000010
using namespace std;
ll arr[100000];
ll brr[100000];
int main()
{
	string a,b;
	cin >>a>>b;
	a+=b;
	stringstream ss;
	ll k;
	ss<<a;
	ss>>k;
	if(sqrt(k)==(int)sqrt(k))
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

	return 0;
}



Measured memory_bytes: 256
s = int(input())
import math
k = math.floor(s**0.5)
m = 0
if s == 10**18:
    print(10**9,0,0,10**9,0,0)
else:
    if k**2+k < s:
        m = (k+1)**2 -s
        print(k+1,1,m,k+1,0,0)
    else:
        m = k*(k+1)-s
        print(k+1,1,m,k,0,0)

Measured memory_bytes: 38512
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    int n,mi=10000000,ma=-10000000;
      long long sum=0;
    cin >> n;
    int a,b;
    for(a=0;a<n;a++){
        cin >> b;
        mi=min(mi,b);
        ma=max(ma,b);
        sum+=b;
    }
    cout << mi << " " << ma << " " << sum << endl; 
    return 0;
}


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

using namespace std;

typedef long long ll;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int x; cin >> x;
  int d = 360;
  for (; d > 0; --d) {
    if (x % d == 0 && 360%d == 0) {
      break;
    }
  }

  cout << (360*x/d/x) << endl;

  
  return 0;
}




Measured memory_bytes: 3648
/*****************************************************
 *     created by: nayakashutosh9
 * "Winners Never Quit and Quitters Never Win".
*****************************************************/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define endl '\n'
#define mod 1000000007
#define inf 1e18
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
const int N = 300005;
/**********************************************************************************************/


void solve() {
	double d, t, s; cin >> d >> t >> s;
	if ((d / s) <= t) cout << "Yes\n";
	else cout << "No\n";
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int t = 1, z = 1;
	// cin >> t; cin.ignore();
	while (t--) {
		// cout << "Case #" << (z++) << ": ";
		// clock_t start = clock();
		solve();
		// clock_t end = clock();
		// cout << (end-start) << endl;
		//print execution time in ms
	}

	return 0;
}

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

int main(){
    int a[6];
    for(int i=0;i<6;i++)cin>>a[i];
    cout<<((a[0]+a[1]*5+a[2]*10+a[3]*50+a[4]*100+a[5]*500)/1000>0)<<endl;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
 
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll a,b,c;
	cin>>a>>b>>c;
	if(c-(a+b)>0){
	ll x=(a+b-c)*(a+b-c);
	if(x>(4*a*b)) cout<<"Yes\n";
	else cout<<"No\n";
	}
	else cout<<"No\n";
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    string S;
    cin >> S;
    
    bool flag = true;
    if(S[0] != 'A') flag = false;
    int cnt = 0;
    for (int i = 1; i < S.size(); i++){
        if ('A' <= S[i] && S[i] <= 'Z'){
            if (S[i] == 'C' && cnt == 0 && i != 1 && i != S.size() - 1 ) cnt++;
            else {
                flag = false;
                break;
            }
        }
    }
  
    if (flag & cnt) cout << "AC" << "\n";
    else cout << "WA" << "\n";
  
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    ll N, K;
    cin >> N >> K;
    vll P(N), C(N);
    for (ll i = 0; i < N; i++)
    {
        cin >> P[i];
        P[i]--;
    }
    for (ll i = 0; i < N; i++)
    {
        cin >> C[i];
    }
    ll ans = -INF;
    
    for (ll i = 0; i < N; i++)
    {
        vector<bool> seen(N);
        vll score;
        ll cur = i;
        ll curScore = 0;
        while (!seen[P[cur]])
        {
            cur = P[cur];
            seen[cur] = true;
            curScore += C[cur];
            score.push_back(curScore);
        }
        //ループおわり
        ll loopLen = score.size();
        ll rem = K % loopLen;
        ll div = K / loopLen;
        if (score.back() >= 0 and loopLen <= K)
        {    
            chmax(ans, div * score.back());
            for (ll j = 0; j < rem; j++)
            {
                chmax(ans, div * score.back() + score[j]);
            }
            if(rem==0)
            {
                for (ll j = 0; j < loopLen and j < K; j++)
                {
                    chmax(ans,(div-1)*score.back()+score[j]);
                }
                
            }
        }
        for (ll j = 0; j < loopLen and j < K; j++)
        {
            chmax(ans, score[j]);
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3824
#include<bits/stdc++.h>
using namespace std;
int A(long long a,long long b)
{
  if(a>9 || b>9)
     return -1;
  return a*b;
}
int main()
{
  long long a,b;
  cin>>a>>b;
  cout<<A(a,b)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#define llint long long

using namespace std;

llint l, r;

int main(void)
{
	cin >> l >> r;
	if(r - l + 1 >= 2019){
		cout << 0 << endl;
		return 0;
	}
	
	llint ans = 2019;
	for(llint i = l; i <= r; i++){
		for(llint j = l; j <= r; j++){
			if(i >= j) continue;
			ans = min(ans, (i%2019) * (j%2019) % 2019);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(input()) for _ in range(n)]

ans = 0
tmp = 1
for i in range(n):
    if a[i] > tmp:
        ans += (a[i] - 1) // tmp
        a[i] = 1

    tmp = max(tmp, a[i] + 1)

print(ans)


Measured memory_bytes: 7080
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

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

int main(void) {
    int A, B, C, D, E;
    cin >> A >> B >> C >> D >> E;

    vector<int> dishes(5);
    dishes[0] = A;
    dishes[1] = B;
    dishes[2] = C;
    dishes[3] = D;
    dishes[4] = E;

    vector<int> rems(5);
    int target_ind = 0;
    int target_rem = 10;
    for (int i = 0; i < 5; i++) {
        rems[i] = dishes[i] % 10;
        if (rems[i] != 0 && rems[i] < target_rem) {
            target_ind = i;
            target_rem = rems[i];
        }
    }

    int ans = 0;
    for (int i = 0; i < 5; i++) {
        if (i != target_ind) {
            ans += ((dishes[i] + 10 - 1) / 10) * 10;
        } else {
            ans += dishes[i];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include  <bits/stdc++.h>
using namespace std;
static int fast_io = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }();
int main(){
  string a;
  cin>>a; 
  if(a=="ABC"){
    cout<<"ARC"<<"\n";  
  }
  else{
    cout<<"ABC"<<"\n";  
  }
  return 0;
}

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

using namespace std;

int N;

int main()
{
	cin >> N;

	vector<vector<bool> > M(N, vector<bool>(N));

	int u, k, v;

	for (int i = 0; i < N; i++)
	{
		cin >> u >> k;

		for (int i = 0; i < k; i++)
		{
			cin >> v;

			M[u - 1][v - 1] = true;
		}
	}

	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < N; j++)
		{
			cout << M[i][j];

			if (j != N - 1)
			{
				cout << ' ';
			}
		}

		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)
 
#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.141592653589793238
#define dcout cout<<fixed<<setprecision(20)
 
const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;
 
// typedef long long ll;
#define int long long
#define double long double
 
template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}
 
typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

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

  int A, B, C; cin >> A >> B >> C;
  if(A+B+C >= 22) cout << "bust" << endl;
  else cout << "win" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <math.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <map>
//#include <unordered_map>
using namespace std;
const int Size=1024;
const int mod2=998244353;
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
//std::ios::sync_with_stdio(false);
#define LINF 0x3f3f3f3f3f3f3f3f
typedef long long ll;
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lson  p<<1
#define rson  p<<1|1
#define pb  push_back
#define pii pair<int,int>
#define pII pair<int,pii>
#define pll pair<ll,ll>
#define se second
#define fi first
/*    */

const int maxn=1e6+15;
const int base=307;

int a[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    int ok=1;
    for(int i=1;n>=i;i++){
        scanf("%d",&a[i]);
        if(a[i]%2==0){
            if(a[i]%3&&a[i]%5) ok=0;
        }
    }
    if(ok==1) printf("APPROVED\n");
    else printf("DENIED\n");
    return 0;
}



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

  int wa(int n){
   int sum=0;
   while(n>0){
      sum += n%10;
      n/=10;
   }
     return sum;
  }

int main(){
  int a,b,n;
  cin >> n >> a >> b;
  int total=0;
  for(int i=0; i<=n; i++){
  	int sum=wa(i);
    if(a<=sum && sum<=b){
      total+=i;
    }    
  }
  cout << total << endl;  	  
}

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

using namespace std;

int64_t N, A, B;
int64_t V[50];

vector<vector<pair<int64_t, int64_t>>> DPT;

pair<int64_t, int64_t> max_sum(int i, int pick) {
	if (pick == 0) {
		return make_pair(0, 1);
	}
	if (i == N) {
		return make_pair(-1e17, 0);
	}
	if (DPT[i][pick].first != -10) {
		return DPT[i][pick];
	}
	auto take = max_sum(i+1, pick-1);
	take.first += V[i];
	auto leave = max_sum(i+1, pick);
	auto ans = take;
	if (take.first == leave.first) {
		ans.second += leave.second;
	}
	if (leave.first > take.first) {
		ans = leave;
	}
	return DPT[i][pick] = ans;
}

typedef __int128 nd_t;

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

inline nd_t abso(nd_t arg) {
	return arg < 0 ? -arg : arg;
}

struct rational {
	nd_t num, den;
	rational() : num(0), den(1) {}
	rational(nd_t num) : num(num), den(1) {}
	rational(nd_t num, nd_t den) : num(num), den(den) {
		if (den == 0) throw "Division by zero";
		if (num == 0) den = 1;
		if (den < 0) {
			num *= -1;
			den *= -1;
		}
		reduce();
	}
	rational(const rational& cpy) : rational(cpy.num, cpy.den) {}
	void reduce() {
		nd_t div = abso(gcd(num, den));
		num /= div;
		den /= div;
		if (den < 0) {
			num *= -1;
			den *= -1;
		}
	}
	rational operator+(const rational& rhs) const {
		nd_t n, d, div = gcd(den, rhs.den);
		n = num*(rhs.den/div)+rhs.num*(den/div);
		d = den/div*rhs.den;	
		return rational(n, d);
	}
	rational operator-() const {
		return rational(-num, den);
	}
	rational operator-(const rational& rhs) const {
		return (*this)+(-rhs);
	}
	rational operator*(const rational& rhs) const {
		if (num == 0 || rhs.num == 0) return rational(0,1);
		nd_t n, d, diva = gcd(num, rhs.den), divb = gcd(rhs.num, den);
		n = (num/diva)*(rhs.num/divb);
		d = (den/divb)*(rhs.den/diva);
		return rational(n, d);
	}
	rational operator/(const rational& rhs) const {
		return (*this)*rational(rhs.den, rhs.num);
	}
	bool operator<(const rational& rhs) const {
		nd_t div = gcd(den, rhs.den);
		// cout << (int64_t)(rhs.den/div*num) << " " << int64_t(den/div*rhs.num) << endl;
		return rhs.den/div*num < den/div*rhs.num;
	}
	bool operator==(const rational& rhs) const {
		return num==rhs.num && den==rhs.den;
	}
	// friend ostream& operator<<(ostream& os, const rational& rhs) {
	// 	rational out(rhs);
	// 	out.reduce();
	// 	os << out.num << '/' << out.den;
	// 	return os;
	// }
};

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N >> A >> B;
	DPT.assign(55, vector<pair<int64_t, int64_t>>(55, make_pair(-10, -10)));
	for (int i = 0; i < N; ++i) {
		cin >> V[i];
	}
	int64_t anssum = -1, ansp = 1, answays = 0;
	for (int p = A; p <= B; ++p) {
		auto a = max_sum(0, p);
		// cout << p << " " << a.first << " " << a.second << endl;
		rational ar(a.first, p), ansr(anssum, ansp);
		if (ar == ansr) {
			answays += a.second;
		} else if (ansr < ar) {
			// cout << anssum << " " << ansp << " " << (ar<ansr) << endl;
			anssum = a.first;
			ansp = p;
			answays = a.second;
		}
	}
	cout << fixed << setprecision(30);
	cout << (long double)anssum/ansp << endl << answays << endl;
}

Measured memory_bytes: 256
k, n = map(int,input().split())
a = list(map(int,input().split()))
min_length = a[n-1]-a[0]
for ind in range(n-1):
    cur_length = k -a[ind+1] + a[ind]
    if cur_length < min_length:
        min_length = cur_length
print(min_length)

Measured memory_bytes: 26444
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    n = i_input()
    a = i_list()

    left = [0]
    right = [0]

    for i in range(n):
        left.append(gcd(left[i], a[i]))
        right.append(gcd(right[i], a[-(i+1)]))

    ans = 0
    for i in range(n):
        ans = max(ans, gcd(left[i], right[n - i - 1]))
    print(ans)



if __name__=="__main__":
    main()


Measured memory_bytes: 21864
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

ll gcd(ll a, ll b){
  if(b<a) swap(a, b);
  ll r = a % b;
  if(r==0) return b;
  while(r!=0){
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
int main(int argc, char const *argv[]) {
  ll a, b;std::cin >> a >> b;
  std::cout << (a*b)/gcd(a, b) << '\n';
  return 0;
}


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

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";

vector<int> G[100005];

int main() {

    CIN(int, N);
    CIN(int, M);

    for (int i = 0; i < M; i++) {
        int u, v;
        cin >> u >> v;
        G[u].push_back(v);
    }
    CIN(int, S);
    CIN(int, T);
    vector<vector<int>> check3(N+5, vector<int>(3, 0));

    queue<pair<int, int>> q;
    q.push(make_pair(S, 0));

    int ans = -1;
    while( !q.empty() ) {
        if (ans != -1) break;
        
        pair<int, int> p = q.front();
        q.pop();
        int e = p.first;
        int t = p.second;
        // cout << e << " " << t << "\n";
        if ( check3[e][t % 3] > 0 ) continue;
        check3[e][t % 3] = 1;

        for (int i = 0; i < G[e].size(); i++) {
            if ( G[e][i] == T && (t+1) % 3 == 0 ) {
                ans = (t+1) / 3;
                break;
            }
            q.push(make_pair(G[e][i], t + 1));
        }
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 11136
#include<stdio.h>
#include<string.h>
 
int main(void){
  char b[2];
  
  scanf("%s",b);
  
  if(b[0] == 'A')
    printf("T");
  if(b[0] == 'T')
    printf("A");
  if(b[0] == 'G')
    printf("C");
  if(b[0] == 'C')
    printf("G");
   
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define INF 2147483647
#define SYOU(x) setprecision(x)
using namespace std;
long long i[10000][10000];
long long u[1111111];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,d=0,e=1,f=0;
  string s;
  cin >>a>>b>>c;
  cout <<a*b/2<<'\n';
  return (0);
}


Measured memory_bytes: 892
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int         long long   
#define double      long double
#define endl        "\n"
#define pb          push_back
#define PI          3.1415926535897932384626433832795l
#define F           first
#define S           second
#define mp          make_pair
#define f(i,n)      for(int i=0;i<n;i++)
#define fastio      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)      (v).begin(),(v).end()
#define rall(v)     (v).rbegin(),(v).rend()
#define gcd(a,b)    __gcd((a),(b))
#define fill(a,value) memset(a,value,sizeof(a));
#define minn(v)     *min_element(v.begin(), v.end());
#define maxx(v)     *max_element(v.begin(), v.end());
#define print(x)    cout<<(x)<<endl;
#define sum(v)+x    accumulate(v.begin(), v.end(),x);
typedef pair<int,int> pii;  
typedef vector<int> vi;
signed main() 
{
    fastio;
    cout << fixed << setprecision(12);
    int n,k;
    cin>>n>>k;
    int ans=0;
    f(i,n)
    {
        int x;
        cin>>x;
        if(x>=k)ans++;
        
    }
    print(ans)
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;


int popcount32(unsigned int x){
	x = (x>>1 & 0x55555555)+(x & 0x55555555);
	x = (x>>2 & 0x33333333)+(x & 0x33333333);
	x = (x>>4 & 0x0f0f0f0f)+(x & 0x0f0f0f0f);
	x = (x>>8 & 0x00ff00ff)+(x & 0x00ff00ff);
	return (x>>16)+(x & 0x0000ffff);
}

int main(){
	int tanni[20];
	int prelearn[20];
	int n,u;
	while(cin>>n>>u,n|u){
		memset(tanni,0,sizeof(tanni));
		memset(prelearn,0,sizeof(prelearn));
		for(int i=0;i<n;i++){
			int c,k;
			cin>>c>>k;
			tanni[i]=c;
			for(int j=0;j<k;j++){
				int r;
				cin>>r;
				prelearn[i]|=1<<r;
			}
		}
		int ans=n;
		for(int i=0;i<(1<<n);i++){
			int pop=popcount32(i);
			if(ans<=pop)continue;
			int pre=0;
			for(int j=0;j<n;j++){
				pre|=(i>>j&1)*prelearn[j];
			}
			if((i&pre)!=pre)continue;
			int s=0;
			for(int j=0;j<n;j++){
				s+=(i>>j&1)*tanni[j];
			}
			if(u<=s)ans=pop;
		}
		cout<<ans<<endl;
	}
    return 0;
}

Measured memory_bytes: 1160
N, X = map(int, input().split())


def a(N):
    return 2 ** (N + 2) - 3


def p(N):
    return 2 ** (N + 1) - 1


def f(N, X):
    if N == 0:
        return 1 if X > 0 else 0

    if X == 1:
        return 0
    elif X <= 1 + a(N - 1):
        return f(N - 1, X - 1)
    else:
        return p(N - 1) + 1 + f(N - 1, X - 2 - a(N - 1))


print(f(N, X))


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
using lint=int64_t;
using namespace std;

int main()
{
	int N,M;
	lint A[100010]={};
	lint sum=0;

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

	vector<int> v;
	for(int i=0;i<N;i++)
	{
		while(A[i]>0)
		{
			v.push_back(A[i]-A[i]/2);
			A[i]/=2;
		}
	}

	sort(v.begin(),v.end(),greater<int>());

	lint ans=0;
	for(int i=0;i<(int)v.size() && i<M;i++)
		ans+=v[i];

	cout << max((lint)0,sum-ans) << endl;
	return 0;
}


Measured memory_bytes: 19432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
#define arrlen(arr) (sizeof(arr)/sizeof(arr[0]))
#define Sort(arr) sort(arr, arr+arrlen(arr))
#define For(i,n) for(int i=0;i<n;i++)
#define Foreach(i,arr) For(i,arrlen(arr))
#define Arrin(arr) Foreach(i,arr){cin>>arr[i];}
#define Arrin2(arr1,arr2) Foreach(i,arr1){cin>>arr1[i]>>arr2[i];}
#define Arrin3(arr1,arr2,arr3) Foreach(i,arr1){cin>>arr1[i]>>arr2[i]>>arr3[i];}
	
int main(){
	int R,G,B,N;
	cin >> R >> G >> B >> N;
	int ans=0;
	For(i,N+1){
		For(j,N+1){
			if((N-i*R-j*G)%B==0&&N>=i*R+j*G) ans++;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>


#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
#define double long double

using namespace std;

int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;

int H, W;
char maze[33][33];
vector<P>v;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> H >> W;
	REP(i, H) {
		REP(j, W) {
			cin >> maze[i][j];
			if (maze[i][j] == 'B') {
				v.push_back({ i,j });
			}
		}
	}
	int N = v.size();
	int ans = 0;
	REP(i, N-1) {
		FOR(j, i + 1, N) {
			int res = abs(v[i].first - v[j].first) + abs(v[i].second - v[j].second);
			ans = max(res, ans);
		}
	}
	print(ans);
}



Measured memory_bytes: 3256
#include <stdio.h>

int str_length(const char s[]){
int len=0;
  while(s[len])
    len++;
  return len;
}

int main(){
  int a;
  char str[128]={};
  scanf("%d",&a);
  scanf("%s",str);
  if (a>=str_length(str)){
  for(int i=0;i<str_length(str);i++)
    putchar(str[i]);
  }
  else {
    for(int i=0;i<a;i++){
    putchar(str[i]);
  }
  printf("...\n");
  }
  return 0;
}

Measured memory_bytes: 1664
n,m = map(int,input().split())
g = []
for _ in range(m):
    g.append(list(map(int,input().split())))

l = 0
r = 100001

for i in range(0,m):
    l = max(g[i][0],l)
    r = min(g[i][1],r)
    if l > r:
        break

print(max(0,r-l+1))

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

int main(){
  vector<int> a(5);
  vector<int> b(5, 0);
  int sum = 0, c; 
  
  for(int i = 0;5 > i;i++){
    cin >> a.at(i);
    if(a.at(i) % 10 != 0)
      b.at(i) = a.at(i) % 10;
  }
  
  int minv = 10;
  for(int i = 0;5 > i;i++){
    if(minv > b.at(i) && b.at(i) != 0){
      c = i;
      minv = b.at(i);
    }
  }
  for(int i = 0;5 > i;i++){
    if(i == c){
      sum += a.at(c);
      continue;
    }
    
    if(b.at(i) == 0)
      sum += a.at(i);
    else
      sum += (a.at(i) / 10 + 1) * 10;
  }
  
  cout << sum<< endl;
}

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

int main(){
    string s;
    cin >> s;
    if(s[s.size()-1] == 's'){
        cout << s + "es" << endl;
    }
    else{
        cout << s + "s" << endl;
    }
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(void) {
	string str;
	
	while(cin >> str) {
		int ans = -1;
		for(int i = 0; i < 10; i++) {
			string cp(str.begin(), str.end());
			vector<string> a;
			bool flag = true;
			string sum_str = "";

			for(int j = 0; j != string::npos;) {
				j = cp.find('X', j);
				if(j != string::npos)
					cp[j] = i + '0';
			}

			for(int j = 0, k = 0; j < cp.size(); k++, j++) {
				int start = j;
				string tmp;
				while(j < cp.size() && '0' <= cp[j] && cp[j] <= '9') j++;
				tmp = string(cp.begin() + start, cp.begin() + j);
				a.push_back(tmp);
			}

			if((a[0][0] == '0' && a[0].size() > 1) || (a[1][0] == '0' && a[1].size() > 1) || (a[2][0] == '0' && a[2].size() > 1))
				flag = false;

			for(int j = 0, carryout = 0; j < a[0].size() || j < a[1].size() || carryout; j++) {
				int tmp = carryout;
				if(j < a[0].size() && j >= a[1].size())
					tmp += a[0][a[0].size() - 1 - j] - '0';
				else if(j >= a[0].size() && j < a[1].size())
					tmp += a[1][a[1].size() - 1 - j] - '0';
				else if(j < a[0].size() && j < a[1].size())
					tmp += + a[0][a[0].size() - 1 - j] + a[1][a[1].size() - 1 - j] - '0' * 2;

				sum_str += tmp % 10 + '0';
				carryout = tmp / 10;
			}
			reverse(sum_str.begin(), sum_str.end());

			for(int j = 0; j < sum_str.size() || j < a[2].size(); j++) {
				if(j < sum_str.size() && j >= a[2].size()) {
					if(sum_str[sum_str.size() - 1 - j] != '0')
						flag = false;
				}
				else if(j >= sum_str.size() && j < a[2].size()) {
					if(a[2][a[2].size() - 1 - j] != '0')
						flag = false;
				}
				else {
					if(sum_str[sum_str.size() - 1 - j] != a[2][a[2].size() - 1 - j])
						flag = false;
				}
			}

			if(flag) {
				ans = i;
				break;
			}
		}

		if(ans == -1)
			cout << "NA" << endl;
		else
			cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  ll n,k;
  cin >>n>>k;
  n %= k; 
  while(1){
    ll y=abs(k-n);
    if(y>=n)break;

    n=y;
  }
  
  
  cout<<n;
}


Measured memory_bytes: 256
def I(): return int(input())
def LI(): return list(map(int,input().split()))
##################################################
N = I()
A = LI()
count = [0]*(N+1)
for x in A:
    count[x] += 1
nC2 = {}
sum = 0
for x in count:
    nC2[x] = x*(x-1)//2
    sum += nC2[x]
for x in count:
    if x-1 in nC2 or x==0:
        continue
    nC2[x-1] = (x-1)*(x-2)//2
for x in A:
    minus = nC2[count[x]]
    plus = 0 if count[x]==0 else nC2[count[x]-1]
    print(sum-minus+plus)

Measured memory_bytes: 26140
#include <iostream>
#include <queue>
using namespace std;
int main(){
  int N;
  int j;
  cin >> N;
  long long int max = 0;
  priority_queue<int, vector<int>, greater<int> > s;
  for(int i = 0; i < N; ++i){
    cin >> j;
    s.push(j);
    max = max + j;
  }

  if(max % 10 != 0){
    cout << max << endl;
    exit(0);
  }

  bool check = true;

  for(int i = 0; i < N; ++i){
    if(s.top() % 10 != 0){
      cout << max - s.top() << endl;
      check = false;
      break;
    }

    s.pop();
  }

  if(check){
  cout << 0 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int sign;
typedef long long ll;
#define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
#define Fordown(i,a,b) for(register sign i=(sign)(a);i>=(sign)(b);--i)
const int N=1e5+5;
template<typename T>bool cmax(T &a,T b){return (a<b)?a=b,1:0;}
template<typename T>bool cmin(T &a,T b){return (a>b)?a=b,1:0;}
template<typename T>T read()
{
	T ans=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')f=-1,ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
	return ans*f;
}
template<typename T>void write(T x,char y)
{
	if(x==0)
	{
		putchar('0'),putchar(y);
		return;
	}
	if(x<0)
	{
		putchar('-');
		x=-x;
	}
	static char wr[20];
	int top=0;
	for(;x;x/=10)wr[++top]=x%10+'0';
	while(top)putchar(wr[top--]);
	putchar(y);
}
void file()
{
#ifndef ONLINE_JUDGE
	freopen("D.in","r",stdin);
	freopen("D.out","w",stdout);
#endif
}



















int n,a[N];
void input()
{
	n=read<int>();
	For(i,1,n)a[i]=read<int>();
}
void work()
{
	int j,c=0,num,del=0;
	sort(a+1,a+n+1);
	For(i,1,n)
	{
		for(j=i;j<n&&a[j]==a[j+1];j++);
		num=j-i+1;
		del+=j-i;
		if(num%2==0)c^=1;
		i=j;
	}
	if(c)del++;
	write(n-del,'\n');
}
int main()
{
	//file();
	input();
	work();
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;


int main(){
    string s;
    cin>>s;
    int red=0,blue=0;
    rep(i,(int)s.size()){
        if(s[i]=='0')red++;
        else blue++;
    }
    int ans=min(red,blue);
    ans*=2;
    cout<<ans<<endl;
    return 0;
}

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

if w==1 or h==1:
  print(1)
elif h%2==0:
  print((h//2)*w)
else:
  if w%2==0:
    print(h*(w//2))
  else:
    print(h*(w//2)+(h//2)+1)
    
  


Measured memory_bytes: 2940
N,T=map(int,input().split())
ct=[0]*N
cost=[]
for i in range(N):
  ct[i]=list(map(int,input().split()))
  if ct[i][1]<=T :
    cost.append(ct[i][0])
if cost==[] :
  print("TLE")
else :
  print(min(cost))

Measured memory_bytes: 9120
#include<bits/stdc++.h>
#include <queue>
#include <stack>
using namespace std; 
typedef pair<long long int,long long int> pa;
#define resize(A) A.resize(unique(A.begin(), A.end()) - A.begin())
#define pb push_back
#define  MAX 200000
long long int MOD=998244353;
long long int INF=1e18;
                                            /* :-] */
 
int main()
{
         ios_base::sync_with_stdio(false); 
         cin.tie(NULL);
         cout.tie(NULL);
         long long int i,j,k=0,l=0,r=0,m=0,n,c,p=0,cnt=0,cnt1=0,x,y,z=0,a,b,low,mid,high,ans=0,maxi=0,mini=INF,t,x1,y1;
         cin>>n>>m;
         long double k1,l1,m1;
      //   multiset<long double>ms;
        // multiset<long double>::iterator it;
    priority_queue<long double>pq;
        long double A[n];
        for(i=0;i<n;i++)
        {
           cin>>A[i];
            pq.push(A[i]);
         }
    for(i=0;i<m;i++)
    {
        k1=pq.top();
        pq.pop();
       
        
        k1=k1/2;
        pq.push(k1);
    }
    while(!pq.empty())
    {
        k=pq.top();
        pq.pop();
        cnt+=k;
    }
    cout<<cnt<<endl;
          
 
    
    
}

Measured memory_bytes: 3568
use std::io::*;

fn main(){
    let n : usize = input();
    let x : usize = input();
    let l : Vec<usize> = (0..n).map(|_| input()).collect();
    let mut ans : usize = 1;
    let mut s : usize = 0;
    for i in 0..n{
        s += l[i];
        if s <= x{
            ans += 1;
        }else{
            break;
        }
    }
    println!("{}", ans);
}

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

Measured memory_bytes: 4352
#!/usr/bin/ruby
def insertionSort(a,g)
	for i in g..a.size-1
		v = a[i]
		j = i - g
		while j >= 0 && a[j] > v
			a[j+g] = a[j]
			j = j - g
			$cnt+=1
			a[j+g] = v
		end
	end
end

def shellSort(a)
	$cnt = 0
	g = []
	h = 1
	while h <= a.size
		g << h
		h = 3*h+1
	end
	g.reverse!
	m = g.size
	p m
	puts g*' '
	for i in 0..m-1
		insertionSort(a,g[i])
	end
end

a=gets.to_i.times.map{gets.to_i}
shellSort(a)
p $cnt
puts a

Measured memory_bytes: 14052
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean[] eng = new boolean[26];
		String s = sc.next();
		char[] c = s.toCharArray();
		char a = 'a';
		int aw = (int)'a';
		for(int i = 0;i < c.length; i++) {
			int cw = (int) c[i];
			eng[cw - aw] = true;
		}
		for(int m = 0; m < eng.length; m++) {
			if(eng[m] == true) {
			} else {
				char ans = (char) ((char)m + aw);
				System.out.println(ans);
				return;
			}
		}
		System.out.println("None");
	}
}


Measured memory_bytes: 27604
import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);
        boolean same = false;
        int no = Integer.parseInt(br.readLine());
        Dice[] dice = new Dice[no];

        for (int i=0; i<no; i++) {
            dice[i] = new Dice(br.readLine());
        }

        for (int j=0; j<no-1; j++) {
            for (int i=1; j+i<no; i++) {
                if(Compare.compare(dice[j],dice[j+i])) same = true;
            }
        }

        if (same) System.out.println("No");
        else System.out.println("Yes");
    }
}


class Dice {
    public int[] plane = new int[6];
    int tmp = -1;

    public Dice(String all){ //diceを作る
        String name[] = all.split(" ");
        for (int i=0; i<6; ++i) {
            plane[i] = Integer.parseInt(name[i]);
        }
    }

    public void east(){
      tmp = plane[0];
      plane[0] = plane[3];
      plane[3] = plane[5];
      plane[5] = plane[2];
      plane[2] = tmp;
    }

    public void north(){
      tmp = plane[0];
      plane[0] = plane[1];
      plane[1] = plane[5];
      plane[5] = plane[4];
      plane[4] = tmp;
    }

    public void south(){
      tmp = plane[0];
      plane[0] = plane[4];
      plane[4] = plane[5];
      plane[5] = plane[1];
      plane[1] = tmp;
    }

    public void west(){
      tmp = plane[0];
      plane[0] = plane[2];
      plane[2] = plane[5];
      plane[5] = plane[3];
      plane[3] = tmp;
    }

    public void spin(){
      tmp = plane[1];
      plane[1] = plane[2];
      plane[2] = plane[4];
      plane[4] = plane[3];
      plane[3] = tmp;
    }

}

class Compare {
    public static boolean compare(Dice d1, Dice d2){
        if(check(d1,d2)) return true;
        for (int i=0; i<3; ++i) {
            d2.spin();
            if(check(d1,d2)) return true;
        }
        d2.west();
        if(check(d1,d2)) return true;
        for (int i=0; i<3; ++i) {
            d2.spin();
            if(check(d1,d2)) return true;
        }
        d2.east();
        if(check(d1,d2)) return true;
        for (int i=0; i<3; ++i) {
            d2.spin();
            if(check(d1,d2)) return true;
        }
        d2.north();
        if(check(d1,d2)) return true;
        for (int i=0; i<3; ++i) {
            d2.spin();
            if(check(d1,d2)) return true;
        }
        d2.west();
        if(check(d1,d2)) return true;
        for (int i=0; i<3; ++i) {
            d2.spin();
            if(check(d1,d2)) return true;
        }
        d2.west();
        if(check(d1,d2)) return true;
        for (int i=0; i<3; ++i) {
            d2.spin();
            if(check(d1,d2)) return true;
        }

        return false;
    }
    private static boolean check(Dice d1, Dice d2){
        if(d1.plane[0] == d2.plane[0] && d1.plane[1] == d2.plane[1] && d1.plane[2] == d2.plane[2] && d1.plane[3] == d2.plane[3] && d1.plane[4] == d2.plane[4] && d1.plane[5] == d2.plane[5]){
                return true;
        }
        return false;
    }
}

Measured memory_bytes: 23444