akhauriyash/Code-Regression huggingface dataset:
#!/bin/bash

read H W
arr=()
for i in `seq ${H}`; do
    read st
    arr+=($st)
done

ans=()
range=(-1 0 1)
for i in `seq 0 $((H-1))`; do
    ansline=''
    for j in `seq 0 $((W-1))`; do
        tl=${arr[$i]}
        t=${tl:j:1}
        # echo "${i}, ${j}, ${tl}, ${tl:j:1}"
        if [ ${t} = '#' ]; then 
            ansline=${ansline}'#'
        else
            cnt=0
            for k in ${range[@]}; do
                if [ $((i+k)) -lt 0 ] || [ $((i+k)) -ge ${H} ]; then
                    continue
                fi
                al=${arr[$((i+k))]}
                for l in ${range[@]}; do
                    if [ $((j+l)) -lt 0 ] || [ $((j+l)) -ge ${W} ]; then
                        continue
                    fi
                    a=${al:$((j+l)):1}
                    # echo "$((i+k)), $((j+l)), ${al}, ${a}, ${cnt}"
                    if [[ ${a} = '#' ]]; then
                        let cnt++
                    fi
                done
            done
            ansline=${ansline}${cnt}
        fi
    done
    echo ${ansline} 
done


Measured memory_bytes: 764
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl

#define pb emplace_back
#define fi first
#define se second
     
using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-12;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }

ll in(){ ll x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head

int a, b;


int main(){

  a = in();
  b = in();
  if( a <= 0 and b >= 0 ){
    puts( "Zero" );
  } else if( a > 0 and b > 0 ){
    puts( "Positive" );
  } else {
    assert( a < 0 and b < 0 );
    if( ( b - a ) % 2 == 0 ){
      puts( "Negative" );
    } else {
      puts( "Positive" );
    }
  }

  return 0;
}


Measured memory_bytes: 256
import math
import copy
from collections import defaultdict

def preproc(a,b): # a != 0 or b != 0
    if a < 0:
        a,b = -a,-b
    if a == 0 or b == 0:
        return (a, b)
    GCD = math.gcd(a,b)
    return (a // GCD, b // GCD)

n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]
mod = 1000000007
dic = defaultdict(int)
A = 0
B = 0
AB = 0
for k,(a,b) in enumerate(ab):
    if a == 0 and b == 0:
        AB += 1
        n -= 1
        continue
    a,b = preproc(a,b)
    if a == 0:
        A += 1
        n -= 1
    elif b == 0:
        B += 1
        n -= 1
    else:
        dic[(a,b)] += 1
ok = (pow(2,A,mod) + pow(2,B,mod) - 1) % mod
c = copy.copy(dic)
for k,v in c.items():
    if not dic[k]:
        continue
    a,b = k
    pair = (b,-a) if b > 0 else (-b,a)
    if dic[pair]:
        ok *= pow(2,v,mod) + pow(2,dic[pair],mod) - 1
        ok %= mod
        n -= v + dic[pair]
        dic[pair] = 0
ans = ok * pow(2,n,mod) - 1 + AB
ans %= mod
print(ans)

Measured memory_bytes: 172284
N=int(input())
A=list(map(int,input().split()))

LIST=[0]*(10**6+1)

for a in A:
    LIST[a]+=1
ANS=0

for i in range(10**6+1):
    if LIST[i]==1:
        ANS+=1
    if LIST[i]!=0:
        for j in range(2*i,10**6+1,i):
            if LIST[j]!=0:
                LIST[j]+=1
print(ANS)


Measured memory_bytes: 32248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define ff first
#define ss second

int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int main() {
    int n;
    scanf("%d", &n);
    vector<ll> a(n);
    ll sm = 0;
    for (auto &i: a) {
        scanf("%d", &i);
        sm += i;
    }vector<vector<pair<ll,ll>>> dp(n+1, vector<pair<ll,ll>>(n+1));
    for (int i=n-1; i>=0; i--) {
        for (int j=i; j<n; j++) {
            dp[i][j] = {(ll)1e18, -1};
            if (j==i) dp[i][j] = {0ll, a[i]};
            else {
                for (int k=i; k<j; k++) {
                    ll totcost = dp[i][k].ff+dp[k+1][j].ff;
                    ll newval = dp[i][k].ss+dp[k+1][j].ss;
                    if (newval+totcost<dp[i][j].ff) {
                        dp[i][j].ff = newval+totcost;
                        dp[i][j].ss = newval;
                    }
                }
            }
        }
    }

    printf("%lld\n", dp[0][n-1].ff);
}

Measured memory_bytes: 2816
h,w,n = map(int,input().split())
s = list(map(int,input().split()))
S = input()
T = input()

def YES(b):
    if not b:
        print('YES')
    else:
        print('NO')
    exit(0)
    return

R = [s[0],s[0]]
C = [s[1],s[1]]

for i in range(n):
    if S[i] == 'L':
        C[0] -= 1
        if not (1 <= C[0] <= w):YES(True)
    elif S[i] == 'R':
        C[1] += 1
        if not (1 <= C[1] <= w):YES(True)
    elif S[i] == 'U':
        R[0] -= 1
        if not (1 <= R[0] <= h):YES(True)
    elif S[i] == 'D':
        R[1] += 1
        if not (1 <= R[1] <= h):YES(True)
    if T[i] == 'R' and C[0] != w:
        C[0] += 1
    elif T[i] == 'L' and C[1] != 1:
        C[1] -= 1
    elif T[i] == 'D' and R[0] != h:
        R[0] += 1
    elif T[i] == 'U' and R[1] != 1:
        R[1] -= 1
YES(False)


Measured memory_bytes: 3888
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
typedef long long ll;

using namespace std;

int main(void)
{
    string a;
    cin >> a;

    if (a == "AAA" || a == "BBB")
        cout << "No"  << endl;
    else
        cout << "Yes"  << endl;
        

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long d = in.nextInt();
		long n = in.nextInt();
		if(d==0) {
			long num = n/100;
			System.out.println(n+num);
		}else if(d==1) {
			long num = n/100;
			System.out.println((n+num)*100);
		}else {
			long num = n/100;
			System.out.println((n+num)*10000);
		}

	}

}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main(){
	int n;
	cin >> n;
	string s[n];
	rep(i,n){
		cin >> s[i];
		sort(all(s[i]));
	}

	sort(s,s+n);

	ll ans = 0,cnt = 1;
	for(int i = 1; i < n; i++){
		if(s[i-1] == s[i]){
			ans += cnt;
			cnt++;
		}else{
			cnt = 1;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 7296
import java.util.*;

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

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] l = new int[M];
        int[] r = new int[M];

        int lmax = Integer.MIN_VALUE;
        int rmin = Integer.MAX_VALUE;
        for (int i = 0; i < M; i++) {
            l[i] = sc.nextInt();
            r[i] = sc.nextInt();

            lmax = Math.max(lmax, l[i]);
            rmin = Math.min(rmin, r[i]);
        }

        if (lmax <= rmin) {
            System.out.println(rmin - lmax + 1);
        } else {
            System.out.println(0);
        }

        return;
    }

}

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

typedef long long ll;
typedef pair<int, int> pi;

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep_op(i, a, n) for (int i = a; i < n; i++)
#define rep_d(j, n) for (int j = n; j >= 0; j--)
#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)

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

const int MOD = 1000000007;

const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const ll INF = 1LL << 60;

// int max = *std::max_element(vec.begin(), vec.end());
// int sum = accumulate(list, list + size, 0);

int main()
{
    ll n, k;
    cin >> n >> k;
    cout << min({abs(n % k - k), n, n % k}) << endl;
}


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

#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define all(v) v.begin(), v.end()
#define ar array

#define F first
#define S second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using pii = pair <int, int>;
using pll = pair <ll, ll>;
using ld = long double;

const int mod = 1e9 + 7;
// const int mod = 998244353;
const ll inf = 2e9;
const ll INF = 2e18;
const ld EPS = 1e-7;

ll cur[20], a[20][20], c[20];

void solve () {
	int n, m, x;
	cin >> n >> m >> x;
	for (int i = 0 ; i < n ; ++ i) {
		cin >> c[i];
		for (int j = 0 ; j < m ; ++ j) {
			cin >> a[i][j];
		}
	}
	ll best = INF;
	for (int mask = 0 ; mask < (1 << n) ; ++ mask) {
		for (int i = 0 ; i < m ; ++ i) {
			cur[i] = 0;
		}
		ll money = 0;
		for (int i = 0 ; i < n ; ++ i) {
			if ((1ll << i) & mask) {
				money += c[i];
				for (int j = 0 ; j < m ; ++ j) {
					cur[j] += a[i][j];
				}
			}
		}
		bool ok = 1;
		for (int i = 0 ; i < m ; ++ i) {
			if (cur[i] < x) ok = 0;
		}
		if (ok) best = min (best, money);
	}
	cout << (best == INF ? -1 : best);
}

int main () {
	ios;
	int tt = 1;
	// cin >> tt;
	while (tt--) {
		solve();
		cout << "\n";
	}
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;

ll N, K, R, S, P;

ll getPoint(char j) {
    if (j == 'r') {
        return P;
    }
    else if (j == 's') {
        return R;
    }
    else {
        return S;
    }
}

int main()
{
    string T;

    cin >> N >> K >> R >> S >> P >> T;
    vector<bool> check(N, true);
    ll ans = 0;

    rep(i, K) {
        ans += getPoint(T[i]);
        check[i] = false;
    }

    repd(i, K, N) {
        if (T[i] == T[i - K] && check[i - K]) {
            ans += getPoint(T[i]);
            check[i] = false;
        }
        else if (T[i] != T[i - K]) {
            ans += getPoint(T[i]);
            check[i] = false;
        }
    }

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

Measured memory_bytes: 512
# 65 - 90
N = int(input())
S = input()
arr = []
for s in S:

    tmp1 = ord(s)


    if tmp1 <= (90-N):
        tmp2 = tmp1 + N
    else:
        tmp2 = 64 + tmp1 + N - 90

    arr.append(chr(tmp2))

result = "".join(arr)
print(result)

Measured memory_bytes: 3060
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextStr() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextStr())
	return i
}

func main() {
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	L := make([]int, n)

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

	var ans int

	for i := 0; i < n-2; i++ {
		for j := i + 1; j < n-1; j++ {
			for k := j + 1; k < n; k++ {
				a, b, c := L[i], L[j], L[k]
				if a+b > c && b+c > a && c+a > b && a != b && b != c && c != a {
					ans++
				}
			}
		}
	}
	fmt.Println(ans)
}


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

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



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

#define ll long long
#define f first
#define s second
#define inf 1e15

#define N 300005

string s;
int n,m,x,y;
int a[N];

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
	int t=1;
//	cin>>t;
	while(t--){
	    
	    
	    cin>>s;
	   
	    ll ans=0,cnt=0;
	   
	    for(int i=0;s[i];i++){
	        
	        if(s[i]=='R'){
	            cnt++;
	            
	        }
	        else
	        {
	            ans=max(ans,cnt);
	            cnt=0;
	        }
	    }
	    ans=max(ans,cnt);
	    
	    cout<<ans<<"\n";
	    
	    
	}
	return 0;
}


Measured memory_bytes: 3604
/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define ld long double
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define el '\n'
#define N 1000000007
#define re return
#define F first
#define S second
#define L length
#define mp make_pair
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n==1) return x;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                              //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

template<typename T>
T maxx(T a,T b)
{
  if(a<b) re b;
  re b;
}
template<typename T, typename... Args>
T maxx(T a,T b, Args... args)
{
    re(maxx(maxx(a,b),args...));
}

template<typename T>
T minn(T a,T b)
{
  if(a<b) re a;
  re b;
}
template<typename T, typename... Args>
T minn(T a,T b, Args... args)
{
    re(minn(minn(a,b),args...));
}

inline ll min(ll a,ll b)
{
  if(a<b) re a;
  else re b;
}
inline ll max(ll a,ll b)
{
  if(a<b) re b;
  else re a;
}

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

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=(ans*(n-i)/(i+1))%N;
  }
  re ans;
}

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

  int t=1;
  //cin>>t;
  while(t--)
  {
    ll n,m,k;
    string s;
    cin>>s;
    if(s=="AAA" || s=="BBB") cout<<"No";
    else cout<<"Yes";

  }


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

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

const ll inf = 1LL<<60;

int main()
{
  long double a;
  cin >> a;
  long double b;
  cin >> b;
  ll ans = a*b;
  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 3796
N, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(N)]
INF = 10**9

def dfs(cur, a, b, c):
    if cur == N:
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c) > 0 else INF
    ret0 = dfs(cur+1, a, b, c)
    ret1 = dfs(cur+1, a+L[cur], b, c) + 10
    ret2 = dfs(cur+1, a, b+L[cur], c) + 10
    ret3 = dfs(cur+1, a, b, c+L[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print(dfs(0,0,0,0))

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES 
#include <iomanip> 
#include <cmath>  
#include<iostream>
#include <fstream>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x;
#define wr(x)  cout << x
#define wrln(x) cout << x << endl

ll H, W, ans;
ll c[12][12], djk[12][12], djks[12];
int main() {
	rd(H);
	rd(W);
	repi(i, 0, 10) repi(j, 0, 10) rd(c[i][j]);

	djks[1] = 0;
	repi(i, 0, 10) {
		if (i == 1) continue;
		repi(j, 0, 10) djk[i][j] = c[i][j];
		bool visited[12] = {};
		while (1) {
			ll minT = 10000, indexT = -1;
			repi(j, 0, 10) {
				if (i == j)continue;
				if (djk[i][j] < minT && !visited[j]) {
					indexT = j;
					minT = djk[i][j];
				}
			}
			if (indexT == -1) {
				djks[i] = djk[i][1];
				break;
			}
			else {
				visited[indexT] = true;
				repi(j, 0, 10) djk[i][j] = min(djk[i][j], djk[i][indexT] + c[indexT][j]);
			}
		}
	}

	repi(i, 0, H) repi(j, 0, W) {
		ll temp;
		rd(temp);
		if (temp != -1) ans += djks[temp];
	}
	wrln(ans);

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
	cin>>a>>b>>c;
	if(b-a==c-b)
	{
		cout<<"YES"<<endl;
	}
	else
	{
		cout<<"NO"<<endl;
	}


	return 0;
}


Measured memory_bytes: 256
/**Bismillahir Rahmanir Rahim.**/

/**
 *    author:  nasimnoob
**/

#include<bits/stdc++.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<cstring>
#include<cstdio>

using namespace std;

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

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

//-----------------------------------------------------------//
#define      test                       int t; cin>>t;  while(t--)

#define      cube(x)                    (x*x*x)
#define      sqr(x)                     (x*x)

#define      INPUT                      freopen("input.txt", "r", stdin)
#define      OUTPUT                     freopen("output.txt", "w", stdout)

#define      srev                       reverse(s.begin(),s.end())
#define      sortstr                    sort(s.begin(), s.end());
#define      gtl(x)                     getline(cin, (x))
#define      dot(x)                     fixed << setprecision(x)

#define      Case                       cout << "Case " << ++tt << ": " ;

#define      PI                         acos(-1) // 3.1415926535897932
#define      MIN                        9999999

#define      Faster                     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);




//scanf("%[^\n]%*c", str);
//sort(s,s+n,greater<int>());
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);


//--------------------------------------Solution------------------------------//

int main()
{

    #ifndef ONLINE_JUDGE
    clock_t tStart = clock();
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    Faster;


    int tt = 0 ;

    string s;
    ll a , b , c , d ;

    cin >> a >> b >> c >> d ;

    ll first = a * d ;
    ll second = b * d ;
    ll third  = a * c ;
    ll four = b * c ;

    ll res = max (first , max(second , max(third , four)));

    cout << res << endl;

    #ifndef ONLINE_JUDGE
    fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif


    return 0 ;
}


Measured memory_bytes: 3636
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;


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

	string s;
	vector<vector<int>>v({ { 7,8,9,0,1,2,3 },{ 8,10,0,1,12,3,4 },{ 9,0,11,2,3,13,5 },{ 0,1,2,3,4,5,6 },{ 1,12,3,4,14,6,16 },{ 2,3,13,5,6,15,17 },{ 3,4,5,6,16,17,18 } });
	while (cin >> s, s != "#") {
		bool ans = true;
		for (int i = 0; i < 1 << 19; i++) {
			int nx = 0;
			int a = 0;
			for (int j = 0; j < 7; j++) {
				nx <<= 1;
				nx += (i >> j) & 1;
			}
			for (auto j : v) {
				a <<= 1;
				int b = 0;
				for (auto k : j) {
					b <<= 1;
					b |= (i >> k) & 1;
				}
				a |= s[b] == '1';
			}
			if (s[a] != s[nx]) {
				ans = false;
				break;
			}
		}
		if (ans)cout << "yes\n";
		else cout << "no\n";
	}
}


Measured memory_bytes: 3100
import java.util.*; 
 
class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
 
  		int[] d=new int[n];
		for(int c=0;c<n;c++){
    		d[c]=sc.nextInt();
    	}
  		Arrays.sort(d);
  		
 
    	System.out.println(d[n/2]-d[n/2-1]);
    }
}

Measured memory_bytes: 50756
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U& u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
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; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B, C;
	cin >> A >> B >> C;
	if (max({ A,B,C }) == C || min({ A,B,C }) == C) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin>>n;
    vector<int> x(n),y(n); for(int i=0; i<n; i++){ cin>>x.at(i); y.at(i)=x.at(i); }
    sort(x.begin(),x.end());
    for(int i=0; i<n; i++){
        if(y.at(i)<x.at(n/2))
            cout<<x.at(n/2)<<endl;
        else
            cout<<x.at(n/2-1)<<endl;
    }
}

Measured memory_bytes: 3712
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<cstring>
#include<map>
#include<vector>
#include<set>
#define rep(i,j,k) for(register int i = j; i <= k; i++) 
#define dow(i,j,k) for(register int i = j; i >= k; i--)
#define fi first
#define se second
//#define P pair<ull,ull>
//#define PP pair<int,pair<int,int> >
//#define mp(a,b) make_pair(a,b)
#define ll long long
#define ull unsigned long long
using namespace std;
 
inline int read() { 
	int s = 0, t = 1; char c = getchar();
	while( !isdigit(c) ) { if( c == '-' ) t = -1; c = getchar(); }
	while( isdigit(c) ) s = s * 10 + c - 48, c = getchar();
	return s * t;
}

const int N = 1e5+5, p = 1e9+7, bit = 60;
struct edge{ int to, nxt; } e[N<<1];
int head[N], cnt = 0, deg[N];
inline void add(int x,int y) {
	deg[x]++, deg[y]++; 
	e[++cnt].to = y, e[cnt].nxt = head[x], head[x] = cnt;
	e[++cnt].to = x, e[cnt].nxt = head[y], head[y] = cnt;
}

ll f[N], g[64]; 
#define ez(i,j) for(register int i = head[j]; i; i=e[i].nxt)
#define to e[i].to
inline void dfs(int x,int fa=0) { 
	ez(i,x) if( to != fa ) dfs(to,x);
	memset(g,0,sizeof(g));
	ez(i,x) if( to != fa ) { 
		rep(j,0,bit) if( (f[to] >> j) & 1 ) g[j]++;
	}
	int ret = 0; 
	dow(i,bit,0) if( g[i] >= 2 ) { ret = i + 1; break; }
	rep(i,ret,bit) if( !g[i] ) { ret = i; break; }
	f[x] = 1ll << ret;
	rep(i,ret+1,bit) if( g[i] ) f[x] |= 1ll << i;
}

int main() {
	int n = read(), rt = 0;
	rep(i,1,n-1) add(read(),read());
	if( n == 2 ) return puts("1"), 0;
	rep(i,1,n) if( deg[i] > 1 ) { rt = i; break; }
	dfs(rt);
	dow(i,bit,0) if( (f[rt] >> i) & 1 ) return printf("%d\n",i), 0;
	return 0; 
}

Measured memory_bytes: 5120
S = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51".split(', ')
K = int(input())

print(S[K-1])


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

const int Maxn = 55;

int n;
int a[Maxn];
set <int> A, B;

int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        if (i != a[i]) {
            A.insert(i);
            B.insert(i);
        }
    }
    if (A.empty() || A.size() <= 2 && A == B) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
import math

A = [0]*200001
for i in range(18):
    for j in range(2**i,2**(i+1)):
        if j <= 200000:
            A[j] = i + 1

def bii(x):
    a = A[x]
    o = [0]*a
    for i in range(a):
        o[i] = x % 2
        x //= 2
    return o

def f(x):
    bi = bii(x)
    popcount = sum(bi)
    a = x % popcount
    if a == 0:
        return 1
    else:
        return f(a)+1

N = int(input())
X = list(map(int,list(input())))
X.reverse()

popc = sum(X)
D = dict()
E = dict()
for j in [popc-1,popc+1]:
    E[j] = 0
    D[j] = [0]*N
    b = 1
    if j == 0:
        continue
    for i in range(N):
        D[j][i] = b
        E[j] += X[i] * b
        E[j] %= j
        b *= 2
        b %= j

aaaa = []
for i in range(N):
    an = X[-(i+1)]
    bb = 1 - 2 * an
    #もしi桁目が1ならば、ビット反転によってpopcとXは減る
    #もしi桁目が0ならば、ビット反転によってpopcとXは増える
    if popc == 1 and an == 1:
        print(0)
        continue
    j = popc + bb
    su = (E[j] + bb * D[j][-(i+1)] + j) % j
    if su == 0:
        print(1)
        continue
    else:
        print(f(su)+1)
        continue

Measured memory_bytes: 95480
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			(3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
template<class T> void chmax(T &a, const T &b){if(a<b)a=b;}
template<class T> void chmin(T &a, const T &b){if(a>b)a=b;}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,sum=0;
	cin>>n;
	vl v(n);
	rep(i,n)cin>>v[i],sum+=v[i];
	Yn(*max_element(all(v))<sum-*max_element(all(v)));

	
}



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

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


Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define F(i) for (int i = 1; i <= n; ++i)
using namespace std;

const int maxn = 300+10, maxlogn = 10, inf = 0x3f3f3f3f;

int n, m, l, q;
int g[maxn][maxn], f[maxn][maxn];

void floyd(int d[maxn][maxn]) { F(k) F(i) F(j) d[i][j] = min(d[i][j], d[i][k]+d[k][j]); }

int main() {
	int a, b, c;
	cin >> n >> m >> l;
	memset(g, 0x3f, sizeof(g));
	for (int i = 1; i <= m; ++i) {
		cin >> a >> b >> c;
		g[a][b] = g[b][a] = c;
	}
	floyd(g);
	memset(f, 0x3f, sizeof(f));
	F(i) F(j) if (g[i][j] <= l) f[i][j] = 1;
	floyd(f);
	cin >> q;
	while (q--) {
		cin >> a >> b;
		cout << (f[a][b]==inf?-1:f[a][b]-1) << endl;
	}
}


Measured memory_bytes: 1280
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;

const double PI  = 3.141592653589793238463;

int main() {
    int k, s, r = 0;
    cin >> k >> s;
    for(int i = 0; i <= k; i++){
        for(int j = 0; j <= k; j++){
            if(s - i - j <= k && s-i-j >= 0){
                r++;
            }
        }
    }
    cout << r;
    cout << endl;
}


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

signed main(){
    cout << fixed << setprecision(10) << flush;

    double a, b, x;
    cin >> a >> b >> x;
    x /= (a*a);
    if(x > b/2.0) cout << atan(2.0*(b-x)/a)*180/M_PI << endl;
    else cout << atan(b*b/(2.0*a*x))*180/M_PI << endl;

    return 0;
}

Measured memory_bytes: 4060
package main

import "fmt"

func main() {
	var n1 int
	var i, s int
	cnt := 0
	fmt.Scan(&n1)
	a := make([]int, n1)
	for i := range a {
		fmt.Scan(&a[i])
	}
	for i = 0; i < n1; i++ {
		max := a[i]
		for s = i; 0 <= s; s-- {
			if max <= a[s] {
				max = a[s]
			}
		}
		if a[i] >= max {
			cnt++
		}
	}
	fmt.Print(cnt)
}

Measured memory_bytes: 512
#include<stdio.h>

int main() {
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int temp = a;
    a = b;
    b = temp;
    int temp1 = a;
    a = c;
    c = temp1;
    printf("%d %d %d",a,b,c);


    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstdio>
#include <stack>
using namespace std;
#define rep(i,n) for (int i=0 ; i<(n);i++)
#define INF 1e9+7
int main() {
	int h, m;
	cin >> h >> m;
	vector <string> moto(h);
	vector <string> a(h * 2);
	rep(i, h)
		cin >> moto[i];
	rep(i, h)
		a[2*i] = a[2*i+1] =moto[i];
	rep(i, 2 * h)
		cout << a[i] << endl;
		
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> H(N);
	for (int i = 0; i < N; i++) cin >> H[i];
	int count = 1;
	for (int i = 1; i < N; i++) {
		bool ok = true;
		for (int j = 0; j < i; j++) {
			if (H[i] < H[j]) ok = false;
		}
		if (ok) count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int max(long long a,long long b)
{
    if(a>=b)
    return a;
    else
    return b;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n,a[100005],b[100005],c[100005],x[100005],y[100005],z[100005];
cin>>n;
for(int i=1;i<=n;i++)
    cin>>a[i]>>b[i]>>c[i];
x[n]=a[n];y[n]=b[n];z[n]=c[n];
for(int i=n;i>=1;i--)
{
    x[i-1]=a[i-1]+max(y[i],z[i]);
    y[i-1]=b[i-1]+max(x[i],z[i]);
    z[i-1]=c[i-1]+max(x[i],y[i]);
}
cout<<max(max(x[0],y[0]),z[0]);
return 0;
}




Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define rep(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

int main()
{
    int N;
    vector<double> p;
    static double dp[3010][3010];
    int i, j;
    double ans = 0;

    cin >> N;

    p.resize(N + 1);

    dp[0][0] = 1;

    rep(i, 1, N)
    {
        cin >> p[i];
        rep(j, 0, i)
        {
            dp[i][j] = dp[i - 1][j] * (1 - p[i]) + dp[i - 1][j - 1] * p[i];
        }
    }

    rep(i, N / 2 + 1, N)
    {
        ans += dp[N][i];
    }

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

Measured memory_bytes: 69120
#include<stdio.h>
int main(void){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(a==b && b==c && c==a){
    printf("1");
  }else if(a==b && b!=c &&c!=a){
    printf("2");
  }else if(a!=b && b!=c &&c==a){
    printf("2");
  }else if(a!=b && b==c &&c!=a){
    printf("2");
  }else{
    printf("3");
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 128
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
vector<int> v;
vector<int> gr[114514];
bool sumi[114514];
void dfs(int x){
	//cout<<x<<endl;
	sumi[x]=true;
	rep(i,gr[x].size()){
		int y=gr[x][i];
		if(!sumi[y]){
			v.pb(y);
			dfs(y);
			break;
		}
	}
}
int main()
{
	int n,m,a,b,s;
	cin>>n>>m;
	rep(i,m){
		cin>>a>>b;
		gr[a].pb(b);gr[b].pb(a);
	}
	REP(i,1,n+1){
		if(gr[i].size()>0){
			s=i;break;
		}
	}
	memset(sumi,false,sizeof(sumi));
	//cout<<s<<endl;
	dfs(s);
	vector<int> out=v;reverse(All(out));out.pb(s);
	v.clear();dfs(s);
	rep(i,v.size()) out.pb(v[i]);
	cout<<out.size()<<endl;
	rep(i,out.size()){
		cout<<out[i];
		if(i<out.size()-1) cout<<' ';else cout<<endl;
	}
}


Measured memory_bytes: 10512
#include<bits/stdc++.h>
using namespace std ;
#define rep( i, s, t ) for( register int i = s; i <= t; ++ i )
#define re register
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
signed main()
{
	int H = gi(), A = gi() ;
	int ans = H / A ; 
	if( ans * A < H ) ++ ans ;
	printf("%lld\n", ans ) ;
	return 0 ;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import itertools
import bisect


def solve(N: int, P: "List[int]", Q: "List[int]"):

    nums = [i for i in range(1, N + 1)]
    perm = list(itertools.permutations(nums, N))
    print(abs(perm.index(tuple(P)) - perm.index(tuple(Q))))
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    Q = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, P, Q)


if __name__ == "__main__":
    main()


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

#include <math.h>
#define PI 3.14159265358979323846264338327950L

bool isPrime(long long x) {
    if (x == 1) return true;
    for (long long i = 2; i*i <= x; i++) {
        if (x % i == 0) return false;
    }
    return true;
}

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

vector<long long> common_divisors(long long a, long long b) {
    long long n = gcd(a, b);
    vector<long long> ans;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            if (n / i == i) {
                ans.push_back(i);
            }
            else {
                ans.push_back(n / i);
                ans.push_back(i);
            }
        }
    }
    return ans;
}
vector<int> get_divisors(long long n) {
    vector<int> ans;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            if (i == n / i) {
                ans.push_back(i);
            }
            else {
                ans.push_back(n / i);
                ans.push_back(i);
            }
        }
    }
    sort(ans.rbegin(), ans.rend());
    return ans;
}

bool is_sorted(vector<int> a) {
    int n = a.size();
    for (int i = 0; i < n - 1; i++) {
        if (a[i + 1] < a[i]) return false;
    }
    return true;
}

int mxN = 1e5;
int main() {
    long long W, H, x, y;
    cin >> W >> H >> x >> y;
    long double area = (long double)((long double)W * H) / 2;
    cout << area;
    if (W == x * 2 && H == y * 2) {
        cout << " " << 1;
    }
    else {
        cout << " " << 0;
    }
    return 0;
}

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

using namespace std;

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> sumW(n + 1, 0), sumE(n + 1, 0);
  for (int i = 0; i < n; i++) {
    sumW[i + 1] = sumW[i] + (s[i] == 'W');
    sumE[i + 1] = sumE[i] + (s[i] == 'E');
  }
  int res = n;
  for (int i = 0; i < n; i++) {
    int num = sumW[i] + (sumE[n] - sumE[i + 1]);
    res = min(res, num);
  }
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 2948
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define ll long long
#define faltu ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define binary(x) std::string binary = std::bitset<25>(x).to_string(); //to binary
#define inf 1000000007
#define mod 1000000007
#define pi pair<int,int>
#define lpi pair<int,int>
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define lvi vector<long long int>
#define pie 3.14159265358979323846
ll int MMM=inf;
int pw(ll int a, ll int b) {
    if (b == 0) return 1;
    ll int t = pw(a, b / 2);
    if (b % 2 == 0) return (t * t)%mod;
    else return ((t * t)%mod * a)%mod;
}
using namespace std;
vi pm;
void prm(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
              prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p]) pm.pb(p);
}
bool sortbysecdesc(const pair<ll int,ll int> &a,const pair<ll int,ll int> &b)
{
    return a.first>b.first;
}
bool cmp(int x,int y){return x>y;}
int gcd(int a,int b)
{
    if(a<b)
        swap(a,b);
    return (b==0)?a:gcd(b,a%b);
}
int main()
{
	faltu;
	string s;
	cin>>s;
	if(s[0]=='S')cout<<"Cloudy";
	else if(s[0]=='C')cout<<"Rainy"<<endl;
	else cout<<"Sunny"<<endl;

}










Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MAX 500005
using namespace std;

template<typename T>
void read(T &n){
    n = 0;
    T f = 1;
    char c = getchar();
    while(!isdigit(c) && c != '-') c = getchar();
    if(c == '-') f = -1, c = getchar();
    while(isdigit(c)) n = n*10+c-'0', c = getchar();
    n *= f;
}
template<typename T>
void write(T n){
    if(n < 0) putchar('-'), n = -n;
    if(n > 9) write(n/10);
    putchar(n%10+'0');
}

int n, a[MAX];

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++){
        read(a[i]);
    }
    int ans = (int)1e9;
    for(int i = 1; i <= 100; i++){
        int s = 0;
        for(int j = 1; j <= n; j++){
            s += (a[j]-i)*(a[j]-i);
        }
        ans = min(ans, s);
    }
    cout << ans << endl;

    return 0;
}

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

int main(){
int h,w,b=0;
cin >>h >>w;
char a[h][w];
for (int i=0;i<h; i++){
for (int j=0;j<w;j++){
cin >> a[i][j];
}
}
for (int i=0;i<h;i++){
for (int j=0;j<w;j++){
if (a[i][j]=='#' && a[i][j]!=a[i-1][j] && a[i][j]!=a[i+1][j] && a[i][j]!=a[i][j-1] && a[i][j]!=a[i][j+1]) b++;
}
}
if (b ==0) cout << "Yes" <<endl;
else cout << "No" <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    if(s[0]=='R' && s[1]=='R' && s[2]=='R') cout<<3<<"\n";
    else if((s[0]=='R' && s[1]=='R') || (s[1]=='R' && s[2]=='R')) cout<<2<<"\n";
    else if(s[0]=='R' || s[1]=='R' || s[2]=='R') cout<<1<<"\n";
    else cout<<0<<"\n";
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds ;
using namespace std ;
 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set ;


const long long mod = 998244353 ;
const int MAX = 2e5 + 10 ;

int arr[MAX] ;
int n ;
long long P[MAX] ;
long long smaller1[MAX] , smaller2[MAX] , larger1[MAX] , larger2[MAX] ;

vector< pair<int , int> >vp ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	P[0] = 1ll ;
	for(int i = 1 ; i < MAX ; ++i)
		P[i] = (P[i-1] * 2ll) % mod ;
	cin>>n ;
	for(int i = 0 ; i < n ; ++i)
	{
		int x , y ;
		cin>>x>>y ;
		vp.emplace_back(x , y) ;
	}
	sort(vp.begin() , vp.end()) ;
	ordered_set s1 , s2 ;
	for(int i = n-1 ; i >= 0 ; --i)
	{
		smaller2[i] = s2.order_of_key(vp[i].second) ;
		larger2[i] = n-i-1 - smaller2[i] ;
		s2.insert(vp[i].second) ;
	}
	long long ans = 0ll , x , y , z , a , b , c ;
	for(int i = 0 ; i < n ; ++i)
	{
		smaller1[i]= s1.order_of_key(vp[i].second) ;
		larger1[i] = i - smaller1[i] ;
		s1.insert(vp[i].second) ;
		// Take current number
		x = 1ll ;
		y = P[n-1] % mod ;
		z = (x * y) % mod ;
		ans = (ans + z) % mod ;
		// Take smaller y from prev numbers , larger y from next numbers
		x = (P[smaller1[i]] - 1ll + mod) % mod ;
		y = (P[larger2[i]] - 1ll + mod) % mod ;
		z = (x * y) % mod ;
		ans = (ans + z) % mod ;
 		// Take smaller y from next numbers, larger y from prev numbers
		x = (P[smaller2[i]] - 1ll + mod) % mod ;
		y = (P[larger1[i]] - 1ll + mod) % mod ;
		z = (x * y) % mod ;
		ans = (ans + z) % mod ;
		// Take Both smaller and greater y from prev numbers and smaller numbers from next numbers
		x = (P[smaller1[i]] - 1ll + mod) % mod ;
		y = (P[larger1[i]] - 1ll + mod) % mod ;
		z = (x * y) % mod ;
		b = (P[smaller2[i]] - 1ll + mod) % mod ;
		z = (z * b) % mod ;
		ans = (ans + z) % mod ;
		// Take Both smaller and greater y from prev numbers and larger numbers from next numbers
		x = (P[smaller1[i]] - 1ll + mod) % mod ;
		y = (P[larger1[i]] - 1ll + mod) % mod ;
		z = (x * y) % mod ;
		b = (P[larger2[i]] - 1ll + mod) % mod ;
		z = (z * b) % mod ;
		ans = (ans + z) % mod ;
		// Take Both smaller and greater from next numbers and smaller from prev numbers
		x = (P[smaller2[i]] - 1ll + mod) % mod ;
		y = (P[larger2[i]] - 1ll + mod) % mod ;
		z = (x * y) % mod ;
		b = (P[smaller1[i]] - 1ll + mod) % mod ;
		z = (z * b) % mod ;
		ans = (ans + z) % mod ;
		// Take Both smaller and greater from next numbers and larger from prev numbers
		x = (P[smaller2[i]] - 1ll + mod) % mod ;
		y = (P[larger2[i]] - 1ll + mod) % mod ;
		z = (x * y) % mod ;
		b = (P[larger1[i]] - 1ll + mod) % mod ;
		z = (z * b) % mod ;
		ans = (ans + z) % mod ;
		// Take Both smaller and greater from next numbers and from prev numbers
		x = (P[smaller1[i]] - 1ll + mod) % mod ;
		y = (P[larger1[i]] - 1ll + mod) % mod ;
		z = (x * y) % mod ;
		a = (P[smaller2[i]] - 1ll + mod) % mod ;
		b = (P[larger2[i]] - 1ll + mod) % mod ;
		c = (a * b) % mod ;
		z = (z * c) % mod ;
		ans = (ans + z) % mod ;
	}
	return cout<<ans<<"\n" , 0 ;
}		

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

using namespace std;

int main(){

    int N,K;

    cin>>N>>K;

    long long a[200001];

    for(int i=0;i<N;i++){
        cin>>a[i];

    }

    for(int i=0;i<N-K;i++){
        if(a[i+K]>a[i]){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
}

Measured memory_bytes: 5196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=100010, inf=2e9;

int solve(int x){
	if(x==0) return 0;
	return x%10 + solve(x/10);
}
bool ten(int x){
	if(x==1) return true;
	return (x%10==0) && ten(x/10);
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	if(ten(n)) cout<<10;
	else cout<<solve(n);
	return 0;
}

Measured memory_bytes: 384
n=gets.to_i
a=gets.split.map(&:to_i)
v=a.inject(:+)/n
c=0
a.each do |aa|
  c+=(aa-v)**2
end
vv=v+1
cc=0
a.each do |aa|
  cc+=(aa-vv)**2
end
puts [c,cc].min


Measured memory_bytes: 1788
import java.util.*;
import java.io.*;
 
public class Main{
    
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
		int A = s.nextInt();
		int B = s.nextInt();
		int C = s.nextInt();
		int D = s.nextInt();
		int E = s.nextInt();
		if(A == 0){
			System.out.println(1);
		}else if(B == 0){
			System.out.println(2);
		}else if(C == 0){
			System.out.println(3);
		}else if(D == 0){
			System.out.println(4);
		}else{
			System.out.println(5);
		}
	}
} 

Measured memory_bytes: 35736
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

n, a, b = map(int, read().split())
MOD = 10**9 + 7


def modinv(a, mod=10**9 + 7):
    return pow(a, mod - 2, mod)


def combination(n, r, mod=10**9 + 7):
    r = min(r, n - r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i + 1, mod) % mod
    return res


ans = 2**n

for k in [a, b]:
    ans -= combination(n, k, MOD)

ans -= 1

ans %= MOD

print(ans)

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

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;
char n[200000];
int main()
{
    int i;
    long long int s=0;
    cin >> n;
    for(i = 0; n[i];i++)
        s += n[i]-48;
    if(s%9==0)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}

Measured memory_bytes: 3764