akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

ll n;
ll a[300000];
ll bdp[300000], fdp[300000];
priority_queue<ll, vector<ll>, greater<ll>> fque;
priority_queue<ll> bque;
ll fsum = 0, bsum = 0;

int main() {
    cin >> n;
    rep(i,3*n) cin >> a[i];
    rep(i,n) {
        fque.push(a[i]);
        fsum += a[i];
    }
    for (int i = 2*n; i < 3*n; i++) {
        bque.push(a[i]);
        bsum += a[i];
    }
    fdp[n] = fsum;
    for (int i = n; i < 2*n; i++) {
        ll q = fque.top();
        if (q < a[i]) {
            fque.pop();
            fque.push(a[i]);
            fdp[i+1] = fdp[i]+a[i]-q;
        } else {
            fdp[i+1] = fdp[i];
        }
    }
    bdp[2*n] = bsum;
    for (int i = 2*n-1; i >= n; i--) {
        ll q = bque.top();
        if (q > a[i]) {
            bque.pop();
            bque.push(a[i]);
            bdp[i] = bdp[i+1]+a[i]-q;
        } else {
            bdp[i] = bdp[i+1];
        }
    }
    ll ans = -INF*INF;
    for (int i = n; i <= 2*n; i++) {
        ans = max(ans, fdp[i]-bdp[i]);
    }
    cout << ans << endl;
}
































Measured memory_bytes: 7796
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n) 
{ v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i]; }
template<class T, class U> void read_n(vector<pair<T, U>>& v, size_t n)
{ v = vector<pair<T, U>>(n); 
  for (lli i=0; i<n; ++i) cin >> v[i].first >> v[i].second; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n;
vector<lli> a;
lli cnt[4];
double dp[301][301][301];

double dfs(lli i, lli j, lli k) {
  if (dp[i][j][k] >= 0.0) return dp[i][j][k];
  lli s = i + j + k;
  double a = double(n) / s;
  double b = 0;
  if (i > 0) b += double(i) / s * dfs(i - 1, j, k);
  if (j > 0) b += double(j) / s * dfs(i + 1, j - 1, k);
  if (k > 0) b += double(k) / s * dfs(i, j + 1, k - 1);
  return dp[i][j][k] = a + b;
}

int main() {
  fill(&cnt[0], &cnt[3], 0);
  fill(((double*)dp), ((double*)dp) + (301*301*301-1), -1);
  dp[0][0][0] = 0.0;
  cin >> n; 
  for (lli i=0; i<n; ++i) {
    lli x; cin >> x;
    cnt[x]++;
  }
  double ans = dfs(cnt[1], cnt[2], cnt[3]);
  printf("%.12lf\n", ans);
  return 0;
}


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

#define ll long long int
#define str string
#define sec .second

ll MOD = 1000000007,INFL = 1ll << 60,INF = 1 << 30;
ll A[10000] = {},X[1000] = {},coun[60] = {},bcou[60] = {};
pair<ll,ll> rui[100000] = {},ruin[100002] = {};
int dy[]={0, 0, 1, -1},dx[]={1, -1, 0, 0};
vector <ll> v;
double a = 0,b = 0,c = 0,d = 0,e = 0,f = 0,n = 0,su = 0, ma = INF,mi=-1;
double ans;
pair<str,ll> S[1000];
bool an = false,bn = false;



int main(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        //Code Line
cin >> a >> b >> c >> d;
e = min(c * b, (a - c) * b);
f = min(d * a, (b - d) * a);
if(a / 2 == c && b / 2 == d)cout << max({e,f, a * b / 2}) << " " << 1 << endl;
else cout << max({e,f, a * b / 2}) << " " << 0 << endl;
  //Code Line
        return 0;
}


Measured memory_bytes: 3456
import heapq
N,M = map(int,input().split())
H=[]
for i in input().split():
    heapq.heappush(H,-int(i))
for i in range(M):
    a = heapq.heappop(H)
    heapq.heappush(H,-(-a//2))
print(-sum(H))

Measured memory_bytes: 64112
import java.util.Scanner;

/**
 * 解説どおりに作成したソースコード
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int x1 = scanner.nextInt(), y1 = scanner.nextInt();
			int x2 = scanner.nextInt(), y2 = scanner.nextInt();
			int xDiff = x2 - x1, yDiff = y2 - y1;
			System.out.printf("%d %d %d %d\n", x2 - yDiff, y2 + xDiff, x1 - yDiff, y1 + xDiff);
		}
	}
}


Measured memory_bytes: 35732
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i)
#define mod 1e9 + 7
typedef long long ll;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	　　　　　 　 _... ..._
	　　　　　 , ´⌒ ⌒ヽ
	　　　 　 ﾉｨ（ノﾉ）ﾉ）ﾉ）
	　　　 　 （（q|.ﾟ ヮﾟﾉ|ﾊ
	　　　　　　△ﾑ,8ﾑﾌつ
	　　　　　/(ﾝ_/＿ヽ＼
	　　　　 ～～i_ﾌ_ﾌ～´
	*/
	int ans = 0;
	string s;
	cin >> s;
	rep0(i, 3) {
		if (s[i] == '+') {
			++ans;
		}
		else {
			--ans;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>


int main(void){

    int N=10,count=0,judge=0;
    scanf("%d",&N);
    
    int a[N],b[N];

    for(int n=0;n<N;n++){
        scanf("%d %d",&a[n],&b[n]);
    }


    for(int n=0;n<N;n++){
        if(a[n]==b[n])count++;
        else count=0;
        //printf("%d ",count);
        if(count==3)judge=1;
    }


    if(judge==1)printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 1736
import math

N = int(input())

def f(a, b): 
    return max(len(str(a)), len(str(b)))
    
max_len = 0

for i in range(1, int(math.sqrt(N)) + 1) :
    if N % i == 0 :
        max_len = f(i, N // i)
        
print(max_len)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<vector<ll> > Graph;
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 ll INF = 1e9;

ll D;
vector<ll>c(26);

int main(){
    cin >> D;
    rep(i,26)cin>>c[i];
    vector<vector<ll> >s(D,vector<ll>(26));
    rep(i,D)rep(j,26)cin>>s[i][j];
    vector<ll>last(D,0);
    ll manzoku = 0;
    vector<ll>ans;
    rep(i,D){
        ll t = 0;
        ll M = 0;
        /*ここにtを選ぶアルゴリズムをかく*/
        rep(j,26){
            ll now = 0;
            now += s[i][j];
            rep(k,26){
                if(k==j)continue;
                now -= c[k]*(i+1-last[k]);
            }
            if(chmax(M,now)){
                t = j;
            }
        }
        manzoku += s[i][t];
        last[t]=i+1;
        rep(j,26){
            manzoku -= c[j]*(i+1-last[j]);
        }
        ans.push_back(t);
    }
    rep(i,ans.size()){
        cout << ans[i]+1 << endl;
    }
    return 0;
}


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

using namespace std;

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

void make_all_case(vector<vector<char>> &cals, vector<vector<char>> &cases, int x, vector<char> &tmp) {
    //ベースケース
    if(x == -1){
        cases.push_back(tmp);
        return;
    }
    //再帰ステップ
    for(char op : cals.at(x)){
        tmp.at(x) = op;
        make_all_case(cals, cases, x - 1, tmp);
    }
}

vector<vector<int>> connecting(vector<char> &c, vector<int> &nums){
    vector<vector<int>> connected(0);
    vector<int> first_num(1, nums.at(0));
    connected.push_back(first_num);
    int index = 0;
    rep(i, c.size()){
        if(c.at(i) == '+'){
            index++;
        }
        if(index >= connected.size()){
            vector<int> connected_num(1, nums.at(i+1));
            connected.push_back(connected_num);
        } else {
            connected.at(index).push_back(nums.at(i+1));
        }
    }
    return connected;
}

long long calculate(vector<char> &c, vector<int> &nums){
    vector<vector<int>> values = connecting(c, nums);
    long long res = 0;
    rep(i, values.size()){
        long long tmp = 0;
        rep(j, values.at(i).size()){
            tmp = tmp*10 + values.at(i).at(j);
        }
        res += tmp;
    }
    return res;
}

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

    vector<int> nums(0);
    long long &tmp = S;
    while(tmp > 0){
        nums.push_back(tmp % 10);
        tmp /= 10;
    }
    reverse(nums.begin(), nums.end());
    // rep(i, nums.size()){
    //     cout << nums.at(i);
    // }
    // cout << endl;

    vector<char> cal(2);
    cal = {'+', '~'};
    vector<vector<char>> cals(nums.size() - 1, cal);
    vector<vector<char>> cases(0, vector<char>(cals.size()));
    vector<char> new_vec(cals.size());
    make_all_case(cals, cases, cals.size() - 1, new_vec);
    // rep(i, cases.size()){
    //     cout << i+1 << ':';
    //     rep(j, cases.at(0).size()){
    //         cout << cases.at(i).at(j);
    //     }
    //     cout << endl;
    // }
    long long ans = 0;
    for(vector<char> c : cases){
        ans += calculate(c, nums);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
using namespace std;
using namespace __gnu_pbds;

#define sp << " " <<
#define mod 1000000007
#define PI 3.14159265358979323
#define y second
#define x first
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define pqueue priority_queue< ll >
//#define pdqueue priority_queue< ll,vector<ll> ,greater< ll > >
#define codejamDebug(x) cout<<"Case #"<<x<<": ";
#define debug(x) cout<<#x<<" :"<<x<<endl;
#define rep(i,n) for(long long i=0;i<n;i++)
#define f(i,a,b) for(long long i = a; i < b; i++)
#define fd(i,a,b) for(long long i = a; i >=b; i--)
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int           ll;
typedef long double             ld;
typedef unsigned long long int ull;
typedef vector <int>            vi;
typedef vector <ll>            vll;
typedef pair <int, int>        pii;
typedef pair <ll, ll>          pll;
typedef vector < pii >        vpii;
typedef vector < pll >        vpll;
typedef vector <string>         vs;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//Handle:cyber_rajat

int main(int argc, char const *argv[])
{
	sync;
	int a,b,c;
	cin >>a>>b>>c;
	cout<<c sp a sp b<<endl;
	return 0;
}


Measured memory_bytes: 256
class Dice:
    def __init__(self, data):
        self.data = data

    def move(self, direction):
        if direction == 'E':
            self.data[0],self.data[3], self.data[5], self.data[2] = \
                self.data[3],self.data[5], self.data[2], self.data[0] 
        elif direction == 'N':
            self.data[0],self.data[1], self.data[5], self.data[4] = \
                self.data[1],self.data[5], self.data[4], self.data[0]
        elif direction == 'S':
            self.data[0],self.data[1], self.data[5], self.data[4] = \
                self.data[4],self.data[0], self.data[1], self.data[5]
        elif direction == 'W':
            self.data[0],self.data[2], self.data[5], self.data[3] = \
                self.data[2],self.data[5], self.data[3], self.data[0]

    def getTop(self):
        return self.data[0]

dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
    dice.move(cmd[i])
print(dice.getTop())

Measured memory_bytes: 6756
#include <cstdio>
#include <cstring>
using ll = long long;

using namespace std;

int main(){
		ll n;scanf("%lld",&n);
		ll ans;
		bool arr[100020];
		memset(arr,true,sizeof(arr));
		for(ll i=2;i<100020;i++){
				if(arr[i]){
						if(i>=n){
							ans=i;
							break;
						}
						for(ll j=i;j<100020;j+=i)arr[j]=false;
					}
			}
	   printf("%lld",ans);
	   return 0;			
	}


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

int main(){
	int N,A;
	cin >> N >> A;
	vector<int> x(N);
	for(int i=0;i<N;i++)	cin >> x.at(i);
	
	//i個め、これまでの合計、これまで何個選んできたか
	vector<vector<vector<long long>>> dp(N+1,vector<vector<long long>>(2501,vector<long long>(N+1,0)));
	dp.at(0).at(0).at(0)=1;
	for(int i=1;i<N+1;i++){
		for(int j=0;j<2501;j++){
			for(int k=0;k<N+1;k++){
				dp.at(i).at(j).at(k)+=dp.at(i-1).at(j).at(k);
				if(j-x.at(i-1)>=0 && k-1>=0){
					dp.at(i).at(j).at(k)+=dp.at(i-1).at(j-x.at(i-1)).at(k-1);
				}
			}
		}
	}
	long long ans=0;
	for(int i=1;i<=N;i++){
		ans+=dp.at(N).at(A*i).at(i);
	}
	cout << ans << endl;
	
	return 0;
}


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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;
typedef priority_queue< int, vector< int >, greater< int > >  minHeap;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bug(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

inline int addmod(lli x,lli y)
{
    return (x%mod + y%mod)%mod;
}
inline int submod(lli x,lli y)
{
    return (x%mod - y%mod + mod)%mod;
}
inline int mulmod(lli x,lli y)
{
    return (x%mod * y%mod)%mod;
}


inline int nextSubMask(int i, int mask)
{
    return (i-1)&mask;   /// returns next  submask
}

template<typename T>
void we_r_done(T mssg)
{
    cout<<mssg;
    exit(0);
}
lli n;
int solve(lli now=0, bool d3=false , bool d5=false, bool d7=false){
    if(now>n) return 0;

    int ret = 0;
    if(d3&&d5&&d7) ret = 1;
    ret += solve(now*10 + 3, true, d5, d7);
    ret += solve(now*10 + 5, d3, true, d7);
    ret += solve(now*10 + 7, d3, d5, true);
    return ret;
}

int main()
{
    ///freopen("output.txt","w",stdout);
   // freopen("input.txt","r",stdin);
    FastIO;


    while(cin>>n){
        cout<<solve()<<endl;
    }

    return 0;
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?
///sort(atoz(v), [](const data x, const data y){return (x.a==y.a?x.b>y.b : x.a<y.a);});


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <queue>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define Q 1000000007

// ll white, black;
// vector<vector<char>> c(h, vector<char>(w));
// ll ans = 0;
// vector<ll> a(N);
// const int M = 2;
// void dfs(vector<int> &A) {
//     // 終端条件 --- 10 重ループまで回したら処理して打ち切り
    

//     if(A.size() == h+w){
//       // rep(i, A.size()) cout << A[i];
//       // cout << " ";
//       vector<vector<char>> tmp(h, vector<char>(w));
//       rep(i, h){
//         rep(j, w) tmp[i][j] = c[i][j];
//       }
//       ll cnt = black;
//       for(ll i = 0; i < h; i++){
//         if(A[i] == 1){
//           // cout << i << " ";
//           rep(j, w){
//             if(tmp[i][j] == '#'){
//               tmp[i][j] = 'r';
//               cnt--;
//             }
//           }
//         }
//       }
//       for(ll i = h; i < h+w; i++){
//         if(A[i] == 1){
//           // cout << i << " ";
//           rep(j, h){
//             if(tmp[j][i-h] == '#'){
//               tmp[j][i-h] = 'r';
//               cnt--;
//             }
//           }
//         }
//       }

//       // cout << cnt << endl;
//       if(cnt == k) ans++;
      
//       return;
//     }

//     for (int v = 0; v < M; ++v) {
//         A.push_back(v);
//         dfs(A);
//         A.pop_back(); // これが結構ポイント
//     }
// }

int main(){
  
  ll n,d;
  cin >> n >> d;
  // vector<ll> x(n),y(n);
  ll x,y;
  ll count = 0;
  rep(i,n){
    cin >> x >> y;
    double dis = sqrt(x*x+y*y);
    if(dis <= d) count++;
  }

  cout << count << endl;



  return 0;
}

Measured memory_bytes: 3676
N = int(input())
B_list = list(int(Bi) for Bi in input().split(' '))

num=0
B_pre=0

for i in range(len(B_list)):
  if i==0:
    num+=B_list[i]
    B_pre=B_list[i]
  else:
    if B_list[i]>=B_pre:
      num+=B_pre
    else:
      num+=B_list[i]
    
    B_pre=B_list[i]
    
num+=B_list[-1]

print(num)

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

int main()
{
    int A, B;
    cin >> A >> B;

    int ret = 0;
    if (A > B)
    {
        ret += A;
        --A;
    }
    else
    {
        ret += B;
        --B;
    }

    ret += max(A, B);

    cout << ret << endl;

    return 0;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n, t;cin >> n >> t;
    vector<int> ans;
    inc(i, 0, n){
        int c, tt;cin >> c >> tt;
        if(tt <= t){
            ans.pb(c);
        }
    }
    if(ans.size()){
        sort(ans.begin(), ans.end());
        cout << ans[0] << endl;
    }else{
        cout << "TLE" << endl;
    }
    return 0;
}


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

int main() {
	// your code goes here
	ll m, d;
	cin>>m>>d;
	ll ans = 0;
	for (ll i=2; i<=9; i++) {
	    for (ll j=2; j<=9; j++){
	        if (i*10 + j <= d && i*j <= m)
	            ans++;
	    }
	}
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d)){
        cout << "Yes\n";
    } else{
        cout << "No\n";
    }
    return 0;
}

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

struct data{
    int a, b;
    data(int a, int b) : a(a), b(b) {}
    data() {}    
    bool operator< (const data other) const{
        return b > other.b;
    }
};

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

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

    bool allsame = true;
    for(int i = 1; i < n; i++)  if(a[i-1] != a[i])  allsame = false;

    if(allsame){
        cout << n/2 << endl;
        return 0;
    }
    
    map<int,int> x, y;
    for(int i = 0; i < n; i++){
        if(i%2 == 0)    x[a[i]]++;
        if(i%2 == 1)    y[a[i]]++;
    }

    vector<data> s, t;
    for(auto p : x) s.push_back(data(p.first, p.second));
    for(auto p : y) t.push_back(data(p.first, p.second));

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

    int ans = n;
    for(data p : s){
        for(data q : t){
            if(p.a != q.a){
                ans = min(ans, n/2-p.b + n/2-q.b);
                break;
            }
        }
    }

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

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

template<class T> inline bool chmin(T &a, T b){
    if(a > b){
        a = b;
        return true;
    }
    return false;
}

//2019 = 3 * 673
int main(){
    long long L, R;
    cin >> L >> R;
    long long range = R - L + 1;
    long long ans = 0;
    if(range < 673){
        ans = 1e10;
        for(long long i = L; i < R; i++){
            for(long long j = i + 1; j <= R; j++){
                long long res = i * j % 2019;
                chmin(ans, res);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <unordered_map>

using namespace std;


int main() {
    
    int n;
    int person[4][3][10] = {};
    cin >> n;
    for (int i = 0;i<n;i++){
        int b,f,r,v;
        cin >> b >> f >> r >> v;
        person[b-1][f-1][r-1] += v;
    }
    for(int i=0;i<4;i++){
        for (int j=0;j<3;j++){
            for (int k=0;k<10;k++){
                cout << " " << person[i][j][k];
            }
            cout << endl;
        }
        if(i != 3) {
            cout << "####################" << endl;
        }
    }
}


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

int main() {
  int n;cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  int ans=0,cnt=0;
  rep(i,n){
    cnt=max(cnt,a[i]);
    if(a[i]>=cnt)ans++;
  }
  cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;

int n;
map<ll, int> m;

void solve() {
  ll cnt = 0;
  for (auto& p : m) {
    if (p.second % 2 == 1) {
      cnt++;
    }
  }
  cout << cnt << endl;
}

int main() {
  ll a;
  cin >> n;
  for (int i=0;i<n;i++) {
    cin >> a;
    m[a]++;
  }
  solve();
}


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

int main(){
  int h,w;
  while(1){
    cin >> h >> w;
    if(h==0&&w==0) break;
    
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++) cout << "#";
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

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

int main() {

	long long N;
	cin >> N;

	vector<long long> a(100100);

	long long x;
	long long ans = 0;
	for (int i = 0; i < N; i++) {
		cin >> x;
		a[x] ++;
		ans += x;
	}
	
	long long q;
	cin >> q;
	long long b, c;
	for (int i = 0; i < q; i++) {
		cin >> b >> c;
		ans = ans - (a[b] * b) +( c * a[b]);
		
		
		a[c] += a[b];

		a[b] = 0;
		
		cout << ans << endl;
	}

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <ll, ll> dl;
typedef pair <int, int> ii;
typedef pair <ll, ll> dll;
typedef vector <ii> vii;
typedef vector <vii> graph;

int n, m;
char mat[410][410];
vector <vector <bool> > vis;
ll total = 0;
ll hashtag;
int px[4] = {-1, 0, 1, 0};
int py[4] = {0, 1, 0, -1};
char est;

ll ff (int y, int x) {
    if (y >= n || y < 0 || x >= m || x < 0) return 0;
    if (mat[y][x] != est || vis[y][x]) return 0;
    vis[y][x] = true;
    ll temp = 0;
    if (est == '.') temp++;
    else hashtag++;
    char copia = est;
    for (int i = 0; i < 4; ++i)
    {
        if (est == '#') est = '.';
        else est = '#';
        temp += ff(y + py[i], x + px[i]);
        est = copia;
    }
    return temp;
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    cin >> n >> m;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            cin >> mat[i][j];
        }
    }
    vector <bool> empty;
    empty.assign(m + 10, false);
    vis.assign(n + 10, empty);
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            if (mat[i][j] == '#') {
                est = '#';
                hashtag = 0;
                total += hashtag * ff(i, j);
            }
        }
    }
    cout << total << "\n";
	return 0;
}


Measured memory_bytes: 10496
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

bool is_splitter(char c)
{
	return c==' ' || c==',' || c=='.';
}

int main()
{
	string s;
	getline(cin,s);
	replace_if(allof(s),is_splitter,' ');
	
	istringstream iss(s);
	vs res;
	for(string t;iss>>t;)
		if(3<=t.size() && t.size()<=6)
			res.push_back(t);
	
	rep(i,res.size())
		cout<<res[i]<<(i==res.size()-1?'\n':' ');
	
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n" 
typedef long long int ll;
 
int main()
{
    fast;
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <utility>
#include <cmath>

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

int main()
{

    int k, s;
    cin >> k;
    cin >> s;
    int ans = 0;

    for (int a = 0; a <= k; ++a)
    {
        for (int b = 0; b <= k; ++b)
        {
            int c = s - a - b;
            if (0 <= c && c <= k)
            {
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

const long long INF = 1e9;

long long dp[10001];

int main(void)
{
    int health;
    int magics_count;
    vector<int> damages;
    vector<int> costs;

    for(int i = 0; i <= 10001; i++){
        dp[i] = INF;
    }

    cin >> health >> magics_count;

    for(int i = 0; i < magics_count; i++){
        int d, c;
        cin >> d >> c;
        damages.push_back(d);
        costs.push_back(c);

    }

    dp[0] = 0;
    for(int dmg = 0; dmg <= health; dmg++){
        for(int m = 0; m < magics_count; m++){
            int reach_damage = min(dmg + damages[m], health);
            dp[reach_damage] = min(dp[reach_damage], dp[dmg] + costs[m]);
        }
    }

    cout << dp[health] << endl;

    return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoderGrand030
{
    class A_PoisonousCookies
    {
        static void Main(string[] args)
        {
            // 文字列の入力
            string[] s = Console.ReadLine().Split(' ');
            int A = int.Parse(s[0]);
            int B = int.Parse(s[1]);
            int C = int.Parse(s[2]);

            int ans = 0;

            if (C - A - B > 0)
            {
                ans = (A + B) + B + 1;

            }
            else {
                ans = C + B;
            }

            //出力
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> isPair;
using vvll = vector< vector<ll> >;
using vll = vector<ll> ;
#define Pll pair<ll,ll>
#define vpll vector<pll>
#define sll set<ll>
#define mll map<ll,ll>

const ll inf=(ll)1e18;
const ll maxs = (ll)1e5+5;
const ll mod = (ll)1e9+7;
const ll oo = (ll) 1e18;

#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define LB lower_bound
#define UB upper_bound
#define line cout<<endl;
#define fr(i,a,b) for(int i=a;i<=b;++i)
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fastio(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mst(x,a) memset(x,a,sizeof(x))

ll getPow(ll num, ll pow) {
    ll res = 1;
    num %= mod;
    while(pow) {
        if(pow & 1)
            res = (res * num) % mod;
        num = (num * num) % mod;
        pow >>= 1;
    }
    return res;
}

ll INV(ll num) {
    num %= mod;
    return getPow(num, mod - 2);
}

ll n;
vll Tree[maxs];
ll dp[maxs][2];


void go(ll s,ll p)
{
    for(auto d : Tree[s])
    {
        if(d!=p)
            go(d,s);
    }
    ll m1=1;// black
    ll m2=1;// white
    for(auto d : Tree[s])
    {
        if(d!=p)
        {
            m1 = (m1*dp[d][1])%mod;
            m2 = (m2%mod*(dp[d][0]+dp[d][1])%mod)%mod;
        }
    }
    dp[s][0] = m1;
    dp[s][1] = m2;
    
}

int main() 
{
    fastio();
	ll t=1;
    //cin>>t;
    while(t--)
	{
        cin>>n;
        ll q=n-1;
        while(q--)
        {
            ll s,d;
            cin>>s>>d;
            Tree[s].pb(d);
            Tree[d].pb(s);
        }
        go(1,0);
        cout<<(dp[1][0]+dp[1][1])%mod;
    }
	
	return 0;
}

Measured memory_bytes: 12800
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

/* #include <bits/stdc++.h> */

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    int a,b;
    while (cin >> a >> b) {
        if (a  <= 5)
            cout << 0 << endl;
        else if (6 <= a && a <= 12)
            cout << b/2 << endl;
        else
            cout << b << endl;
    }
    return 0;
}


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

using namespace std;
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

int main (){
    int N;
  	long long x;
    cin >> N >> x;
  	long long a[150];
    cinf(N,a);
    long long suma,count = 0;
    sort(a, a+N);
    REP(i, N){
        suma += a[i];
    }
    bool can = true;
    REP(i, N){
        if(suma >= x){
            if(x >= a[i]){
                count ++;
                x -= a[i];
        }
        }else{
            if(x >= a[i]){
                count ++;
                x -= a[i];
            }
            can = false;
        }
    }
    if(!can) count--;
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    
    ll a[100] = {};
    a[0] = 2;
    a[1] = 1;
    
    for(int i=2;i<100;i++){
        a[i] = a[i-1]+a[i-2];
    }
    
    cout << a[N] << endl;
}




Measured memory_bytes: 256
N = int(input())
S = input()
lc, rc = 0, 0
for i in range(1, N):
  if S[i] == 'E':
    rc += 1
m = lc + rc
for i in range(N-1):
  if S[i] == 'W':
    lc += 1
  if S[i+1] == 'E':
    rc -= 1
  if lc + rc < m:
    m = lc + rc
print(m)

Measured memory_bytes: 3676
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


int a,b;

void output(int h, int w, int x, int y){
    vector<int> cnt(w);
    rep(i,y)cnt[i]=b;
    REP(i,y,w)cnt[i]=h-b;
    rep(i,x){
        int c = a;
        rep(j,w){
            if(c&&cnt[j]){
                cout<<1;
                --c;
                --cnt[j];
            }
            else cout<<0;
        }
        cout<<endl;
    }
    REP(i,x,h){
        int c = w-a;
        rep(j,w){
            if(c&&cnt[j]){
                cout<<1;
                --c;
                --cnt[j];
            }
            else cout<<0;
        }
        cout<<endl;
    }
}
int main(){
    int h,w;
    cin>>h>>w>>a>>b;
    rep(i,h+1)rep(j,w+1){
        if((2*a-w)*i-(2*b-h)*j==a*h-b*w){
            output(h,w,i,j);
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("gpg");
            //0
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("ggppgggpgg");
            //2
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        string s = InputList[0];

        int Score=0;
        for (int I = 0; I <= s.Length - 1; I++) {

            //自分がグーで相手がパー
            if (I % 2 == 0 && s[I] == 'p') Score--;

            //自分がパーで相手がグー
            if (I % 2 == 1 && s[I] == 'g') Score++;
        }
        Console.WriteLine(Score);
    }
}


Measured memory_bytes: 3032
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		String s = sc.next();
		sc.close();
		
		if (s.matches("^\\d{" +a+ "}-\\d{" +b+ "}$")) {
			System.out.println("Yes");
	    } else {
			System.out.println("No");
		}
		
	}

}


Measured memory_bytes: 23764
n = int(input())
if n < 10:
  print(n)
elif 10 <= n < 100:
  print(9)
elif 100 <= n < 1000:
  print(n-90)
elif 1000 <= n < 10000:
  print(909)
elif n == 100000:
  print(90909)
else:
  print(n-9090)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define ll long long
inline int roundup(int a, int b) { return (((a + (b -1)) / b)); }
using namespace std;
const ll mod=1000000007;


ll powmod(ll x,ll y){
    ll res=1;
    for(ll i=0;i<y;i++){
        res=res*x%mod;
    }
    return res;
}

signed main(void) {
    int n;
    cin >>  n;
    ll ans = (powmod(10, n) - powmod(9, n) - powmod(9, n) + powmod(8, n))%mod;
    ans=(ans+mod)%mod; // ansが負の値になることを予期する

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

Measured memory_bytes: 3588
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

bool prime(ll x) {
    bool flag = true;
    for(int i = 2; i * i <= x; ++i) {
        if(x % i == 0) {
            flag = false;
            break;
        }
    }
    return flag;
}

int main(void) {
    int x; cin >> x;  
    ll ans = x;
    while(1) {
        if(prime(ans)){
            break;
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define MOD 1e+7
#define inf 1e9
#define fi first
#define se second
using namespace std;

const int dx[4] = { 0, 0, 1, -1 };
const int dy[4] = { 1, -1, 0, 0 };

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

	int h, w;
	cin >> h >> w;
	vector<string> grid(h); // 実質vector<vector<char>>
	rep(i, h) cin >> grid[i];

	int res = -1;
	// 二重ループでスタート地点を全探索してBFS
	rep(sh, h)
	{
		rep(sw, w)
		{
			if (grid[sh][sw] == '#') continue; // 壁はスタートにしない
			queue<pair<int, int>> que; // pair<int, int>のqueueで座標を持つ
			vector<vector<int>> dist(h, vector<int>(w, -1)); // h * wのint型の二次元配列を-1で初期化(=未探索)
			dist[sh][sw] = 0;
			que.push({ sh, sw });
			// BFS
			while (!que.empty()) {
				int vh = que.front().fi;
				int vw = que.front().se;
				que.pop();
				//四方向
				rep(dir, 4)
				{
					int nvh = vh + dx[dir];
					int nvw = vw + dy[dir];
					
					// いつもの範囲外をはじくやつ
					if (nvh < 0) continue;
					if (nvw < 0) continue;
					if (nvh >= h) continue;
					if (nvw >= w) continue;
					if (dist[nvh][nvw] != -1) continue;
					if (grid[nvh][nvw] == '#') continue;

					dist[nvh][nvw] = dist[vh][vw] + 1;
					que.push({ nvh, nvw });
				}
			}
			// 配列を縦に舐めて列ごとに*max_elementで更新
			rep(i, h) res = max(res, (int)*max_element(dist[i].begin(), dist[i].end()));
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <complex>
using namespace std;

int main()
{
	int N;
	cin>>N;
	vector<int> C(N);
	vector<int> V(N);

	for(int i=0; i<N; i++)
	{
		cin>>V[i];
	}
	for(int i=0; i<N; i++)
	{
		cin>>C[i];
	}
	int result = 0;
	for(int i=0; i<N; i++)
	{
		if(V[i]>C[i])
		{
			result += V[i]-C[i];
		}
	}
	cout<<result<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

/* #include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree
    <T, null_type, greater<T>, 
    rb_tree_tag,tree_order_statistics_node_update>;
 */ 

#define rep(i,k,n) for(int i = k; i < n; i++)  
#define per(i,k,n) for(int i = k; i >= n; i--)  
#define repp(i,a,n,k) for(typeof(a) i=a;i!=n;i+=k)

#define int long long
#define all(a) a.begin(),a.end()       

#define pb push_back
typedef long long ll; 
typedef pair<int, int> ii;
typedef pair<int,ii > iii;

typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<char> vchar;

#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)

#define ff first
#define ss second

#define lb lower_bound
#define ub upper_bound
#define me max_element

#define INF 1000000000
//#define mod 998244353
#define mod 1000000007
#define endl "\n"


  


int modPow(int a, int b);
int modInv(int a);     




void solve(){
    
    int k;
    cin >> k;
    rep(i,0,k)cout << "ACL";

}


// lower_bound & upper_bound only works on sorted array (Not reverse sorted)
// Recheck if it is 2^9 or 10^9 
//check for long long overflow
//while adding and subs check if mod becomes -ve
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;




signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed;
    //cout <<setprecision(6);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
  // int test=1; cin >> test; while(test--)
    solve();
}

int modPow(int a, int b){
    if(b==0)return 1;
    if(b%2==0){
        int x = a*a;
        x%=mod;
        return modPow(x,b/2);
    }
    return (a*modPow(a,b-1))%mod;
}


int modInv(int a){
    return modPow(a,mod-2);
}





Measured memory_bytes: 3540
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define srand() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l,r) uniform_int_distribution<int>(l,r)(rng)
typedef unsigned long long ull;
const int inf=1039074182;
using namespace std;

int main()
{
//	freopen("input.txt","r",stdin);
  	int n;
  cin>>n;
  cout<<(n-2)*180<<endl;
	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
dataA = [list(map(int, input().split())) for _ in range(n)]
dataB = [list(map(int, input().split())) for _ in range(m)]
for i in range(n) :
	c_i = 0
	for j in range(m) :
		c_i += dataA[i][j] * dataB[j][0]
	print(c_i)



Measured memory_bytes: 6024
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    string str = "";
    cin >> str;
    int len = str.size();
    len--;
    len /= 2;
    for (int i=len; i>=1; i--) {
        bool flag = true;;
        for (int j=0; j<i; j++) {
            if (str.at(j) != str.at(j+i)) {
                flag = false;
                break;
            }
        }
        if (flag) {
            cout << 2*i << endl;
            break;
        }
    }
    return 0;
}


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

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

    int l,r,d;
    cin>>l>>r>>d;

    int br=0;
    int i;
    for (i=l;i<=r;i++)
    if (i%d==0) br++;
	
	cout<<br<<"\n";


    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
	#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int a,b;
    cin>>a>>b;
   	(b==100)?cout<<101:cout<<b;
   	if(a==1) cout<<"00";
   	else if(a==2) cout<<"0000";
   	return 0;
}

Measured memory_bytes: 3632
import bisect

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))


a.sort()
b.sort()
c.sort()


result = 0
for i in range(n):
    b_bisect_in_a = bisect.bisect_left(a, b[i])
    b_bisect_in_c = bisect.bisect_right(c, b[i])
    result += b_bisect_in_a * (n - b_bisect_in_c)
        
        
print(result)

Measured memory_bytes: 23232
import itertools
N = int(input())
S = [input() for _ in range(N)]
d = {'M':[], 'A':[], 'R':[], 'C':[], 'H':[]}

for s in S:
    for c in ['M', 'A', 'R', 'C', 'H']:
        if s.startswith(c):
            d[c] += [s]

num = {k: len(d[k]) for k in ['M', 'A', 'R', 'C', 'H']}

ans = 0
for v in itertools.combinations(['M', 'A', 'R', 'C', 'H'], 3):
    tmp = 1
    for c in v:
        tmp *= num[c]
    ans += tmp
print(ans)

Measured memory_bytes: 87812
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>
#include <cstring>

#define nl '\n'

using namespace std;

string s;
int x;

int main(){

    cin >> s;

    for(int i = 1; i < s.length(); i++){
        if(s[i-1] == s[i]){
            if(s[i] == '0'){
                s[i] = '1';
            } else if(s[i] == '1'){
                s[i] = '0';
            }
            x++;
        }
    }   

    cout << x; 
}

//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out

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

int main() {
  int x, n, c;
  cin >> x >> n;
  unordered_set<int> s;
  for (int i = 0; i < n; ++i) {
    cin >> c; s.insert(c);
  }
  int a(0), b(0);
  while (true) {
    if (!s.count(x + a)) {
      cout << x + a << endl;
      return 0;
    }
    if (!s.count(x + b)) {
      cout << x + b << endl;
      return 0;
    }
    a--;
    b++;
  }
  return 0;
}


Measured memory_bytes: 3600
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]

MOD = 10 ** 9 + 7

dp = [-1] * (1 << n)

dp[0] = 1

def dfs(state, c):
    if dp[state] != -1:
        return dp[state]
    ret = 0
    for i in range(n):
        if state & (1 << i) and a[c][i]:
            ret += dfs(state ^ (1 << i) , c + 1)
    dp[state] = ret % MOD
    return dp[state]

print(dfs((1<<n)-1, 0))


Measured memory_bytes: 62568
n, a, b = map(int, input().split())
mod = 10**9+7
sum = pow(2, n, mod) - 1 #(2**n-1)%modと同じ

def comb(m):
    x = 1
    y = 1
    for i in range(m):
        x = x*(n-i)%mod #コンビネーションの分子
        y = y*(i+1)%mod #コンビネーションの分母
    return (x * pow(y, mod-2, mod) % mod)

print((sum-comb(a)-comb(b))%mod)

Measured memory_bytes: 9196