akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#pragma warning(disable:4996)
using namespace std;
using ld=long double;

int main() {
	while(true){
		int N,M;cin>>N>>M;
		if(!N)break;
		vector<vector<ld>>dps(M + 1, vector<ld>(N));
		dps[0][0]=1;
		for (int i = 0; i < M; ++i) {
			for (int j = 0; j < N; ++j) {
				for (int k = 1; k <= 6; ++k) {
					dps[i+1][(j+k)%N]+=dps[i][j]/6;
				}
			}
		}
		string st;cin>>st;
		ld ans=0;
		for (int i = 0; i < N; ++i) {
			ld  nans=0;
			for (int j = 0; j < N; ++j) {
				if (st[j]=='R') {
					nans+=dps[M][(i+j)%N];
				}
			}
			ans=max(ans,nans);
		}
		
		cout<<setprecision(10)<<fixed<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 65504
program answer
  implicit none
  integer :: i, N, count
  integer, allocatable :: a(:)
  read(*,*) N
  allocate(a(N))
  read(*,*) a

  count=0
  do i = 1, N
     if(a(a(i))==i) then
        count=count+1
     end if
  end do
  
  write(*,*) count/2
  deallocate(a)
  stop
 end program answer


Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
int main(){
    int d,g;
    cin >> d >> g;
    int p[11],c[11];
    for(int i=0;i<d;i++)cin >> p[i] >> c[i];
    int ans=10000000;
    for(int mask=0;mask<(1<<d);mask++){
        int s=0,num=0,rest_max=-1;
        for(int i=0;i<d;i++){
            if(mask&1<<i){
                s+=100*(i+1)*p[i]+c[i];
                num +=p[i];
            }
            else{
                rest_max=i;
            }
        }
        if(s<g){
            int s1=100*(rest_max+1);
            int need = (g - s + s1 - 1) / s1;
            if(need >= p[rest_max]){
                continue;
        }
        num+=need;
        }
        ans=min(ans,num);

    }
            cout << ans;
}

Measured memory_bytes: 256
N,M = gets.split.map(&:to_i)
data = []
N.times do
  data << gets.split.map(&:to_i)
end
data.sort_by!{|a| a[0]}
cnt,ans = 0,0
data.each do |a|
  if cnt + a[1] >= M
    ans += (M-cnt)*a[0]
    break
  end
  cnt += a[1]
  ans += a[0]*a[1]
end
p ans


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

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			int input = int.Parse(Console.ReadLine());
			//if (input < 10)
			//{
			//	Console.WriteLine(0);
			//	return;
			//}
			string str = "";
			if (input == 25)
				str = "Christmas";
			else if (input == 24)
				str = "Christmas Eve";
			else if (input == 23)
				str = "Christmas Eve Eve";
			else if (input == 22)
				str = "Christmas Eve Eve Eve";

			Console.WriteLine(str);
		}
	}
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector <int> ii(n+2,0),ii2(n+2,0);
    int l,r;
    rep(i,m){
        cin >> l >> r;
        ++ii[l];
        --ii[r+1];
    }
    
    int ans=0;
    rep(i,n){
        ii2[i+1]=ii2[i]+ii[i+1];
        if(ii2[i+1]==m){
            ++ans;
        }
    }

    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 3924
#include <cstdio>

int main() {
  int N;
  scanf("%d", &N);

  int res = 0;
  for (int i = 1; i <= N; ++i) {
    res += 800;
    if (i % 15 == 0) res -= 200;
  }
  printf("%d\n", res);
}

Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  // Input
  int N, K;
  std::cin >> N >> K;
  std::string S;
  std::cin >> S;
  assert(S.size() == (size_t)N);

  // Record duration of "online" and "offline" interchangeably
  std::vector<int> duration;
  if (S.front() == '0')
    duration.push_back(0);
  for (int left = 0, size = S.size(); left < size;) {
    int right = left;
    while (right < size and S[left] == S[right])
      ++right;
    duration.push_back(right - left);
    left = right;
  }
  if (S.back() == '0')
    duration.push_back(0);

  // Construct cumulative sum
  std::vector<int> sum(duration.size() + 1, 0);
  for (int i = 0; i < (int)duration.size(); ++i)
    sum[i + 1] = sum[i] + duration[i];

  // Get max
  int res = -1;
  for (int left = 0; left < (int)duration.size(); left += 2) {
    int right = left + 2 * K + 1;
    chmin(right, (int)duration.size());
    chmax(res, sum[right] - sum[left]);
  }

  // Output
  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 1272
#include <iostream>
using namespace std;
const int maxn = 2.2e5;
int sub[maxn];
void init(){
    for(int i = 0; i < maxn; ++i){
        sub[i] = 0;
    }
}
int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n - 1; ++i){
        int boss;
        cin >> boss;
        sub[boss]++;
    }
    for(int i = 1; i <= n; ++i){
        cout << sub[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 4404
#include <stdio.h>
#include <string.h>

int main() {
    char s[200000+1];
    scanf("%s", s);

    int a = 0;
    for (int i = 0; i < strlen(s); i++) {
        if (s[i] == 'A') {
            a = i;
            break;
        }
    }

    int z = 0;
    for (int i = strlen(s)-1; i > 0; i--) {
        if (s[i] == 'Z') {
            z = i;
            break;
        }
    }

    printf("%d\n", z-a+1);

    return 0;
}

Measured memory_bytes: 384
const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {
    const rows = input.split('\n')
    const N = rows[0] - 0
    const A = rows[1].split(' ').map(Number)

    const d = []
    for (let i = 0; i < N; i++) {
        if (d[i - A[i]]) {
            d[i - A[i]].push(i)
        } else {
            d[i - A[i]] = [i]
        }
    }

    let count = 0
    for (let i = 0; i < N; i++) {
        if (d[i + A[i]]) {
            count += d[i + A[i]].length
        }
    }
    
    console.log(count)

})(input)


Measured memory_bytes: 88804
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 7;
const int mod = 1e9 + 7;
int pre[maxn];
vector<int>p1[maxn],p2[maxn];
int num[maxn];
int find_pre(int x){
	if(x==pre[x]) return x;
	else {
		int z = find_pre(pre[x]);
		return pre[x] = z;
	}
}
void join(int x,int y){
    x = find_pre(x);
    y = find_pre(y);
    if(x != y)  pre[y] = pre[x];
}
int main(){
	memset(num,0,sizeof(num));
	int n,m,k;
	scanf("%d %d %d",&n,&m,&k);
	for(int i=0;i<=n;i++) pre[i]=i;   
	while(m--){
		int a,b;
		scanf("%d %d",&a,&b);
		join(a,b);
		p1[a].push_back(b);
		p1[b].push_back(a);	
	}
	while(k--){
		int a,b;
		scanf("%d %d",&a,&b);
		p2[a].push_back(b);
		p2[b].push_back(a);
	}
	for(int i = 1;i <= n;i++){
		num[find_pre(i)]++;
	}
	for(int i = 1;i <= n;i++){
		int ans = num[find_pre(i)]-1;
		for(int j = 0;j < p1[i].size();j++){
			if(find_pre(i) == find_pre(p1[i][j])) ans--;
		}
		for(int j = 0;j < p2[i].size();j++){
			if(find_pre(i) == find_pre(p2[i][j])) ans--;
		}
		cout << ans << " ";
	}
	return 0;
}

Measured memory_bytes: 13176
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Set<Integer> set = new HashSet<>();
		
		for (int i = 0; i < n; i++) {
			set.add(scan.nextInt());
		}
		
		System.out.println(set.size());
	}
}


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

using namespace std;
using ll = long long;

const ll INF = 1LL << 58;

template <class T> int former(const vector<T> &v, T x) {
  return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}

template <class T> int latter(const vector<T> &v, T x) {
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, B, Q;
  cin >> A >> B >> Q;
  vector<ll> S(A), T(B);
  for (int i = 0; i < A; i++)
    cin >> S[i];
  for (int i = 0; i < B; i++)
    cin >> T[i];
  S.push_back(-INF);
  S.push_back(INF);
  sort(S.begin(), S.end());
  T.push_back(-INF);
  T.push_back(INF);
  sort(T.begin(), T.end());
  for (int k = 0; k < Q; k++) {
    ll x;
    cin >> x;
    ll res = INF;

    // S -> T
    for (int i = 0; i < 2; i++) {
      ll first = (i ? S[former(S, x)] : S[latter(S, x)]);
      for (int j = 0; j < 2; j++) {
        ll second = (j ? T[former(T, first)] : T[latter(T, first)]);
        res = min(res, abs(x - first) + abs(first - second));
      }
    }

    // T -> S
    for (int i = 0; i < 2; i++) {
      ll first = (i ? T[former(T, x)] : T[latter(T, x)]);
      for (int j = 0; j < 2; j++) {
        ll second = (j ? S[former(S, first)] : S[latter(S, first)]);
        res = min(res, abs(x - first) + abs(first - second));
      }
    }
    cout << res << '\n';
  }
  return 0;
}


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

int main(){
    int K, N;
    cin >> K >> N;
    vector<int> A(N);
    for (int i=0; i<N; i++) cin >> A.at(i);
    int min_dist = 1e9;
    for (int i=0; i<N-1; i++) {
        min_dist = min(min_dist, K - (A.at(i+1) - A.at(i)));
    }
    min_dist = min(min_dist, K - (K + A.at(0) - A.at(N-1)));
    cout << min_dist << endl;
}

Measured memory_bytes: 1024
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

func Solve() {
  var X int
  NextInt(&X)
  M := make([]int, 200)
  for i := range M { M[i] = i * i * i * i * i }
  ans := []int{0, 0}
  for a := 0; a < 200; a++ {
    for b := 0; b < 200; b++ {
      if M[a] - M[b] == X { ans = []int{a, b} }
      if M[a] + M[b] == X { ans = []int{a, -b} }
    }
  }
  WriteIntVec(ans)
}

func main() {
  Solve()
  Output()
}

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}
func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

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

int main(){
	int n,k,temp;	cin >> n >> k;
	set<int> S;
	while(k--){
		cin >> temp;
		S.insert(temp);
	}
	int chk=0;
	for(int i=n ; ; i++){
		chk = 0;
		temp = i;
		while(temp>0){
			int qq= temp%10;
			if(S.find(qq)!=S.end())	chk=1;
	//		cout << qq << " " << chk << endl;
			temp = temp /10;
		}
		if(chk==0){
			cout << i ;
			return 0;
		}
		
		}
}




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

using namespace std;

int a, b, c, max1, max2, max3, ans;
int main() {
	cin >> a >> b >> c;
	max1 = a;
	if (b > max1) {
		max2 = max1;
		max1 = b;
	}
	else {
		max2 = b;
	}
	if (c > max1) {
		max3 = max2;
		max2 = max1;
		max1 = c;
	}
	else {
		if (c > max2) {
			max3 = max2;
			max2 = c;
		}
		else {
			max3 = c;
		}
	}
	while (max2 <= max1) {
		max2 += 2;
		ans++;
	}
	max2 -= 2;
	ans--;
	while (max3 <= max1) {
		max3 += 2;
		ans++;
	}
	max3 -= 2;
	ans--;
	if (max3 > max2) {
		swap(max2, max3);
	}
	if (max1 == max2 && max2!=max3) {
		ans += 2;
	}
	if (max2 == max3 && max2 != max1) {
		ans++;
	}
	cout << ans;
}

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

using namespace std;
typedef long long ll;

int main(){
    int n; cin >> n;
    vector<int>h(n);
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    int res = 0;
    for(;;){
        if(*max_element(h.begin(), h.end()) == 0) break;

        int i = 0;
        while(i < n){
            if(h[i] == 0) i++;
            else{
                res++;
                while(i < n && h[i] > 0){
                    h[i]--;
                    i++;
                }
            }
        }
    }
    cout << res << endl;
}

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

int main(void){
	stack<int> cars;
	int car;
	while(cin>>car){
		if(car>0){
			cars.push(car);
		}else{
			cout << cars.top() << endl;
			cars.pop();
		}
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final List<Integer> list = IntStream.range(0, n)
                .mapToObj(i -> scanner.nextInt())
                .collect(Collectors.toList());

        if (list.get(0) != 0) {
            System.out.println(-1);
            return;
        }

        long sum = list.get(list.size() - 1);
        long tmp = list.get(list.size() - 1);
        for (int i = list.size() - 2; i >= 0; i--) {
            final int value = list.get(i);
            if (value < tmp - 1) {
                System.out.println(-1);
                return;
            }
            if (value > i) {
                System.out.println(-1);
                return;
            }
            if (value == tmp - 1) {
                tmp = Math.max(tmp - 1, 0);
                continue;
            }
            tmp = value;
            sum += value;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 98944
#include <stdio.h>
int main(void){
    int n,d,i,r;
    r = 1;
    scanf("%d",&d);
    scanf("%d",&n);
    for(i = 0;i < d;i++){
        r *= 100;
    }
    if(n == 100){
        printf("%d",r*(n+1));
        return 0;
    }
    printf("%d",r*n);
    return 0;
}

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

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

    cout << ((n - 1) * (m - 1)) << endl;

    return 0;
}


Measured memory_bytes: 256
import itertools
N = int(input())
a = [i for i in range(1, N+1)]
graph = list(itertools.combinations(a, 2))
graph
for i in range(N//2):
    graph.remove((i+1, 2*(N//2)-i))
print(len(graph))
for i in range(len(graph)):
    print(graph[i][0], graph[i][1])
    

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

int main()
{
  static char s[500010];
  scanf("%s",s);
  int n=strlen(s);
  static int T[500010][30],S[500010][30];
  for(int i=0;i<=n;i++){
    for(int c=0;c<=26;c++){
      T[i][c]=-1;
    }
  }
  for(int c=0;c<26;c++){
    S[n][c]=-1;
  }
  for(int i=n-1;i>=0;i--){
    int p=s[i]-'a';
    T[i][p]=i+1;
    for(int c=p;c+1<=26&&S[T[i][c]][c]!=-1&&T[S[T[i][c]][c]][c]!=-1;c++){
      T[i][c+1]=T[S[T[i][c]][c]][c];
    }
    for(int c=0;c<p;c++){
      S[i][c]=(T[i][26]==-1?-1:S[T[i][26]][c]);
    }
    for(int c=p;c<26;c++){
      S[i][c]=i;
    }
  }
  static int db[500010][19];
  for(int i=0;i<=n;i++){
    for(int k=0;k<19;k++){
      db[i][k]=-1;
    }
  }
  for(int i=n;i>=0;i--){
    db[i][0]=T[i][26];
    int k=0;
    while(db[i][k]!=-1){
      //printf("%d %d %d\n",i,k,db[i][k]);
      db[i][k+1]=db[db[i][k]][k];
      k++;
    }
  }
  int q;
  scanf("%d",&q);
  while(q--){
    int l,r;
    scanf("%d%d",&l,&r);
    l--;
    while(l<r){
      int k=18;
      while(k>=0&&!(db[l][k]!=-1&&db[l][k]<=r)){
	k--;
      }
      //printf("%d %d\n",l,k);
      if(k==-1){
	break;
      }
      l=db[l][k];
    }
    puts(l==r?"Yes":"No");
  }
  return 0;
}


Measured memory_bytes: 155392
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);
 
#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)


int main(){
    int inf = 1e9+7;
    int n;
    cin >> n;
    ll ans = 1;
    for(int i=1;i<=n;i++) {
        ans *= i;
        ans %= inf;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(vs) vs.begin(), vs.end()
using ii = pair<int, int>;
using ll = long long;

int32_t main(){
	ios::sync_with_stdio(0);
	string s, t;
	cin >> s >> t;
	cout << string(t + s) << endl;
}


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


namespace PriRect
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = new string[2];
            //for(int i = 0; i < str.Length; i++){
            while (true)
            {
                str = Console.ReadLine().Split(' ');
                int height = int.Parse(str[0]);
                int weight = int.Parse(str[1]);
                if ((height == 0) && (weight == 0))
                {
                    break;
                }
                for (int i = 0; i < height; i++)
                {
                    for (int k = 0; k < weight; k++)
                    {
                        if ((i == 0 || i == height - 1 || k == 0 || k == weight - 1))
                        {
                         Console.Write("#");
                        }
                        else
                        {
                            Console.Write(".");
                        }
                     } Console.WriteLine("");
                } Console.WriteLine("");
            }
        }
    }
}

Measured memory_bytes: 5292
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

A.sort()
B.sort()
C.sort()

ans = 0

for i in B:
    OK = -1
    NG = N
    while NG - OK > 1:
        mid = (OK + NG) // 2
        if A[mid] < i:
            OK = mid
        else:
            NG = mid
    countA = OK + 1
    
    OK = N
    NG = -1
    while OK - NG > 1:
        mid = (OK + NG) // 2
        if C[mid] > i:
            OK = mid
        else:
            NG = mid
    countC = N - NG - 1
    ans += countA * countC

print(ans)

Measured memory_bytes: 23640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b==c||b+c==a||c+a==b){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
const int N=100086;
int a[N];
int n,k;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	sort(a+1,a+n+1);
	int j=lower_bound(a+1,a+n+1,k)-a;
	printf("%d\n",n-j+1);
	return 0;
}

Measured memory_bytes: 640
S = input()
n = int(input())
for i in range(n):
    q = input().split()
    q[1] = int(q[1])
    q[2] = int(q[2])
    if q[0] == "print":
        print(S[q[1]:q[2] + 1])
    elif q[0] == "reverse":
        if q[1] == 0:
            S = S[:q[1]] + S[q[2]::-1] + S[q[2] + 1:]
        else:
            S = S[:q[1]] + S[q[2]:q[1] - 1:-1] + S[q[2] + 1:]
    elif q[0] == "replace":
        S = S[:q[1]] + q[3] + S[q[2] + 1:]

Measured memory_bytes: 7692
let nm = readLine()!.split(separator: " ").map {
  Int($0)!
}

let n = nm[0]
let m = nm[1]

let a = readLine()!.split(separator: " ").map {
  Int($0)!
}

var c = 0

for number in a {
  c += number
}

let answer = n - c

if answer < 0 {
  print(-1)
} else {
  print(answer)
}


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

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

	if(a.at(a.size()-1)==b.at(0) && b.at(b.size()-1)==c.at(0)) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> H >> W;
	int ans = 0;
	vector<string>s(H);
	for (auto &i : s)cin >> i;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (s[i][j] == '#')continue;
			vector<vector<int>>dis(H, vector<int>(W, MOD));
			dis[i][j] = 0;
			int dir[] = { 1,0,-1,0,1 };
			queue<pair<int, int>>Q;
			Q.push({ i,j });
			while (!Q.empty()) {
				int cy = Q.front().first;
				int cx = Q.front().second;
				Q.pop();
				for (int k = 0; k < 4; k++) {
					int ny = cy + dir[k];
					int nx = cx + dir[k + 1];
					if (ny < 0 || nx < 0 || ny >= H || nx >= W)continue;
					if (s[ny][nx] == '#')continue;
					if (dis[ny][nx] > dis[cy][cx] + 1) {
						dis[ny][nx] = dis[cy][cx] + 1;
						ans = max(dis[ny][nx], ans);
						Q.push({ ny,nx });
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int a,b;
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>a>>b;
	if(a>=b){
		for(int i=1;i<=a;i++) cout<<b;
		cout<<endl;
	}
	else{
		for(int i=1;i<=b;i++) cout<<a;
		cout<<endl;
	}
	return 0;
}


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

long long n,x,m;
int chk[100000];

int main() {
    scanf("%lld %lld %lld",&n,&x,&m);
    long long now=x;
    int cycle;
    int cnt=1;
    long long sum=0;
    long long csum=0;
    while (1) {
        if (chk[now]!=0) {
            cycle=cnt-chk[now];
            break;
        }
        chk[now]=cnt++;
        sum+=now;
        now=(now*now)%m;
    }
    int f=cnt-cycle-1;
    cnt=0;
    int save=now;
    while (cnt==0||now!=save) {
        sum-=now;
        csum+=now;
        now=(now*now)%m;
        cnt++;
    }
    long long ret=0;
    if (n<=f) {
        now=x;
        for(int i=0;i<n;i++) {
            ret+=now;
            now=(now*now)%m;
        }
        printf("%lld",ret);
        return 0;
    }
    ret+=sum;
    n-=f;
    ret+=(n/cycle)*csum;
    n%=cycle;
    now=x;
    for(int i=0;i<f;i++) {
        now=(now*now)%m;
    }
    for(int i=0;i<n;i++) {
        ret+=now;
        now=(now*now)%m;
    }
    printf("%lld",ret);
}

Measured memory_bytes: 4152
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main()
{
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    
    string t;
    cin >> t;
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    
    if (s < t) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;

long long a, b, n;

long long ans = 0;
long long int f(long long x)
{
    return floor((a*x)/b) - (a*floor(x/b));
}

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

    cout << f(min(b-1,n)) << endl;
    return 0;
}

Measured memory_bytes: 3640
import itertools
import math
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
l=[]
for i in itertools.permutations(range(1,n+1)):
    l.append(i)
for i in range(math.factorial(n)):
    if l[i]==p:
        a=i+1
    if l[i]==q:
        b=i+1
ans=abs(a-b)
print(ans)

Measured memory_bytes: 7984
x,k,d = gets.chomp.split(" ").map(&:to_i)

num = [(x / d).abs, k].min
if x >= 0
  x -= num * d
else
  x += num * d
end

k -= num
if k % 2 == 0
  puts x.abs
elsif x >= 0
  puts (x - d).abs
else
  puts (x + d).abs
end


Measured memory_bytes: 14388
from collections import Counter

n = int(input())
A = list(map(int, input().split()))
q = int(input())
query = [tuple(map(int, input().split())) for _ in range(q)]

ctr = Counter(A)
sum_ini = sum(A)

for b, c in query:
    x = ctr[b]
    ctr[c] += x
    ctr[b] -= x
    sum_ini += (c - b) * x
    print(sum_ini)


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

/*３のつく数字ならtrue*/

bool has3(int x){
    while (x)
    {
        if (x % 10 == 3)return true;
        x = x  / 10;
    }
    return false;
}

void call(int n){
    for (int x = 1; x <= n; x++)
    {
        if (x % 3 == 0 || has3(x)){
            cout << " " << x;
        }    
    }
    cout << endl;
}

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

    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)


int main(){
    int n,maxi=0; cin >> n;
    for(int i=1; i <= n; i *= 2){
        maxi = max(maxi, i);
    }
    cout << maxi << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace ITP1_11_C
{
	class Dice
	{
		public static int[] label = new int[6];
		public static void Roll(string s)
		{
			foreach (char c in s)
			{
				switch (c)
				{
					case 'E': { East(); break; }
					case 'N': { North(); break; }
					case 'S': { South(); break; }
					case 'W': { West(); break; }
				}
			}
		}
		static void East()
		{
			int x = label[0];
			label[0] = label[3]; label[3] = label[5];
			label[5] = label[2]; label[2] = x;
		}
		static void North()
		{
			int x = label[0];
			label[0] = label[1]; label[1] = label[5];
			label[5] = label[4]; label[4] = x;
		}
		static void South()
		{
			int x = label[0];
			label[0] = label[4]; label[4] = label[5];
			label[5] = label[1]; label[1] = x;
		}
		static void West()
		{
			int x = label[0];
			label[0] = label[2]; label[2] = label[5];
			label[5] = label[3]; label[3] = x;
		}
	}
	class Program
	{
		static void Main(string[] args)
		{
			Dice.label = Console.ReadLine().Split().Select(int.Parse).ToArray();
			string[] c = new string[] { "E", "N", "S", "W", };
			int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
			if (Array.IndexOf(Dice.label, a[0]) >= 0
				&& Array.IndexOf(Dice.label, a[1]) >= 0
				&& Array.IndexOf(Dice.label, a[2]) >= 0)
			{
				Random rand = new Random();
				while (!(Dice.label[0] == a[0] && Dice.label[1] == a[1]))
				{
					int b = (int)(rand.NextDouble() * 100000);
					Dice.Roll(c[b % 4]);
					rand = new Random(b);
				}
				bool ret = true;
				for (int i = 0; i < 6; i++)
				{
					if (Dice.label[i] != a[i]) ret = false;
				}
				Console.WriteLine(ret ? "Yes" : "No");
			}
			else Console.WriteLine("No");
		}
	}
}


Measured memory_bytes: 18332
h,w=map(int,input().split())
s=[]
for i in range(h):
    s.append(list(input()))
for y in range(h):
    for x in range(w):
        if s[y][x]=="#":
            if 0<y<h-1 and 0<x<w-1:
                if not (s[y-1][x]=="#" or s[y+1][x]=="#" or s[y][x-1]=="#" or s[y][x+1]=="#"):
                    print("No")
                    exit()
            elif y==0 and x==0:
                if not (s[y+1][x]=="#" or s[y][x+1]=="#"):
                    print("No")
                    exit()
            elif y==0 and x==w-1:
                if not (s[y+1][x]=="#" or s[y][x-1]=="#"):
                    print("No")
                    exit()
            elif y==h-1 and x==0:
                if not (s[y-1][x]=="#" or s[y][x+1]=="#"):
                    print("No")
                    exit()
            elif y==h-1 and x==w-1:
                if not (s[y-1][x]=="#" or s[y][x-1]=="#"):
                    print("No")
                    exit()
            elif y==0:
                if not (s[y][x-1]=="#" or s[y][x+1]=="#" or s[y+1][x]=="#"):
                    print("No")
                    exit()
            elif y==h-1:
                if not (s[y][x-1]=="#" or s[y][x+1]=="#" or s[y-1][x]=="#"):
                    print("No")
                    exit()
            elif x==0:
                if not (s[y-1][x]=="#" or s[y+1][x]=="#" or s[y][x+1]=="#"):
                    print("No")
                    exit()
            else:
                if not (s[y-1][x]=="#" or s[y+1][x]=="#" or s[y][x-1]=="#"):
                    print("No")
                    exit()
print("Yes")


Measured memory_bytes: 3192
#include<iostream>
#include<bits/stdc++.h>
#define int double
#define vi vector<int>
#define vvi vector<vi>
#define fo(i,a,b) for(int i=a;i<b;i++)
#define start() int t;cin>>t;while(t--) 
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
using namespace std;
struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0), cin.tie(0); } }_;
 
int32_t main()
{
    string s;
    cin>>s;
    if(s[s.length()-1]=='?')s[s.length()-1]='D';
    for(int i=0;i<s.length()-1;i++)
    {
        if(s[i]=='?'&& s[i+1] =='D')s[i]='P';
        else if(s[i]=='?'&& s[i+1] =='P')s[i]='D';
        else if(s[i]=='?'&& s[i+1] =='?'){s[i]='P';s[i+1]='D';}
        else if(s[i]=='P' && s[i+1]=='?'){s[i+1]='D';}

    }
    cout<<s<<endl;

    return 0;
}

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

class Main {
    static int H;
    static int W;

    static boolean[][] done;
    static char[][] map;

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;

        while (!(line = br.readLine()).equals("0 0")) {
            String[] input = line.split(" ");
            H = Integer.parseInt(input[0]);
            W = Integer.parseInt(input[1]);
            done = new boolean[H][W];
            map = new char[H][W];
            int res = 0;

            for (int i = 0; i < H; i++) {
                map[i] = br.readLine().toCharArray();
            }

            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    if (done[i][j]) {
                        continue;
                    } else {
                        res++;
                        // System.out.println(map[i][j] + "を分配します...");
                        dist(i, j, map[i][j]);
                    }
                }
            }

            System.out.println(res);
        }
    }

    static void dist(int h, int w, char c) {
        try {
            char x = map[h][w];
            if (!done[h][w] && x == c) {
                done[h][w] = true; // 分配済みフラグを立てる
                dist(h, w - 1, c);
                dist(h, w + 1, c);
                dist(h - 1, w, c);
                dist(h + 1, w, c);
            }
        } catch (ArrayIndexOutOfBoundsException e) {
            return;
        }
    }
}


Measured memory_bytes: 27356
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long cnt = 1;
    long mod = 1000000007;
    char[] c1 = sc.next().toCharArray();
    char[] c2 = sc.next().toCharArray();
    int i = 0;
    if(c1[0]==c2[0])cnt=3;
    if(c1[0]!=c2[0]){
      cnt=6;
      i++;
    }
    while(i < n-1){
      if(c1[i]!=c2[i]&&c1[i+1]!=c2[i+1]&&c1[i]!=c1[i+1])cnt=(cnt*3)%mod;
      else if(c1[i]!=c2[i]&&c1[i+1]==c2[i+1])cnt=cnt%mod;
      else if(c1[i]==c2[i]&&c1[i+1]!=c2[i+1])cnt=(cnt*2)%mod;
      else if(c1[i]==c2[i]&&c1[i+1]==c2[i+1])cnt=(cnt*2)%mod;
      i++;
    }
    System.out.println(cnt);
  }
}

Measured memory_bytes: 23764
import java.util.*;

public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        char[] chars = sc.next().toCharArray();
        
        long[] map = new long[26];
		for (char c : chars) {
			map[c-'a']++;
		}
		
		long sum = 1;
		for (long count : map) {
			sum = sum * (count+1L) % 1_000_000_007L;
		}
		
		System.out.println(sum - 1);
    }
}

Measured memory_bytes: 26452
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <stdio.h>
#include <sstream>

using namespace std;
void swap(int &a, int &b);

int main()
{
	int number = 1;
	int score[1000];
	cout << fixed << setprecision(9);

	while (true)
	{
		cin >> number;
		if (number == 0)
			break;

		double median = 0.0;
		for (int i = 0; i < number; ++i)
		{
			cin >> score[i];
			median += score[i];
		}
		median /= (double)number;
		
		double variance = 0.0;
		for (int i = 0; i < number; ++i)
			variance += (score[i] - median)*(score[i] - median);
		variance /= (double)number;

		cout << sqrt(variance) << endl;
	}

	return 0;
}





Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define float long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define endl '\n'
#define pii pair<int, int>
#define min3(a,b,c) min(a, min(b, c))
#define max3(a,b,c) max(a, max(b, c))
#define all(x) x.begin(), x.end()
#define fill(a,b) memset(a, b, sizeof(a))
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

signed main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

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

    string a,b; cin>>a>>b;
    int ans=1000005;
    for(int i=0;i+sz(b)<=sz(a);i++){
        int cnt=0;
        for(int j=0;j<sz(b);j++) if(a[j+i]!=b[j]) cnt++;
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 3548
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    
    int N;
    cin >> N;
    int A[3*N];
    for(int i = 0; i < 3*N; i++) {
        cin >> A[i];
    }
    sort(A, A+3*N);
    long long  sum = 0;
    for(int i = N; i < 3*N; i += 2) {
        sum += A[i];
    }
    cout << sum << endl;
    return 0;
}

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

using namespace std;

int main(){
  int n;
  cin>>n;
  vector<long long int> bar(n,0);
  for (int i=0; i<n; i++) cin>>bar[i];
  vector<long long int> frnt(n,0);
  vector<long long int> bck(n,0);
  for (int i=0; i<n; i++) {
  	frnt[i]=(i==0)? bar[i]:(frnt[i-1]+bar[i]);
    bck[n-i-1]=(i==0)? bar[n-i-1]:(bck[n-i]+bar[n-i-1]);
  }
  long long int mn=LLONG_MAX;
  for (int i=0;i<n-1; i++) {
    mn=min(mn,abs(frnt[i]-bck[i+1]));
  }
  cout<<mn;
  return 0;  
}

Measured memory_bytes: 4992
// ProblemURL : https://atcoder.jp/contests/abc143/tasks/abc143_c
// ---------------------------------------------
package main

import "fmt"

func main() {
	var n int
	var s []byte
	fmt.Scan(&n, &s)

	b := make([]byte, 0, len(s))
	b = append(b, s[0])
	for i := 1; i < len(s); i++ {
		if s[i-1] != s[i] {
			b = append(b, s[i])
		}
	}
	fmt.Println(len(b))
}


Measured memory_bytes: 1408
#include <iostream>
#include <utility>
#include <stdint.h>
#include <list>

using namespace std;

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

  uint64_t digitsum = 0;
  uint64_t digits = 0;
  
  for (int n=0; n<N; ++n) {
    uint16_t d;
    uint64_t c;
    cin >> d >> c;
    digitsum += d*c;
    digits += c;
  }

  uint64_t rounds = 0;
  rounds += digits - 1;
  rounds += (digitsum-1)/9;

  cout << rounds << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
//S.size()
//配列名.Length()

using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;

int main(void){
	int N;cin>>N;
	VI a(N);rep(i,N)cin>>a[i];
	bool jud = true;
	int cnt = 0;
	while(jud){
		for(int t = 0;t < N;t++){
			if(a[t] % 2 == 1)jud = false;
			else a[t] /= 2;
		}
		cnt++;
	}
	cout<<cnt - 1;
}


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

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

const int MOD = 1e9+7;
const int INF = 1e9;
int d[108][108];

int main() {
	int N,K;
	cin>>N>>K;

	if(K>(N-1)*(N-2)/2){
		cout<<-1<<endl;
		return 0;
	}

	for (int i = 0; i < N; ++i){
		for (int j = i+1; j < N; ++j){
			d[i][j] = 1;
		}
	}
	int cnt = 0;
	for (int i = 0; i < N-1; ++i){
		for (int j = i+1; j < N-1; ++j){
			if(cnt >= K)i=N,j=N;
			d[i][j] = 0;
			cnt++;
		}
	}
	int M = 0;
	for (int i = 0; i < N; ++i){
		for (int j = i+1; j < N; ++j){
			if(d[i][j])M++;
		}
	}
	cout<<M<<endl;
	for (int i = 0; i < N; ++i){
		for (int j = i+1; j < N; ++j){
			if(d[i][j]){
				cout<<i+1<<" "<<j+1<<endl;
			}
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using AR2 = array<int, 2>;
constexpr int MOD{1000000000 + 7};
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr int dx[4]{1, 0, -1, 0};
constexpr int dy[4]{0, 1, 0, -1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
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 (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
constexpr int div_roundup(int a, int b)
{
    return (a + b - 1) / b;
}
// vector<vector<int>> vec(n_rows, vector<int>(n_cols, value));
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(0);

    int n;
    cin >> n;
    vector<AR2> a(n);

    rep(i, n)
    {
        cin >> a[i][0] >> a[i][1];
    }

    sort(a.begin(), a.end(), [](const AR2 &x, const AR2 &y) { return x[1] < y[1]; });

    bool can = true;
    int time = 0;

    for (AR2 x : a)
    {
        time += x[0];
        if (time > x[1])
        {
            can = false;
            break;
        }
    }

    cout << (can ? "Yes" : "No") << endl;
}


Measured memory_bytes: 1792
N = input().split(" ")
TL = int(N[0])
TA = int(N[1])
AL = int(N[2])
AA = int(N[3])
a = 0

while a == 0:
  AL = AL - TA
  if AL <= 0:
    a = 1
    break
  TL = TL - AA
  if TL <= 0:
    a = 2
    break
if a == 1:
  print("Yes")
elif a == 2:
  print("No")


Measured memory_bytes: 9172
#include<stdio.h>
int main()
{
    int n,i;
    double a,h,s;
    while(scanf("%lf%d",&h,&n)!=EOF)
    {
        s=0;
        for(i=0;i<n;i++)
        {
            scanf("%lf",&a);
            s+=a;
        }
        if(s>=h)printf("Yes\n");
        else printf("No\n");
    }
}


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

int main(){
  int n, k; cin >> n >> k;
  string s; cin >> s;

  k--;
  if(s.at(k) == 'A') s.at(k) = 'a';
  if(s.at(k) == 'B') s.at(k) = 'b';
  if(s.at(k) == 'C') s.at(k) = 'c';
  cout << s;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <bitset>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>

using namespace std;
using ll=long long;
using vint=vector<int>;
using pint=pair<int,int>;

const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();

#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

void solve(){
	int N, K;
	cin >> N >> K;
	if(K == 1)
		cout << 0 << endl;
	else
		cout << N - K << endl;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <climits>

using namespace std;

int main() {
  string first;
  cin >> first;
  string second;
  cin >> second;

  bool ret = true;
  for (size_t i = 0; i < 3; ++i) {
    if (first[i] != second[2 - i]) {
      ret = false;
    }
    if (second[i] != first[2 - i]) {
      ret = false;
    }
  }

  if (ret) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<functional>
#include<stack>
#include<utility>
#include<map>
 
using namespace std;
 
int main() {
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b)*h / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 5005, mod = 1e9+7;

ll n, chi[N], fac[N] = {1}, fi[N] = {1}, dt[N][N];

vector<ll> adj[N], a;

void calc (ll C, ll P) {
	chi[C] = 1;
	for(auto &T : adj[C]) {
		if(T == P) continue;
		calc(T, C);
		chi[C] += chi[T];
	}
}

ll fcen (ll C, ll P) {
	ll mx = 0, i;
	for(auto &T : adj[C]) {
		if(T == P) continue;
		if(mx < chi[T]) {
			mx = chi[T];
			i = T;
		}
	}
	if(mx <= n/2) return C;
	return fcen(i, C);
}

ll pw (ll X, ll Y) {
	if(!Y) return 1;
	ll R = pw(X, Y/2);
	R = R * R % mod;
	if(Y&1) R = R * X % mod;
	return R;
}

ll cmb (ll X, ll Y) {
	if(X < Y || Y < 0) return 0;
	return fac[X] * fi[Y] % mod * fi[X-Y] % mod;
}

int main()
{
	scanf("%lld",&n);
	for(ll i=1;i<=n;i++) {
		fac[i] = fac[i-1] * i % mod;
		fi[i] = pw(fac[i], mod-2);
	}
	for(ll i=1;i<n;i++) {
		ll A, B;
		scanf("%lld%lld",&A,&B);
		adj[A].push_back(B);
		adj[B].push_back(A);
	}
	calc(1, 0);
	ll C = fcen(1, 0);
	for(auto &T : adj[C]) {
		if(chi[T] < chi[C]) a.push_back(chi[T]);
	}
	a.push_back(chi[1] - chi[C]);
	a.push_back(1);
	ll S = a[0], Z = a.size();
	dt[0][a[0]] = fac[a[0]];
	for(ll i=1;i<Z;i++) {
		for(ll j=0;j<a[i];j++) {
			for(ll k=0;k<=n;k++) {
				dt[i+j][k] = dt[i+j-1][k] * (S-j-k) + dt[i+j-1][k+1] * (k+1);
				dt[i+j][k] %= mod;
			}
		}
		for(ll k=n;k>=0;k--) {
			if(k >= a[i]-1) dt[i][k] = dt[i][k-a[i]+1] * a[i] % mod * fac[a[i]] % mod;
			else dt[i][k] = 0;
			if(k >= a[i]) dt[i][k] = (dt[i][k] + dt[i-1][k-a[i]] * fac[a[i]]) % mod;
		}
		for(ll j=1;j<a[i];j++) {
			for(ll k=n;k>=a[i]-j-1;k--) {
				dt[i][k] += dt[i+j][k-a[i]+j+1] * cmb(a[i], j+1) % mod * fac[a[i]] % mod * fi[j+1];
				dt[i][k] %= mod;
			}
		}
		S += a[i];
	}
	printf("%lld\n",(dt[Z-2][0]+dt[Z-1][0])%mod);
}


Measured memory_bytes: 196224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<static_cast<int>(n);++i)
#define per(i, n) for(int i=static_cast<int>(n)-1;i>=0;--i)
#define eee(a) (cerr<<"[@"<<__LINE__<<"] "<<(#a)<<": "<<(a)<<'\n');
#define ppp(a) (cout<<(a)<<'\n'); 
#define cop(a) for(auto x:(a)){cerr<<(x)<<'\n';}
using ll = long long;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll inverse(ll n,ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}
template<class T>inline bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename T>inline int bs(int g,int k,T c){while(abs(k-g)>1){int m=(g+k)/2;(c(m)?k:g)=m;}return k;}
template<typename T1,typename T2>ostream& operator<<(ostream& s,const pair<T1, T2>& p){return s <<"("<<p.first<<", "<<p.second<<")";}
template<typename T> ostream& operator<<(ostream& s,const vector<T>& v){s<<'[';for(size_t i=0;i<v.size();++i){s<<v[i];if(i<v.size()-1)s<<", ";}s<<']';return s;}
template<typename T> istream& operator>>(istream& s,vector<T>& v){for(T& x:v)s>>x;return s;}

int main(){
    cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    
    int n;
    cin >> n;

    vector<int> A(n), B(n);

    for(int i = 0; i < n; ++i){
        int x, y;
        cin >> x >> y;
        A[i] = x+y;
        B[i] = x-y;
    }
    int AM = *max_element(A.begin(), A.end());
    int Am = *min_element(A.begin(), A.end());
    int BM = *max_element(B.begin(), B.end());
    int Bm = *min_element(B.begin(), B.end());

    cout << max(AM-Am, BM-Bm) << '\n';

    return 0;
}


Measured memory_bytes: 4764