akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main()
{
    int k;
    string s;
    cin >> k >> s;
    if(s.size() <= k)
    {
        cout << s << "\n";
    }
    else
    {
        for(int i = 0;i < k;i++)
        {
            cout << s[i];
        }
        cout << "...\n";
    }
    
    return 0;
}

Measured memory_bytes: 3568
#include<stdio.h>
int i=0,j=0;
int cars[19];

int main(){
    while(1)
    {

        if(scanf("%d",&cars[i])==-1)
        {
            break;
        }
        if(cars[i]==0){
            printf("%d\n",cars[i-1]);
            i--;
        }
        else
        {
            i++;
        }
    }
    return 0;
}

Measured memory_bytes: 1028
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int X,A,B;
  cin >> X >> A >> B;
  cout << (X-A)%B << endl;
  return 0;
}


Measured memory_bytes: 256
program main
  implicit none
  integer N, H(20), Hmin, i, highn
  read(*, *) n
  read(*, *) (H(i), i = 1,N)
  Hmin = 0
  highn = 0
  do i = 1,N
    if (Hmin <= H(i)) then
      Hmin = H(i)
      highn = highn + 1
    end if
  end do
  write(*, '(i0)') highn
end program main

Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

#define rep(i,n) for ( int i = 0; i < (n); ++i )

using namespace std;
using ll = long long int;
const long long int INF = 1001001001001001LL;
const int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;


int main() {
    int h, n;
    cin >> h >> n;
    vector<int> dp(h+1, inf);
    dp[0] = 0;
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        rep(j, h) {
            int nj = min(j+a, h);
            dp[nj] = min(dp[nj], dp[j]+b);
        }
    }
    cout << dp[h] << endl;
    return 0;
}

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


int main(void){
	ll x, rad = 0;
	int k = 1;
	cin >> x;
	rad = x;
	while(rad % 360 != 0){
		rad += x;
		k++;
	}

	cout << k << endl;
	return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M;
ll mo=1000000007;
ll combi(ll N_, ll C_) {
	const int NUM_=400001;
	static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}

ll fact[202020];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	fact[0]=1;
	for(i=1;i<=200000;i++) fact[i]=fact[i-1]*i%mo;
	
	cin>>N>>M;
	if(N==M) {
		cout<<2*fact[N]*fact[M]%mo<<endl;
	}
	else if(abs(N-M)==1) {
		cout<<fact[N]*fact[M]%mo<<endl;
	}
	else {
		cout<<0<<endl;
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 2428
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<cstdlib>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#include<bitset>
#define lmid l,mid,rt<<1
#define rmid mid+1,r,rt<<1|1
#define ll long long
using namespace std;
char s[20];
int main()
{
     scanf("%s",s);
     int n=strlen(s);
     for(int i=0;i<n;i++)
     {
          if(i!=3)
          printf("%c",s[i]);
          else printf("%d",8);
     }
     printf("\n");
}


Measured memory_bytes: 256
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())


s = read()
if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
else:
    print("Sunny")


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

int main() {
  int n;
  cin >> n;
  vector<int>data(1e6+1);
  ll ans = 1,mod = 1e9+7;
  rep(i,0,n){
    int a;
    cin >> a;
    if(a == 0) ans *= 3-data[a];
    else ans *= data[a-1]-data[a];
    data[a]++;
    ans %= mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 7224
#include<stdio.h>
int main(){
  long long int a,b,c;
  scanf("%lld %lld %lld",&a,&b,&c);
  long long int ans = a * b * c;
  if(a % 2 < 1){
    a /= 2;
  }else if(b % 2 < 1){
    b /= 2;
  }else if(c % 2 < 1){
    c /= 2;
  }else{
    if(a > b && a > c){
      a /= 2;
    }else if(b > a && b > c){
      b /= 2;
    }else{
      c /= 2;
    }
  }
  printf("%lld\n",ans -= a * b * c * 2);
  return 0;
}

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

int veloc(int l, int r, int v, int x)
{
    if (x <= l) return v + (l - x);
    else if (x >= r) return v + (x - r);
    return v;
}

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

    int l[n + 2], r[n + 2], v[n + 2];

    l[0] = r[0] = l[1] = 0;
    for (int i = 1; i <= n; i++) {
        cin >> t;
        l[i] = r[i - 1];
        r[i] = l[i] + t * 2;
    }
    l[n + 1] = r[n + 1] = r[n];

    v[0] = 0;
    for (int i = 1; i <= n; i++) { cin >> v[i]; v[i] *= 2; }
    v[n + 1] = 0;

    int pr = 0;
    int ans = 0;
    for (int x = 1; x <= r[n]; x++) {
        int mn = 1e9;
        for (int i = 0; i <= n + 1; i++) {
            mn = min(mn, veloc(l[i], r[i], v[i], x));
        }
        ans += pr + mn;
        pr = mn;
    }
    printf("%lf\n", double(ans) / 8);
}


Measured memory_bytes: 256
call :: Int -> [Int]
call n = f 1
    where
        f x
            | x > n = []
            | x `mod` 3 == 0 = x: f (x+1)
            | any ((== 3) . (`mod` 10)) . takeWhile (/= 0 ) . iterate (`div` 10) $ x
                = x: f(x+1)
            | otherwise = f (x+1)

main = readLn >>= putStrLn . concatMap ((' ':) . show) . call

Measured memory_bytes: 4128
A,B,K = map(int,input().split())

if A <= B:
    A=A
    B=B

else :
    C=A
    A=B
    B=C

#A<B

li=[]

for i in range(1,B+1):
    #print(i)
    if A%i==0 and B%i==0:
        li.append(i)

A%1
#print(li)        
        
if len(li)==1: 
    print(li[0])
else:
    print(li[-K])


Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;typedef vector<ll> vll;
#define fill(a) memset(a, 0, sizeof (a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define unq(v) sort(all(v)),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define getpos(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define pb push_back
#define sz(x) (int)x.size()

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int maxn = 2000100;

int main(){
        _ios;
        int n;
        cin>>n;
        vi v(n);
        vi ev;
        rep(i,n){
            cin>>v[i];
            if(v[i]%2==0){
                ev.pb(v[i]);
            }
        }
        int cnt = ev.size();
        int chk = 0;
        for(auto x: ev){
            if(x%3==0 or x%5==0){
                chk++;
            }
        }
        if(chk==cnt){
            puts("APPROVED");
            return 0;
        }
        else puts("DENIED");




return 0;
}







Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <cmath>
#include <iomanip>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

ll f(int n){
  if(n == 1){
    return 1;
  }
  return n * f(n-1);
}

int main(){
  int N,K;
  string s;
  cin >> N;
  vector<int> x(N);
  vector<int> y(N);
  rep(i,N) {
    cin >> x[i];
    cin >> y[i];
  }
  
  ll factorial = f(N);
  long double sum = 0;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(i == j){
        continue;
      }
      sum += sqrt(pow((x[i] - x[j]), 2) + pow((y[i] - y[j]), 2));
    }
  }
  ll freq = f(N-1);    
  std::cout<<std::fixed<<std::setprecision(10);
  cout << double(sum) / (factorial / freq) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

int N;
std::vector<int> A;
std::vector<long long> portfolio;
long long standard_sum;
long long out;

int main() {
  std::cin >> N;
  A.assign(N, 0);
  portfolio.assign(N, 0);
  for (int i = 0; i < N; ++i) {
    std::cin >> A[i];
    ++portfolio[A[i]-1];
  }

  for (int i = 0; i < N; ++i) {
    if (portfolio[i] != 0) {
      standard_sum += portfolio[i]*(portfolio[i]-1)/2;
    }
  }
  for (int k = 0; k < N; ++k) {
    out = 0;
    if (portfolio[A[k]-1] == 1) {
      out = standard_sum;
    } else {
      out = standard_sum - portfolio[A[k]-1] + 1;
    }
    std::cout << out << std::endl;
  }
}

Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = Integer.parseInt(scan.next());
		int b = Integer.parseInt(scan.next());
		int c = Integer.parseInt(scan.next());
		System.out.println(((a < b && b < c) ? "Yes" : "No"));
		scan.close();
	}
}


Measured memory_bytes: 26052
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<cmath>
#include<typeinfo>

using namespace std;
#define rep(i,m,n) for(int i=m;i<n;++i)
#define repll(i,m,n) for(ll i=m;i<n;++i)
#define llinf 10000000000000000
#define inf 1000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()


int main() {
	int hoge = 10;
	int ans = 0;
	rep(i, 0, 5) {
		int tmp;
		cin >> tmp;
		hoge = min(hoge, (tmp - 1) % 10 + 1);
		tmp = ((tmp + 9) / 10) * 10;
		ans += tmp;
	}
	ans += hoge;
	ans -= 10;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main() {
    static const int MAX = 200000;
    int n, R[MAX];
    
    // 要素数
    std::cin >> n;
    for (int i=0; i<n; i++) {
        std::cin >> R[i];
    }
    // 最も利益が大きいのは
    // 10^9 - 1
    int minVal = R[0];
    int maxVal = -2000000000;
    
    for (int j=1; j<n; j++) {
        if (maxVal < R[j] - minVal) maxVal = R[j] - minVal;
        if (R[j] < minVal) minVal = R[j];
    }
    std::cout<< maxVal << std::endl;
    return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define ll long long
int main(){
 	int a,b,c;
	cin >> a >> b >> c;
	int t;
	t=a;a=b;b=t;
	t=a;a=c;c=t;
	cout << a << " "<<b <<" "<< c <<endl; 
	return 0;
}



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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────────────────

int main() {
	int n;
	cin >> n;
	vl l(n);
	rep(i, n) cin >> l[i];

	sort(ASC(l));

	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			auto dis = lower_bound(ASC(l), l[i] + l[j]) - l.begin();
			ans += dis - (j + 1);
		}
	}
	cout << ans << endl;
}

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

int main ( void ){
    int N = 0;
    int X = 0;
    int T = 0;
    int n = 0;
    int x = 0;
    int t = 0;
    scanf ( "%d %d %d" ,&N ,&X ,&T );

    n = N;

    do{
        n = n - X;
        t = t + T;
    }while ( n > 0 );

    printf ( "%d" ,t );

    return 0;
}

Measured memory_bytes: 1720
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n+1;i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> vv;


int main(){
  int n;
  cin >> n;
  vec a(n);
  rep(i,n) cin >> a[i];
  vec b(n);
  rep(i,n) b[i] = a[i] - i - 1;
  sort(b);
  int med;
  if(n%2 == 0) med = (b[n/2]+b[(n-1)/2])/2;
  else med = b[n/2];
  ll ans = 0;
  rep(i,n){
    ans += abs(a[i] - i - 1 -  med);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1920
import math
import sys
s=int(input())
if s==10**18:
  print('0 0 0 1000000000 1000000000 1000000000')
  sys.exit()
x=math.floor(math.sqrt(s))+1
y=x*(x-1)-s
y2=x*x-s
if y>0:
  l=['0','0','1',str(x-1),str(x),str(y)]
else:
  l=['0','0','1',str(x),str(x),str(y2)]
print(' '.join(l))

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
   long long power=1;
   int tnum;
   cin>>tnum;
   for (int i = 1; i <tnum+1 ; i++)
   {
      power=(power*i)%(1000000007);
   }
   cout<<power;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;


int main() {
    int64_t a, b;
    cin >> a >> b;
    if (a * b <= 0){
        cout << "Zero" << endl;
    }
    else {
        if (a > 0){
            cout << "Positive" << endl;
        }
        else if ((b - a) % 2 == 1){
            cout << "Positive" << endl;
        }
        else {
            cout << "Negative" << endl;
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <map>

using namespace std;

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

    map<int, int> m;
    for (int i = 0; i < n; i++) {
        int l;
        cin >> l;
        m[l]++;
    }

    int res = 0;
    for (map<int, int>::iterator i = m.begin(); i != m.end(); i++) {
        for (map<int, int>::iterator j = next(i); j != m.end(); j++) {
            for (map<int, int>::iterator k = next(j); k != m.end(); k++) {
                if (i->first != j->first && j->first != k->first && i->first + j->first > k->first) {
                    res += i->second * j->second * k->second;
                }
            }
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main(){
	string a,b,c,s1,s2,s3;
	cin>>s1>>s2>>s3;
	a=s1[0];
	b=s2[0];
	c=s3[0];
	cout<<a<<b<<c;
	return 0;
}




Measured memory_bytes: 256
#include <iostream>

using namespace std;

using ll = long long;

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

    int n;
    cin >> n;

    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = i; j <= n; j += i) {
            ans += j;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3608
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { reader: s.lock() };
    let n = sc.read();
    let ab = (0..n)
        .map(|_| (sc.read(), sc.read()))
        .collect::<Vec<(i64, i64)>>();

    let a_sum = ab.iter().map(|&(a, _)| a).sum::<i64>();
    let b_sum = ab.iter().map(|&(_, b)| b).sum::<i64>();

    let mut v = vec![];
    for (i, &(a, b)) in ab.iter().enumerate() {
        v.push((a, i));
        v.push((b, i));
    }
    v.sort();

    let mut used_count = vec![0; n];
    let mut ans = 0;
    for i in 0..n {
        let (t, i) = v[i];
        used_count[i] += 1;
        ans += t;
    }

    if used_count.iter().any(|&c| c == 2) {
        println!("{}", cmp::min(cmp::min(a_sum, b_sum), ans));
    } else {
        let mut min = 1e15 as i64;
        for i in 0..n {
            let (t, i) = v[i];
            let ans = ans - t;
            if i == v[n].1 {
                min = cmp::min(min, ans + v[n + 1].0);
            } else {
                min = cmp::min(min, ans + v[n].0);
            }
        }
        println!("{}", cmp::min(cmp::min(a_sum, b_sum), min));
    }
}

pub struct Scanner<R> {
    reader: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 12272
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> String {
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (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")
    };
}
 
fn main() {
    input! { t: f32, x: f32 }
    println!("{}", t/x);
}

Measured memory_bytes: 4352
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        HashMap<Integer, ArrayList<Integer>> adj = new HashMap<>();
        StringTokenizer st = new StringTokenizer(in.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        for (int i = 0; i < m; i++) {
            st = new StringTokenizer(in.readLine());
            int u = Integer.parseInt(st.nextToken());
            int v = Integer.parseInt(st.nextToken());
            if (adj.containsKey(u)) {
                ArrayList<Integer> list = adj.get(u);
                list.add(v);
                adj.put(u, list);
            } else {
                ArrayList<Integer> list = new ArrayList<>();
                list.add(v);
                adj.put(u, list);
            }
        }
        st = new StringTokenizer(in.readLine());
        int start = Integer.parseInt(st.nextToken());
        int end = Integer.parseInt(st.nextToken());

        Queue<Node> queue = new LinkedList<>();
        boolean[][] vis = new boolean[n + 1][3];
        queue.offer(new Node(start, 0, 0));
        int min = Integer.MAX_VALUE;
        while (!queue.isEmpty()) {
            Node x = queue.poll();
            if (x.id == end) {
                if (x.hops == 0) {
                    min = Math.min(x.dist, min);
                }
            }
            if (adj.containsKey(x.id)) {
                for (int y : adj.get(x.id)) {
                    if (!vis[y][(x.hops + 1) % 3]) {
                        queue.offer(new Node(y, (x.hops + 1) % 3, x.dist + 1));
                        vis[y][(x.hops+1)%3] = true;
                    }
                }
            }
            vis[x.id][x.hops] = true;
        }
        if (min == Integer.MAX_VALUE) {
            System.out.println("-1");
        } else {
            System.out.println(min / 3);
        }
    }

    static class Node {
        int id, hops, dist;

        public Node(int id, int hops, int dist) {
            this.id = id;
            this.hops = hops;
            this.dist = dist;
        }
    }
}
/*


 */

Measured memory_bytes: 76860
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE BangPatterns #-}
import Data.Char (isSpace)
import Data.List (unfoldr)
import Data.Maybe (fromMaybe)
import Control.Monad
import Control.Monad.ST
import Control.Monad.Trans.Maybe
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS

-- 有向グラフに閉路があるか判定し、閉路があれば Nothing を返す。
-- 閉路がなければ最長路の長さを返す。
solve :: V.Vector [Int] -> Maybe Int
solve edges = fmap U.maximum $ runST $ runMaybeT $ do
  let !n = V.length edges  -- 頂点の個数
  vec <- UM.replicate n (-2 :: Int) -- -2: new, -1: DFSの最中, 正: チェック済み
  let dfs !x = do
        s <- UM.read vec x
        case s of
          -2 -> do
            -- x を通る閉路があるかチェックする
            UM.write vec x (-1)
            v <- (+ 1) <$> foldM (\a y -> max a <$> dfs y) 0 (edges V.! x)
            UM.write vec x v
            return v
          -1 -> mzero  -- コールスタックのどこかで dfs x が呼ばれている。閉路
          v -> return v
  mapM_ dfs [0..n-1]
  U.unsafeFreeze vec

main = do
  n <- readLn
  xs <- V.replicateM n $ do
    U.map (subtract 1) . U.unfoldrN (n-1) (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let m = n * (n - 1) `quot` 2  -- グラフの頂点数
  let -- (i,j) (0 <= i < j < n) を 0 以上 m 未満の整数値にコードする
      makePair :: Int -> Int -> Int
      makePair i j | i' < j' = n * i' - (i' + 1) * i' `quot` 2 + j' - i' - 1
                   | otherwise = undefined
        where i' = min i j; j' = max i j
  -- 「試合 (i,j) よりも試合 (i',j') の方を後に行う場合に辺 makePair i j → makePair i' j' が存在する」ようなグラフを作る
  let edges :: V.Vector [Int]
      edges = V.create $ do
        e <- VM.replicate m []
        V.forM_ (V.indexed xs) $ \(i,ys) -> do
          U.forM_ (U.zip ys (U.tail ys)) $ \(a,b) -> do
            -- (i,a) -> (i,b)
            let !b' = makePair i b
            VM.modify e (b' :) (makePair i a)
        return e
  print $ fromMaybe (-1) $ solve edges


Measured memory_bytes: 103036
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(10**9):
    x=0
    for j in range(N):
        tmp = 0
        if A[j] % 2 == 0:
            A[j] /= 2
            x = j
        else:
            x = j
            break
    if A[x] % 2 == 0:
        ans += 1
    else:
        if x == (N-1):
            ans += 1
            print(ans)
            exit()
        print(ans)
        exit()

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int main() {
	int n;
	int a[100];
	
	cin >> n;
	REP(i, n) scanf("%d", a + i);
	
	int all = 0;
	set<int> ss;
	REP(i, n) {
		if (a[i] >= 3200) all++;
		else {
			ss.insert(a[i] / 400);
		}
	}
	
	int mi = ss.size();
	if (mi == 0 && all) mi = 1;
	
	int ma = ss.size() + all;
	
	printf("%d %d\n", mi, ma);
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

#define TRACE(x) cerr << #x << " = " << x << endl
#define REP(i, n) for (int i=0; i<n; i++)
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define _ << " " <<

typedef long long ll;
typedef pair<int, int> P;
#define X first
#define Y second

const int MAX = 1<<17;

int n;
int p[MAX];

int f()
{
  int sum = n % 2, br_nep = 0, ima1 = 0;

  REP(i, n) {
    sum = (sum + p[i]) % 2;
    br_nep += p[i] % 2;
    ima1 += p[i] == 1;
  }

  if (ima1 || br_nep > 1) return sum;
  
  int gc = 0;
  REP(i, n) {
    if (p[i] % 2)
      p[i]--;
    gc = __gcd(gc, p[i]);
  }

  REP(i, n) p[i] /= gc;
  
  return !f();
}

int main()
{

  scanf("%d", &n);
  REP(i, n) scanf("%d", &p[i]);
  
  printf("%s\n", f() ? "First" : "Second");

  return 0;
}


Measured memory_bytes: 640
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	int N;
	List<Integer>[][] array;
	long result = 0;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		N = Integer.parseInt(in.readLine());
		this.array = new List[10][10];
		for (int i = 0; i < 10; ++i) {
			for (int j = 0; j < 10; ++j) {
				this.array[i][j] = new ArrayList<Integer>();
			}
		}

		// arrayの生成
		for (int i = 1; i <= N; ++i) {
			int[] indexes = sub(i);
			if (indexes != null) {
				this.array[indexes[0]][indexes[1]].add(i);
			}
		}

	}

	int[] sub(int val) {
		String str = Integer.toString(val);
		if (str.charAt(str.length() - 1) == '0') {
			return null;
		}
		int[] result = new int[2];

		result[0] = Integer.parseInt(str.substring(0, 1));
		result[1] = Integer.parseInt(str.substring(str.length() - 1, str.length()));
		return result;
	}

	void calc() {
		// カウントする
		for (int i = 1; i < 10; ++i) {
			for (int j = 1; j < 10; ++j) {
				result += this.array[i][j].size() * this.array[j][i].size();
			}
		}
	}

	void showResult() {
		System.out.println(result);
	}
}


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

using namespace std;

int main() {
	char ch;
	string boin = "aiueo";
	cin >> ch;

	if (boin.find(ch) != string::npos) {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}

	return 0;
}

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

using ll = long long;
static const ll MOD = 1e9 + 7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  int D;
  cin >> s >> D;
  
  ll dp[s.size() + 1][2][D + 2];
  for(int i = 0; i < s.size() + 1; i++){
    for(int j = 0; j < 2; j++){
      for(int ii = 0; ii < D + 2; ii++){
        dp[i][j][ii] = 0;
      }
    }
  }
  dp[0][0][0] = 1;
  
  for(int i = 0; i < s.size(); i++){
    for(int j = 0; j < 2; j++){
      for(int ii = 0; ii < D; ii++){
        for(int d = 0; d <= (j ? 9 : (int) s[i] - '0'); d++){
          dp[i + 1][j || (d < (int) s[i] - '0')][(ii + d) % D] += dp[i][j][ii];
          dp[i + 1][j || (d < (int) s[i] - '0')][(ii + d) % D] %= MOD;
        }
      }
    }
  }
  
  cout << (dp[s.size()][0][0] + dp[s.size()][1][0] - 1 + MOD) % MOD << '\n';
}

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

#define ll long long
#define ull unsigned long long 
#define endl '\n'
#define pii pair<int, int>
#define all(a) a.begin(),a.end()
template <typename T>
inline T gcd(T a, T b) { while (b != 0) swap(b, a %= b); return a; }

int main(){
    int n;
    cin >> n;
    map<int, int> m, t;
    for(int i=0; i<n; ++i){
        int x;
        cin >> x;
        ++m[x];
    }
    int p;
    cin >> p;
    for(int i=0; i<p; ++i){
        int x;
        cin >> x;
        ++t[x];
    }

    for(auto x:t){
        if(x.second > m[x.first]){
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
}


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

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(q);
    rep(i, q) {
        cin >> a.at(i);
        a.at(i)--;
    } 
    vector<int> point(n, k - q);
    rep(i, q) {
        point.at(a.at(i))++;
    }
    rep(i, n) {
        if(point.at(i) > 0) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1408
N=int(input())
abc = [list(map(int, input().split())) for _ in range(N)]

a=abc[0][0]
b=abc[0][1]
c=abc[0][2]
#print(abc)
for i in range(1,N):
    a,b,c = abc[i][0]+max(b,c),abc[i][1]+max(c,a),abc[i][2]+max(a,b)

print(max(a,b,c))

Measured memory_bytes: 30580
#pragma GCC optimize("Ofast", "unroll-loops")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

// -----!!!!-----

using namespace std;

#define ll long long
#define ld long double

int main() {
	ld a, b, h, m;
	cin >> a >> b >> h >> m;
	ld theta = M_PI * abs((60.0L * h + m) / 360.0L - m / 30.0L);
	// cout << theta << endl;
	ld res = a * a + b * b - 2 * a * b * cosl(theta);
	// cout << res << endl;
	cout << setprecision(15) << sqrtl(res) << endl;
	return 0;
}

Measured memory_bytes: 3844
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
const double pi=acos(-1.0);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int main(void){
    string s,t;
    cin>>s>>t;
    //cin>>t;
    int y,j;
    int ans=t.size();
    int cnt;
    //cout<<s.at(2)<<endl;
    //int a=s.size()-t.size();
    //cout<<a<<endl;
    rep(i,s.size()-t.size()+1){
        cnt=0;
        
        //cout<<1<<endl;
        for(j=0;j<t.size();++j){
            //cout<<1<<endl;
            y=i+j;
            if(t.at(j)!=s.at(y)){cnt++;}
            
            
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3628
{-# LANGUAGE BangPatterns #-}
import           Control.Monad
import           Control.Monad.State
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.List
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

main :: IO ()
main = do
  [n,k] <- readLnAsListWith unconsInt
  hvec <- readLnAsUVecWith unconsInt n

  print $ VU.last $ solve2 n k hvec

  return ()


-- mutable vector を使うバージョン
solve1 :: Int -> Int -> VU.Vector Int -> VU.Vector Int
solve1 n k hvec = VU.create $ do
  dp <- VUM.replicate n 0
  forM_ [0..n-1] $ \i -> case i of
    0 -> VUM.write dp 0 0
    _ -> forM [(max (i-k) 0)..(i-1)] (\j -> liftM2 (+) (VUM.read dp j) (return . abs $ hvec VU.! i - hvec VU.! j)) >>=  VUM.write dp i . minimum
  return dp


-- https://atcoder.jp/contests/dp/submissions/5209611 を元に、微修正
solve2 :: Int -> Int -> VU.Vector Int -> VU.Vector Int
solve2 n k hvec = VU.constructN n $ \dp ->
  if VU.null dp
  then 0
  else let !i = VU.length dp
           !h_i = hvec VU.! i
       in VU.minimum $ VU.map (\(dp_j, h_j) -> dp_j + abs (h_i - h_j)) $ VU.drop (i-k) $ VU.zip dp hvec


unconsInt :: StateT BS.ByteString Maybe Int
unconsInt = StateT $ BS.readInt . BS.dropWhile isSpace

readLnAsListWith :: StateT BS.ByteString Maybe a -> IO [a]
readLnAsListWith !st = unfoldr (runStateT st) <$> BS.getLine

readLnAsUVecWith :: VU.Unbox a => StateT BS.ByteString Maybe a -> Int -> IO (VU.Vector a)
readLnAsUVecWith !st !n = VU.unfoldrN n (runStateT st) <$> BS.getLine

Measured memory_bytes: 8176
function Main(input){
	var sum = '';
 	for(i = 0; i < input.length; i++){
    	if(input[i] == '1'){
        	sum = sum+'9';
        }else if(input[i] == '9'){
            sum = sum+'1';
        }
    }
  　parseInt(sum,10);
	console.log(sum);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 21064
#include <iostream>

using namespace std;

int main()
{
  int n, k, x, y;

  cin >> n >> k >> x >> y;

  long long cost = 0;
  for (int i = 0; i < n; ++i) {
    if (i < k) {
      cost += x;
    } else {
      cost += y;
    }
  }

  cout << cost << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define loop(i,a,b) for(i=a;i<b;i++)
#define rloop(i,a,b) for(i=a;i>=b;i--)
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
const int inf=1000000001;
const ll INF=1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846

class Heap{
public:
	Heap(){}
	int node;
	int key;
	int parent;
	int left;
	int right;
};

int main(){
	int n,i;
	cin>>n;
	vector<Heap> tree(n+1);
	loop(i,1,n+1){
		Heap a;
		int k;
		cin>>k;
		a.key=k;
		a.node=i;
		a.parent=a.left=a.right=2*inf;
		tree[i]=a;
	}
	loop(i,1,n+1){
		if(i!=1){
			tree[i].parent=tree[i/2].key;
		}
		if(2*i<=n){
			tree[i].left=tree[2*i].key;
		}
		if(2*i+1<=n){
			tree[i].right=tree[2*i+1].key;
		}
	}
	loop(i,1,n+1){
		cout<<"node "<<i<<": key = "<<tree[i].key<<", ";
		if(tree[i].parent!=2*inf){
			cout<<"parent key = "<<tree[i].parent<<", ";
		}
		if(tree[i].left!=2*inf){
			cout<<"left key = "<<tree[i].left<<", ";
		}
		if(tree[i].right!=2*inf){
			cout<<"right key = "<<tree[i].right<<", ";
		}
		cout<<endl;
	}
}

Measured memory_bytes: 3016
/*author : Yashvardhan
Sunday, May 05, 2019
5:19 PM
*/

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

typedef long long ll;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define endl '\n'

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int pow(int a, int b, int m)
{
	int ans = 1;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	string s;
	cin>>s;

	int mini = inf;

	char prev = s[0];
	int cost = 0;
	for(int i = 1; i < s.size() ; i++){
		if(s[i] == prev){
			cost++;
			if(s[i] == '0'){
				s[i] = '1';
			} 
			else s[i] = '0'; 
		}
		prev = s[i];
	}

	mini = min(cost,mini);
	

	if(s[0] == '0') s[0] = '1';
	else s[0] = '0';

	prev = s[0];
	cost = 0;

	for(int i = 1; i < s.size() ; i++){
		if (s[i] == prev)
		{
			cost++;
			if (s[i] == '0')
			{
				s[i] = '1';
			}
			else
				s[i] = '0';
		}
		prev = s[i];
	}

	mini = min(cost,mini);

	cout<<mini<<endl;
	

	t2 = clock();
	cerr<<endl<<t2-t1<<endl;
	
	return 0;
}



Measured memory_bytes: 512
#include <iostream>

using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a>c)
        cout<<"NO";
    else if(a<c){
        if(a+b>c)
           cout<<"YES";
        else
           cout<<"NO";
    }
    else if(a==c)
        cout<<"YES";
    
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0513

"""
import sys
from sys import stdin
from itertools import chain
input = stdin.readline


def flatten(listOfLists):
    "Flatten one level of nesting"
    return chain.from_iterable(listOfLists)


def cut(k):
    global cards
    yellow = cards[:k]
    blue = cards[k:]
    cards = blue + yellow


def shuffle():
    global cards
    yellow = cards[:N]
    blue = cards[N:]
    temp = [[y, b] for y, b in zip(yellow, blue)]
    cards = list(flatten(temp))


cards = []
N = 0
def main(args):
    global N
    global cards
    n = int(input())
    N = n
    m = int(input())

    cards = [x for x in range(1, (2*n)+1)]
    for _ in range(m):
        op = int(input())
        if op == 0:
            shuffle()
        else:
            cut(op)

    print('\n'.join(map(str, cards)))


if __name__ == '__main__':
    main(sys.argv[1:])
    

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

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

dA = V * T
dB = W * T
d = dA - dB
if d >= abs(A - B):
    print("YES")
else:
    print("NO")




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

// マクロ
// forループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x)begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
// 出力
#define PRINT(x) cout<<(x)<<endl
#define PRINTA(x,n) REP(i,n)PRINT(x[i])
// 定数
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
// 略記
#define PB push_back
#define MP make_pair



int main() {
    string S; cin >> S;
    string ans = "";
    REP(i, 3) ans += S[i];
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 3624
//Code Author:-code_kika //
//Institution:-IIT(BHU)  //
#include<bits/stdc++.h>
using namespace std;

//io
#define sf(x) scanf("%d",&x);
#define sf2(x,y) scanf("%d %d",&x,&y);
#define sf3(x,y,z) scanf("%d %d %d",&x,&y,&z);
#define pf(x) printf("%d",x);
#define pf2(x,y) printf("%d %d",x,y);
#define pf3(x,y,z) printf("%d %d %d",x,y,z);
#define sfl(x) scanf("%lld",&x);
#define sfl2(x,y) scanf("%lld %lld",&x,&y);
#define sfl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z);
#define pfl(x) printf("%lld",x);
#define pfl2(x,y) printf("%lld %lld",x,y);
#define pfl3(x,y,z) printf("%lld %lld %lld",x,y,z);
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//basic
#define pb push_back
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define mod 1000000007LL

//typedefs
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vll vector<ll>
#define vi vector<int>

//functions
#define all(c) c.begin(),c.end()
#define fill(c,val) memset(c,val,sizeof(c))

//debug
#ifdef TRACE
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#else
#define trace(x)
#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)
#endif

int main(){
	ll n,a,b;
	cin>>n>>a>>b;
	ll p=b-a+1;
	if(a>b){
		cout<<"0";
		return 0;
	}
	if(n==1){
		if(b!=a){
			cout<<"0";
		}
		else{
			cout<<"1";
		}
		return 0;
	}
	if(n==2){
		cout<<"1";
		return 0;
	}
	
	cout<<(b-a)*(n-2)+1;	
		
}

Measured memory_bytes: 256
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=list(map(int,input().split()))

dp=defaultdict(int)

if n%2==0:
    for i in range(n):
        if i%2==0:
            dp[(i,i//2+1)]=dp[(i-2,i//2)]+a[i]
        else:
            dp[(i,i//2+1)]=max(dp[(i-3,i//2)],dp[(i-2,i//2)])+a[i]
        # print(i)
    # print(dp)
    print(max(dp[(n-1,n//2)],dp[(n-2,n//2)]))
else:
    for i in range(n):
        if i%2==0:
            if i!=0:
                dp[(i,i//2)]=max(dp[(i-4,i//2-1)],dp[(i-3,i//2-1)],dp[(i-2,i//2-1)])+a[i]
            dp[(i,i//2+1)]=dp[(i-2,i//2)]+a[i]
        else:
            dp[(i,i//2+1)]=max(dp[(i-3,i//2)],dp[(i-2,i//2)])+a[i]
    # print(dp)
    print(max(dp[(n-1,n//2)],dp[(n-2,n//2)],dp[(n-3,n//2)]))

Measured memory_bytes: 141668
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int a[100010],n;
bool get(int pos)
{
	for(int i=pos+1;i<=n+1;i++)
	{
		if(a[i]>a[i-1]) {return false;break;}
		if(a[i]<a[i-1]) {return true;break;}
	}
}
int main()
{
	int sum=1,pos=1,i=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	get(pos);
while(i<=n)
{
	if(get(pos)==false)
	{
		for(i=pos+1;i<=n;i++)
		{
			if(a[i]<a[i-1]) {sum++;pos=i;break;}
		}
		get(pos);
	}
	else
	{
		for(i=pos+1;i<=n;i++)
		{
			if(a[i]>a[i-1]) {sum++;pos=i;break;}
		}
		get(pos);
	}
}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <numeric>
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long


const int maxn = 1e5+5;
vector<int> adj[maxn];
queue< pair<int, int> > q;  // a fringe
// int counts[maxn];
int dist[maxn][3];


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

    // fill(counts, counts+maxn, 1e6);
    memset(dist, -1, sizeof(dist));

    int n,m; cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int u,v; cin >> u >> v;
        adj[u].push_back(v);
    }

    int s,t; cin >> s >> t;
    q.push(make_pair(s, 0));
    dist[s][0] = 0;
    
    while (!q.empty()) {
        int curr = q.front().first, d = q.front().second;
        // tie(curr, d) = q.front();
        q.pop();
        for (int nei : adj[curr]) {
            if (dist[nei][(d+1) % 3] == -1) {
                q.push(make_pair(nei, (d+1) % 3));
                dist[nei][(d+1) % 3] = dist[curr][d] + 1;
            }
        }
    }

    if (dist[t][0] == -1) {
        cout << -1 << endl;
    } else {
        cout << dist[t][0] / 3 << endl;
    }

}
 



Measured memory_bytes: 6912
s=input()
lst=[]
for i in s:
    lst.append(i)
def check(ls):
    ls_=list(reversed(ls))
    if not ls==ls_:
        print('No')
        exit()
check(lst)
n=len(lst)
check(lst[:(n-1)//2])
check(lst[(n+3)//2-1:])
print('Yes')

Measured memory_bytes: 3064
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

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

int main() {
	string S;
	cin >> S;
	int A = S[0] - '0';
	int B = S[1] - '0';
	int C = S[2] - '0';
	int D = S[3] - '0';

	if (A + B + C + D == 7)
		printf("%d+%d+%d+%d=7\n", A, B, C, D);
	else if (A + B + C - D == 7)
		printf("%d+%d+%d-%d=7\n", A, B, C, D);
	else if (A + B - C + D == 7)
		printf("%d+%d-%d+%d=7\n", A, B, C, D);
	else if (A + B - C - D == 7)
		printf("%d+%d-%d-%d=7\n", A, B, C, D);
	else if (A - B + C + D == 7)
		printf("%d-%d+%d+%d=7\n", A, B, C, D);
	else if (A - B + C - D == 7)
		printf("%d-%d+%d-%d=7\n", A, B, C, D);
	else if (A - B - C + D == 7)
		printf("%d-%d-%d+%d=7\n", A, B, C, D);
	else if (A - B - C - D == 7)
		printf("%d-%d-%d-%d=7\n", A, B, C, D);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
const int N=200000+10;
int a[N],b[N];
 
int main(){
    int n,k,tmp,cnt=0,ans=0;
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        if(b[a[i]]==0) cnt++;
        b[a[i]]++;
    }
    multiset <int> s;
    multiset <int> ::iterator it;
    for(int i=0;i<N;i++){
        if(b[i]!=0) s.insert(b[i]);
    }
    if(cnt<=k) {cout<<0<<endl;return 0;}
    for(int i=1;i<=cnt-k;i++){
        it=s.begin();s.erase(it);
        ans+=*it;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 11136