akhauriyash/Code-Regression huggingface dataset:
//#pragma comment(linker, "/STACK:102400000,102400000")
//#include <initializer_list>
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <cassert>
//#include <unordered_map>
//#include <unordered_set>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define eps 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define slla(n) scanf("%lld", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define DE(val) cout<<#val<<": "<<val<<endl;
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); repp(i,1,___T)

const int dx44[5] = { 0,-1,-1,1,1 };
const int dy44[5] = { 0,-1,1,-1,1 };

const int dx4[5] = { 0,-1,0,1,0 };
const int dy4[5] = { 0,0,1,0,-1 };
const int dx8[9] = { 0,-1,0,1,0,1,1,-1,-1 };
const int dy8[9] = { 0,0,1,0,-1,1,-1,1,-1 };
const int maxn = 1e5 + 50;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b, ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a, ll b) { if (a == 0) { return b; } else { return gcd(b%a, a); } }
void YES() { puts("YES"); exit(0); }
void Yes() { puts("Yes");}// exit(0); }
void NO() { puts("NO"); exit(0); }
void No() { puts("No");}// exit(0); }
void one() { puts("-1"); exit(0); }

int n;
struct no
{
    int x;
    int y;
    int t;
}node[maxn];

void solve()
{
    sa(n);
    repp(i,1,n)
    {
        sa(node[i].t);
        sa(node[i].x);
        sa(node[i].y);

        int at = node[i].t - node[i-1].t;
        int dis = abs(node[i].x - node[i-1].x) +  abs(node[i].y - node[i-1].y);
        if(at < dis)
        {
            //DE(at)

            puts("No");
            return;
        }
        else
        {
            if(at % 2 != dis % 2)
            {
                puts("No");
                return;
            }
        }
    }
    puts("Yes");
}

int main()
{

    solve();
    // system("pause");
    return 0;
}

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

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

  vector<pair<long,long>> ab(N);
  for(auto &x: ab) cin >> x.first >> x.second;

  sort(ab.begin(), ab.end());

  priority_queue<long> q;

  auto it = ab.begin();

  long r = 0;

  for(int d=1; d<=M; d++) {
      while(it != ab.end() && it->first <= d) {
          q.push(it->second);
          it++;
      }

      if(!q.empty()) {
          r += q.top(); q.pop();
      }
  }

  cout << r << endl;
}


Measured memory_bytes: 2936
import scala.io.Source

object Main{
  def main(args: Array[String]){
    val dices = for{
      in <- Source.stdin.getLines.toList
    } yield in

    val targets = dices.tail.map(_.split(" ").toList.map(_.toInt)).combinations(2)
    val list = for{
      target <- targets
    } yield {
      val dice1 = new Dice(target.head)
      val dice2 = new Dice(target.last)
      dice1.isEqual(dice2)
    }

    println(if(!list.foldLeft(false)((a,b) => a || b)) "Yes" else "No")
  }
}

class Dice(sur: List[Int]){
  private val index: List[Int] = sur

  def isEqual(dice2:Dice): Boolean={
    val dice = new Dice(index)
    val kindOfDices = List[Dice](dice, dice.rotN, dice.rotS, dice.rotW, dice.rotE, dice.rotN.rotN)

    val torf = for{
      kindOfDice <- kindOfDices
    } yield kindOfDice match{
      case x if(x.index == dice2.index) => true
      case x if(x.rotR.index == dice2.index) => true
      case x if(x.rotR.rotR.index == dice2.index) => true
      case x if(x.rotR.rotR.rotR.index == dice2.index) => true
      case _ => false
    }

    torf.foldLeft(false)((a,b) => a || b)
  }

  def getVal(i: Int): Int = index(i)

  def rotR(): Dice =
    new Dice(index).rotS.rotW.rotN

  def rotN(): Dice =
    new Dice(List[Int](index(1), index(5), index(2), index(3), index(0), index(4)))

  def rotS(): Dice =
    new Dice(List[Int](index(4), index(0), index(2), index(3), index(5), index(1)))

  def rotW(): Dice =
    new Dice(List[Int](index(2), index(1), index(5), index(0), index(4), index(3)))

  def rotE(): Dice =
    new Dice(List[Int](index(3), index(1), index(0), index(5), index(4), index(2)))
}

Measured memory_bytes: 229856
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<long long, long long> pll;
#define rep(i, a, b) for(int i = a; i < b; i++)

ll divisor(ll n) {
  vector< ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      //if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end(), greater<ll>());
  return ret[0];
}

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

    ll t =  divisor(N);
    ll k = N / t;

    cout << t + k - 2 << endl;
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    string S;
    cin >> S;
    for (ll i = 0; i < (ll)S.size(); i++) {
        if (S[i] == '?') S[i] = 'D';
    }
    cout << S << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3772
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*


fun solve() {
    val (H, W, A, B) = rd.readIntArray()

    var gd = Array(H){IntArray(W){0}}

    for (i in 0 until H) {
        for (j in 0 until W) {
            if ((i<B && j<A) || (i>=B && j>=A)) gd[i][j] = 1
        }
    }

    for (i in 0 until H) {
        println(gd[i].joinToString(""))
    }

    return
}


//val rd = debug.Reader("agc", "038", "a", "sample-4")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!!
    } catch (e: Exception) { throw e }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
data class IntPair(val first: Int, val second: Int)
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
}


Measured memory_bytes: 61936
#include <stdio.h>

int main(){
  int n,m;
  scanf("%d", &n);
  m = n % 100;
  
  if((n-m)/100 == 7) printf("Yes");
  else if(m%10 == 7) printf("Yes");
  else if((m-(m%10))/10 ==7) printf("Yes");
  else printf("No");
  
  return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)   for(signed i=0; i<n; i++)
#define yn(b)   cout << ((b)?"Yes":"No") << endl
#define YN(b)   cout << ((b)?"YES":"NO") << endl
#define pr(r)   cout << r << endl
int main(void){
    int a, b;
    cin >> a >> b;
    pr((a+b+1)/2);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<62;



int main(void) {

    ll n;
    cin>>n;
    multiset<ll> s;
    rep(i,n){
        ll d;
        cin>>d;
        s.insert(d);
    }

    ll ans=0;
    
    while(s.size()>1){
        ll x=*prev(s.end());
        s.erase(prev(s.end()));
        ll a=1;
        while(a<=x){a*=2;}
        if(s.find(a-x)!=s.end()){
            ans++;
            s.erase(s.find(a-x));
        }
    }
    fin(ans);

}



Measured memory_bytes: 9600
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;


int main() {
	while (true) {
		int N, M;
		cin >> N >> M;
		if (N == 0)break;
		vi a(N), b(M);
		rep(i, N) {
			cin >> a[i];
		}
		rep(i, M) {
			cin >> b[i];
		}
		sort(all(a));
		sort(all(b));
		int ca = 0, cb = 0;
		ll ans = 0;
		while (ca < N || cb < M) {
			if (ca == N) {
				ans += b[cb];
				cb++;
			}
			else if (cb == M) {
				ans += a[ca];
				ca++;
			}
			else {
				if (a[ca] < b[cb]) {
					ans += a[ca];
					ca++;
				}
				else if (b[cb] < a[ca]) {
					ans += b[cb];
					cb++;
				}
				else {
					ans += a[ca];
					ca++;
					cb++;
				}
			}
		}
		cout << ans << endl;
	}


	return 0;
}

Measured memory_bytes: 3128
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
m = [0] * M
d = [0] * (max(a) + 1)
for x in a:
  d[x] += 1
  m[x % M] += 1

res = 0
for i in range(M):
  t = min(m[i], m[(M - i) % M])
  if i == (M - i) % M:
    t = m[i] // 2
  m[i] -= t
  m[(M - i) % M] -= t
  res += t

for i in range(N):
  x = a[i]
  if m[x % M] > 1:
    k = m[x % M] // 2
    if d[x] > 1:
      t = min(d[x] // 2, k)
      res += t
      d[x] -= t * 2
      m[x % M] -= t * 2
print(res)


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

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  vector<ll> cnt(200001, 0);
  ll ans = 0;
  rep(i, N) {
    cin >> A.at(i);
    ans += cnt.at(A.at(i));
    cnt.at(A.at(i))++;
  }

  rep(i, N) cout << ans - cnt.at(A.at(i)) + 1 << endl;
}


Measured memory_bytes: 6344
//abc049_b.cpp
//Sun Oct 21 11:36:54 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int h,w;
	cin >> h >> w;

	string s[h];
	for (int i=0;i<h;i++){
		cin >> s[i];
		cout << s[i] << endl;
		cout << s[i] << endl;
	}

}

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<std::vector<char> > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    string s, t; 
    cin >> s >>t;

    irep(i, s.size()) {
        if(s[i] != t[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}
/** atcoder **/


Measured memory_bytes: 3628
N=int(input())
A=list(map(int, input().split()))
A=sorted(A)
if (A[-1]-A[0])>1:
  print('No')
  exit()
elif (A[-1]-A[0])==0:
  if 1<=A[0] and A[0]<=N//2:
    print('Yes')
    exit()
  else:
    if A[0]+1==N:
      print('Yes')
      exit()    
    else:
      print('No')
      exit()
  
import bisect
a=bisect.bisect_right(A,A[0])
#少ない数a,多い数b
b=N-a
if b==1:
  print('No')
  exit()
if (a-1)+1<=A[0] and A[0]<=(a-1)+b//2 and a+1<=A[-1] and A[-1]<=a+b//2:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 20740
#![allow(non_snake_case)]

#[allow(unused_macros)]
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

fn main() {
    input!{
        N: usize,
        Ais: [usize; N],
    }
    let mut Ais = Ais;
    Ais.sort();
    let mut buff = 0;
    let mut cnt = 0;
    let mut ans = Vec::with_capacity(N);
    for Ai in Ais {
        if Ai != buff {
            buff = Ai;
            if cnt % 2 == 1 {
                ans.push(Ai);
            }
            cnt = 0;
        }
        cnt += 1;
    }
    if cnt % 2 == 1 {
        ans.push(0);
    }
    println!("{}", ans.len());
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    int ans = 0;
    FOR(i, 1, N){
        if (int(log10(i)+1)%2 == 1){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3908
#include<bits/stdc++.h>
#define fi first
#define f first
#define se second
#define s second
#define vi_a vector<int>a;
#define p_b push_back
#define ll long long
#define ld  double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define fast_io cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
#define getfiles    ifstream cin("birch.in");ofstream cout("birch.out");
#define pw(x) (1ll << x)
#define sz(x) (int)x.size()
#define endl "\n"
#define rall(x) x.rbegin(),x.rend()
#define len(a) (ll)a.size()
#define rep(x,l,r) for(ll x=l;x<r;x++)
using namespace std;
ld eps = (ld)1 / 1e15;
ll inf = 1e18, mod2 = 998244353, mod1 = 1e9 + 7;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
ll binmult(ll a, ll b, ll mod) { return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod : (2 * binmult(a, b / 2, mod)) % mod) : 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//const ll to[5]={0,4,6,7,9};
const ll N=1e6;
const ll R=1e4;
const ll to[7]={1,2,3,1,3,2,1};
signed main(){
    fast_io;
    string a;
    cin>>a;
    if(a[2]==a[3] && a[4]==a[5]){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}


Measured memory_bytes: 256
/*

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

using namespace std;

#define ll          long long int
#define vi 			 vector<int>
#define pb           push_back
#define fi           first
#define si           second
#define pii 		 pair<int,int>
#define vii 		 vector<pair<int,int>>
#define F(a,n)       for(int i=0;i<n;i++){cin>>a[i];}
#define P(a,n)       for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define fastIO       ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F1(a,n)      for(int i=1;i<=n;i++){cin>>a[i];}
#define P1(a,n)      for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define mem(a,b)     memset(a, b, sizeof a)
#define matrix(x) 	 vector<vector<x>>
#define NF(a,n,m)    for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m)   for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m)   for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m)  for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
const int nax = 1e7;
const int mod = 1e9+7;



int main(){
fastIO
	int a, b, ans=0;
	cin>>a>>b;
	int outlet=1;
	while(outlet < b){
		outlet--;
		outlet += a;
		ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

int main(void){
	int N,M;
	cin >> N >> M;
	priority_queue<ll> q;
	for(int i=0;i<N;i++){
		ll a;cin >> a;
		q.push(a);
	}
	while(M>0){
		ll t = q.top();
		q.pop();
		q.push(t/2);
		M--;
	}
	ll ans = 0;
	while(!q.empty()){
		ans += q.top();q.pop();
	}
	cout << ans << endl;
}

Measured memory_bytes: 1528
N, K = map(int, input().split())
r, s, p = map(int, input().split())
T = input()
T = [T[i] for i in range(N)]

ans = 0
point = {'r': p, 's': r, 'p': s}
for i in range(N):
    if i < K:
        ans += point[T[i]]
    else:
        if T[i] != T[i-K]:
            ans += point[T[i]]
        else:
            T[i] = 'o'
print(ans)


Measured memory_bytes: 48848
#include<iostream>
#include<vector>
#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];
    }
    bool f = true;
    vector<int> ans;
    while(f){
        f = false;
        int t = b.size();
        if(t == 0){break;}
        t--;
        while(t >= 0){
            if(t + 1== b[t]){
                f = true;
                ans.push_back(b[t]);
                b.erase(begin(b) + t);
                break;
            }
            t--;
        }
    }
    if(b.size() != 0){
        cout << -1 << endl;
    }else{
        reverse(begin(ans), end(ans));
        for(int i = 0; i < ans.size(); i++){
            cout << ans[i] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    ll n; cin >> n;
    ll mx = 0;
    for(ll i=1;i*i<=n;i++) {
        mx = i * i;
    }
    cout << mx;
}


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

int main(){
  int n;
  cin >> n;
  vector<long long> a;
  vector<long long> b;
  long long x;
  for(int i=0; i<n+1; i++){
    cin >> x;
    a.push_back(x);
  }
  for(int i=0; i<n; i++){
    cin >> x;
    b.push_back(x);
  }
  long long s=0;
  for(int i=0; i<n; i++){
    if(a[i] >= b[i]){
      s += b[i];
    } else if(a[i]+a[i+1] >= b[i]){
      s += b[i];
      a[i+1] = a[i+1]+a[i]-b[i];
    } else {
      s += a[i]+a[i+1];
      a[i+1] = 0;
    }
  }
  cout << s;
}

Measured memory_bytes: 2548
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i=1,i##_len=(n); i<=i##_len; ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for(int i=(s);i<(t);++i)
#define rng(obj) (obj).begin(), (obj).end()
#define rrng(obj) (obj).rbegin(), (obj).rend()
#define maxs(x,y) (x=max((x),(y)))
#define mins(x,y) (x=min((x),(y)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T>>
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vp = vector<pii>;
template <class T> inline istream& operator>>(istream&i,v(T)&v)
{ rep(j,v.size())i>>v[j];return i;}
template <class T> string join(const v(T)&v)
{ stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template <class T> inline ostream& operator<<(ostream&o,const v(T)&v)
{ if(v.size())o<<join(v); return o;}
template <class T1,class T2> inline istream& operator>>(istream&i ,pair<T1,T2>&v)
{ return i>>v.fi>>v.se;}
template <class T1,class T2> inline ostream& operator<<(ostream&o ,pair<T1,T2>&v)
{ return o<<v.fi<<","<<v.se;}
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double eps = 1e-10;
bool comp(pii a,pii b){
  return a.se<b.se;
}
//----------------------------------------------------------------

#define fileio ifstream fio; if(argc>=2){fio.open(argv[1]); std::cin.rdbuf(fio.rdbuf());}
#define fastio ios_base::sync_with_stdio(false);
#define MOD 1000000007
//----------------------------------------------------------------
void Main(){
  int n;
  cin>>n;
  vl a(1);
  cin>>a[0];
  rep(i,n-1){
    ll aa; cin>>aa;
    if(aa!=a.back()) a.pb(aa);
  }
  ll ans=1;
  if(a.size()>2){
    rep(i,a.size()-2){
      if( (a[i+2]-a[i+1])*(a[i+1]-a[i])<0 ){ans++;++i;}
    }
  }
  cout<<ans<<endl;
} int main(int argc,char* argv[]){ 
    fastio; fileio; Main();}

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

int main(){
  int a, b, C;
  double S, L, h, rad;

  cin >> a >> b >> C;
  rad = C * M_PI /180;
  S = (a * b * sin(rad)) / 2;
  L = a + b + sqrt(pow(a,2.0) + pow(b,2.0) - 2 * a * b * cos(rad));
  h = b * sin(rad);
  cout << fixed << S << endl;
  cout << L << endl;
  cout << h << endl;
  return 0;
}

Measured memory_bytes: 1240
import java.io.*;
class Main
{
  public static void main(String [] args) throws IOException
  {
    InputStreamReader ir=new InputStreamReader(System.in);
    BufferedReader br=new BufferedReader(ir);
    int n=Integer.parseInt(br.readLine());
    String s=br.readLine();
    if(n >= 3200)
    {
      System.out.println(s);
    }
    else
    {
      System.out.println("red");
    }
  }
}


Measured memory_bytes: 19284
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


import math

def solve(a, b):
    a, b = min(a, b), max(a, b)
    if a == b:
        return 2 * a - 2

    c = int(math.sqrt(a * b)) + 2
    while True:
        if c * c < a * b:
            if c * (c + 1) >= a * b:
                return 2 * c - 2
            else:
                return 2 * c - 1
        else:
            c -= 1

Q = int(input())
for _ in range(Q):
    a, b = map(int, input().split())
    print(solve(a, b))



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a[3],b[3],c[3];
	for(int i=0;i<3;i++){
		cin >> a[i] >> b[i] >> c[i];
	}
	int tmp=0;
	for(int i=0;i<2;i++){
		if(a[i]-b[i]==a[i+1]-b[i+1]){
			tmp++;
		}
		if(b[i]-c[i]==b[i+1]-c[i+1]){
			tmp++;
		}
		if(a[i+1]-a[i]==b[i+1]-b[i]){
			tmp++;
		}
		if(b[i+1]-b[i]==c[i+1]-c[i]){
			tmp++;
		}
	}
	if(tmp==8){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
n = int(input())
a = input().split(" ")
f = 0
for i in range(n):
	b = int(a[i])
	c = 1
	if b % 2 == 0:
		if b % 3 == 0:
			c = 0
		elif b % 5 == 0:
			c = 0
		if c != 0:
			f = 1
if f == 1:
	print("DENIED")
else:
	print("APPROVED")

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <queue>
#include <stack>
#include <climits>
using namespace std;

typedef long long ll;
#define pb push_back

#define rep(i, n) for (int i=0;i<(n);++i)
#define rep2(i, s, n) for (int i=s;i<(n);++i)
#define rev(i, n) for (int i=(n);i>0;--i)
#define INF (1e9+1e9)

/* SegTree 
   http://codeforces.com/blog/entry/18051
*/
class SegTree
{
public:
    vector<int> t;
    int n;
    SegTree(int n) : n(n){
        t.resize(n<<1); fill(t.begin(),t.end(),INT_MAX);
        build();
    }

    void build() { rev(i,n-1) t[i] = min(t[i<<1], t[i<<1|1]); }
    void modify(int p, int value) {
        for(t[p += n] = value; p > 1; p >>= 1) t[p>>1] = min(t[p], t[p^1]);
    }
    int query(int l, int r) { // [l,r)
        int res = INT_MAX;
        for(l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l&1) res = min(res, t[l++]);
            if (r&1) res = min(res, t[--r]);
        }
        return res;
    }
};

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

    SegTree st(N);

    vector<int> C,X,Y;
    rep(i,Q) {
        int c,x,y; cin>>c>>x>>y;
        C.pb(c); X.pb(x); Y.pb(y);
    }

    rep(i,Q)
        if (C[i] == 0) st.modify(X[i], Y[i]);
        else cout << st.query(X[i], Y[i]+1) << endl;
}

 

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

int main()
{
  string S;
  cin >> S;
  int ans = 0;

  if (S == "SUN")
    ans = 7;
  else if (S == "MON")
    ans = 6;
  else if (S == "TUE")
    ans = 5;
  else if (S == "WED")
    ans = 4;
  else if (S == "THU")
    ans = 3;
  else if (S == "FRI")
    ans = 2;
  else if (S == "SAT")
    ans = 1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fr(x,i,n) for(int x = i; x < n; ++x)
#define fb(x,i,n) for(int x = i; x >= n; --x)
#define pr pair<int,int>
#define ll long long int
//const int mod=1e9+7;
const ll inf=1LL<<32;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int x,y,z;
    cin>>x>>y>>z;
    swap(x,y);
    swap(x,z);
    cout<<x<<" "<<y<<" "<<z;
}


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

int main()
{
    string S, T, U;
    int A, B;

    cin >> S >> T;
    cin >> A >> B;
    cin >> U;

    if(U == S) {
        A -= 1;
    } else {
        B -= 1;
    }

    cout << A << " " << B << endl;

    return 0;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n,t;cin>>n>>t;
    vector<pll>a(n);
    rep(i,n){
        ll x,y;cin>>x>>y;
        a[i]=mp(x,y);
    }
    sort(all(a));
    vector<vector<ll> >dp(n+1,vector<ll>(t+1,-1));
    dp[0][0]=0;
    rep(i,n){
        rep(j,t){
            if(dp[i][j]<0){
                continue;
            }
            if(j+a[i].first>=t){
                dp[i+1][t]=max(dp[i+1][t],dp[i][j]+a[i].second);
            }else{
                dp[i+1][j+a[i].first]=max(dp[i+1][j+a[i].first],dp[i][j]+a[i].second);
            }
            dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
        }
        dp[i+1][t]=max(dp[i+1][t],dp[i][t]);
    }
    ll ans=0;
    rep(i,t+1){
        ans=max(ans,dp[n][i]);
        //cout<<dp[n][i]<<endl;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 70784
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

    #[allow(dead_code)]
    pub fn input_line_str() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;

fn main() {
    let n: usize;
    input!(n);
    for i in input_vector::<usize>() {
        if i % 2 == 0 && !(i % 3 == 0 || i % 5 == 0) {
            println!("DENIED");
            return;
        }
    }
    println!("APPROVED");
}


Measured memory_bytes: 4352
/*
g++ -std=c++11 -o2 -Wall ABC112C.cpp -o .\out\ABC112C.out
.\out\ABC112C.out
*/

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

typedef long long ll;

ll xs[105];
ll ys[105];
ll hs[105];

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n;
  cin >> n;
  ll x, y, h;
  for (ll i = 0; i < n; ++i) {
      cin >> x >> y >> h;
      xs[i] = x;
      ys[i] = y;
      hs[i] = h;
  }
  ll cx, cy, ch;
  ll temp;
  bool flag;
  for (ll i = 0; i <= 100; ++i) {
    for (ll j = 0; j <= 100; ++j) {
      flag = true;
      for (ll k = 0; k < n; ++k) {
        if (k == 0) {
          temp = hs[k] + abs(i - xs[k]) + abs(j - ys[k]);
        } else {
          temp = min(temp, hs[k] + abs(i - xs[k]) + abs(j - ys[k]));
        }
      }
      if (flag) {
        if (temp < 1) {
          flag = false;
          continue;
        }
        for (int k = 0; k < n; ++k) {
          if (max(temp - abs(i - xs[k]) - abs(j - ys[k]), 0LL) != hs[k]) {
            flag = false;
            break;
          }
        }
        if (!flag) continue;
        cx = i;
        cy = j;
        ch = temp;
        break;
      }
    }
    if (flag) break;
  }
  cout << cx << " " << cy << " " << ch << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=5e3+5;
int n;
ll k,a[N],p[N],cnt[N]={0},sum[N][N];
ll dfs(ll i){
    ll u=i,num=1,pos=1;
    while(p[i]!=u){
        num++;
        i=p[i];
        sum[u][pos]=sum[u][pos-1]+a[i];
      pos++;
    }
    sum[u][pos]=sum[u][pos-1]+a[u];
    return num;
}
int main()
{
    memset(sum,0,sizeof(sum));
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>p[i];
    }
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    ll ans=-1e10;
    for(int i=1;i<=n;i++){
        cnt[i]=dfs(i);
      //cout<<cnt[i]<<endl;
        ll mx1=-1e18,mx2=-1e18;
        for(int j=1;j<=cnt[i];j++){
            mx1=max(mx1,sum[i][j]);
        }
        for(int j=1;j<=(k%cnt[i]?k%cnt[i]:cnt[i]);j++){
            mx2=max(mx2,sum[i][j]);
        }
        //cout<<mx<<" "<<mx2<<endl;
        if(k>cnt[i]){
            ll num=(k%cnt[i])?k/cnt[i]:k/cnt[i]-1;
            ans=max(ans,max(mx1,num*sum[i][cnt[i]]+mx2));
        }
        else ans=max(ans,mx2);
      //cout<<ans<<endl;
    }
    cout<<ans;
}




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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, int> cnt;
  int t=0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if(cnt[a[i]]==0)
        t++;
    ++cnt[a[i]];
  }
  if (cnt[0] == n) {
    cout << "Yes" << '\n';
    return 0;
  }
  if (n % 3 != 0||t>3) {
    cout << "No" << '\n';
    return 0;
  }
  vector<int> all;
  for (auto& p : cnt) {
    for (int i = 0; i < p.second / (n / 3); i++) {
      all.push_back(p.first);
    }
  }
  if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }
  return 0;
}

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

const lli m = 1e5;
lli n;

int main(void){
    cin >> n;
    vector<lli> a(n), b(m+5);
    rep(i, n){
        cin >> a[i];
        b[a[i]]++;
    }
    lli c, d;
    c = d = 0;
    for(int i = 1; i <= m; i++){
        if(b[i] == 0) continue;
        if(b[i] % 2 == 1) b[i] = 1, c++;
        else b[i] = 2, d++;
    }
    lli ans;
    if(d%2 == 0) ans = c+d;
    else ans = c+d-1;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4828
// Vicfred
// https://atcoder.jp/contests/abc155/tasks/abc155_a
// implementation
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.container.rbtree;
import std.string;

void main() {
    auto input = readln.split.map!(to!int).array;
    auto rbt = redBlackTree(input);
    if(rbt.length == 2)
        "Yes".writeln;
    else
        "No".writeln;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)


int main() {
	ll N,K;
  	cin>>N>>K;
  	ll num[100001];
  	rep(i,100001) num[i]=0;
  
  	ll sum=0;
  	rep(i,N){
     	 ll a,b;
      	 cin>>a>>b;
      	 num[a]+=b;
    }
  
  	for(int i=1;i<100001;i++){
     	 sum+=num[i];
      	 if(sum>=K){
          	cout<<i<<endl;
           	break;
         }
    }
    
  	
  	
}

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

using namespace std;

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) if (s[i] == '9') {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int N,A,B,C;
int l[SIZE];
int an=1e9;
void dfs(int id,int a,int b,int c,int merge_time){
    if(id==N){
        if(!a||!b||!c)return;
        an=min(an,(merge_time-3)*10+abs(a-A)+abs(b-B)+abs(c-C));
        return;
    }
    dfs(id+1,a+l[id],b,c,merge_time+1);
    dfs(id+1,a,b+l[id],c,merge_time+1);
    dfs(id+1,a,b,c+l[id],merge_time+1);
    dfs(id+1,a,b,c,merge_time);
}
int main(){
    R(N,A,B,C);
    REP(i,N)R(l[i]);
    dfs(0,0,0,0,0);
    W(an);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<long long> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  long long ans=a[0];
  int cnt=1;
  bool ng=false;
  for(int i=1;i<n;i++){
    for(int j=0;j<2;j++){
      if(cnt==n-1){
        ng=true;
        break;
      }
      ans+=a[i];
      cnt++;
    }
    if(ng)break;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4828
#include <bits/stdc++.h>
typedef long long ll;
typedef double db;
#define pa pair<int,int>
#define mk make_pair
#define LOG(format, args...) fprintf(stderr, format, args)
using namespace std;
inline int rd() {
	int x=0,f=1;char ch=getchar();
	for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-1;
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}
const int MAXN=5e5+100;
ll N,a[MAXN];
ll l[MAXN];
ll but[MAXN],idx[MAXN];
ll ans[MAXN];
//main========================
int main() {
	memset(idx,0x3f,sizeof idx);
	N=rd();
	for(int i=1;i<=N;++i) a[i]=rd(),l[++*l]=a[i];
	sort(l+1,l+*l+1);
	*l=unique(l+1,l+*l+1)-l-1;
	for(int i=1;i<=N;++i) a[i]=lower_bound(l+1,l+*l+1,a[i])-l;
//	for(int i=1;i<=N;++i) printf("%d\n",a[i]);
	for(int i=1;i<=N;++i) but[a[i]]++,idx[a[i]]=min((ll)i,idx[a[i]]);
//	for(int i=1;i<=*l;++i) {
//		printf("i=%d,but=%d,idx=%d\n",i,but[i],idx[i]);
//	}
	for(int i=*l;i>=1;--i) if(but[i]) {
		but[i-1]+=but[i];
		idx[i-1]=min(idx[i],idx[i-1]);
		ans[idx[i]]+=(ll)(l[i]-(i>1?l[i-1]:0) )*but[i];
	} 
	for(int i=1;i<=N;++i) printf("%lld\n",ans[i]);
	return 0;
}


Measured memory_bytes: 18304
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n; cin>>n;
    vector <int> a(n), b(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[i] = a[i];
    }
    int m = *max_element(a.begin(), a.end());
    int c = count(a.begin(), a.end(),m);
    int m2 = -114514;
    for(int i=0;i<n;i++){
        if(a[i]==m) continue;
        else m2 = max(m2, a[i]);
    }
    for(int i=0;i<n;i++){
        if(c>1) cout<<m<<endl;
        else{
            if(a[i]==m) cout<<m2<<endl;
            else cout<<m<<endl;
        }
    }
}


Measured memory_bytes: 3200
# AOJ 0525

while True:
    R, C = map(int, input().split())
    if R == C == 0:
        break
    osenbei = [input().split() for i in range(R)]
    osenbei = list(zip(*osenbei))  # create a list of columns
    osenbei = [int(''.join(c), 2) for c in osenbei]  # create binary representation of each column

    ans = 0
    for mask in range(1 << R):
        count = 0
        for c in osenbei:
            count_c = bin(c ^ mask).count('1')  # flip specified row
            count += max(count_c, R - count_c)
        ans = max(ans, count)

    print(ans)



Measured memory_bytes: 7868
acgtlist = ["A","C","G","T"]
acgtlen,old_acgtlen = 0,0
for i in input():
	if i in acgtlist:
		acgtlen += 1 
	else:
		acgtlen = 0

	old_acgtlen = acgtlen if acgtlen > old_acgtlen else old_acgtlen
print(old_acgtlen)

Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}
long long gcd(long long a,long long b){
  if(b==0){
    return a;
  }
  return gcd(b,a%b);
}
long long lcm(long long a,long long b){
  long long g=gcd(a,b);
  return a/g*b;
}
long long kaijo(long long x){
  long long l=10*10*10*10*10*10*10*10*10+7;
  long long sum=1;
  for(int i=x;i>0;i--){
    sum*=i;
    if(sum>l){
      sum%=l;
    }
  }
  return sum;
}







int main(){
  long long H,W;
  cin>>H>>W;
  long long s=10*10*10*10*10*10*10*10*10;
  long long ss[3];
  for(int i=1;i<H;i++){
    ss[0]=i*W;
    long long x=W/2;
    ss[1]=(H-i)*x;
    ss[2]=H*W-ss[0]-ss[1];
    sort(ss,ss+3);
    if(ss[2]-ss[0]<s){
      s=ss[2]-ss[0];
    }

    ss[0]=i*W;
    x=(H-i)/2;
    ss[1]=x*W;
    ss[2]=H*W-ss[0]-ss[1];;
    sort(ss,ss+3);
    if(ss[2]-ss[0]<s){
      s=ss[2]-ss[0];
    }

  }
  for(int i=1;i<W;i++){
    ss[0]=i*H;
    long long x=H/2;
    ss[1]=(W-i)*x;
    ss[2]=H*W-ss[0]-ss[1];;
    sort(ss,ss+3);
    if(ss[2]-ss[0]<s){
      s=ss[2]-ss[0];
    }


    ss[0]=i*H;
    x=(W-i)/2;
    ss[1]=x*H;
    ss[2]=H*W-ss[0]-ss[1];
    sort(ss,ss+3);
    if(ss[2]-ss[0]<s){
      s=ss[2]-ss[0];
    }


  }
  
  
  cout<<s<<endl;


}



  

Measured memory_bytes: 256