akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
using namespace std;
int get_answer(int num[][6],int j,int k,int l,int n1,int n2);
int main()
{
	int i=0,j,k,l,num[100][6],check[100][6],check2[100][6],check3[100][6],n1,n2,ans,dnum;
	cin>>dnum;
	for(i=0;i<dnum;i++){
		for(j=0;j<6;j++)cin>>num[i][j];
	}
	for(i=0;i<dnum;i++){
		for(j=0;j<6;j++)check[i][j]=num[i][j];
	}
	for(i=0;i<dnum;i++){
		for(j=0;j<6;j++)check2[i][j]=num[i][j];
	}
	for(i=0;i<dnum;i++){
		for(j=0;j<6;j++)check3[i][j]=num[i][j];
	}
	for(k=0;k<dnum-1;k++){
		for(l=1;l<dnum;l++){
			if(k==l)break;	
			for(i=0;i<6;i++){
				check[k][i]=num[k][i];
				check[l][i]=num[l][i];
					if(num[l][i]==num[k][0])n1=i;
					if(num[l][i]==num[k][1])n2=i;
				}
			
			j=0;
			ans = get_answer(check,j,k,l,n1,n2);
			
			if(ans==0)break;
			for(i=0;i<6;i++){
				check2[k][i]=num[k][i];
				check2[l][i]=num[l][i];
					if(num[l][i]==num[k][2])n1=i;
					if(num[l][i]==num[k][4])n2=i;
				}
			j=2;
			ans = get_answer(check2,j,k,l,n1,n2);
			if(ans==0)break;
			for(i=0;i<6;i++){
				check3[k][i]=num[k][i];
				check3[l][i]=num[l][i];
					if(num[l][i]==num[k][3])n1=i;
					if(num[l][i]==num[k][5])n2=i;
				}
			j=3;
			ans = get_answer(check3,j,k,l,n1,n2);
		}
		if(ans==0)break;
	}
	if(ans==1)cout<<"Yes"<<endl;
	else if(ans==0)cout<<"No"<<endl;
    return 0;
}
int get_answer(int num[][6],int j,int k,int l,int n1,int n2){
	int i=0,m1,m2,ans;
	m1=num[k][j];
	if(j>1)j+=1;
	m2=num[k][j+1];
	n1=num[l][n1];
	n2=num[l][n2];
	
	while(1){
		if(num[k][1]==m2)break;
		swap(num[k][0],num[k][1]);
		swap(num[k][1],num[k][4]);
		swap(num[k][1],num[k][5]);
		if(i==4){
		swap(num[k][0],num[k][3]);
		swap(num[k][2],num[k][3]);
		swap(num[k][3],num[k][5]);	
		}
		if(i==10)break;
		i++;
	}
	i=0;
	while(1){
		if(num[k][0]==m1)break;
		swap(num[k][0],num[k][3]);
		swap(num[k][2],num[k][3]);
		swap(num[k][3],num[k][5]);
		if(i==10)break;
		i++;
	}
	i=0;
	while(1){
		if(num[l][1]==n2)break;
		swap(num[l][0],num[l][1]);
		swap(num[l][1],num[l][4]);
		swap(num[l][1],num[l][5]);
		if(i==4){
		swap(num[l][0],num[l][3]);
		swap(num[l][2],num[l][3]);
		swap(num[l][3],num[l][5]);
		}
		if(i==10)break;
		i++;
	}
	i=0;
	while(1){
		if(num[l][0]==n1)break;
		swap(num[l][0],num[l][3]);
		swap(num[l][2],num[l][3]);
		swap(num[l][3],num[l][5]);
		if(i==10)break;
		i++;
	}
	if(num[k][0]==num[l][0]&&num[k][1]==num[l][1]&&num[k][2]==num[l][2]&&num[k][3]==num[l][3]&&num[k][4]==num[l][4]&&num[k][5]==num[l][5])ans=0;
	else ans=1;
	//cout<<ans<<endl;
		return (ans);
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
using namespace std;
#define fr(x,i,n) for(int x = i; x < n; ++x)
#define fb(x,i,n) for(int x = i; x >= n; --x)
#define pr pair<int,int>
#define ll long long int
const int mod=1e9+7;
/*    auto start = high_resolution_clock::now();
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
    cout << "\nduration="<<duration.count()/1e6 << endl;
*/
const ll inf=1e18;
void solve(){
    int n;
    cin>>n;
    set<string> st;
    string s;
    while(n--){
        cin>>s;
        st.insert(s);
    }
    cout<<st.size();
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    t=1;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 19244
#include<stdio.h>

int main()
{
	int n, m, pass[1005], temp1 = 2, temp2 = 1, idx = 0, ans, ctr = 0;
	
	scanf("%d %d", &n, &m);
	
	for(int i = 0; i < n; i++){
		pass[idx++] = temp1;
		temp1 += 2;
	}
	for(int i = 0; i < m; i++){
		pass[idx++] = temp2;
		temp2 += 2;
	}
	
	for(int i = 0; i < n + m; i++){
		for(int j = i; j < n + m; j++){
			if(i != j){
				ans = pass[i] + pass[j];
				if(ans % 2 == 0){
					++ctr;
				}
			}
		}
	}
	if(ctr == 0){
		printf("0\n");
	}else{
		printf("%d\n", ctr);
	}
}

Measured memory_bytes: 1732
n = int(input())
al = list(map(int, input().split()))

if n%2 == 1:
    dp = [ [0]*4 for _ in range(n//2+1) ] 

    for i in range(n//2):
        dp[i+1][0] = dp[i][0] + al[i*2]
        dp[i+1][1] = max(dp[i][1]+al[i*2+1], dp[i][0]+al[i*2+1])
        dp[i+1][2] = max(dp[i][2]+al[i*2+2], dp[i][0]+al[i*2+2])
        dp[i+1][3] = max(dp[i][3]+al[i*2+2], dp[i][1]+al[i*2+2])
    ans = max(dp[-1])
    print(ans)

else:
    dp = [ [0]*2 for _ in range(n//2+1) ] 
    for i in range(n//2):
        dp[i+1][0] = dp[i][0] + al[i*2]
        dp[i+1][1] = max(dp[i][1]+al[i*2+1], dp[i][0]+al[i*2+1])
    ans = max(dp[-1])
    print(ans)

Measured memory_bytes: 99600
#include <iostream>
#include <algorithm>
#include <vector>
#include <memory.h> 
using namespace std;
int dp[100022][5];
int n , a, b, c ;
vector <pair<int ,pair <int, int> > > v ; //v[i].first  v[i].second.first  v[i]second.second 

int solve (int idx , int noway)
{
	if(idx==n) return 0 ; 
	if (dp[idx][noway]!=-1)return dp[idx][noway]; 
	int x, y, z ;
	if(noway!=1)x = v[idx].first + solve (idx+1 , 1 ); else x = -1 ;
	if(noway!=2)y = v[idx].second.first + solve (idx+1 , 2); else y=-1 ;
	if(noway!=3)z = v[idx].second.second + solve (idx+1 , 3); else z=-1 ;
	
	return dp[idx][noway]= max(x,max(y,z)); 
}


int main() {
	cin >> n ;
	
	memset(dp,-1,sizeof dp);
	
	for (int i=0 ; i<n ; i++)
	{
		cin >> a >> b >> c ;
		v.push_back({a,{b,c}}); 
	}
	int ans = solve(0,0);
	cout<<ans ; 
	return 0;
}

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



const int N = 1e5 + 5, INF = 2e9;


int n, w;
long long dp[N];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n >> w;
    memset(dp, -1, sizeof(dp));
    dp[0] = 0;
    for(int i = 1; i <= n; i++){
        int x, y;
        cin >> x >> y;
        for(int j = w; j - x >= 0; j--){
            if(dp[j - x] != -1){
                dp[j] = max(dp[j], dp[j - x] + y);
            }
        }
    }
    long long ans = -1;
    for(int i = 0; i <= w; i++){
        ans = max(ans, dp[i]);
    }
    cout << ans;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <complex>
#include <cassert>
#include <random>
#include <cstring>
#include <numeric>
#define ll long long
#define ld long double
#define null NULL
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < n; ++i)
#define sz(a) (int)a.size()
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
template<class T> int gmax(T &a, T b) { if (b > a) { a = b; return 1; } return 0; }
template<class T> int gmin(T &a, T b) { if (b < a) { a = b; return 1; } return 0; }
using namespace std;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
    int H, W, A, B;
    while(~scanf("%d %d %d %d", &H, &W, &A, &B)) {
        for(int i = 0; i < H; ++i) {
            for(int j = 0; j < W; ++j) {
                int flag = 0;
                if(j >= A) flag ^= 1;
                if(i >= B) flag ^= 1;
                printf("%d", flag == 0 ? 1 : 0);
            }
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<algorithm>
using namespace std;
#define INF ( 1 << 30 )
int main() {
	int dp[1000], tmp[] = { 500,100,50,10,5,1 }, n;
	fill_n(dp, 1000, INF);
	dp[0] = 0;
	for (int i = 0; i < 1000; i++) {
		for (int j = 0; j < 6; j++) {
			if (i - tmp[j] >= 0) dp[i] = min(dp[i], dp[i - tmp[j]] + 1);
		}
	}
	while (cin >> n, n) cout << dp[1000 - n] << endl;
}

Measured memory_bytes: 2988
N,A,B,C,D=map(int,input().split())
S="*"+input()

X=[0]*(N+1)
Y=[0]*(N+1)

for k in range(1,N+1):
    if S[k]=="#":
        X[k]=X[k-1]+1
    else:
        Y[k]=Y[k-1]+1

if max(X[A:max(C,D)+1])>=2:
    print("No")
else:
    if C<D:
        print("Yes")
    elif C>D:
        F=False
        for k in range(B,min(N,D+1)):
            F|=(S[k-1:k+2]=="...")

        if F:
            print("Yes")
        else:
            print("No")
    else:
        print("No")


Measured memory_bytes: 71104
#include<iostream>

using namespace std;

int main()
{

    unsigned long N, M;
    cin >> N >> M;

    unsigned long long result = 0;

    if (N >= 2 && M >= 2)
    {
        result = (N - 2) * (M - 2);
    }

    if (N == 1 && M > 1)
    {
        result = M - 2;
    }
    if (M == 1 && N > 1)
    {
        result = N - 2;
    }

    if (N == 1 && M == 1)
    {
        result = 1;
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include <math.h>
#include<stdio.h>
#include <climits>
#include<algorithm>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	double n,kari;
	int a,b,c,i, ans = 0,j, x,max;
	int digit_sum=0;
	int aold, bold, cold;
	
	cin >> a >> b >> c;
	while (a % 2 == 0 and b % 2 == 0 and c % 2 == 0) {
		if (a == b and b == c) {
			ans = -1;
			break;
		}
		else {
			aold = a;
			bold = b;
			cold = c;
			a = bold / 2 + cold / 2;
			b = aold / 2 + cold / 2;
			c = aold / 2 + bold / 2;
			ans++;
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
// @author: arch_

#include <bits/stdc++.h>
using namespace std;

array<array<array<int, 10>, 3>, 4> oh;

int main(void) {
    int n; cin >> n;
    int b, f, r, v;
    for (int i = 0; i < n; i++) {
        cin >> b >> f >> r >> v;
        oh[b - 1][f - 1][r - 1] += v;
    }
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 10; k++) cout << " " << oh[i][j][k];
            cout << "\n";
        }
        if (i != 3) cout << "####################\n";
    }
    return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
ll TN = 1;
 
int solution() {
    ll n;
  	string x;
  	cin >> n;
  	set <string> st;
  	for (ll i = 0; i<n; ++i) {
    	cin >> x;
      	st.insert(x);
    } cout << st.size();
    return 0;
}
 
int main() {
    //cin >> TN;
    for (ll i = 0; i<TN; ++i) solution();
    return 0;
}

Measured memory_bytes: 19272
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int x;
    
    scanf("%d", &x);
    
    if (x < 1200) {
        printf("ABC");
    } else {
        printf("ARC");
    }
    
    return 0;
}



Measured memory_bytes: 1704
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct node{
  int key;
  node *left,*right,*p;
  node(){}
  node(int key):key(key){left=right=p=NULL;};
};
node *root;
void insert(node z){
  node *y=NULL;
  node *x=root;
  while(x!=NULL){
    y=x;
    if(z.key<x->key) x=x->left;
    else x=x->right;
  }
  z.p=y;
  if(y==NULL) root=new node(z);
  else if(z.key<y->key) y->left=new node(z);
  else y->right=new node(z);
}
bool find(int z){
  node *x=root;
  while(x!=NULL){
    if(z==x->key) return true;
    if(z<x->key) x=x->left;
    else x=x->right;
  }
  return false;
}
node *nxt(node *x){
  if(x->left!=NULL) return nxt(x->left);
  return x;
}
void del(node *x){
  //cout<<x->key<<endl;
  node *y=x->p;
  if(x->left==NULL&&x->right==NULL){
    if(y!=NULL&&y->left==x) y->left=NULL;
    if(y!=NULL&&y->right==x) y->right=NULL;
    delete(x);
    return;
  }
  if(x->left==NULL&&x->right!=NULL){
    if(y!=NULL&&y->left==x) y->left=x->right;
    if(y!=NULL&&y->right==x) y->right=x->right;
    x->right->p=y;
    delete(x);
    return;
  }
  if(x->left!=NULL&&x->right==NULL){
    if(y!=NULL&&y->left==x) y->left=x->left;
    if(y!=NULL&&y->right==x) y->right=x->left;
    x->left->p=y;
    delete(x);
    return;
  }
  node *z=nxt(x->right);
  x->key=z->key;
  del(z);
}
void del(int k){
  node *x=root;
  while(x!=NULL){
    if(k==x->key) break;
    if(k<x->key) x=x->left;
    else x=x->right;
  }
  //cout<<k<<" "<<x->key<<endl;
  del(x);
}
void inorderTreeWalk(node *v){
  if(v==NULL) return;
  inorderTreeWalk(v->left);
  cout<<" "<<v->key;
  inorderTreeWalk(v->right);
}
void preorderTreeWalk(node *v){
  if(v==NULL) return;
  cout<<" "<<v->key;
  preorderTreeWalk(v->left);
  preorderTreeWalk(v->right);
}
signed main(){
  int n;
  cin>>n;
  root=NULL;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    //cout<<(root==NULL?-1:root->key)<<endl;
    if(s=="print"){
      inorderTreeWalk(root);
      cout<<endl;
      preorderTreeWalk(root);
      cout<<endl;
      continue;
    }
    int x;
    cin>>x;
    if(s=="insert"){
      insert(node(x));
    }
    if(s=="find"){
      cout<<(find(x)?"yes":"no")<<endl;
    }
    if(s=="delete"){
      del(x);
    }
  }
  return 0;
}


Measured memory_bytes: 21828
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    vector<int> v;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        int a;
        cin >> a;
        v.push_back(a);
    }
    int res = 1;
    int max = v[0];
    for(int i = 1; i < n; i++){
        if(v[i] >= max){
            res++;
            max = v[i];
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
int main(){
  char  a[100],b[100],c[100];
  scanf("%s%s",&a,&b);
  sprintf(c,"%s%s\n",a,b);

  int x=atoi(c);
  int y;
  y=sqrt(x);
  if(y*y==x){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 128
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.Array.Unboxed
import Data.Bits
import Data.List
--import qualified  Data.ByteString as B
import Data.Ord
import Data.Array.ST
-- import Data.Array.IO 
import Control.Monad.ST
-- import Data.List.Extra


bsToInt :: BS.ByteString -> Int
bsToInt = fst . fromJust . BS.readInt

main :: IO ()
main = do
 n <- bsToInt <$> BS.getLine
 s <- replicateM n BS.getLine
 let xs = sort s
 let ans = check xs 0
       where
         check [] n = n
         check [x] n = n+1
         check (x:y:xs) n
           | x == y = check (dropWhile (== x) xs) (n+1)
           | otherwise = check (y:xs) (n+1)
 print $ ans


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

struct rule{
  bool permit;
  string src;
  string dst;
};

int main(){
  int n,m;
  while(cin>>n>>m&&!(n==0&&m==0)){
    vector<rule> v;
    for(int i = 0; i < n; i++){
      string ord;
      rule r;
      cin>>ord>>r.src>>r.dst;
      if(ord=="permit")
	r.permit=true;
      else
	r.permit=false;
      v.push_back(r);
    }
    reverse(v.begin(),v.end());
    vector<string> ss,ds,bs;
    for(int i = 0; i < m; i++){
      string src,dst,body;
      cin>>src>>dst>>body;
      for(int j = 0; j < v.size(); j++){
	bool b=false;
	for(int k = 0; k < v[j].src.size(); k++){
	  if(v[j].src[k]=='?')
	    continue;
	  if(v[j].src[k]!=src[k]){
	    b=true;
	    break;
	  }
	}
	if(!b){
	  bool b2=false;
	  for(int k = 0; k < v[j].dst.size(); k++){
	    if(v[j].dst[k]=='?')
	      continue;
	    if(v[j].dst[k]!=dst[k]){
	      b2=true;
	      break;
	    }
	  }
	  if(!b2){
	    if(v[j].permit){
	      ss.push_back(src);
	      ds.push_back(dst);
	      bs.push_back(body);
	    }
	    break;
	  }
	}
      }
    }
    cout<<ss.size()<<endl;
    for(int i = 0; i < ss.size(); i++){
      cout<<ss[i]<<" "<<ds[i]<<" "<<bs[i]<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1048
// C++ code to find number of distinct numbers
// in a subarray
#include<bits/stdc++.h>
using namespace std;

const int MAX = 5e5 + 2;

// structure to store queries
struct Query
{
	int l, r, idx;
};

// cmp function to sort queries according to r
bool cmp(Query x, Query y)
{
	return x.r < y.r;
}

// updating the bit array
void update(int idx, int val, int bit[], int n)
{
	for (; idx <= n; idx += idx&-idx)
		bit[idx] += val;
}

// querying the bit array
int query(int idx, int bit[], int n)
{
	int sum = 0;
	for (; idx>0; idx-=idx&-idx)
		sum += bit[idx];
	return sum;
}

void answeringQueries(int arr[], int n, Query queries[], int q)
{
	// initialising bit array
	int bit[n+1];
	memset(bit, 0, sizeof(bit));

	// holds the rightmost index of any number
	// as numbers of a[i] are less than or equal to 10^6
	int last_visit[MAX];
	memset(last_visit, -1, sizeof(last_visit));

	// answer for each query
	int ans[q];
	int query_counter = 0;
	for (int i=0; i<n; i++)
	{
		// If last visit is not -1 update -1 at the
		// idx equal to last_visit[arr[i]]
		if (last_visit[arr[i]] !=-1)
			update (last_visit[arr[i]] + 1, -1, bit, n);

		// Setting last_visit[arr[i]] as i and updating
		// the bit array accordingly
		last_visit[arr[i]] = i;
		update(i + 1, 1, bit, n);

		// If i is equal to r of any query store answer
		// for that query in ans[]
		while (query_counter < q && queries[query_counter].r == i)
		{
			ans[queries[query_counter].idx] =
					query(queries[query_counter].r + 1, bit, n)-
					query(queries[query_counter].l, bit, n);
			query_counter++;
		}
	}

	// print answer for each query
	for (int i=0; i<q; i++)
		cout << ans[i] << endl;
}

int a[MAX];
Query queries[MAX];
// driver code
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n, q;
    cin >> n >> q;
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int i = 0; i < q; ++i) {
        cin >> queries[i].l >> queries[i].r;
        queries[i].l--;
        queries[i].r--;
        queries[i].idx = i;
    }





	sort(queries, queries+q, cmp);
	answeringQueries(a, n, queries, q);
	return 0;
}


Measured memory_bytes: 17452
#include <iostream>
#include <vector>
#include <limits>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>
#include <bitset>

using namespace std;
using namespace boost;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    constexpr uint f_max{3000};
    constexpr uint suger_max{f_max / 2};

    uint A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    bitset<suger_max + 1> dp_s;
    for (auto &&c: irange(0U, suger_max / C + 1)) {
        for (auto &&d: irange(0U, suger_max / D + 1)) {
            if (c * C + d * D <= suger_max)dp_s.set(c * C + d * D);
        }
    }

//    for (auto &&i: irange(0U, 100U)) {
//        cout << dp_s[i];
//    }
//    cout << endl;

    uint water_max = F / 100 + 1;
    vector<bool> dp_w(water_max, false);
    for (auto &&a: irange(0U, F / A / 100 + 1)) {
        for (auto &&b: irange(0U, F / B / 100 + 1)) {
            if (a * A + b * B < water_max)dp_w.at(a * A + b * B) = true;
        }
    }
    uint suger_index{0};
    vector<uint> suger_max_for_each_water(water_max, 0);
    for (auto &&i: irange(0U, water_max)) {
        if (dp_w.at(i)) {
            uint suger_max_local = i * E;
//            cout << "suger_max_local: ";
//            cout << i * 100 << " " << suger_max_local << endl;
            if (i != 0) {
                suger_max_for_each_water.at(i) = suger_max_for_each_water.at(i - 1);
            }
            while (suger_index <= min(suger_max_local, suger_max)) {
                if (dp_s[suger_index] && i*100 + suger_index <= F) suger_max_for_each_water.at(i) = suger_index;
                suger_index++;
            }
        }
    }

//    for (auto &&i: irange(0U, water_max)) {
//        cout << "suger_max_for_each_water: " << i * 100 << " " << suger_max_for_each_water.at(i) << endl;
//    }


    vector<pair<uint, uint>> suger_max_paired{};
    for (auto &&i: irange(1U, water_max)) {
        if (dp_w.at(i)) {
            suger_max_paired.emplace_back(make_pair(i, suger_max_for_each_water.at(i)));
        }
    }
    sort(suger_max_paired.begin(), suger_max_paired.end(), [](pair<uint, uint> a, pair<uint, uint> b) {
        return a.first * b.second < a.second * b.first;
    });

//    for (auto &&i: irange(0U, (uint)suger_max_paired.size())){
//        cout << "debug" << suger_max_paired.at(i).first << " " << suger_max_paired.at(i).second <<  "debug"<< endl;
//    }


    for (auto &&i: irange(0U, (uint)suger_max_paired.size())) {
        uint suger_and_water = suger_max_paired.at(i).first*100 + suger_max_paired.at(i).second;
        if (suger_and_water <= F){
            cout << suger_and_water << " " << suger_max_paired.at(i).second << endl;
            return 0;
        }
    }
    cout << dp_w.at(27) << endl;
    cout << dp_s[183] << endl;
    cout << A*100 <<  " " << A*100 <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int minuscounter = 0, zero = 0;
    ll c[n];
    ll sum = 0, ans;

    rep(i, n) {
        ll a;
        cin >> a;
        
        if(a == 0) {
            zero = 1;
        }
        else if(a < 0) {
            minuscounter++;
            minuscounter %= 2;
        }

        sum += abs(a);
        c[i] = abs(a);
    }

    sort(c, c+n);

    if(zero || !minuscounter) {
        ans = sum;
    }
    else {
        ans = sum - 2*c[0];
    }

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

Measured memory_bytes: 1024
import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

a,b = get_ints()
b = 2*b
if b>=a:
  print(0)
else:
  print(a-b)

Measured memory_bytes: 3060
N = gets.chomp.to_i
a = Array.new(N)
str = gets.split
for i in 0...N do
    a[i] = str[i].to_i
end

answer = 0
for i in 0...N do
    answer += (a[i]-100)*(a[i]-100)
end

for i in 1..99 do
    b = 0
    for j in 0...N do
        b += (a[j]-i)*(a[j]-i)
    end
    if b < answer
        answer = b
    end
end

puts answer

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

int main() {

    int x[5];
    for (int i = 0; i < 5; i++) {
        cin >> x[i];
    }

    for (int i = 0; i < 5; i++) {
        if (x[i] == 0) {
            cout << i+1 << endl;
            break;
        }
    }

    return 0;
}

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

using namespace std;

#define MOD 998244353

int n;
long long a, b, k, ans, fac[300005], inv[300005], ta;

long long po(long long b, int p) {
	long long re = 1;
	while (p) {
		if (p & 1)
			re = re * b % MOD;
		b = b * b % MOD;
		p >>= 1;
	}
	return re;
}

long long ncr(int a, int b) {
	return fac[a] * inv[b] % MOD * inv[a - b] % MOD;
}

int main() {
	fac[0] = inv[0] = 1;
	for (int i = 1; i < 300005; i++)
		inv[i] = po(fac[i] = fac[i - 1] * i % MOD, MOD - 2);
	scanf("%d%lld%lld%lld", &n, &a, &b, &k);
	for (int i = 0; i * a <= k && i <= n; i++) {
		ta = k - i * a;
		if (ta % b == 0) {
			ta /= b;
			if (ta <= n)
				ans = (ans + ncr(n, i) * ncr(n, ta)) % MOD;
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 4992
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

H, W, K = map(int, input().split())

if W == 1:
    print(1)
    exit(0)


pattern = [0] * (W - 1)
total = 0
for i in range(2 ** (W - 1)):
    bit = format(i, 'b').zfill(W - 1)
    flag = True
    for j in range(W - 1):
        if j >= 1 and bit[j] == bit[j - 1] == "1":
            flag = False
    if flag:
        total += 1
        for j in range(W - 1):
            if bit[j] == "1":
                pattern[j] += 1

dp = [[0] * W for _ in range(H + 1)]
dp[0][0] = 1

for i in range(1, H + 1):
    for j in range(W):
        if j == 0:
            dp[i][j] += dp[i - 1][j + 1] * pattern[j]
            dp[i][j] %= 1000000007
            dp[i][j] += dp[i - 1][j] * (total - pattern[j])
            dp[i][j] %= 1000000007
        elif j == W - 1:
            dp[i][j] += dp[i - 1][j - 1] * pattern[j - 1]
            dp[i][j] %= 1000000007
            dp[i][j] += dp[i - 1][j] * (total - pattern[j - 1])
            dp[i][j] %= 1000000007
        else:
            dp[i][j] += dp[i - 1][j + 1] * pattern[j]
            dp[i][j] %= 1000000007
            dp[i][j] += dp[i - 1][j - 1] * pattern[j - 1]
            dp[i][j] %= 1000000007
            dp[i][j] += dp[i - 1][j] * (total - pattern[j - 1] - pattern[j])
            dp[i][j] %= 1000000007

print(dp[H][K - 1])


Measured memory_bytes: 63980
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    vector<pair<int,int> > b(m);
    for (int i=0;i<n;i++){
        cin >> a.at(i);
    }
    for (int i=0;i<m;i++){
        cin >> b[i].second >> b[i].first;

    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end(),greater<pair<int,int> >());


    int i=0;
    for(int j=0;j<m;j++){

        while(b[j].second){


            if(a[i]<b[j].first){
                a[i]=b[j].first;
            }
            else
            {i=n;

            }
            b[j].second--;
            if(i>n) b[j].second =0;
            if(b[j].second!=0) i++;
        }
        i++;
        if(i>n) break;
    }
    long long sum=0;
    for (int i=0;i<n;i++){
        sum+=a[i];
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 1408
// G++ MACro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){
  CIN(a,b);
  if(a<=0&&b>=0){COUT("Zero");return 0;}
  ll count=0;
  if(a<=0&&b<=0)count = a-b+1;
  SANKOU(count%2,Negative,Positive);

  return 0;
}


Measured memory_bytes: 256
def pythagorean_check(a, b, c)
    check_result =
        if a**2 == b**2 + c**2 || b**2 == a**2 + c**2 || c**2 == a**2 + b**2
            "YES"
        else
            "NO"
        end

    return check_result
end

DATA_NUM = gets.to_i
DATA_NUM.times do
    a, b, c = gets.chomp.split(' ').map!(&:to_i)
    puts pythagorean_check(a, b, c)
end

Measured memory_bytes: 6108
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    cin>>x;
    if(x>=1800) cout<<1<<endl;
       else  if(x>=1600) cout<<2<<endl;
        else  if(x>=1400) cout<<3<<endl;
         else  if(x>=1200) cout<<4<<endl;
          else  if(x>=1000) cout<<5<<endl;
           else  if(x>=800) cout<<6<<endl;
            else  if(x>=600) cout<<7<<endl;
             else  if(x>=400) cout<<8<<endl;
}



Measured memory_bytes: 3584
//
// Numerical Integration (Adaptive Gauss--Lobatto--Kronrod)
//
// Description:
//   Gauss--Lobatto formula is a numerical integrator
//   that is accurate for polynomials of degree <= 2n+1.
//   Adaptive Gauss--Lobatto recursively divides the domain
//   and computes integral by using G-L formula.
//
// Algorithm:
//   Above.
//
// Complexity:
//   O(#pieces) for a piecewise polynomials.
//   In general, it converges in O(1/n^6) for smooth functions.
//
// Verified: 
//   AOJ 2034
//
// References:
//   R. T. Trimbitas, M. G. Trimbitas (2008):
//   Gauss-Lobatto-Kronrod formulae and adaptive numerical integration.
//   in Proceedings of the 10th International Symposium on 
//   Symbolic and Numeric Algorithms for Scientific Computing. pp. 183--186.
//
#include <iostream>
#include <vector>
#include <limits>
#include <cstdio>
#include <algorithm>
#include <functional>

using namespace std;

#define fst first
#define snd second
#define all(c) ((c).begin()), ((c).end())

// adaptive gauss-lobatto
template <class F>
double integrate(F f, double lo, double hi, double eps = 1e-8) {
  const double th = eps / 1e-14; // (= eps / machine_epsilon)
  function<double (double,double,double,double,int)> rec =
    [&](double x0, double x6, double y0, double y6, int d) {
    const double a = sqrt(2.0/3.0), b = 1.0 / sqrt(5.0);
    double x3 = (x0 + x6)/2, y3 = f(x3), h = (x6 - x0)/2;
    double x1 = x3-a*h, x2 = x3-b*h, x4 = x3+b*h, x5 = x3+a*h;
    double y1 = f(x1),  y2 = f(x2),  y4 = f(x4),  y5 = f(x5);
    double I1 = (y0+y6 + 5*(y2+y4)) * (h/6);
    double I2 = (77*(y0+y6) + 432*(y1+y5) + 625*(y2+y4) + 672*y3) * (h/1470);
    if (x3 + h == x3 || d > 50) return 0.0; 
    if (d > 4 && th + (I1-I2) == th) return I2;
    return (double)(rec(x0, x1, y0, y1, d+1) + rec(x1, x2, y1, y2, d+1) 
                  + rec(x2, x3, y2, y3, d+1) + rec(x3, x4, y3, y4, d+1) 
                  + rec(x4, x5, y4, y5, d+1) + rec(x5, x6, y5, y6, d+1));
  };
  return rec(lo, hi, f(lo), f(hi), 0);
}

int main() {
  for (int n; scanf("%d", &n); ) {
    if (n == 0) break;
    double r; 
    scanf("%lf\n", &r);

    vector<pair<double,double>> p(n);
    for (int i = 0; i < n; ++i) 
      scanf("%lf %lf", &p[i].fst, &p[i].snd);
    function<double (double)> f = [&](double x) {
      if (x < p[0].fst) return 0.0;
      if (x >= p.back().fst) return 0.0;
      for (int i = 0; i+1 < n; ++i) 
        if (x < p[i+1].fst) 
          return p[i].snd + (p[i+1].snd-p[i].snd)/(p[i+1].fst-p[i].fst)*(x-p[i].fst);
    };
    function<double (double)> g = [&](double x) {
      return f(x) * f(x + r);
    };
    printf("%.12f\n", integrate(g, p[0].fst-100, p.back().fst+100));
  }
}

Measured memory_bytes: 1244
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include<functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <stack>

#define LL long long
#define pii pair<int,int>
#define pLL pair<LL,LL>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<LL>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<LL>
#define vecpii vector<pii>
#define vecpLL vector<pLL>
#define vecbL vector<bool>
#define endl "\n"
#define REP(e,v) for(auto e:v)
#define rep(i, a, n) for(LL i = a; i < n;i++)

using namespace std;

int inp(){
	int x;
	scanf("%d",&x);
	return x;
}
LL linp(){
	LL x;
	scanf("%lld",&x);
	return x;
}

void outp(int i){
	printf("%d",i);
}

void loutp(LL i){
	printf("%lld",i);
}

LL mod(LL i){
	return i % 1000000007;
}


int gcd(int i,int j){
	if(j != 0)
		return gcd(j, i % j);
	else
		return i;

}

int tNoEP(){
	LL N,M;

	cin >> N >> M;

	loutp((N*(N-1))/2+(M*(M-1)/2));

	return 0;
}

bool isKaibun(string s){



	for(LL i = 0,j = s.length()-1; i < j;i++,j--){

		if(s[i] != s[j]) {
			return false;
		}

	}

	return true;
//	string rs = s;
//	reverse(s.begin(), s.end());
//
//	if(rs == s)
//		return true;
//	else
//		return false;
}

int SP(){

	string s;

	cin >> s;

	LL N = s.length();

	if(isKaibun(s) &&
			isKaibun(s.substr(0, (N-1)/2  )) &&
				isKaibun(s.substr((N+3)/2 -1 , N)))
		printf("Yes");
	else
		printf("No");

	return 0;

}

int MV(){

	LL L;

	cin >> L;

	double root = L/3.0;

	printf("%8.12f", root*root*root);

	return 0;
}
signed main() {

	//tNoEP();
	//SP();
	MV();
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int i, j, l=1, n, m, a, card[200], trade[200];

  scanf("%d%d", &n, &m);
  for(i=0 ; i<2*n ; i++) card[i] = trade[i] = i+1;

  for(i=0 ; i<m ; i++) {
    scanf("%d", &a);
    if(a==0) {
      trade[0] = card[0];
      trade[2*n-1] = card[2*n-1];
      for(j=1 ; j<n ; j++)
	trade[j+j] = card[j];
      for(j=2*n-2 ; j>=n ; j--)
	trade[j-l++] = card[j];
      for(j=0 ; j<2*n ; j++)
	card[j] = trade[j];
      l=1;
    } 
    if(1 <= a && a <= 2*n-1) {
      for(j=0 ; j<a ; j++)
	trade[j] = card[j];
      for(j=0 ; j<2*n-a ; j++)
      	card[j] = card[a+j];
      for(j=0 ; j<a ; j++)
	card[2*n-a+j] = trade[j];
    }
  }

  for(i=0 ; i<2*n ; i++) 
    printf("%d\n", card[i]);
  
  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1e5 + 5;
int main()
{
    ios::sync_with_stdio(false);
    string a , b; cin >> a >> b;
    int time = a.size() - b.size() + 1;
    int ans = 1e9 , cost;
    for (int i = 1 ; i <= time ; i++){
        cost = 0;
        for (int j = 0 ; j < b.size() ; j++){
            if (b[j] != a[j + i - 1]) cost++;
        }
        ans = min (ans , cost);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		String s = sc.next();
		String t = sc.next();
		String[] a = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "n", "m", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
		int[] x = new int[s.length()];
		int[] y = new int[t.length()];
		String ans = "No";
		
		for (int i = 0; i < s.length(); i++) {
			for (int j = 0; j < 26; j++) {
				if (a[j].equals(s.substring(i, i + 1))) {
					x[i] = j;
				}
			}
		}

		for (int i = 0; i < t.length(); i++) {
			for (int j = 0; j < 26; j++) {
				if (a[j].equals(t.substring(i, i + 1))) {
					y[i] = j;
				}
			}
		}
		
		Arrays.sort(x);
		Arrays.sort(y);
		
		if (x[0] < y[t.length() - 1]) {
			ans = "Yes";
		} else if (x[0] == y[t.length() - 1]) {
			if (s.length() < t.length()) {
				ans = "Yes";
				for (int i = 1; i < s.length(); i++) {
					if (x[i] != y[t.length() - (1 + i)]) {
						ans = "No";
						break;
					}
				}
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 21972
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**5+5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


n,m=map(int,input().split())
A=factorization(m)
ans=1
if m==1:
  print(ans)
else:
  for i in range(len(A)):
    ans=ans*cmb(n+A[i][1]-1,A[i][1],mod)
  print(ans%(10**9+7))

Measured memory_bytes: 27096
N = int(input())
nums = [int(s) for s in input().split()]
i = 0
cnt = 0
while True:
    if i == N:
        i = 0
        cnt += 1
    if nums[i % N] % 2 == 1:
        break
    nums[i % N] //= 2
    i += 1
print(cnt)

Measured memory_bytes: 9124
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin>>A>>B;
  
  if(A==B){
    cout<<"Draw"<<endl;
  }
  
  else if(A==1){
cout<<"Alice"<<endl;
  }
else if(B==1){
cout<<"Bob"<<endl;
}
  else if(A>B){
cout<<"Alice"<<endl;
  }
  
  else if(A<B){
cout<<"Bob"<<endl;
  }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int w = sc.nextInt();
			int d = sc.nextInt();
			if(w==0 && d==0) break;
			int sum = 0;
			ArrayList<Integer> list = new ArrayList<Integer>();
			for(int i=0;i<w;i++){
				int h = sc.nextInt();
				sum += h;
				list.add(h);
			}
			for(int i=0;i<d;i++){
				int h = sc.nextInt();
				if(list.contains(h)) list.remove(list.indexOf(h));
				else sum += h;
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 23276
#include <stdio.h>
#include <iostream>
#include <queue>
#include <cstdio>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string.h>
#include <limits.h>
#include <map>
#include <string>
#include <bitset>
#include <vector>
using namespace std;
int a[200005];
int main() {
    int k,n,ans=0;
    cin>>k>>n;
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=n;i++) ans=max(ans,a[i+1]-a[i]);
    ans=max(ans,k-a[n]+a[1]);
    printf("%d\n",k-ans);
    return 0;
}


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

typedef long long ll;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint choose(int n,int k){
    mint x = 1, y = 1;
    for(int i=1;i<=k;i++){
        x *= n - (i - 1);
        y *= i;
    }
    return x / y;
}

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

    int n,a,b;
    cin >> n >> a >> b;
    mint ans = mint(2).pow(n) - 1 - choose(n,a) - choose(n,b);
    cout << ans.x << endl;
    return 0;
}

Measured memory_bytes: 256
//-----------------------------------------------------------
// すぐ使える
//-----------------------------------------------------------
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
		// 1行、2つ(複数)数字
		String[] ss0 = br.readLine().trim().split(" ", 0);
		int N = Integer.parseInt(ss0[0]);
		int M = Integer.parseInt(ss0[1]);

		// 1行目個数、2行目以降文字列を配列に格納
		Integer[] a = new Integer[N];
		Integer[] b = new Integer[N];
		Integer[] ans = new Integer[N];
		for(int i = 0; i < N; i++){
			ss0 = br.readLine().trim().split(" ", 0);
			a[i] = Integer.parseInt(ss0[0]);
			b[i] = Integer.parseInt(ss0[1]);
		}

		Integer[] c = new Integer[M];
		Integer[] d = new Integer[M];
		for(int i = 0; i < M; i++){
			ss0 = br.readLine().trim().split(" ", 0);
			c[i] = Integer.parseInt(ss0[0]);
			d[i] = Integer.parseInt(ss0[1]);
		}

		int m = 0;  //マンハッタン距離を保持
		int min = 0;  //最小のマンハッタン距離
		for(int i = 0; i < N; i++){
			min = Integer.MAX_VALUE;
			for(int j = 0; j < M; j++){
				m = Math.abs(a[i]-c[j]) + Math.abs(b[i]-d[j]);
				if (Math.abs(min) > Math.abs(m)) {
					ans[i] = j+1;
					min = m;
				}
			}
		}

		//
		for(int i = 0; i < N; i++){
			System.out.println(ans[i]);
		}

		return;
    }

}

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



Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
int main (){
	int L;
	int N;
	int sum=0;
	int a;
	int b=1000000;
	scanf("%d %d",&N,&L);
	for(int i = 1; i <= N; i++ ){
		a=0;
		a=L+i-1;
		sum+=a;
		if(abs(a)<abs(b)){
			b=a;
		}
	}
	printf("%d",sum-b);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, a;
  in(n);
  a = 0;
  vector<ll> c(n);
  rep(i, n)
    in(c[i]);
  sort(all(c));
  rep(i, n - 1)
    a += c[i];
  if(a > c[n - 1])
    out("Yes");
  else
    out("No");
  memi;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int INF = 1e9;
const int MXG = 410;

int gcd(int x, int y) {
	if (y==0) return x;
	return gcd(y, x%y);
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, ma, mb;
	cin >> n >> ma >> mb;
	int a[n][3];
	for (int i=0; i<n; i++)
		for (int j=0; j<3; j++)
			cin >> a[i][j];
	int ans = INF;
	vector<vector<vector<int>>> dp(n+1, vector<vector<int>>(MXG, vector<int>(MXG, INF)));
	dp[0][0][0] = 0;
	
	for (int i=0; i<n; i++) {
		for (int j=0; j<MXG; j++) {
			for (int k=0; k<MXG; k++) {
				if (dp[i][j][k] == INF) continue;
				int ra, rb;
				if (i && j) {
					int g = gcd(j, k);
					ra = j/g;
					rb = k/g;
					if (ra == ma && rb == mb) ans = min(ans, dp[i][j][k]);
				}
//				cout << g << ' ' << i << ' ' << j << ' ' << k << ' ' << dp[i][j][k] << '\n';
				dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k]);
				ra = j+a[i][0]; rb = k+a[i][1];
				dp[i+1][ra][rb] = min(dp[i+1][ra][rb], dp[i][j][k] + a[i][2]);
			}
		}
	}
	for (int j=1; j<MXG; j++) {
		for (int k=1; k<MXG; k++) {
			int g = gcd(j, k);
			int ra = j/g;
			int rb = k/g;
			if (ra == ma && rb == mb) ans = min(ans, dp[n][j][k]);
		}
	}
	if (ans == INF) cout << -1;
	else cout << ans;
}

Measured memory_bytes: 28416
n=int(input())
arr=[1]
from math import sqrt as S 
for i in range(2,int(S(n))+1):
    if n%i==0: 
        arr.append(i)
mini=10**20 
for a in arr: 
    b=n//a 
    mini=min(mini,a+b-2)
print(mini)

Measured memory_bytes: 40172
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

int main(){

 long long n,x;
  cin>>n;

  int a[n+1];
  for(int i=1;i<=n;i++){
    cin>>x;
    a[x] = i;
  }

  for(int i=1;i<=n;i++)
    cout<<a[i]<<" ";

  cout<<endl;

 return 0;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;
const int mod = 1000000007;

class mint{
  public:
  ll x;
  mint(ll x = 0):x((x % mod + mod) % mod){};
  mint pow(ll y) const {
    mint res(1);
    mint a(x);
    while(y>0){
      if(y&1) res *= a;
      a *= a;
      y >>= 1;
    }
    return res;
  }
  mint inv() const{ return pow(mod-2); }
  mint& operator+= (const mint a) noexcept {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-= (const mint a) noexcept {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*= (const mint a) noexcept {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/= (const mint a) noexcept {
    return (*this) *= a.inv();
  }
  mint operator+ (const mint a) const noexcept {
    mint res(*this);
    return res += a;
  }
  mint operator- (const mint a) const noexcept {
    mint res(*this);
    return res -= a;
  }
  mint operator* (const mint a) const noexcept {
    mint res(*this);
    return res *= a;
  }
  mint operator/ (const mint a) const noexcept{
    mint res(*this);
    return res /= a;
  }
};

class comb{
  public:
  vector<mint> fact, ifact;
  comb(int n): fact(n+1), ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k) const noexcept{
    if(k < 0 || n < k) return 0;
    return fact[n] * ifact[k] * ifact[n-k];
  }
};

int main(void){
  int n, k;
  cin >> n >> k;
  comb c(n);
  mint ans = 0;
  int m = (n < k) ? n : k+1;
  REP(i, m){
    ans += c(n, i) * c(n-1, i);
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))


int main(){
	int N;
	cin >> N;
	set<int> se;
	FOR(i,0,N){
		int k;
		cin >> k;
		se.insert(k);
	}
	cout << se.size() << endl;
}


Measured memory_bytes: 7756
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

X = I()
if X < 600:
    print(8)
else:
    print(10-X//200)


Measured memory_bytes: 61772