akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    ll k;
    cin>>k;
    if(k%2==0||k%5==0){
        cout<<-1<<endl;
        return 0;
    }
    if(k==1||k==7){
        cout<<1<<endl;
        return 0;
    }
    ll a = 7;
    ll ans = 1;
    while(true){
        a*=10;
        a%=k;
        a+=7;
        a%=k;
        ans++;
        if(a%k==0){
            cout<<ans<<endl;
            return 0;
        }

    }






    
return 0;
}


Measured memory_bytes: 3624
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int judge(char *c_d,char *c_o,int *d_d,int *d_o,int N);
char delete(char *c,int l);
void swap (char *x, char *y);

int main() {
  int N,i,j,flag,tmpi;
  scanf("%d",&N);

  char c[N],c_d[N][3],c_b[N][3],c_s[N][3],d[N],tmpc[N];
  int d_b[N],d_s[N],d_d[N];




  for(i=0;i<N;i++){
    
    scanf("%s",d);
    strcpy(c,d);
    

    delete(c,strlen(d));

    
    
    d_d[i]=atoi(c);
    d_b[i]=atoi(c);
    d_s[i]=atoi(c);
    strcpy(c_d[i],d);
    strcpy(c_b[i],d);
    strcpy(c_s[i],d);
    
    
    
  }

  /*test
  printf("test");
  for(i=0;i<N;i++){
    printf(" %d",d_d[i]);
  }

  printf("\n");
  */

  
  //BubbleSort
  for(i=0; i<=N-1; i++){
    for(j= N-1; j>=i+1; j--){
      if(d_b[j] < d_b[j-1]){
	tmpi = d_b[j];
	d_b[j] = d_b[j-1];
	d_b[j-1] = tmpi;
	
	strcpy(tmpc, c_b[j]);
	strcpy(c_b[j],c_b[j-1]);
	strcpy(c_b[j-1], tmpc);
	
	//swap(&(c_b[j]),&(c_b[j-1]));
	
	
      }
    }
  }
  
  //SelectionSort
  for(i=0;i<=N-1;i++){
    int minj;
    minj = i;
    for(j=i; j<=N-1; j++){
      if(d_s[j] < d_s[minj]){
	minj = j;
      }
    }
    tmpi = d_s[i];
    d_s[i] = d_s[minj];
    d_s[minj] = tmpi;

    strcpy(tmpc, c_s[i]);
    if(i!=minj) strcpy(c_s[i],c_s[minj]);
    strcpy(c_s[minj], tmpc);

    

    //swap(&(c_s[j]),&(c_s[j-1]));
    
  }
  
  for(i=0;i<=N-1;i++){
    if(i==0) {
      printf("%s",c_b[i]);
    }
    else{
    printf(" %s",c_b[i]);
    }
  }
  printf("\n");
  
  flag = 0;
  for(i=0;i<N;i++){
    if(strcmp(c_b[i],c_b[i])!=0){
      flag=1;
      }
  }
  if(flag==0){
    printf("Stable\n");
  }
  else printf("Not stable\n");

  for(i=0;i<=N-1;i++){
    if(i==0) printf("%s",c_s[i]);
    else printf(" %s",c_s[i]);
  }
  printf("\n");
  
  flag = 0;
  for(i=0;i<N;i++){
    if(strcmp(c_s[i],c_b[i])!=0){
      flag=1;
    }
  }
  if(flag==0){
    printf("Stable\n");
  }
  else printf("Not stable\n");

  return 0;
}

int judge(char *c_d,char *c_o,int *d_d,int *d_o,int N){
  int i,j,a,b;

  for(i=0; i<=N-1; i++){
    for(j=i+1; j<=N-1; j++){
      for(a=0; a<=N-1; a++){
	for(b=a+1; b<=N-1; b++){
	  if(d_d[i]==d_o[i] && c_d[a] == c_o[b] && c_d[j] == c_o[a]){
	    return -1;
	  }
	}
      }
    }
  }
  return 1;
}

char delete(char *c,int l){
  int i;
  for(i=0;i<l-1;i++){
    c[i]=c[i+1];
    c[i+1]='\0';
  }

  return *c;
}
  

void swap (char *x, char *y) {
  char temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}
  
  
    
	
  
  
  
  



Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
#define MAX 100000

int main(){
    int a,b,l,m,n=10,ans=1;
    cin>>a>>b;
    l=b;
    for(;l>=10;){
        l/=10;
        n*=10;
    }
    m=a*n+b;
    for(int i=1;i<m;i++){
        if(m%i==0 and m/i==i) ans=-1;
    }
    if(ans<0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<int> R;
  vector<int> G;
  vector<int> B;
  for(int i = 0; i < N; i++) {
    if (S.at(i) == 'R') {
      R.push_back(i);
    }
    else if (S.at(i) == 'G') {
      G.push_back(i);
    }
    else {
      B.push_back(i);
    }
  }
  int count = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; 2 * j < i + N; j++) {
      if (S.at(i) != S.at(j) && S.at(j) != S.at(2 * j - i) && S.at(i) != S.at(2 * j - i)) {
        count += 1;
      }
    }
  }
  cout << R.size() * B.size() * G.size() - count << endl;    
}

Measured memory_bytes: 3672
import Control.Monad        -- unless, replicateM
import Control.Applicative  -- <$>
import Data.List            -- sort, group

main :: IO ()
main = do
  [m,t,p,r] <- (map read . words) <$> getLine
  unless (m == 0 && t == 0 && p == 0 && r == 0) $ do
    ds <- replicateM r ((map read . words) <$> getLine)
    putStrLn . ranking t $ ds
    main

{-
   [[m,t,p,j] | m - elapsed time
                t - team
                p - problem
                j - judge (0 = accepted)]
 -}
type Log = [[Int]]

-- Result team solved total
data Result = Result Int Int Int deriving Show
instance Eq Result where
  (Result t s total) == (Result t' s' total') = s == s' && total == total'
instance Ord Result where
  compare (Result t s total) (Result t' s' total')
    | s > s' = LT
    | s < s' = GT
    | total < total' = LT
    | total > total' = GT
    | otherwise = EQ


ranking ::  Int -> Log -> String
ranking nt ds = join ',' . map (join '=' . reverse . map (show . team)) .
  group . sort $ [accum t ds | t<-[1..nt]]
  where
    team (Result t s total) = t
    join :: Char -> [String] -> String
    join c [x]    = x
    join c (x:xs) = x ++ [c] ++ join c xs

accum :: Int -> Log -> Result
accum team ds = Result team (length solved) total
  where
    ts      = [d | d<-ds, d!!1 == team]   -- log for the team
    correct = [d | d<-ts, d!!3 == 0]      -- accepted submissions
    wrong   = [d | d<-ts, d!!3 /= 0]
    solved  = map (!!2) correct           -- solved problems
    consumed p =                          -- consumed time for a problem
      head [d!!0 | d<-correct, d!!2 == p]
      + (length [d | d<-wrong, d!!2 == p]) * 20
    total   = sum . map consumed $ solved -- total consumed time

Measured memory_bytes: 7612
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;
typedef long long ll;

int main(){
  int X;
  cin >> X;
  int ans=0;
  int x;
  x = X % 500;
  ans += 1000 * (X/500);
  ans += 5 * (x/5);
  cout << ans << endl;
}


Measured memory_bytes: 3608
//
// Created by Harshit on 21-08-2020.
//

//
// Created by Harshit on 21-08-2020.
//
#include "bits/stdc++.h"
using namespace std;
int main(){
    int n;
    cin>>n;
    vector <double> pro(n);
    vector <double> dp(n+1,0.0);

    vector <double> new_dp;
    for(int i=0;i<n;i++)
        cin>>pro[i];

    dp[0]=1-pro[0];
    dp[1]=pro[0];

    for(int i=1;i<n;i++){
        new_dp.assign(n+1,0.0000);
        for(int j=0;j<=n;j++){
            if(j>i+1)
                new_dp[j]=0;
            else{
                new_dp[j]+=(double)(dp[j]*(1.0-pro[i]));
                if(j>0)
                    new_dp[j]+=(double)(dp[j-1]*pro[i]);
            }
        }
        dp=new_dp;
    }
    double res=0;

    for(int i=0;i<=n;i++){
        if(n-i<i){
            res+=dp[i];
        }
    }
    cout<<setprecision(20);
    cout<<res<<endl;

}



Measured memory_bytes: 3864
sx,sy,tx,ty=map(int,input().split())
x=abs(tx-sx)
y=(ty-sy)
ans=''
for _ in range(x):
    ans=ans+'R'
for _ in range(y):
    ans=ans+'U'
for _ in range(x):
    ans=ans+'L'
for _ in range(y):
    ans=ans+'D'
ans=ans+'L'
for _ in range(y+1):
    ans=ans+'U'
for _ in range(x+1):
    ans=ans+'R'
ans=ans+'DR'
for _ in range(y+1):
    ans=ans+'D'
for _ in range(x+1):
    ans=ans+'L'
ans=ans+'U'
print(ans)

Measured memory_bytes: 3064
input_data = [input() for i in range(3)]

ball_kinds = input_data[0].split(' ')
ball_counts = [int(i) for i in input_data[1].split(' ')]
target_ball = input_data[2]

for i in range(2):
    if ball_kinds[i] == target_ball:
        ball_counts[i] = ball_counts[i] - 1

print('{} {}'.format(ball_counts[0], ball_counts[1]))

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

int main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    int ans=0;
    for(int i=0;i<N;i++){
        set<char> s;
        for(int j=0;j<i;j++){
            for(int k=S.size()-1;k>=i;k--){
                if(S[j]==S[k]) s.insert(S[j]);
            }
        }
        int res=s.size();
        ans=max(ans,res);
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, begin, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<int>> A(N, vector<int>(30, 0));
    rep(i, 0, N)
    {
        int K;
        cin >> K;
        rep(j, 0, K)
        {
            int a;
            cin >> a;
            A.at(i).at(a - 1) = 1;
        }
    }
    int ans = 0;
    int f;
    rep(i, 0, 30)
    {
        f = 1;
        rep(j, 0, N)
        {
            if (A.at(j).at(i) != 1)
            {
                f = 0;
            }
        }
        if (f)
        {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
typedef long long ll;
const ll mod = 1000000;
const double pi = acos(-1);
double polar;

void rotate(double &x,double &y,double theta){
  double tx=x,ty=y;
  x=tx*cos(theta)-ty*sin(theta);
  y=tx*sin(theta)+ty*cos(theta);
}

double getAngle(int month,int day,int hour,int minute){
  static double unit=((1+1/365.24)*360)/(24*60);
  static int daylist[]={31,29,31,30,31,30,31,31,30,31,30,31};
  double daytotal=0;
  rep(i,12){
    if (month == i+1)break;
    daytotal+=daylist[i];
  }
  daytotal+=day-1;
  return (daytotal*60*24+hour*60+minute)*unit;
}

bool isok(vector<double> &x,vector<double> &y,vector<double> &z,double angle){
  int n=x.size();
  rep(i,n){
    rotate(x[i],z[i],pi/2-polar);
  }
  rep(i,n){
    rotate(x[i],y[i],angle);
  }
  rep(i,n){
    rotate(x[i],z[i],-(pi/2-polar));
  }
  //rep(i,n)cout << z[i] <<" ";cout << endl;

  rep(i,n){
    double ang=asin(z[i]);
    if (ang < 0.0)return false;
  }
  return true;
}

main(){
  polar=43.2/180*pi;
  int te;
  cin>>te;
  while(te--){
    int month,day,hour,minute;
    char dummy;
    cin>>month>>dummy>>day>>hour>>dummy>>minute;
    double angle=getAngle(month,day,hour,minute);
    angle=angle/180*pi;
    int n;
    cin>>n;
    rep(i,n){
      string name;int m;
      cin>>name>>m;
      vector<double> x(m),y(m),z(m);
      rep(j,m){
	double ang,h;
	cin>>ang>>h;
	ang=ang;
	ang=ang/180*pi;
	h=h/180*pi;
	z[j]=sin(h);
	x[j]=cos(h)*cos(ang);
	y[j]=cos(h)*sin(ang);
	//cout << sqrt(x[j]*x[j]+y[j]*y[j]+z[j]*z[j]) << endl;
      }
      //cout <<"check " << name << endl;
      if (isok(x,y,z,angle))cout << name << endl;
    }
    //cout <<"tc end " <<  endl << endl;
  }
  return false;
}

Measured memory_bytes: 988
import heapq
n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x: x*(-1), A))
heapq.heapify(A)
for i in range(m):
    t = heapq.heappop(A)*(-1)
    heapq.heappush(A, (t//2)*(-1))
print((-1) * sum(A))

Measured memory_bytes: 14180
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <stack>
#include <cstring>
#include <set>
#include <map>
#include <climits>
#include <cassert>
using namespace std;

int main() {
	stack<int> S;
	int a, b, x;
	string s;

	while (cin >> s) {
		if (s[0] == '+') {
			a = S.top(); S.pop();
			b = S.top(); S.pop();
			S.push(a + b);
		}
		else if (s[0] == '-') {
			b = S.top(); S.pop();
			a = S.top(); S.pop();
			S.push(a - b);
		}
		else if (s[0] == '*') {
			a = S.top(); S.pop();
			b = S.top(); S.pop();
			S.push(a*b);
		}
		else {
			S.push(atoi(s.c_str()));
		}
	}
	cout << S.top() << endl;
}

Measured memory_bytes: 3208
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int64_t, int64_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N;
  cin >> N;
  int64_t sum = 0;
  for (int64_t i = 1; i <= N - 1; ++i) {
    sum += i;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b)	for(int i=a;i<=b;i++)
using namespace std;
const int N=2e3+5;
int n,k,Q,a[N],f[N][N];
priority_queue<int> q;
vector<int> v;
bool check(int pos)
{
	int mn=a[pos];
	for(int i=max(1,pos-k+1);i<=pos;i++)
	{
		if(i+k-1>n)	return false;
		if(f[i][k]==mn)
			return true;
	}
	return false;
}
void update()
{
	while(!q.empty())
	{	
		if(q.size()>=k)
			v.push_back(-q.top());
		q.pop();
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>k>>Q; 
	for(int i=1;i<=n;i++)	cin>>a[i];
	if(Q==1)
	{
		cout<<0<<'\n';
		return 0;
	}
	for(int i=1;i<=n;i++)
	{
		f[i][1]=a[i];
		for(int j=i+1;j<=n;j++)
			f[i][j-i+1]=min(f[i][j-i],a[j]);
	}
	int res=2e9;
	for(int i=1;i<=n;i++)
	{
		if(!check(i))	continue;
		int mn=a[i];
		for(int j=1;j<=n;j++)
		{
			if(j==i)	continue;
			if(a[j]>=mn)
				q.push(-a[j]);
			else
				update();	
		}
		update();
		if(v.size()>=1)
			sort(v.begin(),v.end());
		if(v.size()>=Q-1)
			res=min(res,v[Q-2]-mn);
		v.clear();
	}
	cout<<res<<'\n';
	return 0;
} 

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

int main() {
  int A,B;
  cin >> A >> B;
  int upper,lower;
  if(A * 12.5 < B * 10.0){
	upper = ceil(B*10);
    lower = floor(A*12.5);
  }else{
    upper = ceil(A*12.5);
    lower = floor(B*10);
  }
  
  for(int i=lower;i<=upper;i++){
    if(floor(i*0.08) == A && floor(i*0.1) == B){
      cout << i << endl;
      return(0);
    }
  }
  
  cout << "-1" << endl;
  return(0);
}

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

typedef long long ll;
const ll MOD = 1000000007;
const int K = 1 << 20;
const int MAX_N = 5e5;
int n;
int A[MAX_N + 1];
int X[MAX_N + 1];
int zero[MAX_N + 1];
vector<int> occur[K];

ll power(ll a, int n) {
    ll ans = 1;
    while (n > 0) {
        if (n % 2 == 1)
            ans = ans * a % MOD;
        a = a * a % MOD;
        n /= 2;
    }
    return ans;
}

ll dp[MAX_N + 1];
ll func(int i) {
    if (i == 0)
        return power(2ll, (int)occur[i].size() - 1);
    dp[0] = 0;
    ll sumdp = 0;
    ll sumdp2 = 0;
    for (int j = 1; j <= (int)occur[i].size(); j++) {
        int x = occur[i][j - 1];
        dp[j] = 1;
        if (j > 1)
            sumdp2 = (sumdp2 + sumdp * (zero[x] - zero[occur[i][j - 2]])) % MOD;
        dp[j] = (1 + sumdp2) % MOD;
        sumdp = (sumdp + dp[j]) % MOD;
    }
    if (occur[i].back() == n)
        return dp[(int)occur[i].size()];
    else
        return sumdp;
}

int main() {
    cin >> n;
    X[0] = 0;
    zero[0] = 0;
    for (int i = 1; i <= n; i++) {
        cin >> A[i];
        X[i] = X[i - 1] ^ A[i];
        zero[i] = zero[i - 1] + (X[i] == 0);
        occur[X[i]].push_back(i);
    }
    
    if (X[n] != 0)
        cout << func(X[n]) << "\n";
    else {
        ll ans = 0;
        for (int i = 0; i < K; i++)
            if (!occur[i].empty())
                ans = (ans + func(i)) % MOD;
        cout << ans << "\n";
    }
}


Measured memory_bytes: 42228
use std::io::Read;
use std::collections::VecDeque;
use std::cmp::max;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let h: isize = iterator.next().unwrap().parse().unwrap();
    let w: isize = iterator.next().unwrap().parse().unwrap();
    let mut map: Vec<Vec<char>> = Vec::new();
    for _ in 0..h {
        let line: Vec<char> = iterator.next().unwrap().chars().collect();
        map.push(line);
    }

    let di: Vec<isize> = vec![-1, 1, 0, 0];
    let dj: Vec<isize> = vec![0, 0, -1, 1];

    let mut ans: isize = 0;
    for i in 0..h {
        for j in 0..w {
            if map[i as usize][j as usize] == '#' {
                continue;
            }

            let mut d: Vec<Vec<isize>> = vec![vec![-1; w as usize]; h as usize];
            let mut q: VecDeque<(isize, isize)> = VecDeque::new();
            d[i as usize][j as usize] = 0;
            q.push_back((i, j));
            let mut dmax = 0;
            while !q.is_empty() {
                let (ci, cj) = q.pop_front().unwrap();
                for k in 0..4 {
                    let ni = ci + di[k];
                    let nj = cj + dj[k];
                    if ni < 0 || ni >= h || nj < 0 || nj >= w {
                        continue;
                    }
                    if map[ni as usize][nj as usize] == '#' {
                        continue;
                    }
                    if d[ni as usize][nj as usize] != -1 {
                        continue;
                    }
                    d[ni as usize][nj as usize] = d[ci as usize][cj as usize] + 1;
                    dmax = max(dmax, d[ni as usize][nj as usize]);
                    q.push_back((ni, nj));
                }
            }
            // println!("({}, {})", i, j);
            // for dl in d {
            //     println!("{:?}", dl);
            // }
            ans = max(ans, dmax);
        }
    }

    return ans.to_string();
}


Measured memory_bytes: 4352
/*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
	  	  	- William Butler Yeats
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#ifndef LOCAL
#define cerr if(0)cout
#endif
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int a,b;
int main(){
	cin>>a>>b;
	cout<<max(0,a-b-b)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int d[13][13];
  int x,y,s;
  int m=0,no=0;
  int i,j;
  for(i=0;i<13;i++){
    for(j=0;j<13;j++){
      d[i][j]=0;
    }
  }
  while((scanf("%d,%d,%d",&x,&y,&s))!=EOF){
    d[x+2][y+2]++;
    d[x+2][y+1]++;
    d[x+2][y+3]++;
    d[x+1][y+2]++;
    d[x+3][y+2]++;
    if(s!=1){
      d[x+1][y+1]++;
      d[x+1][y+3]++;
      d[x+3][y+1]++;
      d[x+3][y+3]++;
      if(s==3){
	d[x+2][y]++;
	d[x+2][y+4]++;
	d[x][y+2]++;
	d[x+4][y+2]++;
      }
    }
  }
  for(i=2;i<12;i++){
    for(j=2;j<12;j++){
      if(m<d[i][j]){
	m=d[i][j];
      }
      if(d[i][j]==0){
	no++;
      }
    }
  }
  printf("%d\n",no);
  printf("%d\n",m);
  return 0;
}

Measured memory_bytes: 596
#pragma GCC optimize ("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
const int mod = 1e9+7;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define Pr(type) priority_queue<type>
#define gPr(type) priority_queue<type,vector<type>,greater<type>>
#define V(type) vector<type>
#define rep(i,n) for(int i=0; i<n; i++)
#define rer(i,st,en) for(int i=st; i<en; i++)
#define gnr(i,l,r) for(int i=int(r)-1; i>=int(l); i--)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) rep(i,n-1)cout<<a[i]<<' '; cout<<a[n-1]<<'\n'
#define prip(p) cout<<p.first<<' '<<p.second<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

Int n,m,_,x,y,q;
string s,sb;
bool ok;
char ch;


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

  cin>>n>>m;
  int a[n]; rep(i,n)cin>>a[i];
  int ans=0;
  rep(i,n)ans+=(a[i]>=m);
  END
}

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

int main(void){
    ll N; cin>>N;
    for(ll i=1;i<=9;i++){
        for(ll j=0;j<=9;j++){
            if(i*j==N){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
h,w = map(int,input().strip().split(' '))
data = [input() for i in range(h)]

for i in range(h):
    data[i] = list(data[i])

dxy =[(-1,0),(-1,-1),(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,1)]

ans = [[ 0 for i in range(w)] for j in range(h)] 

for x in range(h):
    for y in range(w):
        if data[x][y] == '#':
            ans[x][y] = '#'
            continue
            
        c = 0
        for dx, dy in dxy:
            if x+dx < 0 or x+dx > h-1 or y+dy < 0 or y+dy > w-1:
                continue
            if data[x+dx][y+dy] == '#':
                c += 1
        
        ans[x][y] = c
        
for row in ans:
    print(''.join(list(map(str,row))))

Measured memory_bytes: 3064
mod = 1000000007
x, y = map(int, input().split())
x, y = min(x, y), max(x, y)

if 2*x < y or (2*x-y)%3 != 0:
  print(0)
else:
  b = (2*x-y)//3
  a = x-2*b
  afact, bfact, abfact = 1, 1, 1
  for i in range(1, a+1):
    afact = (afact * i)%mod
  for i in range(1, b+1):
    bfact = (bfact * i)%mod
  for i in range(1, a+b+1):
    abfact = (abfact * i)%mod
    
  print((abfact * pow(afact, mod-2, mod) * pow(bfact, mod-2, mod))%mod)

Measured memory_bytes: 40556
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

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

using ll = long long;
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	int l[50];
	cin >> n >> k;
	REP(i,n){
		cin >> l[i];
	}
	sort(begin(l), begin(l) + n);
	int sum = 0;
	for(int i = n - 1; i > n - k - 1; --i){
		sum += l[i];
	}
	cout << sum << "\n";
	return 0;
}


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

int minNumCoin[50050];

int main(void)
{
    int n, m;
    cin >> n >> m;
    vector<int> c(m);
    rep(i, m) cin >> c[i];

    rep(i, n+1) minNumCoin[i] = 1e9;
    rep(i, m) minNumCoin[c[i]] = 1;

    rep(i, n+1) {
        rep(j, m) {
            if(i - c[j] >= 0) minNumCoin[i] = min(minNumCoin[i], minNumCoin[i-c[j]] + 1);
        }
    }
    cout << minNumCoin[n] << endl;
    return 0;
}


Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
char s1[100005];
int main()
{
	scanf("%s",s1);
	int n=strlen(s1);
	int num=1;
	int ans=0;
	for(int i=1;i<n;i++)
	{
		if(s1[i]=='g' && num)
		{
			num--;
			ans++;
		}
		else if(s1[i]=='g')
		{
			num++;
		}
		else if(s1[i]=='p' && num)
		{
			num--;
		}
		else
		{
			num++;
			ans--;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

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

int main() {
  ll n;
  cin >> n;
  ll sum = 0;
  for(int a = 1; a <= n; a++) {
    for(int b = 1; b <= n; b++) {
      for(int c = 1; c <= n; c++) {
        sum += gcd(gcd(a, b), c);
      }
    }
  }
  cout << sum;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>

#include <utility>
using std::pair;
#include <string>
using std::string;
#include <vector>
using std::vector;
#include <map>
using std::map;
#include <unordered_map>
using std::unordered_map;
#include <set>
using std::set;
#include <unordered_set>
using std::unordered_set;
#include <deque>
using std::deque;
#include <queue>
using std::priority_queue;

using std::cin;
using std::cout;
using std::endl;


inline void print(const vector<int> & V) {
    for (auto v:V) printf("%d ",v);
    printf("\n");
}

int main() {
    int N;
    cin >> N;
    vector<pair<pair<string, int>,int> > V(N);
    for (int i=0;i<N;++i) {
        string s;
        int t;
        cin >> s >> t;
        V[i] = make_pair(make_pair(s,-t),i);
    }
    std::sort(begin(V),end(V));
    for (auto & v : V) printf("%d\n",v.second+1);


	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int dis[20000 + 3][20000 + 3];
int main(){
	int n,m,q,x,y;
	scanf("%d%d%d",&n,&m,&q);
	for(int i = 1;i <= m;i++){
		scanf("%d%d",&x,&y);
		dis[x][y]++;
	}
	for(int i = 1;i <= n;i++){
		for(int j = i + 1;j <= n;j++){
			dis[i][j] += dis[i][j - 1];
		}
	}
	for(int i = 1;i <= n;i++){
		for(int j = i - 1;j >= 1;j--){
			dis[j][i] += dis[j + 1][i];
		}
	}
	for(int i = 1;i <= q;i++){
		scanf("%d%d",&x,&y);
		printf("%d\n",dis[x][y]);
	}
	return 0;
}

Measured memory_bytes: 39936
#include <iostream>
#include <vector>
#include <unordered_map>
#include <string>
using namespace std;

int main() {

    uint N;
    cin >> N;
    unordered_map<string, int> S;
    for(uint i=0; i<N; ++i) {
        string key;
        cin >> key;
        if (S.find(key) == S.end())
            S[key] = 1;
        else
            ++S[key];
    }

    uint M;
    cin >> M;
    unordered_map<string, int> T;
    for(uint i=0; i<M; ++i) {
        string key;
        cin >> key;
        if (T.find(key) == T.end())
            T[key] = 1;
        else
            ++T[key];
    }

    int scoreMax = 0;
    for (auto& p: S) {
        int score = p.second;
        string key = p.first;
        if (T.find(key) != T.end())
            score -= T[key];
        if (score > scoreMax) {
            scoreMax = score;
        }
    }

    if (scoreMax > 0)
        cout << scoreMax << endl;
    else
        cout << 0 << endl;
}


Measured memory_bytes: 3568
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	debug("debug test\n");
   	int n,m;
	cin>>n;
	if(n < 1200){
		cout << "ABC"<< endl;
	}else if(n < 2800){
		cout << "ARC"<< endl;

	}else{
		cout << "AGC"<< endl;

	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>


using namespace std;
using ll = long long;

template<typename T> void print(T t) { cout << t << endl; }

int main() {
	int N, X;
	cin >> N;
	vector<int> xs(N+1);
	for (auto& x : xs)  cin >> x;
	sort(xs.begin(), xs.end());
	int D = xs[1] - xs[0];
	for (int i = 1; i < N; i++) {
		D = gcd(D, xs[i + 1] - xs[i]);
	}
	print(D);
}

Measured memory_bytes: 3708
ARG_N = gets.to_i
ARG_H = gets.split.map(&:to_i)

dp = Array.new(ARG_N)
dp[0] = 0

ARG_N.times do |n|
  if n >= 1
    dp[n] = dp[n-1] + (ARG_H[n] - ARG_H[n-1]).abs
  end
  if n >= 2
    dp[n] = [dp[n], dp[n-2] + (ARG_H[n] - ARG_H[n-2]).abs].min
  end
end

puts dp[ARG_N-1]

Measured memory_bytes: 11404
#include <bits/stdc++.h>
#define REPZ(i, z, n) for(decltype(n) i = (z); i < (n); i++)
#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(all(v)))
#define MIN(v) (*min_element(all(v)))
#define INF 1000000000000 //1E+12
#define MOD 1000000007    //合同式の法

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<

typedef long long ll;
typedef unsigned long long ul;
// 1s間で可能なループ回数2E+8回
// intの最大値2147483647~2E+9
// long longの最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<> push_back
// 連想配列map<key,value> insert,
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 setprecision()
// to_string<->stoi
// stoll(longlong)
// stod(double)
// 大文字65-90(-32)
// 小文字97-122(+32)
using namespace std;
void dfs(){ 
  return;
}
int main(){
  // faster
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n,m; cin >> n >> m;
  vector<int> A(n);
  int sum=0,res=0;
  REP(i,n){
    cin >> A[i];
    sum += A[i];
  }
  REP(i,n){
    res+=(4*m*A[i]>=sum);
  }
  if(res>=m) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define assem99 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ld long double
#define endll '\n'
#define sz(a) (int)(a).size()
#define RWFile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
int dx[] = { 0, -1, 0, 1, -1, 1, -1, 1 };
int dy[] = { -1, 0, 1, 0, 1, -1, -1, 1 };
const int MOD = 1e9 + 7, N = 2e5 + 5, oo = 1e9;
const double pi = acos(-1);
using namespace std;

vector<int> graph[N];
bool vis[N][5];
int bfs(int start, int end)
{
    queue<pair<int, int>> q;
    q.push({start, 0});
    vis[start][0] = 1;
    while(sz(q))
    {
        int curNode = q.front().first, curLevel = q.front().second;
        q.pop();
        if(curLevel % 3 == 0 and curNode == end) return curLevel / 3;
        for(int child : graph[curNode])
        {
            if(!vis[child][(curLevel + 1) % 3])
            {
                q.push({child, curLevel + 1});
                vis[child][(curLevel + 1) % 3] = 1;
            }
        }
    }
    return -1;
}

int main()
{
    assem99
    int n, m; cin>>n>>m;
    for(int i = 0; i < m; i++)
    {
        int u, v; cin>>u>>v;
        graph[u].push_back(v);
    }
    int start, end; cin>>start>>end;
    cout<<bfs(start, end);

    return 0;
}

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

int main(){
	int sum=0,N;
	cin >> N;
	vector<int> C(N),V(N),Q(N);
	for(int i=0;i<N;i++){
		cin >> V[i];
	}
	for(int i=0;i<N;i++){
		cin >> C[i];
		Q[i]=V[i]-C[i];
	}
	sort(Q.rbegin(),Q.rend());
	for(int i=0;i<N;i++){
		if(Q[i]>0){sum+=Q[i];}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N;
	cin >> N;
	lint A, B;
	cin >> A >> B;
	lint diff = A - B;
	vector<lint> ini_data(N);
	lint max_num = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> ini_data[i];
		max_num = max(max_num, ini_data[i]);
	}

	lint left = 1;
	lint right = max_num / B + 1;

	for (lint i = (left + right) / 2; left < right; i = (left + right) / 2) //log(10 ^ 5)
	{
		lint count = 0;
		for (int j = 0; j < N; j++) //10 ^ 5
		{
			lint rest = ini_data[j] - i * B;
			if (0 < rest)
				count += (rest + diff - 1) / diff;
		}

		if (i < count)
		{
			left = i + 1;
		}
		else
		{
			right = i;
		}
	}

	cout << left << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');
        var num = long.Parse(input[0]);
        var hateNum1 = long.Parse(input[1]);
        var hateNum2 = long.Parse(input[2]);


        var sum = Calc.ModPow(2, num, 1000000007) - 1;

        long x1 = 1;
        long x2 = 1;

        for (var i = 0; i < hateNum1; i++)
        {
            x1 *= (num - i);
            x1 %= 1000000007;
        }
        for (var i = 0; i < hateNum2; i++)
        {
            x2 *= (num - i);
            x2 %= 1000000007;
        }

        var hate1 = (x1 * (Calc.ModPow(Calc.Factorial(hateNum1), 1000000005, 1000000007))) % 1000000007;
        var hate2 = (x2 * (Calc.ModPow(Calc.Factorial(hateNum2), 1000000005, 1000000007))) % 1000000007;

        long result = 0;

        if (sum - hate1 - hate2 < 0)
        {
            result = (2000000014 + sum - hate1 - hate2) % 1000000007;
        }
        else
        {
            result = (sum - hate1 - hate2) % 1000000007;

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




class Calc
{
    public static long Factorial(long n)
    {
        var result = n;

        if (n > 0)
        {

            while (n > 1)
            {
                n--;
                result *= n; 
                result %=1000000007;
            }

            return result;
        }
        else
        {
            return 1;
        }
    }

    public static long ModPow(long b, long pow, long mod)
    {
        if(pow == 1)
        {
            return b % mod;
        }

        long n = ModPow(b, pow / 2, mod) % mod;

        if (pow % 2 == 0)
        {
            return (n * n) % mod;
        }
        else
        {
            return (b * ((n * n) % mod)) % mod;
        }
    }
}

Measured memory_bytes: 13140
#abc104 b
s=input()
x=s[2:-1]
flag=True
if s[0]!="A" or s[1].isupper() or s[-1].isupper():
    flag=False
cnt=0
for i in range(len(x)):
        if x[i]=="C":
            cnt+=1
        else:
            if x[i].islower()==False:
                flag=False
if cnt!=1:
    flag=False
if flag:
    print("AC")
else:
    print("WA")


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

#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;

using namespace std;

int main()
{
    fastio;
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    if (n == 2)
    {
        cout << abs(arr[1] - arr[0]);
        return 0;
    }
    int out[n];
    out[n - 1] = 0;
    out[n - 2] = abs(arr[n - 2] - arr[n - 1]);
    for (int i = n - 3; i >= 0; i--)
    {
        int a = abs(arr[i] - arr[i + 1]) + out[i + 1];
        int b = abs(arr[i] - arr[i + 2]) + out[i + 2];
        out[i] = min(a, b);
    }
    //for (auto x : out) cout << x << " ";
    //cout << endl;
    cout << out[0];
    return 0;
}


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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll ;
typedef long double ld ;

const ll MOD = 1E9 + 7, INF = 2E18 + 5 ;
const double PI = 2 * acos(0.0) ;
const long double EPS = 1.0E-14 ;

int main()
{
    ll n, ans = 1, val = 7, rem, ex, flag = 0 ;
    cin >> n ;
    if (n % 2 == 0) cout << "-1" ;
    else {
        while (val % n != 0) {
            rem = val % n ;
            val = (rem * 10) + 7 ;
            ans++ ;
            if (ans > 1E7) {
                flag = 1 ;
                break ;
            }
        }
        if (flag)   cout << -1 ;
        else    cout << ans ;
    }

    return 0 ;
}


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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int P, Q, R;
double getx(double t){
  return (double)(P - Q) * cos(t) + (double)R * cos(t * (P - Q) / Q);
}
double dx(double t){
  return (double)(P - Q) * (-sin(t)) + (double)R * (P - Q) / Q * (-sin(t * (P - Q) / Q));
}
double gety(double t){
  return (double)(P - Q) * sin(t) - (double)R * sin(t * (P - Q) / Q);
}
double dy(double t){
  return (double)(P - Q) * (cos(t)) - (double)R * (P - Q) / Q * (cos(t * (P - Q) / Q));
}
double dist(double x1, double y1, double x2, double y2){
  return sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
}

int main(){
  while(cin>>P>>Q>>R && P){
    int time = -1;
    for(int k = 1; ; k++){
      if(R == 0){
        time = 1;
        break;
      }
      if(k * (P - Q) % Q == 0){
        time = k;
        break;
      }
    }
    const int ITER = 1000000;
    const double delta = 2.0 * time * M_PI / ITER;
    double ans = 0;
    REP(iter, ITER){
      double t = delta * iter;
      ans += sqrt(dx(t) * dx(t) + dy(t) * dy(t)) * delta;
    }
    printf("%.2f\n", ans + EPS);
  }
  return 0;
}

Measured memory_bytes: 1280
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if(a == b && b == c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
struct Node{
	int key;
	Node *prev,*next;
};
Node *nil;
void init(){
	nil = (Node *)malloc(sizeof(Node)); //malloc用于动态分配内存
	nil->prev = nil;
	nil->next = nil; 
}
void insert(int key){
	Node *x = (Node *)malloc(sizeof(Node));
	x->key = key;
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil;
}
Node* listSearch(int key){ 	//返回节点 
	Node *cur = nil->next;
	while(cur!=nil&&cur->key!=key){
		cur = cur->next;
	}
	return cur;
}
void deleteNode(Node *t){
	if(t == nil)
		return ;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
} 
void deleteFirst(){
	deleteNode(nil->next);
} 
void deleteLast(){
	deleteNode(nil->prev);
}
void deleteKey(int key){
	deleteNode(listSearch(key));//用key找节点 在删除节点 
}
void printList(){
	Node *cur = nil->next;
	int isf=0;
	while(1){
		if(cur == nil)	break;
		if(isf++>0)	cout<<" ";
		cout<<cur->key;
		cur = cur->next;
	}
	cout<<endl;
} 
int main(){
	int key,n,i;
	int size=0;
	char com[20];
	int np = 0,nd =0;
	cin>>n;
	init();
	for(int i=0;i<n;i++){
		
		scanf("%s",com);
		if(strlen(com)<=6){
			cin>>key;
		}
		
		if(com[0]=='i'){
			insert(key);
			np++;
			size++;
		}
		
		else if(com[0]=='d'){
			
			if(strlen(com)>6){
				
				if(com[6] == 'F'){
					deleteFirst();
				}
				
				else if(com[6] == 'L'){
					deleteLast();
				}
				
			}
			else{
				deleteKey(key);
			}
			size--;
		}
	}
	printList();
	return 0;
}


Measured memory_bytes: 34404
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}
fn input_i32_vec() -> Vec<i32> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn main() {
    let n: i32 = input();
    let mut l_vec = input_i32_vec();
    l_vec.sort();
    // println!("{:?}", l_vec);
    let mut sum = 0;
    for i in 0..(l_vec.len() - 2) {
        for j in (i+1)..(l_vec.len()-1) {
            let mut count = 0;  
            for k in (j+1)..l_vec.len() {
                if l_vec[k] >= l_vec[i] + l_vec[j] {                    
                    break;
                } else {
                    count += 1;
                }           
            }
            sum += count;
        }
    }
    println!("{}", sum);
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(10)
#define highest(x) (63 - __builtin_clzl(x))

int main(){
    int N, K;
    cin >> N >> K;
    int h[N];
    cins(h, h + N);
    sort(h, h + N);
    int ans = 1e9;
    for(int i = 0; i <= N - K; i++){
        ans = min(ans, h[i + K - 1] - h[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int       lint;
typedef vector<int>         vi;
typedef vector<lint>        vl;
typedef pair<int, int>      pii;
typedef vector<pii>         vii;
typedef set<int>            si;
typedef map<string, int>    msi;

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<lint>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define M               10000000
#define MOD             10000007
#define INF             1e9+7
#define REP(i,a,b)      for(int i = int(a); i <= int(b); i++)
#define REPL(i,a,b)     for(lint i = lint(a); i <= lint(b); i++)
#define fastIO()        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int main()
{
    lint n, k;
    cin>>n>>k;

    lint ans = k * pow((k - 1), (n - 1));
    cout<<ans<<"\n";

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

using namespace std;
using ll = long long;
using ull = unsigned long long;
#define out(S) cout<<(S)<<endl;
#define REP(i,b) for(size_t i=0;i<(b);i++)
#define rREP(i,b) for(size_t i=(b)-1;i>=0;i--)
#define FOR(i,a,b) for(size_t i=(a);i<(b);i++)
#define rFOR(i,a,b) for(size_t i=(b)-1;i>=0;i--)
#define Foreach(item,collection) for(auto item:collection)
#define mod(i) ((i) % (ll)(1e9 + 7))
ll modpow(ll i, ll j) { ll tmp = 1; while (j) { if (j % 2)tmp = mod(tmp*i); i = mod(i*i); j /= 2; }return tmp; }
#define divmod(a,b) (mod(a * modpow((ll)b,(ll)(1e9 + 5))))

bool check(vector<int> v) {
	int tmp = 0;
	Foreach(item, v) {
		if (tmp == item) return false;
		tmp = item;
	}
	return true;
}


int main(){
	int N, M;
	cin >> N >> M;
	vector<string> A;
	A.resize(N);
	REP(i, N) cin >> A[i];
	string B;
	REP(i, M) {
		string b;
		cin >> b;
		B += b;
	}
	FOR(i, 0, N - M +1) {
		FOR(n, 0, N-M+1) {
			string s = "";
			FOR(k, 0, M) s += A[i + k].substr(n, M);
			if (s == B) { out("Yes"); return 0; }
		}
	}
	out("No");
}



Measured memory_bytes: 256
n=int(input())
L=[[] for i in range(n)]
for i in range(n-1):
    u,v,w=map(int, input().split())
    u-=1
    v-=1
    L[u].append([v,w])
    L[v].append([u,w])
ans=[-1]*n
ans[0]=0
stack=[0]
while stack:
    v=stack.pop()
    for u, w in L[v]:
        if ans[u]!=-1:
            continue
        ans[u]=(ans[v]+w)%2
        stack.insert(0,u)
for a in ans:
    print(a)

Measured memory_bytes: 45004
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String ns = sc.next();
        int count = 0;
        for(int i = 0; i < 4; i++){
            if(ns.charAt(i) == '2') count++;
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 21844
def cal(operand,a,b):
    if operand == "+":
        return int(a)+int(b)
    elif operand == "-":
        return int(a)-int(b)
    elif operand == "*":
      return int(a)*int(b)
A=[]
A = list(input().split())
B=[]
for i in A:
    if i.isdigit() == True:
        B.append(int(i))
    else:
      b=B.pop()
      a=B.pop()
      B.append(cal(i,a,b))
print(B[0])



Measured memory_bytes: 5600
/*author: hyperion_1724
  date: 
*/

//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

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

    READV(A);
    READV(H);
    cout<<(A+H-1)/H<<endl;

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


   
    return 0;
}

Measured memory_bytes: 256