akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value


void solve() {

	int N;
	string s;
	cin >> N >> s;

	int r = 0;
	int b = 0;

	for (int i = 0; i < N; i++) {
		if (s[i] == 'R') r++;
		else b++;
	}

	if (r > b) cout << "Yes" << endl;
	else cout << "No" << endl;

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

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

int main(){
  
 string N; cin >> N;
 
  if(N[0] == '9' || N[1] == '9'){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
   
  return 0;
}
  

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int a= 0,b = 0,c = 0, d = 0;
    int ans = 0;

    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(a<b){
        ans += a;
    }else{
        ans += b;
    }
    if(c<d){
        ans += c;
    }else{
        ans += d;
    }
    printf("%d\n",ans);
    return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, m;
string str;

int main(){
	cin >> n;
	
	vector<P> ans;
	if(n%2 == 1){
		for(ll i = 1; i <= n-1; i++){
			ans.push_back(P(i, n));
		}
		n--;
	}
	
	for(ll i = 1; i <= n; i++){
		for(ll j = 1; j < i; j++){
			if(i+j != n+1){
				ans.push_back(P(j, i));
			}
		}
	}
	
	cout << ans.size() << endl;
	for(ll k = 0; k < ans.size(); k++){
		cout << ans[k].first << " " << ans[k].second << endl;
	}
	return 0;
}

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

long long sx, sy, tx, ty;

int main(){
	cin >> sx >> sy >> tx >> ty;

	string str = "";

	str += "L";
	for(int i = 0; i <= ty - sy; i++){
		str += "U";
	}
	for(int i = 0; i <= tx - sx; i++){
		str += "R";
	}
	str += "D";

	for(int i = 0; i < tx - sx; i++){
		str += "L";
	}
	for(int i = 0; i < ty - sy; i++){
		str += "D";
	}

	for(int i = 0; i < tx - sx; i++){
		str += "R";
	}
	for(int i = 0; i < ty - sy; i++){
		str += "U";
	}


	str += "R";
	for(int i = 0; i <= ty - sy; i++){
		str += "D";
	}

	for(int i = 0; i <= tx - sx; i++){
		str += "L";
	}
	str += "U";
	cout << str << endl;

}



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

int main() {
  int a, b;
  cin >> a >> b;
  int cnt = 0;
  for (int i = a; i <= b; i++) {
    if ( (i / 10000) == (i % 10) && ((i / 1000) % 10) == ((i / 10) % 10) ) {
      cnt ++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn main(){
    let n = read_as_vec::<usize>()[0];
    let p = read_as_vec::<u32>();
    let mut tmp = p.clone();
    tmp.sort();

    if p.into_iter().zip(tmp.into_iter()).filter(|x| x.0 != x.1).count() < 3{
        println!("YES");
    }else{
        println!("NO");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main(){
long long n,a,sum=0;
  cin>>n;
  vector<long long> v(n);
  for(long long i=0;i<n;i++){
  cin>>v[i];
  }
  for(long long j=0;j<n-1;j++){
    a+=v[j];
    a%=1000000007;
  sum+=v[j+1]%1000000007*a;
    sum%=1000000007;
  }
  cout<<sum;
return 0;
}

Measured memory_bytes: 4796
import math
def main():
    a,b,c = [int(x) for x in input().split()]
    k = int(input())
    k_b = max(0, math.floor(math.log2(a / b))+1) 
    k_c = max(0, math.floor(math.log2(b * math.pow(2, k_b) / c)) + 1)
    #print(k_b, k_c)
    print('Yes' if k >= k_b + k_c else 'No')


if __name__ == "__main__":
    main()

Measured memory_bytes: 9196
$mod = 998_244_353

blocks, colors, k = gets.split.map(&:to_i)

def modpow(x, y)
  res = 1

  while y != 0 do
    res = (res * x) % $mod if y & 1 != 0
    x = (x * x) % $mod
    y = y >> 1
  end

  return res
end

fac = Array.new(blocks + 1) { 0 }
ifac = Array.new(blocks + 1) { 0 }

fac[0] = 1
ifac[0] = 1

blocks.times do |i|
  fac[i + 1] = ((fac[i] * (i + 1)) % $mod)
  ifac[i + 1] = ((ifac[i] * modpow(i + 1, $mod - 2)) % $mod)
end

res = 0

(k+1).times do |i|
  comb_n = blocks - 1
  comb_k = i
  comb = (ifac[comb_n - comb_k] * ifac[comb_k] * fac[comb_n]) % $mod

  res += (comb * colors * modpow(colors - 1, blocks - i - 1)) % $mod
  res %= $mod
end

puts res

Measured memory_bytes: 17404
#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;
	cin >> N;
	vector<int> a(N);
	rep(i, N) cin >> a[i];

	int count = 1;
	rep(i, N) {
		if (a[i] == count) {
			count++;
		}
	}
	if (count == 1) {
		cout << -1 << endl;
	}
	else {
		cout << N - (count - 1) << endl;
	}

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
// cd test ; rm -R ./*; cd ..

int main(void) {
  int n;
  cin >> n;
  ll a[n], b[n], c[n];
  rep (i, n) {
    cin >> a[i];
    b[i] = a[i]; c[i] = a[i];
  }

  ll ans1 = 0, ans2 = 0;

  if (b[0] <= 0 ) {
    
    ans1 += abs(1 - b[0]);
    b[0] = 1;
  }
  ll now = b[0];
  for (int i = 1; i < n; i++) {
    now = now + b[i];
    if (i % 2 == 1) {
      if (now < 0) continue;
      else {
        ans1 += now + 1;
        now = -1;
      }
    }
    else {
      if (now > 0) continue;
      else {
        ans1 += 1 - now;
        now = 1;
      }
    }
  }

  if (c[0] >= 0) {
    
    ans2 += c[0] + 1;
    c[0] = -1; 
  }
  now = c[0];
  for (int i = 1; i < n; i++) {
    now = now + c[i];
   
    if (i % 2 == 1) {
      if (now > 0) continue;
      else {
        ans2 += 1 - now;
        now = 1;
      }
    }
    else {
      if (now < 0) continue;
      else {
        ans2 += now + 1;
        now = -1;
      }
    }
  }

 
  cout << min(ans1, ans2) << endl;

  return 0;
}

Measured memory_bytes: 2560
void main() {
	auto O = rs, E = rs;
	foreach(i, v; E) {
		write(O[i]);
		write(v);
	}
	if(O.length - E.length == 1) writeln(O[$-1]);
	else writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

int main() {

    int M, D;
    cin >> M >> D;
    int counter = 0;
    for(int i=1;i<=D;i++){
        int a = (i/10)*(i%10);
        if(a <= M && a >=1 && (i/10)>=2 && (i%10)>=2){
            counter++;
        }
    }
    cout << counter << endl;
}


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

int main()
{
  int N,a,b,c,k;
  cin>>N;
  a=N%10;
  k=N/10;
  b=k%10;
  c=N/100;
if(a==7||b==7||c==7)
cout<<"Yes";
else
cout<<"No";
return 0;
}


Measured memory_bytes: 3636
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)



h1,h2 = map(int,input().split())
k1,k2 = map(int,input().split())
a,b,c,d = map(int,input().split())

A = a*h1+(h1//10)*c+b*h2+(h2//20)*d
B = a*k1+(k1//10)*c+b*k2+(k2//20)*d

if A > B:
    print("hiroshi")
elif A < B:
    print("kenjiro")
else:
    print("even")



Measured memory_bytes: 13852
#include<stdio.h>
int main()

{
	int N;
	scanf("%d", &N);
	
	double ma = N / 4;
	int wa;
	int c = 0;
	if(N % 4 == 0) printf("Yes");
  else
  {
	for(wa = 0; wa <= ma -1; wa++)
	{
		if(N % 7 == 0){
          c++;
		}
        N = N - 4;
	}
	
	if(c > 0) 	printf("Yes");	
	else printf("No");
  }
		return 0;
}

Measured memory_bytes: 128
class Queue:
    class Node:
        def __init__(self, key):
            ## self.key, self.next
            self.key = key
            self.next = None

    def __init__(self, N):
        self.head = None
        self.tail = None
        self.size = 0
        self.N = N

    def push(self, x):
        if self.size >= self.N:
            print 'error: size is N'
            return None
        self.size += 1
        node = self.Node(x)
        if self.size == 1:
            self.head = node
            self.tail = self.head
            #print 'add (zero banme-no queue):', self.head.key
        else:
            self.tail.next = node
            self.tail = node
            #print 'add:', self.tail.key

    def pop(self):
        if self.size < 1:
            print 'error: size is 0'
            return None
        self.size -= 1
        x = self.head.key
        self.head = self.head.next
        #print 'pop', x
        return x

    def get_size(self):
        return self.size

    def PrintAll(self):
        c_node = self.head
        while c_node is not None:
            print c_node.key,
            c_node = c_node.next
        print
    def get_head(self):
        return self.head.key

N, C, K = map(lambda x:int(x), raw_input().split())

T_raw=[]
for i in range(N):
    T_raw.append(int(raw_input()))

T_raw.sort()
T = Queue(N)
for i in range(N):
    T.push(T_raw[i])

result=0
while 1:
    #T.PrintAll()
    Bus=[]
    while 1:
        Bus.append(T.pop())
        if T.get_size() == 0 or Bus[0]+K < T.get_head() or len(Bus) == C:
            result+=1
            break
        
    if T.get_size() == 0:
        break
        
print result

Measured memory_bytes: 44660
import sys
N, K = map(int, input().split())
H = list(map(int, input().split()))
if N<=K:
    print(0)
    sys.exit()
dp = [[[float('inf')]*(K+2) for i in range(N+2)] for j in range(N+1)]
dp[0][0][0] = H[0]
dp[0][-1][1] = 0
for i in range(N-1):
    for j in range(i+1):
        for k in range(K+1):
            if H[j]>H[i+1]:
                dp[i+1][j][k+1] = min(dp[i][j][k], dp[i+1][j][k+1])
                dp[i+1][i+1][k] = min(dp[i][j][k], dp[i+1][i+1][k])
            else:
                dp[i+1][i+1][k] = min(dp[i+1][i+1][k], dp[i][j][k]+H[i+1]-H[j])
                dp[i+1][j][k+1] = min(dp[i][j][k], dp[i+1][j][k+1])
    for k in range(K):
        dp[i+1][-1][k+1] = min(dp[i][-1][k], dp[i+1][-1][k+1])
        dp[i+1][i+1][k] = min(dp[i+1][i+1][k], dp[i][-1][k]+H[i+1])

ans = float('inf')
for i in range(K+1):
    res = min(dp[N-1][j][i] for j in range(N))
    ans = min(ans, res)
print(ans)


            











    

    

        






Measured memory_bytes: 369544
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		FastScanner fs = new FastScanner();
		int noOfIt = fs.nextInt();
		int capacity = fs.nextInt();
		int w[] = new int[noOfIt];
		int[] pr = new int[noOfIt];
		for (int i = 0; i < noOfIt; i++) {
			w[i] = fs.nextInt();
			pr[i] = fs.nextInt();

		}
		Long[][] dp = new Long[noOfIt][capacity+1];
		System.out.println(getMaxProfit(capacity, 0, w, pr, dp, noOfIt));
	}

	private static long getMaxProfit(int capacity, int idx, int[] w, int[] pr, Long[][] dp, int noOfIt) {
		// TODO Auto-generated method stub

		if (idx >= noOfIt || capacity <= 0)
			return 0;
		if(dp[idx][capacity]!=null)
			return dp[idx][capacity];
		long p1 = 0;
		if (capacity >= w[idx]) {
			p1 = pr[idx] + getMaxProfit(capacity - w[idx], idx + 1, w, pr, dp, noOfIt);
		}
		long p2 = getMaxProfit(capacity, idx + 1, w, pr, dp, noOfIt);

		dp[idx][capacity] = Math.max(p1, p2);

		return dp[idx][capacity];

	}

}

class FastScanner {
	StringTokenizer tok = new StringTokenizer("");
	BufferedReader in;

	FastScanner() {
		in = new BufferedReader(new InputStreamReader(System.in));
	}

	String next() throws IOException {
		while (!tok.hasMoreElements())
			tok = new StringTokenizer(in.readLine());
		return tok.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}
}

Measured memory_bytes: 290528
// to format a document: ctrl + K -> ctrl + D

#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

int main() {
    int R, G, B, N;
    cin >> R >> G >> B >> N;

    int ans = 0;
    for (int i = 0; i <= N; i += R) {
        for (int j = 0; j <= N - i; j += G) {
            if ((N - i - j) % B == 0) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int main(void){

	int N; cin >> N;
	vector<ll> A(N);
	REP(i,N) cin >> A[i];

	int cnt = 0;
	ll sum = 0;
	ll min_value = 1e9;
	REP(i,N){
		if(A[i] < 0) cnt++;
		sum += abs(A[i]);
		min_value = min(abs(A[i]), min_value);

	}

	if(cnt % 2 == 0) cout << sum << endl;
	else cout << sum - min_value * 2 << endl;



	return 0;

}


Measured memory_bytes: 1024
use std::collections::HashMap;
use std::hash::Hash;
// stdin
macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

// input
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

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

test! {
r"10
aabbbbaaca
" => r"5",

r"5
aaaaa
" => r"1",

r"20
xxzaffeeeeddfkkkkllq
" => r"10"
}

fn solve(src: &str) -> String {
    input! {
        source=src,
        n:i32,
        s:String,
//        a:[char;n],
    };

    let s: String = s;
    let mut vec= s.as_bytes().to_vec();
    vec.dedup();

    format!("{}", vec.len())
}

fn do_solve(a: Vec<i32>) {

}


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



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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)

int main() {
    std::cout<<std::fixed<<std::setprecision(5);
    int n; cin >> n;
    vector<int> v(n);

    rep(i, n) cin >> v[i];
    priority_queue<double , vector<double >, greater<double>> pq;
    rep(i, n) {
        pq.push(v[i]);
    }

    while(!pq.empty()) {
        auto first = pq.top();
        pq.pop();
        if(pq.empty()) {
            cout << first << endl;
            return 0;
        }
        auto second = pq.top();
        pq.pop();
        auto new_item = (first+second)/2.0;
        pq.push(new_item);
    }

    return 0;
}


Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N,M;
	cin >> N >> M;
	vector<LL> X(N);
	vector<LL> Y(M);
	for(int i=0;i<N;++i){
		cin >> X[i];
	}
	for(int i=0;i<M;++i){
		cin >> Y[i];
	}
	vector<LL> sumX(N,0);
	vector<LL> sumY(M,0);
	sumX[N-1] = X[N-1];
	for(int i=N-2;i>=0;--i){
		sumX[i] = sumX[i+1] + X[i];
		sumX[i] %= MOD;
	}
	sumY[M-1] = Y[M-1];
	for(int i=M-2;i>=0;--i){
		sumY[i] = sumY[i+1] + Y[i];
		sumY[i] %= MOD;
	}
	LL XX = 0;
	for(int i=0;i<N-1;++i){
		XX += sumX[i+1] - X[i]*(N-1-i);
		XX = (XX+MOD)%MOD;
	}
	LL YY = 0;
	for(int i=0;i<M-1;++i){
		YY += sumY[i+1] - Y[i]*(M-1-i);
		YY = (YY+MOD)%MOD;
	}
	cout << (XX*YY)%MOD << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 3456
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    int a,b;
    cin >> a >> b;

    int count=0;
    for(int i=a;i<=b;i++){
        string s=to_string(i);
        if(s[0]==s[4] && s[1]==s[3])count++;
    }

    cout << count << endl;

    return 0;
}


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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayLong();
            var K = input[0];
            var A = input[1];
            var B = input[2];
            var ans = 1L;
            if (A - 1 >= K) { ans += K; Console.WriteLine(ans); return; }
            else { ans += A - 1; K -= A - 1; }
            if (B - A <= 2) { ans += K; Console.WriteLine(ans); return; }
            if (K % 2 == 0) ans += (B - A) * (K / 2);
            else ans += (B - A) * (K / 2) + 1;

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

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

using namespace std;

int main(int argc, char const *argv[])
{
    string S;
    cin >> S;

    int sSize = S.size();
    int end = S.size() - 3;

    int len = end + 1;

    while(end > 0){
        len = end + 1;
        bool match = true;
        
        for(int i = 0 ; i < len/2; i++){
            if(S[i] != S[len/2 + i]){
                match = false;
                break;
            }
        }

        if(match) break;

        end -= 2;
    }

    cout << len << endl;
    return 0;
}


Measured memory_bytes: 3540
def calc_lucas_num(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1

    cache = [2, 1]
    lucas_num = 0

    for _ in range(1, n):
        lucas_num = cache[1] + cache[0]
        cache[0], cache[1] = cache[1], lucas_num

    return lucas_num

N = int(input())

print(calc_lucas_num(N))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define cina(a, n) for (int i = 0; i < n; ++i){ cin >> a[i]; }
#define ll long long
#define ld long double

using namespace std;

int main () {
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll n, k;
	cin >> n >> k;
	int ans = 0;
	while (n) {
		n /= k;
		ans++;
	}
	cout << ans;
	return 0;
}

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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    for(int i=a;i<=a*b;i+=a){
        if(i%b==c){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
N=gets.to_i

i = 0
sum = 0
while sum < N
  i += 1
  sum += i
end

if sum != N
  puts 'No'
  exit 0
end

a = Array.new(i+1) { Array.new(i,0) }

x = y = 0
c = 0
N.times do |j|
  # p [i,j,x,y]
  if x < i
    a[y][x] = a[x+1][y] = j+1
    x += 1
  else
    y+=1
    c+=1
    x=c
    a[y][x] = a[x+1][y] = j+1
    x+=1
  end
end

puts 'Yes'
puts a.length
a.each do|l|
  puts ([i]+l).join(' ')
end


Measured memory_bytes: 4604
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define F first
#define S second
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
using ll = long long;
using pi = pair<int,int>;
int main()
{
  int R, C, K; cin >> R >> C >> K;
  using vl = vector<ll>;
  using vll = vector<vl>;
  vll mass(R, vl(C, 0));
  while(K-- > 0) {
    ll r, c, v; cin >> r >> c >> v;
    r--; c--;
    mass[r][c] = v;
  }

  ll inf = (1LL << 60);
  using vlll = vector<vll>;
  vlll dp(R, vll(C, vl(4, -inf)));
  dp[0][0][0] = 0;
  dp[0][0][1] = mass[0][0];
  rep(i,R) {
    rep(j,C) {
      rep(k,4) {
	if(i + 1 < R) {
	  chmax(dp[i+1][j][0], dp[i][j][k]);	  
	  chmax(dp[i+1][j][1], dp[i][j][k] + mass[i+1][j]);
	}
	if(j + 1 < C) {
	  chmax(dp[i][j+1][k], dp[i][j][k]);
	  if(k + 1 < 4) {
	    chmax(dp[i][j+1][k+1], dp[i][j][k] + mass[i][j+1]);
	  }
	}
      }
    }
  }
  ll res = 0;
  rep(i, 4) chmax(res, dp[R-1][C-1][i]);
  cout << res << "\n";

  
  return 0;
}


Measured memory_bytes: 706564
#include <bits/stdc++.h>
using namespace std;
using Int = long long;

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

    Int k,a,b,ans; cin>>k>>a>>b;
    if(b-a>2)ans=a+(k-(a-1))/2*(b-a)+(k-(a-1))%2;
    else ans=k+1;
    cout<<ans<<'\n';
}

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

#define exist 1
#define no_exist 0





typedef struct node{
  char *moji;
  struct node *parent;
  struct node *right;
  struct node *left;
}node;

node *tree;

node *mk_node(char *moji){
  node *p;
  p=malloc(sizeof(node));
  p->moji=malloc(13*sizeof(char));
  strcpy(p->moji,moji);
  p->parent=NULL;
  p->right=NULL;
  p->left=NULL;
  return p;
}

/*char *x??§????????????????????????????´???????????????????*/
int search(char *x){
  node *p;
  p=tree;
  int J;/*??§?°?????????????????????¨???J*/
  while(p!=NULL){
    J=strcmp(x,p->moji);
    if(J<0) p=p->left;
    else if(J>0) p=p->right;
    else return exist;
  }
  return no_exist;
}


void insert(node *N){
  if(tree==NULL){
     tree=N;
     return;
  }
  node *p;
  p=tree;
  int J;
  while(1){
    J=strcmp(N->moji,p->moji);
    if(J>=0){
      if(p->right==NULL){
        p->right=N;
        N->parent=p;
        return;
      }
      else p=p->right;
    }
    else if(J<0){
      if(p->left==NULL){
        p->left=N;
        N->parent=p;
        return;
      }
      else p=p->left;
    }
  }
}    


int main(){
  char order[7],moji[13];
  int n,i;
  tree=NULL;
  node *N;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %s",order);
    if(order[0]=='i'){
      scanf("%s",moji);
      N=mk_node(moji);
      insert(N);
    }
    else{
      scanf("%s",moji);
      if(search(moji)==exist) printf("yes\n");
      else printf("no\n");
    }
  }
  N=tree;
  return 0;
}
  

Measured memory_bytes: 45184
// luogu-judger-enable-o2
#include<iostream>
const int N=100001;
using namespace std;
int n,x[N],y[N],t[N];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>t[i]>>x[i]>>y[i];
    }
    for(int i=1;i<=n;i++)
        if(x[i]+y[i]>t[i]||(t[i]-x[i]-y[i])%2!=0){
            cout<<"No";
            return 0;   
            }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 1408
"use strict";
function main(input) {
    let line = input.split("\n");
    let arr = line[0].split(" ");
    const S = parseInt(arr[0]);
    const W = parseInt(arr[1]);
    if (S <= W) {
        console.log("unsafe");
    } else {
        console.log("safe");
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main() {
	//cin.tie(nullptr); ios_base::sync_with_stdio(false);
	ll N; cin >> N;
	ll n = N;
	if (n == 1) {
		cout << 1 << "\n";
		return 0;
	}
	vector<ll> prime;
	prime.push_back(2);
	//cout << N << "\n";
	while (n%2 == 0) {
		prime[prime.size()-1] *= 2;
		n /= 2;
	}
	//cout << N << "\n";
	for (ll i = 3; i*i <= N; ++i) {
		if (n % i > 0) continue;
		prime.push_back(1);
		while (n % i == 0) {
			prime[prime.size()-1] *= i;
			n /= i;
		}
	}
	if (n > 1) prime.push_back(n);
	/*
	for (auto x : prime) cout << x << " ";
	cout << "\n";
	*/
	vector<ll> remain(prime.size());
	ll ans = 2*N;
	for (int i = 0; i < (1 << prime.size()); ++i) {
		for (int j = 0; j < prime.size(); ++j) {
			if ((i >> j) & 1) remain[j] = prime[j] - 1;
			else remain[j] = 0;
		}
		pair<ll, ll> res = crt(remain, prime);
		if (res.first or res.second) {
			if (!res.first) ans = min(ans, res.second);
			else ans = min(ans, res.first);
		}
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 3520
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <ctime>

#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)
#define v edge[i].to
#define mp(a, b) make_pair(a, b)

using namespace std;

typedef long long LL;

const int N = 1000100;
const int mod = 998244353;

LL p[N], invp[N];

LL C(int a, int b) { return p[a] * invp[b] % mod * invp[a - b] % mod;}

LL qpow(LL a, LL b)
{
	LL ret = 1, base = a;
	while (b) {
		if (b & 1) ret = ret * base % mod;
		base = base * base % mod, b >>= 1;
	}
	return ret;
}

int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	if (n < m) swap(n, m);
	p[0] = 1;
	Rep(i, n + m) p[i] = p[i - 1] * i % mod;
	invp[n + m] = qpow(p[n + m], mod - 2);
	for (int i = n + m - 1; i >= 0; i --) invp[i] = invp[i + 1] * (i + 1) % mod;
	
	LL ans = 0;
	Rep(i, m) ans = (ans + C(i * 2, i) * C(n + m - i * 2, n - i)) % mod;
	
	ans = ans * qpow(C(n + m, n) * 2 % mod, mod - 2) % mod;
	
	printf("%lld\n", (ans + n) % mod);
	
	return 0;
}

Measured memory_bytes: 15744
#include<bits/stdc++.h>
using namespace std;
#define h first
#define p second
#define pii pair<int,int>
#define ll long long int
const ll INF=1e18L+5;

bool comp(pii a,pii b){
  return a.h+a.p<b.h+b.p;
}

int main()
{
    int n;
    cin>>n;
    vector<pair<int,int>> v(n);

    for(int i=0;i<n;i++){
        cin>>v[i].h>>v[i].p;
    }

    sort(v.begin(),v.end(),comp);

  vector<ll> dp(n+1,INF);
   dp[0]=0;
     int ans=1;
   //dp[i] indicates the minimum height that could be achieved using i participants;
    for(int i=0;i<n;i++){
        for(int j=i;j>=0;j--){
        if(dp[j]<=v[i].h){
            dp[j+1]=min(dp[j+1],dp[j]+v[i].p);
            ans=max(ans,j+1);
        }
        }
    }

    cout<<ans;
}


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

int main() {
  int N;
  cin >> N;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  int64_t result = A.at(0);
  if (count(A.begin(), A.end(), 0) != 0) {
    result = 0;
  }
  else {
    
    for (int i = 1; i < N; i++) {

      if (A.at(i) > 1000000000000000000 / result) {
        result = -1;
        break;
      }
      else {
        result *= A.at(i);
      }
    }
  }
  

  cout << result << endl;
  return 0;
}

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

#define rep(i, n) FOR(i, 0, n)
#define FOR(i, x, n) for (int i = (x); i < (n); ++i)
#define all(v) (v).begin(), (v).end()

using ll = long long;

template<class T> void chmax(T& a, T b){ if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b){ if (a > b) { a = b; } }

int main() {
    ll a, b, n;
    cin >> a >> b >> n;
    cout << (min(b - 1, n) * a) / b << endl;

    return 0;
}

Measured memory_bytes: 3564
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include <math.h>
#include <set>
#include <map>
#include <stdio.h>
#include <queue>
#include <iomanip>
#include <cstring>
#include <stack>
#include <chrono>
#include <unordered_map>
#include <stdlib.h>
#include <ctime>
using namespace std;
typedef long long ll;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define fi first
#define se second
#define pll pair<ll,ll>
#define forn(i,e) for(ll i = 1; i<=e; i++)
#define forsn(i,s,e) for(ll i = s; i<=e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define dbg(x) cout<<#x<<" = "<<x<<endl
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
// freopen("input.txt","r", stdin);
// freopen("out.txt","w", stdout);
// auto start = chrono::high_resolution_clock::now();
// auto end = chrono::high_resolution_clock::now();
// double time_taken =chrono::duration_cast<chrono::nanoseconds>(end - start).count();
// time_taken *= 1e-9;
// cout << "Time taken by program is : " << fixed << time_taken << setprecision(9);
// cout << " sec" << endl;
int main()
{
    ll n,d;
    cin>>n>>d;
    d=d*d;
    ll x,y,cnt=0;
    for(ll i=1;i<=n;i++){
        cin>>x>>y;
        if((x*x+y*y)<=d)
            cnt++;
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <set>
#define ll long long 
#include <string>
#define pb push_back
#define mp make_pair
# define pi 3.14159265358979323846
#define mod 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<n;i++)
using namespace std;
ll int multiply(ll int a,ll int b)
{
ll int ans=(a%mod*b%mod)%mod;
return ans;
}
ll int add(ll int a, ll int b)
{
ll int ans=(a%mod+b%mod)% mod;	
return ans;
}

int power(ll int x,  ll int y, ll int p)  
{  
ll int res = 1;     // Initialize result  

x = x % p; // Update x if it is more than or  
            // equal to p 

if (x == 0) return 0; // In case x is divisible by p; 

while (y > 0)  
{  
    // If y is odd, multiply x with result  
    if (y & 1)  
        res = (res*x) % p;  

    // y must be even now  
    y = y>>1; // y = y/2  
    x = (x*x) % p;  
}  
return res;  
}  
void fastio()
{					
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

}
// vector<ll int> adj[100001];
// ll int vis[100001]={0};
// ll int indegree[100001]={0};
// ll int dist[100001]={0};
// void dfs(ll int n)
// {
// 	vis[n]=1;
// 	for(auto node: adj[n])
// 	{
// 		dist[node]=max(dist[node],dist[n]+1);
// 		indegree[node]--;
// 		if (indegree[node]==0)
// 			dfs(node);
// 	}
// }
// ll int dp[100001]={0};
void solve()
{
	
	ll int n;
	cin>>n;
	ll int i,c=0;
	for(i=1;i<n;i++)
	{
		c+=(n-1)/i;
	}
	cout<<c<<endl;

}
int main()
{
	fastio();
	ll int t;
	t=1;
	// cin>>t;
	
	while(t--)
	{
		solve();
	}
		
}
		

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define MAX 100000

int n;
vector<int> e[MAX];
int d[MAX];

void dfs(int s){
	if(e[s].size()==0){
		d[s]=0;
		return;
	}

	vector<int> v;
	int l=e[s].size();
	for(int i=0; i<l; i++){
		dfs(e[s][i]);
		v.push_back(d[e[s][i]]);
	}
	sort(v.begin(), v.end());
	for(int i=0; i<l; i++){
		d[s]=max(d[s], v[i]+l-i);
	}
	return;
}

int main(){
	cin >> n;
	for(int i=1; i<=n-1; i++){
		int a;
		cin >> a;
		e[a-1].push_back(i);
	}

	dfs(0);
	cout << d[0] << endl;
	return 0;
}

Measured memory_bytes: 13952
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

bool judge(int n)
{
    for (int i = 1; i <= 9; i++)
    {
        for (int j = 1; j <= 9; j++)
        {
            if (i * j == n)
            {
                return true;
            }
        }
    }
    return false;
}

int main()
{
    int n;
    cin >> n;
    cout << (judge(n) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#include <random>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod2 = 1'000'000'007;
constexpr ll mod = 998244353;
const double PI = 3.14159265358;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<int> A(N);
  map<int,int,greater<int>> mp;
  for(int i=0; i<N; i++){
    cin >> A[i];
    mp[A[i]]++;
  }
  int ans = 0;
  for(auto m: mp){
    for(int i=0; i<32; i++){
      if(m.first*2 < (1LL<<i)) break;
      if(m.first*2 == (1LL<<i)){
        ans += m.second/2;
        break;
      }
      if(mp.find((1LL<<i) - m.first) == mp.end()) continue;
      int now = min(m.second,mp[(1LL<<i) - m.first]);
      ans += now;
      m.second -= now;
      mp[(1LL<<i) - m.first] -= now;
    }
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 13480
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 999999999
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

bool debug=false;
/*---------------------------------------------------*/

int main(){
  int a,b,c;
  cin>>a>>b;
  c=a+b;
  if(a%3==0||b%3==0||c%3==0)cout<<"Possible"<<endl;
  else cout<<"Impossible"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>

int main(int argc, char* argv[])
{
  int n;
  int c1 = 0;
  int c2 = 0;
  int c4 = 0;

  std::cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    std::cin >> a;
    if (a % 4 == 0) {
      c4++;
    } else if (a % 2 == 0) {
      c2++;
    } else {
      c1++;
    }
  }

  std::string judge = "No";
  if (c2 > 0) {
    if (c4 >= c1) {
      judge = "Yes";
    }
  } else {
    if (c4 >= c1-1) {
      judge = "Yes";
    }
  }
  std::cout << judge << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>

#define ll long long
#define pll pair<ll, ll>

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

const int INF = 1111111111;
const double EPS = 1e-9;

using namespace std;

void init()
{
}

void solve()
{
	ll a, b, v, w, t;
	cin >> a >> v >> b >> w >> t;

	if (a > b)
	{
		ll tmp = a;
		a = b;
		b = tmp;
	}
	if (a == b)
	{
		cout << "YES" << endl;
		return;
	}

	if (a + v * t >= b + w * t)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
}

int main()
{
	init();
	solve();
}


Measured memory_bytes: 3128
//I am so vegetable
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = 3.141593;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }

const int N = 1e5+5;
vector<int>edge[N];
int h[N];
int main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
	int n,m;cin>>n>>m;
    _for(i,1,n+1)cin>>h[i];
    _for(i,0,m){
        int x,y;cin>>x>>y;
        edge[x].PB(y),edge[y].PB(x);
    }
    int ans = 0;
    _for(i,1,n+1){
        int flag = 1;
        _sfor(it,edge[i]){
            if(h[it]>=h[i]){
                flag = 0;
                break;
            }
        }
        if(flag)++ans;
    }
    cout<<ans;
	return 0;
}

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

int main() {
  string c;
  cin >> c;

  if ((c == "a") || (c == "i") || (c == "u") || (c == "e") || (c == "o")) {
  	cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	int n;
	cin >> n;

	vector<string> s(n);
	for (int i = 0; i < n; i++)
	{
		cin >> s.at(i);
		sort(s.at(i).begin(), s.at(i).end());
	}
	sort(s.begin(), s.end());

	ull res = 0;
	ull cnt = 0;
	for (int i = 1; i < n; i++)
	{
		if (s.at(i) == s.at(i - 1))
		{
			cnt++;
		}
		else
		{
			for (ull j = cnt; j > 0; j--)
			{
				res += j;
			}
			cnt = 0;
		}
	}
	for (ull j = cnt; j > 0; j--)
	{
		res += j;
	}

	cout << res << endl;
}

Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(true){
			int n = stdIn.nextInt();
			if(n==0){
				return;
			}
			int num = 0;
			double bmi = Double.MAX_VALUE;
			for(int i=0;i<n;i++){
				int tn = stdIn.nextInt();
				double tall = stdIn.nextInt()*0.01;
				int weight = stdIn.nextInt();
				double t_bmi = weight/(tall*tall);
				double sa = Math.abs(t_bmi-22);
				if(bmi>sa){
					num = tn;
					bmi = sa;
				}
			}
			System.out.println(num);
		}
	}
}

Measured memory_bytes: 12000
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int q;
int l[100100], r[100100];

// 1 base
template<typename T, int max_n>
class BIT {
private:
    T bit[max_n + 1];
    int n;
public:
    BIT(int _n = max_n) {
        n = _n;
        memset(bit, 0, sizeof(bit));
    }
    // [1, i]
    T sum(int i) {
        T s = 0;
        while (i > 0) {
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }
    // [a, b]
    T sum(int a, int b) {
        return sum(b) - sum(a-1);
    }

    void add(int i, T x) {
        while (i <= n) {
            bit[i] += x;
            i += i & -i;
        }
    }

    int lower_bound(T x) {
        int lb = 0, ub = n;
        while (ub - lb > 1) {
            int mid = (ub + lb) / 2;
            T v = sum(mid);
            if (v < x) {
                lb = mid;
            } else {
                ub = mid;
            }
        }
        return ub;
    }

    int upper_bound(T x) {
        int lb = 1, ub = n+1;
        while (ub - lb > 1) {
            int mid = (ub + lb) / 2;
            T v = sum(mid);
            if (v <= x) {
                lb = mid;
            } else {
                ub = mid;
            }
        }
        return ub;
    }
};

// エラトステネスの篩
bool is_prime[100100];

void sieve(int n) {
    memset(is_prime, true, sizeof(is_prime));
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (is_prime[i]) {
            for (int j = i + i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
}

void solve() {
    sieve(100010);
    BIT<int, 100010> b;
    for (int i = 1; i < 100010; i+=2) {
        if (is_prime[i] && is_prime[(i+1)/2])
            b.add(i, 1);
    }
    for (int i = 0; i < q; i++) {
        cout << b.sum(l[i], r[i]) << endl;
    }
}

void input() {
    cin >> q;
    for (int i = 0; i < q; i++) cin >> l[i] >> r[i];
}

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

    input();
    solve();
}


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

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int k;cin >> k;
    int n=7;
    int p = n%k;
    int i = 1;
    while (p!=0) {
        p*=10;
        p+=7;
        i++;
        p%=k;
        if(i>100000000) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 3636
<?php
$n = trim(fgets(STDIN));
$a = explode(' ', trim(fgets(STDIN)));
$b = explode(' ', trim(fgets(STDIN)));
$c = explode(' ', trim(fgets(STDIN)));

$satisfaction = 0;
$former_a = 0;
for ($i = 0; $i < $n; $i++) {
    $satisfaction += $b[(int)$a[$i] - 1];
    if ($former_a === (int)$a[$i] - 1) {
        $satisfaction += $c[(int)$a[$i] - 2];
    }
    $former_a = (int)$a[$i];
}

echo $satisfaction . PHP_EOL;


Measured memory_bytes: 4728