akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		String str = scan.next();
		int q = scan.nextInt();
		for(int i = 0; i < q; i++){
			String com = scan.next();
			int a = scan.nextInt();
			int b = scan.nextInt();
			if(com.equals("print")){
				String out = str.substring(a, b + 1);
				System.out.println(out);
			}
			if(com.equals("reverse")){
				String top = str.substring(0, a);
				String bottom = str.substring(b + 1);
				StringBuffer sb = new StringBuffer();
				for(int j = b; j >= a; j--){
					char ch = str.charAt(j);
					sb.append(ch);
				}
				String r = sb.toString();
				StringBuffer sb2 = new StringBuffer();
				sb2.append(top).append(r).append(bottom);
				str = sb2.toString();
			}
			if(com.equals("replace")){
				String p = scan.next();
				String top = str.substring(0, a);
				String bottom = str.substring(b + 1);
				StringBuffer sb = new StringBuffer();
				sb.append(top).append(p).append(bottom);
				str = sb.toString();
			}
		}
	}
}

Measured memory_bytes: 30028
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
  #include "dbgtoki.hpp"
  #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
DbgTimer D_t;
  #define TSTART() D_t.start()
  #define TSTOP() D_t.stop()
#else
  #define DUMP(i) 
  #define TSTART()
  #define TSTOP()  
#endif
 
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

const int EPS = 1e-9;



int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,h;
  while(cin >> a >> b >> h){
    TSTART();
    int ans = (a+b)*h/2;
    cout << ans << endl;
    TSTOP();
  }
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main(void){
  int zahyou[5],k,i,j,kyori,flag=0;
  for(i=0;i<5;i++){
  scanf("%d\n",&zahyou[i]);
  }
  scanf("%d",&k);
  
  for(i=0;i<5;i++){
    for(j=1;j<5-i;j++){
      kyori = abs(zahyou[i]-zahyou[j]);
      if(kyori>k){
        flag=1;
      }
    }
  }
  if(flag==0){
    puts("Yay!");
  }else{
    puts(":(");
  }
  return 0;
}
      

Measured memory_bytes: 128
#####segfunc######                                                              
def segfunc(x,y):
    return max(x,y)

def init(init_val):
    #set_val                                                                    
    for i in range(n):
        seg[i+num-1]=init_val[i]
    #built                                                                      
    for i in range(num-2,-1,-1):
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2])
    
def update(k,x):
    k+=num-1
    seg[k]=x
    while k+1:
        k=(k-1)//2
        seg[k]=segfunc(seg[k*2+1],seg[k*2+2])

def query(p,q):
    if q<=p:
        return ide_ele
    p+=num-1
    q+=num-2
    res=ide_ele
    while q-p>1:
        if p&1==0:
            res=segfunc(res,seg[p])
        if q&1==1:
            res=segfunc(res,seg[q])
            q-=1
        p=p//2
        q=(q-1)//2
    if p==q:
        res=segfunc(res,seg[p])
    else:
        res=segfunc(segfunc(res,seg[p]),seg[q])
    return res

ide_ele=-10**30
n=int(input())
num=2**(n-1).bit_length()
seg=[ide_ele]*2*num
x=[]
s=[]
for i in range(n):
    p,q=map(int,input().split())
    x.append(p)
    s.append(q)
r=[0]
for i in range(n):
    r.append(r[-1]+s[i])
b=[]
for i in range(n):
    b.append(r[i+1]-x[i])
init(b)
ans=0
for i in range(n):
    ans=max(ans,query(i,n)-(r[i]-x[i]))
print(ans)

Measured memory_bytes: 98516
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

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

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;


int main()
{
   FAST/**/
   
   ll h,n;
   cin>>h>>n;
   
   ll sum = 0;
   rep(n)
   {
       ll temp;
       cin>>temp;
       sum+=temp;
   }
   
   if(sum>=h)
        cout<<"Yes";
   else cout<<"No";        
   
   return 0;        
}  
   

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

int n,m,par[200000];

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

void unite(int x, int y){
    x=find(x);
    y=find(y);
    if(x==y){
        return ;
    }
    par[x]=y;
}

bool same(int x, int y){
    if (find(x)==find(y)){
        return true;
    } else {
        return false;
    }
}

int main(void){
    scanf("%d%d",&n,&m);    
    for (int i=0; i<n+m; i++){
        par[i]=i;
    }
    for (int i=0; i<n; i++){
        int k;
        scanf("%d",&k);
        for (int j=0; j<k; j++){
            int l;
            scanf("%d",&l);
            unite(i,n+l-1);
        }
    }
    for (int i=0; i<n-1; i++){
        if (same(i,i+1)==false){
            printf("NO\n");
            return 0 ;
        }
    }
    printf("YES\n");
	return 0 ;
}

Measured memory_bytes: 1280
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input!{
        source = src,
        h: isize,
        a: isize,
    }
 
    let adjust;
    if h % a == 0 {
        adjust = 0;
    } else { 
        adjust = 1;
    }
    return (adjust + h / a).to_string();
}


Measured memory_bytes: 4352
import sys
sys.setrecursionlimit(10 ** 7)

N = int(input())
X = list(map(int, input().split()))

cnt = 10 ** 10
for i in range(101):
    p = 0
    for x in X:
        p += (i - x) ** 2

    cnt = min(cnt, p)

print(cnt)


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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
typedef long double ld;
#define int ll
#define maxn 100001

int num[maxn],N,Q;


int32_t main(){
	fast;
	cin>>N;
	int sm = 0;
	FOR(i,1,N){
		int a; cin>>a;
		sm += a;
		num[a]++;
	}
	
	cin>>Q;
	
	FOR(i,1,Q){
		int b,c;
		cin>>b>>c;
		
		sm -= num[b] * b; sm += num[b] * c;
		
		num[c] += num[b];
		num[b] = 0;
		cout<<sm<<'\n';
		
	}
		
}


Measured memory_bytes: 4432
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Mar 28 21:00:07 JST 2020
 **/

signed main() {
    std::string s;
    std::cin >> s;
    std::cout << (s[2] == s[3] && s[4] ==s[5] ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
h_list = list(map(int, input().split()))

# 隣接展望台の高さで最大のものをセット
max_h_map = dict()
for _ in range(M):
    src, dst = map(int, input().split())
    max_h_map[src] = max(max_h_map.get(src, 0), h_list[dst - 1])
    max_h_map[dst] = max(max_h_map.get(dst, 0), h_list[src - 1])

good_cnt = 0
for i in range(N):
    h = h_list[i]
    max_h = max_h_map.get(i + 1, 0)
    if h > max_h:
        good_cnt += 1

print(good_cnt)

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

int main() {
  
  int N;
  cin >> N;
  
  int num=0, sum=0;
  for(int i=0; i<N; i++){
    cin >> num;
    sum+=num;
  }
  cout << sum - N << endl;

  
  

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,x,mx=2,flag,ans=1,MOD=1000000007;
vector< pair< int,int > > v;
int main() {
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&x),
        v.push_back(make_pair(x,0));
    for(int i=1;i<=n;i++)
        scanf("%d",&x),
        v.push_back(make_pair(x,1));
    sort(v.begin(),v.end());
    stack<int> s;
    for(int i=0;i<=2*n;i++) {
        if(s.empty()) {
            flag=v[i].second;
            s.push(flag);
            continue ;
        }
        if(flag!=v[i].second) {
            ans=(1ll*ans*s.size())%MOD;
            s.pop();
        }
        else
            s.push(flag);
    }
    printf("%d",ans);
}


Measured memory_bytes: 2420
X, Y = map(int, input().split())

m, r = divmod(2*Y-X, 3)
if r != 0:
    print(0)
    exit()

n = Y - 2*m

if n < 0 or m < 0:
    print(0)
    exit()

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n-i) * modinv(i+1, mod) % mod
    return res

print(combination(n+m, n))

Measured memory_bytes: 73028
#pragma GCC optimize("unroll-loops")
#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;

typedef  long long int  ll;
typedef long double ld;
/*
cin>>str;
getline(cin,str);
*/
/*
ifstream f("data.in");
ofstream g("data.out");
*/


///*******Define******///
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define mid(s,e)   (s+(e-s)/2)
///******************///

///******Constants****///
const long long mod = 1e9+7;
const long long MODP = 998244353;
const long long mini = INT_MIN;
const long long maxi = 0x3f3f3f3f;
///********************///

///*****Utility*******///
inline ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
inline ll power(ll a, ll n, ll mod){ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
inline ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b);}
inline ll lcm(ll a,ll b) { return ((a*b)/gcd(a,b)); }
inline ll modinverse(ll a,ll m) { ll m0 = m;ll y = 0, x = 1; if (m == 1) return 0; while (a > 1){ ll q = a / m; ll t = m; m = a % m, a = t;t = y; y = x - q * y; x = t; }if (x < 0) x += m0; return x; }
///*******************///

///*******************///
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>PBDS;
#define p(i,n,vect) for(ll i=0;i<(ll)n;++i) {cout<<vect[i]<<" ";} cout<<"\n";
///******************///

///******Variable Declarations***///
ll N,cnt;
///******************************///

void solve()
{
    cin>>N;
    ll r=0,w=0;
    cnt=0;
    vector<char>v(N);
    for(ll i=0;i<N;++i)
    {
         cin>>v[i];
         if(v[i]=='R')
            r++;
        else
            w++;
    }
    //cout<<r<<" "<<w<<"\n";
    for(ll i=0;i<r;i++)
    {
        if(v[i]=='W')
        {
            cnt++;
        }
    }
    cout<<cnt<<"\n";
}

signed main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   
    solve();
}
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*****END*****<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

Measured memory_bytes: 3656
import sys
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


S = LS2()
N = len(S)
S1 = S[::2]
S2 = S[1::2]

r = sum(s in ['R','U','D'] for s in S1) + sum(s in ['L','U','D'] for s in S2)
print('Yes' if r == N else 'No')


Measured memory_bytes: 61852
import numpy as np
w, h, n = map(int, input().split())
xya = [list(map(int, input().split())) for i in range(n)]
x,y,a=[],[],[]
for z in xya:
    x.append(z[0])
    y.append(z[1])
    a.append(z[2])
pp = np.array([[1]*w]*h)
for i in range(n):
    if a[i]==1:
        pp[:, :x[i]]=0
    if a[i]==2:
        pp[:, x[i]:]=0
    if a[i]==3:
        pp[(h-y[i]):, :]=0
    if a[i]==4:
        pp[:(h-y[i]), :]=0
print(sum(sum(pp)))

Measured memory_bytes: 12540
#include<bits/stdc++.h>
using namespace std;
const int maxn=200100;
int p[maxn],a[maxn];
int len[maxn];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		p[a[i]]=i;
	int res=1;
	len[n]=1;
	for(int i=n-1;i>=1;i--){
		if(p[i+1]>p[i]) len[i]=len[i+1]+1;
		else len[i]=1;
		if(len[i]>res) res=len[i];
	}
	printf("%d\n",n-res);
	return 0;
}


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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int x, n;
    cin >> x >> n;
    vector<int> p(n);
    REP(i, n) cin >> p[i];

    P ans(1001, -1);
    for (int i = -1; i < 102; i++) {
        if (find(p.begin(), p.end(), i) == p.end()) {
            int diff = abs(x - i);
            ans = min(ans, P(diff, i));
        }
    }
    cout << ans.second << '\n';
    return 0;
}


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

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

	vector<ll> A, B;
	A.assign(N,0);
	B.assign(N,0);

	for(ll i=0;i<N;i++){
		cin >> A[i];
	}
	for(ll i=0;i<N;i++){
		cin >> B[i];
	}

	ll S = 0;
	ll num1 = 0;
	vector<ll> res;
	for(int i=0;i<N;i++){
		if(A[i]<B[i]){
			S += B[i]-A[i];
			num1 ++;
		}
		else{
			res.push_back(A[i]-B[i]);
		}
	}

	ll sum(0);
	for(ll i=0; i<res.size(); i++){
		sum += res[i];
	}

	if(num1==0) cout << 0 << endl;
	else if(sum < S) cout << -1 << endl;
	else{
		std::sort(res.begin(), res.end(), std::greater<ll>());
		ll sum2(0);
		ll num2(0);
		while(sum2 < S){
			sum2 += res[num2];
			num2 ++;
		}
		cout << num1+num2 << endl;
	}

	return 0;
}



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

void call(int n){
  int i =1;
  do{
    int x = i;
    if(x%3==0){
      cout << " "<< i;continue;
    }
    do{
    if(x%10==3){
      cout<<" "<<i; break;
    }
    x/=10;
  }while(x);
}while(++i <= n);


  cout<<endl;
}

int main(){
  int a;
  cin>>a;
  call(a);
  return 0;

}

Measured memory_bytes: 3072
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n][3];
for(int i=0;i<n;i++)
{
for(int j=0;j<3;j++)
{
cin>>arr[i][j];
}
}
int num;	
int dp[n][3]={0};
for(int i=0;i<3;i++)
dp[0][i]=arr[0][i];
for(int i=1;i<n;i++)
{
for(int j=0;j<3;j++)
{
num=dp[i-1][j];
for(int k=0;k<3;k++)
{
if(j!=k)
dp[i][k]=max(dp[i][k],num+arr[i][k]);
}
}
}
int maxer=0;
for(int i=0;i<3;i++)
{
if(dp[n-1][i]>maxer)
maxer=dp[n-1][i];
}
cout<<maxer<<endl;
return 0;
}

Measured memory_bytes: 2560
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

typedef vector <vector<int>> Graph;

// 強連結成分分解ライブラリ
class StronglyConnectedComponent {
public:
  Graph G;
  Graph rG;
  Graph cG;
  vector<int> vs;
  vector<bool> used;
  vector<int> componentId;
  int componentCount;
  int V;

  StronglyConnectedComponent(int V) {
    this->V = V;
    used = vector<bool>(V);
    componentId = vector<int>(V);
    G = Graph(V);
    rG = Graph(V);
  }

  void add_edge(int from, int to) {
    assert(0 <= from < V);
    assert(0 <= to < V);

    G[from].push_back(to);
    rG[to].push_back(from);
  }

  void run() {
    fill(used.begin(), used.end(), false);
    componentCount = 0;
    vs.clear();

    for (int v = 0; v < V; ++v) {
      if (used[v]) continue;

      dfs(v);
    }

    fill(used.begin(), used.end(), false);

    for (int i = vs.size() - 1; i >= 0; --i) {
      int v = vs[i];
      if (used[v]) continue;

      cG.push_back(vector<int>());
      rdfs(v, componentCount++);
    }
  }

private:
  void dfs(int v) {
    used[v] = true;

    for (int i = 0; i < G[v].size(); ++i) {
      int u = G[v][i];

      if (used[u]) continue;

      dfs(u);
    }

    vs.push_back(v);
  }

  void rdfs(int v, int k) {
    used[v] = true;
    componentId[v] = k;
    cG[k].push_back(v);

    for (int i = 0; i < rG[v].size(); ++i) {
      int u = rG[v][i];

      if (used[u]) continue;

      rdfs(u, k);
    }
  }
};

const int MAX_V = 2010;
int N, D;
bool answer[MAX_V];
StronglyConnectedComponent scc(MAX_V);

void add_clause(int i, bool f, int j, bool g) {
  assert(0 <= i && i < N);
  assert(0 <= j && j < N);
  scc.add_edge(2 * i + (f ? 0 : 1), 2 * j + (g ? 1 : 0));
  scc.add_edge(2 * j + (g ? 0 : 1), 2 * i + (f ? 1 : 0));
}

bool satisfiable() {
  scc.run();
  memset(answer, false, sizeof(answer));

  for (int i = 0; i < N; ++i) {
    if (scc.componentId[2 * i] == scc.componentId[2 * i + 1]) return false;
    answer[i] = scc.componentId[2 * i] < scc.componentId[2 * i + 1];
  }

  return true;
}

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

  int X[N];
  int Y[N];

  int x, y;
  for (int i = 0; i < N; ++i) {
    cin >> x >> y;
    X[i] = x;
    Y[i] = y;
  }

  for (int i = 0; i < N; ++i) {
    int x1 = X[i];
    int y1 = Y[i];

    for (int j = i + 1; j < N; ++j) {
      if (i == j) continue;

      int x2 = X[j];
      int y2 = Y[j];

      if (abs(x1 - x2) < D) {
        add_clause(i, false, j, false);
      }

      if (abs(x1 - y2) < D) {
        add_clause(i, false, j, true);
      }

      if (abs(y1 - x2) < D) {
        add_clause(i, true, j, false);
      }

      if (abs(y1 - y2) < D) {
        add_clause(i, true, j, true);
      }
    }
  }

  if (satisfiable()) {
    cout << "Yes" << endl;

    for (int i = 0; i < N; ++i) {
      if (answer[i]) {
        cout << X[i] << endl;
      } else {
        cout << Y[i] << endl;
      }
    }
  } else {
    cout << "No" << endl;
    return 0;
  }

  return 0;
}


Measured memory_bytes: 3948
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, c,k=0, i, j,l=1e9+7;
  string s, r, y;
  cin>>n;
  if(n>=30) cout<<"Yes";
  else cout<<"No";
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
   //cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <unordered_map>
#include <vector>
#include <queue>
#include <limits>

int main()
{
    std::unordered_map<int, std::vector<int>> graph;
    int N, M;
    std::cin >> N >> M;
    for (int i = 1; i <= N; i++)
    {
        graph.insert(std::make_pair(i, std::vector<int>{}));
    }
    for (int i = 1; i <= M; i++)
    {
        int A, B;
        std::cin >> A >> B;
        graph[A].push_back(B);
        graph[B].push_back(A);
    }
    // 最短距離, 道標
    std::vector<std::pair<int, int>> state;
    state.resize(N + 1);
    for (int i = 1; i <= N; i++)
    {
        state[i].first = std::numeric_limits<int>::max();
        state[i].second = -1;
    }
    std::queue<int> q{{1}};
    while (!q.empty())
    {
        int current_room_id = q.front();
        q.pop();
        int next_step = state[current_room_id].first;
        for (auto const &adj_room_id : graph[current_room_id])
        {
            if (next_step + 1 < state[adj_room_id].first)
            {
                state[adj_room_id].first = next_step + 1;
                state[adj_room_id].second = current_room_id;
                q.emplace(adj_room_id);
            }
        }
    }

    std::cout << "Yes\n";
    for (int i = 2; i <= N; i++)
    {
        std::cout << state[i].second << std::endl;
    }
}

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

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

        int n = sc.nextInt();

        double[] x = new double[n];
        double[] y = new double[n];

        for(int i = 0; i < n; i++)
            x[i] = sc.nextInt();
        for(int i = 0; i < n; i++)
            y[i] = sc.nextInt();

        double[] mink = new double[3];

        for(int p = 0; p < 3; p++){
            mink[p] = 0.0;
            for(int i = 0; i < n; i++)
                mink[p] += Math.abs(Math.pow(x[i] - y[i], (double)(p + 1)));
                mink[p] = Math.pow(mink[p], 1.0/(double)(p + 1));
        }

        double[] dist = new double[n];
        for(int i = 0; i < n; i++)
            dist[i] = Math.abs(x[i] - y[i]);

        Arrays.sort(dist);

        System.out.printf("%f\n%f\n%f\n%f\n", mink[0], mink[1], mink[2], dist[n - 1]);

        sc.close();
    }
}



Measured memory_bytes: 26608
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    ll n, a, b;
    cin >> n >> a >> b;
    if (n % (a + b) < a) {
        cout << n / (a + b) * a + n % (a + b);
    } else {
        cout << n / (a + b) * a + a;
    }
}


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

const int max_size = 200005;
int n;
bitset<max_size> bs;

int popcount(int n) {
    int count = 0;
    int i = 0;
    for (int j = 1; j <= n; j*=2) {
        if (n>>i&1) count++;
        ++i;
    }
    return count;
}

int residue(int mod, vector<int> &res) {
    int ri = 1, r = 0;
    rep(i,n) {
        res.at(i) = ri;
        if (bs.test(i)) {
            r += ri;
            r %= mod;
        }
        ri <<= 1;
        ri %= mod;
    }
    return r;
}

int main() {
    cin >> n;
    string s;
    cin >> s;
    bs = bitset<max_size>(s);
    int mod = bs.count();
    vector<int> ans(n);
    vector<int> resn1(n), resp1(n);
    int rn1 = 0;
    if (0 < mod-1) rn1 = residue(mod-1, resn1);
    int rp1 = residue(mod+1, resp1);

    rep(i,n) {
        int m, r;
        if (bs.test(i)) {
            m = mod-1;
            if (m == 0) {
                ans.at(i) = 0;
                continue;
            }
            r = rn1;
            r -= resn1.at(i);
        }
        else {
            m = mod+1;
            r = rp1;
            r += resp1.at(i);
        }
        r %= m;
        if (r<0) r += m;
        int count = 1;
        while (r != 0) {
            r %= popcount(r);
            count++;
        }
        ans.at(i) = count;
    }

    reverse(ans.begin(), ans.end());
    rep(i,n) cout << ans.at(i) << endl;
    return 0;
}

Measured memory_bytes: 6052
#include<bits/stdc++.h>
using namespace std;
const long long MX=1e18;
const long long MD=1e9+7;
const long long MXX=1e6+6;
long long n,w,dp[105][100005],vl[105],wa[105];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>w;
    for(int i=0;i<105;i++)
    {
        for(int j=1;j<100005;j++)
        {
            dp[i][j]=MX;
        }
        dp[i][0]=0;
    }
    for(int i=1;i<=n;i++)cin>>wa[i]>>vl[i];
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<100005;j++)
        {
            if(j>=vl[i])
            {
                dp[i][j]=min(dp[i-1][j],dp[i-1][j-vl[i]]+wa[i]);
            }
            else dp[i][j]=dp[i-1][j];
        }
    }
    long long ans=0;
    for(int i=100004;i>=0;i--)
    {
        if(w>=dp[n][i])
        {
            cout<<i;
            break;
        }
    }
}


Measured memory_bytes: 82304
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdlib, std.datetime;

immutable int N = 26;
//immutable int D = 365;
int D;
long[] C;
long[][] S;

void main() {
    auto stattime = Clock.currTime();
    D = readln.chomp.to!int;
    C = readln.split.map!(to!long).array;
    S = iota(D).map!(_ => readln.split.map!(to!long).array).array;

    auto ans = gen_initital_ans();
    auto score = calc_score(ans);

    while ((Clock.currTime - stattime).total!"msecs" < dur!"msecs"(1980).total!"msecs") {
        auto idx = uniform(0, D);

        foreach (next; 0..26) {
            auto cur = ans[idx];
            ans[idx] = next;
            auto next_score = calc_score(ans);
            if (next_score >= score) {
                score = next_score;
            } else {
                ans[idx] = cur;
            }
        }
    }

    ans.each!(a => writeln(a+1));
}

int[] gen_initital_ans() {
    auto ans = new int[](D);
    auto prev = new int[](N);
    prev[] = -1;

    foreach (i; 0..D) {
        int best_idx = -1;
        long best_score = -(1L << 59);
        foreach (j; 0..N) {
            long minus = (i - prev[j]) * C[j];
            long plus = S[i][j];
            long score = minus + plus;
            if (score >= best_score) {
                best_score = score;
                best_idx = j;
            }
        }
        ans[i] = best_idx;
        prev[best_idx] = i;
    }
    return ans;
}

long calc_score(const ref int[] ans) {
    auto prev = new int[](N);
    long score = 0;
    foreach (i, a; ans) {
        score += S[i][a];
        score -= decrease(C[a], prev[a], i.to!int);
        prev[a] = i.to!int;
    }
    foreach (a; 0..26) {
        score -= decrease(C[a], prev[a], D);
    }
    return score;
}

long decrease(long c, int prev, int cur) {
    return (cur - prev - 1) * (cur - prev) / 2 * c;
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<pll> vpl;
typedef vector<int> vi;
ll modpow(ll b, ll e ,ll mod) {
	ll ans = 1;
	for (; e; b = b * b % mod, e /= 2)
		if (e & 1) ans = ans * b % mod;
	return ans;
}
const int N = 100005;
bool vis[N];
int pai[N];
vi g[N];

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n , m;
	cin >> n >> m;
	for(int i = 0 ; i <m  ; i++){
		int x, y;
		cin >> x >> y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	queue<int> q;
	q.push(1);
	vis[1] = true;
	while(!q.empty()){
		int u = q.front();
		q.pop();
		for(int w : g[u]){
			if(!vis[w]){
				vis[w] = true;
				pai[w] = u;
				q.push(w);
			}
		}
	}
	bool can = true;
	for(int i = 1; i <= n; i++){
		if(!vis[i]){
			cout <<"No" << endl;
			return 0;
		}
	}
	cout <<"Yes" << endl;
	for(int i = 2 ; i <= n; i ++){
		cout << pai[i] << endl;
	}
}

Measured memory_bytes: 10712
#include"bits/stdc++.h"


#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(int x = (l);x<=(u);x++)
#define RREP(x,l,u) for(int x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;

const int maxn = 200010;
const int mod = 1e9+7;
const int MAX = 1000000010;
const double eps = 1e-6;
const double PI = acos(-1);

template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}

int n,m,ans;

vector<int> has[maxn];

struct Node{
	int l,r,mx,bj;
}T[maxn<<2];

void pushdown(int i){
	if(!T[i].bj)return;
	T[i<<1].mx+=T[i].bj;T[i<<1].bj+=T[i].bj;
	T[i<<1|1].mx+=T[i].bj;T[i<<1|1].bj+=T[i].bj;
	T[i].bj=0;
}

void build(int i,int l,int r){
	T[i].l=l;T[i].r=r;
	if(l==r){
		T[i].mx=l;
		return;
	}
	int M=l+r>>1;
	build(i<<1,l,M);build(i<<1|1,M+1,r);
	T[i].mx=max(T[i<<1].mx,T[i<<1|1].mx);
}

void update(int i,int l,int r){
	if(l<=T[i].l&&T[i].r<=r){
		T[i].mx++;T[i].bj++;
		return;
	}
	pushdown(i);
	int M=T[i].l+T[i].r>>1;
	if(l<=M)update(i<<1,l,r);if(r>M)update(i<<1|1,l,r);
	T[i].mx=max(T[i<<1].mx,T[i<<1|1].mx);
}

void Work(){
	ans=n-m;
	REP(i,0,m+1){
		for(auto x:has[i])update(1,1,x);
		ans=max(ans,T[1].mx-i-m-1);
	}
	iout(ans);
}

void Init(){
	read(n,m);
	REP(i,1,n){
		int x,y;
		read(x,y);
		has[x].PB(y);
	}
	build(1,0,m+1);
}

int main(){
	Init();
	Work();
	return 0;
}


Measured memory_bytes: 18944
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  if (a%x == 0) {
    cout << b/x - a/x + 1 << endl;
  } else {
    cout << b/x - a/x << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
template <class T>
inline void read(T &x)
{
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)){if(c=='-')f=-1; c=getchar();}
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=2e5+10;
int a[N],b[N],n;
bool che(int x)
{
	for(int i=1;i<=n;++i) b[i]=a[i]>=x;
//	for(int i=1;i<=n;++i) cout<<b[i]<<' '; cout<<endl;
	int l=(n+1)/2,r=l;
	while(l>1)
	{
		if(b[l-1]==b[l]) return b[l];
		if(b[r+1]==b[r]) return b[r];
		l--,r++;
	}
	return b[1];
}
int main()
{
	read(n),n=n*2-1;
	for(int i=1;i<=n;++i) read(a[i]);
	int lb=1,rb=n,ans;
	while(lb<=rb)
	{
		int mid=lb+rb>>1;
		if(che(mid)) ans=mid,lb=mid+1;
		else rb=mid-1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1920
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

  public static void main(String[] args) {
    FastScanner sc = new FastScanner();

    int N = sc.nextInt();
    int[] x = new int[N];

    int m = 0;
    for (int i = 0; i < N; i++) {
      x[i] = sc.nextInt();
      m = Math.max(x[i], m);
    }

    int ans = Integer.MAX_VALUE;
    for (int i = 0; i <= m; i++) {
      int t = 0;
      for (int j = 0; j < N; j++) {
        t += (x[j] - i) * (x[j] - i);
      }
      ans = Math.min(t, ans);
    }

    System.out.println(ans);

  }
}

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

  private int readByte() {
    if (hasNextByte()) {
      return buffer[ptr++];
    } else {
      return -1;
    }
  }

  private static boolean isPrintableChar(int c) {
    return 33 <= c && c <= 126;
  }

  private void skipUnprintable() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
      ptr++;
    }
  }

  public boolean hasNext() {
    skipUnprintable();
    return hasNextByte();
  }

  public String next() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    StringBuilder sb = new StringBuilder();
    int b = readByte();
    while (isPrintableChar(b)) {
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  public int nextInt() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    int n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }

  public long nextLong() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    long n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }
}

Measured memory_bytes: 22356
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

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

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int n, m;
    cin >> n >> m;
    VI a(m), b(m);
    REP(i, m) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }

    VVI e(n, VI(n, 0));
    REP(i, m) {
        e[a[i]][b[i]] = 1;
        e[b[i]][a[i]] = 1;
    }

    VI v(n);
    iota(ALL(v), 0);
    int ans = 0;
    do {
        if(v[0]!=0){
            continue;
        }
        bool f = true;
        FOR(i, 1, n) {
            if (e[v[i - 1]][v[i]] == 0) {
                f = false;
                break;
            }
        }
        if (f) {
            ans++;
        }
    } while (next_permutation(v.begin(), v.end()));

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


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

char F(char C){
    if(C!='Z')return (char)C+1;
    else return 'A';
}


int main(){
    ll N;
    cin >> N;
    string S;
    cin >> S;
    for(int i=0;i<S.size();i++){
        for(int j=0;j<N;j++){
            S.at(i)=F(S.at(i))
        ;}
    ;}
    cout<<S<<endl;
}




Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        n: usize,
        k: usize,
        s: Chars,
    };
    let mut c = 0_i64;
    for (i, &s_i) in s.iter().enumerate().skip(1) {
        if s_i != s[i - 1] {
            c += 1;
        }
    }
    for _ in 0..k {
        c -= 2;
    }
    let ans = n as i64 - 1 - std::cmp::max(c, 0);
    println!("{}", ans);
}


Measured memory_bytes: 2576
#include<iostream>

using namespace std;

int main(){
int x=0,flag=0;
string a,b;
cin>>a>>b;
string g=a+b;
for(int i=0;i<g.length();++i){
	x+=g[i]-'0';
	x*=10;
}
x/=10;
for(int i=0;i<x;++i){
	if(i*i==x){
		flag=1;
		break;
	}
}
if(flag==1){
	cout<<"Yes\n";

}else{
	cout<<"No\n";
}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vi a(n);
    for(int & i : a)
        cin >> i;
    sort(a.begin() , a.end());
    int m = (n - 1) /2;
    if(a[m] == a[m + 1]) return cout << 0 << '\n' , 0;
    cout <<a[m + 1] - a[m] << '\n';



    return 0;
}












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

typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a,b;
	cin >> a >> b;
	int cur = 1;
	int ans = 0;
	while (cur < b)
	{
		++ans;
		cur += (a - 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int n,a;
  int min=1000000;
  int max=-1000000;
  long long int sum=0;

  scanf("%i", &n);
  for(int i=0;i<n;i++)
  {
    scanf("%i",&a);
    if(min>a) 
    {
        min=a;
        
    }
    if(max<a)
    {
        max=a;
    }
    
    sum=sum+a;
  }

  printf("%i %i %lld\n", min, max, sum);
  
  return 0;
}



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

int ans(int first,vector<int> sum){
  int ans =0;
  for(int i=first;i<sum.size();i+=2){
    ans += sum.at(i);
  }
  return ans;
} 

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
  	cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  cout << abs(ans(1,vec)-ans(0,vec))<< endl;
}

Measured memory_bytes: 256
N=int(input())
XY=[]
for i in range(N):
  XY.append(list(map(int,input().split())))
mr=abs(XY[0][0])+abs(XY[0][1])  
for i in range(1,N):
  if abs(XY[i][0])+abs(XY[i][1])>mr:
    mr=abs(XY[i][0])+abs(XY[i][1])
import math
m=int(math.log(mr,2)//1+1)
g=(XY[0][0]+XY[0][1])%2
cnt=0
for i in range(N):
  if (XY[i][0]+XY[i][1])%2==g:
    cnt+=1
if cnt!=N:
  print(-1)
else:
  if g==1:
    W=['']*N
    for i in range(N):
      for j in range(m):
        if abs(XY[i][0])>=abs(XY[i][1]) and XY[i][0]>=0:
          W[i]+='R'
          XY[i][0]-=2**(m-j-1)
        elif abs(XY[i][0])>=abs(XY[i][1]) and XY[i][0]<0:
          W[i]+='L'
          XY[i][0]+=2**(m-j-1)
        elif abs(XY[i][0])<abs(XY[i][1]) and XY[i][1]>=0:
          W[i]+='U'
          XY[i][1]-=2**(m-j-1)
        elif abs(XY[i][0])<abs(XY[i][1]) and XY[i][1]<0:
          W[i]+='D'
          XY[i][1]+=2**(m-j-1)
    print(m)
    for i in range(m):
       print(2**i,end=' ')
    print()
    for j in range(N):
      print(W[j][::-1])
  else:
    for i in range(N):
      XY[i][0]+=1
    W=['']*N
    for i in range(N):
      for j in range(m):
        if abs(XY[i][0])>=abs(XY[i][1]) and XY[i][0]>=0:
          W[i]+='R'
          XY[i][0]-=2**(m-j-1)
        elif abs(XY[i][0])>=abs(XY[i][1]) and XY[i][0]<0:
          W[i]+='L'
          XY[i][0]+=2**(m-j-1)
        elif abs(XY[i][0])<abs(XY[i][1]) and XY[i][1]>=0:
          W[i]+='U'
          XY[i][1]-=2**(m-j-1)
        elif abs(XY[i][0])<abs(XY[i][1]) and XY[i][1]<0:
          W[i]+='D'
          XY[i][1]+=2**(m-j-1)
    print(m+1)
    print(1,end=' ')
    for i in range(m):
      print(2**i,end=' ')
    print()
    for j in range(N):
      W[j]+='L'
      print(W[j][::-1])

Measured memory_bytes: 3508
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		int[] t = new int[n];
		int ans = 0;
		for (int i = 0; i < n; i++) {
			t[i] = Integer.parseInt(sc.next());
			ans += t[i];
		}
		int m = Integer.parseInt(sc.next());
		for (int i = 0; i < m; i++)
			out.println(ans - t[Integer.parseInt(sc.next()) - 1] + Integer.parseInt(sc.next()));
		out.flush();
	}
}

Measured memory_bytes: 21844
N = int(input())
t = []
i=0
s=2
ans1 =0
ans2 =0
while (i**5<10**11):
    t.append(i**5)
    i+=1
for j in t:
    if(N + j) in t:
        ans1 = j
        ans2 = N + j
        s = 0
        break
    elif(N-j) in t:
        ans1 = -j
        if(N-j >0):
            ans2 = N - j
            s = 1
            break
        else:
            ans2 = j - N
            s=1
            break
if(s==0):
    ans3 = t.index(j) 
    ans4 = t.index(ans2)
else:
    ans3 = (t.index(j))*(-1)
    ans4 = t.index(ans2)
print(ans4,ans3)

Measured memory_bytes: 62140
#include<cmath>
#include<cstdio>
inline int in();
inline void wr(int);
int main(int argc,char**argv){
	register double x;
	scanf("%lf",&x);
	printf("%.8lf\n",pow(x/3,3));
}
inline int in(){
	register char c=getchar();
	register int x=0,f=1;
	for(;c<'0'||c>'9';c=getchar())
		if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())
		x=(x<<1)+(x<<3)+(c&15);
	return x*f;
}
inline void wr(int x){
	if(x<0)putchar('-'),x=-x;
	if(x/10)wr(x/10);
	putchar(x%10+'0');
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define debug(var) std::cout << #var << " : " << var;
using ll = long long;
using ull = unsigned long long;
ll mod = 1e9 + 7;


int main(){


	std::string S; std::cin >> S;
	std::set<char> set;
	set.insert(S[0]);
	set.insert(S[1]);
	set.insert(S[2]);

	if(set.size() == 3){
		std::cout << "Yes";
	}else{
		std::cout << "No";
	}


	return 0;
}


Measured memory_bytes: 256
import sys
import itertools

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]


def main():

    N = in_n()
    p_list = primes(55555)
    M = len(p_list)

    ans = []
    for i in range(M):
        if p_list[i] % 5 == 1:
            ans.append(p_list[i])

    print(' '.join(map(str, (ans[:N]))))


if __name__ == '__main__':
    main()


Measured memory_bytes: 67028
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// 無限大の値
const ll  LINF = 1LL << 60;
const int iINF = 1 << 29;

int main(void){
  string  a,b,c;
  cin >> a >> b >> c;
  string ans = "";
  ans += toupper(a[0]);
  ans += toupper(b[0]);
  ans += toupper(c[0]);
  
  cout << ans << endl;  
  return 0;
} 

Measured memory_bytes: 3612