akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    ll N;
    cin>>N;
    ll ans=0;
    for(ll i=1;i<=N;i++){
        if(i%3!=0&&i%5!=0){
            ans+=i;
        }
    }
    cout<<ans;
}
    

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int a[26],i,j;
string s;
int main(){
	for(cin>>s;i<s.size();i++){
		a[s[i]-'a']=1;
	}
	for(i=0;i<26;i++){
		if(a[i]==0)return cout<<char(i+'a'), 0;
	}
	cout<<"None"<<endl;
}

Measured memory_bytes: 512
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-01-18 20:36:11
**/

#include <cstdio>
/*
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
*/
#include <vector>
#include <algorithm>
/*
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
*/
#include <iomanip>
//#include <random>
#include <utility>
//#include <chrono>


using namespace std;

using int64 = long long;

template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#define getchar_unlocked getchar
#else
#define debug(_) 1728
#endif

template<class T> inline void fastin(T &num) {
  T c;
  num = 0;
  c = getchar_unlocked();
  for (; (c > 47 && c < 58); c = getchar_unlocked()) num = (num << 3) + (num << 1) + c - 48;
}

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

  int n; fastin(n);
  vector<pair<int64, int64>> v;
  for (int i = 0; i < n; ++i) {
    int64 x, l; fastin(x); fastin(l);
    v.emplace_back(x - l, x + l);
  }

  sort(v.begin(), v.end(), [](const pair<int64, int64>& p, const pair<int64, int64>& q){
    return p.second < q.second;
  });

  //debug(v);

  int64 last = v[0].second;
  int ans = 0;

  for (int i = 1; i < n; ++i) {
    if (v[i].first < last) {
      ++ans; continue;
    }
    last = v[i].second;
  }

  //cout << n - ans << endl;
  printf("%d\n", n - ans);

  return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int a, b;
	char ans;

	cin >> a >> b;

	if (a + b == 15) ans = '+';
	else if (a * b == 15) ans = '*';
	else ans = 'x';

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

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

	// For prime mod.
	// Do not use if MOD is not prime number !!
	mint inv() const { return pow(MOD-2);}
	mint& operator/=(const mint a) { return (*this) *= a.inv();}
	mint operator/(const mint a) const {mint res(*this); return res/=a;}
};

typedef vector<mint> vm;
void solve() {
    ll n, s;
    cin >> n >> s;
    vll a(n);
    for(ll i = 0; i < n; i++) cin >> a[i];
    vector<vm> dp(n + 1, vm(s + 1));
    dp[0][0] = 1;
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j <= s; j++) {
            dp[i + 1][j] += dp[i][j] * 2;
            if(j >= a[i]) dp[i + 1][j] += dp[i][j - a[i]];
        }
    }
    cout << dp[n][s].x << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

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

int n[100];
int main() {
  string s; cin >> s;
  for (char c : s) {
    n[c-'a']++;
    if (n[c-'a'] > 1) { cout << "no" << endl; return 0; }
  }
  cout << "yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int a,b,g[12]={1,3,1,2,1,2,1,1,2,1,2,1};
  scanf("%d%d",&a,&b);
  printf("%s\n",(g[a-1]==g[b-1])? "Yes":"No");
  return 0;
}

Measured memory_bytes: 128
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

last = [0]*26
scr = 0 
for d in range(D):
    sts_p = 0
    sts_date = 1
    total = scr
    for i in range(26):
        total += s[d][i]
        for j in range(26):
            if i == j:
                continue
            else:
                total -= (c[j]*(d+1 - last[j]))
        
        if total >= sts_p:
            sts_p = total
            sts_date = i+1
        total = scr

    scr = sts_p
    last[sts_date - 1] = d+1
    print(sts_date)

Measured memory_bytes: 9328
H,W,N=map(int,input().split())
D=dict()
da=[-1,-1,-1,0,0,0,1,1,1]
db=[-1,0,1,-1,0,1,-1,0,1]
for i in range(N):
    a,b=map(int,input().split())
    for j in range(9):
        na=a+da[j]
        nb=b+db[j]
        if 1<na<H and 1<nb<W:
            if (na,nb) in D:
                D[(na,nb)]+=1
            else:
                D[(na,nb)]=1
ans=[0 for i in range(10)]
for i in D:
    ans[D[i]]+=1
tmp=sum(ans)
ans[0]=(H-2)*(W-2)-tmp
for i in ans:
    print(i)


Measured memory_bytes: 142324
#include <bits/stdc++.h>
#define s second
#define f first
#define ll long long
#define MAXN   1000010
using namespace std;
const int N = 1e6+5, mod = 1e9+7;
ll a[N], n, maX[N], tempmap[N];
ll fastpower(ll b, ll p)
{
    if ( p == 0)
        return 1 ;
    ll halfpower = fastpower(b,p/2)%mod ;
    halfpower *= halfpower;
    halfpower %= mod ;
    if ( p % 2 )
        halfpower = (halfpower * (b%mod) ) %mod ;
    return halfpower;
}
ll spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (ll i=2; i<MAXN; i++)
        spf[i] = i;
    for (ll i=4; i<MAXN; i+=2)
        spf[i] = 2;
    for (ll i=3; i*i<MAXN; i++)
    {
        if (spf[i] == i)
        {
            for (ll j=i*i; j<MAXN; j+=i)
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}
int main()
{
    sieve();
    cin >> n ;
    for ( int i = 0 ; i < n ; i++)
    {
        cin >> a[i];
        int x = a[i] ;
        while ( x > 1)
        {
            int z = spf[x];
            while ( x % z == 0)
            {
                tempmap[z]++ ;
                x /= z ;
            }
            if ( tempmap[z] > maX[z])
                maX[z] = tempmap[z] ;
            tempmap[z] = 0 ;
        }
    }
    ll lcm = 1 , finalans = 0 ;
    for ( int i = 2 ; i <= 1e6 ; i++)
        lcm = (lcm * fastpower(i,maX[i]) )%mod;
    for ( int i = 0 ; i < n ; i++)
        finalans = (finalans +(lcm * fastpower(a[i],mod-2))%mod)%mod ;
    cout << finalans ;
}


Measured memory_bytes: 24832
package main

import (
	"bytes"
	"errors"
	"fmt"
	"strings"
)

func main() {
	var h, w int
	fmt.Scan(&h, &w)
	m := loadMaze(h, w)
	fmt.Printf("%v\n", maxScore(m, pos{w - 1, h - 1}))
}

type pos struct {
	x, y int
}

type history struct {
	pos
	l int
}

func searchMinPathLength(maze []string, goal pos) (int, error) {
	// return min path, if not found this returns -1, errors.New("not found")
	cur := pos{0, 0}
	candidates := []history{}
	curHist := history{}
	note(maze, cur)
	candidates = append(candidates, history{cur, 1})
	for len(candidates) > 0 {
		curHist = candidates[0]
		candidates = candidates[1:]
		if curHist.x == goal.x && curHist.y == goal.y {
			return curHist.l, nil
		}
		for _, n := range nextAvailables(maze, curHist.pos) {
			note(maze, n)
			candidates = append(candidates, history{n, curHist.l + 1})
		}
	}
	return -1, errors.New("not found")
}

func note(maze []string, cur pos) {
	var buf bytes.Buffer
	l := maze[cur.y]
	buf.WriteString(l[0:cur.x])
	buf.WriteString("#")
	buf.WriteString(l[cur.x+1 : len(l)])
	maze[cur.y] = buf.String()
}

func nextAvailables(maze []string, cur pos) (candidates []pos) {
	for _, diff := range []pos{pos{0, 1}, pos{0, -1}, pos{1, 0}, pos{-1, 0}} {
		if isBlocked(maze, cur.x+diff.x, cur.y+diff.y) {
			continue
		}
		candidates = append(candidates, pos{cur.x + diff.x, cur.y + diff.y})
	}
	return candidates
}

func maxScore(maze []string, goal pos) int {
	sum := countBlock(maze)
	l, e := searchMinPathLength(maze, goal)
	if e != nil {
		return -1
	}
	return (goal.x+1)*(goal.y+1) - sum - l
}

func countBlock(maze []string) (sum int) {
	for i := 0; i < len(maze); i++ {
		sum += strings.Count(maze[i], "#")
	}
	return sum
}

func loadMaze(h, w int) []string {
	maze := make([]string, h)
	for i := 0; i < h; i++ {
		fmt.Scan(&(maze[i]))
	}
	return maze
}

func isBlocked(maze []string, x, y int) bool {
	if x < 0 || y < 0 || y >= len(maze) || x >= len(maze[y]) {
		return true
	}
	if maze[y][x] == '#' {
		return true
	}
	return false
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  constexpr int max = 200;
  auto has_sqrt = [&] (int   x) {
    for (int i = 0; i < max; i++) {
      if (i * i == x) return true;
    }
    return false;
  };
  int n, d; std::cin >> n >> d;
  auto x = std::vector<std::vector<int>>(n, std::vector<int>(d));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < d; j++) {
      std::cin >> x.at(i).at(j);
    }
  }
  auto check = [&] (int i, int j) {
    assert(0 <= i && i < j && j < n);
    int z = 0;
    for (int k = 0; k < d; k++) {
      z += (x[i][k] - x[j][k]) * ((x[i][k] - x[j][k]));
    }
    return has_sqrt(z);
  };
  int ret = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      ret += check(i, j);
    }
  }
  std::cout << ret << std::endl;
  return 0;
}

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

typedef long long ll;
const ll mod=1e9+7;
const int N=200000;

void Run()
{
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
//ll s[N],c[N];
ll h=1000000000000000000;
ll a[N];
vector<string>v;
map<string,int>mp;
int main()
{
    Run();
    ll A;
  cin>>A;
  string B;
  cin>>B;
  ll b = (B[0]-'0')*100+(B[2]-'0')*10+(B[3]-'0');
  cout<<A*b/100<<endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    char c; cin >> c;
    cout << (char)(c+1) << endl;

    return 0;
}

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

int main(){
    string s;
    cin>>s;
    
    int len=s.size();
    for(int i=0; i<len; i++){
        if(s[i]=='7'){
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}


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

// 入力
int n, W;
int weight[3010], value[3010]; // 品物の個数は 100 個なので少し余裕持たせてサイズ 110 に

// DPテーブル
int dp[3010][3010] = {0}; // テーブルの初期値はすべて 0 にしておきます

// 復元用テーブル
int prev_w[3010][3010];

int main() {
    // 入力受け取り
    cin >> n >> W;
    for (int i = 0; i < n; ++i) cin >> weight[i] >> value[i];

    // DPループ
    for (int i = 0; i < n; ++i) {
        for (int w = 0; w <= W; ++w) {

            // i 番目の品物を選ぶ場合を考える
            if (w >= weight[i]) {
                if (dp[i+1][w] < dp[i][w-weight[i]] + value[i]) {
                    dp[i+1][w] = dp[i][w-weight[i]] + value[i];
                    prev_w[i+1][w] = w - weight[i];
                }
            }

            // i 番目の品物を選ばない場合を考える
            if (dp[i+1][w] < dp[i][w]) {
                dp[i+1][w] = dp[i][w];
                prev_w[i+1][w] = w;
            }
        }
    }

    // 最適値の出力
    int ans = dp[n][W-1];
    int U[3010];
    for (int i = 0; i < n; ++i){
        U[i] = 0;
    }
    // 復元
    int cur_w = W-1;
    for (int i = n-1; i >= 0; --i) {
        // 選んでいた場合
        if (prev_w[i+1][cur_w] == cur_w - weight[i]) {
            U[i] = 1;
        }
        // 復元テーブルをたどる
        cur_w = prev_w[i+1][cur_w];
    }

    int temp = 0;
    for (int i = 0; i < n; ++i){
        if(U[i] == 0){
            temp = max(temp,value[i]);
        }
    }
    cout << ans + temp << endl;
}


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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  ll a, b, c;
  cin >> a >> b >> c;
  if (c-a-b>=0 && (c-a-b)*(c-a-b)>4*a*b)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    m = kwargs["m"]
    H = kwargs["H"]
    A = kwargs["A"]
    B = kwargs["B"]
    tmp = [1 for i in range(n)]

    for i in range(m):
        if H[A[i] - 1] >= H[B[i] - 1]:
            tmp[B[i] - 1] = 0

        if H[A[i] - 1] <= H[B[i] - 1]:
            tmp[A[i] - 1] = 0

    res = sum(tmp)
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    #kwargs["n"] = [int(i) for i in cin][0]
    kwargs["n"], kwargs["m"] = [int(i) for i in cin]

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    #kwargs["n"] = [int(i) for i in cin][0]
    kwargs["H"] = [int(i) for i in cin]

    kwargs["A"] = []
    kwargs["B"] = []
    for i in range(kwargs["m"]):
        cin = input().split()
        #a = cin[0]
        #a = cin
        #a = [int(i) for i in cin][0]
        a, b = [int(i) for i in cin]
        kwargs["A"].append(a)
        kwargs["B"].append(b)

    cout = main(kwargs)
    print(cout)

Measured memory_bytes: 45300
#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<vi> vvi;
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 N;
	cin >> N;
	vi H(N);
	REP(i, N)cin >> H[i];
	REP(i, N) {
		if (i == 0) {
			H[i]--;
		}
		else if (H[i - 1] != H[i]) {
			H[i]--;
		}
	}
	int pre = H[0];
	FOR(i, 1, N) {
		if (pre > H[i]) {
			cout << "No" << endl;
			return 0;
		}
		pre = H[i];
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fi first
#define se second 
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define pp pair<ll,ll> 
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t = 1;
void solve() 
{
	ll n;
	string a, b;
	cin>>n>>a>>b;
	rep(i,0,n)cout<<a[i]<<b[i];
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cin >> t ;
    while(t--){
        solve();
    }
    return 0 ;
}


Measured memory_bytes: 256
n,m,x = map(int, input().split())
a_list = list(map(int, input().split()))

former = []
latter = []

for i in range(len(a_list)):
    if a_list[i] < x:
        former.append(a_list[i])
    else:
        latter.append(a_list[i])
print(min(len(former), len(latter)))

Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp(a) setprecision(a)<<fixed
#define ss second
#define fori(v) for(ll i=0; i<v; i++)
#define forj(v) for(ll j=0; j<v; j++)
#define fork(v) for(ll k=0; k<v; k++)
#define forl(v) for(ll l=0; l<v; l++)
#define fort(v) for(ll t=0; t<v; t++)
#define forz(v) for(ll z=0; z<v; z++)	
#define forx(v) for(ll x=0; x<v; x++)
#define fory(v) for(ll y=0; y<v; y++)
#define ll int
#define double long double
#define MAX 530100
#define pb(a) push_back(a)
const ll INF = 0x3f3f3f3f;
const ll inf = INF;
ll modulo = pow(10,9)+7;

void deal(){
	ll r;
	cin>>r;
	cout<<3*r*r;
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	deal();
}

/*

4 6
4 8 7 8
1 2 4
2 1 2 2
1 3 4
2 1 1 8
1 1 3
1 1 4

*/

Measured memory_bytes: 256
/* Code by : Suraj (@suraj1611) */

#include<bits/stdc++.h>
#include <string>

using namespace std;

#define ll long long int
#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define mx INT_MAX
#define mn INT_MIN
#define md 1000000007
#define pb push_back
#define mp make_pair
#define maxsize 1100005
#define lb cout<<endl;
#define endl "\n"
#define F first
#define S second
#define label cout<<"hello!"<<endl
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll x, ll  y) 
{ 
	ll m=md;
   	ll ans=1;
    while (y > 0) 
    {
        if (y & 1)
            ans = (ans * x) % m;
        x = (x * x) % m;
        y >>= 1;
    }
    return ans;
} 

int main()
{
	IOS
	


	ll a,b,c;
	cin>>a>>b>>c;
	ll x=(a-b);
	if(x>=c)
		cout<<0<<endl;
	else
		cout<<c-x<<endl;



    return 0;
}

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

using namespace std;

int main() {
    string S;
    cin >> S;

    set<char> s;
    for (char c: S) {
        if (s.find(c) == s.end()) {
            s.insert(c);
        } else {
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
    return 0;
};


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

int n;
int x[50], y[50];

int main() {
	int i;
	
	cin >> n; if (n % 2) { cout << "NA" << endl; return 0; }
	for (i = 0; i < n; i++) cin >> x[i] >> y[i];
	
	for (i = 0; i < n; i++) {
		if (x[(i + 1) % n] - x[i] != x[(n/2 + i) % n] - x[(n/2 + i + 1) % n]) break;
		if (y[(i + 1) % n] - y[i] != y[(n/2 + i) % n] - y[(n/2 + i + 1) % n]) break;
	}
	if (i < n) { cout << "NA" << endl; }
	else { printf("%.14f %.14f\n", (x[0] + x[n/2]) * 0.5, (y[0] + y[n/2]) * 0.5); }
	return 0;
}

Measured memory_bytes: 3212
#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
typedef long long ll;
string s;
int num[100010];
int L[100010];
int R[100010];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>s;
    int len=s.length();
    int pos=0;
    for(int i=0;i<len;i++)
    {
    	if(s[i]=='R')
    		pos=i;
    	R[i]=pos;
	}
	pos=len;
	for(int i=len-1;i>=0;i--)
	{
        if(s[i]=='L')
			pos=i;
        L[i]=pos;
    }
	int step;
	for(int i=0;i<len;i++)
	{
		if(s[i]=='L')
		{
			step=i-R[i];
			num[R[i]+step%2]++;
		}
		else
		{
			step=L[i]-i;
            num[L[i]-step%2]++;
		}
	}
	for(int i=0;i<len;i++)
		cout<<num[i]<<" ";
    return 0;
}

Measured memory_bytes: 1872
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n = 0;
	cin >> n;
	vector<int> a(n);
	for (auto &i : a)
		cin >> i;
	sort(a.rbegin(), a.rend());
	bool flag = false; int pt = 1; lli res = a[0];
	for (int i = 1; i + 1 < n; ++i)
	{
		res += a[pt];
		if (flag)
		{
			flag = false; ++pt;
		}
		else
			flag = true;
	}
	cout << res << endl;
}

Measured memory_bytes: 3996
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -with-rtsopts="-A32m" #-}
module Main where
import qualified Data.ByteString.Char8 as B
import Data.List(sort, foldl', unfoldr)
import Data.Char(isSpace)
import Data.Monoid((<>))

data PI = PI {-# UNPACK #-} !Int {-# UNPACK #-} !Int
    deriving (Eq)
instance Ord PI where
    compare (PI x y) (PI z w) = compare (- (x + y)) (- (z + w)) <> compare x z 
    

parse :: B.ByteString -> [PI]
parse = unfoldr step
  where
  step !s | B.null s = Nothing
          | otherwise = do
               (n1, s1) <- B.readInt s
               (n2, s2) <- B.readInt (B.tail s1)
               let s3 = B.dropWhile isSpace s2
               return (PI n1 n2, s3)

main :: IO ()
main = do
    n <- fmap read getLine :: IO Int
    content <- B.getContents
    let asbs = parse content
    let l  = sort asbs
        ps = cycle [1,-1 :: Int]
        ans = sum $ zipWith (\(PI a b) p -> if p == 1 then a else - b) l ps
    print ans                


Measured memory_bytes: 18684
abc = require('fs').readFileSync('/dev/stdin', 'ascii').split(' ', 3).map(Number);
ary = range(abc[0], abc[1]);
ary = ary.filter(is_divisor(abc[2]));
console.log(ary.length);

function range(a, b) {
	var res = [], i;
	for (i = a; i <= b; i++) res.push(i);
	return res;
}

function is_divisor(x) {
	return (function (y) { return x % y == 0; })
}

Measured memory_bytes: 16008
h, w = map(int, input().split())
a = [input() for _ in range(h)]
MOD = 10**9+7

dp = [[0]*(w) for _ in range(h)]
dp[0][0] = 1
for i in range(h):
    for j in range(w):
        if i+1 < h and a[i+1][j] == '.':
            dp[i+1][j] += dp[i][j]
            if dp[i+1][j] >= MOD:
                dp[i+1][j] %= MOD
        if j+1 < w and a[i][j+1] == '.':
            dp[i][j+1] += dp[i][j]
            if dp[i][j+1] >= MOD:
                dp[i][j+1] %= MOD
print(dp[h-1][w-1])

Measured memory_bytes: 53488
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()
a = sorted(inpl())
ng = 10**9+1
ok = -1
def sol(x):
    cnt = 0
    for i,t in enumerate(a):
        tmp = x - t
        c = bisect.bisect_left(a,tmp)
        cnt += n-c
    return True if cnt >= m else False

while ng-ok > 1:
    mid = (ng+ok)//2
    if sol(mid):
        ok = mid
    else: ng = mid
    # print(ok,ng)
# print(ok)
res = 0
cnt = 0
revc = [0]
for i in range(n)[::-1]:
    revc.append(revc[-1] + a[i])
# print(revc)
for i in range(n):
    j = n-bisect.bisect_left(a,ok-a[i])
    res += j*a[i] + revc[j]
    cnt += j
res -= (cnt-m) * ok
print(res)

Measured memory_bytes: 86084
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
 
using namespace std;
 
auto main() -> int {
  int n,t;
  int m = 10000;
  int ans = 0;
  cin >> n >> t;
  vector<pair<int,int>> p(n);
  for(auto && a : p)cin >> a.first >> a.second;
  for(auto && a : p){
    if(a.second <= t){
      m = min(m,a.first);
    }
  }
  
  if(m != 10000)cout << m << endl;
  else cout << "TLE" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void) {
  char S[11];
  char T[12];

  scanf("%s", &S);
  scanf("%s", &T);
  int l = strlen(S);
  int cnt = 0;
  for (int i = 0; S[i] != '\0'; i++) {
    if (S[i] != T[i]) {
      cnt++;
    }
  }
  if (cnt == 0) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 1648
#include<stdio.h>

main()
{
  int tall[10],temp;
  int c,i;
  
  for(i=0;i<10;i++){
    scanf("%d",(tall+i));
  }
  for(i=10;i>0;i--){
    for(c=0;c<i;c++){
      if(tall[c]<tall[c+1]){
	temp=tall[c+1];
	tall[c+1]=tall[c];
	tall[c]=temp;
      }
    } 
  }
  for(i=0;i<3;i++){
    printf("%d\n",tall[i]);
  }
  return 0;
}

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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	string s;
	cin >>s;
	bool N=false;
	bool S=false;
	bool E=false;
	bool W=false;
	for (int i=0; i<s.size(); i++)
		if ('N'==s.at(i))
			N=true;
		else if ('S'==s.at(i))
			S=true;
		else if ('E'==s.at(i))
			E=true;
		else
			W=true;
	if ((N==S)&&(E==W))
		cout <<"Yes" <<endl;
	else
		cout <<"No" <<endl;
	return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double result = 0;
            bool Isend = false;

            List<string> resultlist = new List<string>();

            while (true)
            {
                string[] Input = Console.ReadLine().Split(' ');

                switch (Input[1])
                {
                    case "+":
                        result = int.Parse(Input[0]) + int.Parse(Input[2]);
                        break;

                    case "-":
                        result = int.Parse(Input[0]) - int.Parse(Input[2]);
                        break;

                    case "*":
                        result = int.Parse(Input[0]) * int.Parse(Input[2]);
                        break;

                    case "/":
                        result = int.Parse(Input[0]) / int.Parse(Input[2]);
                        break;

                    default:
                        Isend = true;
                        break;
                }

                //???????????\???(?)?????\???????????????????????????
                if (Isend) break;


                double truncation = Math.Truncate(result);
                resultlist.Add(truncation.ToString());

            }

            foreach(string output in resultlist)
            {
                Console.WriteLine(output);
            }

        }

    }

}

Measured memory_bytes: 9272
#include <iostream>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

bool used[405][405];

int main()
{
    int h, w;
    cin >> h >> w;
    char s[405][405];
    for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) cin >> s[i][j];
    ll ans = 0;
    for(int i = 0; i < h; i++) for(int j = 0; j < w; j++){
        if(used[i][j]) continue;
        used[i][j] = true;
        ll white = 0, black = 0;
        if(s[i][j] == '#') black++;
        else white++;
        queue<P> que;
        que.push(P(i, j));
        while(que.size()){
            P p = que.front();
            que.pop();
            if(s[p.first][p.second] == '#'){
                for(int l = 0; l < 4; l++){
                    int x = p.first + dx[l], y = p.second + dy[l];
                    if(x >= 0 && x < h && y >= 0 && y < w && s[x][y] == '.' && !used[x][y]){
                        white++;
                        que.push(P(x, y));
                        used[x][y] = true;
                    }
                }
            }
            else{
                for(int l = 0; l < 4; l++){
                    int x = p.first + dx[l], y = p.second + dy[l];
                    if(x >= 0 && x < h && y >= 0 && y < w && s[x][y] == '#' && !used[x][y]){
                        black++;
                        que.push(P(x, y));
                        used[x][y] = true;
                    }
                }
            }
        }
        ans += white * black;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(50) << setiosflags(ios::fixed);
  vector<int> v;
  int q;
  cin >> q;
  rep(qi, q)
  {
    int type;
    cin >> type;
    if (type == 0)
    {
      int x;
      cin >> x;
      v.push_back(x);
    }
    else if (type == 1)
    {
      int p;
      cin >> p;
      cout << v[p] << endl;
    }
    else
    {
      v.pop_back();
    }
  }
  return 0;
}



Measured memory_bytes: 3816
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
int ans[8];

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  int high = 0;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    if(a < 3200)ans[a / 400]++;
    else high++;
  }
  int res = 0;
  for(int i = 0; i < 8; i++){
    if(ans[i] != 0)res++;
  }
  if(res == 0)cout << 1 << " " << high << endl;
  else cout << res << " " << res + high << endl;
	return 0;
}


Measured memory_bytes: 256
/* ****TCIITB**** */

#include<bits/stdc++.h>
#define io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

#define N  100005

int main()
{
	
	io

	ll l;
	cin>>l;
	long double res=(l*1.0)/3;
	res=(res*res*res);
	cout<<fixed<<setprecision(21)<<res;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<unsigned P> struct ModInt {
  using M = ModInt;
  unsigned v;
  ModInt() : v(0) {}
  ModInt(auto x) : v(x >= 0 ? x % P : (P - -x % P) % P) {}
  constexpr ModInt(unsigned v, int) : v(v) {}
  static constexpr unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool) *this; }
  M operator*(M r) const { return M(*this) *= r; }
  M operator/(M r) const { return M(*this) /= r; }
  M operator+(M r) const { return M(*this) += r; }
  M operator-(M r) const { return M(*this) -= r; }
  bool operator==(M r) const { return v == r.v; }
  bool operator!=(M r) const { return !(*this == r); }
  M& operator*=(M r) { v = (uint64_t) v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; }
  M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  M pow(auto n) const {
    if (n < 0) return pow(-n).inv();
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
  friend M operator*(auto l, M r) { return M(l) *= r; }
  friend M operator/(auto l, M r) { return M(l) /= r; }
  friend M operator+(auto l, M r) { return M(l) += r; }
  friend M operator-(auto l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend istream& operator>>(istream& is, M& r) { lint x; is >> x; r = x; return is; }
  friend bool operator==(auto l, M r) { return M(l) == r; }
  friend bool operator!=(auto l, M r) { return !(l == r); }
};
using Mint = ModInt<(unsigned) 1e9 + 7>;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  VV<Mint> dp(n + 1, V<Mint>(n + 1));
  dp[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    char c; cin >> c;
    if (c == 'D') {
      for (int x = 0; x <= i; ++x) {
        dp[i + 1][x] += dp[i][x] * x;
        if (x) dp[i + 1][x - 1] += dp[i][x] * x * x;
      }
    } else if (c == 'U') {
      for (int x = 0; x <= i; ++x) {
        dp[i + 1][x + 1] += dp[i][x];
        dp[i + 1][x] += dp[i][x] * x;
      }
    } else {
      for (int x = 0; x <= i; ++x) {
        dp[i + 1][x] += dp[i][x];
      }
    }
  }
  cout << dp[n][0] << '\n';
}


Measured memory_bytes: 3300
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
import collections, heapq, itertools, bisect
import math, fractions
import sys, copy

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LIM(): return [-int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline().rstrip())
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline().rstrip())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    N, M = LI()
    A = LIM()
    heapq.heapify(A)
    for _ in range(M):
        x = -heapq.heappop(A)
        heapq.heappush(A, -(x // 2))
    print(-sum(A))

if __name__ == '__main__':
    main()

Measured memory_bytes: 92160
n, ma, mb = map(int,input().split())
INF = 10**6
abmax = 10
nmax = 40
medi = []
sumb = 0
suma = 0
for i in range(n):
    a, b, c = map(int,input().split())
    suma += a
    sumb += b
    medi.append([a,b,c])
dp = [[[INF for k in range(nmax*abmax+1)] for j in range(nmax*abmax+1)] for i in range(nmax+1)]
dp[0][0][0] = 0
for i in range(n):
    a, b, c = medi[i]
    for x in range(suma+1 - a):
        for y in range(sumb+1 - b):
            if dp[i][x][y] == INF:
                continue
            dp[i + 1][x][y] = min(dp[i + 1][x][y], dp[i][x][y])
            dp[i + 1][x + a][y + b] = min(dp[i][x][y] + c, dp[i + 1][x + a][y + b])

t = 1
ok = False
ans = INF
for ca in range(1,nmax*abmax+1):
    for cb in range(1,nmax*abmax+1):
        if ma*cb == mb*ca:
            ans = min(ans, dp[n][ca][cb])
    
print(ans if ans != INF else -1)

Measured memory_bytes: 61684
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

int main() {
  int N;
  cin >> N;

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

  vector<int> ans(N);
  bool possible = true;
  for (int i = N - 1; i >= 0; i--) {
    bool tempPos = false;
    for (int j = b.size() - 1; j >= 0; j--) {
      if (b[j] == j + 1) {
        ans[i] = b[j];
        tempPos = true;
        for (int k = j; k < b.size() - 1; k++) {
          b[k] = b[k + 1];
        }
        b.pop_back();
      }
      if (tempPos) {
        break;
      }
    }
    if (!tempPos) {
      possible = false;
      break;
    }
  }

  if (possible) {
    for (int i = 0; i < N; i++) {
      cout << ans[i] << endl;
    }
  } else {
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import math
t = input().split(" ")
A, B, H, M = [int(te) for te in t]

mins = H * 60 + M

l = mins * 0.5
s = M * 6

c2 = A*A + B*B - 2*A*B*math.cos(math.radians(abs(l-s)))

print(pow(c2,0.5))

Measured memory_bytes: 62444
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int c[3][3];
    for(int i = 0;i<3;i++){
        for(int j = 0;j<3;j++){
            cin >> c[i][j];
        }
    }
    bool fl = true;
    for(int i = 0;i<2;i++){
        if((c[1][i+1]-c[1][i])!=(c[2][i+1]-c[2][i]) || (c[2][i+1]-c[2][i])!=(c[0][i+1]-c[0][i]) || (c[1][i+1]-c[1][i])!=(c[0][i+1]-c[0][i])){
            fl = false;
        }
    }
    for(int i = 0;i<2;i++){
        if((c[i+1][0]-c[i][0])!=(c[i+1][1]-c[i][1]) || (c[i+1][2]-c[i][2])!=(c[i+1][1]-c[i][1]) || (c[i+1][0]-c[i][0])!=(c[i+1][2]-c[i][2])){
            fl = false;
        }
    }
    if(fl){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
object Main extends App {
	val s = scala.io.StdIn.readLine.toList.sorted
	val t = scala.io.StdIn.readLine.toList.sorted.reverse

	def check(a: List[Char], b: List[Char]): Boolean = {
		a match {
			case Nil => b match {
				case Nil => false
				case _   => true 
			}
			case e::rest => b match {
				case Nil => false
				case _ => if(e == b.head) check(rest, b.tail)
							else if( e < b.head) true
							else false
			}
			
		}	
	} 

	if(check(s,t)) println("Yes")
	else println("No")
}

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

int n,m;
vector<bool>visited;
vector<vector<int> >g;
int num_visited = 0;
int ans = 0;

void dfs(int v){
    visited[v] = true;
    num_visited++;
    if(num_visited == n)    ans++;
    for(int i = 0; i < g[v].size(); i++){
	int next = g[v][i];
	if(!visited[next])  dfs(next);
    }
    visited[v] = false;
    num_visited--;
}

int main(){
    cin >> n >> m;
    g = vector<vector<int> >(n);
    visited = vector<bool>(n, false);
    rep(i, m){
	int a,b;    cin >> a >> b;
	a--;	
	b--;
	g[a].push_back(b);
	g[b].push_back(a);
    }
    dfs(0);
    cout << ans << endl;
}


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

typedef long long ll;
typedef long double ld;

const int inf = 1e9;

int main(){
  int k;
  cin>>k;
  ll sum = 0;
  for(int a = 1; a <= k; ++a){
    for(int b = 1; b <= k; ++b){
      for(int c = 1; c <= k; ++c){
	int x = __gcd(a, b);
	int y = __gcd(x, c);
	sum += y;
      }
    }
  }
  cout<<sum<<endl;
  return 0;
}




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

namespace AtCorder
{
	public class Program
	{
		const long MOD = 1000000007;
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			int n = cin.Int();
			int d = cin.Int();
			int ans = n / (2 * d + 1);
			if (n % (2 * d + 1) != 0) {
				ans++;
			}
			Console.WriteLine(ans);
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;
		
		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
int main(){
    int height, width;
    cin >> height >> width;
    vector<vector<char>> cell(height, vector<char>(width));
    rep(i, 0, cell.size()){
        rep(j, 0, cell.at(0).size()){
            cin >> cell.at(i).at(j);
        }
    }
    vector<bool> rows(cell.size(), false);
    vector<bool> columns(cell.at(0).size(), false);
    rep(i, 0, cell.size()){
        rep(j, 0, cell.at(0).size()){
            if(cell.at(i).at(j) == '#'){
                rows.at(i) = true;
                columns.at(j) = true;
            }
        }
    }
    rep(i, 0, cell.size()){
        if(rows.at(i)){
            rep(j, 0, cell.at(0).size()){
                if(columns.at(j)){
                    cout << cell.at(i).at(j);
                }
            }
            cout << endl;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    ll k;
    cin >> n >> k;
    int a[n + 1];
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    vector<bool> vis(n + 1, false);
    vector<ll> vstep(n + 1);
    ll steps = 0;
    int i;
    for (i = 1; steps != k;)
    {
        if (vis[i])
        {
            ll cyc = steps - vstep[i], sleft = k - steps;
            ll smore = sleft % cyc;
            // cout << "smore: " << smore << "\n";
            // cout << "i :" << i << "\n";
            int j;
            for (j = i; smore > 0; smore--)
            {
                j = a[j];
            }
            cout << j;
            return 0;
        }
        else
        {
            vis[i] = true;
            vstep[i] = steps;
            i = a[i];
        }
        steps++;
    }
    cout << i;
    return 0;
}

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

int main(){

	int N, D, X;
	cin >> N >> D >> X;
	vector<int> A(105);
	int ans = 0;
	for(int i = 0; i < N; i++)
	{
		cin >> A[i];
		int cnt = 0, day = 0;
		while(D >= day){
			day = A[i] * cnt + 1;
			cnt++;
		}
		ans += cnt-1;
		
	}
	cout << ans + X << endl;
	
}

Measured memory_bytes: 256