akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

signed main()
{
  ll t_hp;
  ll t_at;
  ll a_hp;
  ll a_at;

  cin >> t_hp >> t_at >> a_hp >> a_at;

  bool turn = true;
  string ans;

  while (t_hp > 0 && a_hp > 0)
  {
    if (turn)
    {
      // true → takahashi's turn
      a_hp -= t_at;
      turn = !turn;
    }
    else
    {
      // false → aoki's turn
      t_hp -= a_at;
      turn = !turn;
    }
  }

  // check
  if (t_hp > 0)
  {
    ans = "Yes";
  }
  else
  {
    ans = "No";
  }

  cout << ans << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  string S;
  int N, a, b;
  cin >> S;
  N=S.size();
  a=0;
  b=0;
  vector<string> T(N);
  vector<string> U(N);
  for (int i=0; i<N; i++) {
    T[i]=S.at(i);
    U[i]=S.at(N-1-i);
  }
  for (int j=0; j<N; j++) {
    if (T[j]==U[j]) {
      a=a+1;
    }
  }
  vector<string> V((N-1)/2);
  for (int k=0; k<(N-1)/2; k++) {
    V[k]=S.at((N-3)/2-k);
  }
  for (int l=0; l<(N-1)/2; l++) {
    if (T[l]==V[l]) {
      b=b+1;
    }
  }
  if (a==N && b==(N-1)/2) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1000000000; 

int main(){
  string s;
  cin >> s;
  if(s[2] == s[3] && s[4] == s[5]){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N, ans;
std::vector<std::vector<LL>>dist;
std::vector<std::vector<bool>>flag;

bool warshall_floyd(LL V)
{
	for (LL k = 0; k < V; ++k)
	{
		for (LL i = 0; i < V; ++i)
		{
			for (LL j = 0; j < V; ++j)
			{
				if (dist[i][j] > dist[i][k] + dist[k][j]) return false;
				if (dist[i][j] == dist[i][k] + dist[k][j] && (i != k && k != j)) flag[i][j] = true;
			}
		}
	}
	return true;
}

int main()
{
	in >> N;
	dist.resize(N);
	flag.resize(N);
	rep(i, dist.size()) dist[i].resize(N);
	rep(i, flag.size()) flag[i].resize(N);
	rep(i, N) rep(j, N) in >> dist[i][j];
	if (!warshall_floyd(N)) out << -1 << std::endl;
	else
	{
		rep(i, N) rep(j, i + 1) ans += (!flag[i][j] ? dist[i][j] : 0);
		out << ans << std::endl;
	}
	return 0;
}


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

struct Node {
  int key;
  Node *right,*left,*parent;
};

Node *root, *NIL;

void insert(int k) {
  Node *y=NIL;
  Node *x=root;
  Node *z;
  z=(Node *)malloc(sizeof(Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  while (x!=NIL) {
    y=x;
    if (z->key<x->key) {
      x=x->left;
    } else {
      x=x->right;
    }
  }
  z->parent=y;
  if (y==NIL) {
    root=z;
  } else {
    if (z->key<y->key) {
      y->left=z;
    } else {
      y->right=z;
    }
  }
}
void inorder(Node *u) {
  if (u==NIL) {
    return;
  }
  inorder(u->left);
  cout<<" "<<u->key<<flush;
  inorder(u->right);
}
void preorder(Node *u) {
  if (u==NIL) {
    return;
  }
  cout<<" "<<u->key<<flush;
  preorder(u->left);
  preorder(u->right);
}
int main() {
  int n;
  scanf("%d",&n);
  string com;
  int x;
  for (int i=0; i<n; i++) {
    cin>>com;
    if (com=="insert") {
      scanf("%d",&x);
      insert(x);
    } else if (com=="print") {
      inorder(root);
      cout<<endl;
      preorder(root);
      cout<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 26628
//
//  main.cpp
//  N
//
//  Created by Charles on 2017/10/1.
//  Copyright © 2017年 Charles. All rights reserved.
//

#include <iostream>
using namespace std;
#define ll long long
const int maxn=3501;
ll n;
int main(int argc, const char * argv[]) {
    ll a,b;
    ll c;
    scanf("%lld",&n);
    for(a=1;a<=maxn;++a)
        for(b=1;b<=maxn;++b){
            ll x=4*a*b-n*b-n*a;
            ll y=n*a*b;
            if(x>0 && y%x==0) {
                c=y/x;
                cout<<a<<" "<<b<<" "<<c<<endl;
                return 0;
            }
        }
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Comparator;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author HossamDoma
*/public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
static class TaskA   {
public void solve(int testNumber, InputReader in, PrintWriter out) {

        choice[] val = new choice[4];
        val[0] = new choice(0.25, in.nextLong());
        val[1] = new choice(0.50, in.nextLong());
        val[2] = new choice(1, in.nextLong());
        val[3] = new choice(2, in.nextLong());

        int n = in.nextInt();

        Arrays.sort(val, Comparator.comparing(o -> (long)((long)((2.0 / o.sz)) * o.v)));

        long ans = 0;

        for(int i = 0; n > 0 && i < 4; ++i){
            double cap = val[i].sz;
            long tmp = (long) (n / cap) * val[i].v;
            ans += tmp;
            n %= cap;
        }

        out.println(ans);

    }

class choice   {
long v;
double sz;

public choice(double sz, long v) {
            this.v = v;
            this.sz = sz;
        }

}

}
static class InputReader   {
public BufferedReader reader;
public StringTokenizer tokenizer;

public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

public int nextInt() {
        return Integer.parseInt(next());
    }

public Long nextLong() {
        return Long.parseLong(next());
    }

}
}



Measured memory_bytes: 26452
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  int N; cin >> N;
  vi a(N);
  rep(i, N) {
    cin >> a[i];
  }
  sort(all(a));
  ll l = 0,   vl = a[l];
  ll r = N-1, vr = a[r];
  ll ans = vr - vl;

  while (r - l > 1) {
    ll l1 = abs(a[l+1] - vl), l2 = abs(a[l+1] - vr);
    ll r1 = abs(a[r-1] - vl), r2 = abs(a[r-1] - vr);
    if (l1>=l2 && l1>=r1 && l1>=r2) {
      ans += l1;
      vl = a[++l];
    } else if (l2>=l1 && l2>=r1 && l2>=r2) {
      ans += l2;
      vr = a[++l];
    } else if (r1>=l1 && r1>=l2 && r1>=r2) {
      ans += r1;
      vl = a[--r];
    } else {
      ans += r2;
      vr = a[--r];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())

# https://note.nkmk.me/python-prime-factorization/


def prime_factorize(n):
  a = []
  while n % 2 == 0:
    a.append(2)
    n //= 2
  f = 3
  while f * f <= n:
    if n % f == 0:
      a.append(f)
      n //= f
    else:
      f += 2
  if n != 1:
    a.append(n)
  return a


import collections

c = collections.Counter(prime_factorize(n))

ans = 0
for k, v in c.items():
  dprint('k', '=', k)
  dprint('v', '=', v)
  a = 0
  i = 0
  while True:
    if v < i * (i + 1) // 2:
      a = i - 1
      break
    i += 1
  dprint('a', '=', a)
  ans += a


print(ans)


Measured memory_bytes: 9488
#include "bits/stdc++.h"
using namespace std;

using ll = long long;
#define pb push_back
#define fastread ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define all(v) v.begin(), v.end()
#define file freopen("in.txt", "r", stdin);
#define pii pair<int, int>
#define pll pair<ll, ll>

const int maxn = 105;
ll dp[maxn][100005];
int n, w;
pll p[maxn];

ll call(int i, int ammount){
	if(i >= n)return 0;
	if(dp[i][ammount] != -1)return dp[i][ammount];
	ll ret = 0, ret1 = 0;
	if(ammount + p[i].first <= w)ret = p[i].second + call(i+1, ammount + p[i].first);
	ret1 = call(i+1, ammount);
	return dp[i][ammount] = max(ret, ret1);
}

int main(){
	//file
	scanf("%d %d", &n, &w);
	for(int i=0; i<n; i++)scanf("%lld %lld", &p[i].first, &p[i].second);
	memset(dp, -1, sizeof dp);
	cout<<call(0, 0)<<endl;
}

Measured memory_bytes: 82304
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

 
int main() {

    ll a,b,c;
    cin >> a >> b >> c;

    if(c-a-b<0) {
        cout<<"No"<<endl;
        return 0;
    }
    if(4*a*b<(c-a-b)*(c-a-b)) {
        cout<<"Yes"<<endl;
    }
    else {
        cout<<"No"<<endl;
    }

    

 return 0;
}

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

int main() {
    string S, ans = "Yes";
    cin >> S;
    for (int i = 0; i < S.size(); i++) {
        if ((i % 2 && S[i] == 'R') || (i % 2 == 0 && S[i] == 'L')) {
            ans = "No";
        }
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
/*
template<class... T>
ostream& operator<<(ostream& os, tuple<T...>& t) {
	for (size_t i = 0; i < tuple_size< tuple<T...> >::value; ++i) {
		if (i) os << " ";
		os << get<0>(t);
	}
	return os;
}
*/
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

class Dice;
bool operator<(const Dice& d1, const Dice& d2);
class Dice {
private:
	int top, front, right, left, back, bottom;
public:
	Dice(vector<int> v) {
		top = v[0], front = v[1], right = v[2], left = v[3], back = v[4], bottom = v[5];
	}
	Dice(int top, int front, int right, int left, int back, int bottom) : top(top), front(front), right(right), left(left), back(back), bottom(bottom) {
	}
	vector<int> toV() const {
		vector<int> res = {top, front, right, left, back, bottom};
		return res;
	}
	Dice rotR() const {
		return Dice(left, front, top, bottom, back, right);
//		return Dice(top, left, front, back, right, bottom);
	}
	Dice rotD() const {
		return Dice(back, top, right, left, bottom, front);
	}
	set< vector<int> > p() {
		set< vector<int> > res; res.insert( toV() );
		REP(i, 30) {
			EACH(x, res) {
				Dice d(x);
				res.insert( d.rotR().toV() );
				res.insert( d.rotD().toV() );
			}
		}
		return res;
	}
	bool operator==(Dice& d) {
		/*
		EACH(x, p1) {
			if (p2.count(x) > 0) {
				return true;
			}
		}
		return false;
		*/
		return p().count(d.toV());
	}
};
/*
bool operator<(const Dice& d1, const Dice& d2) {
	return d1.toV() < d2.toV();
}
*/

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N; cin >> N;
	vector<Dice> d;
	REP(i, N) {
		vector<int> v(6); cin >> v;
		d.pb( Dice(v) );
	}
	set< vector<int> > ss =d[0].p();
//	for (vector<int> x : ss) cout << x << endl;
	bool ans = false;
	REP(i, N) REP(j, N) {
		if (i != j && d[i] == d[j]) {
//			cout << i << "==" << j << endl;
			ans = true;
		}
	}
	if (!ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t a,b,n;
    cin >> a >> b >> n;
    int64_t res = 0;
    cout << a*(min(n,b-1))/b << endl;
}

Measured memory_bytes: 3396
package main

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

var (
	input  = bufio.NewScanner(os.Stdin)
	tokens []string
)

// genTokens generates tokens from the input, and puts it into the tokens array.
func genTokens() {
	if !input.Scan() {
		panic("No more input")
	}

	nextFields := strings.Fields(input.Text())
	tokens = append(tokens, nextFields...)
}

// nextInt returns next int in its input, or panics if no input.
func nextInt() int {
	if len(tokens) == 0 {
		genTokens()
	}
	if len(tokens) == 0 {
		panic("No more input")
	}

	next := tokens[0]
	tokens = tokens[1:]

	ret, err := strconv.Atoi(next)
	if err != nil {
		panic(err)
	}
	return ret
}

// nextInt64 returns next int in its input, or panics if no input.
func nextInt64() int64 {
	if len(tokens) == 0 {
		genTokens()
	}
	if len(tokens) == 0 {
		panic("No more input")
	}

	next := tokens[0]
	tokens = tokens[1:]

	ret, err := strconv.ParseInt(next, 10, 64)
	if err != nil {
		panic(err)
	}
	return ret
}

// next returns the next string separated by spaces, or panics if no input.
func next() string {
	if len(tokens) == 0 {
		genTokens()
	}
	if len(tokens) == 0 {
		panic("No more input")
	}

	next := tokens[0]
	tokens = tokens[1:]

	return next
}

func main() {
	n := nextInt()
	switch n % 10 {
	case 2:
		fallthrough
	case 4:
		fallthrough
	case 5:
		fallthrough
	case 7:
		fallthrough
	case 9:
		fmt.Println("hon")
	case 0:
		fallthrough
	case 1:
		fallthrough
	case 6:
		fallthrough
	case 8:
		fmt.Println("pon")
	case 3:
		fmt.Println("bon")
	}
}


Measured memory_bytes: 1756
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vi>

// ref https://atcoder.jp/contests/abc176/submissions/16160744
int walkable(int now_h, int now_w, int max_h, int max_w, int goal_h, int goal_w,
             vector<string> &data, vector<vector<int>> &dist) {
  char forwardable = '.';
  priority_queue<vi, vvi, greater<vi>> q;
  vector<vector<bool>> visited(max_h, vector<bool>(max_w, false));
  // start
  int cnt = 0;
  q.push({0, now_h, now_w});
  dist[now_h][now_w] = 0;
  while (!q.empty()) {
    int nd = q.top().at(0);
    int nh = q.top().at(1);
    int nw = q.top().at(2);
    q.pop();

    FOR(i, -2, 3) {
      FOR(j, -2, 3) {
        int next_h = nh + i;
        int next_w = nw + j;
        int cost = (abs(i) + abs(j) > 1) ? 1 : 0;
        if (next_h < 0 || next_h >= max_h) continue;
        if (next_w < 0 || next_w >= max_w) continue;
        if (data[next_h][next_w] != forwardable) continue;
        if (dist[next_h][next_w] <= nd) continue;
        if (dist[next_h][next_w] > dist[nh][nw] + cost) {
          dist[next_h][next_w] = dist[nh][nw] + cost;
          q.push({nd + cost, next_h, next_w});

          /*
          REP(l, max_h) {
            REP(m, max_w) { cout << dist[l][m] << " "; }
            cout << endl;
          }
          cout << endl;
          */
        }
      }
    }
  }
  return dist[goal_h][goal_w];
}

int main() {
  int h, w, ch, cw, dh, dw;
  cin >> h >> w;
  cin >> ch >> cw;
  cin >> dh >> dw;
  ch--;
  cw--;
  dh--;
  dw--;
  vector<string> data(h);
  REP(i, h) { cin >> data[i]; }
  vector<vector<int>> dist(h, vector<int>(w, INT_MAX));
  int ans = walkable(ch, cw, h, w, dh, dw, data, dist);

  if (ans != INT_MAX) {
    cout << ans << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}

Measured memory_bytes: 9864
#include<bits/stdc++.h>
using namespace std;
using ll = long long ;
int main()
{
    ll n;
    cin>>n;
    if(n>=400&&n<=599)cout<<8<<endl;
   else  if(n>=600&&n<=799)cout<<7<<endl;
   //else  if(n<=600&&n>=799)cout<<7<<endl;
   else  if(n>=800&&n<=999)cout<<6<<endl;
   else  if(n>=1000&&n<=1199)cout<<5<<endl;
   else  if(n>=1200&&n<=1399)cout<<4<<endl;
   else  if(n>=1400&&n<=1599)cout<<3<<endl;
   else  if(n>=1600&&n<=1799)cout<<2<<endl;
   else  if(n>=1800&&n<=1999)cout<<1<<endl;
}
///6+10+3+10+9+15+3


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  vector<int> p(N);
  for (int i=0;i < N;++i) {
    cin >> p[i];
  }
  sort(p.begin(), p.end());
  int ca = 0;
  int cab = 0;
  int cb = 0;
  for (int i=0;i < N;++i) {
    if (p[i] <= A) {
      ca++;
    }
    if (p[i] >= A + 1 && p[i] <= B) {
      cab++;
    }
    if (p[i] >= B+1) {
      cb++;
    }
  }
  if(ca <= cab && ca <= cb) {
    cout << ca << endl;
  } else if(cab <= ca && cab <= cb) {
    cout << cab << endl;
  } else if(cb <= ca && cb <= cab) {
    cout << cb << endl;
  } else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int p25,p5,p1,p2;
int q,s,h,d,n;
int main()
{
	scanf("%d%d%d%d",&q,&h,&s,&d);
	h = min(q * 2,h);
	s = min(h * 2, s);
	d = min(s * 2,d);
	scanf("%d",&n);
	long long ans = 0;
	ans = (long long)n / 2 * d + n % 2 * s;
	printf("%lld\n",ans);
	return 0;
}

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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

int main() {
    int X;
    cin >> X;
    if (X >= 30) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


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

void dfs(const vector<vector<int>> &to, vector<int> &d, int current) {
  for (auto next : to.at(current)) {
    if (d.at(next) == -1) {
      d.at(next) = d.at(current) + 1;
      dfs(to, d, next);
    }
  }
}

int main() {
  int n, u, v;
  cin >> n >> u >> v;
  u--; v--;
  vector<vector<int>> to(n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    to.at(a).push_back(b);
    to.at(b).push_back(a);
  }
  vector<int> du(n, -1), dv(n, -1);
  du.at(u) = 0;
  dv.at(v) = 0;
  dfs(to, du, u);
  dfs(to, dv, v);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (du.at(i) < dv.at(i)) ans = max(ans, dv.at(i) - 1);
  }
  cout << ans << endl;
}


Measured memory_bytes: 11648
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  a[0]=0; a[n+1]=0;
  for(int i=1;i<n+1;i++) cin >> a[i];
  
  int cost[n];
  for(int i=0;i<n+1;i++){
    cost[i] = a[i+1]-a[i];
    if(cost[i]<0) cost[i]=-cost[i];
  }
  
  int sum;
  for(int i=0;i<n+1;i++) sum = sum+cost[i];
    
  int div[n];
  for(int i=1;i<n+1;i++){
    div[i]=a[i+1]-a[i-1];
    if(div[i]<0) div[i]=-div[i];
  }
  
  int ans[n];
  for(int i=1;i<n+1;i++){
    ans[i]= sum - cost[i-1] - cost[i] + div[i]-4197302;
    cout << ans[i] << endl;
  }
  return 0;
} 

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

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define int long long
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 2000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,neg,poz,sif;
int cev;
string s;
vector<int> v,ek,ar,ek1,ar1;

main(void){
	scanf("%lld %lld",&n,&k);
	FOR{
		scanf("%lld",&a[i]);
		if(a[i]<0){
			neg++;
			ek.pb(a[i]);
		}
		if(a[i]>0){
			poz++;
			ar.pb(a[i]);
		}
		if(a[i]==0){
			sif++;
			//~ ar.pb(0);
			//~ ek.pb(0);
		}
	}
	int at=neg*poz;
	int yes=at;
	at+=sif*(sif-1)/2+sif*(neg+poz);
	if(k>yes && k<=at){printf("0\n");return 0;}
	sort(a+1,a+n+1);
	sort(ar.begin(),ar.end());
	ar1=ar;
	reverse(ar1.begin(),ar1.end());
	sort(ek.begin(),ek.end());
	ek1=ek;
	reverse(ek.begin(),ek.end());
	if(k<=yes){
		int bas=-inf;
		int son=-1;
		int say=0;
		while(bas<=son){
			say=0;
			//~ reverse(ek.begin(),ek.end());
			//~ reverse(ar1.begin(),ar1.end());
			FOR{
				//~ if(a[i]==0){say+=n-1;continue;}
				if(a[i]<0){
					int start=0;
					int end=(int)ar1.size()-1;
					while(start<=end){
						if(ar1[mid]*a[i]>ort)end=mid-1;
						else start=mid+1;
					}
					//~ if(end<(int)ar1.size() && end>=0)
					//~ if(ar1[end]>=i)end--;
					say+=end+1;
				}
				else if(a[i]>0){
					int start=0;
					int end=(int)ek1.size()-1;
					while(start<=end){
						if(ek1[mid]*a[i]>ort)end=mid-1;
						else start=mid+1;
					}
					//~ if(end<(int)ek1.size() && end>=0)
					//~ if(ek[end]>=a[i])end--;
					say+=end+1;
				}
				//~ if(ort==1)cout<<say<<"**&&*"<<endl;
			}
			say/=2;
			if(say<k)bas=ort+1;
			else son=ort-1;
			//~ cout<<say<<" : : "<<bas<<" : : "<<son<<endl;
		}
		printf("%lld\n",bas);
	}
	else{
		int bas=1;
		int son=inf;
		int say=0;
		while(bas<=son){
			say=0;
			FOR{
				if(a[i]==0){say+=n-1;continue;}
				if(a[i]>0){
					int start=0;
					int end=(int)ar.size()-1;
					while(start<=end){
						if(ar[mid]*a[i]>ort)end=mid-1;
						else start=mid+1;
					}
					if(end<(int)ar.size() && end>=0)
					if(ar[end]>=a[i])end--;
					say+=end+1+ek.size()+sif;
				}
				else{
					int start=0;
					int end=(int)ek.size()-1;
					while(start<=end){
						if(ek[mid]*a[i]>ort)end=mid-1;
						else start=mid+1;
					}
					if(end<(int)ek.size() && end>=0)
					if(ek[end]<=a[i])end--;
					say+=end+1+ar.size()+sif;
				}
				
			}
			say/=2;
			if(say>=k)son=ort-1;
			else bas=ort+1;
			//~ cout<<say<<" : : "<<bas<<" : : "<<son<<endl;
		}
		printf("%lld\n",bas);
	}
	
	return 0;
}



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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

int main(){
	summon_tourist;

	int A, B; cin >> A >> B;
	cout << A*B << ln;
}


Measured memory_bytes: 3660
import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;


public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] v = br.readLine().split(" ");
        String[] c = br.readLine().split(" ");
        int[] vs = new int[v.length];
        int[] cs = new int[v.length];
        
        for (int i = 0; i < v.length; i++) {
            vs[i] = Integer.parseInt(v[i]);
            cs[i] = Integer.parseInt(c[i]);
        }
        
        int ans = 0;
        for (int i = 0; i < v.length; i++) {
            if (vs[i] > cs[i]) {
                ans += vs[i] - cs[i];
            }
        }
        
        
        System.out.println(ans);
    }
}





Measured memory_bytes: 21332
#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define F first
#define S second
#define f(i,s,n) for(int i=(int)s;i<=(int)n;++i)
#define Fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
void solve()
{
	int n;cin>>n;
	int sum=7;
	for(int i=0;i<1000000;i++){
		if(sum%n==0){
			cout<<i+1;
			return;
		}
		sum=sum*10;
		sum%=n;
		sum+=7;
		sum%=n;
	}
	cout<<-1;
}
int main()
{	Fast;
	//int t;cin>>t;
//	while(t--)
	solve();
}

Measured memory_bytes: 3656
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	int N,u,v,w;cin>>N;
	vector<vector<P>> path(N, vector<P>());
	rep(i,N-1){
		cin>>u>>v>>w;
		--u; --v;
		path[u].push_back(make_pair(v, w));
		path[v].push_back(make_pair(u, w));
	} 
	vector<int>node(N, inf);
	queue<int> Q;
	Q.push(0);
	node[0] = 0;
	while(!Q.empty()){
		int f = Q.front();
		Q.pop();
		for(auto x: path[f]){
			int wei = x.second;
			int t = x.first;
			if(node[t] == inf){
				if(wei % 2 == 1){
					node[t] = node[f] +1;
				}else{
					node[t] = node[f];
				}
				node[t] %= 2;
				Q.push(t);
			}
		}
	}
	show(node);
	return 0;
}

Measured memory_bytes: 6784
use num::abs;
use proconio::input;
use proconio::marker::{Chars, Isize1};
use std::collections::VecDeque;

fn bfs(
    h: isize,
    w: isize,
    field: Vec<Vec<char>>,
    si: isize,
    sj: isize,
    ti: isize,
    tj: isize,
) -> isize {
    let mut q = VecDeque::<(isize, isize, isize)>::new();
    q.push_back((0, si, sj));
    let mut visited = vec![vec![false; w as usize]; h as usize];
    let mut queued = vec![vec![false; w as usize]; h as usize];
    queued[si as usize][sj as usize] = true;

    while !q.is_empty() {
        let (cost, i, j) = q.pop_front().unwrap();
        if i == ti && j == tj {
            return cost;
        };
        if visited[i as usize][j as usize] {
            continue;
        };
        visited[i as usize][j as usize] = true;
        for ni in i as isize - 2..=i + 2 {
            if ni < 0 || h <= ni {
                continue;
            }
            for nj in j as isize - 2..=j + 2 {
                if nj < 0
                    || w <= nj
                    || field[ni as usize][nj as usize] == '#'
                    || queued[ni as usize][nj as usize]
                {
                    continue;
                }
                match abs(ni - i) + abs(nj - j) {
                    0 => (),
                    1 => {
                        q.push_front((cost, ni, nj));
                        queued[ni as usize][nj as usize] = true;
                    }
                    _ => q.push_back((cost + 1, ni, nj)),
                }
            }
        }
    }

    -1
}

fn main() {
    input! {
        h: isize,
        w: isize,
        ch: Isize1,
        cw: Isize1,
        dh: Isize1,
        dw: Isize1,
        field: [Chars; h],
    }
    let ans = bfs(h, w, field, ch, cw, dh, dw);
    println!("{}", ans);
}


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

int main(){
    int n;
    cin >> n;
    vector<int> x(n);
    for(int i = 0; i < n; i++){
        cin >> x.at(i);
    }
    vector<int> h(100);
    int sum = 0;
    for(int i = 0; i < 100; i++){
        for(int j = 0; j < n; j++){
            sum = sum + abs(x.at(j) - i) * abs(x.at(j)-i);
        }
        h.at(i) = sum;
        sum = 0;
    }
    sort(h.begin(), h.end());
    cout << h.at(0);
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int win = 0;
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == 'o') win++;
        }
        System.out.println(8 - win <= 15 - s.length() ? "YES" : "NO");
        sc.close();

    }

}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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; }

int main(void){
    ll N,K; cin >> N >> K;
    vector<ll> A(N), B(N);
    REP(i,N){
        cin >> A[i];
        B[i] = A[i];
    }

    SORT(A);
    SORT(B); REVERSE(B);

    ll xl=-1000000000000000000,xr=-xl,X=(xl+xr)/2;
    while(xr-xl>1){
        ll tmp = 0;
        REP(i,N-1){
            ll l=-1, r=N, n=(l+r)/2;
            
            if(A[i] < 0){
                while(r-l>1){
                    if(A[i]*B[n] <= X) l = n;
                    else r = n;
                    n = (l+r)/2;
                }
            }
            else{
                while(r-l>1){
                    if(A[i]*A[n] <= X) l = n;
                    else r = n;
                    n = (l+r)/2;
                }
            }
            if(A[i] >= 0) tmp += max((ll)0,r-i-1);
            else tmp += min(N-i-1,r);
        }

        if(tmp < K) xl = X;
        else xr = X;
        X = (xl+xr)/2;
    }
    cout << xr << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define debug(a) cout << #a ": " << a << endl
using namespace std;
typedef long long ll;

int main(void){
    IOS;
    int n, m;
    cin >> n >> m;
    if (m >= n) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}

Measured memory_bytes: 3660
/**
    In the name of Allah, the Most Gracious, the Most Merciful.
**/

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

using ll = long long;

int main() {
    #ifdef _OFFLINE_
        freopen("in.txt", "r", stdin);
    #endif /// _OFFLINE_

    string s;
    cin >> s;
    for(int i=0; i<2; i++) {
        if(s[i]==s[i+1] && s[i] == s[i+2]) {
            puts("Yes");
            exit(0);
        }
    }

    puts("No");
    return 0;

}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int a;
  cin >> a;
  int v[19];
  int c[19];
  int m[19];
  int ans=0;
  for (int i=0;i<a;i++)
  {
    cin >> v[i];
  }
  for (int i=0;i<a;i++)
  {
    cin >> c[i];
  }
  for (int i=0;i<a;i++)
  {
    m[i]=v[i]-c[i];
  }
  for (int i=0;i<a;i++)
  {
    if(m[i]>0)
    {
      ans=ans+m[i];
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  string s;
  cin >> s;
  if(s == "SUN"){
    cout << 7 << endl;
  }
    if(s == "MON"){
    cout << 6 << endl;
  }
  if(s == "TUE"){
    cout << 5 << endl;
  }
  if(s == "WED"){
    cout << 4 << endl;
  }
  if(s == "THU"){
    cout << 3 << endl;
  }
  if(s == "FRI"){
    cout << 2 << endl;
  }
  if(s == "SAT"){
    cout << 1 << endl;
  }
}


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

int n;
int a[1005][1005];
int day[1005];
int pos[1005];
int aa[1005][1005];
bool used[1005];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		for(int j=0;j<n-1;j++){
			scanf("%d",&a[i][j]);
			a[i][j]--;
		}
	}
	queue<P> que;
	for(int i=0;i<n;i++){
		if(!used[a[i][0]] && a[a[i][0]][pos[a[i][0]]]==i){
			used[i]=true;
			used[a[i][0]]=true;
			que.push(P(i,a[i][0]));
			day[i]=1;
			day[a[i][0]]=1;
			pos[i]++;
			pos[a[i][0]]++;
		}
	}
	while(que.size()){
		P p=que.front();
		que.pop();
		used[p.first]=false;
		used[p.second]=false;
		int f=p.first;
		int t=p.second;
		//printf("%d-%d %d %d %d %d\n",f,t,pos[f],pos[t],a[f][pos[f]],a[t][pos[t]]);
		if(pos[f]<n-1 && !used[a[f][pos[f]]] && a[a[f][pos[f]]][pos[a[f][pos[f]]]]==f){
			used[f]=true;
			used[a[f][pos[f]]]=true;
			int mx=max(day[f],day[a[f][pos[f]]]);
			que.push(P(f,a[f][pos[f]]));
			day[f]=mx+1;
			day[a[f][pos[f]]]=mx+1;
			pos[a[f][pos[f]]]++;
			pos[f]++;
		}
		//printf("%d-%d %d %d %d %d\n",f,t,pos[f],pos[t],a[f][pos[f]],a[t][pos[t]]);
		swap(f,t);
		if(pos[f]<n-1 && !used[a[f][pos[f]]] && a[a[f][pos[f]]][pos[a[f][pos[f]]]]==f){
			used[f]=true;
			used[a[f][pos[f]]]=true;
			int mx=max(day[f],day[a[f][pos[f]]]);
			que.push(P(f,a[f][pos[f]]));
			day[f]=mx+1;
			day[a[f][pos[f]]]=mx+1;
			pos[a[f][pos[f]]]++;
			pos[f]++;
		}
	}
	int ans=0;
	for(int i=0;i<n;i++){
		if(pos[i]!=n-1){
			printf("-1\n");
			return 0;
		}
		ans=max(ans,day[i]);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 6144
#include <iostream>
#include <stack>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, char const *argv[])
{
    stack<int> S1;
    stack<pair<int, int>> S2;

    char ch;
    int sum = 0;
    for (int i = 0; cin >> ch; i++) {
        if (ch == '\\') {
            S1.push(i);
        } else if (ch == '/' && S1.size() > 0) {
            int j = S1.top(); S1.pop();
            sum += i - j;
            int a = i - j;
            while (S2.size() > 0 && S2.top().first > j) {
                a += S2.top().second; S2.pop();
            }
            S2.push(make_pair(j, a));
        }
    }

    vector<int> ans;
    while (S2.size() > 0) {
        ans.push_back(S2.top().second);
        S2.pop();
    }
    reverse(ans.begin(), ans.end());

    cout << sum << endl;
    cout << ans.size();
    for (int i = 0; i < ans.size(); i++) {
        cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}




Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll s;
    cin >> s;
    const int v = 1000000000;
    int y3 = (s+v-1)/v;
    int x3 = v*y3 - s;
    cout << "0 0 1000000000 1 " << x3 << " " << y3 << endl;
}

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

int main() {
    int n, ans = 0;
    cin >> n;
    int p[n];
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    for (int i = 2; i < n; i++) {
        if ((p[i - 2] - p[i - 1]) * (p[i - 1] - p[i]) > 0)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define done(x) {cout<<x<<"\n";return 0;}  
using namespace std;

int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    if(a>b || (n==1 && a!=b)) done(0)
    if((n==1 && a==b) || n==2) done(1)
    ll l=a+b,r=a+b;
    l+=(n-2)*a; r+=(n-2)*b;
    cout<<r-l+1<<"\n";
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
const long long p=1e9+7;
long long n;
long long inv[110000];
long long ans=0;
int main(){
	cin>>n;
	inv[1]=1;
	for(long long i=2;i<=n;i++) 
	inv[i]=(p-p/i)*inv[p%i]%p;
	long long f=0;
	long long x1,x2;
	cin>>x1;
	for(long long i=1;i<=n-1;i++){
		cin>>x2;
		f=(f+1)*inv[i]%p+(i-1)*f%p*inv[i]%p;
		ans=(ans+(x2-x1)%p*f%p)%p;
		x1=x2;
	}
	for(int i=1;i<=n-1;i++) ans=(ans*i)%p;
	cout<<ans%p;
}

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

using namespace std;

int main()
{

    int n;
    cin >> n;
    if ((n / 100 == 0 || n / 100 > 12) && (n % 100 == 0 || n % 100 > 12))
        cout << "NA"<<endl;
    else if (n / 100 == 0 || n / 100 > 12)
        cout << "YYMM"<<endl;
    else if (n % 100 == 0 || n % 100 > 12)
        cout << "MMYY"<<endl;
    else
        cout <<"AMBIGUOUS"<<endl;
}


Measured memory_bytes: 256
/** Which of the favors of your Lord will you deny ? **/

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

#define LL long long
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define MP make_pair
#define F first
#define S second

#define ALL(x) (x).begin(), (x).end()
#define DBG(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << endl
#define READ        freopen("alu.txt", "r", stdin)
#define WRITE       freopen("vorta.txt", "w", stdout)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class TIn>using indexed_set = tree<TIn, null_type, less<TIn>,rb_tree_tag, tree_order_statistics_node_update>;

/**

PBDS
-------------------------------------------------
1) insert(value)
2) erase(value)
3) order_of_key(value) // 0 based indexing
4) *find_by_order(position) // 0 based indexing

**/

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);

inline void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int nmax = 2e5+7;
const LL LINF = 1e17;

template <class T>
string to_str(T x)
{
    stringstream ss;
    ss<<x;
    return ss.str();
}

//bool cmp(const PII &A,const PII &B)
//{
//
//}

int main()
{
    optimizeIO();

    char ch;
    cin>>ch;

    if(ch>='a' && ch<='z') cout<<"a"<<endl;
    if(ch>='A' && ch<='Z') cout<<"A"<<endl;

    return 0;
}

/**

**/

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}




Measured memory_bytes: 3632
n,k = map(int,input().split())
A = list(map(int,input().split()))

allvote=0
allvote=sum(A)
# print( allvote )

c=0
for a in A:
    if a>=allvote/(4*k) :
        c+=1

if c>=k :
    ans = "Yes"
else:
    ans = "No"
print(ans)

Measured memory_bytes: 9172
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9 + 7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
#ifdef LOCAL
#define debug(x) cerr << #x << ": " << x << endl
#else
#define debug(x)
#endif
int dx[4] ={ 1,0,-1,0 };
int dy[4] ={ 0,1,0,-1 };

int N;
string S;

inline vector<int> Z_algorithm(string S) {
	vector<int> Z(S.size());
	Z[0] = S.size();
	int i = 1, j = 0;
	while(i < S.size()){
		while(i + j < S.size() && S[j] == S[i + j]) j++;
		Z[i] = j;

		if(j == 0){
			i++;
			continue;
		}
		int k = 1;
		while(i + k < S.size() && k + Z[k] < j){
			Z[i + k] = Z[k];
			k++;
		}
		i += k;
		j -= k;
	}
	return Z;
}

signed main() {
	cin >> N >> S;
	ll ans = 0;
	rep(i, N) {
		string T = S.substr(i, N - i);
		vector<int> v = Z_algorithm(T);
		for(int j = 1; j < v.size(); j++) {
			if(v[j] <= j) ans = max(ans, (ll)v[j]);
		}
	}
	cout << ans << endl;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
using ll = long long;
using ull = unsigned long long;

struct UnionFind {
  vector<int> par;
  vector<int> siz;

  UnionFind(int n) {
    par = vector<int>(n);
    siz = vector<int>(n, 1);
    rep(i, n) {
      par[i] = i;
    }
  }

  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return;
    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
  }

int size(int x) {
    return siz[root(x)];
  }
};

int main() {
  int n; cin >> n;
  vector<tuple<int, int, int>> vt;
  vector<tuple<int, int, int>> xy, yx;
  rep(i, n) {
    int x, y; cin >> x >> y;
    xy.push_back(make_tuple(x, y, i));
    yx.push_back(make_tuple(y, x, i));
  }
  sort(xy.begin(), xy.end());
  sort(yx.begin(), yx.end());
  for(int i = 1; i < n; i++) {
    vt.push_back(make_tuple(get<0>(xy[i]) - get<0>(xy[i-1]), get<2>(xy[i]), get<2>(xy[i-1])));
    vt.push_back(make_tuple(get<0>(yx[i]) - get<0>(yx[i-1]), get<2>(yx[i]), get<2>(yx[i-1])));
  }
  sort(vt.begin(), vt.end());
  UnionFind uf(n);
  ll ans = 0;
  for(tuple<int, int, int> t : vt) {
    if (!uf.same(get<1>(t), get<2>(t))) {
      uf.unite(get<1>(t), get<2>(t));
      ans += get<0>(t);
    }
  }
  cout << ans;
}


Measured memory_bytes: 7212
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);

using namespace std;
typedef long long int  ll;
typedef pair<ll, ll> P;

constexpr int MOD = 1e9 + 7;
constexpr ll inf = 1LL << 60;

//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


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

int main() {
ll n;
cin>>n;

ll a[n+1];
rep(i, n){
	cin>>a[i];
}

ll sa[n+1];
ll wa[n+1];
rep(i, n){
	sa[i]=i-a[i];
	wa[i]=i+a[i];
}

ll cnt=0;

map<ll, ll> mp;
rep(i, n){
if(mp.count(sa[i])) cnt+=mp[sa[i]];

	if(!mp.count(wa[i])) mp[wa[i]]=1;
	else mp[wa[i]]++;


}



cout<<cnt<<endl;

return 0;

}

Measured memory_bytes: 20540
N,K=gets.split.map &:to_i
W=$<.map &:to_i

l=0
r=$$**3
m=r/2

def can? m
  i=0
  k=1
  sum=0
  while i<N
    return false if W[i]>m
    sum+=W[i]
    if m<sum
      sum=W[i]
      k+=1
    end
    i+=1
  end
  k<=K
end

while l+1<r
can?(m) ? r=m : l=m
m=(l+r)/2
end
p l+1

Measured memory_bytes: 7032
def count_scan(s):
    max_min = 0
    compare = 0
    for c in s:
        if c == '(':
            compare += 1
        elif c == ')':
            compare -= 1
            max_min = min(max_min, compare)
    return min(max_min, compare), compare
 
 
def key(lst):
    m, c = lst
    if c > 0:
        return 1, m
    else:
        return -1, c - m
 
 
def main():
    n = int(input())
    lst = [input() for _ in range(n)]
 
    txt = 'No'
    ans = 0
    for max_min, c in sorted([count_scan(s) for s in lst],
                             reverse=True,
                             key=key):
        if max_min + ans < 0:
            break
        ans += c
    else:
        if ans == 0:
            txt = 'Yes'
 
    print(txt)
  
if __name__ == '__main__':
    main()

  

Measured memory_bytes: 171232
#include <stdio.h>
int main(void){
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if(a >= 10){
        printf("-1");
    }else if(b >= 10){
        printf("-1");
    }else{
        printf("%d", a * b);
    }
    
    return 0;
    
}


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

int main(){
    int n;
    cin>>n;
    double ians=0;
    for(int i=0; i<n; i++){
        double a;
        cin>>a;
        ians+=1/a;
    }
    cout<<1/ians;
    return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    cunt=0
    for a in A:
        if a==cunt+1:cunt+=1
    if 1 in A:
        if n==1 and A[0]==1:print(0)
        else:print(n-cunt)
    else:
        print(-1)
        

if __name__=='__main__':
    main()

Measured memory_bytes: 26012