akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
	int N, K, x = 1;
	cin >> N >> K;
	for (; N > 0; N--) {
		if (x < K) {
			x = 2 * x;
		} else {
			x = x + K;
		}
	}
	cout << x << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    ll n;
    cin >> n;
    ll a[100005] = {};
    rep(i,0,n)cin >>a[i];

    int cnt = 0,cnt2 = 0;
    rep(i,0,n){
        if(a[i]%4 == 0)cnt++;
        else if(a[i]%2 == 0)cnt2++;
    }

    if(cnt >= n/2)Yes;
    else{
        n -= cnt*2;
        if(cnt2 >= n)Yes;
        else No;
    }
	return  0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pl;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) for(ll (i)=(n)-1;(i)>=0;i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

int main(){
    ll count,dp[101/*桁数*/][5/*0ではないものの個数(0,1,2,3)*/][2/*smaller*/],digit;
    string n;
    cin>>n>>count;
    rep(i,101)rep(j,5)rep(k,2)dp[i][j][k] = 0;
    dp[0][0][0] = 1;
    digit = n.size();
    rep(i,digit){
        int num = n[i] - '0';
        rep(j,count + 1)rep(k,2)rep(d,(k)?10:num + 1){
            dp[i + 1][j + (d != 0)][k || d < num] += dp[i][j][k];
        }  
    }
    cout<<dp[digit][count][0] + dp[digit][count][1]<<endl;
}

Measured memory_bytes: 256
from collections import Counter

n = int(input())
a = [int(i) for i in input().split()]

a_sum = [0]
for i in range(n):
    a_sum.append((a_sum[-1]+a[i]))

cnt = Counter(a_sum)

ans = 0
for v in cnt.values():
    ans += v*(v-1)//2

print(ans)

Measured memory_bytes: 41568
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    int n;cin >> n;
    vi a(n);
    rep(i,n) cin >> a[i];
    map<int,int> mp;
    rep(i,n) mp[a[i]]++;
    int sum = 0;
    for(auto t : mp){
        sum += t.second-1;
    }
    //call(sum);
    if(sum&1) ++sum;
    cout << n - sum << endl;
}

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

// --------------------------------------------------------------------------------
#define FASTIO	ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define frepi(a,b) for(int i=a;i<=b;++i)
// --------------------------------------------------------------------------------

void solve_main()
{
   ll n,d;cin>>n>>d;
   d = d*d;
   int ans=0;
   for(int i=0;i<n;++i)
   {
   		ll x,y;cin>>x>>y;
   		if(x*x + y*y <=d)
   			ans++;
   }
   cout<<ans;
}

int main()
{
	#ifndef ONLINE_JUDGE
		freopen("/home/suryakant/input.txt","r",stdin);
		freopen("/home/suryakant/output.txt","w",stdout);
	#endif
	
    int t=1;
    // cin>>t;
    while(t--)
    {
    	solve_main();
    }    
}

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

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

    int A, B, C;
    cin >> A >> B >> C;
    int sum = A % B;
    while (true) {
        if (sum == C) {
            cout << "YES" << endl;
            exit(0);
        }
        sum = (sum + A) % B;
        if (sum == A % B) {
            cout << "NO" << endl;
            exit(0);
        }
    }

    return 0;
}

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

int main () {
    
    int a, b;
    char op;

    for (int i = 0;; i++) {
        cin >> a >> op >> b;

        if (op == '?') break;

        if (op == '+') {
            cout << a+b << endl;
        }
        else if (op == '-') {
            cout << a-b << endl;
        }
        else if (op == '*') {
            cout << a*b << endl;
        }
        else {
            cout << a/b << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3092
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int a,b,c,i,cnt;
	cnt=0;
	cin>>a>>b>>c;
	while(1){
		if(c<=0) break;
		c=c-a;
		cnt=cnt+1;
		if(cnt%7==0) c=c-b;
	}
	cout<<cnt<<endl;
	return 0;
}



Measured memory_bytes: 3100
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
#define ll long long
using namespace std;

int main(){
	int a,b;
	while(scanf("%d%d",&a,&b)==2)
    {
        printf("%d\n",a*b);
    }
	return 0;
}


Measured memory_bytes: 3816
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cassert>

using namespace std;
using ll = long long;

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

int main()
{
    int n;
    cin >> n;
    int ans = 1001001001;
    for(int i = 1; i <n; i++){
        int b = n - i;
        string s, t;
        int tmp = 0;
        s = to_string(i);
        t = to_string(b);
        for(int j = 0; j < s.length(); j++){
            tmp += s[j] - '0';
        }
        for(int k = 0; k< t.length(); k++){
            tmp += t[k] - '0';
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

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

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

using namespace std;

ll facs[(ll)1e5+10];


// x^n in mod
ll modpow(ll a,ll n,ll p){
    ll x = a;
    ll res = 1;
    while(n)
    {
        if(n & 1)
        {
            res = ((ll)res * (ll)x) % p;
        }
        n >>= 1;
        x = ((ll)x*(ll)x) % p;
    }
    return res;
}

// n! in mod
ll fac(ll n){
  return facs[n];
}

// nCr in mod
ll comb(ll n, ll r){
  if(n<0 || n<r || r<0)return 0;
  ll fn = fac(n);
  ll fr = fac(r);
  ll fn_r = fac(n-r);
  
  ll d = (modpow(fr, MOD-2, MOD) * modpow(fn_r, MOD-2, MOD)) % MOD;
  ll u = fn%MOD;
  
  ll result = u * d % MOD;

  return result;
}

int main(){
  ll n, same_num,a1,a2;cin>>n;
  ll a[n+2];
  map<ll,ll> m;
  rep(i,n+1){
    ll t;cin>>t;
    a[i]=t;
    if(m[t]){
      a2=i;
      rep(j, n+1)if(a[j]==t){a1=j; break;}
    }
    m[t]++;
  }
  
  facs[0]=1;
  rep(i, n+10){
    facs[i+1] = (facs[i]*(i+1))%MOD;
  }

  ll p=a1+1;
  ll q=n-a2-1;
  cout<<n<<endl;
  rep(i,n){
    ll k=i+2;

    ll result = comb(n+1, k)-comb(p+q, k-1)+MOD;
    cout<<result%MOD<<endl;

  }

  return 0;
}

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

namespace _0277
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] price = new int[4] { 6000, 4000, 3000, 2000 };
            for (int i = 0; i < 4; i++)
            {
                int[] vs = RArInt();
                Console.WriteLine(vs[1] * price[vs[0] - 1]);
            }         
        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



Measured memory_bytes: 20008
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e5+5;

int n, m;
int deg[N];

int32_t main()
{
	IOS;
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int u, v;
		cin>>u>>v;
		deg[u]++, deg[v]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(deg[i]%2)
		{
			cout<<"NO";
			return 0;
		}
	}
	cout<<"YES";
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    int main(){
      ll cnt[5]={},ans=0;
      int n;
      string s;
      cin>>n;
      for(int i=0;i<n;i++){
        cin>>s;
        switch(s[0]){
          case 'M':cnt[0]++;break;
          case 'A':cnt[1]++;break;
          case 'R':cnt[2]++;break;
          case 'C':cnt[3]++;break;
          case 'H':cnt[4]++;break;
        }    
      }
      for(int i=0;i<5;i++){
        for(int j=0;j<5;j++){
          if(i==j) continue;
          for(int k=0;k<5;k++){
            if(i==k||j==k) continue;
            ans+=cnt[i]*cnt[j]*cnt[k];
          }
        }
      }
      cout<<(ans/6)<<endl;
      return 0;
    }

Measured memory_bytes: 256
def solve():
    N = int(input())
    As = [int(i) for i in input().split()]

    N_minus_A = [0] * N
    N_plus_A = [0] * N

    for i in range(N):
        minus = i + 1 - As[i]
        plus = i + 1 + As[i]
        if 0 < minus < N:
            N_minus_A[minus] += 1
        if 0 < plus < N:
            N_plus_A[plus] += 1
    print(sum([N_minus_A[i] * N_plus_A[i] for i in range(N)]))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 32168
#! env/bin/local python3
# -*- coding:utf-8 -*-

# -- submit ----

import itertools

# --- fetch input ---
inputs: list = []
while True:
    try:
        inputs.append(input().strip('\n'))
    except EOFError:
        break

# --- write code below ---
n, m, q = (int(i) for i in inputs[0].split())
conditions = [[int(j) for j in c.split()] for c in inputs[1:]]

# length == n -> break
candidates: list = []

results = itertools.combinations_with_replacement(range(1, m+1), n)
for i in results:
    temp_sum = 0
    for con in conditions:
        a, b, c, d = con
        if i[b-1] - i[a-1] == c:
            temp_sum += d
    if temp_sum > 0:
        candidates.append(temp_sum)

ranking = sorted(candidates)
print(ranking[-1])


Measured memory_bytes: 13852
#全ての約数を列挙。o(√N)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    #ソートしない場合はコメントアウト
    divisors.sort() 

    return divisors

n,m = [int(_) for _ in input().split()]
ans = 0
l = make_divisors(m)
for i in range(0, len(l)):
    if m // l[i] >= n:
        ans = max(l[i], ans)
print(ans)

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

int main() {
  int n;
  cin >> n;
  vector<double> recp_a(n);
  int a;
  for (int i=0; i<n; i++) {
    cin >> a;
    recp_a[i] = 1.0 / (double)a;
  }

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

  double sum = 0;
  for (double e : recp_a) {
    sum += e;
  }

  double ans = 1.0 / sum;


  printf("%.6f\n", ans);

  return 0;
}


Measured memory_bytes: 256
import sys

X,N = map(int,input().split())
P = list(map(int,input().split()))
if X < 1 or 100 < X:
    sys.exit()
if N < 0 or 100 < N:
    sys.exit()
if N == 0:
    print(X)
    sys.exit()

P_number = len(P)
if P_number < 1 or 100 < P_number:
    sys.exit()

res1 = 100
res2 = 100
res0 = 0
i = 0
j = 0
while i <= N:
    if (X - i) not in P:
        res1 = (X - i)
        break
    i += 1
while j <= N:
    if (X + j) not in P:
        res2 = (X + j)
        break
    j += 1
if i > j:
    res0 = res2
elif j > i:
    res0 = res1
elif i == j:
    res0 = res1
print(res0)

Measured memory_bytes: 9108
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

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

    cout<<max(0,min(b,d)-max(a,c))<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
using namespace std;
const int N=2e4+10;
int n,a[N],b[N];
template<typename I> inline void read(I &ot){
	I ch=getchar(), x=0, f=1;
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}
	ot=x*f;}
template<typename I, typename... U> inline void read(I &x,U&... y){read(x); read(y...);}
int main()
{
	//freopen("Construct Sequences.in","r",stdin);
	//freopen(".out","w",stdout);
	read(n);
	for(RG int i=1;i<=n;i++) a[i]=i*(n+1), b[i]=(n-i+1)*(n+1);
	for(RG int i=1,aa;i<=n;i++)
	{
		read(aa);
		a[aa]-=(n-i+1);
	}
	for(RG int i=1;i<=n;i++) printf("%d ",a[i]); printf("\n");
	for(RG int i=1;i<=n;i++) printf("%d ",b[i]);
	//fclose(stdin); fclose(stdout);
	return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007


void solve()
{
	ll n,m;
	cin>>n>>m;
	cout<<(n-1)*(m-1);
	return;
}
int main()
{
	fast;
	int q;
	q=1;
	// cin>>q;
	while(q--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3652
H, N = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
max_a = max(a for a, b in ab)
dp = [0]*(H+max_a)
for i in range(1, H+max_a):
    dp[i] = min(dp[i-a]+b for a, b in ab)
print(dp[H])

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

int main() {
	int a,b;
	cin >> a >> b;
	if (a <= 5) {
		cout << "0" << endl;
	}
	else if (a >= 13) {
		cout << b << endl;
	}
	else cout << b / 2 << endl;
}


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

        static readonly long Mod = 1000000000 + 7;

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

            var num = 0;
            for (var i = 0; i < N; ++i)
            {
                if (num + 1 == ai[i])
                    ++num;
            }

            WriteLine(0 == num ? -1 : N - num);
            //Out.Flush();
        }
    }
}

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

#define N 100010
int n, m;
int a[N];

int main() {
	while (scanf("%d%d", &n, &m) != EOF) {
		memset(a, 0, sizeof a);
		for (int i = 1, l, r; i <= m; ++i) {
			scanf("%d%d", &l, &r);
			++a[l]; --a[r + 1];
		}
		int res = 0;
		for (int i = 1; i <= n; ++i) {
			a[i] += a[i - 1];
			res += (a[i] == m);
		}
		printf("%d\n", res);
	}
	return 0;
}


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

int main(){
  string S;
  cin >> S;
  int ans=0;
  string T="01";
  for (int i=0;i<S.size();i++){
    ans=(S[i]==T[i%2])?ans+1:ans;
  }
  int L=S.size();
  ans=min(ans,L-ans);
  cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<ld> v(n);
    for(int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    for(int i = 1; i < n; i++)
    {
        v[0] = (v[i] + v[0])/2;
    }
    cout << setprecision(18);
    cout << fixed;
    cout << v[0];

    return 0;
}


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

string s = "", t = "", ans = "";
int sz1 = 0, sz2 = 0;

int mem[3010][3010];
int DP(long long i, long long j){

	if(i == sz1 || j == sz2)	return 0;
	if(mem[i][j] != -1)	return mem[i][j];

	long long opt1 = (s[i] == t[j]) ? 1+ DP(i+1, j+1) : 0;
	long long opt2 = DP(i, j+1);
	long long opt3 = DP(i+1, j);

	int mx = 0;
	mx = (mx > opt1) ? mx : opt1;
	mx = (mx > opt2) ? mx : opt2;
	mx = (mx > opt3) ? mx : opt3;

	return mem[i][j] = mx;
}

void trace(long long i, long long j){

	if(i == sz1 || j == sz2)	return;

	long long opt1 = (s[i] == t[j]) ? 1+ DP(i+1, j+1) : 0;
	long long opt2 = DP(i, j+1);
	long long opt3 = DP(i+1, j);

	int mx = 0;
	mx = (mx > opt1) ? mx : opt1;
	mx = (mx > opt2) ? mx : opt2;
	mx = (mx > opt3) ? mx : opt3;

	if(mx == opt1)	{
		if(s[i] == t[j]){
					ans += s[i]; trace(i+1, j+1);
					return;
		}
	}
	else if(mx == opt2) {trace(i, j+1);
		return;}
	else if(mx == opt3)	{trace(i+1, j);}

	return;
}


int main(){

	// freopen("input", "r", stdin);
	// freopen("output", "w", stdout);
	memset(mem, -1, sizeof mem);

	cin >> s >> t;
	sz1 = s.length();
	sz2 = t.length();

	DP(0,0);
	trace(0,0);

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

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

signed main(){
  int n, k;
  cin >> n >> k;
  long h[100000];
  for(int i = 0; i < n; i++){
    cin >> h[i];
  }
  sort(h, h + n);
  
  long minDif = 1000000001;
  for(int i = n - 1; i >= k - 1; i--){
    long dif = h[i] - h[i - k + 1];;
    if(minDif > dif){
      minDif = dif;
    }
  }
  cout << minDif << endl;
}

Measured memory_bytes: 1024
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n, m = map(int, input().split())

s = getSomeInputListInt(m)
p = getInputListInt()

s_bit = []

for tmp_s in s:
    tmp_bit = 0
    for i in range(1, tmp_s[0] + 1, 1):
        aaa = 1 << (tmp_s[i] - 1)
        tmp_bit = aaa | tmp_bit
    s_bit.append(tmp_bit)

ans = 0
for i in range(int(pow(2, n))):
    flg = True
    for j in range(m):
        cnt = bin(s_bit[j] & i).count("1")
        if cnt % 2 != p[j]:
            flg = False
            break
    if flg:
        ans += 1

print(ans)

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    for(int i = 0; i < m; i++) cin >> x[i];

    sort(x.begin(), x.end());
    vector<int> diff;
    for(int i = 1; i < m; i++){
        diff.push_back(x[i]-x[i-1]);
    }

    sort(diff.begin(), diff.end());
    int ans = 0;
    for(int i = 0; i < m-n; i++) ans += diff[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4172
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <cstdlib>
#include <cstdio>
using namespace std;
typedef long long int ll;

int n;
string s;
map<string, int> Mols;
class MolNotFound {};
int solve(int &p);


int Molecule(int &p){
	int ret = 0;
	if(s[p] == '('){
		ret += solve(++p);
		p++;
	}else{
		string n="";
		n += s[p++];
		while(islower(s[p])) n+=s[p++];
		if(!Mols.count(n)) throw MolNotFound();
		ret += Mols[n];
	}
	
	if(isdigit(s[p])){
		int t=0;
		while(isdigit(s[p])) t = t*10 + s[p++]-'0';
		ret *= t;
	}
	
	return ret;
}

int solve(int &p){
	int ret = 0;
	while(s[p] && s[p] != ')') ret += Molecule(p);
	return ret;
}

main(){
	int i,j;
	while(cin >> s, s!="END_OF_FIRST_PART"){
		int w;
		cin >> w;
		Mols[s] = w;
	}
	while(cin >> s, s!="0"){
		int p = 0;
		try{
			cout << solve(p) << endl;
		}catch(...){
			cout << "UNKNOWN" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1288
import java.util.*;
class Main {
 public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
  int testCase = 1;
  while(sc.hasNext()){
   int x = sc.nextInt();
  if( x > 0 ) {
   System.out.println( "Case " + testCase + ": " + x );
   testCase++;
  } else {
    break;
  }
 }
}
}
    


Measured memory_bytes: 42340
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0; 
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

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

void solve(){
    int n = scan!int;
    long[] as = scan!long(n + 1);
    log("as:", as);

    long[] ls;
    long u = 1;
    foreach(i, a; as){
        ls ~= u;
        u = (u - a) * 2;
        if(u > (1L<<60)) u = 1L<<60;
    }
    log("ls:", ls);

    long x = 0;
    long ans = 0;
    foreach_reverse(i, a; as){
        long l = ls[i];
        log("i:", i, "a:", a, "l:", l);
        if(x + a <= l){
            x += a;
            ans += x;
            log("1.", "x:", x, "ans:", ans);
        }
        else if((x + 1) / 2 + a <= l){
            x = l;
            ans += l;
            log("2.", "x:", x, "ans:", ans);
        }
        else{
            "-1".print;
            return;
        }
    }
    ans.print;
}


Measured memory_bytes: 7456
from sys import stdin, setrecursionlimit

MOD = 10 ** 9 + 7


def cmd(n, r, mod=10 ** 9 + 7):
    r = min(r, n - r)
    x = y = 1
    for i in range(r):
        x *= n - i
        x %= mod
        y *= i + 1
        y %= mod
    return x * pow(y, mod - 2, mod) % mod


def main():
    n, a, b = map(int, stdin.readline().split())

    ans = pow(2, n, MOD) - 1

    ans -= cmd(n, a, MOD)
    ans -= cmd(n, b, MOD)

    print(ans % MOD)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

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

int main(){
  string str;
  cin>>str;
  int i, flag=1;
  for(i=0; i<str.length(); i++){
    if(i%2==0){
      if(str[i]=='R' || str[i]=='U' || str[i]=='D')
        continue;
      else{
        flag=0;
        break;
      }
    }
    else{
      if(str[i]=='L' || str[i]=='U' || str[i]=='D')
        continue;
      else{
        flag=0;
        break;
      }
    }
  }

  if(flag)
    cout<<"Yes\n";
  else
    cout<<"No\n";
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  long long num;
  scanf("%lld", &num);
  long long n, min=1000000, max=-1000000, sum;
  int index;
  sum=0;
  for(index=0; index<num; ++index){
	scanf("%lld", &n);
	sum=sum+n;
	if(min>n)
	  min=n;
	if(max<n)
	  max=n;
}
  printf("%lld %lld %lld\n", min, max, sum);
  return 0;
}



Measured memory_bytes: 2100
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;
const int Max = 1e6 + 5;
int lst[Max], ls[Max];

int main()
{
	string str;
	cin >> str;
	int l = Max, r = -1;
	for (int i = 0; i <= str.size(); i++)
	{
		if (str[i] == 'A')l = min(l, i);
		if (str[i] == 'Z')r = max(r, i);
	}
	if (l == Max || r == -1)cout << 0;
	else 
	cout << r - l + 1;
}

Measured memory_bytes: 3348
#include<stdio.h>

int main()
{
    int a,b,c;
    int flag;
    while(scanf("%d%d%d",&a,&b,&c)!=EOF)
    {
        flag=b*10+c;
        if(flag%4==0) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


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

typedef long long LL;
typedef pair<int, int> II;

const int N = (int) 1e5 + 10;
int n, m, a[N];

int main() {
#ifdef LOCAL
    freopen("inp", "r", stdin);
    freopen("out", "w", stdout);
#endif
    scanf("%d%d", &n, &m);
    while (m--) {
        int u, v; scanf("%d%d", &u, &v);
        a[u] ^= 1;
        a[v] ^= 1;
    }
    for (int i = 1; i <= n; ++i) if (a[i] == 1) {
        puts("NO");
        return 0;
    }
    puts("YES");
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

// constexpr inline ll mod = 1'000'000'007;
// constexpr int max_n = 200'000 + 5;

int n;
vector<int> as(100);

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(15); // 浮動小数の表示の精度

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> as[i];
    }
    ll money = 1000;
    ll kabu = 0;
    for (int i = 0; i < n; i++) {
        if (i < n-1 && as[i] < as[i+1]) {
            ll mai = money / as[i];
            money -= as[i] * mai;
            kabu += mai;
        }
        else
        {
            money += kabu * as[i];
            kabu = 0;
        }
    }
    cout << money << endl;

    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <functional>

#define INF 1000000000000000000
using namespace std;
typedef long long ll;

int main() {
	int a[50], b[50], c[50], d[50];
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> c[i] >> d[i];
	}
	for (int i = 0; i < n; i++) {
		ll dist;
		int ans = 0;
		dist = abs(a[i] - c[0]) + abs(b[i] - d[0]);
		for (int j = 1; j < m; j++) {
			ll temp= abs(a[i] - c[j]) + abs(b[i] - d[j]);
			if (temp < dist) {
				dist = temp;
				ans = j;
			}
		}
		cout << ans + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
inline char gc() {
	static char now[1<<16], *S, *T;
	if(S == T) {T = (S = now) + fread(now, 1, 1<<16, stdin); if(S == T) return EOF;}
	return *S++;
}
#define gc getchar
inline int read() {
	int x = 0, f = 1; char c = gc();
	while(c < '0' || c > '9') {(c ^ '-') ? 0 : (f = 0); c = gc();}
	while(c >= '0' && c <= '9') {x = (x << 3) + (x << 1) + (c ^ 48); c = gc();}
	return f ? x : ((~x) + 1);
}
#define N 100010
int n, L, T, x[N], d[N];
int main() {
	n = read(); L = read(); T = read();
	for (int i = 1; i <= n; ++ i) {
		x[i] = read(); d[i] = read();
	}
	int cnt = 0;
	for (int i = 1; i <= n; ++ i) {
		if (d[i] == 2) d[i] = -1;
		x[i] += T * d[i];
		cnt += x[i] / L;
		if (x[i] % L < 0) -- cnt;
		x[i] = (x[i] % L + L) % L;
	}
	sort(x + 1, x + n + 1);
	cnt = (cnt % n + n) % n;
	for (int i = 1; i <= n; ++ i) printf("%d\n", x[(i + cnt - 1) % n + 1]);
	return 0;
}

Measured memory_bytes: 1920
#include <iostream>
#include <string>

using namespace std;

void funca()
{
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) cout << "Yes";
    else cout << "No";
}

void funcb()
{
    int x;
    cin >> x;

    int u = 0;
    u += x / 500 * 1000;
    x %= 500;
    u += x / 5 * 5;

    cout << u;


}

int main()
{
    //funca();
    funcb();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ull unchaed long long
#define ll long long
#define il inline
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define rep0(i, n) for(int i = 0; i < (n); i ++)
#define per0(i, n) for(int i = (n) - 1; i >= 0; i --)
#define ept 1e-9
#define INF 0x3f3f3f3f
#define sz(x) (x).size()
#define Axx(x) (x).begin(), (x).cntd()
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
inline ll read1()
{
	ll x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
using namespace std;
const int mod = 998244353;
const int N = 1010;
inline void add(int &x, int y) { x += y; if (x >= mod) x -= mod; }

char s[N];
int k, n, seq[N], tot, pre[N];

int dp[N][N], S;

void do_dp(int minsum, int cur)
{
	static int pre1[N][N], pre2[N][N];
	for (int i = 0; i <= S; i++) for (int j = 0; j <= S; j++) pre1[i][j] = pre2[i][j] = 0;

	// puts("dp");
	for (int i = 0; i <= S; i++) for (int j = 0; j <= S; j++) if (dp[i][j])
			{
				// 0 <= a[i] < cur
				add(pre1[i][j], dp[i][j]);
				add(pre1[i + cur][j], mod - dp[i][j]);

				// a[i] >= cur
				add(pre2[i + cur][j], dp[i][j]);
			}

	memset(dp, 0, sizeof(dp));
	for (int i = 0; i <= S; i++) for (int j = 0; j <= S; j++)
		{
			if (i) add(pre1[i][j], pre1[i - 1][j]);
			if (i && j) add(pre2[i][j], pre2[i - 1][j - 1]);
			if (i >= minsum)
			{
				dp[i][j] = pre1[i][j] + pre2[i][j];
				if (dp[i][j] >= mod) dp[i][j] -= mod;
			}
		}
}

int main()
{
	scanf("%s%d", s + 1, &k);
	n = strlen(s + 1);

	int last = 0;
	for (int i = 1; i <= n; i++) if (s[i] == '0')
		{
			seq[++tot] = i - last - 1;
			last = i;
		}
	seq[++tot] = n - last;
	for (int i = 1; i <= tot; i++) pre[i] = pre[i - 1] + seq[i];
	S = pre[tot];

	dp[0][0] = 1;
	for (int i = 1; i <= tot; i++) do_dp(pre[i], seq[i]);

	int ans = 0;
	for (int i = 0; i <= S && i <= k; i++) add(ans, dp[S][i]);
	cout << ans;

	return 0;
}


Measured memory_bytes: 11272
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <limits.h>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

#define C (1000000000 + 7)

int main() {
    
    int n, m;
    
    long long x_sum = 0, y_sum = 0;
    long long x_start, y_start;
    
    cin >> n;
    cin >> m;
    
    for ( int i = 0; i < n; i++ ) {
        long long x;
        cin >> x;
        
        if ( !i ) { x_start = x; }
        else {
            x_sum += abs( x - x_start )*i;
            x_sum -= abs( x - x_start )*(n-i-1);
        }
    }
    
    for ( int i = 0; i < m; i++ ) {
        long long y;
        cin >> y;
        
        if ( !i ) { y_start = y; }
        else {
            y_sum += abs( y - y_start )*i;
            y_sum -= abs( y - y_start )*(m-i-1);
        }
    }
    
    cout << ((x_sum%C) * (y_sum%C))%C << endl;
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <stack>

using namespace std;

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

const int INF = 1 << 28;

int main()
{
  int a, d, n;
  while(cin >> a >> d >> n, (a|d|n) ) {
    int idx = 0;
    for(int i = a; ; i += d) {
      bool flag = true;
      flag &= i > 1;
      for(int j = 2; j * j <= i; ++j) {
        flag &= i % j != 0;
      }
      if( flag ) {
        if( ++idx == n ) {
          cout << i << endl;
          break;
       }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <iomanip>

using namespace std;

bool cmp(long long a, long long b) {
  return(a>b);
}

long long comb(long long n, long long  k) {
  long long ans = 1;
  for (int i=1;i<=k;i++) {
    ans = ((n-k+i) * ans) / i;
  }
  return(ans);
}

int main(){
  int n, a, b;
  vector<long long> v;
  long long total = 0;
  double ave;
  map<long long, int> m;
  long long l = 0;
  int l_count = 0;
  int set_keys = 0;
  
  cin >> n >> a >> b;
  for (int i=0;i<n;i++) {
    long long vv;
    cin >> vv;
    if (m.find(vv) == m.end()) {
      m[vv] = 0;
    }
    m[vv]++;
    v.push_back(vv);
  }
  sort(v.begin(), v.end(), cmp);
  for (int i=0;i<a;i++) {
    total += v[i];
    if (l!=v[i]) {
      l = v[i];
      l_count= 0;
      set_keys++;
    }
    l_count++;
  }
  ave = ((double)total)/a;
  cout << setprecision(30) << ave << endl;
  long long c = 0;
  if (set_keys==1) {
    for (int i=l_count;i<=b && i<=m[l];i++) {
      c += comb((long long)m[l], (long long)i);
    }
  } else {
    c = comb((long long)m[l], (long long)l_count);
  }
  cout << c << endl;
  return(0);
}


Measured memory_bytes: 384
#!/usr/bin/env python3
X = int(input())
if X == 1:
    print(1)
else:
    ans = 0
    for b in range(2, int(X**0.5) + 1):
        for p in range(2, 11):
            if b ** p <= X :
                ans = max([ans, b**p])
    print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n,d,x;
  cin>>n>>d>>x;
  double f=(2*d+(2*n-1)*x)/2.0;
  double v=0;
  double vl=1;
  for(in c=n;c>=1;--c){
    v+=f*vl;
    vl*=(1+c)/double(c);
  }
  cout<<setprecision(15);
  cout<<v<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#if defined(__GNUC__)
#pragma GCC optimize ("Ofast")
#endif
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 51, LOG=20;

ll n, m, k, u, v, x, y, t, a, b, ans;
ll dp[MAXN][MAXN][MAXN*MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>m;
	dp[0][0][0]=1;
	for (int i=1; i<=n; i++){
		cin>>x;
		dp[i][0][0]=1;
		for (int j=1; j<=i; j++){
			for (int s=0; s<x; s++) dp[i][j][s]=dp[i-1][j][s];
			for (int s=x; s<=n*m; s++) dp[i][j][s]=dp[i-1][j][s]+dp[i-1][j-1][s-x];
		}
	}
	for (int i=1; i<=n; i++) ans+=dp[n][i][i*m];
	cout<<ans<<'\n';
	
	return 0;
}
/*
      ___           ___                            ___           ___           ___           ___           ___           ___
     /\  \         /\__\      ___                 /\  \         /\__\         /\  \         /\__\         /\  \         /\__\      ___
    /::\  \       /:/  /     /\  \               /::\  \       /:/  /        /::\  \       /:/  /        /::\  \       /:/  /     /\  \
   /:/\:\  \     /:/  /      \:\  \             /:/\ \  \     /:/__/        /:/\:\  \     /:/__/        /:/\:\  \     /:/  /      \:\  \
  /::\~\:\  \   /:/  /       /::\__\           _\:\~\ \  \   /::\  \ ___   /::\~\:\  \   /::\  \ ___   /::\~\:\  \   /:/  /       /::\__\
 /:/\:\ \:\__\ /:/__/     __/:/\/__/          /\ \:\ \ \__\ /:/\:\  /\__\ /:/\:\ \:\__\ /:/\:\  /\__\ /:/\:\ \:\__\ /:/__/     __/:/\/__/
 \/__\:\/:/  / \:\  \    /\/:/  /             \:\ \:\ \/__/ \/__\:\/:/  / \/__\:\/:/  / \/__\:\/:/  / \/__\:\/:/  / \:\  \    /\/:/  /
      \::/  /   \:\  \   \::/__/               \:\ \:\__\        \::/  /       \::/  /       \::/  /       \::/  /   \:\  \   \::/__/
      /:/  /     \:\  \   \:\__\                \:\/:/  /        /:/  /        /:/  /        /:/  /        /:/  /     \:\  \   \:\__\
     /:/  /       \:\__\   \/__/                 \::/  /        /:/  /        /:/  /        /:/  /        /:/  /       \:\__\   \/__/
     \/__/         \/__/                          \/__/         \/__/         \/__/         \/__/         \/__/         \/__/
*/


Measured memory_bytes: 51072
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    long long int ans = 0;
    for(int i = 0; i < n; i++){
        long long int val;
        cin >> val;
        ans ^= val;
    }
    if(ans == 0){
        cout << "Yes";
    }else{
        cout << "No";
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		if(s.equals("AAA") || s.equals("BBB")) {
			pl("No");
		}
		else {
			pl("Yes");
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}

}

Measured memory_bytes: 21844
#include <stdio.h>

int main(){
  int i,n=0,m=1;
  char s[100];
  scanf("%s",&s);
  while(s[n]!=0) n++;
  for(i=0;(i<n/2)&&(m!=0);i++){
    if(s[n-i-1]!=s[i]) m=0;
  }
  for(i=0;(i<(n-1)/4)&&(m!=0);i++){
    if(s[(n-1)/2-i-1]!=s[i]) m=0;
  }
  for(i=(n+3)/2-1;(i<(n+1)*3/4)&&(m!=0);i++){
    if(s[n-i-1]!=s[i]) m=0;
  }
  if(m==1){
    printf("Yes");
  }else{
    printf("No");
  }
  return(0);
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define in(v) v; cin >> v;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rrep(i,n) for(long long i=(n);i>=0;--i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

// ========== debug ==========
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif
// ===========================

int main() {
  int X, Y;
  ins(X, Y);

  rep(i, X+1) {
    if (i * 2 + (X-i) * 4 == Y) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";

  return 0;
}


Measured memory_bytes: 3612
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_STR_MAX		100000									// 最大文字列数

// 内部変数
static FILE *szpFpI;											// 入力
static char sc1Str[D_STR_MAX + 5];								// 文字列
static int siSLen;												// 文字列長
static int siCCnt;												// 変換回数

// 改行カット
// 戻り値：文字数
int
fCutCrLf(
	char *pcpStr				// <I> 文字列
)
{
	int i;

	for (i = 0; pcpStr[i] != '\0'; i++) {
		if (pcpStr[i] == '\n') {
			pcpStr[i] = '\0';
			break;
		}
	}

	return i;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpI = fopen(lc1Buf, "r");
#else
	szpFpI = stdin;
#endif

	// 文字列 - 取得
	fgets(sc1Str, sizeof(sc1Str), szpFpI);

	// 文字列長 - 取得
	siSLen = fCutCrLf(sc1Str);

	// 変換回数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siCCnt);

	// 変換
	int liNo = 0;
	while (siCCnt > 0) {
		if (liNo < siSLen - 1) {						// 最終文字の前
			if (sc1Str[liNo] != 'a') {						// 'a'以外
				int liCCnt = 'z' - sc1Str[liNo] + 1;			// 'a'への変換回数
				if (siCCnt >= liCCnt) {							// 'a'への変換可能
					siCCnt -= liCCnt;								// 'a'への変換
					sc1Str[liNo] = 'a';								// 'a'への変換
				}
			}
			liNo++;											// 次の文字へ
		}
		else {											// 最終文字
			sc1Str[liNo] = (sc1Str[liNo] - 'a' + siCCnt % 26) % 26 + 'a';
			siCCnt = 0;
		}
	}

	// 結果 - 表示
	printf("%s\n", sc1Str);

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 384
a0 = int(input())   #500円玉
b0 = int(input())   #100円玉
c0 = int(input())   # 50円玉
x = int(input())   #合計金額

cnt = 0
for a in range(a0 + 1):
    for b in range(b0 + 1):
        for c in range(c0 + 1):
            if 500 * a + 100 * b + 50 * c == x:
                cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(x) cout<<#x<<"="<<x<<endl;
#define endl '\n'
#define M 1000000007
#define int long long
#define INF 1e18
#define max_n 1000000

using namespace std;

void solve()
{
   ll x;
   cin>>x;
   if(x>=30)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
}

int32_t main()
{
	IOS
	ll T = 1;
// 	cin >> T;
	for (ll i = 1; i <= T; ++i)
	{
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3640
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
const int maxn=2e5+111;
char s[maxn];
int l[maxn];
int r[maxn];
int main(){
    int n,k,c;
    scanf("%d%d%d",&n,&k,&c);
    scanf("%s",s+1);
    int pre=-c,tp=0;
    for(int i=1;i<=n&&tp<k;++i){
        if(pre+c<i&&s[i]=='o'){
            l[++tp]=i;
            pre=i;
        }
    }
    tp=0,pre=n+c+1;
    for(int i=n;i>=1&&tp<k;--i){
        if(pre-c>i&&s[i]=='o'){
            ++tp;
            r[k+1-tp]=i;
            pre=i;
        }
    }
    for(int i=1;i<=k;++i){
        if(l[i]==r[i]) printf("%d\n",l[i]);
    }
    return 0;
}

Measured memory_bytes: 3200
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	long long N,tot=0;
	cin>>N;
	for(long long i=1;i<=N;i++)
	{
		if((i%3)!=0 && (i%5)!=0)
		{
			tot=tot+i;
		}
	}
	cout<<tot;
	return 0;
}

Measured memory_bytes: 3192
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <string>
#include <iterator>

#define ll long long

using namespace std;

int main()
{
    ll N, cnt = 0;
    cin >> N;
    for (ll i = 0; i < N; i++) {
        int a;
        cin >> a;
        while (a % 2 == 0) {
            cnt++;
            a /= 2;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256