akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>

#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#include <iomanip>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const int INF = 1e9 + 7;
const ll mod = 998244353;

string S;
ll A,B,ans;

int main() {
	cin >> A >> B;
	if (A >= 13)cout << B << endl;
	else if (A >= 6)cout << B / 2 << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
main()
{
  int N, i, j, v, l;
  
  int A[100];
  scanf("%d",&N); 
  for(i = 0; i < N; i++){
    scanf("%d",&A[i]); 
  }
  for(i = 0; i < N; i++){   
    v = A[i]; 
    j = i - 1;
    while(j >= 0 && A[j] > v){
      A[j + 1] = A[j];
    j--;
    A[j + 1] = v;
    }
    for(l = 0; l < N; l++){
      printf("%d",A[l]);
      if(l != N - 1)
	printf(" ");
    }
  printf("\n");
  }
  return 0;  
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T, class U>T rem(T a, U b) { return a - b*floor(a/b); }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vll W(N);
        rep(i, 0, N) cin >> W[i];

        ll mn = inf;
        rep(i, 1, N) {
                ll s1 = accumulate(W.begin(), W.begin()+i, 0);
                ll s2 = accumulate(W.begin()+i, W.end(), 0);
                ll diff = abs(s1 - s2);
                chmin(mn, diff);
        }

        cout << mn << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 7;
const double pi = acos(-1);
const int mod = 998244353;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;

int main(){
	string s;
	cin >> s;
	if(s[2] == s[3] && s[4] == s[5]) cout <<"Yes\n"; 
	else cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
template<typename T> inline void debug(const vector<T> &xs){
#ifdef DEBUG
	pr(xs);
#endif
}

int main(){
	int N;
	cin >> N;
	vector<ll> A(N);
	for(int i=0; i<N; i++) cin >> A[i];

	int s = 0;
	int ans = 1;
	for(int i=1; i<N; i++){
		if(A[i-1] < A[i]){
			if(s > 0) {
			} else if(s < 0){
				ans++;
				s = 0;
			} else {
				s = 1;
			}
		} else if(A[i] < A[i-1]){
			if(s > 0){
				ans++;
				s = 0;
			} else if(s < 0) {
			} else {
				s = -1;
			}
		}
	}

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(x, y) for(ll x = 0; x < (y); x++)
#define REP(x, z, y) for(ll x = (z); x < (y); x++)
#define all(x) x.begin(), x.end()
#define len(x) (sizeof(x) / sizeof(x[0]))
#define split_str(str, sp_word) istringstream stream(str); string res; FOR(cnt, 0, getline(stream,res,sp_word))
#define scanln(x) fgets(x, sizeof x, stdin)
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define i_str(x) atoi(x.c_str())
#define digit(x) ((ll)log10((double)(x)) + 1)
using namespace std;
const int MOD = 1000000007; 
typedef long long ll;
typedef string str;

int main(){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  printf("%d",max(a * b,c * d));
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define mems(x)     memset(x,0,sizeof(x))
#define all(a)      a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

/*---------------------------------------------------------------------------------------------------*/

void solve()
{
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  while(b<=a)
    {
        if(k==0)
            break;
        b*=2;
        k--;
    }
    while(c<=b)
    {
        if(k==0)
            break;
        c*=2;
        k--;
    }
    if(c>b && b>a)
        cout << "Yes\n";
    else
        cout << "No\n";
  return;
} 

signed main()
{
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  FAST
  int T=1;
  // cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}


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

int main(){
  int n, m;
  int a, b, c;
  int K, S, count = 0;

  cin>>K>>S;
  

  for(int i = 0; i <= K; i++){
    for(int j = 0; j<= K; j++){//cout<<i<<" "<<j<<" "<<S-(i+j)<<endl;
      if(S-(i+j) <= K&& S-(i+j)>=0){
	count++;
      }
    }
  }
  cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 256
# ABC159_C
# def drange(begin, end, step):
#     n = begin
#     while n+step < end:
#      yield n
#      n += step
l=int(input())
ans=(l/3)**3
print(ans)
# ans=03

# for x in range(1,1001):
#     for y in range(1,1001):
#         z=l-x-y
#         if z>0:
#             v=x*y*z
#             ans=max(v,ans)
# print(ans)

# for x in drange(1.0,1001.0,0.1):
#     for y in drange(1.0,1001.0,0.1):
#         z=l-x-y
#         if z>0:
#             v=x*y*z
#             ans=max(v,ans)
# 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 len = Integer.parseInt(sc.nextLine());
		int acCon,tleCon,waCon,reCon;
		acCon = tleCon = waCon = reCon = 0;
		for (int i = 0; i < len; i++) {
			switch(sc.nextLine()) {
			case "AC":
				acCon++;
				break;
			case "TLE":
				tleCon++;
				break;
			case "WA":
				waCon++;
				break;
			case "RE":
				reCon++;
				break;
			}
		}

		System.out.println("AC x " + acCon);
		System.out.println("WA x " + waCon);
		System.out.println("TLE x " + tleCon);
		System.out.println("RE x " + reCon);

	}
}


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

int main(){
    int n;
    cin>>n;
    long sum=0;
    while(n--){
        int a,b;
        cin>>a>>b;
        int maxi=max(a,b);
        int mini=min(a,b);
        sum+=((maxi-mini)+1);
    }
    cout<<sum<<endl;
    return 0;
}


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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;


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

	int n,m;cin>>n>>m;

	priority_queue<int> p;

	for(int i=0; i<n; i++){
		int tmp; cin>>tmp;
		p.push(tmp);
	}

	for(int i=0; i<m; i++){
		int s = p.top();p.pop();

		p.push(s/2);
	}
	ll sum =0;

	while(!p.empty()){
		ll tmp; tmp =p.top();p.pop();

		sum +=tmp;
	}
	writeln(sum);



}




Measured memory_bytes: 892
import java.util.Scanner;

class Main {
    static int minOf(int[] a) {
        int min = a[0];
        for (int i = 1; i < a.length; i++) {
            if (a[i] < min) {
                min = a[i];
            }
        }
        return min;
    }

    static int maxOf(int[] a) {
        int max = a[0];
        for (int i = 1; i < a.length; i++) {
            if (a[i] > max) {
                max = a[i];
            }
        }
        return max;
    }

    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = Integer.parseInt(stdIn.next());
        int[] x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = Integer.parseInt(stdIn.next());
        }

        int xMin = minOf(x);
        int pNum = maxOf(x) - xMin + 1;
        int[] p = new int[pNum];
        int pos = xMin;
        for (int i = 0; i < pNum; i++) {
            for (int j = 0; j < n; j++) {
                p[i] += (x[j] - pos) * (x[j] - pos);
            }
            pos++;
        }

        System.out.println(minOf(p));
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int d,t,s;
  cin >> d >> t >> s;
  if(d<=t*s) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3648
#!/usr/bin/env python3
import sys

YES = "YES"  # type: str
NO = "NO"  # type: str

def solve(N: int, A: "List[int]"):
    p = sorted(A)
    for i in range(0,N-1):
        if (p[i] == p[i+1]):
            print(NO)
            return

    print(YES)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 29632
#include <bits/stdc++.h>
#define LL long long
#define MEM(x,y) memset(x,y,sizeof(x))
using namespace std;
const int maxn = 2e5+7;
LL x[maxn],d[maxn];
LL L;
int n;
LL solve()
{
    LL res=0,ans=0;
    LL tmp=n,dir=1;
    int now=1;
    while (tmp--)
    {
        res+=d[now]*tmp;
        now=now+tmp*dir;
        dir=-dir;
    }
    ans=res;
    LL sum=0;for (int i=1;i<=n;i++) sum+=d[i];
    int cnt=n;
    LL offset=0;for (int i=1;i<=cnt/2;i++) offset+=d[i];
    //printf("%lld\n",res);
    for (int i=1;i<n-1;i++)
    {
        offset-=d[i];
        res=res-sum+2*offset;
        cnt--;
        if (cnt%2==0)
        {
            res+=2*d[i+cnt/2];
            offset+=d[i+cnt/2];
        }
        else res+=d[i+cnt/2+1];
        //printf("%lld\n",res);
        ans=max(ans,res);
    }
    return ans;
}

int main()
{
    scanf("%lld%d",&L,&n);
    x[0]=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%lld",&x[i]);
        d[i]=x[i]-x[i-1];
    }
    n++;d[n]=L-x[n-1];
    LL ans=solve();
    for (int i=1;i<=n/2;i++) swap(d[i],d[n-i+1]);
    ans=max(ans,solve());
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3328
N,L = map(int,input().split())
azi = [L+i-1 for i in range(1,N+1)]
b = sum(azi)
zero_count = 0
for i in range(N):
    if azi[i] == 0:
        print(b)
        zero_count = 1
        break

if zero_count == 0:
    if b<0:
        print(b-azi[N-1])
    else:
        print(b-azi[0])

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>
#include <stack>
#include <bitset>

using namespace std;
typedef long long ll;

#define MAX_N 1000000
#define INF 1000000

#define P (100000000 + 7)

int main() {

  // ---------------------
  // Input
  
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  ll a, b, c;
  cin >> a >> b >> c;

  // ---------------------
  // 
  
  ll x = (4*a*b);
  ll y = (c-a-b);

  if ( y < 0 ) {
    cout << "No" << endl;
    return 0;
  }
  
  y = y*y;
  
  if (x < y) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
  
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  map<int, bool> mp;
  REP(i, 4) {
    int n; cin >> n;
    mp[n] = true;
  }
  cout << (mp[1]&&mp[9]&&mp[7]&&mp[4]? "YES" : "NO") << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int vl = 12801;

int main() {
  int h, w; cin >> h >> w;
  int a[h][w], b[h][w], c[h][w];
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      cin >> a[i][j];
    }
  }
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      cin >> b[i][j];
    }
  }
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      c[i][j] = abs(a[i][j]-b[i][j]);
    }
  }
  bool able[h][w][vl]; fill(able[0][0], able[h][0], false);
  able[0][0][c[0][0]] = true;
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      if (i == h-1 && j == w-1) continue;
      for(int k=0; k<vl; k++) {
        if (able[i][j][k]) {
          //cout << i << " " << j << " " << k << endl;
          if (i < h-1) {
            able[i+1][j][abs(k - c[i+1][j])] = true;
            able[i+1][j][k + c[i+1][j]] = true;
          }
          if (j < w-1) {
            able[i][j+1][abs(k - c[i][j+1])] = true;
            able[i][j+1][k + c[i][j+1]] = true;
          }
        }
      }
    }
  }
  int an = 1e9;
  for(int i=0; i<vl; i++)
    if (able[h-1][w-1][i]) an = min(an, i);
  cout << an << endl;
}

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

int
main (void)
{
	string str;
	cin >> str;
	int a, b, c;
	a = b = c = 0;

	for (int i = 0; i < 3; i++)
	{
		if (str[i] == 'a')
			a++;
		else if (str[i] == 'b')
			b++;
		else
			c++;
	}

	if (a == 1 && b == 1 && c == 1)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 300
ll d[MAX_V][MAX_V];
int V;
void warshall_floyd() {
	rep(k, 0, V) rep(i, 0, V) rep(j, 0, V) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}

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

	cin >> V;
	ll a[V][V];
	rep(i, 0, V) rep(j, 0, V) {
		cin >> d[i][j];
		a[i][j] = d[i][j];
	}

	rep(k, 0, V) rep(i, 0, V) rep(j, 0, V) {
		if(k == i || i == j || j == k || d[i][j] == INF || d[k][j] == INF) continue;
		if(d[i][k] + d[k][j] == a[i][j]) d[i][j] = INF;
		else if(d[i][k] + d[k][j] < a[i][j]) {
			cout << -1 << endl;
			return 0;
		}
	}

	ll res = 0;
	rep(i, 0, V) rep(j, 0, V) if(d[i][j] != INF) res += d[i][j];
	cout << res / 2 << endl;

}


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

a_b = sorted(a_b,key=lambda x: x[0])
hon = 0
ans = 0
for i in range(n):
    if hon + a_b[i][1] >= m:
        ans += a_b[i][0]*(m-hon)
        break
    else:
        ans += a_b[i][0]*a_b[i][1]
    hon += a_b[i][1]
print(ans)

Measured memory_bytes: 29792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  double a,b,n,ans=0;
  cin >>a >>b >>n;
  if(b-1<n)ans=floor(a*(b-1)/b);
  else ans=floor(a*n/b);
  cout << ans <<endl;
}

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

int main()
{
  int K, N;
  cin >> K >> N;
  vector<int> A(N);
  for (auto & a : A)
    cin >> a;
  int max = 0;
  for (int i = 0, _i = N - 1; i < _i; ++i)
  {
    const auto dist = A[i + 1] - A[i];
    if (max < dist)
      max = dist;
  }
  const auto dist = A[0] + K - A[N - 1];
  if (max < dist)
    max = dist;
  cout << K - max;
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int solver(int hisold,int adultP){
    int result;
    result = 0;
    if(13 <= hisold){
        result = adultP;
    }
    else{
        if(6 <= hisold and hisold <= 12){
            result= adultP /2;
        }
    }
    return result;
}

int main(void){
    int answer=0;
    int A,B;
    cin >> A >> B;
    answer = solver(A,B);
    cout << answer << endl;
}

Measured memory_bytes: 256
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <iostream>
#include <vector>
#include <set>
#include <regex>
#include <boost/format.hpp>

using namespace std;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define DEBUG(_debuged) cerr << #_debuged << ":" << _debuged << endl;

struct L
{
    int t;
    int x;
    int y;
};

vector<int> loadn(int n)
{
    vector<int> v(n);
    REP(i, n)
    cin >> v[i];
    return v;
}

uint64_t modpower(const unsigned int N, const unsigned int K, const unsigned int MOD)
{
    uint64_t ret = 1;
    uint64_t k2 = N;
    REP(i, 31)
    {
        if ((K >> i) & 0x1)
        {
            ret *= k2;
            ret = ret % MOD;
        }
        k2 = (k2 * k2) % MOD;
    }
    return ret;
}

class ModCombinationMemo
{
  public:
    const unsigned int N;
    const unsigned int MOD;
    vector<uint64_t> memo = {1};

    ModCombinationMemo(uint32_t N, uint32_t MOD)
        : N(N), MOD(MOD)
    {
    }

    uint64_t c(uint64_t k)
    {
        if (memo.size() > k)
        {
            return memo[k];
        }

        FOR(i, memo.size(), k + 1)
        {
            const auto number = (memo[i - 1] * (N - i + 1)) % MOD;
            const auto reverceDeon = modpower(i, MOD - 2, MOD);
            memo.push_back(number * reverceDeon % MOD);
        }

        return memo[k];
    }
};

uint64_t c(const unsigned int N, const unsigned int K, const unsigned int MOD)
{
    if (K == 0)
    {
        return 1;
    }

    uint64_t n = 1, k = 1;

    REP(i, K)
    {
        n *= N - i;
        k *= i + 1;

        n = n % MOD;
        k = k % MOD;
    }

    uint64_t powerk = modpower(k, MOD - 2, MOD);

    return (n * powerk) % MOD;
}

unsigned trailing_zeros(unsigned n)
{
    if (!n)
        return -1;
    unsigned int c = 32; // c will be the number of zero bits on the right
    n &= -(signed)n;
    if (n)
        c--;
    if (n & 0x0000FFFF)
        c -= 16;
    if (n & 0x00FF00FF)
        c -= 8;
    if (n & 0x0F0F0F0F)
        c -= 4;
    if (n & 0x33333333)
        c -= 2;
    if (n & 0x55555555)
        c -= 1;
    return c;
}

int main(int argc, char *argv[], char *envp[])
{
    int N; cin >> N;
    vector<uint32_t> v(N);
    int ret = 0;
    REP(i, N)
    {
        cin >> v[i];
        ret += trailing_zeros(v[i]);
    }
    cout << ret << endl;
}


Measured memory_bytes: 256
n = gets.to_i
S = gets.split.map(&:to_i).sort!
q = gets.to_i
T = gets.split.map(&:to_i).sort!

ans = 0

T.each do | t |
  S.each do | s |
    if t == s
      ans += 1
      break
    end
  end
end
puts ans



Measured memory_bytes: 7228
nn = gets.to_i
ans = nn
0.upto(nn) do |m|
  x = 0
  n = m
  while n > 0 do
    if n >= 46656 then
      n -= 46656
    elsif n >= 7776 then
      n -= 7776
    elsif n >= 1296 then
      n -= 1296
    elsif n >= 216 then
      n -= 216
    elsif n >= 36 then
      n -= 36
    elsif n >= 6 then
      n -= 6
    elsif n >= 1 then
      n -= 1
    end
    x += 1
  end

  n = nn - m
  while n > 0 do
    if n >= 59049 then
      n -= 59049
    elsif n >= 6561 then
      n -= 6561
    elsif n >= 729 then
      n -= 729
    elsif n >= 81 then
      n -= 81
    elsif n >= 9 then
      n -= 9
    elsif n >= 1 then
      n -= 1
    end
    x += 1
  end
  if ans > x then
    ans = x
  end
end
print("#{ans}\n")


Measured memory_bytes: 1788
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>
#include <tuple>
#include <string.h>
#include <map>
#include <iomanip>
#include <time.h>
using namespace std;
typedef long long ll;

void twin(bool b) {
    cout << (b ? "Yay!" : ":(" ) << endl;
}

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << (a != c) << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

constexpr ll INF=(1ll<<60);
ll ma[125252];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n;
  ll a[125252];
  cin>>n;
  REP(i, n+1){
    cin>>a[i];
  }
  ma[0]=1;
  FOR(i, 1, n+1){
    if(ma[i-1]<a[i-1]){
      cout<<-1<<'\n';
      return 0;
    }
    ll tmp=ma[i-1]-a[i-1];
    CHMIN(tmp, INF/2);
    ma[i]=tmp*2;
  }
  ll ans=0;
  bool ok=true;
  ll cur=0;
  FORR(i, 0, n+1){
    if((cur+1)/2+a[i]>ma[i]){
      cout<<-1<<'\n';
      return 0;
    }
    cur=min(ma[i], cur+a[i]);
    ans+=cur;
  }
  cout<<(ok ? ans : -1)<<'\n';
  return 0;
}


Measured memory_bytes: 5208
#include <iostream>

using namespace std;

int main(void) {
	int r, d;
	long long s;
	cin >> r >> d >> s;
	for (int i = 0; i < 10; i++) {
		s = r * s - d;
		if (s < 0)
			s = 0;
		printf("%d\n", s);
	}
	return 0;
}

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

using namespace std;

vector< int > g[2005];

int distancies[2005];

int d[2005][2005], check[2005];

void dijkstra(int a) //A menor distância de 'a' até todos os outros pontos
{
    queue<int> lista;
    memset(check, 0, sizeof check);
    lista.push(a);

    while(!lista.empty())
    {
        int v = lista.front();
        lista.pop();

        if (check[v] == 1)
            continue;

        check[v] = 1;

        for (int i = 0; i < g[v].size(); i++)
        {
            int u = g[v][i];
            if (d[u][ a ] > d[a][v]+d[v][u])
            {
                d[u][a] = d[v][a]+d[v][u];
                d[a][u] = d[v][a]+d[v][u];
            }

            lista.push(u);
        }
    }

    return;
}

int main()
{
    int n, x, y; cin >> n >> x >> y;

    memset(d, 63, sizeof d);

    //Setando distâncias iniciais

    for (int i = 0; i <= n; i++)
        d[i][i] = 0;

    for (int i = 1; i < n; i++) //Assimilar as distâncias consecutivas
    {
        d[i][i+1] = 1;
        d[i+1][i] = 1;
    }

    d[x][y] = 1;
    d[y][x] = 1;

    //Setando arestas de cada vértice (indo e voltando // undirected)

    for (int i = 1; i < n; i++)
        g[i].push_back(i+1), g[i+1].push_back(i);

    g[x].push_back(y);
    g[y].push_back(y);

    //Qual a menor distância entre todos os pontos (i,j)?

    for (int i = 1; i <= n; i++) //permutar 'A' de 1 a n
        dijkstra(i); //Dijkstra marca a menor distância de 'A' para todos os outros

    for (int i = 1; i <= n; i++) //Para cada par (i, j), vamos saber a sua distância
    {
        for (int j = i+1; j <= n; j++)
        {
            distancies[ d[i][j] ]++;
        }
    }

    for (int i = 1; i < n; i++)
        cout << distancies[i] << endl;

    return 0;
}


Measured memory_bytes: 16128
S = input()
T = input()

dic_S = {}
dic_T = {}
s_S = set(S)
s_T = set(T)
List_S = []
List_T = []

for i in s_S:
    dic_S[i] = []

for j in range(len(S)):
    dic_S[S[j]].append(j)

for k in s_T:
    dic_T[k] = []
    
for l in range(len(T)):
    dic_T[T[l]].append(l)

for i in s_S:
    List_S.append(dic_S[i])

for j in s_T:
    List_T.append(dic_T[j])

List_S.sort()
List_T.sort()

if List_S == List_T:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 20528
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int x,y;
    cin>>x>>y;
    cout<<x+y/2<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        public static void Main(string[] args)
        {
            var s = ReadLine().Replace(",", " ");

            Console.WriteLine(s);
            ReadLine();
        }

        /// <summary>
        /// コンビネーション
        /// </summary>
        /// <param name="n"></param>
        /// <param name="m"></param>
        /// <returns></returns>
        static int nCm(int n, int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * nCm(n - 1, m - 1) / m;
        }

        /// <summary>
        /// stringを一文字ずつintにキャストして配列に変換します。
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static int[] StringCharArrayIntArray(string str)
        {
            List<int> b = new List<int>();
            for (int i = 0; i < str.Length; i++) {
                b.Add( int.Parse(str[i].ToString()));
            }
            return b.ToArray();
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }

        public static int ReadLineInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static string[] ReadLineStringSplit(char a = ' ')
        {
            return ReadLine().Split(a).ToArray();
        }

        public static int[] ReadLineIntSpilit(char a = ' ')
        {
            return ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        }

        static string[] GetAplhaLowerArray() => new string[]{ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
        static string[] GetAplhaUpperArray() => new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+6;
typedef long long ll;
const int mod=1e9+7;
int a,b,c;
int main()
{
    scanf("%d%d%d",&a,&b,&c);
    int ans=min(c,b/a);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024
var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func main() {
	k, n := nextInt(), nextInt()
	a := make([]int, n)

	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}

	longest := k + a[0] - a[n-1]
	for i := 0; i < n-1; i++ {
		longest = max(longest, a[i+1]-a[i])
	}
	fmt.Println(k-longest)
}

Measured memory_bytes: 4864
#include <iostream>

using namespace std;

int main(void) {
    int n;
    cin >> n;
    string s[n];
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }

    bool y = false;
    for (int i = 0; i < n; ++i) {
        if (s[i][0] == 'Y') {
            y = true;
        }
    }

    if (y) {
        cout << "Four" << endl;
    } else {
        cout << "Three" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,ans;
char a[5];
int main(){
	cin>>a;
	if((a[0]=='R'&&a[1]!='R')||(a[1]=='R'&&a[0]!='R'&&a[2]!='R')||(a[2]=='R'&&a[1]!='R')){
		cout<<1;
	}else{
		if(a[0]=='R'&&a[1]=='R'&&a[2]=='R'){
			cout<<3;
		}else{
			if(a[0]!='R'&&a[1]!='R'&&a[2]!='R') cout<<0;
			else cout<<2;
		}
	}
	return 0;
}  

Measured memory_bytes: 3648
a, b, c = map(int, input().split())

flag = 0
ans = 0

if a == b == c and a%2 == 0:
  ans = -1

else:
  while flag == 0:
    if a%2 == 0 and b%2 == 0 and c%2 == 0:
      a_tmp = (b+c)/2
      b_tmp = (a+c)/2
      c_tmp = (a+b)/2
      
      a = a_tmp
      b = b_tmp
      c = c_tmp
      
      ans += 1
      
    else:
      flag = 1

print(ans)

Measured memory_bytes: 38256
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
        int n;
        cin>>n;
        double dp[n+1]={0};
        dp[0] = 1;
        // dp[i] denotes probaility of getting i heads
        for(int i=0;i<n;i++)
        {
            double p_heads;
            cin>>p_heads;
            double p_tails = 1-p_heads;
            for(int j=n;j>=0;j--)
            {
                dp[j] = ((j-1>=0?dp[j-1]:0))*p_heads + dp[j]*p_tails;
            }
        }
        double answer = 0;
        for(int i=1;i<=n;i++)
            if(i > (n-i))
            answer += dp[i];
        cout<<setprecision(10)<<fixed<<answer<<endl;
}


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

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

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  ll ans=0;
  for(int i=1;i<=n;i++){
    int x = calc(i);
    // cout << i << " " << x << endl;
    if (x >= a && x <= b){
      ans += i;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#ifdef DEBUG
#define debug(x) cerr << #x << " " << x << '\n'
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;

int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	int a, b;
 	cin >> a >> b;
 	cout << max(0,a-2*b) << '\n';
	return 0;
}


Measured memory_bytes: 256
from operator import itemgetter
l = list(map(int, input().split()))
N = l[0]
M = l[1]
A = list(map(int, input().split()))
B = []
for i in range(M):
    b = list(map(int, input().split()))
    B.append(b)
A = sorted(A)
B = sorted(B, key=lambda x: x[1])
m = 0
s = 0
for i in range(M):
    i = M-1-i
    if B[i][0]+m <= N-1:

        if A[B[i][0]+m] <= B[i][1]:
            m = m+B[i][0]
            s += B[i][1]*B[i][0]
        else:
            if A[m] <= B[i][1]:
                for l in range(m, N):
                    if A[l] >= B[i][1]:
                        s += B[i][1]*(l-m)
                        m = l
                        break
            else:
                break
    else:
        if A[N-1] <= B[i][1]:
            s = s+B[i][1]*(N-m)
            m = N
            break
        else:
            if A[m] <= B[i][1]:
                for l in range(m, N):
                    if A[l] >= B[i][1]:
                        s += B[i][1]*(l-m)
                        m = l
                        break
            else:
                break
if m < N:
    for i in range(m, N):
        s += A[i]
print(s)


Measured memory_bytes: 82968
/* HARDWORK IS THE KEY TO SUCCESS.
   RATING IS TEMPORARY , KNOWLEDGE IS PERMANENT.!!!*/
 
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define T ll t = 1; cin>>t; while(t--)
#define ain ll n,k,i; cin>>n; ll a[n]; for(i=0; i<n; i++) cin>>a[i]
#define matin ll m,n; cin >> n >> m; ll a[n + 1][m + 1]; for(ll i=1;i<=n;i++) for(ll j=1;j<=m;j++) cin>>a[i][j];
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define I insert
#define pb push_back
 
const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;
inline ll add(ll a, ll b) { return (mod + a + b) % mod;}
inline ll sub(ll a, ll b) {return (a - b + mod) % mod;}
inline ll mul(ll a, ll b) {return (1ll * a * b) % mod;}
ll fastpow(ll x, ll y) {
    ll res = 1; x = x % mod; while (y > 0) { if(y & 1) res = (res * x) % mod; y = y >> 1;x = (x * x) % mod;}return res;}
ll inv(ll x) {
    return fastpow(x, mod - 2);
}
 
 
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll a,b;
    cin >> a >> b;
    ll c = a * b;
    cout << c;
 
 
}

Measured memory_bytes: 3640
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      String s = sc.nextLine();
      char[] c =new char[3];
      
        for(int i = 0;i<3;i++){
          c[i] = s.charAt(i);
        }

        if(c[0]==c[1]||c[1]==c[2]||c[2]==c[0]){
          System.out.println("No");
        }else{
          System.out.println("Yes");
        }

  }
}


Measured memory_bytes: 21844
def modinv(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return lastx % (10**9+7)

MOD=10**9+7
am=[2]
for i in range(60):
    am.append((am[-1]**2)%MOD)

fr=[1]
for i in range(1,2*(10**5)+10):
    fr.append((fr[-1]*i)%MOD)

n,a,b=map(int,input().split())
a=min(a,n-a)
b=min(b,n-b)
s=bin(n)[2::][::-1]

ans=1
for i in range(len(s)):
    if s[i]=="1":
        ans*=am[i]
        ans%=MOD

for x in [a,b]:
    tmp=1
    for i in range(n-x+1,n+1):
        tmp=(tmp*i)%MOD
    tmp*=modinv(fr[x],MOD)
    ans=(ans-tmp)%MOD

ans=(ans-1)%MOD
print(ans)

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

int main()
{
	int a, b;
	cin >> a >> b;
	if (a <= b) {
		for (int i = 0; i < b; i++) {
			cout << a;
		}
		cout << endl;
	}
	else
	{
		for (int i = 0; i < a; i++) {
			cout << b;
		}
		cout << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define in2(x, y) int x,y;cin>>x>>y
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)
#define reppp(j, i, n) for (int j=i+1; j<n; j++)

#define lim5 100002
#define lim9 1000000002

#define deg(rad) (((rad)/2/M_PI)*360)
#define pow(x) (x)*(x)

int main() {
	string s, a[10] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
	cin >> s;

	rep(i, 7) {
		if (s == a[i]) {
			out(7 - i);
			return 0;
		}
	}

	return 0;
}


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

using namespace std;

int main() {
  string S;
  string first_2;
  string last_2;
  
  cin >> S;
  first_2 = S.substr(0, 2);
  last_2 = S.substr(2);
  
  int f2 = stoi(first_2);
  int l2 = stoi(last_2);
  
  if ((1 <= f2 && f2 <= 12) && ((1 <= l2 && l2 <= 12))) {
    cout << "AMBIGUOUS" << endl;
  } else if (1 <= f2 && f2 <= 12) {
    cout << "MMYY" << endl;
  } else if (1 <= l2 && l2 <= 12) {
    cout << "YYMM" << endl;
  } else {
    cout << "NA" << endl;
  }
}

Measured memory_bytes: 256
N,X = map(int,input().split())
l = list(map(int,input().split()))
#print(l)
d = preD = 0
i = 0
for i in range(N):
    d = preD + l[i]
    preD = d
    #print(i+1,d)
    if d == X:
        print(i+2)
        break
    elif d > X:
        print(i+1)
        break
else:
    print(N+1)

Measured memory_bytes: 3064
'use strict';

const lines = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("");
let answer = "Yes";

for (let i = 0; i < lines.length; i++) {
  let count = 0;
  //同じ文字を数える
  lines.forEach(letter => {
    if (lines[i] === letter)
    count++;
  });
  //数えた数が奇数ならNoを返して抜ける
  if (count % 2 === 1) {
    answer = "No";
    break;
  }
}
console.log(answer);



Measured memory_bytes: 22212
#include<stdio.h>

int main(){
  int a,i,j,n,k,u,v[100][100];

  scanf("%d",&n);

  for(i=0;i<n;i++)for(j=0;j<n;j++)v[i][j]=0;
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&a);
      a--;
      v[u][a]=1;
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
 if(j)printf(" ");
      printf("%d",v[i][j]);
     
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2052
import numpy as np

[N, M, C] = list(map(int, input().split(' ')))
B_list = list(map(int, input().split(' ')))
A_mat = [list(map(int, input().split(' '))) for _ in range(N)]

corrected = 0
for i in range(N):
    value = np.dot(B_list, A_mat[i]) + C
    if value > 0:
        corrected = corrected + 1

print(corrected)


Measured memory_bytes: 21664
#include "bits/stdc++.h"
using namespace std;
 
int main()
{
  int a, b;
  cin >> a >> b;
  int ans = (a + b);
  if (ans % 2 == 0)
    cout << (a + b) / 2 << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 256
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#else
#define VS_ENDPAUSE()
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
	func();
	VS_ENDPAUSE();
	return 0;
}


void func(void)
{
	int n;
	cin >> n;
	vector< int > a(n);
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	sort(a.begin(), a.end());

	const int rate[8+1] = {400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 10000};
	int hist[8+1] = {0};
	for(int i=0; i<n; i++){
		for(int j=0; j<9; j++){
			if(a[i]<rate[j]){
				hist[j]++;
				break;
			}
		}
	}
	int minVal = 0;
	for(int i=0; i<8; i++){
		if(hist[i]>0){
			minVal++;
		}
	}
	int maxVal;
	if(minVal==0 && hist[8]>0){
		minVal = 1;
		maxVal = hist[8];
	} else {
		maxVal = minVal + hist[8];
	}

	cout << minVal << " " << maxVal << endl;

	return;
}




Measured memory_bytes: 256
s = list(input())
K = int(input())

alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

for i in range(len(s)):
    if K <=0 :
        break
    if (26 - alphabet.index(s[i])) <= K and s[i] != "a":
        
        K -= (26 - alphabet.index(s[i]))
        s[i] = "a"
#         print(K)

if K > 0:
    if K%26 + alphabet.index(s[-1]) > 25:
        s[-1] = alphabet[(K%26 - alphabet.index(s[-1]))]
    else:
        s[-1] = alphabet[(K%26+alphabet.index(s[-1]))]
print("".join(s))

Measured memory_bytes: 4156
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

n=int(input())
a=int(input())
n%=500
if n<=a:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3808
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <list>
#include <fstream>
#include <iomanip>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <bitset>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int

#include <nmmintrin.h>
#ifdef _MSC_VER

#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}



int main() {
	itn n;
	cin >> n;
	int ans = 0;
	REP(i, n) {
		int a;
		scanf("%d", &a);
		while (a%2 == 0) {
			ans++;
			a /= 2;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
def error_check(n,l):
	total = 0
	if n % 2 == 0:
		i = 1
		for k in range(n//2):
			total += (i+i)
			i += 2
		if total == sum(l):
			return True
		else:
			return False
	else:
		i = 2
		for k in range(n//2):
			total += (i+i)
			i += 2
		if total == sum(l):
			return True
		else:
			return False

n = int(input())
a = list(map(int,input().split()))
m = n // 2
if error_check(n,a):
	print((2 ** m) % (10**9+7))
else:
	print(0)


Measured memory_bytes: 14008
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  int n;
  cin >> n;
  vector<double > v(n);
  REP(i,n)cin >> v[i];
  sort(all(v));
  // REP(i,n) cout << v[i] << endl;
  double ans = 0;
  if(n == 2){
    ans = (v[0] + v[1])/2;
  }else{
    ans = (v[0] + v[1])/pow(2,n - 1);
    for(int i = 2; i < n; i ++){
      ans += v[i]/pow(2, n - i);
    }
  }
  cout<<setprecision(10) << ans << endl;

}


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

/*
・グラフ
  > Dijkstra
  > BellmanFord
  > WarshallFloyd
  > Kruskal
[応用] 単一終点最短路問題は, すべての有向辺を逆向きに張り替えると, 単一始点最短路問題に帰着できる.
[使用例]
Graph<int> g(N);              // 頂点数N, 重さの型がintのグラフを宣言
add_edge(g,a,b,c);            // グラフgに, aからbへの重さcの無向辺を追加
add_arc(g,a,b,c);             // グラフgに, aからbへの重さcの有向辺を追加
add_to_edges(edges,a,b,c);    // 辺集合edgesに, 始点a, 終点b, 重さcの辺を追加
*/

template<typename T> struct Edge {
  int from, to;
  T weight;
  Edge() : from(0), to(0), weight(0) {}
  Edge(int f, int t, T w) : from(f), to(t), weight(w) {}
};
template<typename T> using Edges = vector< Edge< T > >;
template<typename T> using Graph = vector< Edges< T > >;
template<typename T> void     add_edge(Graph< T > &g, int from, int to, T w = 1) { g[from].emplace_back(from,to,w); g[to].emplace_back(to,from,w); }
template<typename T> void      add_arc(Graph< T > &g, int from, int to, T w = 1) { g[from].emplace_back(from,to,w); }
template<typename T> void add_to_edges(Edges< T > &e, int from, int to, T w = 1) { e.emplace_back(from,to,w); }

/*
・ワーシャルフロイド法
  > O(V^3) [V:頂点数] (WarshallFloyd())
  > O(V^2) : 辺の追加 (add_edge_to_matrix())
[備考] 全点間最短路を求めるアルゴリズム
      負閉路が存在しているかの検出も可能
        -> ある頂点vからv自身への最短路が負なが負閉路が存在
[注意] 結果を足し合わせる際, INFの大きさに注意
[使用例]
auto wf = WarshallFloyd(g);      // グラフgにおける全点間最短路
add_edge_to_matrix(wf,a,b,c);    // 隣接行列wfに, 始点a, 終点b, 重さcの辺を追加して, wfを更新
*/

template<typename T> using Matrix = vector< vector< T > >;
template<typename T> Matrix< T > WarshallFloyd(Graph< T > &g) {
  const auto INF = numeric_limits< T >::max()/10;
  int vertex = g.size();
  Matrix< T > dist(vertex, vector< T >(vertex, INF));
  for (int i = 0; i < vertex; ++i) dist[i][i] = 0;
  for (int i = 0; i < vertex; ++i) {
    for (auto &e : g[i]) {
      dist[e.from][e.to] = min(dist[e.from][e.to], e.weight);
    }
  }
  for (int k = 0; k < vertex; ++k) {
    for (int i = 0; i < vertex; ++i) {
      for (int j = 0; j < vertex; ++j) {
        if (dist[i][k] != INF && dist[k][j] != INF) {
          dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
        }
      }
    }
  }
  return dist;
}
template<typename T> void add_edge_to_matrix(Matrix< T > &mat, int from, int to, T weight = 1) {
  const auto INF = numeric_limits< T >::max()/10;
  mat[from][to] = mat[to][from] = min(mat[from][to], weight);
  int vertex = mat.size();
  for (int k : {from, to}) {
    for (int i = 0; i < vertex; ++i) {
      for (int j = 0; j < vertex; ++j) {
        if (mat[i][k] != INF && mat[k][j] != INF) {
          mat[i][j] = min(mat[i][j], mat[i][k] + mat[k][j]);
        }
      }
    }
  }
}

int N, M, res;
vector<tuple<int,int,int>> edges;

signed main() {

  cin >> N >> M;

  Graph<ll> g(N);

  for (int i = 0; i < M; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    --a, --b;
    edges.push_back(make_tuple(a, b, c));
    add_edge(g, a, b, c);
  }

  auto wf = WarshallFloyd(g);
  for (auto&& t : edges) {
    int a, b, c; tie(a, b, c) = t;
    if (wf[a][b] < c) ++res;
  }

  cout << res << endl;

}


Measured memory_bytes: 384