akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>

static const size_t N_MAX = 100;

int main() {
  size_t N;
  int A[N_MAX];
  scanf("%zu", &N);
  for (size_t i = 0; i < N; i++)
    scanf("%d", &A[i]);
  int c = 0;
  for (size_t i = 0; i < N - 1; i++) {
    auto m = std::min_element(A + i, A + N);
    if (A[i] != *m) {
      std::swap(A[i], *m);
      c++;
    }
  }
  for (size_t i = 0; i < N - 1; i++)
    printf("%d ", A[i]);
  printf("%d\n", A[N-1]);
  printf("%d\n", c);
  return 0;
}

Measured memory_bytes: 2744
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<stdbool.h>

int ceil_pow2(int n){
	int res = 0;
	while(1U<<res < (unsigned int)n)res++;
	return res;
}

typedef int32_t Int;
inline Int max(Int a, Int b){return a>b?a:b;}
Int segtree_op(Int a, Int b){return max(a, b);}
const Int segtree_e = INT32_MIN;

Int* segtree(int n){
	int lg = ceil_pow2(n);
	Int* res = (Int*)malloc(sizeof(Int) * (1<<lg) * 2);
	for(int i=0; i<=(1<<lg)*2; i++)res[i] = segtree_e;
	return res;
}
void update(Int arr[], int k){arr[k] = segtree_op(arr[k*2], arr[2*k+1]);}
void set(Int arr[], int n, int p, Int x){
	int lg = ceil_pow2(n);
	p += 1<<lg;
	arr[p] = x;
	for(int i=1; i<=lg; i++)update(arr, p>>i);
}
Int get(Int arr[], int n, int p){
	return arr[p +(1<<ceil_pow2(n))];
}
Int prod(Int arr[], int n, int l, int r){
	Int sml = segtree_e, smr = segtree_e;
	int lg = ceil_pow2(n);
	l += 1<<lg;
	r += 1<<lg;
	while(l < r){
		if(l & 1) sml = segtree_op(sml, arr[l++]);
		if(r & 1) smr = segtree_op(arr[--r], smr);
		l >>= 1;
		r >>= 1;
	}
	return segtree_op(sml, smr);
}
Int all_prod(Int arr[]){return arr[1];}
int max_right(Int arr[], int n, int l, bool (*f)(Int)){
	if(l == n) return n;
	int lg = ceil_pow2(n);
	int size = 1<<lg;
	l += size;
	Int sm = segtree_e;
	do{
		while(l % 2 == 0) l >>= 1;
		if(!f(segtree_op(sm, arr[l]))){
			while(l < size){
				l = 2*l;
				if(f(segtree_op(sm, arr[l]))){
					sm = segtree_op(sm, arr[l]);
					l++;
				}
			}
			return l - size;
		}
		sm = segtree_op(sm, arr[l]);
		l++;
	}while((l & -l) != l);
	return n;
}
int min_right(Int arr[], int n, int r, bool (*f)(Int)){
	if(r == 0) return 0;
	int lg = ceil_pow2(n);
	int size = 1<<lg;
	r += size;
	Int sm = segtree_e;
	do{
		r--;
		while(r>1 && r&1) r >>= 1;
		if(!f(segtree_op(arr[r], sm))){
			while(r < size){
				r = 2*r + 1;
				if(f(segtree_op(arr[r], sm))){
					sm = segtree_op(arr[r], sm);
					r--;
				}
			}
			return r + 1 - size;
		}
		sm = segtree_op(arr[r], sm);
	}while((r & -r) != r);
	return 0;
}

int main(){
	int N, Q;
	scanf("%d%d", &N, &Q);
	Int *d = segtree(N);
	for(int i=0; i<N; i++){
		int A;
		scanf("%d", &A);
		set(d, N, i, A);
	}
	while(Q--){
		int T, X, Y;
		scanf("%d%d%d", &T, &X, &Y);
		if(T == 1)set(d, N, X-1, Y);
		else if(T == 2)printf("%d\n", prod(d, N, X-1, Y));
		else {
			bool f(Int x){return x < Y;}
			printf("%d\n", 1 + max_right(d, N, X-1, f));
		}
	}
	return 0;
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define f(i,n) for(int i=0;i<n;i++) 
#define F first 
#define S second 
#define pb push_back 

using namespace std;

void test(){
	ll n,x,t;
	cin>>n>>x>>t;
	ll v = (n/x);
	if(n%x!=0)v++;
	cout<<(v*t)<<"\n";
}

int main(){
	int tests=1;
	// cin>>tests;
	while(tests--){
		test();
	}
}


Measured memory_bytes: 3620
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    k, x = rli()
    if k*500 >= x:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


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

int main(void){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(abs(c-a) <= d || (abs(c-b) <= d && abs(b-a) <= d)) cout << "Yes\n";
  else cout << "No\n";
}


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

using namespace std;

int main () {
	string s; cin >> s;
	int ans = 0, tmp = 0;
	for (int i = 0; i < 3; ++i) {
		if (s[i] == 'R') ++tmp;
		else {
			ans = max(ans, tmp);
			tmp = 0;
		}
	}
	ans = max(ans, tmp);
	cout << ans << endl;

	return 0;
}

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

typedef long long ll;
const int maxn = 400 + 5;
const ll INF = 1e18L;
ll dp[maxn][maxn];
ll prefix_sum[maxn];

void min_self(ll &a, ll b) {
    a = min(a, b);
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n; cin >> n;

    vector<int> slimes(n);
    for (int &x: slimes) cin >> x;

    fill(&dp[0][0], &dp[n][0], INF);
    for (int i = 0; i < n; ++i) {
        
        dp[i][i] = 0LL;
        prefix_sum[i] += i > 0 ? prefix_sum[i-1] + slimes[i] : slimes[i];
    }

    for (int len = 2; len <= n; ++len) {
        for (int i = 0; i <= n-len; ++i) {
            int j = i + len - 1;
            ll sum = prefix_sum[j] - (i > 0 ? prefix_sum[i-1] : 0);
            for (int k = i; k < j; ++k) {
                min_self(dp[i][j], dp[i][k] + dp[k+1][j] + sum);
            }
        }
    }

    cout << dp[0][n-1] << "\n";

}

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
int main(){
    long a, b, n;
    cin >> a >> b >> n;
    /*
    long x=1;
    long score_max=0;
    while(1){
        long score = (long)(a*x/b)-a*(long)(x/b);
        cout << score << endl;
        if(score_max < score) score_max=score;
        x++;
        if(x>b)break;
    }*/
    long x = min(n, b-1);
    long score = (long)(a*x/b);
    cout << score << endl;
    return 0;
}

Measured memory_bytes: 3628
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n, m, q = [int(x) for x in input().split()]
abcd = [[int(x) for x in input().split()] for _ in range(q)]
all_pattern = []
start = ['1']

def dfs(s):
    last_s = int(s[-1])
    next_s = [str(x) for x in range(last_s, m + 1)]
    for i in next_s:
        t = s[:]
        t.append(i)
        if len(t) == n + 1:
            all_pattern.append(t[1:])
        else:
            dfs(t)
dfs(start)
ans = 0
for pattern in all_pattern:
    res = 0
    for i in range(q):
        a, b, c, d = abcd[i]
        if int(pattern[b - 1]) - int(pattern[a - 1]) == c:
            res += d
    ans = max(ans, res)
#print(all_pattern)
print(ans)

    





Measured memory_bytes: 95524
#include<bits/stdc++.h>
using namespace std;
long long GCD(long long a,long long b)
{
	if(b==0)
		return a;
	return GCD(b,a%b);
}
long long LCM(long long a,long long b)
{
	return a/GCD(a,b)*b;
}
int main()
{
	long long a,b;
	scanf("%lld %lld",&a,&b);
	printf("%lld",LCM(a,b));
	return 0;
}

Measured memory_bytes: 256
l=input().split()
a=int(l[0])
b=int(l[1])
c=int(l[2])
if a>b:
    a,b=b,a
if b>c:
    b,c=c,b
if a>b:
    a,b=b,a
print(f"{a} {b} {c}")


Measured memory_bytes: 5612
#include "bits/stdc++.h" 
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i = ll(a); i <= ll(b); i++)
int main()
{
    ll n;
    cin>>n;
    REP(i,1,n)
    {
        if(floor(i*1.08)==n)
        {
            cout<<i;
            return 0;
        }
    }
    cout<<":(";
}

Measured memory_bytes: 256
N=int(input())
from itertools import product
a=10**5
for p in product(range(9),repeat=5):
    n=N-sum([9**(i+1)*p[i] for i in range(5)])
    if n<0:continue
    b=sum(p)
    x=6**6
    while x>0:
        b+=n//x
        n%=x
        x//=6
    a=min(a,b)
print(a)

Measured memory_bytes: 8984
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,x,ans=0;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		if(x>=k)ans++;
	}
	cout<<ans<<"\n";
	
	
	
		
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	N = parseInt(input[0]);
	A = input[1].split(" ");

	var min = parseInt(A[0]);
	var max = parseInt(A[0]);
	for(var i=1;i<N;i++){
		var tmp = parseInt(A[i]);
		if(tmp < min) min = tmp;
		if(tmp > max) max = tmp;
	}
	console.log(max - min);
	//文字列から10進数に変換する
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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


void solve(long long W, long long H, long long x, long long y) {
    double total_area = W*H;
    
    cout << fixed << setprecision(6) << total_area/2 << " " << ((x*2 == W and y*2 == H) ? 1 : 0) << "\n";
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long W;
    scanf("%lld",&W);
    long long H;
    scanf("%lld",&H);
    long long x;
    scanf("%lld",&x);
    long long y;
    scanf("%lld",&y);
    solve(W, H, x, y);
    return 0;
}


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

int N,A[110];

int main(){
	cin >> N;
	for(int i=1;i<=N;i++){
		cin >> A[i];
	}
	int ans = 1e9;
	for(int c=0;c<=200;c++){
		int sum = 0;
		for(int i=1;i<=N;i++){
			sum += (A[i]-(c-100))*(A[i]-(c-100));
		}
		ans = min(ans,sum);
	}
	cout << ans << endl;
}


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

long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int main() {
    long long A, B, C;
    cin >> A >> B >> C;
    if (C % GCD(A, B) == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
N, X = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
last_index = len(A) - 1
ret = 0
for i, a in enumerate(A):
    if a <= X:
        ret += 1
        X -= a
if ret == N and X > 0:
    ret -= 1
print(ret)

Measured memory_bytes: 3060
void main() {
	auto N = ri;
	auto A = iota(N).map!(a => ri).array;
	if(A[0] > 0) {
		writeln(-1);
		return;
	}
	foreach(i; 0..N-1) {
		if(A[i+1]-A[i] > 1) {
			writeln(-1);
			return;
		}
	}
	ulong ans;
	foreach(i; 0..N-1) {
		if(A[i]+1 == A[i+1]) ans++;
		else ans += A[i+1];
	}
	ans.writeln;
}

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

import std.stdio;
import std.string;
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;
}

T[] deepcopy(T)(T[] a) {
	static if(isArray!T) {
		T[] res;
		foreach(i; a) {
			res ~= deepcopy(i);
		}
		return res;
	} else {
		return a.dup;
	}
}

ulong[] generate_prime_list(T)(T N) if(isIntegral!T) {
	ulong[] prime_list = [2];
	bool not_prime = false;
	foreach(i; 3..N.to!ulong+1) {
		foreach(j; prime_list) {
			if(i % j == 0) {
				not_prime = true;
				break;
			}
		}
		if(!not_prime) prime_list ~= i;
		not_prime = false;
	}
	return prime_list;
}

bool isPrime(ulong n) {
	if(n <= 1) return false;
	else if(n == 2) return true;
	else if(n % 2 == 0) return false;

	foreach(i; iota(3, n.to!double.sqrt.ceil+1, 2)) {
		if(n % i == 0) return false;
	}
	return true;
}

class UnionFind(T) {
	T[] arr;
	this(ulong n) {
		arr.length = n+1;
		arr[] = -1;
	}
	T root(T x) {
		return arr[x] < 0 ? x : root(arr[x]);
	}
	bool same(T x, T y) {
		return root(x) == root(y);
	}
	bool unite(T x, T y) {
		x = root(x);
		y = root(y);
		if(x == y) return false;
		if(arr[x] > arr[y]) swap(x, y);
		arr[x] += arr[y];
		arr[y] = x;
		return true;
	}
	T size(T a) {
		return -arr[root(a)];
	}
}


Measured memory_bytes: 4092
#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;

void solve(int64_t k, int64_t n) {
  int64_t q = (k + n - 1) / n;
  int64_t r = n * q - k;
  cerr << q << ' ' << r << endl;
  cout << n << endl;
  int64_t a = q + r + n - 1;
  REP(i,n-1) cout << a << ' ';
  cout << a - (n+1) * r << endl;
}

int main() {
  int64_t k;
  cin>>k;
  if (k == 0) {
    cout << 2 << endl;
    cout << "0 0" << endl;
  } else if (k < 50) {
    cout << (k+1) << endl;
    REP(i,k) {
      cout << 0 << " ";
    }
    cout << (k*(k+1)) << endl;
  } else if (k < 1000000) {
    solve(k, 2);
  } else {
    solve(k, 50);
  }
  return 0;
}


Measured memory_bytes: 256
# dp array
import sys
input = sys.stdin.readline
def chmin(dp, idx, b):
    if dp[idx] > b:
        dp[idx] = b
        return True
    return False
def main():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    INF = 10 ** 9
    dp = [INF] * N
    dp[0] = 0
    for i in range(N):
        for j in range(1, K+1):
            if i+j < N:chmin(dp, i+j, dp[i]+abs(h[i]-h[i+j]))
    print(dp[-1])
if __name__ == "__main__":
    main()

Measured memory_bytes: 52444
# A - Can't Wait for Holiday

S = input()

if S == 'MON':
    print(6)
elif S == 'TUE':
    print(5)
elif S == 'WED':
    print(4)
elif S == 'THU':
    print(3)
elif S == 'FRI':
    print(2)
elif S == 'SAT':
    print(1)
elif S == 'SUN':
    print(7)

Measured memory_bytes: 8988
import java.util.Scanner;
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int k = scan.nextInt();
    int q = scan.nextInt();
    int[] points = new int[n];
    for(int i = 0; i < n; i++){
      points[i] = 0;
    }
    for(int i = 0; i < q; i++){
      int iNum = scan.nextInt() - 1;
      points[iNum] += 1;
    }

    for(int i = 0; i < n; i++){
      int sum = k - q + points[i];
      if(sum <= 0){
        System.out.println("No");
      }else{
        System.out.println("Yes");
      }
    }

  }
}


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

const int N = (int) 3e5 + 5;
const long long INF = (long long) 1e18;

int n;
int a[N];
long long dpLeft[N], dpRight[N];
multiset <int> myset;
multiset <int> :: iterator it;

int main() {
	//freopen(".inp", "r", stdin); freopen(".out", "w", stdout);
	scanf("%d", &n); 
	for (int i = 1; i <= 3 * n; i++) scanf("%d", &a[i]);

	long long sum = 0;
	for (int i = 1; i <= 3 * n; i++) dpLeft[i] = -INF;
	for (int i = 1; i <= n; i++) {
		myset.insert(a[i]);
		sum += a[i];
	}
	dpLeft[n] = sum;
	for (int i = n + 1; i <= 3 * n; i++) {
		it = myset.begin();
		int v = a[i];
		if (*it < v) {
			sum = sum + v - *it;
			dpLeft[i] = max(dpLeft[i - 1], sum);
			myset.erase(it);
			myset.insert(v);
		} else dpLeft[i] = max(dpLeft[i - 1], sum);
	}

	myset.clear(); sum = 0;
	for (int i = 1; i <= 3 * n; i++) dpRight[i] = INF;
	for (int i = 3 * n; i >= 2 * n + 1; i--) {
		myset.insert(a[i]);
		sum += a[i];
	}
	dpRight[2 * n + 1] = sum;
	for (int i = 2 * n; i >= 1; i--) {
		it = myset.end(); it--;
		int v = a[i];
		if (*it > v) {
			sum = sum + v - *it;
			dpRight[i] = min(dpRight[i + 1], sum);
			myset.erase(it);
			myset.insert(v);
		} else dpRight[i] = min(dpRight[i + 1], sum);
	}

	long long ans = -INF;
	for (int i = n; i <= 2 * n; i++) ans = max(ans, dpLeft[i] - dpRight[i + 1]);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 10752
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a,b,c;
int main()
{
    scanf("%lld%lld%lld",&a,&b,&c);
    if((c-a-b)*(c-a-b)>4*a*b&&c-a-b>0)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
}

Measured memory_bytes: 256
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

//
// solution 
//
const MOD: usize = 1_000_000_007;
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        N: usize,
    }

    // dp: length, 3文字前, 2文字前, 1文字前
    // A -> 0, C -> 1, G -> 2, T -> 3
    let mut dp = vec![ vec![ vec![ vec![0; 4]; 4]; 4]; N+1];

    dp[0][3][3][3] = 1;
    for len in 0..N {
        for third_last in 0..4 {
            for sec_last in 0..4 {
                for last in 0..4 {
                    for next in 0..4 {
                        match (third_last, sec_last, last, next) {
                            // NG list 
                            // ? A G C
                            // A ? G C
                            // ? G A C
                            // ? A C G 
                            // A G ? C
                            (_, 0, 2, 1) |
                            (0, _, 2, 1) |
                            (_, 2, 0, 1) |
                            (_, 0, 1, 2) |
                            (0, 2, _, 1) => (),
                            _ => {
                                dp[len+1][sec_last][last][next] +=
                                    dp[len][third_last][sec_last][last];
                                dp[len+1][sec_last][last][next] %= MOD;
                            },
                        }
                    }
                }
            }
        }
    }
    let mut ans = 0;
    for third_last in 0..4 {
        for sec_last in 0..4 {
            for last in 0..4 {
                ans += dp[N][third_last][sec_last][last];
                ans %= MOD;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector< vector<int> >
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main(){


    // vector<bool> P(100000010, true);
    // for(int i = 2; i * i <= 100000000; i++){
    //     if(P[i]){
    //         for(int j = 2 * i; j <= 100000000; j += i){
    //             P[j] = false;
    //         }
    //     }
    // }

    int N;
    cin >> N;
    int ans = 0;
    rep(i, N){
        int p;
        cin >> p;
        bool flag = true;
        for(int j = 2; j * j <= p; j++){
            if(p % j == 0){
                flag = false;
                break;
            }
        }
        if(flag) ans++;
    }

    cout << ans << endl;
}


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

int main(){
	int num,i,k;
	int mountain_num = 1;
	int N[100];
	int count_flg;
	
	//入力	
	cin >> num;
	
	for (i = 0;i<num;i++){
		cin >> N[i];
	}

	
	
	//計算
	
	for ( i=1;i<num;i++){
		count_flg = 0;
		
		for(k = 0; k<i;k++)
		{
			if(N[k] - N[i] <= 0) 
			{
				
			}else{
				count_flg = 1;
			}
		}
		if(count_flg == 0) {
			mountain_num++;				
		}
		
	}
	
	//出力
	cout << mountain_num << endl;
	
		
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main(void){
    string input;
    
    int n;
    
    getline(cin, input);
    sscanf(input.c_str(), "%d\n", &n);
    
    int *a = new int[n]();
    
    getline(cin, input);
    const char *p = input.c_str();
    
    for(int i = 0; i < n; i++){
        sscanf(p, "%d", a + i);
        
        if(i == n - 1) break;
        while(*p != ' ') p++;
        p++;
    }
    
    for(int i = n - 1; 0 <= i; i--){
        printf("%d", a[i]);
        if(i) printf(" ");
    }
    printf("\n");
    
    return(0);
}



Measured memory_bytes: 3280
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;


int main(){
    int n,l;
    cin >> n >> l;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    SORT(s);
    string ans;
    rep(i,n) ans+=s[i];
    cout << ans;
    rn 0;
}


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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);


// ABC096C - Half and Half
int main(){
  int a, b, c, x, y; // A=A円, B=B円, AB=C円
  cin >> a >> b >> c >> x >> y; // 2AB = 2(A + B)

  const int MAX_NUM = 1e5;

  int minP = INT_MAX;
  for (int ci = 0; ci <= 2 * MAX_NUM; ci += 2) {
    int p = ci * c;
    int rx = x - ci / 2;
    int ry = y - ci / 2;
    if (rx > 0) {
      p += rx * a;
    }
    if (ry > 0) {
      p += ry * b;
    }
    if (p < minP) {
      minP = p;
    }
  }

  cout << minP << endl;
  return 0;
}


Measured memory_bytes: 256
import collections

n = int(input())
v = list(map(int,input().split()))
vodd = v[0::2]
veven = v[1::2]

set_vodd = list(set(vodd))
set_veven = list(set(veven))
cnt_vodd = collections.Counter(vodd)
cnt_veven = collections.Counter(veven)

if len(set_vodd) == 1 and set_vodd == set_veven:
    print(n//2)
else:
    if cnt_vodd.most_common(1)[0][0] != cnt_veven.most_common(1)[0][0]:
        ans_vodd = (n//2)- cnt_vodd.most_common(1)[0][1]
        ans_veven = (n//2)- cnt_veven.most_common(1)[0][1]
        print(ans_vodd + ans_veven)
    elif len(set_vodd)>=2 and len(set_veven)>=2:
        ans_vodd_1 = (n//2)- cnt_vodd.most_common(1)[0][1]
        ans_veven_1 = (n//2)- cnt_veven.most_common(2)[1][1]
        ans_vodd_2 = (n//2)- cnt_vodd.most_common(2)[1][1]
        ans_veven_2 = (n//2)- cnt_veven.most_common(1)[0][1]
        print(min(ans_vodd_1+ans_veven_1,ans_vodd_2+ans_veven_2))

Measured memory_bytes: 19936
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int Q, H, S, D, N;
    cin >> Q >> H >> S >> D >> N;

    int f = min({Q * 4, H * 2, S});
    if (f * 2 <= D) {
        cout << f * N << endl;
    }
    else {
        int ans = N / 2 * D;
        if (N % 2 == 1) ans += f;
        cout << ans << endl;

    }


    return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl

const int MN = 100010;
const int INF = INT_MAX;

int N;
int h[MN];
int dp[MN];

int main() {
    rep(i, MN) dp[i] = INF;

    cin >> N;
    dp[0] = 0;

    rep(i, N) {
        cin >> h[i];
        if (i > 0) {
            dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        }
       if (i > 1) {
            dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
        }        
    }
    cout << dp[N-1] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;



int main()
{
	int n,i,s=0,flag=0,a[210];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);	
	while(1)
	{
		for(i=0;i<n;i++)
		{
			if(a[i]%2==0)
				flag=0;
			else
			{
				flag=1;
				break;
			}
			a[i]/=2;	
		}
		if(flag==0)
			s++;
		else
			break;	
	}
	printf("%d\n",s);
	return 0;
}

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

int main() {
    int N, A;
    cin >> N >> A;
    
    if (N % 500 == 0) {
        cout << "Yes" << endl;
    }
    else if (N % 500 <= A) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

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

int main() {
  int n;
  cin >> n;
  for (int i = 0; i <= 25; ++i) {
    for (int j = 0; j <= 14; ++j) {
      if (i * 4 + j * 7 == n) {
        cout << "Yes\n";
        return 0;
      }
    }
  }
  cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
s = gets.chomp.split('')
k = gets.to_i
arr = []
(0...s.count).each do |j|
  (1..(k + 1)).each do |i|
    break if i + j > s.count
    tmp = s.slice(j, i)
    arr.push(tmp.join) if tmp.count > 0
  end
end
arr.uniq!
arr.sort!
puts arr[k - 1]

Measured memory_bytes: 9648
H1,M1,H2,M2,K = map(int, input().split())
H1_t = H1*60+M1
H2_t = H2*60+M2
time = max(H1_t,H2_t) - min(H1_t,H2_t)
if time > K:
    print(time - K)
else:
    print(0)

Measured memory_bytes: 61576
N = int(input())
A = list(map(int, input().split()))
P = ['n'] * N
s = 1
if A[N-1] > A[N-2]:
    P[N-1] = 'sell'
    s = 0
for i in range(N-2):
    if s == 1:
        if A[N-i-2] > A[N-i-3]:
            P[N-i-2] = 'sell'
            s = 0
    else:
        if A[N-i-2] < A[N-i-3]:
            s = 1
            P[N-i-2] = 'buy'
if s == 0:
    P[0] = 'buy'
    s = 1
else:
    P[0] = 'n'

m = 1000
stock = 0
    
for i in range(N):
    if s == 1:
        if P[i] == 'buy':
            stock = m // A[i]
            m = m % A[i]
            s = 0
    else:
        if P[i] == 'sell':
            m += stock*A[i]
            stock = 0
            s = 1
print(m)

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

int main() {
  long long n;
  cin >>n;
  long long kotae=1;
  vector<long long>a(n);
  for(long long i=0;i<n;i++)cin>>a[i];
  long long tmp=0;
  bool minus=false;
  bool plus=false;
  for(long long i=0;i<n-1;i++){
    //cout<<i<<" "<<a[i]-a[i+1]<<" "<<tmp<<endl;
    if(tmp==0){
      if(a[i]-a[i+1]<0){
        tmp=-1;
        minus=true;
        plus=false;
      }if(a[i]-a[i+1]>0){
        tmp=1;
        plus=true;
        minus=false;
      }
    }else if(a[i]-a[i+1]==0){
      if(tmp<0||minus==true){
        minus=true;
        plus=false;
        tmp=-1;
      }else if(tmp>0||plus==true){
        plus=true;
        minus=false;
        tmp=1;
      }
    }else if(a[i]-a[i+1]<0&&plus==true){
      kotae++;
      tmp=0;
      //minus=true;
      //plus=false;
    }else if(a[i]-a[i+1]>0&&minus==true){
      kotae++;
      tmp=0;
      //minus=false;
      //plus=true;
    }
  }
  cout<<kotae<<endl;
  return 0;
}

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

using namespace std;

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

  int previous_x, previous_y;
  int previous_t;
  previous_x = previous_y = 0;
  previous_t = 0;

  bool can = true;
  for(int i = 0; i < point_num; i++)  {
    int x, y;
    int t;
    cin >> t >> x >> y;

    int diff_x = abs(x - previous_x);
    int diff_y = abs(y - previous_y);
    int diff_t = t - previous_t;

    // int left_t = diff_t - (diff_x + diff_y);
    int dist = diff_x + diff_y;

    if(diff_t < dist || dist % 2 != diff_t % 2) {
      can = false;
      break;
    }

    previous_x = x;
    previous_y = y;
    previous_t = t;
  }

  if(can) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

template<int SZ> struct DSU {
    int par[SZ], sz[SZ];
    DSU() {
        F0R(i,SZ) sz[i] = 1;
    }
    
    int get(int x) { // path compression
    	if (par[x] != x) par[x] = get(par[x]);
    	return par[x];
    }
    
    bool unite(int x, int y) { // union-by-rank
    	x = get(x), y = get(y);
    	if (x == y) return 0;
    	sz[x] += sz[y], par[y] = x;
    	return 1;
    }
};

DSU<MX> D;

ll N,M,dp[MX],sum[MX],A[MX],B[MX],ans[MX];
vi adj[MX];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> M;
    FOR(i,1,N+1) {
        cin >> A[i] >> B[i];
        A[i] = max(A[i]-B[i],0LL);
    }
    F0R(i,M) {
        int u,v; cin >> u >> v;
        adj[u].pb(v), adj[v].pb(u);
    }
    vi x; FOR(i,1,N+1) x.pb(i);
    sort(all(x),[](int u, int v) { return A[u] < A[v]; });
    for (int i: x) {
        D.par[i] = i;
        sum[i] = B[i];
        vi child;
        for (int j: adj[i]) if (D.par[j] && D.get(i) != D.get(j)) {
            child.pb(D.get(j));
            sum[i] += sum[D.get(j)];
            D.unite(i,j);
        }
        ans[i] = A[i]+sum[i];
        for (int j: child) ans[i] = min(ans[i],sum[i]-sum[j]+max(ans[j],A[i]));
    }
    cout << ans[x.back()];
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)

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

int main(){
  int n; cin>>n;
  vector<string> s(n);
  for(string &i:s)
    cin>>i;
  int A_count=0,W_count=0,T_count=0,R_count=0;
  
  for(int i=0;i<n;i++){
    if(s[i]=="AC") A_count++;
    else if(s[i]=="WA") W_count++;
    else if(s[i]=="TLE") T_count++;
    else R_count++;
  }
  cout<<"AC x "<<A_count<<endl;
  cout<<"WA x "<<W_count<<endl;
  cout<<"TLE x "<<T_count<<endl;
  cout<<"RE x "<<R_count<<endl;
}

Measured memory_bytes: 6412
#include <stdio.h>
#include <iostream>
#include <queue>
#include <cstdio>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string.h>
#include <limits.h>
#include <map>
#include <string>
#include <bitset>
#include <vector>
using namespace std;
int ans[2005];
int main() {
    int n, x, y;
    cin >> n >> x >> y;
    for (int i = 1; i < n; i++)
        for (int j = i + 1; j <= n; j++) {
            if (i <= x && j >= y) ans[x - i + j - y + 1]++;
            else if (i <= x && j <= x) ans[j - i]++;
            else if (i >= y && j >= y) ans[j - i]++;
            else if (i > x && j < y) ans[min(j - i, y - x + 1 - j + i)]++;
            else if (i <= x && j < y) ans[min(j - i, y - i - j + x + 1)]++;
            else if (i > x && j >= y) ans[min(j - i, j - x - y + i + 1)]++;
        }
    for (int i = 1; i < n; i++) printf("%d\n", ans[i]);
    return 0;
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 1000000007LL
#define HF   500000004LL
#define EPS 0.00001
#define f first
#define s second
#define pb push_back

#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 5005
int n, m;
ll p2[MN], ip2[MN];
ll dp[MN][MN];

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

    cin >> n >> m;
    p2[0] = 1;
    ip2[0] = 1;
    FOR(i, 1, MN-2){
        p2[i] = (p2[i-1]*2)%MOD;
        ip2[i] = (ip2[i-1]*HF)%MOD;
    }
    FOR(j, 1, m){
        dp[1][j] = p2[j];
    }
    FOR(i, 2, n){
        ll sm = 0;
        FOR(j, 1, m){
            ll pt1 = (dp[i-1][j]*(j+1))%MOD;
            ll pt2 = (sm*p2[j-1])%MOD;
            dp[i][j] = (pt1+pt2)%MOD;

            sm += ((dp[i-1][j]*j)%MOD*ip2[j])%MOD;
            sm %= MOD;
        }
    }
    cout << dp[n][m] << "\n";

    return 0;
}


Measured memory_bytes: 199168
#include <iostream>
#include<algorithm>
#include<stdio.h>
#include<math.h>
using namespace std;

typedef long long LL;

LL a[200000+10],f[200000+100],n,k;

bool cmp(LL x,LL y)
{
    return x>y;
}
bool  check(LL amd)
{
    LL sum=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]*f[i]>amd)
           sum=sum+(a[i]-amd/f[i]);
        if(sum>k)
            return false;
    }
    return true;
}
int main()
{
    scanf("%lld%lld",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%lld",&a[i]);
    for(int i=1;i<=n;i++)
        scanf("%lld",&f[i]);
    sort(a+1,a+1+n);
    sort(f+1,f+1+n,cmp);
    LL l=-1,r=1e13,ans=0;
    while(r-l>1)
    {
        LL mid=(l+r)>>1;
        //cout<<" "<<l<<" "<<r<<" "<<mid<<" "<<check(mid)<<endl;
        if(check(mid))
        {
            ans=mid;
            r=mid;
        }
        else l=mid;
    }
     printf("%ld",ans);
    //cout<<ans;
    return 0;
}

Measured memory_bytes: 3328
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
      int a,b,c;
      char d,e;
      cin>>a>>d>>b>>e>>c;

      if(b<=4){
          cout<<"Heisei"<<endl;
      }
      else{
          cout<<"TBD"<<endl;
      }

}


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

using namespace std;

#define all(x) begin(x), end(x)

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

struct modint {
    static const int MOD = 998244353;

    ll v;
    modint(const int _v = 0): v(_v % MOD) {
        if (v < 0) v += MOD;
    }

    bool operator==(const modint& other) const {
        return v == other.v;
    }

    modint& operator+=(const modint& other) {
        v += other.v;
        if (v >= MOD)
            v -= MOD;
        return *this;
    }

    modint& operator-=(const modint& other) {
        v -= other.v;
        if (v < 0)
            v += MOD;
        return *this;
    }

    modint& operator*=(const modint& other) {
        v = 1LL * v * other.v % MOD;
        return *this;
    }

    modint& operator/=(const modint& other) {
        *this *= other.inv();
        return *this;
    }

    modint operator+(const modint& other) const {
        return modint(v) += other;
    }

    modint operator-(const modint& other) const {
        return modint(v) -= other;
    }

    modint operator*(const modint& other) const {
        return modint(v) *= other;
    }

    modint operator/(const modint& other) const {
        return modint(v) /= other;
    }

    static modint pow(modint b, ll e) {
        modint res = 1;
        for (ll p = 1; p <= e; p <<= 1) {
            if (p & e)
                res *= b;
            b *= b;
        }

        return res;
    }

    modint pow(ll e) const {
        return pow(*this, e);
    }

    modint inv() const {
        return pow(MOD - 2);
    }

    friend ostream& operator<<(ostream& os, modint m) {
        return os << m.v;
    }
};

constexpr int MAXN = 1e5;
modint fact[MAXN], tcaf[MAXN];

void gen_fact() {
    fact[0] = 1;
    for (int i = 1; i < MAXN; ++i) {
        fact[i] = fact[i - 1] * i;
    }

    tcaf[MAXN - 1] = modint(1) / fact[MAXN - 1];
    for (int i = MAXN - 2; i >= 0; --i) {
        tcaf[i] = tcaf[i + 1] * (i + 1);
    }
}

modint choose(int n, int k) {
    assert(n >= 0);
    if (k < 0 or n < k)
        return 0;

    return fact[n] * tcaf[k] * tcaf[n - k];
}

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

    int n;
    cin >> n;

    modint ans = modint::pow(3, n);
    modint cur = 0;
    modint term = 1;
    modint p = 2;
    // n choose k * 2^k for k in range()
    for (int k = n; k > n / 2; --k) {
        cur += term * p;
        // going from n!/k!(n-k)! to n!/(k-1)!(n-k+1)!
        // multiply by k/(n-k+1)
        term /= (n - k + 1);
        term *= k;
        p += p;
    }

    cout << ans - cur << '\n';
 
    return 0;
}


Measured memory_bytes: 1792
#!/usr/bin/env python3
import sys
YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(a: int, b: int, c: int):
    if c-a-b <0:
        print(NO)
        return
        
    if 4*a*b < (c-a-b)**2:
        print(YES)
    else:
        print(NO)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    c = int(next(tokens))  # type: int
    solve(a, b, c)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
n = int(input())
an = [int(num) for num in input().split()]
bn = [int(num) for num in input().split()]
cn = [int(num) for num in input().split()]

sum = 0
for a in an:
  sum += bn[a-1]

add = []
for i in range(n-1):
  if an[i]+1 == an[i+1] :
    add.append(an[i])

for j in add:
  sum += cn[j-1]
    
print(sum)

Measured memory_bytes: 9088
package main

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

func readQuestion() []int {

    bufio := bufio.NewReader(os.Stdin)
    l, _ := bufio.ReadString('\n')
    n, _ := strconv.Atoi(strings.Trim(l, "\n"))
    cards := make([]int, n)
    for i := 0; i < n; i++ {
        l, _ = bufio.ReadString('\n')
        n, _ := strconv.Atoi(strings.Trim(l, "\n"))
        cards[i] = n
    }
    return cards
}

func solve(cards []int) int {
    count := 0
    i := 0
    for i < len(cards) {
        if cards[i] >= 2 {
            n := cards[i] / 2
            cards[i] -= n * 2
            count += n
        } else if i < len(cards)-1 && cards[i] > 0 && cards[i+1] > 0 {
            n := int(math.Min(float64(cards[i]), float64(cards[i+1])))
            cards[i] -= n
            cards[i+1] -= n
            count += n
        } else {
            i++
        }
    }
    return count
}

func main() {
    cards := readQuestion()
    ans := solve(cards)
    fmt.Printf("%v\n", ans)
}          

Measured memory_bytes: 4736
#include<cstdio>
int main()
{
    int n;
    scanf("%d",&n);
    for (int i = 1; i < 10; i++)
    {
        if (n%i==0&&n/i>0&&n/i<10)
        {
            printf("Yes");
            return 0;
        }
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define powerof2 ()
#define mp make_pair
#define pi acos(-1)
using ll = long long;
const ll M = 1000000007;
const ll M1= 998244353;
using vl = vector<ll>;
using pll =  pair<ll,ll>;
ll power(ll x,ll y){
	if(y==0)
		return 1;
	ll res=power(x,y/2);
	res=(res*res);
	if(y&1)
		res=(res*x);
	return res;
}
 
ll powermod(ll x,ll y,ll mod){
	if(y==0)
		return 1;
	ll res=powermod(x,y/2,mod);
	res=(res*res)%mod;
	if(y&1)
		res=(res*x)%mod;
	return res;
}
/*ll binarysearch(ll va)
{
	ll n=1;
	ll l=va+1,u=n;
	ll st=num.order_of_key(va);
	while(l+1<u)
	{
		m=(l+u)/2;
		ll in=num.order_of_key(m);
		if(in-st==m-va)
		{
			l=m;
		}
		else
		{
            u=m;
		}
	}
	if(num1.find(l)==num1.end())
		return l;
	return u;
}*/
void solve(){
	int a,b;
	cin>>a>>b;
	if(a/10==0 && b/10==0) cout<<(a*b)<<"\n";
	else cout<<-1;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
 
    for(int i=1;i<=t;i++)
    {//cout<<"Case #"<<i<<": ";
    solve();}
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    ll H;
    cin >> H;
    ll hit=0;
    ll cnt = 1;
    while(H>1){
        H = H / 2;
        hit = hit + cnt;
        cnt = cnt * 2;
    }
    ll ans = hit + cnt;
    cout << ans << endl;
}

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

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector < int >v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}

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

	double ans = v[0];
	for (int i = 1; i < N; i++) {
		ans = (ans + (double)v[i]) / 2.0;
	}

	printf("%.10f\n", ans);

	return 0;
}


Measured memory_bytes: 256
N , K = map(int, input().split())
sushi = [list(map(int, input().split())) for i in range(N)]
top = [-10**10]*(N+1)
sub = [0]
cnt = 0
for t, d in sushi:
    if top[t] < d:
        sub.append(top[t])
        top[t] = d
    else:
        sub.append(d)
top.sort(reverse = True)
sub.sort(reverse = True)
top_dp = [0] *(N+1)
sub_dp = [0] * (N+2)
top_dp[1] = top[0]
sub_dp[1] = sub[0]
for i in range(1, N):
    top_dp[i+1] = top_dp[i] + top[i]
for i in range(1, len(sub)):
    sub_dp[i+1] = sub_dp[i] + sub[i]
dp = [0] * (K+1)
for i in range(1, K+1):
    dp[i] = top_dp[i] + sub_dp[K-i] + i*i
print(max(dp))

Measured memory_bytes: 42432
#include <stdio.h>

#define N 100 

typedef struct {
    int array[N];
} Array;

int bubble( Array *, int );

int main() {
    int i = 0,
        num = 0,
        inp = 0,
        ret = 0;

    Array a;

    scanf( "%d", &num );
    for( i=0; i < num; i++ ) {
        scanf( "%d", &a.array[i] );
    }
    ret = bubble( &a, num );

    for( i=0; i < num; i++ ) {
        if( i )
            printf(" ");
        printf( "%d", a.array[i] );
    }
    printf( "\n");
    printf( "%d\n", ret );

    return 0;
}

int bubble( Array *p, int n ) {
    int j = 0,
        flag = 1,
        count = 0,
        store = 0;

    while( flag ) {
        flag = 0;
        for( j=n-1; j >= 1; j-- ) {
            if( p->array[j] < p->array[j-1] ) {
                count += 1;
                store = p->array[j];
                p->array[j] = p->array[j-1];
                p->array[j-1] = store;

                flag = 1;
            }
        }
    }

    return count;
}


Measured memory_bytes: 2124
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
inline LL read() {
	LL x = 0, fh = 1;
	char c = getchar();
	while (c < '0' || c > '9') {
		if (c == '-') fh = -1;
		c = getchar();
	}
	while (c >= '0' && c <= '9') {
		x = (x << 1) + (x << 3) + c - '0';
		c = getchar();
	}
	return x * fh;
}
const LL N = 2e5 + 10, INF = 1e18;
LL n, k, l, r, mid, ll, rr, mmid, cnt, i, a[N];
int main() {
	n = read(); k = read();
	for (i = 0; i < n; i++) a[i] = read();
	sort(a, a + n);
	l = -INF; r = INF;
	while (l + 1 < r) {
		mid = l + r >> 1;
		cnt = 0;
		for (i = 0; i < n; i++) {
			if (a[i] < 0) {
				ll = i; rr = n;
				while (ll + 1 < rr) {
					mmid = ll + rr >> 1;
					if (a[i] * a[mmid] <= mid) rr = mmid;
					else ll = mmid;	
				}
				cnt += n - rr;
			}
			else {
				ll = i; rr = n;
				while (ll + 1 < rr) {
					mmid = ll + rr >> 1;
					if (a[i] * a[mmid] <= mid) ll = mmid;
					else rr = mmid;
				}
				cnt += ll - i;
			}
		} 
		if (cnt < k) l = mid;
		else r = mid;
	}
	cout << r;
	return 0;
}

Measured memory_bytes: 5100