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

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

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

int main() {
  int S, W;
  std::cin >> S >> W;
  if(W >= S) {
    std::cout << "unsafe" << '\n';
  } else {
    std::cout << "safe" << '\n';
  }
}


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

using namespace std;

bool d[200004];

int main() {
	for (int i=2; i<=200000; i++) {
		if (!d[i]) {
			for (int j=i*2; j<=200000; j+=i) d[j]=1;
		}
	}
	int n; scanf("%d",&n);
	for (int i=n; i<=200000; i++) {
		if (d[i]==0) {
			printf("%d",i);
			return 0;
		}
	}
}

Measured memory_bytes: 384
use std::cmp::{max, min};
use std::io::{self, Read};
use std::iter::FromIterator;

#[allow(dead_code)]
struct Source {
    chars: Box<Iterator<Item = char>>,
}

#[allow(dead_code)]
impl Source {
    fn next_chr(&mut self) -> char {
        self.chars
            .by_ref()
            .skip_while(|c| char::is_whitespace(*c))
            .next()
            .expect("eof")
    }

    fn next_str(&mut self) -> String {
        let it = self
            .chars
            .by_ref()
            .skip_while(|c| char::is_whitespace(*c))
            .take_while(|c| !char::is_whitespace(*c));
        let s = String::from_iter(it);
        if s.is_empty() {
            panic!("eof")
        } else {
            s
        }
    }

    fn from_stdin() -> Self {
        let mut data = String::new();
        io::stdin().read_to_string(&mut data).expect("Input error");
        Self::from_str(&data)
    }

    fn from_str(s: &str) -> Self {
        let data = String::from(s);
        let chars = data.chars().collect::<Vec<char>>().into_iter();
        Source {
            chars: Box::new(chars),
        }
    }
}

#[allow(unused_macros)]
macro_rules! input {
    ($src:expr; $($elem:tt)*) => {
        input_inner!($src, $($elem)*)
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($src:expr) => {};
    ($src:expr,) => {};
    ($src:expr, $var:ident : mut $ty:tt $($rest:tt)*) => {
        let mut $var = parse!($src, $ty);
        input_inner!($src $($rest)*)
    };
    ($src:expr, $var:ident : $ty:tt $($rest:tt)*) => {
        let $var = parse!($src, $ty);
        input_inner!($src $($rest)*)
    };
}

#[allow(unused_macros)]
macro_rules! parse {
    ($src:expr, ( $($ty:tt),* )) => {
        ( $(parse!($src,$ty)),* )
    };
    ($src:expr, char) => {
        $src.next_chr()
    };
    ($src:expr, [ $ty:tt; $len:expr ]) => {
        (0..$len).map(|_| parse!($src,$ty)).collect::<Vec<_>>()
    };
    ($src:expr, $ty:tt) => {
        parse_str!($src,$ty)
    };
}

#[allow(unused_macros)]
macro_rules! parse_str {
    ($src:expr, chars) => {
        $src.next_str().chars().collect::<Vec<char>>()
    };
    ($src:expr, $ty:ty) => {
        $src.next_str().parse::<$ty>().expect("Parse error")
    };
}

fn main() {
    let mut src = Source::from_stdin();
    input! { src;
             t: f64, x: f64,
    }

    println!("{}", t / x);
}


Measured memory_bytes: 4352
<?php
//error_reporting(0);
//$N = (int)trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
list($K,$N) = explode(" ",trim(fgets(STDIN)));
$a = array_map('intval',explode(" ",trim(fgets(STDIN))));

$a[]=$a[0]+$K;
$dis=0;
for($i=0;$i<$N;$i++) {
  $dis = max($dis,$a[$i+1]-$a[$i]);
}
printf("%d\n",$K-$dis);


Measured memory_bytes: 27120
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main(){
  int x, a, b, c, d;
  cin >> x;
  d = x%10;
  c = x/10%10;
  b = x/100%10;
  a = x/1000;
    
  if(a+b+c+d==7) cout << a <<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<< endl;
  else if(a+b+c-d==7) cout << a <<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<< endl;
  else if(a+b-c+d==7) cout << a <<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<< endl;
  else if(a+b-c-d==7) cout << a <<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<< endl;
  else if(a-b+c+d==7) cout << a <<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<< endl;
  else if(a-b+c-d==7) cout << a <<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<< endl;
  else if(a-b-c+d==7) cout << a <<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<< endl;
  else if(a-b-c-d==7) cout << a <<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<< endl;
}

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

int main()
{
  int N ;
  cin>>N ;
  vector<int>A(N) ;
  for(int i=0;i<N;i++) cin>>A.at(i) ;
  
  for(int i=0;i<N;i++){
    if(A.at(i)%2==0){
      if(A.at(i)%3!=0&&A.at(i)%5!=0){
        cout<<"DENIED"<<endl ;
        return 0 ;
      }
    }
  }
  cout<<"APPROVED"<<endl ;
  
  return 0 ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m;i>n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
   lli A,B,L,R,N,M,K,sum=0,num=0,flag=0;
   cin >> N >> M;
   Vec(P,int,N,0);
   rep(i,0,N)cin >> P[i];
   Sort(P);
   num=1;
   if(N!=1)rep(i,0,M){
      if(P[N-num]<L){
         num=1;
         Sort(P);
      }
      P[N-num]/=2;
      if(num==1)L=P[N-1];
      num++;
   }
   else{
      rep(i,0,M){
         Sort(P);
         P[N-1]/=2;
      }
   }
   rep(i,0,N)sum+=P[i];
   Out(sum);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define PB push_back
#define MP make_pair
#define pri 1000000007
#define ftype  long double
#define endl '\n'
#define pr pair<ll,ll>
#define debug(x) cout<<#x<<" "<<x<<endl;
using namespace std;
void masterstroke(){
	ll n;cin>>n;
	ll a[n];
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}
	ll ans=0;
	for(ll i=1;i<n-1;i++){
		ll x=0;
		if(a[i]>a[i+1])x++;
		if(a[i]>a[i-1])x++;
		if(x==1)ans++;
	}
	cout<<ans<<endl;
}
int main(){
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 ll t=1;//cin>>t;
	 for(ll i=0;i<t;i++)masterstroke();
}

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

typedef struct {
	long long a;
	long long b;
	long long sa;
}pair_t;

int cmp(const void* p, const void* q) {
	return ((pair_t*)q)->sa - ((pair_t*)p)->sa;
}

int main(void) {
	long long n;
	pair_t pair[100001] = { 0 };
	long long ans = 0;
	long long ne_total = 0, po_total = 0;

	scanf("%lld", &n);
	for (int i = 0; i < n; i++)scanf("%lld", &pair[i].a);
	for (int i = 0; i < n; i++)scanf("%lld", &pair[i].b);

	for (int i = 0; i < n; i++) {
		pair[i].sa = pair[i].a - pair[i].b;
		if (pair[i].sa < 0)
			ne_total -= pair[i].sa, ans++;
		else po_total += pair[i].sa;
	}
	//for (int i = 0; i < n; i++) printf("pair[%d].sa=%lld\n", i, pair[i].sa);
	if (po_total < ne_total) printf("-1");
	else {		
		qsort(pair, n, sizeof(pair_t), cmp);
		//printf("ne_total=%lld\n", ne_total);
		for (int i = 0; ne_total > 0; i++) {
			ne_total -= pair[i].sa;
			ans++;
		}
		printf("%lld", ans);
	}
	return 0;
}


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

using namespace std;

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

	string s;
	cin >> s;

	if (s == "ARC")cout << "ABC" << endl;
	else { cout << "ARC" << endl; }

	return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <string.h>
#define N 1000
int main(){
  char T[N],P[N];
  int i,j,n,t,p;
  scanf("%s",T);
  scanf("%s",P);
  t=strlen(T);
  p=strlen(P);
  for(i=0;i<=t-p;i++){
    n=0;
    for(j=0;j<p;j++){
      if(T[i+j]!=P[j])
	n++;
    }
    if(n==0&&t>=p)
      printf("%d\n",i);
  }
  return 0;
}

Measured memory_bytes: 540
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
double nx[15],ny[15],dis[15][15],ans;
int sum=1,sum2,n,pos[15];
inline double sqr(double x){
    return x*x;
} 
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i){
        scanf("%lf%lf",&nx[i],&ny[i]);
        pos[i]=i;
        sum*=i;
    }
    sum2=sum;
    for(int i=1;i<=n;++i)
        for(int j=i+1;j<=n;++j)
            dis[i][j]=dis[j][i]=sqrt(sqr(nx[i]-nx[j])+sqr(ny[i]-ny[j]));
    do{
        for(int i=1;i<n;++i){
            ans+=dis[pos[i]][pos[i+1]];
            //cout<<pos[i]<<" "<<pos[i+1]<<" "<<dis[pos[i]][pos[i+1]]<<endl;
        }
        next_permutation(pos+1,pos+n+1);
    }while(--sum);
    printf("%.10lf",ans/sum2);
    return 0;
}

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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

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

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

    int n, m, p;
    while (cin >> n >> m >> p, n) {
        vector<int> x(n);
        rep(i, n) cin >> x[i];
        int sm = accumulate(all(x), 0);
        cout << (x[m-1] == 0 ? 0 : sm * (100 - p) / x[m-1]) << endl;
    }

}

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

#define REP(i, n) for (int i = (int)(m); i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)

using VI = vector<int>;
using PII = pair<int, int>;
using ll = long long;

int main()
{
    int a, p;
    cin >> a >> p;

    int ans = (a*3+p)/2;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,k;
    int ans = 0;
    cin >> a >> b >> c >> k;
    if(k<=a)
        cout << k << endl;
    else if(k>a && k <= a+b)
        cout << a << endl;
    else if(k>a+b && k<=a+b+c)
    {
        int rem = (a+b+c) - k;
        ans = a + (c-rem)*(-1);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

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

	int a = scan.nextInt();
	int b = scan.nextInt();
	int c = scan.nextInt();

	if(b-a == c-b){
	    System.out.println("YES");
	}else{
	    System.out.println("NO");
	}
    }
}


Measured memory_bytes: 21844
S = input()
s1 = int(S[:2])
s2 = int(S[2:])
flag1 = False
flag2 = False

if s1 != 00 and s1 < 13:
    flag1 = True

if s2 != 00 and s2 < 13:
    flag2 = True
    
if flag1 and flag2:
    print("AMBIGUOUS")
elif flag1 and not flag2:
    print("MMYY")
elif not flag1 and flag2:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    private static final long MOD = 1_000_000_007;

    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final String l = scanner.next();
        final int n = l.length();

        final long[] undetermined = new long[n];
        final long[] determined = new long[n];
        undetermined[0] = 2;
        determined[0] = 1;

        IntStream.range(1, n)
                .forEach(i -> {
                    determined[i] = determined[i - 1] * 3;
                    determined[i] %= MOD;
                    final int c = l.charAt(i) - '0';
                    if (c == 1) {
                        undetermined[i] = undetermined[i - 1] * 2;
                        undetermined[i] %= MOD;
                        determined[i] += undetermined[i - 1];
                        determined[i] %= MOD;
                    } else {
                        undetermined[i] = undetermined[i - 1];
                    }
                });

        System.out.println((undetermined[n - 1] + determined[n - 1]) % MOD);
    }
}


Measured memory_bytes: 31204
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,ans=0,c=1e9;
  cin >>n;
  vector<int>a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    c=min(c,a[i]);
    if(a[i]<=c){
      ans++;
    }
  }
  cout << ans <<"\n";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int a[105];
int main(){
	int n;
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%d", &a[i]);
	sort(a, a+n);
	printf("%d\n", a[n-1]-a[0]);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
template<class T>using vv = vector<vector<T>>;
#define in(v) v; cin >> v;
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)

template<int MOD> struct MInt {
  long long val;
  MInt(long long val = 0) : val(val % MOD) { if (val < 0) val += MOD; }
  MInt operator+(const MInt& n) const { return MInt(val) += n; }
  MInt operator*(const MInt& n) const { return MInt(val) *= n; }
  MInt& operator+=(const MInt& n) { val = (val + n.val) % MOD; return *this; }
  MInt& operator*=(const MInt& n) { val = (val * n.val) % MOD; return *this; }
  friend ostream& operator<<(ostream& os, const MInt& n) { os<<n.val; return os; }
  friend istream& operator>>(istream& os, MInt& n) { os>>n.val; return os; }
};
using mint = MInt<1000000007>;

template<class T>vector<vector<T>> matrixmul(vector<vector<T>> A, vector<vector<T>> B) {
  int N = A.size();
  int M = B[0].size();
  vector<vector<T>> ans(N, vector<T>(M));
  rep(i, N) rep(j, M) {
    T tmp = 0;
    rep(k, A[0].size())
      tmp += A[i][k] * B[k][j];
    ans[i][j] = tmp;
  }
  return ans;
}

template<class T>vector<vector<T>> matrixpow(vector<vector<T>> A, ll K) {
  if (K == 1)
    return A;
  if (K % 2 == 0)
    return matrixpow(matrixmul(A, A), K/2);
  else
    return matrixmul(matrixpow(matrixmul(A, A), K/2), A);
}

int main() {
  int in(N); ll in(K);

  vv<mint> A(N, vector<mint>(N));
  rep(i, N) rep(j, N)
    cin >> A[i][j];

  vv<mint> B = matrixpow(A, K);
  mint ans = 0;
  rep(i, N) rep(j, N)
    ans += B[i][j];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5248
package main

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

func main() {
	n := readi64() - 1

	str := ""
	for n >= 0 {
		flagment := n % 26
		n = n/26 - 1
		str = string('a'+flagment) + str
	}
	fmt.Println(str)
}

/*-------------------utilities-------------------*/

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func chmin(x *int, y int) bool {
	if *x > y {
		*x = y
		return true
	}
	return false
}

func chmax(x *int, y int) bool {
	if *x < y {
		*x = y
		return true
	}
	return false
}

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

func lcm(a, b int) int {
	return (a * b) / gcd(a, b)
}

func permutations(arr []int) [][]int {
	var helper func([]int, int)
	res := [][]int{}

	helper = func(arr []int, n int) {
		if n == 1 {
			tmp := make([]int, len(arr))
			copy(tmp, arr)
			res = append(res, tmp)
		} else {
			for i := 0; i < n; i++ {
				helper(arr, n-1)
				if n%2 == 1 {
					tmp := arr[i]
					arr[i] = arr[n-1]
					arr[n-1] = tmp
				} else {
					tmp := arr[0]
					arr[0] = arr[n-1]
					arr[n-1] = tmp
				}
			}
		}
	}
	helper(arr, len(arr))
	return res
}

func isPrime(n int) bool {
	if n == 1 {
		return false
	}
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return true
}

func divisor(n int) (res []int) {
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			res = append(res, i)
			if i*i != n {
				res = append(res, n/i)
			}
		}
	}
	sort.Ints(res)
	return
}

// func searchInts(a []int, k int) int {
// 	return binarySearch(len(a), func(i int) bool {
// 		return a[i] >= k
// 	})
// }

func binarySearch(n int, f func(int) bool) int {
	i, j := 0, n
	for i < j {
		h := int(uint(i+j) >> 1)
		if !f(h) {
			i = h + 1
		} else {
			j = h
		}
	}
	return i
}

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7
)

var (
	readString func() string
)

func init() {
	readString = newReadString(os.Stdin)
}

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

func readi64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readui64() uint64 {
	i, err := strconv.ParseUint(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


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

using i64 = int64_t;

constexpr i64 INF = 1e12;

int n;
vector<i64> v;
i64 dp[3003][3003]={0};

i64 dfs(int left, int right){
    if(left + right == n)return 0;
    if(dp[left][right] != INF)
            return dp[left][right];

    i64 res;
    if((left+right)%2 == 0){
        res = dfs(left+1, right) + v[left];
        res = max(res, dfs(left, right+1) + v[v.size()-right-1]);
    }else{
        res = dfs(left+1, right) - v[left];
        res = min(res, dfs(left, right+1) - v[v.size()-right-1]);
    }
    dp[left][right] = res;
    return res;
}

int main(){
    cin >> n;
    for(int i=0;i<n;++i){
        i64 tmp;
        cin >> tmp;
        v.push_back(tmp);
    }

    for(int i=0;i<=n;++i){
        for(int j=0;j<=n;++j){
            dp[i][j] = INF;
        }
    }

    cout << dfs(0, 0) << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, x, d;
    scanf("%d %d %d", &n, &x, &d);
    if (d == 0) {
        if (x == 0) {
            return printf("1"), 0;
        }
        return printf("%d", n + 1), 0;
    }
    ll res = 0;
    map <int, vector <pair <ll, ll> > > mp;
    for (int i = 0; i <= n; i++) {
        ll mn = (ll)i * x + (ll)i * (i - 1) / 2 * d;
        ll mx = (ll)i * x + (ll)i * (n + n - i - 1) / 2 * d;
        if (mn > mx) swap(mn, mx);
        mp[((mn%abs(d))+abs(d))%abs(d)].pb({mn, mx});
    }
    auto it = mp.begin();
    while (it != mp.end()) {
        sort(it->se.begin(), it->se.end());
        /*printf("%d: ", x.fi);
        for (auto y : x.se) {
            printf("%lld %lld\n", y.fi, y.se);
        }*/
        ll hold = -9e18, mx = hold, mn;
        for (auto y : it->se) {
            if (mx == hold) {
                mn = y.fi;
                mx = y.se;
                continue;
            }
            if (y.fi > mx) {
                res += (mx - mn) / abs(d) + 1;
                mn = y.fi;
                mx = y.se;
            } else {
                mx = max(mx, y.se);
            }
        }
        res += (mx - mn) / abs(d) + 1;
        it++;
    }
    printf("%lld", res);
    return 0;
}

Measured memory_bytes: 25564
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int a = in.nextInt() - 1;
        int b = in.nextInt() - 1;
        int c = in.nextInt() - 1;
        int d = in.nextInt() - 1;
        String s = in.next();
        char cs[] = s.toCharArray();

        boolean ok = true;
        for (int i = a; i <= c - 1; i++) {
            if (cs[i] == '#' && cs[i + 1] == '#') {
                ok = false;
            }
        }
        for (int i = b; i <= d - 1; i++) {
            if (cs[i] == '#' && cs[i + 1] == '#') {
                ok = false;
            }
        }

        if (ok && c > d) {
            ok = false;
            for (int i = b - 1; i <= d - 1; i++) {
                if (cs[i] == '.' && cs[i + 1] == '.' && cs[i + 2] == '.') {
                    ok = true;
                    break;
                }
            }
        }

        if (ok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 26668
#include<stdio.h>
#include<math.h>
int main()
{
      long long int n,d;
      scanf("%lld%lld",&n,&d);
      long long int x,y,ans=0;
      while(n--)
      {
            scanf("%lld%lld",&x,&y);
            long long int m;
            m=(x*x)+(y*y);
            double n;
            n=(double) (sqrt(m));
            if(n<=(double)d) ans++;
      }
      printf("%lld\n",ans);

      return 0;
}


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

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

int N,M;
bool used[5000];
set<int> G[555];
vector<edge> E;

int main(){
  cin >> N >> M;  
  for(int i=0;i<M;i++){
    int s,t; cin >> s >> t;
    --s; --t;
    E.push_back( edge(t,s) );
    G[s].insert( i );
    G[t].insert( i );
  }
  if( M == 0 ) {
    cout << 0 << endl;
    return 0;
  }
  bool ed = true;
  int res = 0;
  while( ed ){
    int minid=0;
    while( G[minid].empty() ) minid++;
    for(int i=0;i<N;i++){
      if( G[i].empty() ) continue;
      if( G[minid].size() > G[i].size()  ) minid = i;
    }
    //   cout << G[minid].size() << endl;
    res += G[minid].size()-1;
    for(auto it = G[minid].begin(); it != G[minid].end(); it++ ){
      used[*it] = true;
      // cout << "new " << *it << endl;
      for(int i=0;i<N;i++){
        if( i == minid ) continue;
        G[i].erase(*it);
      }
    }
    G[minid].clear();
    ed = false;
    for(int i=0;i<M;i++)
      if( !used[i] ) ed = true;
  }
  cout << res << endl;
}

Measured memory_bytes: 3420
#include <iostream>
#include <queue>

using namespace std;

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

    int n, m; cin >> n >> m;
    priority_queue<int> pq;
    for(int i = 0; i < n; ++i)
    {
        int x; cin >> x;
        pq.push(x);
    }

    for(int i = 0; i < m; ++i)
    {
        int x = pq.top();
        pq.pop();
        pq.push(x >> 1);
    }

    long long ans = 0;
    for(int i = 0; i < n; ++i)
    {
        ans += pq.top();
        pq.pop();
    }

    cout << ans;
    return 0;
}


Measured memory_bytes: 892
import collections
N = int(input())
lsA = list(map(int,input().split()))
counterA = collections.Counter(lsA)
lsn = list(counterA.values())
rep = 0
even = 0
for i in lsn:
    if i % 2 ==1:
        rep += i//2
    else:
        rep += (i-1)//2
        even += 1
rep += -(-even//2)
ans = N-rep*2
print(ans)

Measured memory_bytes: 22040
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
    int a, b, m;
    cin >> a >> b >> m;
    vector<int> A(a), B(b), x(m), y(m), c(m);
    for (int i = 0; i < a; i++)
        cin >> A[i];
    for (int i = 0; i < b; i++)
        cin >> B[i];
    for (int i = 0; i < m; i++)
        cin >> x[i] >> y[i] >> c[i];
    
    int minA = *min_element(A.begin(), A.end());
    int minB = *min_element(B.begin(), B.end());
    int ans = minA + minB;
    
    for (int i = 0; i < m; i++) {
        int cost = A[x[i]-1] + B[y[i]-1] - c[i];
        ans = min(ans, cost);
    }
    
    cout << ans << endl;
    
    return 0;
}


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


#define clr(arr,val) memset(arr,val ,sizeof arr)
typedef  long long ull;
typedef long long ll;


ll const oo=1e9 ;
int const SZ= (int)1e5+3;
const ll mod=(ll)1e9+7;


vector<int> adj[SZ];
//int arr[100];
int dp[SZ];
int n,m;

int solve(int i){

    int &ret=dp[i];
    if(~ret) return ret;
    int mx=0;
    for(int x: adj[i]){
        mx=max(mx,solve(x));
    }
    return ret=1+mx;
    
}
int main()
{
    
    cin>>n>>m;
    int u,v;
    for(int i=0;i<m;i++){
        cin>>u>>v; 
        adj[u].push_back(v);
    }
    clr(dp,-1);
    int mx=0;
    for(int i=1;i<=n;i++){
        mx=max(mx,solve(i));
    }
    
    cout<<mx-1<<endl;
    
    return 0;
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;

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

    map<char, ll> m;
    string march = "MARCH";
    int N; cin >> N;
    rep(i, N) {
        string S; cin >> S;
        m[S[0]]++;
    }
    ll ans = 0;
    REP(a, 0, 5) {
        REP(b, a+1, 5) {
            REP(c, b+1, 5) {
                ans += m[march[a]] * m[march[b]] * m[march[c]];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())

ans = 0
if x == y:
    ans = 0
elif x * y == 0:
    ans = abs(x) + abs(y) + (1 if x > y else 0)
elif x * y > 0:
    ans = abs(x - y) + (2 if x > y else 0)
else:
    ans = abs(x + y) + 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, a) for (int i = 0; i < (int)(a); i++)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
typedef long long ll;
template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v){stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v){if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.first>>v.second;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.first<<","<<v.second;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const vector<T>&a){ll res(0);for(auto&&x:a)res+=x;return res;}

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template <typename Head> void dump(Head &&head) {
  cerr << head;
  dump();
}
template <typename Head, typename... Tail>
void dump(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  dump(forward<Tail>(tail)...);
}
#define debug(...)                                                               \
  do {                                                                         \
    cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = ";                        \
    dump(__VA_ARGS__);                                                         \
  } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template <typename T> struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;
template <typename T> using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template <typename T> using Matrix = vector<vector<T>>;

const ll LINF = 1LL << 60;
const int INF = 1001001001;

/////////////////////////////////////////////////////////////////////

vector<ll> divisor(ll n)
{
  vector<ll> res;
  for (ll i=1; i*i<=n; i++) {
    if (n%i == 0) {
      res.push_back(i);
      if (i != n/i) res.push_back(n/i);
    }
  }
  sort(res.begin(), res.end());
  return res;
}

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

  vector<ll> d = divisor(2*n);

  ll ans = LINF;
  for (auto v:d) {
    vector<ll> a = {0, -1};
    vector<ll> b = {v, 2*n/v};
    auto p = crt(a,b);
    if (p.first > 0) mins(ans, p.first);
  }
  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 3792
n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
    if a[i] + a[i + 1] > x:
        ans += a[i + 1] + a[i] - x
        a[i + 1] = x - a[i]
        if a[i + 1] < 0:
            a[i + 1] = 0
print(ans)

Measured memory_bytes: 14540
#include<iostream>
using namespace std;
int main(){
    int face[6]={},n;
    for(int i=0;i<6;i++){
        cin >> face[i];
    }
    cin >> n;
    for(int i=0;i<n;i++){
        int num_up,num_front,dice[6][5]={{1,2,4,3,1},{0,3,5,2,0},{0,1,5,4,0},{0,4,5,1,0},{0,2,5,3,0},{1,3,4,2,1}};
        cin >> num_up >> num_front;
        int a=0;
        while(true){
            if(face[a]==num_up) break;
            a+=1;
        }
        int b=0;
        while(true){
            if(face[b]==num_front) break;
            b+=1;
        }
        int c=0;
        while(true){
            if(b==dice[a][c])break;
            c+=1;
        }
        cout << face[dice[a][c+1]]<<endl;
    }
    return 0;
}



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

int main() {
  long long x;
  scanf("%lld", &x);
  
  long long now = 100;
  int ans = 0;
  while (now < x) {
    long long interest = static_cast<long long>(floor(now * 0.01));
    now += interest;
    ans++;
  }

  printf("%d\n", ans);
  
  return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define mod 1000000007
#define pb push_back
#define pi pair<ll,ll>
#define vi vector<ll>
#define vpi vector< pi >
#define ff first
#define ss second
const int N=30;
vpi v[N];
int main()
{
	int l,x,y,p=0,add=0;
	cin>>l;
	for(int i=1;i<20;i++) v[i].pb({i+1,0});
	int j=1;
	for(int i=19;i>=0;i--)
	{
		if((l&(1<<i))&&add)
		{
			v[1+i].pb({20,add});
			add+=(1<<i);
		}
		else if(l&(1<<i))
		{
			for(int j=0;j<i;j++)
			{
				if(j==i-1)
				v[j+1].pb({20,(1<<j)});
				else
				v[j+1].pb({j+2,(1<<j)});
			}
			add+=(1<<i);
		}
	}
	//cout<<add<<"\n";
	add=0;
	for(int i=1;i<=20;i++) add+=v[i].size();
	cout<<"20 "<<add<<"\n";
	for(int i=1;i<=19;i++)
	{
		for(auto z:v[i])
			cout<<i<<" "<<z.ff<<" "<<z.ss<<"\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<climits>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>

#define	push_front	pf
#define	push_back	pb
#define	make_pair	mp

using namespace std;

typedef	pair<int,int>	pii;

int main()
{
	for(int n,m;cin>>n>>m,n||m;){
		int t[100]; for(int i=0;i<n;i++)	cin>>t[i];
		int h[100];	for(int i=0;i<m;i++)	cin>>h[i];

		int tsum=accumulate(t,t+n,0);
		int hsum=accumulate(h,h+m,0);

		if((tsum+hsum)%2==1)	cout<<-1<<endl;
		else{
			sort(t,t+n);
			sort(h,h+m);
			int tswp,hswp,swpsum=1000;
			for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					if(tsum-t[i]+h[j]==hsum-h[j]+t[i] && swpsum>t[i]+h[j]){
						tswp=t[i];
						hswp=h[j];
						swpsum=t[i]+h[j];
					}
				}
			}
			if(swpsum==1000)	cout<<-1<<endl;
			else				cout<<tswp<<' '<<hswp<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 0
#ifndef LOCAL
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define sim template < class c
#define int long long
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef tree< pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
signed main(){
    fastio
    int a ;
    cin >> a ;
    cout << 1 - a << endl;
    return 0; 
}

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

int main(){
  vector<vector<int>> A(3,vector<int>(3));
  vector<vector<bool>> B(3,vector<bool>(3,false));
  for(vector<int> &i:A)
    for(int &j:i)
      cin>>j;
  int N;
  cin>>N;
  for(int i=0;i<N;i++){
    int j;
    cin>>j;
    for(int k=0;k<3;k++)
      for(int l=0;l<3;l++)
        if(A[k][l]==j)
          B[k][l]=true;
  }
  for(int i=0;i<3;i++){
    if(B[i][0] && B[i][1] && B[i][2]){
      cout<<"Yes"<<endl;
      return 0;
    }
    if(B[0][i] && B[1][i] && B[2][i]){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  if((B[0][0] && B[1][1] && B[2][2]) || (B[0][2] && B[1][1] && B[2][0])){
    cout<<"Yes"<<endl;
  }else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();
    int k = sc.nextInt();
    int q = sc.nextInt();

    int[] scores = new int[n];

    for (int i = 0; i < q; i++) {
      int a = sc.nextInt() - 1;
      scores[a]++;
    }

    for (int i = 0; i < n; i++) {
      int p = k - (q - scores[i]);
      if (p > 0) {
        os.println("Yes");
      } else {
        os.println("No");
      }
    }
  }

}

Measured memory_bytes: 68240
import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
MOD = 10**9+7

N = int(input())

a = []
for i in range(N):
    ab = list(map(int,(input().split())))
    a.append(ab)

if N%2 == 1:
    a.sort()
    l = a[(N-1)//2][0]
    #print(a)
    a.sort(key=lambda x:x[1])
    r = a[(N-1)//2][1]
    print(r-l+1)
else:
    a.sort()
    l1 = a[N//2-1][0]
    r1 = a[N//2][0]
    #print(a)
    a.sort(key=lambda x:x[1])
    l2 = a[N//2-1][1]
    r2 = a[N//2][1]
    c = l1 + r1
    d = l2 + r2
    #print(l1,l2,r1,r2)
    print(d-c+1)

Measured memory_bytes: 114568
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
#include <string>
#include <unordered_map>
#include <map>
#include <queue>
#include <set>
#include <stack>

using namespace std;

#define long long long
#define fi first
#define se second
typedef pair<int,int> ii;

vector<ii> vec;
vector<ii> ans;
int pas[100003];

int main()
{
	// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	// freopen("input.in", "r", stdin);

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

	if((n&-n) == n)
	{
		printf("No\n");
		return 0;
	}
	vec.push_back({1,1});
	int lar = 0;
	for(int i = 2; i <= n; i++)
	{
		// for(auto it : vec) printf("%d|%d ", it.fi, it.se);
		// 	printf("\n");
		if((i&-i) == i)
		{
			lar = i;
			ans.push_back({i/2, i});

			for(auto &it : vec)
				it.fi ^= i;
			vec.push_back({i,i});
			sort(vec.begin(), vec.end());
		}
		else
		{
			ans.push_back({vec[i-lar].se, i+n});
			ans.push_back({lar, i});
			pas[vec[i-lar].se] = i+n;
			pas[lar] = i;
			vec.push_back({i^lar, i});
		}
	}
	for(int i = 1;  i <= n; i = i+i)
	{
		if(pas[i] <= n)
			ans.push_back({i+n, pas[i]+n});
		else
			ans.push_back({i+n, pas[i]-n});
	}

	printf("Yes\n");
	for(auto i : ans) printf("%d %d\n", i.fi, i.se);
}










Measured memory_bytes: 5480
#include <bits/stdc++.h>
#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(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
 
struct segtree{
	using D = int;
	D inf = 1e9;
 
	int N;
	vector<D> val;
 
	segtree(){}
	segtree(int n){
		N=1;
		while(N<n) N*=2;
		val.assign(N*2,inf);
	}
	segtree(const vector<D>& ds){
		int n = ds.size();
		N=1;
		while(N<n) N*=2;
		val.assign(N*2,inf);
		rep(i,n) val[i+N] = ds[i];
		for(int i=N-1;i>0;i--) val[i] = min(val[i*2],val[i*2+1]);
	}
	void assign(int k,D d){
		k+=N;
		chmin(val[k],d);
		k/=2;
		while(k){
			val[k] = min(val[k*2],val[k*2+1]);
			k/=2;
		}
	}
	D getmin(int a,int b){
		D res = inf;
		a+=N,b+=N;
		while(a<b){
			if(a&1) chmin(res,val[a++]);
			if(b&1) chmin(res,val[--b]);
			a/=2,b/=2;
		}
		return res;
	}
};
 
int N;
int Q;
const int MN = 200010;
int b[MN];
int num0[MN],num1[MN];
int main(){
	cin>>N;
	rep(i,N) cin>>b[i];
	b[N] = 1;
	N++;
	rep(i,N){
		if(b[i]==0) num0[i+1]=1;
		else num1[i+1]=1;
	}
	rep(i,N){
		num0[i+1] += num0[i];
		num1[i+1] += num1[i];
	}
	cin>>Q;
	using P = pair<int,int>;
	vector<P> ps;
	rep(i,Q){
		int l,r;
		cin>>l>>r;
		l--;
		ps.pb(P(l,r));
	}
	ps.pb(P(N-1,N));
	sort(all(ps));
 
	segtree seg0(N),seg1(N);
 
	seg0.assign(0,0);
	seg1.assign(0,0);
 
	int ans = 0;
 
	for(P p:ps){
		int l = p.fs, r = p.sc;
		int val = 1e9;
		chmin(val,seg0.getmin(l,r)+num0[r]);
		chmin(val,seg1.getmin(0,l)+num1[l]+num0[r]-num0[l]);
		seg0.assign(r,val-num0[r]);
		seg1.assign(r,val-num1[r]);
		ans = val;
	}
	cout << ans << endl;
}

Measured memory_bytes: 8432
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//変数
LL N, M;






//サブ関数
//入力
void input()
{
	cin >> N >> M;
}


//計算
void calc()
{
	LL ans = 0;
	//ans += 2 * (N - 1);
	//ans += 2 * (M - 1);
	if (N == 1 && M == 1) {
		cout << 1 << endl;
	}
	else if (min(N, M) == 1) {
		cout << max(N, M) - 2 << endl;
	}
	else {
		cout << (N - 2)*(M - 2) << endl;
	}
	//ans += (N - 2)*(M - 2);
//	cout << ans << endl;
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Measured memory_bytes: 256
//author:emre yazicioglu

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define fori(a,b,c) for(ll a = b;a < ll(c);a++)
#define ford(a,b,c) for(ll a = b;a >= ll(c);a--)
#define pb emplace_back

const int N = 2e6 + 7;
ll n,m,k,ans,cur,ar[N];
string str;
vector<ll> v;

int main(){

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

	// freopen("in.txt","r",stdin);
	// freopen("out.txt","w",stdout);
	
	cin >> n >> m >> k;
	cout << max(0ll, k - (n - m));


}

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

// 根付き木の構成

void dfs (Graph &G, Graph &down, long long x, long long px) {
  
  for (long long nx : G[x]) {
    if (nx != px) {
      down[x].push_back(nx);
      dfs(G, down, nx, x);
    }
  }
  
}

// main関数

int main () {
  
  long long MOD = 1000000000 + 7;
  
  // 入力
  
  long long N, K;
  cin >> N >> K;
  Graph G(N);
  
  for (long long i = 0; i < N - 1; i++) {
    long long a, b;
    cin >> a >> b;
    G[a - 1].push_back(b - 1);
    G[b - 1].push_back(a - 1);
  }
  
  // dfs
  
  Graph down(N);
  
  dfs(G, down, 0, -1);
  
  // 計算
  
  long long ans = K;
  
  for (long long i = 0; i < N; i++) {
    
    if (down[i].size() == 0) continue;
    
    else if (i == 0) {
      
      if (down[i].size() > K - 1) {
        cout << 0 << endl;
        return 0;
      }
      
      else {
        for (long long j = 0; j < down[i].size(); j++) {
          ans *= (K - 1 - j);
          ans %= MOD;
        }
      }
      
    }
    
    else {
      
      if (down[i].size() > K - 2) {
        cout << 0 << endl;
        return 0;
      }
      
      else {
        for (long long j = 0; j < down[i].size(); j++) {
          ans *= (K - 2 - j);
          ans %= MOD;
        }
      }
      
    }
    
  }
  
  // 出力
  
  cout << ans << endl;
  return 0;
  
}

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

typedef long long ll;


int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	ll a;
	while(cin>>a){
		ll sum=0,temp=a;
		while(temp){
			sum+=temp%10;
			temp/=10;
		}
		if(a%sum==0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Data.Array
main = do
  [n,m] <- map read . words <$> getLine
  abs <- replicateM m $ map read . words <$> getLine
  let a = accumArray (flip (:)) [] (1,n) [x | [a,b] <- abs, x <- [(a,b),(b,a)]]
      f i v | length v == n-1 = 1
            | otherwise = sum [f j (i:v) | j <- a!i, notElem j v]
  print $ f 1 []

Measured memory_bytes: 892
using System;

class Program
{
  static void Main(string[] args)
  {
    string[] input = Console.ReadLine().Split(' ');
    int a = int.Parse(input[0]);
    int b = int.Parse(input[1]);
    int c = int.Parse(input[2]);
    int d = int.Parse(input[3]);
    
    int ab, bc, ac;
    if(a < b) ab = b - a;
    else ab = a - b;
  
    if(b < c) bc = c - b;
    else bc = b - c;
  
    if(a < c) ac = c - a;
    else ac = a - c;
  
    if(ac <= d || (ab <= d && bc <= d)) Console.WriteLine("Yes");
    else Console.WriteLine("No");
  }
}

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


int main(){
    int N; cin >> N;
    vector<int> a(N);
    for(int i=0; i<N; i++) cin >> a[i];
    
    int cnt=0;
    for(int i=0; i<N; i++){
        while(1){
            if(a[i]%2==0){
                cnt++;
                a[i] /= 2;
            }
            else {
                break;
            }
        }
    }
    
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<string>
#include<sstream>
#include<cctype>
#include<map>
#include<stack>
#include<queue>
#include<cstdlib>
#include<ctime>
using namespace std;
#define INF 0x3f3f3f3f
typedef long long ll;
int gcd(int a, int b){return b==0?a:gcd(b,a%b);}

const int MOD = 1e9 + 7;

int main()
{
//    freopen("input1.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int n, x, k = 0;
    ll ans = 1;
    scanf("%d", &n);
    while(n--)
    {
        scanf("%d", &x);
        k++;
        if(x < 2 * k - 1)
        {
            ans = ans * k % MOD;
            k--;
        }
    }
    for(int i = 2; i <= k; i++)
        ans = ans * i % MOD;
    printf("%d\n", (int)ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int t, sequence, maxS, aux;
int main(){
	//ios::sync_with_stdio(0), cin.tie(0);
	//cout<< fixed<< setprecision(10) << x << endl;
	cin>>t;
	vector<int> arr;
	for(int a = 0; a < t; a++){
        cin>>aux;
        arr.push_back(aux);
	}
	for(int a = 1; a < t; a++){
        if(arr[a - 1] >= arr[a])sequence++;
        else{
            maxS = max(maxS, sequence);
            sequence = 0;
        }
	}
	maxS = max(maxS, sequence);
	cout<<maxS<<endl;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() 
{
    ll n;
    string s;
    cin>>n>>s;
    ll mv=0;
    for(ll i=0;i<n;i++)
    {
        map<char,bool> m1;
        map<char,bool> m2;
        ll c=0;
        for(ll j=0;j<=i;j++)
        {
            m1[s[j]]=1;
        }
        for(ll j=i+1;j<n;j++)
        {
            m2[s[j]]=1;
        }
        for(ll j=0;j<26;j++)
        {
            c+=(m1['a'+j]&m2['a'+j]);
        }
        mv=max(c,mv);
    }
    cout<<mv<<endl;
    return 0;
}


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

int main() {
	long long int n, k;
	cin >> n >> k;
	if(k >= n){
		cout << "0";
		return 0;
	}
	long long int a[n];
	for(long long int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a, a+n);
	long long int sum = 0;
	for(int i = 0; i  < n - k; i++){
		sum += a[i];
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30 - 1)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

vector<int> eratosthenes(int N) {
    vector<int> res(N + 1, 1);
    res[0] = 0;
    res[1] = 0;
    for (int i = 2; i * i <= N; i++) {
        if (res[i] == 0)
            continue;
        for (int j = i; i + j <= N; j += i) {
            res[i + j] = 0;
        }
        return res;
    }
}

signed main() {
    cin >> N;
    vi a(N);
    cin >> a;
    vi b = a;
    sort(ALL(a));
    UNIQUE(a);
    int mx = *max_element(ALL(a));
    vi res(mx + 1, 1);
    vi check(mx + 1, 0);
    REP(i, N) {
        check[b[i]]++;
    }
    REP(i, a.size()) {
        if (res[a[i]] == 0)
            continue;
        for (int j = a[i]; a[i] + j < res.size(); j += a[i]) {
            res[a[i] + j] = 0;
        }
    }
    dump(res);
    REP(i, a.size()) {
        if (res[a[i]] == 1 && check[a[i]] == 1) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 12696
# Python3 (3.4.3)
import sys
input = sys.stdin.readline
from math import ceil,floor

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
A = [int(input()) for _ in range(5)]

total = 0
rem = 10
for a in A:
    total += ceil(a/10)*10
    rem = min(rem, (a-1)%10+1)

print(total-10+rem)

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

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    unordered_map<ll, ll> counter;
    rep(i, n) {
        cin >> a[i];
        counter[a[i]]++;
    }
    ll ans = 0;
    for (auto p : counter) {
        ans += p.second * (p.second - 1) / 2;
    }
    rep(i, n) {
        ll diff = counter[a[i]] * (counter[a[i]] - 1) / 2;
        diff -= (counter[a[i]] - 1) * (counter[a[i]] - 2) / 2;
        cout << ans - diff << endl;
    }
}

Measured memory_bytes: 10568