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

int main() {

   string s;
   cin>>s;

   int a=0,b=0;

  for(int i=0;i<s.length();i++){
    if(s[i] == 'A')
        a++;
    else if(s[i] == 'B')
        b++;
  }

  if(a>0 && b>0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    string s;cin>>s;
    if(s[0]=='S')cout<<"Cloudy"<<endl;
    else if(s[0]=='C')cout<<"Rainy"<<endl;
    else cout<<"Sunny"<<endl;
}

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

int main() {
  int n = 0;
  cin >> n;
  
  double ans = 0.0;
  
  if (n % 2 == 0) {
    ans = (double)1 / 2;
  } else {
    ans = (double)(n + 1) / (2 * n);
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using psi=pair<string,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD ((ll)1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
template<class T>void geti(T&a){for(auto&_:a)cin>>_;}
template<class T>void getii(T&a){for(auto&_:a)geti(_);}
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__)
#define dclt(t,...) t __VA_ARGS__;get(__VA_ARGS__)
template<class F,class S>void add(map<F,S>&mp,F f,S s){if(mp.find(f)==mp.end())mp[f]=F();mp[f]+=s;}

bool sign(ll a){
    return a>=0;
}

int main(){
    dcl(n,k);
    map<int,int> mp;
    rep(i,n){
        dclt(int,t);
        add(mp,t,1);
    }
    vi v;
    for(auto m:mp){
        v.pb(m.sc);
    }
    if(v.size()<=k){
        cout<<0<<endl;
    }else{
        sort(all(v));
        cout<<accumulate(v.rbegin()+k,v.rend(),0)<<endl;
    }
}


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

int main() {
  int n;
  cin >> n;
  vector<int> list(n);
  int s1=0;
  for(int i=0;i<n;i++) {
    cin >> list.at(i);
    s1+=list.at(i);
  }
  int s2=0;
  int temp=1e9;
  for(int i=0;i<n-1;i++) {
    s2+=list.at(i);
    s1-=list.at(i);
    //cout << abs(s2-s1);
    temp=min(temp,abs(s2-s1));
  }
  cout << temp << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	/** 交通機関の数 */
	private static final int N = 5;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			long n = scanner.nextLong();
			long min = IntStream.range(0, N).mapToLong(i -> scanner.nextLong()).min().getAsLong();
			System.out.println((n - 1) / min + N);
		}
	}
}


Measured memory_bytes: 36172
#include<bits/stdc++.h>
#define LL long long
#define Max 100005
#define Mod 1e9+7
const LL mod=1e9+7;
const LL inf=0x3f3f3f3f;
using namespace std;
char s[Max];
int main()
{
	int len;
	int a,b,c;
	a=0,b=0,c=0;
	scanf("%s",s);
	len=strlen(s);
	for(int i=0;s[i];i++)
		if(s[i]=='a')
			a++;
		else if(s[i]=='b')
			b++;
		else if(s[i]=='c')
			c++;
	if(a==0 || b==0 || c==0)
	{
		if(len>=3)
		{
			printf("NO\n");
			return 0;
		}
	}
	int ans=min(a,min(b,c));
	a-=ans;
	b-=ans;
	c-=ans;
	if(a>=2 || b>=2 || c>=2)
		printf("NO\n");
	else
		printf("YES\n");
    return 0;
}

Measured memory_bytes: 384
while (w, h = gets.chomp.split(" ").map{|str| str.to_i}) != [0, 0]
	queue = []
	table = []
	for y in 0..(h - 1)
		table << gets.chomp.split("").map.with_index do |char, x|
			if char == "."
				0
			elsif char == "#"
				-1
			elsif char == "@"
				queue << [y, x]
				0
			end
		end
	end
	while !queue.empty?
		y, x = queue.shift
		if table[y][x] == 0
			table[y][x] = 1
			queue << [y, x - 1] if x != 0 
			queue << [y - 1, x] if y != 0
			queue << [y, x + 1] if x != w - 1
			queue << [y + 1, x] if y != h - 1
		end
	end
	puts table.flatten.count(1)
end

Measured memory_bytes: 9056
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#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++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

void solve()
{

}

int main()
{ios_base::sync_with_stdio(false);
cin.tie(0);
int t;
cin>>t;
map<string,int> m;

while(t--)
{
	string s;
	cin>>s;
	m[s]++;
}

o2("AC x",m["AC"]);on;
o2("WA x",m["WA"]);on;
o2("TLE x",m["TLE"]);on;
o2("RE x",m["RE"]);
return 0;
}



Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<MOD>;

bool seen[100010];

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> g[100010];
    rep(i, n - 1){
        ll a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }


    queue<P> que;

    que.push(make_pair(0,0));
    seen[0] = true;

    mint ans = k;

    while(!que.empty()){
        P p = que.front();
        que.pop();
        ll v = p.first;
        ll d = p.second;
        ll tmp;
        if (d == 0) tmp = k - 1;
        else tmp = k - 2;

        for(auto nv : g[v]){
            if (seen[nv]) continue;
            seen[nv] = true;
            ans *= max(tmp, 0ll);
            tmp--;
            que.push(make_pair(nv, d+1));
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8180
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

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

	cout << max(0, abs(a-b)-w) << endl;

	return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int, input().split()))

from collections import defaultdict
cnt=defaultdict(int)
S=A[0]
cnt[0]+=1
cnt[S]+=1

for i in range(1, N):
  S+=A[i]
  cnt[S]+=1

out=0
nums=list(cnt.keys())
for i in nums:
  tmp=cnt[i]
  out+=tmp*(tmp-1)//2
  
print(out)

Measured memory_bytes: 38916
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(ll i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(ll i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;

ll n, k;
ll ans = 0;
VV G;

int dfs(int u, int p=-1) {
  int res = 0;
  for (auto &v : G[u]) {
    chmax(res, dfs(v, u));
  }
  ++res;
  if (res == k && u != 0 && p != 0) {
    ++ans;
    res = 0;
  }
  return res;
}


int main() {
  cin >> n >> k;
  G.assign(n, V());

  rep(i, n) {
    int x; cin >> x;
    --x;
    if (i == 0) {
      if (x != 0) ++ans;
      continue;
    }
    G[x].push_back(i);
  }

  dfs(0);

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


Measured memory_bytes: 10368
def readinput():
    n=int(input())
    return n

def main(n):
    count=0
    for i in range(1,n+1):
        if(len(str(i))%2==1):
            count+=1
    return count

if __name__=='__main__':
    n=readinput()
    ans=main(n)
    print(ans)


Measured memory_bytes: 2940
import java.util.Scanner;

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

Scanner sc = new Scanner(System.in);

int n,m;

n = sc.nextInt();
  m= sc.nextInt();
int t=0;
int sum = 0;
int sum_l = 0;
int bar[] = new int[100];

  for(int i = 0;i<n;i++){
    sum = 0;

    for(int l =0;l<m;l++){
      t = sc.nextInt();
      System.out.print(t+" " );
bar[l] +=t;
      sum+=t;
    }

    sum_l+=sum;
System.out.println(sum);
  }


  for(int i = 0; i< m; i++){
    System.out.print(bar[i]);
    System.out.print(" ");
  }
  System.out.println(sum_l);

  }//main

}//class



Measured memory_bytes: 40680
import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner scn = new Scanner(System.in);
		int a,b,c;
		a = scn.nextInt();
		b = scn.nextInt();
		c = scn.nextInt();
		System.out.printf((a+b+c)<=21?"win":"bust");
	}
}

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

char s[1000000];

int main()
{
	scanf("%s",s+1);
	int len=strlen(s+1);
	int ans=0;
	for(int i=1;i<=len;i++)
		ans+=s[i]-'0';
	if(ans%9) puts("No");
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 3860
#include<algorithm>
#include<cstdio>
#include<functional>
#include<iostream>
#include<cfloat>
#include<climits>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<time.h>
#include<vector>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;
  int ret = x - 1;
  if (y >= x) ret++;
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 256
import sys, math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

def main():
    N, K = MAP()
    NK = N - K + 1
    for i in range(K):
        if NK < i + 1:
            print(0)
        else:
            print(combinations_count(NK, i + 1) * combinations_count(K - 1, i) % mod)

if __name__ == '__main__':
    main()


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

using namespace std;

typedef long long int ll;

int main() 
{ 
	// int t; cin >> t;

	// while (t--)
	// {
	// 	int n,k; cin >> n >> k;
	// 	int i = 2;
	// 		while (n % i != 0)
	// 			i++;
		
	// 	int sum = n;
	// 	while (k--){
	// 		sum += i;
	// 		if (sum % 2 == 0)
	// 			i = 2;
		
	// 	}
	// 	cout << sum << endl;
		
	// }	

	int d,t,s; cin >> d >> t >> s;

	if ((t*s) >= d)
		cout << "Yes";
	else
	{
		cout << "No";
	}
	
} 


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

using namespace std;
typedef long long ll;

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

	ll n, k;
	cin >> n >> k;

	ll rem1 = (n % k + k) % k;
	ll rem2 = k - rem1;

	cout << min(rem1, rem2) << '\n';

	return 0;
}

/*template < typename T >
long long modexp(T a, T b, T p) {
	// returns a to the power b mod p by modular exponentiation

	long long res = 1;
	long long mult = a % p;
	while (b > 0) {
		if (b & 1) {
			res = (res * mult) % p;
		}
		b >>= 1;
		mult = (mult * mult) % p;
	}

	return res;
}*/

/*ll primeModInverse(ll a, ll n) {
	// returns inverse of a mod n by mod exponentiation, use only if n is prime
	return (ll) modexp(a, n - 2, n);
}*/

/*template < typename T >
T gcd(T a, T b) {

	if (b == 0) {
		return a;
	}

	return gcd(b, a % b);

}*/


Measured memory_bytes: 3616
import java.util.*;
import java.io.*;
import java.awt.Point;
import java.math.BigInteger;

public class Main {

	public static void main(String[] args) throws Exception {
		FastIO sc = new FastIO(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		
		int N = sc.nextInt();
		char[] dir = sc.next().toCharArray();
		
		int[][] dp = new int[N][3002];
		Arrays.fill(dp[0], 1); dp[0][0] = 0;
		
		for(int i = 1; i < N; i++) {
			for(int j = 1; j <= i+1; j++) {
				if(dir[i-1] == '>') {
					dp[i][j] += dp[i-1][3001] - dp[i-1][j-1];
					dp[i][j] %= 1000000007;
					dp[i][j] += 1000000007;
					dp[i][j] %= 1000000007;
				} else {
					dp[i][j] += dp[i-1][j-1] - dp[i-1][0];
					dp[i][j] %= 1000000007;
					dp[i][j] += 1000000007;
					dp[i][j] %= 1000000007;
				}
			}
			for(int j = 1; j < 3002; j++) {
				dp[i][j] += dp[i][j-1];
				dp[i][j] %= 1000000007;
			}
		}
		/*
		for(int i = 0; i < N; i++) {
			System.out.println(Arrays.toString(dp[i]));
		}
		*/
		pw.println(dp[N-1][3001]);
		pw.close();
		
	}

	static class FastIO {

		//Is your Fast I/O being bad?

		InputStream dis;
		byte[] buffer = new byte[1 << 17];
		int pointer = 0;

		public FastIO(String fileName) throws Exception {
			dis = new FileInputStream(fileName);
		}

		public FastIO(InputStream is) throws Exception {
			dis = is;
		}

		int nextInt() throws Exception {
			int ret = 0;

			byte b;
			do {
				b = nextByte();
			} while (b <= ' ');
			boolean negative = false;
			if (b == '-') {
				negative = true;
				b = nextByte();
			}
			while (b >= '0' && b <= '9') {
				ret = 10 * ret + b - '0';
				b = nextByte();
			}

			return (negative) ? -ret : ret;
		}

		long nextLong() throws Exception {
			long ret = 0;

			byte b;
			do {
				b = nextByte();
			} while (b <= ' ');
			boolean negative = false;
			if (b == '-') {
				negative = true;
				b = nextByte();
			}
			while (b >= '0' && b <= '9') {
				ret = 10 * ret + b - '0';
				b = nextByte();
			}

			return (negative) ? -ret : ret;
		}

		byte nextByte() throws Exception {
			if (pointer == buffer.length) {
				dis.read(buffer, 0, buffer.length);
				pointer = 0;
			}
			return buffer[pointer++];
		}

		String next() throws Exception {
			StringBuffer ret = new StringBuffer();

			byte b;
			do {
				b = nextByte();
			} while (b <= ' ');
			while (b > ' ') {
				ret.appendCodePoint(b);
				b = nextByte();
			}

			return ret.toString();
		}

	}
}


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

int main(){
    string a;
    string b;
    cin>>a>>b;
    ll n=a.length();
    ll ans=0;
    for(ll i=0;i<n;i++){
        if(a[i]!=b[i]){
            ans++;
        }
    }
    cout<<ans<<endl;
}



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

int n, m;

int main()
{
	cin >> n >> m;
	
	int h[n + 1]; memset(h, 0, sizeof(h));
	
	for(int i = 1; i <= n; i++) cin >> h[i];
	
	int a[m + 1], b[m + 1];
	bool f[n + 1], tt[n + 1];
	
	memset(a, 0, sizeof(a)); memset(b, 0, sizeof(b));
	memset(f, true, sizeof(f)); memset(tt, false, sizeof(tt));
	
	for(int i = 1; i <= m; i++)
	{
		cin >> a[i] >> b[i];
		
		if(h[a[i]] < h[b[i]]) f[a[i]] = false;
		else if(h[a[i]] > h[b[i]]) f[b[i]] = false;
		else if(h[a[i]] == h[b[i]]) f[a[i]] = f[b[i]] = false;
	}
	
	int t = 0;
	for(int i = 1; i <= n; i++) if(f[i]) t++;
	
	cout << t;
	
//	system("pause");
	return 0;
}

Measured memory_bytes: 4836
from sys import stdin

li = list(map(int,stdin.readline().rstrip().split()))
li.sort()

count = 0

if all(li)%2 == 1:
    wake = li[2]//2
    nokori = li[2]-li[2]//2
    print(li[0]*li[1]*(nokori-wake))
else:
    print(0)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 100000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M, R;
    cin >> N >> M >> R;
    int r[R];
    rep(i, R) {
        cin >> r[i];
        r[i]--;
    }
    sort(r, r+R);
    int d[N][N];
    rep(i, N) rep(j, N) d[i][j] = INF;
    rep(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        d[a][b] = c;
        d[b][a] = c;
    }


    rep(k, N) rep(i, N) rep(j, N) 
        d[i][j] = min (d[i][j], d[i][k] + d[k][j]);

    int ans = INF;
    do{
        int tmp = 0;
        rep(i, R-1) tmp += d[r[i]][r[i+1]];
        ans = min(ans, tmp);
    }while(next_permutation(r, r+R));
    cout << ans << endl;

    return 0;
}


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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

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

  	int a[n];
  	FOR(i, n){
  		cin >> a[i];
  	}
  	
  	int count = 1, obs = a[0];
  	FORR(i, 1, n){
  		if(obs <= a[i]){
  			obs = a[i];
  			count++;
  		}
  	}

  	cout << count;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int MOD = 1e9 + 7;

map<ll,ll> ma;
ll b(ll n)
{
	if(n<2) return n;
	if(ma[n]!=0) return ma[n];
	if(n%2==0)
	{
		return (ma[n]=b(n/2));
	}
	else
	{
		ll x = n-1;
		ll y = n+1;
		while(x%2==0) x>>=1;
		while(y%2==0) y>>=1;
		return (ma[n]=(b(x)+b(y))%MOD);
	}
}

ll a(ll n)
{
	if(n==1) return 1;
	if(n==2) return 2;
	if(n&1)
	{
		ll k = (n-1)/2;
		ll ans = ((a(k)*3LL)%MOD + b(k+1))%MOD;
		if(ans<0) ans+=MOD;
		return ans;
	}
	else
	{
		ll k = n/2;
		ll ans = ((a(k)*3LL)%MOD - b(k))%MOD;
		if(ans<0) ans+=MOD;
		return ans;
	}
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll n; cin>>n;
	cout<<a(n+1);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <bitset>
#include <time.h>
#include <set>
#include <algorithm>
#define ll long long
#define Inf 123372036854775806ll
using namespace std;

// -4,-3,-1,-6


int main() {
    int N;
    cin>>N;
    map<ll,int> counts;
    for(int i=1;i<=N;i++) {
        ll x;
        cin>>x;
        counts[x]++;
    }
    
    ll ans = 0;
    for(auto x : counts) {
        ll a = x.first;
        ll b = x.second;
        if (b < a)
            ans += b;
        else
            ans += b-a;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6272
#include<cstdio>
#include<iostream>
using namespace std;
typedef long long int ll;
const int MAXN=1e6+5;
int n,q,k;
char s[MAXN];
int main(){
	scanf("%d\n%s%d",&n,s+1,&q);
	while(q--){
		scanf("%d",&k);
		ll ans=0,dnum=0,mnum=0,pairnum=0;
		for(int i=1;i<=k;++i){
			if(s[i]=='D') ++dnum;
			if(s[i]=='M') {++mnum;pairnum+=dnum;}
			if(s[i]=='C') ans+=pairnum;
		}
		for(int i=k+1;i<=n;++i){
			if(s[i-k]=='D') {--dnum;pairnum-=mnum;}
			if(s[i-k]=='M') --mnum;
			if(s[i]=='D') ++dnum;
			if(s[i]=='M') {++mnum;pairnum+=dnum;}
			if(s[i]=='C') ans+=pairnum;
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

int main(void){
  ll n;
  cin >> n;
  
  if (n % 10 == 9 || n / 10 == 9)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
    

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1e9
#define pb push_back
#define mp  make_pair
#define loop(a,n) for(long long i=a;i<n;i++)
#define vil vector<long long int>
#define vi vector<int>
#define sz(v) v.size()
using namespace std;
ll gcd(ll a,ll b){
    if(a==0)return b;
    return gcd(b%a,a);
}
bool isperfect(ll n){
    ll y=sqrt(n);
    if(n%y==0&&y*y==n)return true;
    return false;
}
bool comp(pair<ll,ll> a,pair<ll,ll> b){
    return a.second<b.second;
}


int main() {
  string s;
  cin>>s;
  if(s=="ABC")cout<<"ARC";
  else cout<<"ABC";
}



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

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a*b)/gcd(a,b)
#define ff              first
#define ss              second
#define int             long long
#define pb              emplace_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             INT_MAX
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(x)			x.begin(),x.end()
#define digits(x)		floor(log10(x))+1
#define FIO				ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

class dsu {
private:
	int *id;
	int* sz;

	int root(int i) {
		while (i != id[i]) {
			id[i] = id[id[i]];
			i = id[i];
		}
		return i;
	}
public:
	int n;
	dsu(int v) {
		n = v;
		id = new int[n];
		sz = new int[n];

		for (int i = 0; i < n; i++) {
			id[i] = i;
			sz[i] = 0;
		}
	}

	bool find(int p , int q) {
		return root(p) == root(q);
	}

	void join(int p , int q) {
		int i = root(p);
		int j = root(q);
		if (i == j) {
			return;
		}
		if (sz[i] < sz[j]) {
			id[i] = j ;
			sz[j] += sz[i];
		}
		else {
			id[j] = i;
			sz[i] += sz[j];
		}
	}
};

int nCr(int n , int r ) {
	int p = 1, k = 1;

	if (n - r < r ) {
		r = n - r;
	}
	if (r != 0) {
		while (r != 0) {
			p *= n ;
			k *= r ;
			int m = __gcd(p, k);
			p /= m;
			k /= m;
			n--;
			r--;
		}
	}
	else {
		p = 1;
	}
	return p ;
}

int modPower(int x, int y , int p) {
	//Used to calculate (x^y)%p
	int res = 1;
	if (y == 0) {
		return 1;
	}

	x = x % p;
	if (x == 0) {
		return 0  ;
	}

	while (y > 0) {
		if (y & 1) {
			res = (res * x) % p;
		}

		y >>= 1;
		x = (x * x) % p;
	}
	return res ;

}



int32_t main() {
	FIO;


	int n ;
	cin >> n;
	if (n >= 30) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}









	return 0;
}


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

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

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

long long comb(long long n, long long r) {
    static vector<vector<ll>> memo(51, vector<ll>(51, -1));
    long long r_new = (r <= n/2) ? r : n-r;
    if (r_new < 0) return 0;
    if (r_new == 0) return 1;
    if (memo.at(n).at(r) != -1) return memo.at(n).at(r);
    else return memo.at(n).at(r) = (n-r_new+1) * comb(n, r_new-1) / r_new;
}

void solve() {
    int n, k, s, t;
    cin >> n >> k >> s >> t;
    vector<int> a(n);
    for (int i=0; i<n; ++i) cin >> a.at(i);

    vector<int> free;
    for (int i=0; i<18; ++i) {
        int ss = s & (1<<i), tt = t & (1<<i);
        if (ss && !tt) {
            cout << 0 << '\n';
            return;
        }
        if (!ss && tt) {
            free.push_back(i);
            continue;
        }
        for (int j=0; j<n; ++j) {
            if ((a.at(j) & (1<<i)) != ss) {
                a.erase(a.begin()+j);
                --j;
                --n;
            }
        }
    }

    int d = (int)free.size();
    for (int i=0; i<n; ++i) {
        int tmp = 0;
        for (int j=0; j<d; ++j) if (a.at(i) & (1<<free.at(j))) tmp += (1<<j);
        a.at(i) = tmp;
    }

    ll res = 0;
    for (int i=1; i<=min(k, n); ++i) res += comb(n, i);
    for (int bits=1; bits<(1<<d); ++bits) {
        int cnt = 0;
        for (int i=0; i<d; ++i) if (bits & (1<<i)) ++cnt;
        map<int, int> mp;
        for (int i=0; i<n; ++i) ++mp[bits & a.at(i)];
        ll sum = 0;
        for (auto p : mp) for (int i=1; i<=min(k, p.second); ++i) sum += comb(p.second, i);
        if (cnt%2 == 0) res += sum;
        else res -= sum;
    }
    cout << res << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 3708
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro split-and-bind (arg-lst string &body body)
  (let ((pos1 (gensym "POS"))
	(pos2 (gensym "POS"))
	(str (gensym "STR")))
    (labels ((expand (arg-lst &optional (init-pos1 t))
	       (if (null arg-lst)
		   body
		   `((let* ((,pos1 ,(if init-pos1 0 `(1+ ,pos2)))
			    (,pos2 (position #\space ,str :start ,pos1 :test #'char=))
			    (,(car arg-lst) (parse-integer ,str :start ,pos1 :end ,pos2)))
		       ,@(expand (cdr arg-lst) nil))))))
      `(let ((,str ,string))
         (declare (string ,str))
	 ,@(expand arg-lst)))))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

;; Hauptteil

(defstruct city
  (year 0 :type uint31)
  (prefecture 0 :type uint31)
  (version 0 :type uint31))

(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (m (read))
         (p-table (make-array (list (1+ n)) :element-type 'list :initial-element nil))
         (city-table (make-array (list m) :element-type 'list :initial-element nil)))
    ;; node := (prefecture year version)
    (dotimes (city-idx m)
      (split-and-bind (prefecture year) (read-line)
        (let ((node (make-city :prefecture prefecture :year year)))
          (push node (aref p-table prefecture))
          (setf (aref city-table city-idx) node))))
    (loop for p-idx from 1 to n
          do (setf (aref p-table p-idx)
                   (sort (the list (aref p-table p-idx)) #'< :key #'city-year))
             (loop for node in (aref p-table p-idx)
                   for version from 1
                   do (setf (city-version node) version)))
    (dotimes (city-idx m)
      (format t "~6,'0D~6,'0D~%"
              (city-prefecture (aref city-table city-idx))
              (city-version (aref city-table city-idx))))))

#-swank(main)


Measured memory_bytes: 91620
#include <bits/stdc++.h>
using namespace std;
int main(){
int A, B, C, K, M; cin >> A >> B >> C >> K;
if(A>=B&&A>=C){ A=A<<K; }else if(B>=A&&B>=C){ B=B<<K; }else{ C=C<<K; }
cout << A+B+C << "\n";
}

Measured memory_bytes: 256
S = input()
a = S[:2]
b = S[2:]
if "01" <= a <= "12":
    if "01" <= b <= "12":
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if "01" <= b <= "12":
        print("YYMM")
    else:
        print("NA")


Measured memory_bytes: 2940
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <utility>
#include <vector>

int main() {
    using VertexId = std::uint32_t;
    using EdgeId = std::uint64_t;
    using EdgeWeight = std::uint64_t;
    using AdjData = std::pair<VertexId, EdgeWeight>;
    using AdjList = std::vector<AdjData>;
    using Edge = std::pair<std::pair<VertexId, VertexId>, EdgeWeight>;
    auto edge_list = std::vector<Edge>();

    auto n = VertexId(0);
    auto m = EdgeId(0);
    std::cin >> n >> m;

    auto adjacency_list = std::vector<AdjList>(n, AdjList());
    for (auto i_ = 0; i_ < m; ++i_) {
        auto source = VertexId(0);
        auto target = VertexId(0);
        auto weight = EdgeWeight(0);
        std::cin >> source >> target >> weight;

        adjacency_list[source].emplace_back(target, weight);
        adjacency_list[target].emplace_back(source, weight);
        edge_list.emplace_back(std::make_pair(source, target), weight);
    }

    std::sort(edge_list.begin(), edge_list.end(), [](const auto& a, const auto& b) { return a.second < b.second; });

    auto forrest_map = std::vector<std::pair<VertexId, VertexId>>();
    for (auto i = 0; i < n; ++i) forrest_map.emplace_back(i, 0);

    std::function<VertexId(VertexId)> find = [&find, &forrest_map](const VertexId& v) {
        if (v == forrest_map[v].first) return v;

        const auto parent = forrest_map[v].first;
        const auto parent_root = find(parent);
        forrest_map[v].first = parent_root;

        return parent_root;
    };

    auto weight_sum = 0;
    for (const auto& e : edge_list) {
        const auto source = e.first.first;
        const auto target = e.first.second;
        const auto weight = e.second;

        const auto source_root = find(source);
        const auto target_root = find(target);

        const auto source_rank = forrest_map[source_root].second;
        const auto target_rank = forrest_map[target_root].second;
        if (source_rank > target_rank) {
            forrest_map[target_root] = std::make_pair(source_root, source_rank);
            weight_sum += weight;
        } else if (source_rank < target_rank) {
            forrest_map[source_root] = std::make_pair(target_root, target_rank);
            weight_sum += weight;
        } else if (source_root != target_root) {
            forrest_map[target_root] = std::make_pair(source_root, source_rank);
            forrest_map[source_root].second++;
            weight_sum += weight;
        }
    }

    std::cout << weight_sum << std::endl;

    return 0;
}


Measured memory_bytes: 10148
'use strict';
const inputRaw = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
const INPUT_LIST_LENGTH_INDEX = 0;
const INPUT_LIST_INDEX = 1;
const INPUT_LIST_DELIMITER = " ";
const inputListLength = parseInt(inputRaw[INPUT_LIST_LENGTH_INDEX]);
const inputList = inputRaw[INPUT_LIST_INDEX].split(INPUT_LIST_DELIMITER);

const process = (inputList, inputListLength) => {
  let min = inputList[0];
  let max = inputList[0];

  for (let i=0;i<inputListLength; i++) {
    const current = parseInt(inputList[i]);

    if (current > max) {
      max = current;
    }
    if (current < min) {
      min = current;
    }
  }

  return max - min;
}

console.log(process(inputList, inputListLength));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
 
#define cinsc ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOR(i,k,n)  for(int64 i=k;i<(int)n;i++)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define SQ(x) ((x)*(x))
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
 
//ONLINE_JUDGE   LOCAL
 
int64 powr(int64 x,int64 y,int64 p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0;
    while (y > 0){   
        if (y & 1)  
            res = (res*x) % p;   
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
} 
 
void  in_o(){
#ifndef LOCAL
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    cinsc;
}
 
int main(){
    //in_o();
    int n,m,x;
    cin>>n>>m;int a[100002],f[100002];
    FOR(i,0,m){
        cin>>x;a[x]=1;
    }
    f[0]=1;
    FOR(i,1,n+1){
        f[i]=(f[i-1]+f[i-2])%MOD;
        if(a[i])
            f[i]=0;
    }
    cout<<f[n]<<endl;
    return 0;
}


Measured memory_bytes: 4392
#include<stdio.h>
int main(void){
    int H,R;
    scanf("%d %d",&H,&R);
    if(H+R<0){
        printf("-1\n");
    }else if(H+R>0){
        printf("1\n");
    }else{
        printf("0\n");
    }
    return 0;
}


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

using namespace std;

int main() {
  int N, T, A;
  cin >> N;
  cin >> T >> A;
  double minimum = 10000000.;
  int H;
  double diff;
  int ans;
  for (int i = 0; i < N; ++i) {
    cin >> H;
    diff = abs(A - (T - (H * 0.006)));
    if (diff < minimum) {
      minimum = diff;
      ans = i + 1;
    }
  }
  cout << ans << endl;
  return 0;
}



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

using namespace std;
#define vi vector<ll>
typedef long long ll;
void read(){
    freopen("in.txt", "r", stdin);
}



ll ks(ll num_items, ll cap, const vector<ll> &w, const vector<ll> &v){
    ll dp[num_items + 1][cap + 1];

    for(ll i = 0; i <= num_items; i++){
        dp[i][0] = 0;
    }

     for(ll i = 0; i <= cap; i++){
        dp[0][i] = 0;
    }

    for(ll i = 1; i <= num_items; i++){
        for(ll j = 1; j <= cap; j++){
            ll curr_value = v[i - 1];
            ll curr_wt =  w[i - 1];
            if(curr_wt > j){
                dp[i][j] = dp[i - 1][j];
            }
            else{
              dp[i][j] = max(curr_value + dp[i - 1][j - curr_wt],
                           dp[i - 1][j]
                           );
            }

        }
    }
    return dp[num_items][cap];


}

int main(){
    //read();
    ll num_items, cap; cin >> num_items >> cap;
    vector<ll> w(num_items), v(num_items);

    for(ll i = 0; i < num_items; i++){
        cin >> w[i] >> v[i];
    }

    cout << ks(num_items, cap, w, v);
    return 0;
}



Measured memory_bytes: 79104
#include <stdio.h>
int main(void){
   int a,b,c,x,y,z;
scanf("%d %d %d",&a,&b,&c);
if(a>b){
x=b;
y=a;
z=c;

  if(b>c){
    x=c;
    y=b;
    z=a;
  }
  else if(a>c){
    x=b;
    y=c;
    z=a;
  }
}

if(a<b){
x=a;
y=b;
z=c;

  if(c<a){
    x=c;
    y=a;
    z=b;
  }
  else if(c<b){
    x=a;
    y=c;
    z=b;
  }
}

printf("%d %d %d\n",x,y,z);

return (0);
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
int main(){
long long n;
cin>>n;
long long ans=0;
long long M=1000000007;
long long sum1=1;
long long sum2=1;
long long sum3=1;
for(long long i=0;i<n;i++){
  sum1=((sum1%M)*10)%M;
  sum2=((sum2%M)*9)%M;
  sum3=((sum3%M)*8)%M;
}
ans+=sum1;
ans=ans%M;
ans-=sum2;
ans=ans%M;
ans-=sum2;
ans=ans%M;
ans+=sum3;
ans=ans%M;
ans=(ans+M)%M;
cout<<ans<<endl;
  return 0;
}


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

int main()
{
  int cn=0;
  string str,ff;
  stack<char> st;
  cin>>str;
  for(int i=0;i<str.size();i++)
  {
    //char& c=str[i];
    if(str[i]=='0'){
      st.push('0');
    }else if(str[i]=='1'){
      st.push('1');
    }else{
      if(!st.empty()) st.pop();
    }
  }
  /*
  for(int i=0;i<st.size();i++){
    cout<<st[i];
  }
  cout<<endl;
  */
  while(!st.empty())
  {
    ff+=st.top();
    st.pop();
  }
  reverse(ff.begin(), ff.end());
  cout<<ff<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

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

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

int cntS[2][100010];
int cntT[2][100010];

signed main() {
	string S, T;
	cin >> S >> T;

	REP(i, 1, S.size()) {
		cntS[S[i - 1] - 'A'][i] = 1;
	}
	REP(i, 1, T.size()) {
		cntT[T[i - 1] - 'A'][i] = 1;
	}
	rep(j, 2) {
		REP(i, 1, S.size()) {
			cntS[j][i] += cntS[j][i - 1];
		}
		REP(i, 1, T.size()) {
			cntT[j][i] += cntT[j][i - 1];
		}
	}

	int q;
	cin >> q;
	rep(loop, q) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;

		int sa = cntS[0][b] - cntS[0][a - 1];
		int sb = cntS[1][b] - cntS[1][a - 1];
		int ta = cntT[0][d] - cntT[0][c - 1];
		int tb = cntT[1][d] - cntT[1][c - 1];

		int sdif = sa - sb;
		int tdif = ta - tb;

		int dif = sdif - tdif;

		if (dif < 0) dif *= -1;
		cout << (dif % 3 ? "NO" : "YES") << endl;
	}

    return 0;
}


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

#define fi first
#define se second
#define U unsigned
#define P std::pair<int,int>
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
const int MAXN = 1e5 + 5;
char S[MAXN],T[MAXN];
int main(){
	LL a,b,c,k;scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
	LL ans = 0;
	if(k <= a) ans = k;
	else if(k <= a+b) ans = a;
	else ans = a-(k-a-b);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (int i = a; i < b; i++)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld n,r,i,j,t,k,p,q,s,a,b;
    cin>>a>>b;
    double x=(((a+b)*1.0)/(2.0));
    if((x-(lld)x)==0)
    	cout<<lld(x);
    else
    	cout<<lld(x)+1;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		int k = saori.saori_hayami();
		ArrayList<Integer> ans = new ArrayList<>();
		if(b-a+1 >= 2*k){
			for(int i = a;i < a+k;i++){
				ans.add(i);
			}
			for(int i = b;i > b-k;i--){
				ans.add(i);
			}
			Collections.sort(ans);
		} else {
			for(int i = a;i <= b;i++){
				ans.add(i);
			}
			Collections.sort(ans);
		}
		for(int num : ans){
			System.out.println(num);
		}
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 24660
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    cin>>n>>k;
    vector<int>a(n);
    //rep(i,n)cin>>a[i];
    int ans=(n+k-3)/(k-1);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {

	int n;
	double a, J = 0, B = 0;
	string b;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		if (b == "JPY")J += a;
		else B += a;
	}
	cout << J + B * 380000 << endl;

	return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
typedef long long ll;
using namespace std;
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define out(s) cout << s << endl

int main(){
    int N,H;cin >> N >> H;
    int n,h;cin >> n >> h;
    int w=H*N;
    int b=n*H+h*N-n*h;
    w-=b;
    out(w);
    return 0;
}




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

using namespace std;

int n, x, a, ans=0;
vector<int> as;

int main()
{    cin >> n >> x;
    for(int i = 0; i < n; ++i)
    {
        cin >> a;
        as.push_back(a);
    }

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

    long long s = 0;
    for(int i = 0; i < n; ++i)
    {
        s += as[i];
        if(s <= x)
        {
            ans++;
        }
    }
    if(ans == n && s < x)
        ans--;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e3+5;
const int inf=0x3f3f3f3f;
int main(void)
{
    int n,m;
    scanf("%d%d",&n,&m);
    printf("%d",n*m);
    return 0;
}


Measured memory_bytes: 3816