akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef vector < int > vint;
typedef pair < int, int > pii;
typedef pair < int, bool > pib;
typedef unsigned long long ull;

#define PB push_back
#define MP make_pair
#define RANGE(V) V.begin(), V.end()
#define FOR(i,n) for(int i=0;i<n;++i)
#define FORN(i,n) for(int i=1;i<=n;++i)
#define debug(x) cerr<<#x<<":"<<x<<"\n";
#define FORS(i,n) for(int i=0;i<n.length();++i)
const int INF = INT_MAX;
const int MAX = 10000001;
const int M = 1000000007;
int mod{ 1000000007 };


int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//freopen("input.txt", "r", stdin);
	float n, x, t;
	cin >> n >> x >> t;
	int ans = ceil(n / x) * t;
	cout <<ans ;
	return 0;	
}






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

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,k;
	cin>>n>>k;

	vector<ll> v(n),dp(n,1e15);
	for(ll i=0;i<n;++i) cin>>v[i];

	dp[0] = 0;
	dp[1] = abs(v[1]-v[0]);

	for(ll i=2;i<n;++i){
		for(ll j= max(0LL,i-k);j<i;++j){
			dp[i] = min(dp[j] + abs(v[i] - v[j]), dp[i]);
		}
	}

	cout<<dp[n-1]<<"\n";

	return 0;
}

Measured memory_bytes: 4748
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<vector<int>> as(n, vector<int> (n));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cin >> as[i][j];
        }
    }
    ll ans = 0;
    unordered_set<int> us;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            for(int k = 0; k < n; k++){
                if(i == j || i == k || j == k){ continue; }
                if(as[i][j] + as[j][k] < as[k][i]){
                    cout << -1 << '\n';
                    return 0;
                }
                // if(as[i][j] + as[j][k] > as[k][i] && !us.count(k * 1000 + i)){
                //     us.insert(k * 1000 + i);
                //     ans += as[k][i];
                //     prints(k, i, as[k][i]);
                // }
            }
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            int cnt = 0;
            for(int k = 0; k < n; k++){
                if(i == j || i == k || j == k){ continue; }
                if(as[i][j] < as[i][k] + as[k][j]){
                    cnt++;
                }
            }
            if(cnt == n - 2){
                ans += as[i][j];
            }
        }
    }
    cout << ans / 2 << '\n';
    return 0;
}


Measured memory_bytes: 640
<?php
while(true)
{
    $in = explode(" ", trim(fgets(STDIN)));
    $h = $in[0];
    $w = $in[1];
    if($h == 0 && $w == 0)
    {
        break;
    }
    for($i = 0; $i < $h; $i++)
    {
        for($j = 0; $j < $w; $j++)
        {
            echo "#";
        }
        echo "\n";
    }
    echo "\n";
}

Measured memory_bytes: 15060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define outwp10(i) cout<<fixed<<setprecision(10)<<i<<"\n";

int main()
{
  double a, b, t; cin>>a>>b>>t;
  t = t*2*M_PI/360;
  outwp10(abs(a*b)*0.5*sin(t));
  outwp10(pow(a*a+b*b-2*a*b*cos(t), 0.5) + a + b);
  outwp10(b*sin(t));
}


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

int main() {
  int n,m; cin >> n >> m;
  vector<int> count(n,0);
  for(int i=0; i<m; i++){
    int a,b;
    cin >> a >> b;
    count[a-1]++;
    count[b-1]++;
  }
  for(int i=0; i<n; i++){
    cout << count[i] << endl;
  }
  return 0;
}

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

int main()
{
  string S,T;
  cin >> S >> T;
  int counter = 0;
  for(int i = 0;i < S.size();i++){
    if(S.at(i) != T.at(i)) counter++;
  }
  cout << counter << endl;
}


Measured memory_bytes: 3848
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000009;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);


struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
modint combP(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[a - b];
}
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

int cnt[1 << 20];
int ans[1 << 20];
void solve() {
	int mi = 100000;
	int chk = 0;

	int x, n; cin >> x >> n;
	vector<int> p(n);
	rep(i, n)cin >> p[i];
	for (int i = -100; i <= 200; i++) {
		bool exi = false;
		rep(j, n)if (i == p[j])exi = true;
		if (exi)continue;
		if (abs(x - i) < mi) {
			mi = abs(x - i);
			chk = i;
		}
	}
	cout << chk << "\n";
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(6);
	//init_f();
	//init();
	//int t; cin >> t;rep(i,t)
	solve();
	stop
		return 0;
}


Measured memory_bytes: 7760
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k; cin >> n >> k;
	vector<char> a(k);
	rep(i, 0, n) cin >> a[i];
	rep(i, n, 10 * n) {
		string s = to_string(i);
		bool fl = false;
		rep(j, 0, s.size())rep(l,0,k) {
			if (a[l] == s[j]) {
				fl = true; break;
			}
		}
		if (!fl) {
			printf("%d", i);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 384
def inp():
    ls=list(map(int,input().split()))
    return ls
x,n=map(int,input().split())
ls=inp()
ans=0
d=float('inf')
for i in range(102):
    if i in ls:
        continue
    tmp = abs(x - i)
    if tmp < d:
        d = tmp
        ans = i
print(ans)

Measured memory_bytes: 9224
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;
import std.math;

void main()
{
    real x=0, y=0;
    int deg=90;
    foreach(s;stdin.byLine())
    {
        auto m = s.chomp().split(",").map!(to!int);
        immutable n=m[0], d=m[1];
        if(n==0 && d==0) break;
        x+=n*cos(PI*deg/180);
        y+=n*sin(PI*deg/180);
        deg=(deg-d)%360;
    }
    [x,y].map!(to!int).map!(to!string).join("\n").writeln();
}

Measured memory_bytes: 1100
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		int a=stdIn.nextInt();
		int b=stdIn.nextInt();
		int c=stdIn.nextInt();
		
		if(a<b&&b<c){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 26228
// C++(GCC 9.2.1)
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int main(){
    
    // 1. 入力情報.
    LL N, A, B;
    scanf("%lld %lld %lld", &N, &A, &B);
    
    // 2. 総和としてありうる値の個数.
    LL ans = max(0LL, (N - 2) * (B - A) + 1);
    
    // 3. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

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

int main()
{
  int h,n;
  int a;
  int wa = 0;
  cin >>h>>n;
  for(int i=0;i<n;i++)
  {
    cin>>a;
    wa+=a;
  }
  h = h-wa;
  if(h<=0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, p[10];
  cin >> N;
  int max = 0, maxid;
  for(int i = 0; i < N; i++){
    cin >> p[i];
    if(p[i] > max){
      max = p[i];
      maxid = i;
    }
  }
  int total = 0;
  for(int i = 0; i < N; i++){
    if(i == maxid){
      total += p[i] / 2;
    }else{
      total += p[i];
    }
  }
  cout << total << endl;
}

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

int main(){
    
    int N;
    cin >> N;
    vector<int> A(N);
    for( int i=0; i<N; i++) cin >> A[i];
    
    int count = 0;
    for( int i=0; i<N; i++){
        int min = i;
        
        for( int j=i+1; j<N; j++){
            if( A[min] > A[j] ){
                min = j;
            }
        }
      
       if( min != i ){
         swap(A[min],A[i]);
         count++;
       }
    }
     
  for(int i=0;i<N;i++){
    cout << (i!=0?" ":"") << A[i];
  }
  cout << endl << count << endl;
    return 0;
}


Measured memory_bytes: 3096
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let mut C = Vec::new();
    let mut S = Vec::new();
    let mut F = Vec::new();
    for _ in 0..N-1 {
        let c: usize = sc.get();
        let s: usize = sc.get();
        let f: usize = sc.get();
        C.push(c);
        S.push(s);
        F.push(f);
    }
    for s in 0..N {
        let mut cur = 0;
        for i in s..N-1 {
            cur = max(cur, S[i]);
            if cur % F[i] != 0 {
                cur += F[i] - (cur % F[i]);
            }
            cur += C[i];
        }
        println!("{}", cur);
    }
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;


#define F first
#define S second

#define ERR 1e-9

#if !ONLINE_JUDGE && !EVAL
    #define dbg_var(x) cerr << #x << ": " << x << "\n";
    #define dbg_iter(x, y) cerr  << #x << ": " << print_iterable(x, y) << "\n";
#else
    #define dbg_var(x)
    #define dbg_iter(x, y)
#endif // ONLINE_JUDGE

template <typename T1, typename T2>
string print_iterable( T1 begin_iter, T2 end_iter){
    bool first = true;
    stringstream res;
    res << "[ ";
    for(; begin_iter != end_iter; ++begin_iter){
        if(!first) res << ", ";
        first = false;
        res << *begin_iter;
    }
    res << " ]";
    return res.str();
}

void aggMax(int & res, int x){ if(x > res)res = x; }
void aggMin(int & res, int x){ if(x < res)res = x; }

int II(){ int i; cin >> i; return i; }
void OI(int i){ cout << i; }

// constraints
#define MAXN 1000000

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int A = II(), B = II();
    cout << max(A+(A-1), max(B+(B-1), A+B)) << "\n";
    return 0;
}


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


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

  vector<int> a(1000001,0);
  rep(i,n) {
    int A;
    cin >> A;
    a[A] += 1;
  }

  //pairwise
  bool flag1 = 1;
  //setwise
  bool flag2 = 1;

  for(int i = 2; i <= 1000000; i++){
    int cnt = 0;
    for(int j = i; j <= 1000000; j += i){
      if(a[j] > 0) cnt += a[j];
    }
    if(cnt >= 2) flag1 = 0;
    if(cnt == n) flag2 = 0;
  }
  
  if(flag1) cout << "pairwise coprime" << endl;
  else if (flag2) cout << "setwise coprime" << endl;
  else cout << "not coprime" << endl;
  
 }


Measured memory_bytes: 7220
#include<iostream>
#include<math.h>
#include<algorithm>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)

using namespace std;

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

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    n = ni()
    a = sorted(nl(), reverse=True)
    print(sum(a[:n//2]) + sum(a[1:(n+1)//2]))
    return

solve()


Measured memory_bytes: 31252
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
    queue<pair<string, int> > Q;
    int t=0;
    int n,q;
    cin >> n >> q;

    for(int i=0;i<n;++i)
    {
        string name;
        int time;
        cin >> name >> time;
        pair<string,int> p = make_pair(name,time);
        Q.push(p);
    }

    pair<string,int> u;
    while(!Q.empty())
    {
        u = Q.front();Q.pop();
        int a = u.second;
        int m = min(a,q);
        a = a - m;
        t = t + m;
        if(a > 0)
        {
            Q.push(make_pair(u.first,a));
        }
        else
        {
            cout << u.first << " " << t << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 6328
import java.util.Scanner;
public class Main {
	    public static void main(String args[]) {
	    	Scanner sc = new Scanner(System.in);
	    	int n = sc.nextInt(); //n????????\?????????????????????
	        StringBuilder NewBuilder = new StringBuilder(); 
	    	int [] a  = new int[n];
	    	 
	    	for(int i = 0; i < n ; i++) {
	    		a[i] = sc.nextInt();
	    	}

            for(int i = n; i >= 1; i--){
            	 
                int x = a[i-1];
                NewBuilder.append(x);
     
                if(i == 1){
                    break;
                }
                NewBuilder.append(" ");
            }
            NewBuilder.append("\n");
            System.out.print(NewBuilder);

    }	        

}

Measured memory_bytes: 25976
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String c = sc.next();
        sc.close();
        int countR = 0;
        int answer = 0;
        for (int i = 0; i < n; i++) {
            if (c.charAt(i) == 'R') {
                countR++;
            }
        }
        for (int i = 0; i < countR; i++) {
            if (c.charAt(i) == 'W') {
                answer++;
            }
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 41004
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;++i)
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;
typedef vector<P> vip;

int main(){
  string s;cin>>s;
  int n = s.size();
  ll k;cin>>k;
  int o = 0;
  int ans = 0;
  for(int i=0;i<n;i++){
    if(s[i]!='1'){
      ans = s[i]-'0';
      break;
    }
    o++;
  }
  if(k<=o){
    cout << 1 << endl;
  }else{
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

int main() {
    long long res = 1;
    const long long UPPER = 1000000000LL * 1000000000LL;

    int N;
    cin >> N;

    for (int i = 0; i < N; ++i) {
        long long v;
        cin >> v;

        if (v == 0) {
            res = 0;
            break;
        }

        if (res < 0) {
            continue;
        }

        if (res <= UPPER/v) {
            res *= v;
        } else {
            res = -1;
        }

        if (res > UPPER) {
            res = -1;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3608
#include <cstdio>
#include <cstring>
int main(void)
{
  char input[10] = {0};
  
  scanf("%s", input);
  
  if(strcmp(input, "Sunny") == 0)
    printf("%s\n", "Cloudy");
  else {
  	if (strcmp(input, "Cloudy") == 0)
      printf("%s\n", "Rainy");
    else
      printf("%s\n", "Sunny");
  }
  return 0;
}

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

const int Maxn = 205;

int n;
int a[Maxn];
int res;

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < 2 * n; i++)
        scanf("%d", &a[i]);
    sort(a, a + 2 * n);
    for (int i = 0; i < n; i++)
        res += a[2 * i];
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a) begin(a),end(a)
#define FOR(x,val,to) for(int x=(val);x<int((to));++x)
#define FORE(x,val,to) for(auto x=(val);x<=(to);++x)
#define FORR(x,arr) for(auto &x: arr)
#define FORS(x,plus,arr) for(auto x = begin(arr)+(plus); x != end(arr); ++x)
#define FORREV(x,plus,arr) for(auto x = (arr).rbegin()+(plus); x !=(arr).rend(); ++x)
#define REE(s_) {cout<<s_<<'\n';exit(0);}
#define GET(arr) for(auto &i: (arr)) sc(i)
#define whatis(x) cerr << #x << " is " << (x) << endl;
#define e1 first
#define e2 second
#define INF 0x7f7f7f7f
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef int64_t ll;
typedef uint64_t ull;
#define umap unordered_map
#define uset unordered_set
using namespace std;
using namespace __gnu_pbds;

#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> P) { for(auto const &vv: P)os<<"("<<vv.first<<","<<vv.second<<")"; return os; }
template<class T> ostream& operator<<(ostream &os, set<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) { os<<"("<<P.first<<","<<P.second<<")"; return os; }
inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
inline void getch(char &x){while(x = getchar_unlocked(), x < 33){;}}
inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}
template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //s.find_by_order(), s.order_of_key() <- works like lower_bound
template<typename T> using ordered_map = tree<T, int, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 1000001

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    sc(n);
    int a[n];
    GET(a);
    --a[0];
    FOR(i,1,n){
        if(a[i]-1 >= a[i-1]) --a[i];
    }
    FOR(i,1,n){
        if(a[i] < a[i-1]){
            REE("No")
        }
    }
    cout << "Yes\n";
}



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

int main(){
  int n;
  cin >> n;
  if(n>29)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,int>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    int x; cin >> x;
    cout << 8-(x-400)/200 << endl;
    return 0;
}


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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

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

ll lcm(ll a, ll b){
    return a * b / gcd(a, b);
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll a, b; cin >> a >> b;
    cout << lcm(a, b) << endl;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);

    string N;
    cin >> N;

    REP(i, N.length()){
        if(N[i] == '7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define es cout<<" "
#define dump(x) cout<<" "<<#x<<"="<<x
#define pdump(p) cout<<" "<<#p<<"=("<<p.fst<<","<<p.snd<<")"
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std; using lint = long long; using ld = long double;
using pii = pair<int, int>; using pll = pair<lint, lint>;
template<class T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<class T, class... Ts> 
auto make_vec(size_t a, Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));}

/****************** グラフ ******************/
// 諸宣言
using Weight = lint;
using Flow = lint;
struct Edge {
    int src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) {}
    Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
    Edge(int s, int d, Weight w, Flow c) : src(s), dst(d), weight(w), cap(c) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1, Flow c = 1) {
    g[a].emplace_back(a, b, w, c);
    g[b].emplace_back(b, a, w, c);
}
void add_arc(Graph &g, int a, int b, Weight w = 1, Flow c = 1) {
    g[a].emplace_back(a, b, w, c);
}

int color[100001];

void dfs(const Graph &g, vector<bool>& seen, int v) {
    seen[v] = true; // v を訪問済にする
    for (auto next_v : g[v]) { 
        if (seen[next_v.dst]) continue; // next_v が探索済だったらスルー
        // 行きがけ処理
        if (next_v.weight == 0) {
            color[next_v.dst] = color[v];
        }
        else {
            color[next_v.dst] = (1 - color[v]);
        }
        dfs(g, seen, next_v.dst);
        // 帰りがけ処理
    }
}


int main(void) {
    int n;
    cin >> n;
    Graph g(n);
    rep (n-1) {
        int a, b, w;
        cin >> a >> b >> w;
        --a; --b; w %= 2;
        add_edge(g, a, b, w);
    }
    
    vector<bool> seen(n, false);
    
    // 深さ優先探索
    dfs(g, seen, 0);
    repeat (i, n) cout << color[i] << endl;
}

Measured memory_bytes: 11904
//#define _USE_MATH_DEFINES
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#define FINAL_OUT(x) {cout << (x) << '\n'; exit(0); }
inline int safe_mul(const int x, const int y) __attribute__ ((warn_unused_result));

int main()
{
//    freopen("in.txt","r", stdin);
//    freopen("out.txt", "w", stdout);
//    cin.tie(0);
//    cout << fixed << setprecision(20);
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    string s;
    cin >> s;

    int n = s.length();

    int64_t ans = 0;
    int cur = 0;
    int state = 0;
    for (int i = n - 1; i >= 0; --i) {
        if (s[i] == 'B') {
            if (state == 1) {
                state = 0;
                ++cur;
            } else {
                cur = 0;
            }
        } else if (s[i] == 'C') {
            if (state == 0) {
                state = 1;
            } else {
                cur = 0;
            }
        } else {
            if (state == 1) {
                cur = 0;
                state = 0;
            }
            ans += cur;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 720
n, a, b, k = map(int, input().split())

def cmb1(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 998244353 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ans = 0
for i in range(n+1):
    x = a*i
    y = k-x
    if y < 0:
        continue
    if y%b == 0:
        j = y//b
        ans += cmb1(n, i, mod)*cmb1(n, j, mod)
print(ans%mod)


Measured memory_bytes: 128012
#include<algorithm>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <string.h>
using namespace std;
int main(void){
	long long int X,ANS[10000],c=0;
	cin >> X;
	//if(X<=3){cout << "1" << endl;exit(0);}
	for (long long int i=X; i >= 1; i--) {
		for (long long int j=10; j >=2 ; j--) {	
          long long  int temp=pow(i,j);
			if(temp<=X){
				ANS[c]=temp;
				++c;
			}
		}
	}
	sort(ANS,ANS+c);
	cout << ANS[c-1] << 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;

class two_edge_connected_components{
	int idx;
	vector<int> ord,low,id;
	const vector<vector<int>>& G;

	void dfs1(int u,int p){
		ord[u]=low[u]=idx++;
		bool f=true;
		for(int v:G[u]){
			if(v==p && f){ f=false; continue; }
			if(ord[v]==-1){
				dfs1(v,u);
				low[u]=min(low[u],low[v]);
			}
			else{
				low[u]=min(low[u],ord[v]);
			}
		}
	}

	void dfs2(int u,int p){
		if(p==-1 || ord[p]<low[u]){
			id[u]=idx++;
			if(p!=-1) bridge.emplace_back(minmax(p,u));
		}
		else{
			id[u]=id[p];
		}
		for(int v:G[u]) if(id[v]==-1) dfs2(v,u);
	}

public:
	vector<pair<int,int>> bridge;
	vector<vector<int>> tree;

	two_edge_connected_components(const vector<vector<int>>& G):G(G){
		int n=G.size();

		idx=0;
		ord.assign(n,-1);
		low.assign(n,-1);
		rep(u,n) if(ord[u]==-1) dfs1(u,-1);

		idx=0;
		id.assign(n,-1);
		rep(u,n) if(id[u]==-1) dfs2(u,-1);

		tree.resize(idx);
		rep(u,n) for(int v:G[u]) if(id[u]!=id[v]) tree[id[u]].emplace_back(id[v]);
	}

	int operator[](int i)const{ return id[i]; }
};

int main(){
	int n,m; cin>>n>>m;
	vector<vector<int>> G(n);
	rep(i,m){
		int u,v; cin>>u>>v; u--; v--;
		G[u].emplace_back(v);
		G[v].emplace_back(u);
	}

	cout<<two_edge_connected_components(G).bridge.size()<<endl;
/*
	two_edge_connected_components Te(G);

	int ans=0;
	rep(u,n) for(int v:G[u]) if(Te[u]!=Te[v]) ans++;
	cout<<ans/2<<endl;
*/
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define STR(i,str) for(int i=0;(str)[i];i++)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX3(a,b,c) ((a)>(b)?(a)>(c)?(a):(c):(b)>(c)?(b):(c))
#define MIN3(a,b,c) ((a)<(b)?(a)<(c)?(a):(c):(b)<(c)?(b):(c))
#define RNG(a,b) ((a)>(b)?(a)-(b):(b)-(a))
#define RNG3(a,b,c) ((a)>(b)?(b)>(c)?(a)-(c):(c)>(a)?(c)-(b):(a)-(b):(b)>(c)?(c)>(a)?(b)-(a):(b)-(c):(c)-(a))
#define MAXS(a,b) {if((a)<(b))(a)=(b);}
#define MINS(a,b) {if((a)>(b))(a)=(b);}



int main(){
	int a, b, c, d = 0;
	scanf("%d%d", &a, &b);
	c = 1;
	while(d < a && c < b){
		c <<= 1;
		d++;
	}
	printf("%d\n", c + (a - d) * b);
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{ 
	int a[3];
	int i,j,m;
	for(i=0;i<3;i++) scanf("%d",&a[i]);
	for(i=0;i<3;i++){
		for(j=i+1;j<3;j++){
			if(a[i]>a[j]){
				m=a[i];
				a[i]=a[j];
				a[j]=m;
			}
		}
	}
	printf("%d %d %d\n",a[0],a[1],a[2]);
	return 0;
}


Measured memory_bytes: 2688
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

#define MOD 1000000007

void solve(int test_case) {
	string s;
	cin>>s;
	if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]) {
		cout<<"Bad";
	}else cout<<"Good";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

using namespace std;

#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define mk make_pair

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

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){
    os << v.first <<" "<<v.second<<endl;
    return os;
}

const int maxn = 1e5+5;
const int mod = 1e9+7;

int dp[maxn][2];

int mult(LL a,LL b){
    return (int)((a*b)%mod);
}

int add(LL a,LL b){
    return (int)((a+b)%mod);
}
string s;
int N;

int main()
{
    cin >> s;
    N = s.size();
    dp[0][0] = 1;
    _for(i,0,N){
        if(s[i] == '1'){
            dp[i+1][0] = mult(2,dp[i][0]);
            dp[i+1][1] = dp[i][0];
            dp[i+1][1] = add(dp[i+1][1],mult(3,dp[i][1]));
        }
        else{
            dp[i+1][0] = dp[i][0];
            dp[i+1][1] = mult(3,dp[i][1]);
        }
    }

    cout << add(dp[N][0],dp[N][1]) << endl;

    return 0;
}


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


int main() {
  int N;cin >> N;
  vector<int> A(N);
  for (int i = 0;i < N;i++){
    cin >> A.at(i);
  }

  sort(A.begin(),A.end());
  cout << A.at(N-1)-A.at(0) << endl;

}       

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

/*============================ DEBUGGING =============================*/

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

/*============================= DEFINES ==============================*/

#define eps 1e-9
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define B begin()
#define E end()
#define F first
#define S second
#define tostr(x) to_string(x)
#define SZ(x) ((int)x.size())
#define ins insert
#define rep(i,x,y) for(int i=x;i<y;i++)
#define per(i,x,y) for(int i=x;i>y;i--)
#define repi(i,x,y) for(int i=x;i<=y;i++)
#define peri(i,x,y) for(int i=x;i>=y;i--)
#define inf (ll)LLONG_MAX
#define ds1(i,x) for(auto i=x.begin();i!=x.end();i++)
#define ds2(i,x) for(auto i:x)
#define fib(n) ceil(pow((1+sqrt(5),n)-pow((1-sqrt(5),n)/(float)(pow(2,n)*sqrt(5)
#define FIO {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define dig(n) (int)(log10(n)+1)
#define ss(x,k) substr(x,k)  // x is the start pos and k is the length of substr.
#define set(x,k) memset(x,k,sizeof x)

/*============================== TYPEDEFS ============================*/

typedef long long ll;
typedef long l;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vlli;
typedef vector<bool> vb;
typedef queue<int> qi;
typedef vector<pair<int,int> > vpii;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
/*============================ START FROM HERE =======================*/

int main(){
	FIO
	
	str s;cin>>s;
	bool ok=true;
	rep(i,0,SZ(s)){
		if(i%2){if(s[i]!='L'&&s[i]!='U'&&s[i]!='D')ok=false;}
		else if(s[i]!='R'&&s[i]!='U'&&s[i]!='D')ok=false;
	}
	if(ok)cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

//verified AOJ GRL_1
#define MAX_V 100000
template <typename T>
struct edge{int to;T cost;};

template <typename T>
void dijkstra(int s, vector<T> &d, vector<edge<T>> G[MAX_V]){
    priority_queue< pii,vector<pii>,greater<pii> > que;
    rep( i,d.size() )d[i]=INF;
    d[s] = 0;
    que.push( pii(0,s) );
    
    while( que.size() ){
        pii p=que.top();
        que.pop();
        
        int v=p.second;
        if(d[v]<p.first)continue;
        
        rep(i,G[v].size()){
            edge<T> e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(pii(d[e.to],e.to));
            }
        }
    }
}

int h,w;
int f(int y,int x){
    return y*w + x;
}

int main(){
    char a,b;
    cin>>h>>w>>a>>b;
    
    vector<string> v(h);
    rep(i,h)cin>>v[i];
    
    pii s,t;
    rep(i,h){
        rep(j,w){
            if(v[i][j]==a)s = pii(i,j);
            if(v[i][j]==b)t = pii(i,j);
        }
    }
    
    vector<edge<int>> G[2500];
    int dy[]={1,0,-1,0};
    int dx[]={0,1,0,-1};
    
    rep(i,h){
        rep(j,w){
            rep(k,4){
                int ddy = i+dy[k];
                int ddx = j+dx[k];
                if(ddx<0 || ddy<0 || ddx>=w || ddy>=h)continue;
                if(v[i][j]==v[ddy][ddx]){
                    G[f(i,j)].pb(edge<int>{f(ddy,ddx),0});
                    G[f(ddy,ddx)].pb(edge<int>{f(i,j),0});
                }else if(((v[i][j]=='o') xor (v[ddy][ddx]=='o')) and (isupper(v[i][j]) xor isupper(v[ddy][ddx]))){
                    G[f(i,j)].pb(edge<int>{f(ddy,ddx),0});
                    G[f(ddy,ddx)].pb(edge<int>{f(i,j),0});
                }else if(k%2==1 and ((v[i][j]=='o') xor (v[ddy][ddx]=='o')) and ((v[i][j]=='-') xor (v[ddy][ddx]=='-'))){
                    G[f(i,j)].pb(edge<int>{f(ddy,ddx),1});
                    G[f(ddy,ddx)].pb(edge<int>{f(i,j),1});
                }else if(k%2==0 and ((v[i][j]=='o') xor (v[ddy][ddx]=='o')) and ((v[i][j]=='|') xor (v[ddy][ddx]=='|'))){
                    G[f(i,j)].pb(edge<int>{f(ddy,ddx),1});
                    G[f(ddy,ddx)].pb(edge<int>{f(i,j),1});
                }
            }
        }
    }
    vector<int> d(h*w);
    dijkstra(f(s.first,s.second),d,G);
    cout<<d[f(t.first,t.second)]/2<<endl;
}



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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

// bool ok(int a, int b) {}

int main() {
    lint X;
    cin >> X;
    for (lint B = -1000; B <= 1000; B++) {
        lint R = X + pow(B, 5);

        lint left = -1000, right = 1000;

        while (abs(right - left) > 1) {
            // dd(left, right);
            int mid = (right + left) / 2;
            if (pow(mid, 5) < R) {
                left = mid;
            } else {
                right = mid;
            }
        }
        if (pow(left, 5) == R) {
            cout << left << " " << B << endl;
            return 0;
        } else if (pow(right, 5) == R) {
            cout << right << " " << B << endl;
            return 0;
        } else {
            continue;
        }
    }
    return 0;
}

Measured memory_bytes: 4104
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define MAX 500000
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define Mod 1000000007
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
using namespace __gnu_pbds; 
using namespace std;

typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> new_data_set; 

ll arr[MAX][3];
ll dp[3100][3100];
pii next1[3100][3100];
bool getit[3100][3100];
string s,t;
ll f(ll i,ll j,ll n,ll m){
	if(i==n || j==m) return 0;
	if(dp[i][j]!=-1) return dp[i][j];

	if(s[i]==t[j]){
		dp[i][j]=f(i+1,j+1,n,m)+1;
		next1[i][j]=mp(i+1,j+1);
		getit[i][j]=1;
	}else{
		ll first=f(i+1,j,n,m);
		ll second=f(i,j+1,n,m);
		dp[i][j]= max(first,second);
		if(first>second){
			next1[i][j]=mp(i+1,j);
		}else{
			next1[i][j]=mp(i,j+1);
		}
	}
	return dp[i][j];
}

int main(){
	ios_base::sync_with_stdio(false);
	memset(dp,-1,sizeof(dp));
	memset(getit,0,sizeof(getit));
	For(i,0,3100) For(j,0,3100){
		pii temp(-1,-1);
		next1[i][j]=temp;
	}
	cin>>s>>t;
	string ans;
	f(0,0,s.size(),t.size());
	pii c(0,0);
	while(c.fi!=-1){
		// cout<<c.fi<<" "<<c.se<<endl;
		if(getit[c.fi][c.se]){
			ans.pb(s[c.fi]);
		}
		c=next1[c.fi][c.se];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 236288
#086-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n=I()
Q=[]
for i in range(n):
    Q.append(IL())
t,x,y=0,0,0
for i in range(n):
    tt=Q[i][0]-t
    tx=Q[i][1]-x
    ty=Q[i][2]-y
    if tx+ty<=tt and (tt-(tx+ty))%2==0:
        t,x,y=Q[i]
    else:
        print("No")
        break
else:
    print("Yes")

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

#define mod 1000000007

char grid[1002][1002];

long long solve(int n, int m) {
	long long dp[n + 1][m + 1];
	//for column
	int blockage = 0;
	for (int i = 1; i <= n; i++) {
		if (grid[i][1] == '#') {
			blockage = 1;
		}
		if (blockage == 1) {
			dp[i][1] = -1;
		}
		else {
			dp[i][1] = 1;
		}
	}

	blockage = 0;
	for (int j = 1; j <= m; j++) {
		if (grid[1][j] == '#') {
			blockage = 1;
		}
		if (blockage == 1) {
			dp[1][j] = -1;
		}
		else {
			dp[1][j] = 1;
		}
	}

	for (int i = 2; i <= n; i++) {
		for (int j = 2; j <= m; j++) {

			if (grid[i][j] == '#') {
				dp[i][j] = -1;
				continue;
			}

			int x = dp[i - 1][j];
			int y = dp[i][j - 1];
			if (x != -1 && y != -1) {
				dp[i][j] = (x + y) % mod;
			}
			else if (x == -1 && y == -1) {
				dp[i][j] = -1;
			}
			else if (x == -1) {
				dp[i][j] = y;
			}
			else if (y == -1) {
				dp[i][j] = x;
			}
		}
	}

	// for (int i = 1; i <= n; i++) {
	// 	for (int j = 1; j <= m; j++) {
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }
	if (dp[n][m] == -1) {
		return 0;
	}
	return dp[n][m] % mod;
}

int main() {
	int n, m;
	cin >> n >> m;

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			cin >> grid[i][j];
		}
	}

	cout << solve(n, m);
}

Measured memory_bytes: 12304
#include<iostream>
using namespace std;
int main(){
  int n,k,q,i;
  cin>>n>>k>>q;
  int score[n];
  for(i=0;i<n;i++){
    score[i]=k;
  }
  int a[q];
  for(i=0;i<q;i++){
    cin>>a[i];
    score[a[i]-1]+=1;
  }
  for(i=0;i<n;i++){
    score[i]-=q;
  }
  for(i=0;i<n;i++){
    if(score[i]>0)
      cout<<"Yes\n";
    else
      cout<<"No\n";
  }
  return 0;
}

Measured memory_bytes: 1408
n = int(input())
lista = []
for i in range(n):
  lista.append(int(input()))

count = 1
fp = lista[0]
if fp == 2:
  print(count)
  exit()

for i in range(n):
  fp = lista[fp-1]
  count += 1
  if fp == 2:
    print(count)
    exit()
print(-1)
       

Measured memory_bytes: 7084
N = int(input())

n = int((2*N)**0.5)
if n*(n+1) == 2*N:
    print("Yes")
    print(n+1)
    S = [[] for _ in range(n+1)]
    num = 1
    for i in range(n+1):
        j = i+1
        while len(S[i]) < n:
            S[i].append(str(num))
            S[j].append(str(num))
            num += 1
            j += 1
    for i in range(n+1):
        print(n, " ".join(S[i]))
    
else:
    print("No")

Measured memory_bytes: 17012
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(" ").map(String::toLong).mapIndexed { index, it -> it - (index + 1) }.sorted()
    println(aList.map {  Math.abs(it - aList[n / 2]) }.sum())
}


Measured memory_bytes: 81252