akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    string s;
    cin>>s;
    bool ok=false;
    if(s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[2]) {
        ok=true;
    } 
    if(s[0]==s[2]&&s[1]==s[3]&&s[0]!=s[1]) {
        ok=true;
    } 
    if(s[0]==s[3]&&s[1]==s[2]&&s[0]!=s[2]) {
        ok=true;
    } 
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define Mod 998244353
using namespace std;
int Read() {
	int x = 0, f = 1; char ch = getchar();
	while(!isdigit(ch)) {if(ch == '-')  f = -1; ch = getchar();}
	while(isdigit(ch)) {x = (x << 3) + (x << 1) + ch - '0'; ch = getchar();}
	return x * f;
}
int n, q, mi[200005], ii[200005], sum[800005], cov[800005];
void pushup(int o, int l, int r) {
	int mid = (l + r) >> 1;
	sum[o] = (sum[o << 1] * mi[r - mid] % Mod + sum[o << 1 | 1]) % Mod;
}
void build(int o, int l, int r) {
	if(l == r)  {sum[o] = 1; return ;}
	int mid = (l + r) >> 1;
	build(o << 1, l, mid);
	build(o << 1 | 1, mid + 1, r);
	pushup(o, l, r);
}
void pushc(int o, int l, int r, int x) {
	cov[o] = x;
	sum[o] = ii[r - l + 1] * x % Mod;
}
void pushdown(int o, int l, int r) {
	if(cov[o]) {
		int mid = (l + r) >> 1;
		pushc(o << 1, l, mid, cov[o]);
		pushc(o << 1 | 1, mid + 1, r, cov[o]);
		cov[o] = 0;
	}
}
void modify(int o, int l, int r, int nl, int nr, int x) {
	if(nl <= l && r <= nr) {pushc(o, l, r, x); return ;}
	int mid = (l + r) >> 1; pushdown(o, l, r);
	if(nl <= mid)  modify(o << 1, l, mid, nl, nr, x);
	if(mid < nr)  modify(o << 1 | 1, mid + 1, r, nl, nr, x);
	pushup(o, l, r);
}
signed main() {
	n = Read(), q = Read();
	mi[0] = 1, ii[0] = 0;
	for(int i = 1; i <= n; i++)
	    mi[i] = mi[i - 1] * 10 % Mod, ii[i] = (ii[i - 1] * 10 + 1) % Mod;
	build(1, 1, n);
	for(int i = 1; i <= q; i++) {
		int l = Read(), r = Read(), d = Read();
		modify(1, 1, n, l, r, d);
		cout << sum[1] << endl;
	}
	return 0;
}

Measured memory_bytes: 14920
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;

signed main(){
    
    string s; cin >> s;
    s = s + "X";
    int n = (int)s.size();
    char cur = 'X';
    int ans = 0;
    for(int i = 0;;i++){
        if(s[i] != cur){
            cur = s[i];
            ans++;
        }

        if(s[i] == 'X') break;
    }

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

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		 //sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;
int main() {
    string S;
    cin>>S;
    string ans;
    if(S == "Sunny"){
        ans = "Cloudy";
    }
    else if(S == "Cloudy"){
        ans = "Rainy";
    }
    else{
        ans = "Sunny";
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 256
# coding: utf-8
import sys


def readline():
    return sys.stdin.readline().rstrip()


def read(f=int):
    return f(readline())


def reads(f=int):
    return list(map(f, readline().split()))


def read_n(n: int, f=int):
    return [read(f) for _ in range(n)]


def reads_n(n: int, f=int):
    return [reads(f) for _ in range(n)]

A, B = reads()

print(max([A - B * 2, 0]))


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main() {
	int w,h;

	while (cin >> h >> w) {
		if (h == 0 && w == 0) {
			break;
		}
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if ((i % 2 == 0 && j % 2 == 0) || (i % 2 != 0 && j % 2 != 0)) {
					cout << '#' << flush;
				} else {
					cout << '.' << flush;
				}
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	string S;
	cin >> S;

	if (S == "SUN") co(7);
	if (S == "MON") co(6);
	if (S == "TUE") co(5);
	if (S == "WED") co(4);
	if (S == "THU") co(3);
	if (S == "FRI") co(2);
	if (S == "SAT") co(1);


	Would you please return 0;
}

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

using namespace std;

#define For(i,a,b) for(ll i=a;i<b;i++)
#define Ford(i,a,b) for(ll i=a;i>=b;i--)
#define RET(x) { cout << x; exit(0); }
#define smin(a,b) a=min(a,b)
#define smax(a,b) a=max(a,b)
#define SZ(x) ((ll)((x).size()))
#define PB push_back
#define ER(x) cout << #x << ' ' << x << '\n';
#define X first
#define Y second

typedef long long int LL;
typedef LL ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef string str;

const ll M=5e5+5,LG=30,mod=924844033;
ll pw(ll x,ll y){ if (y==0) return 1; return pw(x*x%mod,y/2)*(y&1?x:1)%mod; }

#define MOK(x) if (x>=mod) x-=mod;

struct bignum{
  ll ar[M];
  ll siz=0;
  void read(str s){
    while (SZ(s)){
      ar[siz]=s.back()-'0';
      s.pop_back();
      siz++;
    }
  }
  void mult9(){
    ll e=0;
    For(i,0,siz){
      ll p=ar[i]*9+e;
      e=p/10;
      ar[i]=p%10;
    }
    if (e){
      ar[siz++]=e;
    }
  }
  void plusplus(){
    for (ll i=0;1;i++){
      if (ar[i]!=9){
	ar[i]++;
	if (ar[siz]) siz++;
	return;
      }
      ar[i]=0;
    }
  }
  void decer(){
    ar[siz-1]--;
    while (siz && ar[siz-1]==0) siz--;
  }
  bool is0(){
    return (siz==0);
  }
  void chap(){
    For(i,0,siz) cout << ar[i];
    cout << '\n';
  }
};

bignum n;
  
int main(){
  ios::sync_with_stdio(0);
  str s;
  cin >> s;
  n.read(s);
  n.mult9();
  //n.chap();
  //return 0;
  ll tused=0;
  while (!n.is0()){
    n.plusplus();
    n.decer();
    tused++;
    //ER(tused);
    //n.chap();
    //if (tused>20) return 0;
  }
  RET((tused+8)/9);
}


Measured memory_bytes: 5276
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; ++i)
#define rep(i, n) repl(i, 0, n)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
const int MOD = 1000000007;
const int INF = 1001001001;
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, -1, 0, 1};

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int l = 0;
    int r = 1e9;
    while(r - l > 1) {
        int x = (l + r) / 2;
        auto f = [&](int x) {
            ll now = 0;
            rep(i, n) {
                now += (a[i] - 1) / x;
            }
            return now <= k;
        };
        if(f(x)) r = x; else l = x;
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 3956
#include<cstdio>
#include<iostream>
using namespace std;
int main(){ 
    int n;
    int prime[1000000];
    while(cin>>n){
    for(int i=0;i<1000000;i++)prime[i]=0;
    for(int i=2;i<=n;i++){ 
        for(int j=2;i*j<=n;j++){ 
            prime[i*j]=1;
        }
    }
    int ans=0;
    for(int i=2;i<=n;i++){
        if(prime[i]==0)ans++;
    }
    printf("%d\n",ans);
    }
}

Measured memory_bytes: 6920
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
    int A,B,C,X;
    cin>>A>>B>>C>>X;
    int count=0;
    for(int i=0;i<A+1;i++){
        for(int j=0;j<B+1;j++){
            for(int k=0;k<C+1;k++){
                if(500*i+100*j+50*k==X){
                    count+=1;
                }
            }
        }
    }
    cout<<count<<endl;
    
    return 0;
}






Measured memory_bytes: 256
fun main(args: Array<String>){
    val (m,k) = readLine()!!.split(" ").map(String::toLong)
    val t : Long = Math.pow(2.0,m.toDouble()).toLong()
    if(t<=k){
        println(-1)
        return
    }
    if(m==1L){
        if(k==0L) println("0 0 1 1")
        else println(-1)
        return
    }
    for (i in 0 until t) if(i!=k) print("$i ")
    print("$k ")
    for (i in (0 until t).reversed()) if(i!=k) print("$i ")
    print("$k")
    println()
}

Measured memory_bytes: 52672
#define MOD_TYPE 2

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using multiInt = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

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

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

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

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
#pragma endregion

int main()
{
  init_main();

  string s;
  cin >> s;
  Yes(s != "AAA" && s != "BBB");

  return 0;
}


Measured memory_bytes: 256
h,w=gets.split.map(&:to_i)
$a=[]
h.times{$a<<gets.chomp.split("")}
def valid(i,j,h,w)
  0<=i and i<h and 0<=j and j<w
end
def neigh?(i,j,h,w)
  if valid(i-1,j,h,w) and $a[i-1][j].eql?("#")
    return true
  elsif valid(i,j-1,h,w) and $a[i][j-1].eql?("#")
    return true
  elsif valid(i+1,j,h,w) and $a[i+1][j].eql?("#")
    return true
  elsif valid(i,j+1,h,w) and $a[i][j+1].eql?("#")
    return true
  end
  return false
end

0.upto(h-1){|i| 0.upto(w-1){|j|
  if $a[i][j].eql?("#") and not neigh?(i,j,h,w)
    puts "No"
    exit
  end
}}
puts "Yes"

Measured memory_bytes: 1916
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	if((s[0]=='A' and s[1]=='A' and s[2]=='A') or(s[0]=='B' and s[1]=='B' and s[2]=='B'))
	cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
A, B = map(int, input().split())
S = input()
flag = True
if len(S) != A + B + 1:
    print('No')
else:
    for i in range(len(S)):
        if i != A:
            if S[i] == '-':
                flag = False
                break
        if i == A:
            if S[i] != '-':
                flag = False
                break
print('Yes' if flag else 'No')
        


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9;
int number;
const int nx = 1e5+5;
int ac[nx][3];
int dyn[3][nx];
int init(int a, int i){
	if(i == number) return 0;
	if(dyn[a][i] != -1) return dyn[a][i];
	int& res = dyn[a][i];
	
	if(a==0){
		res=max(res, init(1, i+1)+ac[i][0]);
		res=max(res, init(2, i+1)+ac[i][0]);
	}
	if(a==1){
		res=max(res, init(0, i+1)+ac[i][1]);
		res=max(res, init(2, i+1)+ac[i][1]);
	}
	if(a==2){
		res=max(res, init(0, i+1)+ac[i][2]);
		res=max(res, init(1, i+1)+ac[i][2]);
	}
	
	return res;
}
int main(){
	cin>>number;
	for(int i=0; i<number; i++) cin>>ac[i][0]>>ac[i][1]>>ac[i][2];
	memset(dyn, -1, sizeof dyn);
	cout<<max(init(0,0),max(init(1,0),init(2,0)))<<"\n";
	return 0;
}



Measured memory_bytes: 7296
#include <iostream>

using namespace std;

int main()
{
	long long i, j=0, k, N, a[100000], ans=0;
	cin >> N;
	for (i = 0; i < N; i++) {
		cin >> a[i];
	}

	for (i = 0; i < N; i++) {
		if (a[j] == 2) {
			cout << ans+1 << endl;
			return 0;
		}

		j=a[j]-1;
		ans++;
	}

	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
a_list = []
for i in range(n):
  a = int(input())
  list_ = []
  for _  in range(a):
    tuple_a = list(map(int,input().split()))
    list_.append(tuple_a)
  a_list.append(list_)
case_list = []
for i in range(2**n):
  case = [0 for i in range(n)]
  for j in range(n):
    if ((i >> j) & 1): 
      case[j] = 1
  case_list.append(case)

ok_case = []
for case in case_list:
  frug = True
  for i  in range(n):
    if case[i] == 1:
      cheker = a_list[i]
      for c in cheker :
        if c[1] != case[c[0] - 1]:
          frug = False
  if frug == True:
    ok_case.append(case)
result_list = []
for ok in ok_case:
  result_list.append(sum(ok))
print(max(result_list))
  


Measured memory_bytes: 10544
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    ll N,A,B;
    cin>>N>>A>>B;
    if((A-B)%2==0){
        cout<<abs(A-B)/2<<endl;
        return 0;
    }
    cout<<min((A+B-1)/2,(2*N-A-B+1)/2)<<endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    int N,K,p=pow(10,9)+7;cin>>N>>K;
    int a[110];
    for(int i=1;i<=N;i++)cin>>a[i];

    mat dp(110,vec(100010));
    int sum[100010];
    sum[0]=0;

    //初期化
    for(int j=1;j<=K;j++)dp[0][j]=0;
    for(int i=0;i<=N;i++)dp[i][0]=1;
    //漸化式
    for(int i=1;i<=N;i++){
        for(int k=1;k<=K+1;k++)
            sum[k]=(sum[k-1]+dp[i-1][k-1])%p;
        for(int j=1;j<=K;j++)
            dp[i][j]=(sum[j+1]-sum[j-min(a[i],j)]+p)%p;   
    }
    cout<<dp[N][K]<<endl;
    return 0;
}

Measured memory_bytes: 43776
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define lb long double
#define vec vector<int>
using namespace std;
int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int> >a(n, vector<int>(m));
	rip(i, n) {
		rip(j, m) cin >> a[i][j];
	}
	vec b(m);
	rip(i, m)cin >> b[i];
	vec c(n);
	rip(i, n) {
		rip(j, m) {
			c[i] += a[i][j] * b[j];
		}
	}
	rip(i, n)cout << c[i] << endl;
}


Measured memory_bytes: 3212
#include<stdio.h>
#include<math.h>

int main() {
	long long a, b, c;
	int i;
	while(scanf("%lld%lld",&a,&b)!=EOF) {
		a = b/a;
		c = 1;
		for(i=0;i<100;i++) {
			if(c>a) break;
			else c *= 2;
		}
		printf("%d\n",i);
	}
}

Measured memory_bytes: 128
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	ar := make([]int, n+1)
	br := make([]int, n)
	for i := range ar {
		fmt.Scan(&ar[i])
	}
	for i := range br {
		fmt.Scan(&br[i])
	}
	ans := 0
	for i := 0; i < n; i++ {
		if ar[i] >= br[i] {
			ans += br[i]
			ar[i] -= br[i]
			br[i] = 0
		} else {
			ans += ar[i]
			br[i] -= ar[i]
			ar[i] = 0
		}
		if ar[i+1] >= br[i] {
			ans += br[i]
			ar[i+1] -= br[i]
			br[i] = 0
		} else {
			ans += ar[i+1]
			br[i] -= ar[i+1]
			ar[i+1] = 0
		}
	}
	fmt.Println(ans)
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  vector<pair<int,int>> a(n);
  for(int i=0;i<n;i++) cin >> a[i].first,a[i].second=i%2;
  sort(all(a));
  int ans=0;
  for(int i=0;i<n;i+=2) ans+=a[i].second;
  cout << ans << endl;
  return 0;
}

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

int main() {

  double a, b, x;
  cin >> a >> b >> x;

  double answer = 0.0;
  double wh = x / (a * a); 
  double dh = b - wh;

  if (dh <= wh) {

    double aa = atan2(dh * 2,a);
    answer = aa * 180.0 / M_PI;

  } else {

    double ab = a * b;
    double x2 = 2 * x;
    double h = x2 / ab;
    double bb = atan2(h,b);
    answer = bb * 180.0 / M_PI;
    answer = 90 - answer;

  }

  cout << setprecision(12) << answer << endl; 

}

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

typedef long long ll;

int main() {
ll N, K;   cin >> N >> K;
vector<ll> H(N);
for (int i = 0; i < N; i++) {
    cin >> H[i];
}
sort(H.begin(), H.end());

ll ans = 1000000001;
for (int i = 0; i < N - K + 1; i++) {
    ans = min(ans, H[i + K - 1] - H[i]);
}

cout << ans << endl;

}

Measured memory_bytes: 1024
#include <stdio.h>


int main(){
	
	int n,a[100000],i,m=1,count=0;
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	
	while(count<=n){
		count=count+1;
		m = a[m-1];
		if(m==2){break;}
	}
	
	if(count==n+1)printf("-1\n");
	else printf("%d\n",count);
	
	return 0;
}


Measured memory_bytes: 512
import std.conv;
import std.stdio;
import std.string;
import std.array;
import std.algorithm;

void main()
{
    auto a = readln.split.map!(to!int);
    int w=a[0],h=a[1],x=a[2],y=a[3],r=a[4];
    writefln(x-r<0 || y -r < 0 || x+r > w || y+r > h ? "No" : "Yes");
}

Measured memory_bytes: 2448
# -*- coding: utf-8

while True:
   a = list(map(int,input().split()))
   if a == [0,0]:
      break
   if a[1] % 2 == 0:
      b1 = "#."*int(a[1]/2)
      b2 = ".#"*int(a[1]/2)
   if a[1] % 2 == 1:
      b1 = "#."*int((a[1]-1)/2)+"#"
      b2 = ".#"*int((a[1]-1)/2)+"."
   
   if a[0] %2 == 0:
      for i in range(int(a[0]/2)):
         print(b1)
         print(b2)
   if a[0] %2 == 1:
      for i in range(int((a[0]-1)/2)):
         print(b1)
         print(b2)
      print(b1)
   print("")



Measured memory_bytes: 5624
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
int h[n+1];
  for(int i=1;i<=n;i++)cin>>h[i];
  int ans[n+1]={0};
  ans[0]=0;
  ans[1]=0;
  ans[2]=abs(h[2]-h[1]);
  for(int i=3;i<=n;i++){
  ans[i]=min(abs(h[i]-h[i-2])+ans[i-2],abs(h[i]-h[i-1])+ans[i-1]);
  }cout<<ans[n];
  
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = (1 << 29);
const long long INFL = (1LL<<60);
const double eps = (1e-9);

int main(int argc, char* argv[])
{
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;

  ll ans = INFL;
  for (int i = 0; i <= max(x, y) * 2; i += 2) {
    ll tmp = i * c;
    if ((x - i / 2) > 0) tmp += (x - i / 2) * a;
    if ((y - i / 2) > 0) tmp += (y - i / 2) * b;
    chmin(ans, tmp);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int INF = 2e9;

int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size(), m = t.size();
  vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i] == t[j]) dp[i + 1][j + 1] = max(dp[i][j] + 1, dp[i + 1][j + 1]);
      dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j]);
      dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1]);
    }
  }

  string res = "";
  int i = n, j = m;
  while (i > 0 && j > 0) {
    if (dp[i][j] == dp[i - 1][j]) i--;
    else if (dp[i][j] == dp[i][j - 1]) j--;
    else {
      res += s[i - 1];
      i--;
      j--;
    }
  }
  reverse(res.begin(), res.end());
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 38572
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        final int N = sc.nextInt();
        final int K = sc.nextInt();

        final int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = sc.nextInt();
        }

        Arrays.sort(H);

        for (int i = 1; i <= K && N-i >= 0; i++) {
            H[N-i] = 0;
        }

        long ans = 0;
        for (int i = 0; i < N; i++) {
            ans += H[i];
        }

        System.out.println(ans);
    }
}


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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, k, n) for (int i = k; i < n; ++i)
#define fore(i,a) for (auto &i : a)
#define repr(i, n) for (int i = n; i >= 0; --i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int mod = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = LLONG_MAX / 2;
const static double eps = 1e-10;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

struct edge {
    int u, v;
    llong cost;
};

bool comp(const edge &e1, edge &e2) {
    return e1.cost < e2.cost;
}

const static int MAX_N = 200001;

int par[MAX_N + 1], rank_t[MAX_N + 1];

void init_union_find(int n) {
    for (int i = 0; i <= n; ++i) {
        par[i] = i;
        rank_t[i] = 0;
    }
}

int find_root(int x) {
    return par[x] == x ? x : par[x] = find_root(par[x]);
}

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

void unite(int x, int y) {
    x = find_root(x);
    y = find_root(y);
    if (x == y) return;

    if (rank_t[x] < rank_t[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rank_t[x] == rank_t[y]) rank_t[x]++;
    }
}

vector<edge> es;

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<tuple<int, int, int> > XY(n), YX(n);
    rep(i, n) {
        int x, y;
        cin >> x >> y;
        XY[i] = make_tuple(x, y, i);
        YX[i] = make_tuple(y, x, i);
    }

    sort(all(XY));
    sort(all(YX));

    rep(i, n - 1) {
        edge ex, ey;
        ex.u = get<2>(XY[i]);
        ex.v = get<2>(XY[i + 1]);
        ex.cost = get<0>(XY[i + 1]) - get<0>(XY[i]);
        es.push_back(ex);

        ey.u = get<2>(YX[i]);
        ey.v = get<2>(YX[i + 1]);
        ey.cost = get<0>(YX[i + 1]) - get<0>(YX[i]);
        es.push_back(ey);
    }

    sort(all(es), comp);

    init_union_find(n);

    llong res = 0;
    rep(i, es.size()) {
        edge e = es[i];
        if (! same(e.u, e.v)) {
            unite(e.u, e.v);
            res += e.cost;
        }
    }

    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 8688
#include <iostream>
#include <iomanip>
using namespace std;
 
int main() {
  double r;
  double PI=3.14159265359;
  
  cin >> r;
  
  cout << fixed << setprecision(10) << r*r*PI << " " << 2*r*PI <<  endl;

  return 0;
}



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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    if (a - b == 0) {
        cout << c << endl;
        return 0;
    }

    if (b - c == 0) {
        cout << a << endl;
        return 0;
    }

    if (a - c == 0) {
        cout << b << endl;
        return 0;
    }


    return 0;
}

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

//橋と関節点:  O(V + E)
class Lowlink{
public:
  int V;
  vector<vector<int> > G;
  vector<int> ord;           //ord[i] := ノードiに訪れた順番
  vector<int> low;           //low[i] := ノードiから訪れることができる最小のord[j]の値。
  vector<int> articulation;
  int ok;
  
  Lowlink():V(-1),ok(false){};
  Lowlink(int V):V(V),G(V),ok(false){};
  
  void add_edge(int a,int b){
    ok = false;
    assert(a < V && b < V);
    assert(a >=0 && b >= 0);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  void build(int root = 0){
    ok = true;
    ord.clear(); ord.resize(V,-1);
    low.clear(); low.resize(V,-1);
    articulation.clear(); articulation.resize(V,0); /*関節点用*/
    
    int cnt = 0;
    function<int(int,int)> dfs=[&](int pos,int pre){
      ord[pos] = low[pos] = cnt++;
      for(int to:G[pos]) {
        if(to == pre) continue; 
        if(ord[to] != -1) low[pos] = min(low[pos], ord[to]);
        else {
          low[pos] = min(low[pos], dfs(to, pos));
	  
	  /*関節点用*/
	  if(pos == root) articulation[pos]++;
	  else articulation[pos] |= ord[pos] <= low[to];
	  
	}
      }
      return low[pos];
    };
    
    dfs(root , -1);
    articulation[root] = articulation[root] >= 2; /*関節点用*/
  }

  int isBridge(int a,int b){
    assert(ok);
    assert(a < V && b < V);
    assert(a >= 0 && b >= 0);
    if(ord[a] > ord[b]) swap(a, b);
    return ord[a] < low[b];
  }
  
  int isArticulation(int a){
    assert(ok);
    assert(a >= 0 && a < V);
    return articulation[a];
  }
};


signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  auto verifyBridge=[&]{
    int V, E;
    cin>>V>>E;
  
    Lowlink A(V);
    for(int i=0;i<E;i++){
      int a,b;
      cin>>a>>b;
      A.add_edge(a,b);
    }
    
    A.build();
    
    typedef pair<int,int> P;
    vector<P> ans;
    for(int i=0;i<V;i++)
      for(int to:A.G[i]) if(i < to && A.isBridge(i, to)) ans.push_back(P(i, to));
    
    sort(ans.begin(),ans.end());
    for(auto a:ans) cout<<a.first<<" "<<a.second<<endl;
  };

  verifyBridge();

  return 0;
}



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

ll digitSum(string &k, int s){

    int n = k.size();
    if(n == 1){
        int ans = 0;
        for(int i=1; i<=k[0]-'0'; i++)
            if(i%s == 0)
                ans++;
        return ans;
    }
    vector<vector<ll>> dp(n, vector<ll>(s, 0));
    // dp[i][j] stores the number of integers having 'i' digits and
    // having remainder as 'j' when sum of digits is divided by 's'

    for(int d=1; d<=9; d++){
        int rem = d%s;
        dp[1][rem]++;
    }

    dp[0][0] = 1;
    for(int i=2; i<=n-1; i++){
        for(int j=0; j<s; j++){
            // Find number integers having number of digits as 'i'
            // and remainder as 'j'
            // At this place we can append any of the 10 digits
            for(int d=0; d<=9; d++){
                ll req = ((j-d)%s+s)%s;
                dp[i][j] = (dp[i][j] + dp[i-1][req])%M;
            }
        }
    }

    // Now find number of required integers with exactly 'n' digits
    ll ans = 0, sum = 0;
    vector<ll> cnt(s, 0);
    for(int i=0; i<=n-1; i++){
        for(int j=0; j<s; j++){
            cnt[j] = (cnt[j] + dp[i][j])%M;
        }
    }
    for(int i=0; i<n; i++){
        int d = k[i]-'0';
        int st = 0;
        if(i == 0)
            st++;
        for(int w=st; w<d; w++){
            int newSum = sum + w;
            int req = (-newSum%s + s)%s;
//            for(int j=0; j<=n-i-1; j++){
//                ans = (ans + dp[j][req])%M;
//            }
            ans = (ans + cnt[req])%M;
        }
        for(int j=0; j<s; j++){
            cnt[j] = ((cnt[j] - dp[n-i-1][j])%M + M)%M;
        }
        sum += d;
    }
    // If the number 'k' itself has sum of digits as multiple of 's'
    if(sum%s == 0)
        ans = (ans + 1)%M;

    for(int i=1; i<=n-1; i++){
        ans = (ans + dp[i][0])%M;
    }
    return ans;
}

int main()
{
 string k;
 cin>>k;
 int s;
 cin>>s;
 ll ans = digitSum(k, s);
 cout<<ans;
 return 0;
}



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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

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

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n;cin>>n&&n;){
		vi a(n),b(n);
		rep(i,n) cin>>a[i];
		rep(i,n) cin>>b[i];
		if(accumulate(all(a),0ll)<accumulate(all(b),0ll)){
			cout<<-1<<endl;
			continue;
		}
		ll lack=0,res=0;
		vi enough;
		rep(i,n){
			if(a[i]<b[i]){
				lack+=b[i]-a[i];
				res++;
			}
			else
				enough.push_back(a[i]-b[i]);
		}
		sort(all(enough));
		if(lack==0){
			cout<<0<<endl;
			continue;
		}
		per(i,enough.size()){
			lack-=enough[i];
			if(lack<=0){
				res+=enough.size()-i;
				break;
			}
		}
		cout<<res<<endl;
	}
}


Measured memory_bytes: 1660
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;
int main(void){

    int n,m;
    cin>>n>>m;
    int s = m;
    int ans = m;
    for(int i = 0;i < n;i++){
        int x,y;
        cin>>x>>y;
        s += x-y;
        if(s<0){
            cout<<0<<endl;
            return 0;
        }
        ans = max(ans,s);
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
using namespace std;
struct student
{
	int num;
	int total;
}s[100100];
bool cmp(student a,student b)
{
	if(a.total<b.total)
	return true;
	else
	return false;
}
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		s[i].num=i;
		cin>>s[i].total;
	}
	sort(s+1,s+1+n,cmp);
	for(int i=1;i<=n;i++)
	{
		if(i!=n)
		{
			cout<<s[i].num<<" ";
		}
		else
		{
			cout<<s[i].num;
		}
	}
}

Measured memory_bytes: 1536
if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    canReach = [[[False for _ in range(51)] for _ in range(N)] for _ in range(50)]  # k, n, a

    for k in range(50):
        for n in range(N):
            canReach[k][n][B[n]] = True

    for k in range(1, 50):
        for n in range(N):
            for a in range(51):
                if canReach[k - 1][n][a] or canReach[k - 1][n][a % k]:
                    canReach[k][n][a] = True

    aList = [[[False for _ in range(51)] for _ in range(N)] for _ in range(50)]  # k, n, a
    for n in range(N):
        aList[49][n][A[n]] = True

    ans = 0
    for k in reversed(range(1, 50)):
        # 到達可能かどうかチェック
        for n in range(N):
            judge = False
            for a in range(51):
                if aList[k][n][a] and canReach[k][n][a]:
                    judge = True
                    break
            if not judge:
                print(-1)
                exit()
        # kを使わないで行けるかどうかチェック
        shouldUseK = False
        for n in range(N):
            judge = False
            for a in range(51):
                if aList[k][n][a] and canReach[k - 1][n][a]:
                    judge = True
                    break
            if not judge:
                shouldUseK = True
                break

        if shouldUseK:
            ans += 2 ** k
            for n in range(N):
                for a in range(51):
                    if aList[k][n][a]:
                        aList[k - 1][n][a] = True
                        aList[k - 1][n][a % k] = True
        else:
            for n in range(N):
                for a in range(51):
                    if aList[k][n][a]:
                        aList[k - 1][n][a] = True

    print(ans)


Measured memory_bytes: 5748
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line);
    let ls : Vec<i32> = line.trim().split(" ").map(|i| i.parse().unwrap()).collect();
    let n : i32 = ls[0];
    let m : i32 = ls[1];

    println!("{}", (n-1) * (m-1));
}


Measured memory_bytes: 4352
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp1 {
    public class Class1 {
        static void Main(string[] args) {
            var N = Console.ReadLine();
            foreach (var a in N.Reverse()) {
                if (a == '2' || a == '4' || a == '5' || a == '7' || a == '9') {
                    Console.Write("hon");
                } else if (a == '3') {
                    Console.Write("bon");
                } else {
                    Console.Write("pon");
                }
                break;
            }
        }
    }
}

Measured memory_bytes: 26356
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int main()
{
	double x;
	for (; cin >> x;)
	{
		if (x <= 48.0)
		{
			cout << "light fly" << endl;
		}
		else if (48.0 < x && x <= 51.0)
		{
			cout << "fly" << endl;
		}
		else if (51.0 < x && x <= 54.0)
		{
			cout << "bantam" << endl;
		}
		else if (54.0 < x && x <= 57.0)
		{
			cout << "feather" << endl;
		}
		else if (57.0 < x && x <= 60.0)
		{
			cout << "light" << endl;
		}
		else if (60.0 < x && x <= 64.0)
		{
			cout << "light welter" << endl;
		}
		else if (64.0 < x && x <= 69.0)
		{
			cout << "welter" << endl;
		}
		else if (69.0 < x && x <= 75.0)
		{
			cout << "light middle" << endl;
		}
		else if (75.0 < x && x <= 81.0)
		{
			cout << "middle" << endl;
		}
		else if (81.0 < x && x <= 91.0)
		{
			cout << "light heavy" << endl;
		}
		else
		{
			cout << "heavy" << endl;
		}
	}
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    string S;
    cin >> S;
    string T;
    cin >> T;
    T = T.substr(0, sz(T) - 1);
    bool bl = S == T;
    puts(bl ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

int main()
{
    KAKA
    string s;
    cin>>s;
    ll sum = 0;
    for(char c : s)
    {
        sum += c - '0';
    }
    if(sum % 9) cout<<"No"<<"\n";
    else cout<<"Yes"<<"\n";
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e9

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll n, k, x, ans;
vector <ll> a;
bool can_reach[5001];

void upper_bound(){
	int lo, mid, hi;
	bool pos;
	lo = 0;
	hi = n-1;
	while(lo<=hi){
		mid=lo+(hi-lo)/2;
		for(int i = 0; i < n; i++){
			if(i!=mid){
				for(int j = k-1; j >= a[i]; j--){
					can_reach[j]=can_reach[j]|can_reach[j-a[i]];
				}
			}
		}
		pos=0;
		for(int i = k-1; i >= k-a[mid] && i >= 0; i--){
			if(can_reach[i]){
				pos=1;
			}
		}
		for(int i = 1; i <= k; i++){
			can_reach[i]=0;
		}
		if(!pos){
			ans=mid;
			lo=mid+1;
		}
		else{
			hi=mid-1;
		}
	}
}

int main()
{
	ans=-1;
	can_reach[0]=1;
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> x;
		a.pb(x);
	}
	sort(a.begin(),a.end());
	upper_bound();
	cout << ans+1;
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;

ll MOD = 998244353;
ll ext_gcd(ll a, ll b, ll&x, ll&y){
    if (b == 0){
        x = 1; y = 0; return a;
    }
    ll q = a/b;
    ll g = ext_gcd(b, a-q*b, x, y);
    ll z =  x - q*y;
    x = y; y = z;
    return g;
}

// aのmod mにおける逆元を返す。aとmは互いに素であることが要請される。
ll invmod(ll a, ll m){
    ll x,y;
    ext_gcd(a, m, x, y);
    x %= m;
    if (x < 0) x += m;
    return x;
}



int main (){
    ll N;
    cin >> N;
    ll max = 1000000;
    ll A[200000];
    ll c[1000001];
    ll w[max+1];


    // 初期化
    rep(i, max+1){
        w[i] = 0;
        c[i] = 0;
    }

    rep(i, N){
        cin >> A[i];
        c[A[i]]++;
    }


    // wの計算
    REP(i, 1, max+1){
        w[i] += invmod(i, MOD);
        for(int j=i*2;j<max+1;j+=i){
            w[j] -= w[i];
        }
        if (w[i] < 0) w[i] += MOD;
    }

    ll ans = 0;
    REP(i, 1, max+1){
        ll tmp1 = 0;
        ll tmp2 = 0;
        ll res;
        for(int j = i; j < max+1; j+=i){
            res = (j*c[j]) % MOD;
            tmp1 += res;
            tmp2 += (j*res) % MOD;
            tmp1 %= MOD;
            tmp2 %= MOD;
        }
        ll tmp3;
        tmp3 = invmod(2, MOD)*((((tmp1*tmp1)%MOD)-tmp2+MOD)%MOD) % MOD;
        ans += w[i]*tmp3 % MOD;
        ans %= MOD;
    }

    cout << ans << endl;



}

Measured memory_bytes: 17408
#include<stdio.h>
int main(){
	int na;
	int a[10];
	int angka[3][3];
	int tanda[3][3];
	
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			scanf("%d", &angka[i][j]);
		}
	}
	scanf("%d", &na);
	for(int c=0;c<na;c++){
		scanf("%d", &a[c]);
	for(int  l = 0 ; l < 3 ; l++ ) {
        for(int k = 0 ; k < 3 ; k++ ){
            if( a[c] == angka[l][k] ){
                tanda[l][k] = 1;
                }
            }
        }
    }

    if( (tanda[1][1] == 1 && tanda[2][2] == 1 && tanda[0][0] == 1  )
    || (tanda[2][0] == 1 && tanda[1][1] == 1 && tanda[0][2] == 1  )
    || (tanda[0][0] == 1 && tanda[0][1] == 1 && tanda[0][2] == 1  )
    || (tanda[1][0] == 1 && tanda[1][1] == 1 && tanda[1][2] == 1  )
    || (tanda[2][0] == 1 && tanda[2][1] == 1 && tanda[2][2] == 1  )
    || (tanda[0][0] == 1 && tanda[1][0] == 1 && tanda[2][0] == 1  )
    || (tanda[0][1] == 1 && tanda[1][1] == 1 && tanda[2][1] == 1  )
    || (tanda[0][2] == 1 && tanda[1][2] == 1 && tanda[2][2] == 1  )
    ) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
	return 0;
}

Measured memory_bytes: 1664
#include <algorithm>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <istream>
#include <map>
#include <numeric>
#include <ostream>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>


using namespace std;


class Solution {
 public:
  void solve(std::istream& in, std::ostream& out) {
    int d;
    in >> d;
    out << "Christmas ";
    for (int ctr1 = 25; ctr1 > d; --ctr1)
      out << "Eve ";
    return;
  }
};

void solve(std::istream& in, std::ostream& out)
{
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}
// Powered by caide (code generator, tester, and library code inliner)


#include <fstream>
#include <iostream>


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


  istream& in = cin;


  ostream& out = cout;

  solve(in, out);
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
using namespace std;

int main(){
	string s;
	cin >> s;
	for(int i = 0; i < s.size(); i += 2){
		cout << s[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 512
if __name__ == '__main__':
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    A = sorted(A)[::-1]
    s = sum(A)
    cnt = 0
    for i in range(M):
        if s<=4*M*A[i]:
            cnt += 1
    if cnt==M:
        print("Yes")
    else:
        print("No")
    


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
#define lint long long
//#define P pair<int, int>



int main(){
    int N, M;
    
    cin >> N >> M;
    
    lint t = 1;
    
    for(int i = 0; i < M; ++i){
        t *= 2;
    }
    
    cout << (lint)t * (1900 * M + 100 * (N - M)) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

int main() {
  int k;
  scanf("%d", &k);
  ll a[100005];
  for (int i = 0; i < k; i++) {
    scanf("%lld", &a[i]);
  }
  ll mn = 2;
  ll mx = 2;
  for (int i = k - 1; i >= 0; i--) {
    // [L, R]のaの倍数のminは、ceil(L/a)*a
    //                  maxは、floar(R/a)*a
    mn = (mn + a[i] - 1) / a[i] * a[i];
    mx = mx / a[i] * a[i] + a[i] - 1;
    if (mn > mx) {
      puts("-1");
      return 0;
    }
  }
  printf("%lld %lld", mn, mx);
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    set<int> st;
    REP(i,N){
        int a; cin>>a;
        st.insert(a);
    }
    cout<<st.size()<<endl;
}


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

namespace ConsoleApp2
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			var list = new List<Coordinate>(n);

			for (int i = 0; i < n; i++)
			{
				var inputs = Console.ReadLine().Split(' ');
				list.Add(new Coordinate(int.Parse(inputs[0]), int.Parse(inputs[1])));
			}
			list.Sort((a, b) => 
			{
				if (a.mX == b.mX)
				{
					return a.mY - b.mY;
				}
				else
				{
					return a.mX - b.mX;
				}
			});

			var dic = new Dictionary<Diff, int>();
			for(int i = 0; i < n - 1; i++)
			{
				for (int j = i + 1; j < n; j++)
				{
					var diff = new Diff(list[i], list[j]);
					if (dic.ContainsKey(diff))
					{
						dic[diff]++;
					}
					else
					{
						dic.Add(diff, 1);
					}
				}
			}
			int sameDiff = 0;
			foreach(var val in dic.Values)
			{
				sameDiff = Math.Max(sameDiff, val);
			}
			// コスト0で回収できる回数
			int zeroCostCount = sameDiff;

			int cost = 1 + (n - 1 - zeroCostCount);

			Console.WriteLine(cost);
		}

		public class Coordinate
		{
			public int mX;
			public int mY;

			public Coordinate(int x, int y)
			{
				mX = x;
				mY = y;
			}
		}

		public struct Diff
		{
			public int mDiffX;
			public int mDiffY;

			public Diff(Coordinate a, Coordinate b)
			{
				mDiffX = b.mX - a.mX;
				mDiffY = b.mY - a.mY;
			}

			public override bool Equals(object obj)
			{
				return ((Diff)obj).mDiffX == mDiffX && ((Diff)obj).mDiffY == mDiffY;
			}

			public override int GetHashCode()
			{
				return mDiffX + mDiffY;
			}
		}
	}
}


Measured memory_bytes: 13396
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char S[100000];

int main() {
  int N, result;
  int i;
  scanf ("%d", &N);
  scanf ("%s", S);
  
  result = 1;
  for (i=1;i<N;i++) {
     if (S[i]!=S[i-1]) result++;
  }
  
  
  
  printf("%d", result);
  return 0;
}




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

int main(){
    int a[6];
    for(int i=0; i<5; i++){
        cin>>a[i];
    }
    for(int i=0; i<5; i++){
        if(a[i]==0)
        {
            cout<<i+1<<endl;
            break;
        }
    }

}


Measured memory_bytes: 3624