akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#define N 500000
#define INF 2000000000
using namespace std;
int c;

void merge(int *A,int l,int m,int r){
  vector<int> L,R;
  for(int i=l;i<m;i++)L.push_back(A[i]);
  for(int i=m;i<r;i++)R.push_back(A[i]);  
  int i=0,j=0;
  L.push_back(INF);
  R.push_back(INF);
   for(int k=l;k<r;k++){
     if(R[j]>L[i])A[k]=L[i++];
     else A[k]=R[j++];
     c++;
  }
}

void mergesort(int *A,int l,int r){
  if(l+1<r){
    int m=(l+r)/2;
    mergesort(A,l,m);
    mergesort(A,m,r);
    merge(A,l,m,r);
  }
}
 
 
int main(){
  int n,S[N];
  cin>>n;
  for(int i=0;i<n;i++)cin>>S[i];
  mergesort(S,0,n);
  for(int i=0;i<n-1;i++)cout<<S[i]<<" ";
  cout<<S[n-1]<<endl<<c<<endl;
  return 0;
}


Measured memory_bytes: 7260
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8101145141919364364;

int main(){
	int a,b; cin>>a>>b;
	if(a%2==1&&b%2==1) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int w,n;
  int a,b;
  int i,j;
  char k;
  scanf("%d %d",&w,&n);
  int line[w],li;
  for(i=0;i<w;i++){
    line[i]=i+1;
  }
  for(i=0;i<n;i++){
    scanf("%d",&a);
    scanf(" %c",&k);
    scanf("%d",&b);
    li=line[a-1];
    line[a-1]=line[b-1];
    line[b-1]=li;
  }
  for(i=0;i<w;i++){
    printf("%d\n",line[i]);
  }
  return 0;
}

Measured memory_bytes: 592
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename Monoid>
struct SegmentTree {
    using Op = function<Monoid(const Monoid& lhs, const Monoid& rhs)>;
    ll width;
    vector<Monoid> node;
    Op op;
    Monoid unit;
    
    SegmentTree(ll N, Op op, Monoid unit)
    : SegmentTree(vector<Monoid>(N, unit), op, unit) {}
    SegmentTree(const vector<Monoid>& elems, Op op, Monoid unit)
    : op(op)
    , unit(unit) {
        width = 1;
        while (width < elems.size()) {
            width *= 2;
        }
        node.resize(2 * width - 1, unit);
        for (size_t i = 0; i < elems.size(); i++) {
            node[i + width - 1] = elems[i];
        }
        for (size_t i = width - 2; i != numeric_limits<size_t>::max(); i--) {
            node[i] = op(node[2 * i + 1], node[2 * i + 2]);
        }
    }
    void update(ll idx, Monoid elem) {
        idx += width - 1;
        node[idx] = elem;
        while (idx >= 1) {
            idx = (idx - 1) / 2;
            node[idx] = op(node[2 * idx + 1], node[2 * idx + 2]);
        }
    }
    Monoid query_core(ll a, ll b, ll root, ll left, ll right) const {
        // assert([left, right) = root以下にある範囲)
        assert(0 <= a && b <= width);
        if (right <= a || b <= left) {
            return unit;
        }
        if (a <= left && right <= b) {
            return node[root];
        }
        ll mid = (left + right) / 2;
        Monoid ans_l = query_core(a, b, 2 * root + 1, left, mid);
        Monoid ans_r = query_core(a, b, 2 * root + 2, mid, right);
        return op(ans_l, ans_r);
    }
    Monoid query(ll a, ll b) const {
        assert(0 <= a && b <= width);
        return query_core(a, b, 0, 0, width);
    }
    Monoid operator[](size_t idx) { return query(idx, idx + 1); }
};

int main() {
    ll n, q;
    cin >> n >> q;
    SegmentTree<int> tree(n, [](int lhs, int rhs){ return min(lhs, rhs); }, numeric_limits<int>::max());
    for (ll i = 0; i < q; i++) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0) { // update
            tree.update(x, y);
        } else {
            cout << tree.query(x, y+1) << endl;
        }
    }
}



Measured memory_bytes: 4184
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N, M;
ll Ks[15];
vector<int> switches[15];
ll Ps[15];
ll toUse[2005][15];
ll val;

int main() {
	scanf("%lld %lld", &N, &M);
	for(int i = 0; i < M; i++) {
		scanf("%lld", &Ks[i]);
		for(int j = 0; j < Ks[i]; j++) {
			scanf("%lld", &val);
			switches[i].push_back(val);
		}
	}
	for(int i = 0; i < M; i++) {
		scanf("%lld", &Ps[i]);
	}
	for(int i = 1; i < pow(2, N ); i++) {
		// memset(toUse, 0, sizeof(toUse));
		for(int j = 0; j <= 20; j++) {
			if(i & 1 << j) {
				toUse[i][j + 1] = 1;
			}
		}
		// cout << " this\n";
	}
	// for(int i = 1; i < pow(2, N ); i++) {
	// 	for(int j = 0; j < 10; j++) {
	// 		cout << toUse[i][j + 1] << " ";
	// 	}
	// 	cout << "\n";
	// }
	int flag = 1;
	ll ans = 0;
	int cnt1 = 0;
	for(int k = 1; k <= pow(2, N); k++) {
		flag = 1;
		for(int i = 0; i < M; i++) {
			int cnt = 0;
			for(int j = 0; j < switches[i].size(); j++) {
				// cout << i << " this " << switches[i][j] << "\n";
				if(toUse[k][switches[i][j]]) {
					cnt++;
				}
			}
			// cout << i << " "<< Ps[i] << " that\n";
			if(cnt % 2 != Ps[i]) {
				// cout << " hey\n";
				flag = 0;
			}
			
			cnt1++;
		}
		if(flag) {
			ans++;
		}
	}
	printf("%lld\n", ans);
		
	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

public class Main {
    public static boolean hated(int price, Set<Integer> hateNum){
        if(price<10) return hateNum.contains(price);
        else return hateNum.contains(price%10)||hated(price/10,hateNum);
    }
    
    public static int pay(int price, Set<Integer> hateNum){
        while(hated(price,hateNum)){
        	price++;
        }
        return price;
    }
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        Set<Integer> hateNum = new HashSet<>();
        for(int k=0;k<K;k++) hateNum.add(sc.nextInt());
        System.out.println(pay(N,hateNum));
    }
}

Measured memory_bytes: 22484
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    int x=a-1;
    int y=b-1;
    int res;
    res=max(max(x+a,y+b),a+b);
    cout<<res;
    return 0;
}


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

using namespace std;

int main() {

    int cup[3] = {1, 0, 0};
    char pos[2], split;

    while(cin >> pos[0] >> split >> pos[1]) {
        swap(cup[pos[0] - 'A'], cup[pos[1] - 'A']);
    }

    for(int i = 0; i < 3; ++i) {
        if(cup[i]) cout << char('A' + i) << endl;
    }

}

Measured memory_bytes: 1132
#include <bits/stdc++.h>
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
using namespace std;

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

#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for (int i=(a); i<(b); ++i)
#define FORD(i,a,b) for (int i=(a)-1; i>=(b); --i)

#define pb push_back
#define mp make_pair
#define st first
#define nd second

const int MOD = 1000000007;

char S[28];
bool taken[256];

int main() {
  // ios_base::sync_with_stdio(0);

  scanf("%s", S);
  int N = strlen(S);
  REP(i,N) taken[S[i]] = true;

  if (N == 26) {
    FORD(i,N-1,0) {
      taken[S[i+1]] = false;
      FOR(c,S[i]+1,'z'+1) if (!taken[c]) {
        S[i] = c;
        S[i+1] = 0;
        printf("%s\n", S);
        return 0;
      }
    }
    printf("-1\n");
    return 0;
  }

  if (N != 26) {
    for (int c = 'a'; c <= 'z'; ++c) if (!taken[c]) {
      S[N] = c;
      printf("%s\n", S);
      return 0;
    }
  }


}


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

#define rep(i,a,b) for(int i=a;i<b;i++)

typedef long long int ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;

int M;

vi mul_mat_vec(vvi a, vi b)
{
	int n = b.size();
	vi ret(n, 0);
	rep(i, 0, n)
	{
		ret[i] = 0;
		rep(j, 0, n) ret[i] += a[i][j] * b[j];
		ret[i] %= M;
	}
	return ret;
}

vvi mul_mat_mat(vvi a, vvi b)
{
	int n = a.size();
	vvi ret(n, vi(n, 0));
	rep(i, 0, n) rep(j, 0, n)
	{
		ret[i][j] = 0;
		rep(k, 0, n) ret[i][j] += a[i][k] * b[k][j];
		ret[i][j] %= M;
	}
	return ret;
}

void write_vec(vi a)
{
	int n = a.size();
	rep(i, 0, n) cout << a[i] << " ";
	cout << endl;
}

void write_mat(vvi a)
{
	int n = a.size();
	int nn = a[0].size();
	rep(i, 0, n)
	{
		rep(j, 0, nn) cout << a[i][j] << " ";
		cout << endl;
	}
}

vvi fastpow(vvi x, int n)
{
	vvi ret(x.size(), vi(x.size(), 0));
	rep(i, 0, x.size()) ret[i][i] = 1;

	while (0 < n)
	{
		if ((n % 2) == 0)
		{
			x = mul_mat_mat(x, x);
			n >>= 1;
		}
		else
		{
			ret = mul_mat_mat(ret, x);
			--n;
		}
	}
	return ret;
}

int main()
{
	while (1)
	{
		int N, A, B, C, T;
		cin >> N >> M >> A >> B >> C >> T;
		if (N == 0) return 0;
		vi S(N);
		rep(i, 0, N) cin >> S[i];
		
		vvi mat(N, vi(N, 0));
		rep(i, 0, N)
		{
			if (i != 0) mat[i][i - 1] = A;
			mat[i][i] = B;
			if (i != N - 1) mat[i][i + 1] = C;
		}


		
		vvi mats = fastpow(mat, T);
		S = mul_mat_vec(mats, S);

		cout << S[0];
		rep(i, 1, N) cout << " " << S[i];
		cout << endl;
	}
}

Measured memory_bytes: 3280
N = int(input())
p = [int(input()) for _ in range(N)]
max_p = max(p)
max_index = p.index(max_p)

sum = 0
for i in range(N):
    if i == max_index:
        sum += int(p[i]/2)
    else:
        sum += p[i]
print(sum)

Measured memory_bytes: 9116
#include <stdio.h>
int main()
{
  int i,n,temp=0;
  scanf("%d",&n);
  int ar[n];
  for(i=0;i<n;i++)
  {
    scanf("%d",&ar[i]);
  }
  for(i=1;i<n-1;i++)
  {
    if((ar[i-1]>ar[i]&&ar[i]>ar[i+1])||(ar[i]>ar[i-1])&&(ar[i]<ar[i+1]))
    {
      temp++;
    } 
  }
   printf("%d\n",temp);
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin>>n>>m;
    vector<pi> itv(m);
    rep(i,m){
        int a,b; cin>>a>>b; a--; b--;
        itv[i] = mp(b,a);
    }
    sort(all(itv));
    int idx=0, ans=0;
    while(idx<m){
        ans++;
        int now = itv[idx].fi;
        while(idx<m && itv[idx].se<now) idx++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define uni(q) unique(all(q)),q.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll n; cin >> n;
    vl a(n),b(n);
    rep(i,n){
        cin >> a[i] >> b[i];
    }
    ll ans = 0;
    for(ll i=n-1; i>=0; i--){
        if((a[i]+ans)%b[i]==0) continue;
        ans += b[i] - ((a[i]+ans) % b[i]);
        //cout << ans << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#define INF 10e15
using namespace std;
typedef long long int ll;
ll n, W, w[1000],v[1000];
ll dp[1100000];
int main()
{
    scanf("%lld%lld",&n,&W);
    for(int i = 0 ; i < n; i++)scanf("%lld%lld",&w[i],&v[i]);
    //initialize
    fill(dp,dp+n*1001,INF);
    dp[0] = 0;

    for(int i = 0; i <n;i++)
    {
        for(ll k = 1000*n; k >= v[i];k--)
        {
            dp[k] = min(dp[k-v[i]]+w[i],dp[k]);
        }
    }
    ll ans = 0;
    for(ll k = 1000*n; k >= 0;k--)
        if(dp[k]<=W){ans = k;break;}

    printf("%lld\n",ans);
}



Measured memory_bytes: 1024
/*==============================================*\
ID:          shahidul_brur
 
Name:     Md. Shahidul Islam
Study:      CSE, BRUR
Address:  Rangpur, Bangladesh
 
 mail: shahidul.cse.brur@gmail.com
 FB  : fb.com/shahidul.brur
 Blog: shahidul-brur.blogspot.com(in Bengali),
       shahidul-brur-en.blogspot.com(in English)
\*===============================================*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};

const double pi = acos(-1.0);
const double eps = 1e-6;
const int mod = (int)1e9+7;
const int maxn = (int)2e5+5;
const int logn = 20;
int a[maxn];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n; cin>>n;
    f0(i,n) 
    {
        cin>>a[i];
    }
    sort(a,a+n);
    double sum = a[0];
    f1(i,n-1)
    {
        sum = (sum+a[i])/2.0;
    }
    cout << fixed << setprecision(12) << sum;
    return 0;
}


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

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;


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

    vector<string> arr(n);

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

    int count1 = 0;
    int count2 = 0;
    int count3 = 0;
    int count4 = 0;

    for (int i = 0; i < n; i++) {
        if (arr[i] == "AC") {
            count1++;
        }
        if (arr[i] == "WA") {
            count2++;
        }
        if (arr[i] == "TLE") {
            count3++;
        }
        if (arr[i] == "RE") {
            count4++;
        }
    }
   
    cout << "AC" << " x " << count1 << endl;
    cout << "WA" << " x " << count2 << endl;
    cout << "TLE" << " x " << count3 << endl;
    cout << "RE" << " x " << count4 << endl;

    return 0;
}

Measured memory_bytes: 6420
import sys
def input():
    return sys.stdin.readline()[:-1]
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for i in range(n)]
ans=float('inf')
for i in range(n):
    if ct[i][1]<=t:
        ans=min(ans,ct[i][0])
if ans==float('inf'):
    print("TLE")
else:
    print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
const int MOD = (int)(1e9+7);
const int INF = (int)(1e9+1e7);
const ll INFL = (ll)(1e17);
const double EPS = 1e-8;
using namespace std;
int main()
{
  ll N,a,b;
  cin >> N >> a >> b;
  if((b-a)%2==0){cout << (b-a)/2 <<endl;}
  else{
      ll c=0;ll d=0;
      c+=(a-1)+(b-a+2)/2;
      d+=(N-b)+(-a+b+1)/2;
      cout << min(c,d) <<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n;
int a[20][20];
int cost[1<<20];
int dp[1<<20];

int32_t main(){
	cin>>n;
	for(int i = 0 ; i < n; i ++){
		for(int j = 0 ; j < n; j ++) cin>>a[i][j];
	}
	for(int i = 0 ; i < (1<<n) ; i ++){
		cost[i] = 0;
		for(int j = 0 ; j < n ; j ++){
			if(1<<j & i){
				for(int k = j+1 ; k < n ; k ++){
					if(1<<k & i){
						cost[i] += a[j][k];
					}
				}
			}
		}
	}
	dp[0] = 0;
	for(int i = 0 ; i < (1<<n) ; i++){
		for(int j = i ; j > 0 ; j = (j-1)&i){
			dp[i] = max(dp[i] , dp[i^j] + cost[j]);
		}
	}
	printf("%lld\n" , dp[((1<<n)) - 1]);
}

Measured memory_bytes: 2816
str = gets.chomp

l = str.length
sum = 0

if l == 1
  sum = str.to_i
else
  ["", "+"].repeated_permutation(l - 1) do |plus|
    tmp = ""
    str.each_char.with_index do |c, i|
      tmp << c
      tmp << plus[i] if i != l - 1
    end
    sum += eval(tmp)
  end
end

puts sum

Measured memory_bytes: 1916
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

int main(){
	map<string,string> encode_old;
	map<string,string> decode_old;

	decode_old["00000"] = "A";
	decode_old["00001"] = "B";
	decode_old["00010"] = "C";
	decode_old["00011"] = "D";
	decode_old["00100"] = "E";
	decode_old["00101"] = "F";
	decode_old["00110"] = "G";

	decode_old["00111"] = "H";
	decode_old["01000"] = "I";
	decode_old["01001"] = "J";
	decode_old["01010"] = "K";
	decode_old["01011"] = "L";
	decode_old["01100"] = "M";
	decode_old["01101"] = "N";

	decode_old["01110"] = "O";
	decode_old["01111"] = "P";
	decode_old["10000"] = "Q";
	decode_old["10001"] = "R";
	decode_old["10010"] = "S";
	decode_old["10011"] = "T";
	decode_old["10100"] = "U";

	decode_old["10101"] = "V";
	decode_old["10110"] = "W";
	decode_old["10111"] = "X";
	decode_old["11000"] = "Y";
	decode_old["11001"] = "Z";

	decode_old["11010"] = " ";
	decode_old["11011"] = ".";
	decode_old["11100"] = ",";
	decode_old["11101"] = "-";
	decode_old["11110"] = "'";
	decode_old["11111"] = "?";


	encode_old[" "] = "101";
	encode_old["'"] = "000000";
	encode_old[","] = "000011";
	encode_old["-"] = "10010001";
	encode_old["."] = "010001";

	encode_old["?"] = "000001";
	encode_old["A"] = "100101";
	encode_old["B"] = "10011010";
	encode_old["C"] = "0101";
	encode_old["D"] = "0001";
	encode_old["E"] = "110";
	encode_old["F"] = "01001";
	encode_old["G"] = "10011011";

	encode_old["H"] = "010000";
	encode_old["I"] = "0111";
	encode_old["J"] = "10011000";
	encode_old["K"] = "0110";
	encode_old["L"] = "00100";
	encode_old["M"] = "10011001";
	encode_old["N"] = "10011110";

	encode_old["O"] = "00101";
	encode_old["P"] = "111";
	encode_old["Q"] = "10011111";
	encode_old["R"] = "1000";
	encode_old["S"] = "00110";
	encode_old["T"] = "00111";
	encode_old["U"] = "10011100";

	encode_old["V"] = "10011101";
	encode_old["W"] = "000010";
	encode_old["X"] = "10010010";
	encode_old["Y"] = "10010011";
	encode_old["Z"] = "10010000";

	map<string,string> encode;
	map<string,string> decode;
	for(map<string,string>::iterator it = encode_old.begin(); it != encode_old.end(); it++){
		encode[it->second] = it->first;
	}

	for(map<string,string>::iterator it = decode_old.begin(); it != decode_old.end(); it++){
		decode[it->second] = it->first;
	}

	string str;
	while(getline(cin,str)){

		string decoded="";
		for(int i=0;i<str.size();i++){
			decoded += decode[str.substr(i,1)];
		}

		string encoded="";
		for(int i=0;i<decoded.size();i++){
			for(int len=1;len<=decoded.size()-i;len++){
				if(!encode[decoded.substr(i,len)].empty()){
					encoded+=encode[decoded.substr(i,len)];
					i+=len-1;
					break;
				}
			}
		}

		cout << encoded << endl;

	}
}

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

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

	int max_cnt = 0, cnt = 0;
	for (int i = 0; i < N - 1; i++) {
		if (H.at(i) >= H.at(i + 1)) {
			cnt++;
		} else {
			if (max_cnt < cnt) max_cnt = cnt;
			cnt = 0;
		}
	}
	if (max_cnt < cnt) max_cnt = cnt;

	cout << max_cnt << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  	long long n;
  	cin >> n;
  	long long ans = 0;
  	long long i = 1;
  	while(1){
      	if (i*i > n) break;
      	ans = i*i;
      	i++;
    }
  	cout << ans << endl;
  	return 0;
}

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


using namespace std;
constexpr long long int mod = 1000000007,MOD= 998244353,MAX=200000;

int main() {
    int A;
    cin >> A;
    if (A % 10 == 3)cout << "bon";
    else if (A % 10 == 0 || A % 10 == 1 || A % 10 == 6 || A % 10 == 8)cout<<"pon";
    else cout << "hon";
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう
//a=61
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
typedef pair<int,int> pairii;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() {
  int n,m,c;
  int judge=0;
  int cnt=0;
  cin>>n>>m>>c;
  judge=c;
  vector<int> s(m);
  vector<int> p(m);
  rep(h,m)cin>>p[h];
  rep(k,n){
    judge=c;
  rep(i,m)cin>>s[i];
  rep(j,m){
    judge+=(p[j]*s[j]);
  }
  if(judge>0)cnt++;
  }
  cout<<cnt<<endl;
}

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

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

    int ans = 0;
    int count;
    for (int i = 1; i < N - 1; i++)
    {
        count = 0;

        for (char c = 'a'; c <= 'z'; c++)
        {
            bool left = false, right = false;

            for (int j = 0; j < i; j++)
            {
                if (c == S[j])
                    left = true;
            }
            for (int k = i; k < N; k++)
            {
                if (c == S[k])
                    right = true;
            }

            if (left == true && right == true)
            {
                count++;
            }
        }

        if (ans < count)
        {
            ans = count;
        }
    }
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  ll n,k;
  cin>>n>>k;
  ll a[n];
  for(ll i=0;i<n;i++)
    cin>>a[i];
  for(ll i=0;i<n;i++)
  {
    if(i+k==n)
      break;
    if(a[i]<a[i+k])
      cout<<"Yes\n";
    else
      cout<<"No\n";
  }
}


Measured memory_bytes: 5200
#!/usr/bin/env run-cargo-script

use std::fmt::Debug;
use std::io;
use std::io::{Read, Stdin};
use std::str;
use std::str::FromStr;

fn main() {
    let mut sc = Scanner::new();
    let (o, e) = (sc.parse::<String>(), sc.parse::<String>());
    let mut ob = o.bytes();
    let mut eb = e.bytes();
    for _ in 0..e.len() {
        print!("{}", ob.next().unwrap() as char);
        print!("{}", eb.next().unwrap() as char);
    }
    if let Some(b) = ob.next() {
        println!("{}", b as char);
    }
}

struct Scanner {
    stdin: Stdin,
    buf: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            buf: Vec::with_capacity(256),
        }
    }

    fn parse<T: FromStr>(&mut self) -> T
        where <T as FromStr>::Err: Debug
    {
        self.buf.clear();
        let mut it = self.stdin.lock().bytes();
        let mut c = it.next().unwrap().unwrap();
        while c == ' ' as u8 || c == '\n' as u8 {
            c = it.next().unwrap().unwrap();
        }
        while !(c == ' ' as u8 || c == '\n' as u8) {
            self.buf.push(c);
            c = it.next().unwrap().unwrap();
        }
        str::from_utf8(&self.buf).unwrap().parse::<T>().unwrap()
    }
}


Measured memory_bytes: 4352
import datetime
import sys
i_weekday = { i:weekday for i, weekday in enumerate('Monday Tuesday Wednesday Thursday Friday Saturday Sunday'.split() ) }
while True:
  M, D = map(int, input().split())
  if M == 0:
    sys.exit()
  dt = datetime.datetime.strptime(f'2004-{M}-{D}', '%Y-%m-%d')
  #print(dt)
  print(i_weekday[ dt.weekday() ] )


Measured memory_bytes: 7348
from sys import stdin,stdout
def fn(mask_r,mask_c):
    cells=0
    for cur_r in range(r):
        for cur_c in range(c):
            if mask_c &(1<<cur_c)==0 or mask_r&(1<<cur_r)==0:continue
            if a[cur_r][cur_c]=='#':cells+=1
    return cells==k
for _ in range(1):#int(stdin.readline())):
    # n=int(stdin.readline())
    ans=0
    r,c,k= map(int,stdin.readline().split())
    a=[input() for _ in range(r)]
    for mask_r in range(1<<r):
        for mask_c in range(1<<c):
            # print(bin(mask_r)[2:],bin(mask_c)[2:])
            if fn(mask_r,mask_c):ans+=1
    print(ans)


Measured memory_bytes: 9204
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;

int main(){

  int a, b, x;
  cin >> a >> b >> x;

  if (a > x){
    cout << "NO" << endl;
    return 0;
  }

  if ((a + b) < x){
    cout << "NO" << endl;
  }
  else {
    cout << "YES" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
def main():
    word = {}
    n = int(input())
    for _ in range(n):
        s = "".join(sorted(input()))
        if s in word:
            word[s] += 1
        else:
            word[s] = 1
    answer = 0
    for cnt in word.values():
        answer += cnt * (cnt - 1) // 2
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 17852
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	string s;
	while(cin >> s) {
		string t;
		REP(i,SZ(s)){
			if(s[i] != 'x') {
				t += s[i];
			}
		}
		DEBUG(t);
		bool f = true;
		REP(i,(SZ(t))/2){
			if(t[i] != t[SZ(t)-1-i]) f = false;
		}
		if(f) {
			int ans = 0;
			int l = 0;
			int r = SZ(s)-1;
			while(l <= r) {
				if(s[l] == 'x' && s[r] == 'x'){
					l++;
					r--;
				} else if(s[l] == 'x') {
					l++;
					ans++;
				} else if(s[r] == 'x') {
					r--;
					ans++;
				} else {
					l++;
					r--;
				}
			}
			cout << ans << endl;
		} else {
			cout << -1 << endl;
		}
	}
	return 0;
}


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

#define ll long long
#define pp pair < ll, ll >
#define x first
#define y second

using namespace std;

int n;
string s;

void Input()
{
    ios_base::sync_with_stdio(0);       cin.tie(0);

//    freopen("abc.txt", "r", stdin);
    cin >> n >> s;

    for (int i=0; i<=s.length()-1; i++)
        s[i] = (char) ( (((int) s[i]) + n - 65) % 26 + 65 );

    cout << s << endl;
}

void Process()
{

}

int main()
{
    Input();
    Process();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define get ch=getchar()
#define is isdigit(ch)
#define Md 1000000007
using namespace std;
typedef pair<long long, long long> Pairs;
inline ll read(){
	char get;
	ll r=0;
	while(!is)get;
	while(is){
		r=(r<<3)+(r<<1)+(ch^48);
		get;
	}
	return r;
}
ll n;
map<Pairs, int> dp;

inline void adds(int &x, int a) {
    x=(x+a)%Md;
}
inline int dfs(ll u, ll v) {
    if (v<0) return 0;
    if (!v) return 1;
    if (dp.count(Pairs(u, v))) return dp[Pairs(u, v)];
    int res=0;
    adds(res,dfs(u/2,v/2));
    adds(res,dfs((u-1)/2,(v-1)/2));
    if (v>=2) adds(res,dfs(u/2,(v-2)/2));
    return dp[Pairs(u,v)]=res;
}
int main() {
    n=read();
    printf("%lld",dfs(n,n));
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define OK cout << endl
#define f(a,j,k) for(int i = a ; i < j ; i += k)
#define f1(a,j,k) for(int i = a ; i > j ; i -= k)
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
typedef vector<int> vi;
typedef pair<int,int> pri;
typedef pair<long long,long long> prl;
const ll M = 1e9 + 7;
ll Pow(ll i,ll n){
    ll ans = 1;
    while(n){
        if(n & 1) ans *= i,ans %= M;
        i *= i;
        i %= M;
        n >>= 1;
    }
  return ans;
}
void solve(){
   ll n , k;
   cin >> n >> k;
   ll ans = 0;
   ll a[k+5];
   ll res[k+5];
   f(1,k+1,1) a[i] = Pow(k/i,n) % M;
   f1(k,0,1){
      res[i] = a[i];
      for(ll j=i<<1;j <= k;j+=i)
      ((res[i]-=res[j])+=M)%=M;
   }
   f(1,k+1,1){
       (ans += res[i] * i) %= M;
   }
   cout << ans << endl;
}
int main() {
	  std::ios::sync_with_stdio(false);
	  int t;
		solve();

	return 0;
}


Measured memory_bytes: 5124
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
  #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl "\n"
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
   int n,t,a,val;
   cin>>n>>t>>a;
   vector<int> v(n);
   for(auto &it:v)cin>>it;
   int cnt=INT_MAX;
   for(int i=0;i<n;i++){
	   int ans=t*1000-(v[i]*(6));
	   int diff=abs(ans-a*1000);
	   if(diff<cnt){
		    cnt=diff;
		    val=i; 
		  } 
	 }
	 cout<<val+1<<endl;
}
int32_t main(){
   IOS;
   solve();
   //debug();
  #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
  #endif	
}


Measured memory_bytes: 256
#123B
num_list = [int(input()) for i in range(5)]
max_list = []
count = 0
min_num = 0
for j in range(5):
    max_list.append(int((num_list[j] + 9) / 10) * 10)
    
    if max_list[j] - num_list[j] > count:
        count = max_list[j] - num_list[j]
        min_num = j
    else:
        pass

s = sum(max_list) - max_list[min_num] + num_list[min_num]
print(s)

Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main()
{
    int a=0;
    string b;
    cin>>b;
    for(int i=0;i<b.size();++i)
    {
        if(b.at(i)=='+') a++;
        else a--;
    }
    cout<<a;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
	int n, q;
	
	std::cin >> n;
	int *S = new int[n];
	for (int i=0; i<n; i++) std::cin >> S[i];
	
	std::cin >> q;
	int *T = new int[q];
	for (int i=0; i<q; i++) std::cin >> T[i];
	
	int count = 0;
	for (int i=0; i<q; i++) {
		for (int j=0; j<n; j++) {
			if (S[j] == T[i]) {
				count++; break;
			}
		}
	}
	
	std::cout << count << std::endl;
	
	delete[] S;
	delete[] T;
	
	return 0;
}




Measured memory_bytes: 3096
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    int a;
    cin>>a;
    if(a>=30){
        cout<<"Yes"<<endl;
    }else{cout<<"No"<<endl;}
    
return 0;
}


Measured memory_bytes: 3572
import sys
input = sys.stdin.readline

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

cnt = 1
ret = 0

for i in range(n):
  if cnt == a[i]:
    cnt += 1
  else:
    ret += 1

if ret == n and cnt == 1:
  print(-1)
else:
  print(ret)


Measured memory_bytes: 25696
import java.util.Scanner;
import java.io.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int a,b,c,i,count;
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
        count=0;
        for(i=a; i<=b; i++){
            if(c % i == 0) count++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 26388
// AOJ 1163: Cards
// 2017.9.15 bal4u@uu
// 2018.3.12

#include <stdio.h>
#include <string.h>

#define MAX 1004
int  hi[MAX], to[MAX][MAX];
char seen[MAX];
int  match[MAX];

int bipartiteMatching(int m, int n)
{
	int u, max;
	int bpm(int u);

	memset(match, -1, (m+n)*sizeof(int));
	max = 0;
	for (u = 0; u < m; u++) {
		memset(seen, 0, m+n);
		if (bpm(u)) max++;
	}
	return max;
}

int bpm(int u)
{
	int i, v;

	for (i = 0; i < hi[u]; i++) {
		v = to[u][i];
		if (seen[v]) continue;
		seen[v] = 1;
		if (match[v] < 0 || bpm(match[v])) {
			match[u] = v, match[v] = u;
			return 1;
		}
	}
	return 0;
}

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

int gcd(int a, int b)
{
	int r;
	while (b != 0) r = a % b, a = b, b = r;
	return a;
}

int b[501], r[502];

int main()
{
	int i, j, m, n;

	while (m = in()) {
		n = in();
		for (i = 0; i < m; i++) b[i] = in();
		for (j = 0; j < n; j++) r[j] = in();

		memset(hi, 0, (m+n) << 2);
	    for (i = 0; i < m; i++) for (j = 0; j < n; j++) {
			if (gcd(b[i], r[j]) > 1) to[i][hi[i]++] = m + j;
		}			

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



Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int n, a[10];
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int p; cin >> p;
		if (p < 400)a[0]++;
		else if (p < 800)a[1]++;
		else if (p < 1200)a[2]++;
		else if (p < 1600)a[3]++;
		else if (p < 2000)a[4]++;
		else if (p < 2400)a[5]++;
		else if (p < 2800)a[6]++;
		else if (p < 3200)a[7]++;
		else a[8]++;
	}
	int cnt = 0;
	for (int i = 0; i < 8; i++)if (a[i])cnt++;
	cout << max(cnt, (int)1) << ' ' << cnt + a[8] << endl;

}

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

total = abs(a[0]) + abs(a[n - 1])
for i in range(1, n):
    total += abs(a[i] - a[i - 1])

def calc(a, i, total):
    if i == 0:
        pre = 0
    else:
        pre = a[i - 1]

    if i != len(a) - 1:
        return total - (abs(a[i] - pre) + abs(a[i] - a[i + 1])) + abs(pre - a[i + 1])
    else:
        return total - (abs(pre - a[i]) + abs(a[i])) + abs(pre)

for i in range(n):
    print(calc(a, i, total))

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

void swap(int* a, int i, int j) {
    int tmp = a[i];
    a[i] = a[j];
    a[j] = tmp;
}

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i=0; i<n; i++) {
        cin >> a[i];
    }
    for (int i=0; i<n; i++) {
        int j = i - 1;
        while ( j >= 0 && a[j] > a[j+1]) {
            swap(a, j, j+1);
            j--;
        }
        for (int k=0; k<n-1; k++) {
            cout << a[k] << " ";
        }
        cout << a[n-1] << endl;
    }
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int main(){
	int n,x;
	cin >> n >> x;
	int m;
	int mmin = 100000000;
	int ans = n;
	for(int i = 0;i < n;i++){
		cin >> m;
		x-=m;
		mmin = min(mmin,m);
	}
	ans += x/mmin;

	cout << ans << endl;

	return 0;
}

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

using namespace std;

int arr[2][105];
int sa,sb;
int n;

int main()
{
	cin >> n;
	for(int i=0;i<2;i++)
		for(int j=0;j<n;j++)
			cin >> arr[i][j];
	for(int i=0;i<n;i++)
		sb+=arr[1][i];
	int ans=0;
	for(int i=0;i<n;i++)
	{
		sa+=arr[0][i];
		ans=max(ans,sa+sb);
		sb-=arr[1][i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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 <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n); rep (i, n) cin >> a[i];
    int q; cin >> q;
    map<int, int> m;
    rep (i, n) {
        m[a[i]]++;
    }
    ll sum = 0;
    rep (i, n) sum += a[i];
    rep (_, q) {
        int b, c; cin >> b >> c;
        sum += (c - b) * m[b];
        m[c] += m[b]; m[b] = 0;
        cout << sum << "\n";
    }
    return 0;
}

Measured memory_bytes: 8276
#include <iostream>

using namespace std;

int main(){
    int m;
    int f;
    int b;
    cin >> m >> f >> b;
    if((m + f) < b){
        cout << "NA" << endl;
    }
    else if(b < m){
        cout << 0 << endl;
    }
    else{
        cout << b - m << endl;
    }
}


Measured memory_bytes: 3116
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

#define MAX_N (100000)

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  int N, ds[MAX_N];
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &ds[i]);
  }

  // solve
  sort(ds, ds + N);
  printf("%d\n", ds[N / 2] - ds[N / 2 - 1]);
  
  return 0;
}


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

int x;
set<int> ss,s;

int main() {
	ss.insert(1);
	ss.insert(7);
	ss.insert(9);
	ss.insert(4);
	for(int i=0;i<4;i++){
		cin >> x;
		if(ss.count(x))s.insert(x);
	}
	if(s.size()==4){
		cout << "YES";
	}else{
		cout<< "NO";
	}
	return 0;
}

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

using ll = long long int;

ll n, m, d;

double ans;

int main(void){
  scanf("%lld %lld %lld", &n, &m, &d);

  double expectation = (d == 0) ? n / pow(n, 2) : 2 * (n - d) / pow(n, 2);

  ans = expectation * (m - 1);

  printf("%10.10lf\n", ans);

  return 0;
}


Measured memory_bytes: 256
A = list(input())
B = list(input())
C = list(input())

def turn(card):
    if card == 'a':
        if A:
            turn(A.pop(0))
        else:
            print('A')
            exit(0)
    elif card == 'b':
        if B:
            turn(B.pop(0))
        else:
            print('B')
            exit(0)
    else:
        if C:
            turn(C.pop(0))
        else:
            print('C')
            exit(0)

turn(A.pop(0))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define ll long long int
#define INF 1000000000000
#define MOD 1000000007
#define DEBUG(x) cerr<<'>'<<#x<<':'<<x<< endl
using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string S;
    cin >> S;
    string rev = S;
    reverse(rev.begin(), rev.end());
    if(rev != S)
    {
        cout << "No" << endl;
        return 0;
    }
    ll len = S.length();
    rev = S.substr(0, (len / 2));
    S = rev;
    reverse(S.begin(), S.end());
    if(S == rev)
    {
        cout << "Yes" << endl;
    }    
    else
    {
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e9;
#define Fast    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sz      300005

int main(){
    Fast;
    int a,b,c, i,j,k, n,m,t, cs=1;

    cin>>a>>b>>c>>k;

    if(a>=k){
        cout<<k<<endl;
    }
    else if(a+b>=k){
        cout<<a<<endl;
    }
    else{
        k-=(a+b);
        k*=-1;
        a+=k;
        cout<<a<<endl;
    }
    return 0;
}



Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,i,j,k,l,a,b,c,d,m;
    cin>>a>>b;

    if((a+b)<10)
    {
        cout<<a+b<<endl;
    }
    else
    {
    cout<<"error"<<endl;

    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;

int main()
{
	long n, m;
	long b[40];
	memset(b, 0, sizeof(b));

	cin >> n >> m;

	int j = 0;

	while (m % 2 == 0) {
		b[j]++;
		m /= 2;
	}
	if (b[j] > 0)
		j++;

	for (long i = 3; i <= m; i += 2) {
		while (m % i == 0) {
			b[j]++;
			m /= i;
		}
		if (b[j] > 0)
			j++;
	}

	long long s = 1;

	for (int i = 0; b[i] > 0; i++) {
		for (long j = 0; j < b[i]; j++)
			s = (s * (n + b[i] - 1 - j)) % 1000000007;
		
		for (long j = 0; j < b[i]; j++) {
			long long p = 1000000005, x = b[i] - j;

			while (p) {
				if (p & 1)
					s = (s * x) % 1000000007;
				x = (x * x) % 1000000007;
				p = p >> 1;
			}
		}
	}

	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let k: usize = read();
    let a: usize = read();
    let b: usize = read();
    let mut ans = "NG";
    if (b / k) - ((a-1) / k) > 0 {
        ans = "OK";
    }
    println!("{}", ans);
}


Measured memory_bytes: 2132
#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 x;
    cin >> x;
    int j = 31;
    bool s = true;
    int maxi = 1;
    while(j > 1){
        int cnt = j*j;
        while(cnt <= x){
            maxi = max(maxi,cnt);
            cnt *=j;
            if(cnt <= x) maxi = max(maxi,cnt);
        }
        j--;
    }
    cout << maxi;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>
#include<bitset>
#include<tuple>
#include<time.h>
#include<list>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;

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



i64 n, a[202020], d[202020];
void solve(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		d[i+1] = d[i] + a[i];
	}
	sort(d+1, d+n+1);
	
	i64 ans = 0, cnt = 0;
	for(int i = 1; i <= n; i++){
		if(d[i] == 0) ans++;
	}
	for(int i = 2; i <= n; i++){
		if(d[i-1] == d[i]){
			cnt++;
			ans += cnt;
		}
		else{
			cnt = 0;
		}
	}
	cout << ans << endl;
}

int main(){
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3328
# AtCoder Beginner Contest 050 - B
# -*- encoding: UTF-8 -*-
n = int(input())
s = input()

slist = list(s)
x = 0
xmax = 0

for i in slist:
  if i == "I":
    x = x + 1
  else:
    x = x - 1
  
  if x > xmax:
     xmax = x

print(xmax)


Measured memory_bytes: 2940
import java.util.Scanner;
 
 
public class Main {
     
 
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[][][] data = new int[4][3][10];
         
        for(int i = 0; i < n; i++) {
            int b = stdIn.nextInt();
            int f = stdIn.nextInt();
            int r = stdIn.nextInt();
            int v = stdIn.nextInt();
             
            data[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++) {
                    System.out.print(" " + data[i][j][k]);
                }
                System.out.println();
            }
            if(i != 3) {
            System.out.println("####################");
            }
        }
    }
 
}


Measured memory_bytes: 29772
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>


int main() {
    int num;
    std::vector<int> v;
    std::cin >> num;
    for(int i = 0; i < num; i++) {
        int input;
        std::cin >> input;
        v.push_back(input);
    }
    if (num % 2 == 0) {
        for (int i = num; i >= 2; i -= 2) {
            std::cout << v.at(i - 1) << ' ';
        }
        for (int i = 1; i < num - 1; i += 2) {
            std::cout << v.at(i - 1) << ' ';
        }
    } else {
        for (int i = num; i >= 1; i -= 2) {
            std::cout << v.at(i - 1) << ' ';
        }
        for (int i = 2; i < num - 1; i += 2) {
            std::cout << v.at(i - 1) << ' ';
        }
    }
    if (num != 1) std::cout << v.at(v.size() - 2);
    
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 3060