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

using namespace std;

const int N = 305;
const int mod = 1000000007;
using Dp = array<array<int, N>, 2 * N>;

void add(int &x, int y) {
	x += y;
	if (x >= mod) x -= mod;	
}

int mul(int x, int y) {
	return (long long) x * y % mod;
}

int pw(int x, int y) {
	int ans = 1;
	for (; y > 0; y >>= 1, x = mul(x, x)) {
		if (y & 1) ans = mul(ans, x);
	}		
	return ans;
}

int deg[N];
int fact[N];
int ifact[N];

void precalc() {
	fact[0] = 1;
	for (int i = 1; i < N; ++i) {
		fact[i] = mul(fact[i - 1], i);
	}
	ifact[N - 1] = pw(fact[N - 1], mod - 2);
	for (int i = N - 1; i > 0; --i) {
		ifact[i - 1] = mul(ifact[i], i);
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	precalc();
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> deg[i];
	}
	Dp f{};
	f[0][0] = 1;
	int sumDeg = 0;
	for (int i = 1; i <= n; ++i) {
		Dp nf{};
		for (int nv = 0; nv <= i - 1; ++nv) {
			for (int sd = 0; sd <= sumDeg; ++sd) {
				add(nf[nv][sd], mul(f[nv][sd], ifact[deg[i] - 1]));
				if (deg[i] > 1) {
					add(nf[nv + 1][sd + deg[i] - 2], mul(f[nv][sd], ifact[deg[i] - 2]));
				}
			}
		}
		f = nf;
		sumDeg += max(0, deg[i] - 2);
	}
	int ans = 0;
	for (int nv = 3; nv < n; ++nv) {
		for (int sd = 1; sd <= sumDeg; ++sd) {
			int coef = mul(fact[n - nv - 1], fact[sd]);
			coef = mul(coef, ifact[sd - 1]);
			coef = mul(coef, fact[nv - 1]);
			add(ans, mul(coef, f[nv][sd]));
		}
	}
	bool flag = true;
	for (int i = 1; i <= n; ++i) {
		if (deg[i] != 2) {
			flag = false;
			break;
		}
	}
	if (flag) {
		add(ans, fact[n - 1]);
	}
	cout << mul(ans, (mod + 1) / 2) << "\n";
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define int long long

int n,m,L,R,s[200009],t[200009];
int a[200009],x[200009];
int query[200009];

bool ch1(int mid){
  int A=a[mid];
  r(i,m){
    if(query[i]==1 && A>=x[i]) A=(A+s[i])*t[i];
    if(query[i]==2 && A<=x[i]) A=(A-s[i])/t[i];
  }
  return R<A;
}

bool ch2(int mid){
  int A=a[mid];
  r(i,m){
    if(query[i]==1 && A>=x[i]) A=(A+s[i])*t[i];
    if(query[i]==2 && A<=x[i]) A=(A-s[i])/t[i];
  }
  return L<=A;
}

void ch3(int mid){
  int A=a[mid];
  r(i,m){
    if(query[i]==1 && A>=x[i]) A=(A+s[i])*t[i];
    if(query[i]==2 && A<=x[i]) A=(A-s[i])/t[i];
  }
  cout<<A<<endl;
}

signed main(){
  cin>>n>>m>>L>>R;
  r(i,n)cin>>a[i];
  r(i,m){
    cin>>query[i]>>x[i]>>s[i]>>t[i];
  }
  //cout<<endl;
  sort(a,a+n);

  //r(i,n)ch3(i);

  int l=-1,r=n;
  while(r-l>1){
    int mid=(r+l)/2;
    if(ch1(mid))r=mid;
    else l=mid;
  }

  int l2=-1,r2=n;
  while(r2-l2>1){
    int mid=(r2+l2)/2;
    //cout<<r2<<l2<<mid<<endl;
    if(ch2(mid))r2=mid;
    else l2=mid;
    //cout<<r2<<l2<<mid<<endl;
  }
  //cout<<r<<' '<<r2<<endl;

  cout<<r-r2<<endl;
}



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

int main() {
	int n;
	stack<int> trains;
	while(cin >> n){
		if(n == 0){
			cout << trains.top() << endl;
			trains.pop();
		}
		else{
			trains.push(n);
		}
	}
	return 0;
}

Measured memory_bytes: 1196
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define loop(i,x,n) for(ll i = x;i<n;i++)
#define loopr(i,x,n) for(ll i = n-1;i>=x;i--)
#define S(v) sort(v.begin(), v.end());
#define ff first
#define ss second
map<ll,bool> empty;


int main()
{		
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll t = 1;
	// cin>>t;
	while(t--){
		ll n, x, T;
		cin>>n>>x>>T;

		cout<<(n%x == 0? (n/x)*T : (((n/x)+1))*T);
	}
}
/*

1 5 4 1 2 2 4

*/




Measured memory_bytes: 3644
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
	int s,m,h;
	cin>>s;
	h=s/3600;
	m=s%3600/60;
	s=s%3600%60;
	cout<<h<<":"<<m<<":"<<s<<endl;
	return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int cnt=0;int N,X;cin>>N>>X;int m[N]={0};for(int i=0;i<N;i++){cin>>m[i];X-=m[i];cnt++;}
  sort(m,m+N);while(1){X-=m[0];if(X>=0)cnt++;else break;}
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef long long int ll;
void swap(ll *x,ll *y){ll temp;temp=*x;*x=*y;*y=temp;}
ll asc(const void *a,const void *b){return *(ll*)a-*(ll*)b;}
ll desc(const void *a,const void *b){return *(ll*)b-*(ll*)a;}
ll max(ll x,ll y){return x>y?x:y;}
ll min(ll x,ll y){return x>y?y:x;}

int main(){
    int n,m,x,a[200];
    int map[200]={};

    scanf("%d %d %d",&n,&m,&x);
    for(int i=0;i<m;i++){
        scanf("%d",&a[i]);
        map[a[i]-1]++;
    }

    int costl,costr;
    costl=costr=0;
    for(int i=0;i<x-1;i++){
        if(map[i]){
            costl++;
        }
    }
    for(int i=n-1;i>x-1;i--){
        if(map[i]){
            costr++;
        }
    }
    
    if(costl<costr){
        printf("%d\n",costl);
    }else{
        printf("%d\n",costr);
    }
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

int main(void){
  int x;
  scanf("%d",&x);
  if(x>29) printf("Yes");
  else printf("No");
  return 0;
}


Measured memory_bytes: 1728
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
  ll ans = 0;
  ll x;
  cin >> x;
  string s = to_string(x);
  ll n;
  n = s.size() - 1;
  vector<ll> t(n+1);
  rep(i,n+1){
    t[n-i] = x % 10;
    x = x / 10;
  }
  
  for (ll bit = 0; bit < (1<<n); ++bit){
    ll sum = t[0];
    for(ll i = 0; i < n; i++){
     if(bit & (1<<i)){
       ans = ans + sum;
       sum = 0;
       sum = t[i+1];
       
     }
     else{
       
       sum = 10 * sum + t[i+1]; 
     }
    }
    
    ans = ans + sum;
       
        

    }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3676
N,M=map(int,input().split())

def dfs(num,visited):
    #print(visited)
    if num in visited and visited[-1]!=num:
        tree[num][visited[-1]]=-1
        tree[visited[-1]][num]=-1
        while visited[-1]!=num:
            temp=visited.pop(-1)
            #print(temp)
            tree[temp][visited[-1]]=-1
            tree[visited[-1]][temp]=-1
            start.append(temp)
            
    else:
        for index,item in enumerate(tree[num]):
            if item == 1:
                tree[num][index]=0
                tree[index][num]=0
                dfs(index,visited+[num])
    return 0

tree=[[0]*N for i in range(N)]

for _ in range(M):
    a,b=map(int,input().split())
    tree[a-1][b-1]=1
    tree[b-1][a-1]=1

start=[0]

while start:
    #print(start[-1]+1)
    dfs(start.pop(-1),[])

cnt=0
for leaf in tree:
    cnt+=leaf.count(-1)

print(M-cnt//2)



Measured memory_bytes: 3064
import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
	static int mod = (int)1e9+7;
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	public static void main(String sp[])throws IOException{
		FastReader sc = new FastReader();
		String st = sc.next();
		if(st.equals("Sunny"))
			System.out.println("Cloudy");
		else if(st.equals("Cloudy"))
			System.out.println("Rainy");
		else System.out.println("Sunny");

	}
	
	public static class pair{
		int pos;
		int bomb;
	}
	
	
	public static int partition(int [] arr, int s, int e){
		
		int index=s;
		int pivot = arr[e];
		for(int i=s;i<=e-1;i++){
			if(arr[i]<=pivot){
				arr = swap(arr, index, i);
				index++;
			}
		}
		swap(arr,index,e);
		print(arr);
		return index;
	}
	
	public static int[] swap(int[] arr, int low, int high){
		int temp = arr[low];
		arr[low]=arr[high];
		arr[high]=temp;
		return arr;
	}
	
	
	public static long gcd(long a, long b){
		if(a==0)
			return b;
		
		return gcd(b%a,a);
	}
	
	public static void print(int[] arr){
		for(int i=0;i<arr.length;i++)
			System.out.print(arr[i]+" ");
		System.out.println();
	}
	

	public static class comp implements Comparator<pair>{
		public int compare(pair o1, pair o2){
			return o1.bomb-o2.bomb;
		}
	}
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
}

Measured memory_bytes: 19156
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
import collections
N = int(input())
d = [int(input()) for _ in range(N)]
c = collections.Counter(d)
print(len(c))


Measured memory_bytes: 3316
#include <iostream>

using namespace std;
struct card {char suit, value;};

bool stable_or(struct card c1[],struct card c2[],int n){
    for(int i = 0;i < n;i++){
        if(c1[i].suit != c2[i].suit){
            return false;
        }
    }
    return true;
}

void bubble_sort(int n,card c[]){
    int i,j;

    for(i = 0;i < n;i++){
        for(j = n - 1;j >= i + 1;j--){
            if(c[j].value < c[j - 1].value){
                card box = c[j];
                c[j] = c[j - 1];
                c[j - 1] = box;
            }
        }
    }

    for(i = 0;i < n;i++){
        if(i > 0){
            cout << ' ';
        }
        cout << c[i].suit << c[i].value;
    }
    cout << endl << "Stable" << endl;
    
}

void select_sort(int n,card c[]){
    int i,j,minj;

    for(i = 0;i < n;i++){
        minj = i;
        for(j = i;j < n;j++){
            if(c[j].value < c[minj].value){
                minj = j;
            }
        }
        card box = c[i];
        c[i] = c[minj];
        c[minj] = box;
    }

     for(i = 0;i < n;i++){
        if(i > 0){
            cout << ' ';
        }
        cout << c[i].suit << c[i].value;
    }
    cout << endl;
    
}

int main() {
    int n,i;
    card c1[100],c2[100];
    char ch;

    cin >> n;

    for(i = 0;i < n;i++){
        cin >> c1[i].suit >> c1[i].value;
        c2[i] = c1[i];
    }
      
    bubble_sort(n,c1);
    select_sort(n,c2);

    if(stable_or(c1,c2,n)){
        cout << "Stable" << endl;
    }
    else {
        cout << "Not stable" << endl;
    }
    
    return 0;
}

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

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

    int n;
    cin >> n;

    int bef, ans = 0;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        if(i > 0){
            if(bef < a){
                ans++;
            }
        }
        bef = a;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,s,f) for(i=s;i<f;i++)
#define print(v) for(auto &z:v) cout<<z<<' ';cout<<'\n'
#define hi cout<<'h'<<'i'<<'\n' 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define B begin()
#define E end()
#define sz(v) (int)((v).size())
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define clk1 clock_t start_time=clock()
#define clk2 cout<<(clock()-start_time)/(double)CLOCKS_PER_SEC
#define clean(arr) memset(arr,0,sizeof(arr))
#define mod 1000000007
#define mod2 998244353
#define space 100005
//<<fixed << setprecision(9)

int main()
{
    int n,i,j,t;
    boost;

    cin>>n;
    int arr[n];
    rep(i,0,n)
    {
        cin>>arr[i];
    }
    int mn=1e9,sum;
    rep(i,1,101)
    {
        sum=0;
        rep(j,0,n)sum+=(i-arr[j])*(i-arr[j]);
        mn=min(mn,sum);
    }
    cout<<mn;

    return 0;
}



Measured memory_bytes: 256
import math
x=int(input())

stop=False
for i in range(int(math.pow(10**9,1/5))+1):
    for j in range(int(math.pow(10**9,1/5))+1):
        if i**5-(-j)**5==x:
            print(i,-j)
            stop=True
            break
    if stop:
        break
else:
    stop=False
    range_num=int(math.pow(10**9+(math.pow(2,1/4)*10**2)**5,1/5))
    for i in range(int(math.pow(10**9,1/4))+1):
        for j in range(i,range_num+1):
            if j**5-i**5==x:
                print(j,i)
                stop=True
                break
        if stop:
            break

Measured memory_bytes: 9308
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main() {
    cin.tie(0)->sync_with_stdio(false);

	int N; cin >> N;
	vector<int> C(N, 0), S(N, 0), F(N, 0);
	REP(i, N - 1) cin >> C[i] >> S[i] >> F[i];

	REP(i, N - 1) {
		int res = S[i] + C[i];
		for (int j = i + 1; j < N - 1; j++) {
			if (res < S[j])
				res = S[j];
			else if (res % F[j])
				res += F[j] - (res % F[j]);
			res += C[j];
		}
		cout << res << '\n';
	}
	cout << 0 << '\n';
    return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
//#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long int
#define mkp make_pair
#define maxN 100005
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,a,b) for(int i=a;i<b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define  vi vector<int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in cin>>
#define out cout<<
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
void printArray(int arr[],int n)
{
   for(int i=0;i<n;i++)cout<<arr[i]<<' ';
}
void printMp(mp m)
{
  mp ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printUmp(ump m)
{
  ump ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printSt(st s)
{
  st ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printMst(mst s)
{
  mst ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printVec(vector<int>v)
{
for(int i=0;i<v.size();i++)cout<<v[i]<<' ';
}
void printVec2(vector<int>v[],int n)
{
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<v[i].size();j++)
            cout<<v[i][j]<<' ';
        cout<<endl;
    }
}
 set<pair<int,int>> primeset;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
        for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          primeset.insert(mkp(p,1));
}
int32_t main()
{
fastio;
int n;in n;
double arr[n];
rep(i,n)
    in arr[i];
sort(arr,arr+n);
double sum=(arr[0]+arr[1])/2.0;
repl(i,2,n)
    {
        sum+=arr[i];
        sum/=2.0;
    }
    out sum;
 return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;  // or pb_ds;

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#ifndef DEBUG
#define endl "\n"
#endif
#define fff ff
#define sss ss.ff
#define ttt ss.ss
#define INF (1 << 30)
#define LLF (1ll << 60)
#define PRIME (1000000007)
#define FASTIO std::ios::sync_with_stdio(false)
#ifdef DEBUG
#define debug(x) cerr << #x << " = " << x << endl
#else
#define debug(x)
#endif
#define rep(i, begin, end)                            \
  for (__typeof(end) i = (begin) - ((begin) > (end)); \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define FILE_INPUT                  \
  freopen("input.txt", "r", stdin); \
  freopen("output.txt", "w", stdout)

#define all(x) x.begin(), x.end()

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<string> vs;

template <typename T, typename B = null_type>
using oset =
    tree<T, B, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order / order_of_key

const ld eps = 1e-12;

/*-----------------END TEMPLATE-----------------*/

vi vals;
vi valsR;

int(((((((((((((((main)))))))))))))))() {
  FASTIO;
  ll a, b;
  cin >> a >> b;
  if (a > 8 || b > 8) {
    cout << ":(" << endl;
  } else {
    cout << "Yay!" << endl;
  }
}

/*

0 1 2 3 4
      x

*/

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
	int s;
	cin >> s;
	int h, m;
	m = s/60;
	h = m/60;
	s %= 60;
	m %= 60;
	cout << h << ':' << m << ':' << s << endl;
	return 0;
}


Measured memory_bytes: 3132
#include <string>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string.h>
#include <utility>
#include <queue>
#include <stack>
#include <iomanip>
#include <ctype.h>
#include <map>
#include <set>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <sstream>
#include <math.h>
#include <time.h>
#include <iostream>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <tuple>
#include <cmath>
#include <stdio.h>      /* printf, fgets */
#include <stdlib.h>
#include <fstream>

using namespace std;

typedef long long LL;

#define FOR(i,n) for(int i = 0;i < n;i++)
#define MP make_pair
#define PB push_back
#define ALL(a) (a).begin(),(a).end()
#define PII pair<int, int>
#define PLL pair<long long, long long>
#define CLEAR(a) memset(a, 0, sizeof(a))
#define ERASE(a) memset(a, -1, sizeof(a))
#define INF 2000000007LL
#define y1 uu1
#define y2 uu2
const double EPS = 1E-12;
const double PI = acos(-1.0);

using namespace std;

const LL mod = 998244353;

int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  if (s == "SAT") cout << 1 << endl;
  if (s == "MON") cout << 6 << endl;
  if (s == "TUE") cout << 5 << endl;
  if (s == "WED") cout << 4 << endl;
  if (s == "THU") cout << 3 << endl;
  if (s == "FRI") cout << 2 << endl;
  if (s == "SUN") cout << 7 << endl;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
i1 = list(map(int, input().split()))
i2 = list(map(int, input().split()))
cnt = 0
for i in range(N):
    if sum(i1[:i+1])+sum(i2[i:]) > cnt:
        cnt = sum(i1[:i+1])+sum(i2[i:])
print(cnt)

Measured memory_bytes: 3060
#include <stdio.h>
int main(void){
    int n,k,d,a,ans=0;
    scanf("%d %d",&n,&k);
    int x[n];
    for(int i=0; i<n; i++)
        x[i]=0;
    for(int i=0; i<n; i++){
        scanf("%d",&d);
        for(int j=0; j<d; j++){
            scanf("%d",&a);
            x[a-1]=1;
        }
    }
    for(int i=0; i<n; i++){
        if(x[i]==0)
            ans++;
    }
    printf("%d",ans);
}


Measured memory_bytes: 1736
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);
	public void run() {
		
			long q = sc.nextLong();
			calc(q);
			
		
	}
	public void calc(long q){
		long sum = 0;
		for(long i = 0; i < q; i++){
			long p = sc.nextLong();
			String c = sc.next();
			long n = sc.nextLong();
			
			int t = 0;
			if(c.equals("(")) t = 1;
			if(c.equals(")")) t = -1;
			
			sum += t * n;
			if(sum == 0) System.out.println("Yes");
			else System.out.println("No");
		}
		
	}
	public void calc2(int q){
		int sum = 0;
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i = 0; i < q; i++){
			int p = sc.nextInt();
			String c = sc.next();
			int n = sc.nextInt();


			if(c.equals("(")){
				if(list.size() == 0) list.add(n);
				else if(list.get(0) > 0) list.add(n);
				else{
					while(n > 0){
						if(list.size() == 0) {
							list.add(n);
							n = 0;
						}
						else if(list.get(0) * -1 <= n){
							n = n + list.get(0);
							list.remove(0);
						}
						else{
							list.add(list.get(0) + n);
							list.remove(0);
							n = 0;
						}
					}
				}
			}
			if(c.equals(")")) {
				if(list.size() == 0) list.add(n * -1);
				else if(list.get(0) < 0) list.add(n * -1);
				else{
					n = n * -1;
					while(n < 0){
						if(list.size() == 0){ 
							list.add(n);
							n = 0;
						}
						else if(list.get(0) <= n * -1){
							n = n + list.get(0);
							list.remove(0);
						}
						else {
							list.add(list.get(0) + n);
							list.remove(0);
							n = 0;
						}
					}
				}
			}
					
			if(list.size() == 0) System.out.println("Yes");
			else System.out.println("No");
		}
	}

	
	public static void main(String[] args) {
		
		new Main().run();
	}
}

Measured memory_bytes: 46556
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int ans = N * N * N;
		System.out.println(ans);
	}

}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 21332
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

static const double PI = 3.14159265358979;
static const ll MOD = 1e9 + 7;
static const ll INF = (ll)1 << 62;

int main() {
	ll n; cin >> n;
	double T, A; cin >> T >> A;
	double h[1001];
	rep(i, 0, n)cin >> h[i];

	double t = 1e10;

	ll p = 0;
	rep(i, 0, n) {
		if (t > abs(T - h[i] * 0.006 - A)) {
			t = abs(T - h[i] * 0.006 - A);
			p = i + 1;
		}
	}

	cout << p << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e9+7;

signed main(){
    int N; cin >> N;
    vector<int> a(N);
    for(int i = 0; i < N; i++) cin >> a[i];
    int ans = 0;
    for(int digit = 0; digit <= 60; digit++){
        int c0 = 0, c1 = 0;
        for(int i = 0; i < N; i++){
            if(1 & (a[i] >> digit)) c1++;
            else c0++;
        }
        int tmp = (1ll << digit) % MOD;
        int c = c0 * c1 %MOD;
        tmp = tmp * c % MOD;
        ans += tmp;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include<stdio.h>
int main(void)
{
  int a,b;
  scanf("%d\n",&a);
  scanf("%d\n",&b);

  if(-1000 <= a && b <= 1000)
  {
    if(a<b)
      printf("a < b\n");
    else if(a>b)
      printf("a > b\n");
    else
      printf("a == b\n");  
  }

}

Measured memory_bytes: 1816
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  double n; cin >> n;
  rep(i,3501) rep(j,3501){
    if(i==0 || j==0 || 4*i*j-n*i-n*j<=0) continue;
    double w = (n*i*j)/(4*i*j-n*i-n*j);
    if(ceil(w) == floor(w)){
      cout << i << " " << j << " " << int(w) << endl;
      return 0;
    }
  }
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3728
#include <iostream>
#include <string>
#include <math.h>
#include <map>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>
#include <stdlib.h>
#include <stack>
#include <queue>
#include <bitset>
#include <memory.h>

using namespace std;

int main() {
    int size;
    int case_count = 1;
    
    
    while(cin>>size){
        //size==0なら終了
        if(size==0){
            break;
        }
        
        //データの入力
        int num;
        cin>>num;
        int val[num];
        int wei[num];
        for(int i=0; i<num; i++)scanf("%d,%d",&val[i],&wei[i]);
        
        //計算
        int dp[size+1];
        int dp_temp[size+1];
        int dp_val[size+1];
        int dp_val_temp[size+1];
        for(int i=0; i<=size; i++){
            dp[i]=0;
            dp_val[i]=0;
        }
        dp[0]=1;

        for(int i=0; i<num; i++){
            memcpy(dp_temp,dp,sizeof(dp));
            memcpy(dp_val_temp,dp_val,sizeof(dp_val));
            for(int j=0; j<=size; j++){
                if(dp[j]==1){
                    int next_wei=j+wei[i];
                    int next_val=dp_val[j]+val[i];
                    if(next_wei<=size){
                        if(dp_val[next_wei]<next_val){
                            dp_temp[next_wei]=1;
                            dp_val_temp[next_wei]=next_val;
                        }
                    }
                }
            }
            memcpy(dp,dp_temp,sizeof(dp_temp));
            memcpy(dp_val,dp_val_temp,sizeof(dp_val_temp));
        }
        int max_val=0;
        int min_wei=0;
        for(int i=0; i<=size; i++){
            if(max_val<dp_val[i]){
                max_val=dp_val[i];
                min_wei=i;
            }
        }
//        for(int i=0; i<=size; i++){
//            cout<<i<<" "<<dp[i]<<" "<<dp_val[i]<<endl;
//        }cout<<endl;
        cout<<"Case "<<case_count<<":"<<endl;
        cout<<max_val<<endl;
        cout<<min_wei<<endl;
        case_count++;
        
    }
    
    return 0;
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ifstream in("file.in");
ofstream out("file.out");
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

///________CODE_STARTS_HERE________\\\

long long n,cnt=1,p,isp[1005];

int main(){
    ios_base :: sync_with_stdio(0);
    cin >> n;
    for(int i=2;i<=n;i++){
        if(!isp[i]){
            int k=i;p=0;
            while(k<=n){
                p+=n/k;
                k*=i;
            }
            cnt*=(p+1);
            cnt%=1000000007;
            for(int j=i;i*j<=n;j++){
                isp[i*j]=1;
            }
        }
    }
    cout << cnt;
}


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

char s[10];
int n1 = 0,n2 = 0;

int main(){
  scanf("%s",&s);
  n1 = (s[0]-'0') * 10 + s[1]-'0';
  n2 = (s[2]-'0') * 10 + s[3]-'0';
 int x1 = (1<= n1 && n1 <= 12);
  int x2 = (1<=n2 && n2 <= 12);
  if ( x1 && x2 ) printf("AMBIGUOUS\n");
  else if ( !x1 && !x2 ) printf("NA\n");
  else if ( x1 ) printf("MMYY\n");
  else printf("YYMM\n");
  return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		int d = sc.nextInt();
		int ta = sc.nextInt();
		int tb = sc.nextInt();
		double da = sc.nextInt();
		double db = sc.nextInt();
		double min = Double.MAX_VALUE;
		for (int i = 0; i * da <= d; i++) {
		    for (int j = 0; i * da + j * db <= d; j++) {
		        if (i == 0 && j == 0) {
		            continue;
		        }
		        min = Math.min(min, Math.abs((ta * i * da + tb * j * db) / (i * da + j * db) - t));
		    }
		}
		System.out.println(min);
	}
}



Measured memory_bytes: 26532
// Created by new_sm
//
#include<bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
s.find_by_order(x) xth element in set
x.order_of_key(x) number of elements <x*/
#define ll long long
#define vi vector<int>
#define si set<int>
#define mii map<int,int>
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define chotu 1000000007
#define set0(a) memset(a,0,sizeof(a))
#define endl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lower_string(s) transform(all(s),s.begin(),::tolower())
#define upper_string(s) transform(all(s),s.begin(),::toupper())
#define size(s) s.size()
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<typename T,typename U>
bool compare(T x,U y){return(abs(x-y)<=1e-9);}
void solve()
{
fastio
int n,x,t;
cin>>n>>x>>t;
int p=ceil(n/(float)x);
cout<<p*t;  
}
int main()
{
//code
fastio
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t;
t=1;
while(t--)
{
solve();
cout<<endl;
}
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <map>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

typedef pair<int,int> pii;
typedef pair<int,pii> ipii;

int main()
{
  while(1){
    int N, M;
    cin >> N >> M;
    if(N == 0 && M == 0) break;
    int h[N], w[M];
    REP(i,N)
      cin >> h[i];
    REP(i,M)
      cin >> w[i];
    map<int, pii> m;
    int dp[max(N,M)];
    REP(i,N){
      dp[i] = h[i];
      if(m.find(h[i]) != m.end()){
        m[h[i]].first++;
      }else{
        m.insert(ipii(h[i],pii(1,0)));
      }
    }
    for(int i = 1, x = N-1; i < N; i++, x--){
      REP(j,x){
        dp[j] += h[j+i];
        if(m.find(dp[j]) != m.end()){
          m[dp[j]].first++;
        }else{
          m.insert(ipii(dp[j],pii(1,0)));
        }
      }
    }
    REP(i,M){
      dp[i] = w[i];
      if(m.find(w[i]) != m.end()){
        m[w[i]].second++;
      }else{
        m.insert(ipii(w[i],pii(0,1)));
      }
    }
    for(int i = 1, x = M-1; i < M; i++, x--){
      REP(j,x){
        dp[j] += w[j+i];
        if(m.find(dp[j]) != m.end()){
          m[dp[j]].second++;
        }else{
          m.insert(ipii(dp[j],pii(0,1)));
        }
      }
    }
    int ans = 0;
    for(map<int, pii>::iterator p = m.begin(); p != m.end(); p++)
      ans += p->second.first * p->second.second;
    cout << ans << endl;
  }
}

Measured memory_bytes: 25000
#include <algorithm>
#include <iostream>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define pb push_back

ll power(int x, unsigned int y){
    ll res = 1;
    while(y > 0){
        if(y & 1) res = res * x;
        y >>= 1;
        x *= x;
    }
    return res;
}

const int mx = 2 * 1e5 + 5;
vector<ll> adj[mx];
vector<bool> vis(mx, false);
ll in = 0;


void dfs(int x) {
    in++;
    vis[x] = true;

    for(auto child : adj[x]) {
        if(!vis[child]) {
            dfs(child);
        }
    }
}

// Check for number of Cases!!
void solve() {
    int nodes, edges;
    cin >> nodes >> edges;

    while(edges--) {
        int a, b;
        cin >> a >> b;

        adj[a].pb(b);
        adj[b].pb(a);
    }

    ll ans = 0;

    for(int i = 1; i <= nodes; i++) {
        if(!vis[i]) {
            in = 0;
            dfs(i);
            ans = max(ans, in);
        }
    }

    cout << ans;
}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int t = 1;
    // cin >> t;
    while(t--) {
      solve();
    }
}

Measured memory_bytes: 20724
from bisect import bisect
from itertools import accumulate
from functools import reduce
from sys import setrecursionlimit

setrecursionlimit(10000000)

MOD = 998244353

def solve(robots):
    N = len(robots)+1
    robots.sort()

    parent = [None]*N

    stack = [(float('inf'),0)]
    for i,(x,d) in enumerate(robots,start=1):
        d += x
        while stack[-1][0] <= x:
            stack.pop()
        parent[i] = stack[-1][1]
        while stack[-1][0] <= d:
            stack.pop()
        stack.append((d,i))

    dp = [1]*N
    for i in reversed(range(1,N)):
        p = parent[i]
        dp[p] *= dp[i]+1
        dp[p] %= MOD
    return dp[0]

if __name__ == '__main__':
    N = int(input())
    robots = [tuple(map(int,input().split())) for _ in range(N)]
    print(solve(robots))

Measured memory_bytes: 84952
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define ll long long
#define ull unsigned long long
#define vi vector<int>

const double PI = 3.14159265358979323846;

ll gcd(ll a, ll b) {
    if (a < b) return gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int turn = 0;
    while (A > 0 && C > 0) {
        if (turn % 2 == 0) {
            C -= B;
        } else {
            A -= D;
        }
        turn++;
        // cout << A << " " << C << endl;
    }
    if (A <= 0) {
        No;
    } else {
        Yes;
    }
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,0,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;

signed main(){
    string S;cin>>S;
    if(S=="ABC")cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
}

Measured memory_bytes: 3596
using System;
using System.Linq;

namespace Algo
{
    class Program
    {
        static void Main()
        {
            var nk = Console.ReadLine()?.Split().Select(long.Parse).ToArray();
            var n = nk[0];
            var d = Console.ReadLine()?.Split().Select(_ => _[0]).ToArray();
            while (true)
            {
                var s = n.ToString();
                var flag = true;
                foreach (var c in d)
                {
                    if (s.Contains(c))
                    {
                        flag = false;
                        break;
                    }
                }

                if (flag)
                {
                    Console.WriteLine(n);
                    return;
                }

                n++;
            }
        }
    }
}


Measured memory_bytes: 30308
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
	int x,y,z;
	cin >> x >> y >> z;
	x-=z;
	int ans=0;
	ans+= x/(y+z);

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <cassert>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;

typedef long long ll;

const int N = 200005;

struct node
{
        int a, b, c;
} v[N];
bool cmp1(node a, node b)
{
        return a.a < b.a;
}
bool cmp2(node a, node b)
{
        return a.b < b.b;
}

int main()
{
        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int n; cin >> n;
        for(int i = 1; i <= n; ++i) cin >> v[i].a, v[i].b = i;
        sort(v+1,v+1+n,cmp1);
        for(int i = 1; i <= n; ++i) cerr << v[i].a << ' ' << v[i].b << ' ' << v[i].c << endl;
        for(int i = 1; i <= n; ++i)
        {
                if(i <= n/2) v[i].c = v[(n+2)/2].a;
                else v[i].c = v[n/2].a;
        }
        sort(v+1,v+1+n,cmp2);
        for(int i = 1; i <= n; ++i) cout << v[i].c << '\n';
        return 0;
}


Measured memory_bytes: 4608
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2.0) //等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll number1, ll number2) {
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	string s;
	scans(s);
	printyn(s[2] == s[3] and s[4] == s[5]);

	Please AC;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n, k; scanf("%d%d", &n, &k);

	int ans = 0;
	for(int i = 0; i < n; i++) {
		int h; scanf("%d", &h);

		ans += (h >= k);
	}
	printf("%d\n", ans);
	return 0;
}


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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);

int main() {
    ll a, b, c, k, ans=0;
    cin >> a >> b >> c >> k;
    
    if(k >= a) {
        ans += a;
        k -= a;
    }
    else {
        ans += k;
        cout << ans << endl;
        return 0;
    }
    if(k >= b) {
         k -= b;
    }
    else {
        cout << ans << endl;
        return 0;
    }
    ans -= k;
    cout << ans << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}



Measured memory_bytes: 3596
import math
N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
count = [0] * 40
if K == 0:
    print(sum(A))
    exit()
for a in A:
    for i in range(40):
        if a >> i & 1:
            count[i] += 1
ans = sum(count[_] * 2**_ for _ in range(int(math.log2(K)) + 1, 40))
while K:
    b = int(math.log2(K))
    if count[b] * 2 > N:
        #0をたてる
        ans += count[b] * 2**b
        K = 2**b - 1
    else:
        #1を立てる
        ans += (N - count[b]) * 2**b
        if K - 2**b:
            ans += sum(count[_] * 2**_
                       for _ in range(1 + int(math.log2(K - 2**b)), b))
        else:
            ans += sum(count[_] * 2**_ for _ in range(b))
        K -= 2**b
print(ans)


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

int main() {
    int n; ll MOD; cin >> n >> MOD;
    vector<vector<ll>> dp(3 * n + 1, vector<ll>(n + 1, 0));
    dp[0][0] = 1;
    for (ll i = 0; i < 3 * n; i++) {
        for (ll j = 0; j <= n; j++) {
            if (i + 1 <= 3 * n) ( dp[i+1][j] += dp[i][j] ) %= MOD;
            if (i + 2 <= 3 * n && j + 1 <= n) ( dp[i+2][j+1] += dp[i][j] * (i + 1) ) %= MOD;
            if (i + 3 <= 3 * n && j + 1 <= n) ( dp[i+3][j+1] += dp[i][j] * (i + 1) * (i + 2) ) %= MOD;
        }
    }
    ll ans = 0;
    for (int i = 0; i <= n; i++) ( ans += dp[3*n][i] ) %= MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 97248
all,rolls=map(int,input().split())
inputList=list(map(int,input().split()))

sum = 0
sumList =[]

# 初めに全期待値計算
for i in range(all):
	inputList[i] = (inputList[i] + 1) / 2

# 最初の組み合わせの期待値計算
for i in range(rolls):
	sum = sum + inputList[i]
sumList.append(sum)

# 2番目以降の期待値計算
for i in range(all - rolls):
	sum = sum + inputList[i + rolls] - inputList[i]
	sumList.append(sum)

sumList.sort(reverse=True)
print(sumList[0])


Measured memory_bytes: 25060
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;
int a[10010],ans[103][103];

int main()
{
	int h,w;
	scanf("%d%d",&h,&w);
	int N;
	scanf("%d",&N);
	
	for(int i=1;i<=N;i++){
		scanf("%d",&a[i]);
	}
	int n = 1,m = 1,inc=1;
	for(int i=1;i<=N;i++){
		int cnt=a[i];
		for(;cnt!=0;cnt--){
			ans[n][m] = i;
			m+=inc;
			if(m==w+1||m==0){
				n++;
				inc = -inc;
				m+=inc;
			}
		}
	}	
	
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			printf("%d%c",ans[i][j],j==w?'\n':' '); 
		} 
	} 
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

int n;
int t[333333];
int r[333333];

int main(){
    cin>>n;
    rep(i,n)cin>>t[i];
    rep(i,n){
        r[i]=t[i];
    }
    rep(i,n-1)r[i+1]=min(r[i+1],r[i]);
    int ans=0;
    rep(i,n){
        if(t[i]<=r[i])ans++;
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 1792
n,y = [int(i) for i in input().split()]

y = y//1000

a = b = c = -1

###10a+5b+c=y
###a+b+c=n
###->9a+4b=y-n=m
m = y-n

for i in range(m//9+1):
  if (m-9*i)%4 == 0:
    if (m-9*i)//4 <= n-i:
      a = i
      b = (m-9*i)//4
      c = n - a - b
      break
print(a,b,c)


Measured memory_bytes: 3060
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple


int main(void)
{
  ll N, M, tmp, ans;
  ans = 0;
  cin >> N >> M;
  priority_queue<ll> q;
  for(ll i=0;i<N;i++){
    cin >> tmp;
    q.push(tmp);
  }
  for(ll i=0;i<M;i++){
    tmp = q.top();
    q.pop();
    tmp = tmp / 2;
    q.push(tmp);
  }
  for(ll i=0;i<N;i++){
    ans += q.top();
      q.pop();
  }
  cout << ans << endl;
}


Measured memory_bytes: 1400