akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 21
#define EPS 1e-9
#define INF 1e9

struct Point{
  double x, y;
  Point(double x = 0,double y = 0) : x(x), y(y) {}

  Point operator + (const Point &p)const{
    return Point(x + p.x , y + p.y);
  }
 
  Point operator - (const Point &p)const{
    return Point(x - p.x , y - p.y);
  }
 
  Point operator * (const double &k)const{
    return Point(x * k , y * k);
  }
 
  Point operator / (const double &k)const{
    return Point(x / k , y / k);
  }

  bool operator < (const Point &p)const{
    return x != p.x ? x < p.x : y < p.y;
  }

  double norm(){
    return x*x + y*y;
  }
  double dot(const Point &p)const{
    return x*p.x + y*p.y;
  }
  double Abs(){
    return sqrt(norm());
  }
}; 

typedef Point Vector;
 
struct Segment{
  Vector s, t;
 
  Segment(){}
  Segment(Vector s, Vector t) : s(s), t(t) {}
 
  Point Projection(const Point &p){
    Vector base = t - s;
    double t = (p-s).dot(base) / base.norm();
    return s + base*t;
  }

  bool intersectSP(const Point &p){
    return (((s-p).Abs() + (t-p).Abs() - (t-s).Abs()) < EPS);
  }

  double distanceSP(const Point &p){
    Point r = Projection(p);
    if(intersectSP(r)) return (r-p).Abs();
    return min((s-p).Abs(), (t-p).Abs());
  }
};

int N;
Point h, d, crystal[MAX];
 
double dist(Point a, Point b){
  return sqrt(pow(a.x-b.x,2) + pow(a.y-b.y,2));
}

Segment s;
bool rec(int S, int v, double total_dist){
  if(S == (1 << N) - 1){
    return true;
  }
  for(int u = 0 ; u < N ; u++){
    if(!(S >> u & 1)){
      s = Segment(crystal[v], crystal[u]);
      if(s.distanceSP(d) < total_dist) return false;
      if(total_dist+dist(crystal[v],crystal[u]) >= dist(d, crystal[u])){
        return false;
      }
    }
  }
  for(int u = 0 ; u < N ; u++){
    if(!(S >> u & 1)){
      if(rec(S | 1 << u, u, total_dist + dist(crystal[v],crystal[u]))){
	return true;
      }
    }
  }
}

bool solve(){
  for(int i = 0 ; i < N ; i++){
    if(rec(0, i, dist(h, crystal[i]))){
      return true;
    }
  }  

  return false;
}
 
int main(){
  while(cin >> N >> h.x >> h.y >> d.x >> d.y, (N + h.x + h.y + d.x + d.y)){
    for(int i = 0 ; i < N ; i++){
      cin >> crystal[i].x >> crystal[i].y;
    }
    cout << (solve() ? "YES" : "NO") << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1228
using System;
class p
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int A = int.Parse(input[0]);
    int B = int.Parse(input[1]);
    int C = int.Parse(input[2]);
    Console.WriteLine((A <= C) && (C <= B) ? "Yes" : "No");
  }
}

Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int a, b, c, d, e, f;
    double x, y;
    while(scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) == 6)
    {
        y = (double) (a*f - c*d)/(a*e - b*d);
        x = (double) (c - b*y)/a;
        printf("%.3f %.3f\n", x, y);
    }
    return 0;
}

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

using namespace std;

int x[100000], y[100000];

int main() {
	int n, m;

	scanf("%d %d", &n, &m);

	for (int i = 0;i < m;++i)
		scanf("%d", &x[i]);

	sort(x, x + m);

	for (int i = 1;i < m;++i)
		y[i] = x[i] - x[i - 1];

	sort(y + 1, y + m, greater<int>());

	int tot = 0;
	for (int i = n;i < m;++i)
		tot += y[i];

	printf("%d", tot);

	return 0;
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	x := getInt()

	i := 0
	for sum := 0; sum < x; i++ {
		sum += i + 1
	}

	fmt.Println(i)
}

// -----------------------------------------

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <bitset>
#include <algorithm>
#include <string>
#include <queue>

#define ll long long
#define ull unsigned long long
using namespace std;

const ll mod = 1000000007;

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

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll ans = 0;
    int k;
    cin >> k;
    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= k; j++) {
            for (int p = 1; p <= k; p++) {
                ans += gcd(gcd(i,j), p);
            }
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>//cout << fixed からの cout << setprecision(n) << 小数　によって小数を整数部分含めてn桁表示できるようにする
#include <cctype>
#include <unordered_map>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  vector<int> dp(n,INF);
  for(int i = 0;i < n;i++) cin >> h[i];
  dp[0] = 0;
  for(int i = 1;i < n+1;i++){
    for(int j = 1;j <= min(i - 0,k);j++){
      dp[i] = min(dp[i],dp[i-j] + abs(h[i]-h[i-j]));
    }
  }
  cout << dp[n-1] << endl;

  return 0;
}


Measured memory_bytes: 1024
import sys
from collections import deque


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    h, w = nm()
    Ch, Cw = nm()
    Dh, Dw = nm()
    S = [list(ns()) for _ in range(h)]
    pos = deque([(Ch, Cw)])
    cost = [[float('Inf')] * w for _ in range(h)]
    cost[Ch - 1][Cw - 1] = 0


    warp = deque([(Ch, Cw)])
    while pos:
        while pos:
            c_i, c_j = pos.pop()
            for i, j in [(1, 0), (0, -1), (-1, 0), (0, 1)]:
                if 0 <= c_i + i - 1 < h and 0 <= c_j + j - 1 < w \
                        and cost[c_i + i - 1][c_j + j - 1] > cost[c_i - 1][c_j - 1] \
                        and S[c_i + i - 1][c_j + j - 1] == '.':
                    cost[c_i + i - 1][c_j + j - 1] = cost[c_i - 1][c_j - 1]
                    pos.append((c_i + i, c_j + j))
                    warp.append((c_i + i, c_j + j))

        warp_sub = []
        while warp:
            c_i, c_j = warp.pop()
            for i in range(-2, 3):
                for j in range(-2, 3):
                    if 0 <= c_i + i - 1 < h and 0 <= c_j + j - 1 < w \
                            and cost[c_i + i - 1][c_j + j - 1] > cost[c_i - 1][c_j - 1] + 1 \
                            and S[c_i + i - 1][c_j + j - 1] == '.':
                        cost[c_i + i - 1][c_j + j -
                                          1] = cost[c_i - 1][c_j - 1] + 1
                        pos.append((c_i + i, c_j + j))
                        warp_sub.append((c_i + i, c_j + j))

        warp.extend(warp_sub)

    print(cost[Dh - 1][Dw - 1] if cost[Dh - 1][Dw - 1] != float('Inf') else -1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 137244
<?php
list($h) = ints();
list($w) = ints();
list($n) = ints();
echo (intdiv($n, max($h, $w)) + min(1, $n % max($h, $w)));
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 16064
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let csf: Vec<(u32, u32, u32)> = (0..n-1).map(|_| (read(), read(), read())).collect();

    let mut anss: Vec<(u32)> = (0..n).map(|_| 0).collect();

    let mut i = 0;
    while i < n - 1 {
        let (c, s, f) = csf[i];
        // println!("{} {} {} {}", i, c, s, f);
        for j in 0..i+1 {
            let mut a = anss[j];
            if a < s {
                a = s;
            }
            if a % f != 0 {
                a += f - (a % f);
            }
            a += c;
            anss[j] = a;
            // println!("{} {} {} {} {}", i, j, c, s, f);
        }
        
        // println!("{:?}", anss);
        i += 1;
    }

    for ans in anss {
        println!("{}", ans);
    }
}


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

int main(int argc, const char * argv[]) {
    
    long long int x,y;
    long long int len=1;
    long long int a;
    
    
    cin >> x >> y;
    
    a=x;
    for(;;){
        
        a=a*2;
        if(a>y) break;
        len++;
    }
    
    cout << len << endl;
    
    return 0;
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

template<class T,class F>
struct segtree{
  int n;
  T e;
  F f;
  std::vector<T> dat;

  segtree(){}
  segtree(int sz,T _e,F _f):e(_e),f(_f){
    n = 1;
    while(n<=sz)n<<=1;
    dat.resize(2*n,e);
  }
  segtree(std::vector<T> const& v,T _e,F _f):e(_e),f(_f){
    build(v);
  }
  void build(std::vector<T> const& v){
    n = 1;
    int sz = v.size();
    while(n<=sz)n<<=1;
    dat.resize(2*n,e);
    for(int i=0;i<sz;++i){
      dat[i+n] = v[i];
    }
    for(int i=n-1;i>0;--i){
      dat[i] = f(dat[i<<1],dat[i<<1|1]);
    }
  }
  void set(int p,T v){
    for(dat[p+=n]=v;p>1;p>>=1){
      dat[p>>1] = f(dat[p],dat[p^1]);
    }
  }
  T query(int l,int r){
    T res = e;
    for(l+=n,r+=n;l<r;l>>=1,r>>=1){
      if(l&1){
        res = f(res,dat[l]);
        l++;
      }
      if(r&1){
        r--;
        res = f(res,dat[r]);
      }
    }
    return res;
  }
  T operator[](int k){
    return query(k,k+1);
  }
};

int main(){

  ll n,d,a;
  cin>>n>>d>>a;
  vector<pll> xh(n);
  cin>>xh;

  auto sum = [](auto a,auto b){return a+b;};
  segtree<ll,decltype(sum)> seg1(n,0,sum);

  constexpr auto ceil = [](auto a,auto b){return (a-1)/b+1;};
  sort(xh.begin(),xh.end());
  ll ans = 0;

  rep(i,n){
    pll key = { xh[i].first-2*d,-1 };
    auto itr = lower_bound(xh.begin(),xh.end(),key);
    ll idx = itr-begin(xh);
    ll attacked = seg1.query(idx,i+1);
    ll damage = a*attacked;
    ll hp = xh[i].second-damage;
    if(hp<=0)continue;
    ll attack = ceil(hp,a);
    seg1.set(i,attack);
    ans += attack;
  }
  cout<<(ans)<<endl;

}

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


int main() {
    long long N;
    cin >> N;
    
    unsigned long long sum = 0;
    for(long long i=1;i<N+1;i++){
        if(i%3!=0 && i%5!=0){
            sum += i;
        }
    }

    if(sum==0){
        cout << 1 << endl;
    }else{
        cout << sum << endl;
    }


}

  


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

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(s: &[char]) -> bool {
    let m = s.len();
    for i in 0..m {
        if s[i] != s[m - 1 - i] {
            return false;
        }
    }
    true
}

use std::iter::Iterator;

fn main() {
    input! {
        a:usize,
        b:usize,
    }

    if a < 10 && b < 10 {
        println!("{}", a * b);

    }else{
        println!("-1")
    }

    

}


Measured memory_bytes: 4352
N,a,b=map(int,input().split())
mod=10**9+7
n=max(a,b)
fra=[1]*(n+2)
inv=[1]*(n+2)
t=1
for i in range(1,n+2):
    t*=i
    t%=mod
    fra[i]=t
t=pow(fra[n+1],mod-2,mod)
for i in range(n+1,0,-1):
    inv[i]=t
    t*=i
    t%=mod
ans=pow(2,N,mod)-1
tmp=inv[a]
for i in range(1,a+1):
    tmp*=(N+1-i)%mod
    tmp%=mod
ans-=tmp
tmp=inv[b]
for i in range(1,b+1):
    tmp*=((N+1-i)%mod)
    tmp%=mod
ans-=tmp
ans%=mod
print(ans)

Measured memory_bytes: 42352
n = int(input().strip())
s = [input().strip() for _ in range(n)]
num = [0 for _ in range(5)]
num[0] = len([True for _s in s if _s[0] == "M"])
num[1] = len([True for _s in s if _s[0] == "A"])
num[2] = len([True for _s in s if _s[0] == "R"])
num[3] = len([True for _s in s if _s[0] == "C"])
num[4] = len([True for _s in s if _s[0] == "H"])
ans = 0
for i in range(5):
    for j in range(i + 1, 5):
        for k in range(j + 1, 5):
            ans += num[i] * num[j] * num[k]
print(ans)

Measured memory_bytes: 10540
n = gets
as = gets.split.map(&:to_i)
bs = gets.split.map(&:to_i)

count = 0
reserve = 0
bs.each_with_index do |b, i|
  if reserve > 0
    if as[i] >= reserve
      as[i] -= reserve
      count += reserve
    else
      count += as[i]
      as[i] = 0
    end
    reserve = 0
  end
  c = as[i] - b
  if c >= 0
    count += b
  else
    count += as[i]
    reserve = -c
  end
end

l = [as.last, reserve].min
p count + l


Measured memory_bytes: 15388
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc167_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string K = Console.ReadLine();

            int len = S.Length;
            int len2 = K.Length;

            string K2 = K.Substring(0, len);

            if (S == K2 && len2 == len + 1)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
            Console.Read();
        }
    }
}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  ll t1, t2, a1, a2, b1, b2;
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
  
  if((a1-b1)*t1 + (a2-b2)*t2 == 0) {
    cout << "infinity" << endl;
    return 0;
  }
  ll first = (a1-b1)*t1, second = (a2-b2)*t2;
  if(abs(first) > abs(second) || first >= 0 && second >= 0 || first <= 0 && second <= 0) {
    cout << 0 << endl;
    return 0;
  }
  
  ll d = abs(second+first);
  ll n = abs(first)/d + 1;
  //cout << first << " " << second << " " << d << endl;
  if(d > abs(first)) {
    cout << 1 << endl;
    return 0;
  }

  if(abs(first)%d != 0) cout << 2*n-1 << endl;
  else cout << 2*n-2 << endl;
  
}


Measured memory_bytes: 3604
def main():
    H = int(input())
    H2 = H
    ccc = 0
    while H2 > 1:
        H2 = H2 // 2
        ccc += 1
    cnt = (1-2**(ccc+1))/(1-2)
    print(int(cnt))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
package main

import (
	"fmt"
)

func main(){
	var number int64
	fmt.Scanf("%d", &number)

	fmt.Printf("%d\n", answer(number))
}

func answer(n int64) int64 {
	ret := int64(0)

	if isOdd(n) {
		return ret
	}

	for i := 1; i < 2000; i++ {
		t := int64(1)
		for j := 1; j <= i; j++ {
			t = t * 5
		}
		if n < (t * 2) {
			break
		}
		ret += n / (2 * t)
	}
	return ret
}

func isOdd(n int64) bool{
	if n % 2 == 1 {
		return true
	}
	return false
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            int rating = Integer.parseInt(br.readLine());

            String result = "ABC";
            if (rating >= 2800) {
                result = "AGC";
            } else if (rating >= 1200) {
                result = "ARC";
            }

            System.out.println(result);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 21076
#include <stdio.h>
#define MAX 1002

int main(void){
	char c[MAX];
	int sum = 0, i;
	
	while(1){
		sum = 0;
		fgets(c, MAX, stdin);
		for(i = 0; c[i] != '\n'; i++){
			sum += (c[i] - '0');
		}
		if(sum == 0){
			break;
		}
		printf("%d\n", sum);
	}
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int X, N;
    cin >> X >> N;
    set<int> P;
    REP(i,N) {
        int p; cin >> p;
        P.insert(p);
    }
    auto it = P.insert(X);
    if (it.second) OUT(X)
    else {
        int r = X-1;
        int l = X+1;
        while(true) {
            it = P.insert(r);
            if (it.second) {
                OUT(r)
                return 0;
            }
            it = P.insert(l);
            if (it.second) {
                OUT(l)
                return 0;
            }
            r--;
            l++;
        }
    }


    return 0;
}

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

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
#define go(i,s) for(int i = head[s]; i; i = e[i].next)
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const int maxn = 100050;

long long n;
int ans, k, w1, w2;

int main()
{
	cin >> n;
	ans = 1<<30;
	fo(i,1,sqrt(n))
	{
		if(n%i==0)
		{
			w1 = w2 = 0;
			k = i;
			while(k){++w1;k/=10;}
			k = n/i;
			while(k){++w2;k/=10;}
			ans = min(ans,max(w1,w2));
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
int main()
{
	int n, q;
	string s;
	int l[100000], r[100000];
	cin >> n >> q;
	cin >> s;
	int i, cnt = 0;
	string ss = "AC";
	int b[100000] = { 0 };
	for (i = 0; i < n; i++) {
		if (s[i] == 'A') {
			if (s[i + 1] == 'C') {
				b[i] = cnt;
				cnt++;
				i++;
			}
		}
		b[i] = cnt;
	}
	for (i = 0; i < q; i++) {
		cin >> l[i] >> r[i];
		int ans = 0;
		ans = b[r[i] - 1] - b[l[i] - 1];


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

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
 
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;
 
#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
#define FF first
#define SS second
 
#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}
 
 
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
 
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
 
  string a, b;
  cin >> a >> b;
  string s = a + b;
  LL x = stoll(s);
 
  for(LL i=1;i*i<=x;++i)
	if(i*i == x){
	  cout << "Yes" << endl;
	  return 0;
	}
  cout << "No" << endl;
 
  return 0;
}

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

using namespace std;
int N, Z, W, a[4000], dp[2][2000][2002];

int dfs(bool isx, int i, int xi)
{
    if (dp[isx][i][xi] >= 0) {
        return dp[isx][i][xi];
    }
    int ret;
    if (i == N - 1)
        ret = abs(a[xi] - a[N - 1]);
    else {
        if (isx) {
            ret = max(dfs(false, i + 1, i), dfs(true, i + 1, xi));
        }
        else {
            ret = min(dfs(true, i + 1, i), dfs(false, i + 1, xi));
        }
    }
    return dp[isx][i][xi] = ret;
}

int main()
{
    //
    memset(dp, -1, sizeof(dp));
    scanf("%d %d %d", &N, &Z, &W);
    for (int i = 0; i < N; i++) {
        scanf("%d", &a[i]);
    }
    a[N] = Z;
    a[N + 1] = W;

    for (int isx = 0; isx <= 1; isx++)
        for (int xi = 0; xi <= N + 1; xi++)
            dp[isx][N - 1][xi] = abs(a[xi] - a[N - 1]);

    for (int i = N - 2; i >= 0; i--) {
        for (int isx = 0; isx < 2; isx++) {
            for (int xi = 0; xi <= N + 1; xi++) {
                int ret;
                switch (isx) {
                    case 0:
                        ret = min(dp[1][i + 1][i], dp[0][i + 1][xi]);
                        break;
                    case 1:
                        ret = max(dp[0][i + 1][i], dp[1][i + 1][xi]);
                        break;
                }
                dp[isx][i][xi] = ret;
            }
        }
    }

    printf("%d\n", dp[1][0][N + 1]);
    // printf("%d\n", dfs(true, 0, 2001));
}


Measured memory_bytes: 31488
import sys

N=int(input())
TXY=[list(map(int,input().split())) for i in range(N)]

TXY=[[0,0,0]]+TXY

n=0
nx=0
ny=0

for t,x,y in TXY:
    #print(n,nx,ny,t,x,y)
    if abs(x-nx)+abs(y-ny)<=t-n and (abs(x-nx)+abs(y-ny))%2==(t-n)%2:
        n,nx,ny=t,x,y
    else:
        print("No")
        sys.exit()


print("Yes")

Measured memory_bytes: 28148
#include<stdio.h>

int n, A[2000];

//入力値のMから選んだ要素を引いていく再帰関数
int solve(int i, int m){
	if( m==0 ) return 1; //作れるとき
	if( i>=n ) return 0; //作れないとき
	int res = solve(i+1, m) || solve(i+1, m-A[i]); //どちらかがtrueならtrue
	return res;
}

int main(void){
	int q, m[2000], i;
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d", &A[i]);
	}
	scanf("%d", &q);
	for(i=0; i<q; i++){
		scanf("%d", &m[i]);
//		printf("%d\n", solve(0,m[i]));
		if( solve(0,m[i]) ) printf("yes\n");
		else printf("no\n");
	}
	return 0;
}


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

struct Point{
    double x;
    double y;
    Point(double x_in, double y_in){
        x = x_in;
        y = y_in;
    }
    Point(){}
};

struct Segment{
    Point p1;
    Point p2;
    Segment(const Point& p1_in, const Point& p2_in){
        p1 = p1_in;
        p2 = p2_in;
    }
};

Point calc_s(const Segment& S){
    double x = (2 * S.p1.x + S.p2.x) / 3.0;
    double y = (2 * S.p1.y + S.p2.y) / 3.0;
    Point P(x, y);
    return P;
}

Point calc_t(const Segment& S){
    double x = (S.p1.x + 2 * S.p2.x) / 3.0;
    double y = (S.p1.y + 2 * S.p2.y) / 3.0;
    Point P(x, y);
    return P;
}

Point calc_u(const Point& s, const Point& t){
    double distance = sqrt((s.x - t.x) * (s.x - t.x)
                         + (s.y - t.y) * (s.y - t.y));
    double cos_ = (t.x - s.x) / distance;
    double sin_ = (t.y - s.y) / distance;
    double x_tmp1 = distance / 2.0;
    double y_tmp1 = x_tmp1 * sqrt(3.0);

    double x_tmp2 = cos_ * x_tmp1 - sin_ * y_tmp1;
    double y_tmp2 = sin_ * x_tmp1 + cos_ * y_tmp1;

    double x_ = x_tmp2 + s.x;
    double y_ = y_tmp2 + s.y;
    Point ret(x_, y_);
    return ret;
}

void Koch(const Segment& Seg, int n){
    if (n == 0) return;
    Point s = calc_s(Seg);
    Point t = calc_t(Seg);
    Point u = calc_u(s, t);
    Segment Seg1(Seg.p1, s);
    Koch(Seg1, n - 1);
    cout << s.x << " " << s.y << endl;
    Segment Seg2(s, u);
    Koch(Seg2, n - 1);
    cout << u.x << " " << u.y << endl;
    Segment Seg3(u, t);
    Koch(Seg3, n - 1);
    cout << t.x << " " << t.y << endl;
    Segment Seg4(t, Seg.p2);
    Koch(Seg4, n - 1);
}


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

    Point p1(  0.0, 0.0);
    Point p2(100.0, 0.0);
    Segment Seg(p1, p2);
    cout << Seg.p1.x << " " << Seg.p1.y << endl;
    Koch(Seg, n);
    cout << Seg.p2.x << " " << Seg.p2.y << endl;

    return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
#define mp  make_pair
using namespace std;

typedef pair <int,int>  PII;
const int dx[4]={-1,1,0,0},dy[4]={0,0,-1,1};
int n,m,k,a[805][805],dis[805][805],ans;
char ch;
queue <PII> Q;

void work()
{
	scanf("%d %d %d",&n,&m,&k),ans=2*n;
	for (int i=1; i<=n; i++)
		for (int j=1; j<=m; j++)
			{
				do  ch=getchar();  while ((ch!='#')&&(ch!='.')&&(ch!='S'));
				if (ch!='#')  a[i][j]=1;
				if (ch=='S')  dis[i][j]=1,Q.push(mp(i,j));
			}
	while (!Q.empty())
		{
			int x=Q.front().first,y=Q.front().second,d;  Q.pop();
			d=min(min(x-1,n-x),min(y-1,m-y));
			ans=min(ans,(d+k-1)/k+1);
			if (dis[x][y]<=k)
				for (int i=0; i<4; i++)
					if ((a[x+dx[i]][y+dy[i]])&&(!dis[x+dx[i]][y+dy[i]]))
						dis[x+dx[i]][y+dy[i]]=dis[x][y]+1,Q.push(mp(x+dx[i],y+dy[i]));
		}
	printf("%d",ans);
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 5248
#include <iostream>
#include <string>
#include <queue>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <climits>

using namespace std;

#define INF INT_MAX

int N;
long long M;
vector<long long> A;
vector<long long> As;


long long get_count(int base) {
    long long res = 0;
    for (int i = 0; i < N; i++) {
        int Ay = base - A[i];
        int idx = lower_bound(A.begin(), A.end(), Ay) - A.begin();
        res += N - idx;
    }
    return res;
}


long long get_sum(int base) {

    long long res = 0;

    for (int i = 0; i < N; i++) {
        As.push_back(A[i]);
    }
    for (int i = N-2; 0 <= i; i--) {
        As[i] += As[i+1];
    }
    for (int i = 0; i < N; i++) {
        int Ay = base - A[i];
        int idx = lower_bound(A.begin(), A.end(), Ay) - A.begin();
        int cnt = N - idx;
        res += 1LL * A[i] * cnt;
        res += As[idx];
    }
    return res;
}


int main() {

    cin >> N >> M;
    int a;
    for (int i = 0; i < N; i++) {
        cin >> a;
        A.push_back(a);
    }

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

    int min = 0, max = INF;

    while (min+1 != max) {
        int mid = (min + max)/2;
        if (M <= get_count(mid)) {
            min = mid;
        } else {
            max = mid;
        }
    }

    long long ans =  (M - get_count(min + 1)) * min + get_sum(min + 1);

    cout << ans;
   
    return 0;

}


Measured memory_bytes: 2548
#include<stdio.h>
#include<stdlib.h>
int main(){
  long long ng=0,ok=1e18,n,m,k,s,a[200010],i;
  scanf("%lld %lld",&n,&k);
  for(i=0;i<n;i++)scanf("%lld",&a[i]);
  while(labs(ng-ok)>1){
    m=(ok+ng)/2;
    for(i=s=0;i<n;i++){
      s+=(a[i]-1)/m;//printf("%d\n",s);
    }//printf("%lld %lld\n",m,s);
    if(s>k)ng=m;
    else   ok=m;
  }
  printf("%lld\n",ok);
  return 0;
}
	     
  


Measured memory_bytes: 3244
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    ll D[N];
    ll i,j;
    for(i=0;i<N;i++){
        cin >> D[i];
    }
    ll M;
    cin >> M;
    ll T[M];
    for(i=0;i<M;i++){
        cin >> T[i];
    }
    sort(D,D+N);
    sort(T,T+M);
    i=0;j=0;
    while(i<N){
        while(j<M){
            if(i>=N||D[i]>T[j]){
                cout <<"NO";
                return 0;
            }
            if(D[i]<T[j])i++;
            if(D[i]==T[j]){
                j++;
                i++;
            }
        }
        i++;
    }
    cout << "YES";
    return 0;
}


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

int main(){
    string s;
    stack<int> a;
    while(cin >> s){
        if(s == "+"){
            int p = a.top();
            a.pop();
            int q = a.top();
            a.pop();
            a.push(p + q);
        }
        else if(s == "-"){
            int p = a.top();
            a.pop();
            int q = a.top();
            a.pop();
            a.push(q - p);
        }
        else if(s == "*"){
            int p = a.top();
            a.pop();
            int q = a.top();
            a.pop();
            a.push(p * q);
        }
        else{
            int tmp = atoi(s.c_str());
            a.push(tmp);
        }
    }
    cout << a.top() << endl;
    return 0;
}



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

int main(){
    
    string s,t;
    cin >> s >> t;
    
    vector<pair<char, char>> vec(s.size());
    
    for(int i = 0; i < s.size(); i++){
        vec[i].first = s[i];
        vec[i].second = t[i];
    }
    
    sort(vec.begin(), vec.end());
    
    bool flag = true;
    
    for(int i = 0; i < s.size(); i++){
        if(vec[i].first == vec[i+1].first and vec[i].second != vec[i+1].second){
            flag = false;
            break;
        }
    }
    
    for(int i = 0; i < s.size(); i++){
        swap(vec[i].first, vec[i].second);
    }
    
    sort(vec.begin(), vec.end());
    
    for(int i = 0; i < s.size(); i++){
        if(vec[i].first == vec[i+1].first and vec[i].second != vec[i+1].second){
            flag = false;
            break;
        }
    }
    
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}




Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
#include <stack>
#include <iomanip>
#include <map>
#include <math.h>
#include <list>
#include <deque>
typedef long long ll;
using namespace std;
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; }
ll MOD = 1000000007;
ll INF = 1LL << 60;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) {return a / GCD(a, b) * b;}

int main()
{
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    int migi = tx - sx;
    int upper = ty - sy;
    for(int i = 0; i < migi; i++) cout <<'R';
    for(int i = 0; i < upper; i++) cout << 'U';
    for(int i = 0; i < migi; i++) cout << 'L';
    for(int i = 0; i < upper; i++) cout << 'D';
    cout << 'D';
    for(int i = 0; i < migi + 1; i++) cout <<'R';
    for(int i = 0; i < upper + 1; i++) cout << 'U';
    cout <<'L';
    cout <<'U';
    for(int i = 0; i < migi + 1; i++) cout <<'L';
    for(int i = 0; i < upper + 1; i++) cout << 'D';
    cout <<'R';
    cout << endl;
}


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

static void SolveA()
{
	int n, k;
	std::string s;
	std::cin >> n >> k;
	std::cin >> s;

	s[k - 1] = std::tolower(s[k - 1]);

	std::cout << s;
}

enum Format
{
	None,
	YYMM,
	MMYY,
};

static void SolveB()
{
	std::string s;
	std::cin >> s;

	const int upper = std::stoi(s.substr(0, 2));
	const int lower = std::stoi(s.substr(2, 2));

	int format{};
	// YYMM
	if (1 <= lower && lower <= 12)
	{
		format |= Format::YYMM;
	}

	// MMYY
	if (1 <= upper && upper <= 12)
	{
		format |= Format::MMYY;
	}

	if ((format & Format::YYMM) && (format & Format::MMYY))
	{
		std::cout << "AMBIGUOUS\n";
		return;
	}

	if (format & Format::YYMM)
	{
		std::cout << "YYMM\n";
		return;
	}

	if (format & Format::MMYY)
	{
		std::cout << "MMYY\n";
		return;
	}

	std::cout << "NA\n";
}

int main()
{
	SolveB();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vii;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
 

const int MAX_E = 300100;
const int MAX_V = 100100;
 
int par_uft[MAX_V];
int rank_uft[MAX_V];
 
void init_uft(int n) {
	int i;
	for (i = 0; i < n; i++) {
		par_uft[i] = i;
		rank_uft[i] = 0;
	}
}
 
int find_uft(int x) {
	if (par_uft[x] == x) {
		return x;
	}
	else {
		return par_uft[x] = find_uft(par_uft[x]);
	}
}
 
void unite_uft(int x, int y) {
	x = find_uft(x);
	y = find_uft(y);
	if (x == y)return;
 
	if (rank_uft[x] < rank_uft[y]) {
		par_uft[x] = y;
	}
	else {
		par_uft[y] = x;
		if (rank_uft[x] == rank_uft[y]) {
			rank_uft[x]++;
		}
	}
}
 
bool same_uft(int x, int y) {
	return find_uft(x) == find_uft(y);
}
 
 
 
struct edge { int u, v, cost; };
 
bool comp(const edge& e1, const edge& e2) {
	return e1.cost < e2.cost;
}
 
edge es[MAX_E];
int V, E;
 
ll kruskal() {
	sort(es, es + E, comp);
	init_uft(V);
	ll res = 0LL;
	for (int i = 0; i < E; i++) {
		edge e = es[i];
		if (!same_uft(e.u, e.v)) {
			unite_uft(e.u, e.v);
			res += e.cost;
		}
	}
	return res;
}


int main(){
	char c;
	int a,b,d;
	while(cin>>V>>E){
		if(E==0)break;
		rep(i,E){
			cin>>a>>c>>b>>c>>d;
			d/=100;
			d--;
			if(a>b){
				int t=a;
				a=b;
				b=t;
			}
			es[i].u=a;
			es[i].v=b;
			es[i].cost=d;
		}
		cout<<kruskal()<<endl;
	}

}

Measured memory_bytes: 3284
#include <iostream>
using namespace std;
int main () {
    int N, ans=0;
    cin >> N;
    for (int i=1;i<=N;i+=2){
        int cnt=0;
        for (int j=1;j<=i;j++){
            if (i%j==0)
                cnt++;
        }
        if (cnt==8)
            ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
// GRL_5_B Height of a Tree

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <vector>

#define MAXN 10010

using namespace std;

struct edge {
  int to, wt;
  edge(int to, int wt) : to(to), wt(wt) {}
};

vector<edge> adj[MAXN];
bool visited[MAXN];
int LD[MAXN];

void dfs(int i, int ld) {
  if (visited[i])
    return;
  visited[i] = true;
  LD[i] = max(LD[i], ld);
  for (auto &e : adj[i])
    if (!visited[e.to])
      dfs(e.to, ld + e.wt);
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0, s, t, wt; i < n - 1; ++i) {
    scanf("%d%d%d", &s, &t, &wt);
    adj[s].emplace_back(t, wt);
    adj[t].emplace_back(s, wt);
  }
  memset(LD, 0, sizeof(LD));

  for (int root = 0; root < n; ++root) {
    if (adj[root].size() == 1) {
      memset(visited, 0, sizeof(visited));
      dfs(root, 0);
    }
  }
  for (int root = 0; root < n; ++root) {
    printf("%d\n", LD[root]);
  }
}


Measured memory_bytes: 3584
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())

sub = 0
a = int(input())
x = int(input())
x = int(input())
x = int(input())
e = int(input())

k = int(input())

if (e-a) > k :
  print (":(")
else :
  print ("Yay!")



Measured memory_bytes: 38384
fun main(args: Array<String>) {

    val n = readLine()!!.toInt()
    val a1 = readLine()!!.split(" ").map(String::toInt)
    val a2 = readLine()!!.split(" ").map(String::toInt)


    var max = 0
    for (i in 0 until n) {
        max = Math.max(a1.take(i + 1).sum() + a2.takeLast(n - i).sum(), max)
    }
    println(max)
}




Measured memory_bytes: 37944
import java.util.stream.*;
import java.util.*;

public class Main{
  public static void main(String[] args){

    List<Integer> order = new ArrayList<Integer>();

    List<Integer> a = new ArrayList<Integer>();
    List<Integer> b = new ArrayList<Integer>();

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    for(int i = 0; i < N; i++){
      order.add(i + 1);
    }

    for(int i = 0; i < N; i++){
      a.add(sc.nextInt());
    }

    for(int i = 0; i < N; i++){
      b.add(sc.nextInt());
    }


    Permutation.makePerm(new ArrayList<Integer>(), order, a, b);
    // System.out.println(Permutation.cnt);
    System.out.println(Math.abs(Permutation.aIndex - Permutation.bIndex));
  }
}

class Permutation {

  public static int cnt = 0;
  public static int aIndex = 0;
  public static int bIndex = 0;
  public static void makePerm(List<Integer> perm, List<Integer> ori, List<Integer> a, List<Integer> b){

    List<Integer> incPerm = new ArrayList<Integer>(perm);
    List<Integer> decOri = new ArrayList<Integer>(ori);

    // System.out.println("---- enter method ----");
    // System.out.println("perm count: " + perm.size());
    // System.out.println("perm elements: " + perm);
    // System.out.println("ori count: " + ori.size());
    // System.out.println("ori elements: " + ori);
    if(ori.size() == 0){
      cnt++;
      // System.out.println("perm: " + perm);
      if(a.equals(perm)) aIndex = cnt;
      if(b.equals(perm)) bIndex = cnt;
    }

    for (int i = 0; i < ori.size(); i++){
      // 次の要素を確定する
      Integer nextElement = ori.get(i);
      incPerm.add(nextElement);
      decOri.remove(i);
      makePerm(incPerm, decOri, a, b);
      // System.out.println("current ori: " + ori);
      // 確定していた要素を削除し、元に戻す
      incPerm.remove(incPerm.size() - 1);
      decOri.add(i, nextElement);
    }

    // System.out.println("loop end perm: " + perm);
    // System.out.println("loop end ori: " + ori);
    // System.out.println("---- leave method ----");
  }
}



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


int main() {
    int n;
    cin >> n;
    if (n % 10 == 9 || n / 10 == 9) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}




Measured memory_bytes: 3608
#pragma region header
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int n,k;cin >> n >> k;
    vi a(n);
    int sum = 0;
    rep(i, n) {
        cin >> a[i];
        // if(i<k)sum+=a[i];
    }
    sort(all(a));
    /*vi sa(n-1);
    rep(i, n-1) {
        sa[i]= a[i+1]-a[i];
        if(i<k-1)sum+=sa[i];
    }
    int mi =  sum;
    rep(i, n-k) chmin(mi,sum-sa[i]+sa[i+k-1]);
    for(auto p:sa)cout << p << ' ';
    cout << "\n";
    cout << mi << endl;
    cout << sum << endl;*/
    int mi = inf;
    rep(i, n-k+1) chmin(mi,a[i+k-1]-a[i]);
    cout << mi << endl;
    return 0;
}

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

int N, K;
vector<bool> C;

int main(void) {
	cin >> N >> K;
	C.resize(N + 1, false);
	for (int j = 0; j < K; ++j) {
		int D;
		cin >> D;
		for (int i = 0; i < D; ++i) {
			int v;
			cin >> v;
			C[v] = true;
		}
	}

	int cnt = 0;
	for (int i = 1; i <= N; ++i) {
		if (C[i] == false)
			++cnt;
	}

	cout << cnt << '\n';
	return 0;
}


Measured memory_bytes: 3632