akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

class B {
    static StreamWriter Out = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    static void Main(string[] args) {
        string S;
        Input(out S);
        for(; ; ) {
            S = S.Substring(0, S.Length - 1);
            if(S.Length % 2 == 0) {
                if(S.Substring(0, S.Length / 2).Equals(S.Substring(S.Length / 2, S.Length / 2))) {
                    Console.WriteLine(S.Length);
                    return;
                }
            }
        }
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void Inputs<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
    static void Print<T>(T s) => Out.WriteLine(s);
    static void Print<T>(params T[] s) => Out.WriteLine(string.Join(" ", s));
    static void Print<T>(IEnumerable<T> e) => Out.WriteLine(string.Join(" ", e));
}

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

N = int(input())
(T, A) = map(int, input().split(' '))
H = list(map(int, input().split(' ')))

d = 1000000
hi = 0
for i in range(N):
    h = H[i]
    dc = abs(A - (T - 0.006 * h))
    if dc < d:
        d = dc
        hi = i
        # print('{}: d={}, h={}'.format(i + 1, d, h))

print(hi + 1)


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

int main() {
	int h,w;cin>>h>>w;
	vector<vector<int>> a(h,vector<int>(w,0)),a2;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>a[i][j];
		}
	}
	a2=a;
	int count=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w-1;j++){
			if(a[i][j]%2){
				count++;
				a[i][j+1]++;
			}
		}
	}
	for(int i=0;i<h-1;i++){
		if(a[i][w-1]%2){
			count++;
			a[i+1][w-1]++;
		}
	}
	cout<<count<<endl;
	a=a2;
	for(int i=0;i<h;i++){
		for(int j=0;j<w-1;j++){
			if(a[i][j]%2){
				count++;
				a[i][j+1]++;
				cout<<i+1<<' '<<j+1<<' '<<i+1<<' '<<j+2<<endl;
			}
		}
	}
	for(int i=0;i<h-1;i++){
		if(a[i][w-1]%2){
			count++;
			a[i+1][w-1]++;
			cout<<i+1<<' '<<w<<' '<<i+2<<' '<<w<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 4096
import math

n = int(input())

p = []
for _ in range(n):
    p.append(tuple(map(int, input().split())))

s = 0
for i in range(n):
    x1, y1 = p[i]
    for j in range(n):
        x2, y2 = p[j]

        s += math.sqrt((x1-x2)**2 + (y1-y2)**2)

print(s/n)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N;
vector<int>a;
bool b[101];
ll res;

void dfs(int x) {
	if (x > N / 2) {
		ll s = 0;
		for (int i = 1; i <= N; ++i) {
			s += a[i];
		}
		res = max(res, s);
	}
	else {
		if (b[x]) {
			dfs(x + 1);
		}
		else {
			bool t = false;
			for (int i = x; i <= N; i += x) {
				if (a[i] < 0) {
					t = true;
					break;
				}
			}
			if (t) {
				ll s = 0;
				for (int i = 1; i < x; ++i) {
					s += a[i];
				}
				for (int i = x; i <= N; ++i) {
					s += max(a[i], 0);
				}
				if (s >= res) {
					queue<int>q;
					for (int i = x; i <= N; i += x) {
						q.push(a[i]);
						a[i] = 0;
						b[i] = true;
					}
					dfs(x + 1);
					for (int i = x; i <= N; i += x) {
						a[i] = q.front();
						q.pop();
						b[i] = false;
					}
				}
			}
			dfs(x + 1);
		}
	}
}

int main() {
	cin >> N;
	a = vector<int>(N + 1);
	for (int i = 1; i <= N; ++i) {
		cin >> a[i];
	}
	for(int i = N / 2 + 1; i <= N; ++i) {
		a[i] = max(a[i], 0);
	}
	dfs(1);
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1LL << 60;
ll dp[110][2][100];
string S;
ll K;
int main() {
    cin >> S >> K;
    int N = S.size();
 
    dp[0][0][0] = 1;
 
    for (int i = 0; i < N; i++) {
        int D = S[i] - '0';
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k <= K; k++) {
                int target = 9;
                if (j == 0) target = D;
                for (int d = 0; d <= target; d++) {
                    int cnt = 0;
                    if (d != 0) cnt++;
                    dp[i + 1][j || (d < D)][k + cnt] += dp[i][j][k];
                }
            }
        }
    }
 
    ll ans = 0;
    ans += dp[N][0][K];
    ans += dp[N][1][K];
    cout << ans << endl;
}

Measured memory_bytes: 3728
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = Integer.parseInt(in.next());
            int ans = 0;
            for (int i = 1; i <= N; i++) {
                if (i % 2 == 0) continue;
                int cnt = 0;
                for (int j = 1; j <= N; j++) {
                    if (i % j == 0) cnt++;
                }
                if (cnt == 8) {
                    ans++;
                }
            }
            out.println(ans);
        }

    }
}



Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
bool compare(string a, string b) 
{ 
    return (a+b < b+a); 
} 
  
string lexSmallest(string a[], int n) 
{ 
    // Sort strings using above compare() 
    sort(a, a+n, compare); 
  
    // Concatenating sorted strings 
    string answer = ""; 
    for (int i = 0; i < n; i++) 
        answer += a[i]; 
  
    return answer; 
} 
int main(){
   int n,l;
   cin>>n>>l;
   string A[n];
   for(int i=0;i<n;i++) cin>>A[i];
   cout<<lexSmallest(A,n);   
   return 0;
}



Measured memory_bytes: 3632
package main

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

func main() {
	nextReader = newScanner()
	n, a, b := nextInt(), nextInt(), nextInt()
	fmt.Println((n / (a + b) * a) + min(n%(a+b), a))
}

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

// ---------------------------------------------------------------
// I/O
// ---------------------------------------------------------------
var nextReader func() string

func newScanner() func() string {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 1024), int(1e11))
	sc.Split(bufio.ScanWords)
	return func() string {
		sc.Scan()
		return sc.Text()
	}
}

func nextString() string { return nextReader() }

func nextInt() int { n, _ := strconv.Atoi(nextReader()); return n }

func nextInts(size int) []int {
	ns := make([]int, size)
	for i := 0; i < size; i++ {
		ns[i] = nextInt()
	}
	return ns
}


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

int main() {
    int a[3][3];
    vector<vector<bool>> b(3,vector<bool>(false));
    rep(i,3){ 
        rep(j,3) cin >> a[i][j];
    }
    int n;
    cin >> n;
    rep(l,n){
        int k;
        cin >> k;
        rep(i,3){ 
            rep(j,3) {
                if(a[i][j]==k) b[i][j]=true;
            }
        }
    }
    if((b[0][0]&&b[0][1]&&b[0][2])||(b[1][0]&&b[1][1]&&b[1][2])||(b[2][0]&&b[2][1]&&b[2][2])||(b[0][0]&&b[1][0]&&b[2][0])||(b[0][1]&&b[1][1]&&b[2][1])||(b[0][2]&&b[1][2]&&b[2][2])||(b[0][0]&&b[1][1]&&b[2][2])||(b[2][0]&&b[1][1]&&b[0][2])){
        cout << "Yes" <<endl;
    } else {
        cout << "No" << endl;
    }
}

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

using namespace std;
int a,b;
int main()
{
	//freopen("dfh.in","r",stdin);
//	freopen("dfh.out","w",stdout);
	cin>>a>>b;
	int o=b+1-a;
	int u=b-1+a;
	for(int i=o;i<=u;i++)
	{
		cout<<i<<" ";
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void swap(int *from,int*to);

int main(void) {
	int n, j, i,m;
	int array[100];

	scanf("%d", &n);
	for (i = 0; i<n; i++) {
		scanf("%d", &array[i]);
	}

	for (i = 1; i<=n; i++) {
		j = i;

		for (m = 0; m < n; m++) {
			
			if (m == n - 1){
			    printf("%d\n",array[m]);
			    
		}else {printf("%d ", array[m]);}
		}
		while (j>0 && array[j - 1]>array[j]) {
			swap(&array[j - 1], &array[j]);
			j--;
		}
	}

	return 0;
}

void swap(int *from, int*to) {
	int tmp = *from;
	*from = *to;
	*to = tmp;
}


Measured memory_bytes: 2064
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = 92233720368547758;
#[allow(dead_code)]
static INF_I32: i32 = 21474836;
#[allow(dead_code)]
static INF_USIZE: usize = 18446744073709551;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

fn main() {
    use itertools_num::ItertoolsNum as _;
    input! {
       L:usize,
       R:usize,
       d:usize,
    }

    let mut ans: usize = 0;
    for i in L..R + 1 {
        if i % d == 0 {
            ans += 1;
        }
    }

    echo!(ans);
}


Measured memory_bytes: 2160
#include"bits/stdc++.h"
using namespace std;
int main()
{
	int num;
	int sum=0;
	scanf("%1d",&num);
	if(num)
	{
		sum++;
	}
	scanf("%1d",&num);
	if(num)
	{
		sum++;
	}
	scanf("%1d",&num);
	if(num)
	{
		sum++;
	}
	printf("%d",sum);
} 

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

    final int MOD = 1000000007;
    int N = scanner.nextInt();
    int M = scanner.nextInt();

    List<Long> factorials = new ArrayList<>();
    int k = M;
    for (int i = 2; i <= M && k > 1; i++) {
      long count = 0;
      while (k % i == 0) {
        count++;
        k /= i;
      }
      if (count > 0) factorials.add(count);
    }

    long count = 1;
    for(long f : factorials) {
      count = (count * choose(f + N - 1, f, MOD)) % MOD;
    }
    System.out.println(count);
  }

  public static long choose(long n, long k, long mod) {
    if (k > n - k) return choose(n, n - k, mod);
    long res = 1;
    for (int i = 0; i < k; i++) {
      res = (res * (n - i)) % mod;
    }
    for (int i = 1; i <= k; i++) {
      res = (res * inverse(i, mod)) % mod;
    }
    return res % mod;
  }

  public static long inverse(long a, long mod) {
    return modpow(a, mod - 2, mod);
  }

  public static long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
      if (n % 2 == 1) res = (res * a) % mod;
      a = (a * a) % mod;
      n >>= 1;
    }
    return res % mod;
  }
}


Measured memory_bytes: 23252
#include <stdio.h>
int main(void){
    // Here your code !
    int H,M,S,MA;
    scanf("%d",&MA);
    H = MA/3600;
    M = (MA-(3600*H))/60;
    S = MA-(H*3600+M*60);
    printf("%d:%d:%d\n",H,M,S);
    return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a=nxt(),b=nxt();
    if(a>9||b>9)
    {
    	cout<<"-1\n";

    }
    else
    	cout<<a*b<<endl;

    return 0;   
}


 
 


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
int n;
struct node{int col[4];
    node nxt(){ return node{col[1],col[2],col[3],col[0]};}
    friend bool operator <(node a,node b)
    {
        for (int i=0;i<4;i++)
            if (a.col[i]!=b.col[i]) return a.col[i]<b.col[i];
        return 0;
    }
}a[410],a1,a2,a3,a4;
map<node,int>mp;
void insert(node x,int v)
{for (int i=0;i<4;i++,x=x.nxt()) mp[x]+=v;}


node xx,yy;
int id1;
ll ans,re;
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
    {
        scanf("%d%d%d%d",&a[i].col[0],&a[i].col[1],&a[i].col[2],&a[i].col[3]);    
        insert(a[i],1);    
    }
    for (int i=1;i<=n;i++)
    {
        insert(a[i],-1);
        for (int j=i+1;j<=n;j++)
        {
            insert(a[j],-1);
            for (int t=0;t<4;t++)
            {
                a1=node{a[j].col[1],a[i].col[0],a[i].col[3],a[j].col[2]};
                a2=node{a[i].col[1],a[j].col[0],a[j].col[3],a[i].col[2]};
                a3=node{a[j].col[1],a[j].col[0],a[i].col[1],a[i].col[0]};
                a4=node{a[i].col[3],a[i].col[2],a[j].col[3],a[j].col[2]};
                a[j]=a[j].nxt();                
                if (mp[a1]==0||mp[a2]==0||mp[a3]==0||mp[a4]==0) continue;
                re=1;
                re*=mp[a1];insert(a1,-1);
                re*=mp[a2];insert(a2,-1);
                re*=mp[a3];insert(a3,-1);
                re*=mp[a4];
                insert(a1,1);insert(a2,1);insert(a3,1);
                ans+=re;

            }
            insert(a[j],1);
        }
    }
    cout<<ans;
}

Measured memory_bytes: 20352
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;
const int mod = 1000000007;

int main(){
  ll N,M;
  cin >> N >> M;
  if(N >= M/2){
    cout << M/2 << endl;
    return 0;
  }
  ll sa=M-2*N;
  cout << N+sa/4 << endl;
  return 0;
}


Measured memory_bytes: 256
c = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))
c.extend(c2)
c.extend(c3)
for a1 in range(c[0]+1):
  b1 = c[0]-a1
  b2 = c[1]-a1
  b3 = c[2]-a1
  a2 = c[3]-b1
  a3 = c[6]-b1
  ab = [a1,a2,a3,b1,b2,b3]
  for i in ab:
    if i < 0:
      break
  if (c[4]==a2+b2) & (c[5]==a2+b3) & (c[7]==a3+b2) & (c[8]==a3+b3):
    print("Yes")
    break
else:
  print("No")

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

int main(){
	int n, ans = 0;
	cin >> n;

	int a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n - 2; i++){
		if ((a[i] < a[i + 1] && a[i + 1] < a[i + 2]) || (a[i] > a[i + 1] && a[i + 1] > a[i + 2])) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>


int main(void)

{
	int n, x;
	int l[101];
	int i;
	int d[102];
	int count = 1;
	d[0] = 0;
	scanf("%d", &n);
	scanf("%d", &x);
	for (i = 0; i < n; i++) {
		scanf("%d", &l[i]);
		d[i + 1] = d[i] + l[i];
		if (d[i + 1] <= x) {
			count++;
			
		}
	}
	printf("%d", count);
	return 0;

}

Measured memory_bytes: 128
n = int(input())
h = list(map(int, input().split()))[::-1]

tmp = h.pop(0)

ans = "Yes"
for  i in h:
    if tmp > i:
        tmp = i
    elif tmp < i:
        if tmp < i-1:
            ans = "No"
        elif tmp == i-1:
            tmp = i-1

print(ans)

Measured memory_bytes: 14396
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	list<int> l;
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		int x;
		cin >> x;
		if (i & 1) l.push_back(x);
		else l.push_front(x);
	}
	vector<int> v(l.begin(), l.end());
	if (n % 2 == 1)
		reverse(v.begin(), v.end());
	for (int i = 0; i < v.size(); i++)
		printf("%d%c", v[i], " \n"[i + 1 == v.size()]);
	return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,
//tree_order_statistics_node_update> indexed_multiset;
#define all(x) (x).begin(),(x).end()
#define endl '\n'
//#define int long long



signed main() { //[J][O][L][S][K][E][Y]
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        string str; cin >> str;
        cout << (str[2] == str[3] && str[4] == str[5] ? "Yes" : "No");
        return 0;

}

/*

*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define lla(s) s.rbegin(),s.rend()
#define pcnt(b) __builtin_popcount(b)
#define vi vector<int>
#define vvi vector<vector<int>>
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const ll INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m,k;
    cin>>n>>m>>k;
    string ans ="No";
    rep(i,0,n+1){
        rep(j,0,m+1){
            int tmp = i*(m-j)+j*(n-i);
            if(tmp==k){ans="Yes";}
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
n = int(input())
x,y,h = [],[],[]
for i in range(n):
  xi,yi,hi = map(int, input().split())
  x.append(xi)
  y.append(yi)
  h.append(hi)
  if hi>0:
    num = i
  
for cx in range(0,101):
  for cy in range(0,101):
    H = h[num]+abs(x[num]-cx)+abs(y[num]-cy)
    if all([max(H-abs(xi-cx)-abs(yi-cy),0)==hi for xi,yi,hi in zip(x,y,h)]):
      print(cx,cy,H)
      sys.exit()

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

int main( ){
  int taro=0,hana=0,n;
  string a,b;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a>>b;
    if(a==b){
      taro++;
      hana++;
    }
    if(a>b)taro+=3;
    if(a<b)hana+=3;
  }
  cout<<taro<<" "<<hana<<endl;
  return 0;
}

Measured memory_bytes: 3132
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int r = sc.nextInt();
		if (n >= 10) {
			System.out.println(r);
		} else {
			System.out.println(r + 100 * (10 - n));
		}

	}

}

Measured memory_bytes: 21460
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<pair<int,int> , null_type,less<pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update> 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define fi first
#define se second
#define endl '\n'
#define int int64_t
#define double long double
#define fdt fuck donald trump
// mt19937 rnd(time(0));
// const int SMALL = LLONG_MIN >> 2;
const int BIG = LLONG_MAX >> 2;
const int MAXN = (int)2e5 + 3;
const int MOD = 998244353;

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
	// freopen("FDT.txt","r",stdin);
	int x, y, z, a, b, c;
	cin >> x >> y >> a >> b >> c;
	multiset<int> p, q;
	for(int i = 0; i < a; i ++){
		cin >> z;
		p.insert(z);
	}
	for(int i = 0; i < b; i ++){
		cin >> z;
		q.insert(z);
	}
	while(p.size() > x)
		p.erase(p.begin());
	while(p.size() < x)
		p.insert(0);
	while(q.size() > y)
		q.erase(q.begin());
	while(q.size() < y)
		q.insert(0);
	for(int i = 0; i < c; i ++){
		cin >> z;
		if(*p.begin() < *q.begin()){
			if(*p.begin() < z){
				p.erase(p.begin());
				p.insert(z);
			}
		}
		else{
			if(*q.begin() < z){
				q.erase(q.begin());
				q.insert(z);
			}
		}
	}
	int ans = 0;
	for(int u: p)
		ans += u;
	for(int u: q)
		ans += u;
	cout << ans;
}


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

using namespace std;

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

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

	int res = (K / 2) * ((K + 1) / 2);

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <sstream>
#include <numeric>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

// namespace
using namespace std;
namespace mp = boost::multiprecision;

// types
using pii = pair<int, int>;
using ll = long long int;
using ld = long double;
using mpi = mp::cpp_int;
using mpf = mp::number<mp::cpp_dec_float<1024>>;

// consts
int MOD = 1000000007;  // https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a


int main() {
    ll a, b, t, s, k;
    cin >> a >> b >> k;
    t = max((ll)0, a - k);
    s = max((ll)0, b - (k - (a - t)));
    cout << t << " " << s;
    return 0;
}


Measured memory_bytes: 256
n, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(n)]
ans = float("INF")
for a in range(2**n):
    d0 = [(a >> b) & 1 for b in range(n)]
    for c in range(2**n):
        d1 = [(c >> d) & 1 for d in range(n)]
        abc = [0] * 3
        ans_ = 0
        for i in range(n):
            if d0[i] == 1 and d1[i] == 1:
                if abc[0]: ans_ += 10
                abc[0] += l[i]
            elif d0[i] == 0 and d1[i] == 1:
                if abc[1]: ans_ += 10
                abc[1] += l[i]
            elif d0[i] == 1 and d1[i] == 0:
                if abc[2]: ans_ += 10
                abc[2] += l[i]
        if abc[0] == 0 or abc[1] == 0 or abc[2] == 0: continue
        ans_ += abs(abc[0]-A)+abs(abc[1]-B)+abs(abc[2]-C)
        ans = min(ans, ans_)
print(ans)

Measured memory_bytes: 3064
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<stack>
#define ll long long
#define inf 20021225
#define mid (l+r>>1)
#define M 1000100
#define N 400010
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
struct node{int x,y,id;}a[M],b[M];
struct edge{int to,lt;}e[M];
int poi,ls[N],rs[N],in[N],cnt,n,tot;
void add(int x,int y){e[++cnt].to=y; e[cnt].lt=in[x]; in[x]=cnt;}
void build(int &x,int l,int r,int tag)
{
	if(l==r)	return void(x=tag?a[l].id+n:b[l].id); if(!x) x=++poi;
	build(ls[x],l,mid,tag),build(rs[x],mid+1,r,tag); add(x,ls[x]),add(x,rs[x]);
}
void link(int x,int l,int r,int LL,int RR,int fr)
{
	if(LL>RR)	return;
	if(LL<=l&&RR>=r)	return void(add(fr,x));
	if(LL<=mid)	link(ls[x],l,mid,LL,RR,fr);
	if(RR>mid)	link(rs[x],mid+1,r,LL,RR,fr);
}
stack<int> stk;
int dfn[N],low[N],tms,col[N],cl; bool is[N];
void tarjan(int x)
{
	stk.push(x); dfn[x]=low[x]=++tms; is[x]=1;
	for(int i=in[x];i;i=e[i].lt)
	{
		int y=e[i].to;
		if(!dfn[y])	tarjan(y),low[x]=min(low[x],low[y]);
		else if(is[y])	low[x]=min(low[x],dfn[y]);
	}
	if(low[x]==dfn[x])
	{
		int w=0; cl++;
		do
		{
			w=stk.top(); stk.pop(); col[w]=cl; is[w]=0;
		}while(w!=x);
	}
}
int rem[N],rem_cnt,rtx,rty;
bool check(int val)
{
	int lx,rx;
	for(int i=1;i<=poi;i++)	in[i]=rem[i]; cnt=rem_cnt;
	lx=1,rx=1;
	for(int i=1;i<=n;i++)
	{
		while(lx<i&&a[i].x-a[lx].x>=val)	lx++;
		while(rx<=n&&a[rx].x-a[i].x<val)	rx++;
		link(rtx,1,n,lx,i-1,a[i].id),link(rtx,1,n,i+1,rx-1,a[i].id);
	}
	lx=1,rx=1;
	for(int i=1;i<=n;i++)
	{
		while(lx<=n&&a[i].x-b[lx].y>=val)	lx++;
		while(rx<=n&&b[rx].y-a[i].x<val)	rx++;
		link(rty,1,n,lx,rx-1,a[i].id);
	}
	lx=1,rx=1;
	for(int i=1;i<=n;i++)
	{
		while(lx<=n&&b[i].y-a[lx].x>=val)	lx++;
		while(rx<=n&&a[rx].x-b[i].y<val)	rx++;
		link(rtx,1,n,lx,rx-1,b[i].id+n);
	}
	lx=1,rx=1;
	for(int i=1;i<=n;i++)
	{
		while(lx<i&&b[i].y-b[lx].y>=val)	lx++;
		while(rx<=n&&b[rx].y-b[i].y<val)	rx++;
		link(rty,1,n,lx,i-1,b[i].id+n),link(rty,1,n,i+1,rx-1,b[i].id+n);
	}
	
	while(!stk.empty())	stk.pop(); tms=0;
	for(int i=1;i<=poi;i++)	dfn[i]=low[i]=is[i]=col[i]=0;
	for(int i=1;i<=poi;i++)	if(!dfn[i])	tarjan(i);
	for(int i=1;i<=n;i++)	if(col[i]==col[i+n])	return 0;
	return 1;
}
void get()
{
	int l=0,r=1e9,ans=0;
	while(l<=r)
	{
		int val=l+r>>1;
		if(check(val))	ans=val,l=val+1;
		else	r=val-1;
	}
	printf("%d\n",ans);
}
bool cmpx(node x,node y){return x.x<y.x;}
bool cmpy(node x,node y){return x.y<y.y;}
int main()
{
	n=read();
	for(int i=1;i<=n;i++)	a[i].x=b[i].x=read(),a[i].y=b[i].y=read(),a[i].id=b[i].id=i; poi=2*n;
	sort(a+1,a+n+1,cmpx); sort(b+1,b+n+1,cmpy);
	build(rtx,1,n,1); build(rty,1,n,0);
	for(int i=1;i<=poi;i++)	rem[i]=in[i];
	rem_cnt=cnt; get();
	return 0;
}

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

using namespace std;

int main(){
    int A, B, K; cin >> A >> B >> K;
    for(int i=min(A,B); i >= 1; --i){
        if(A % i ==0 && B % i == 0){
            --K;
            if(K == 0){
                cout << i << endl;
                return 0;
            }
        }
    }
    assert(false);
}

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


using namespace std;


#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()


ll sum(int n);

void go(){
	string a,b,c;cin>>a>>b>>c;
	cout << a[0] << b[0] << c[0];
}
int main(){
   
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);
   
   go();

   return 0;
}

ll sum(int n){                
   if(n == 0){
      return n;
   }else{
      return sum(n/10) + n%10;
   }
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using static System.Console;
using static System.Linq.Enumerable;
using static System.Math;

class Program
{
    static void Main()
    {
        var (A, B, C, X, Y) = ReadLine().Split(' ').Select(int.Parse).ToArray();

        var ans = Range(0, Max(X, Y) + 1).Select(i => A * Max(X - i, 0) + B * Max(Y - i, 0) + C * (i * 2)).Min();

        WriteLine(ans);
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


Measured memory_bytes: 28232
#include<stdio.h>
#define NIL -1
struct Node_struct{int p, l, r, s, d;};
typedef struct Node_struct Node;
Node T[25];
int D[25];
int H[25];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ", u, T[u].p, T[u].s, T[u].d+1, D[u], H[u]);

  if(T[u].p == NIL) printf("root\n");
  else if(T[u].l == NIL && T[u].r == NIL) printf("leaf\n");
  else printf("internal node\n");
   
}

void calcDepth(int u, int p){
  D[u] = p;
  if(T[u].l != NIL) calcDepth(T[u].l,p+1);
  if(T[u].r != NIL) calcDepth(T[u].r,p+1);
}

void calcHeight(int u){
  if(T[u].d == NIL) H[u] = 0;
  else{
    if(T[u].l != NIL) calcHeight(T[u].l);
    if(T[u].r != NIL) calcHeight(T[u].r);

    H[u] = H[T[u].l]+1;
    if( H[T[u].l] < H[T[u].r])  H[u] = H[T[u].r]+1;
  }
  
}

int main(){
  int i, j;
  int n;
  int id,l,r;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = T[i].s = T[i].d = H[i] = NIL;

  
  
  for(i=0; i<n; i++){
    scanf("%d %d %d", &id, &l, &r);
    if(l != -1){
      T[id].l = l;
      T[l].p = id;
      T[id].d++;
      if(r != -1) T[l].s = r;
    }
   if(r != -1){
      T[id].r = r;
      T[r].p = id;
      T[id].d++;
      if(l != -1) T[r].s = l;
    }
  }
  

  //根を求める (find the root)
  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }
  
  //それぞれのノードの深さを求める (find depth of each node)
  calcDepth(root, 0);

  calcHeight(root);
  
  //出力 (output)
  for(i=0; i<n; i++) print(i);
  
  return 0;
}



Measured memory_bytes: 2052
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    int N;
    cin >> N;
    vll X(N), Y(N);
    
    rep(i, N) {
        cin >> X[i] >> Y[i];
    }
    int ans = INF;
    rep(i, N) {
        rep(j, N) {
            ll p = X[i] - X[j];
            ll q = Y[i] - Y[j];
            int minus = 0;
            rep(k, N) {
                int connect_count = 0;
                REP(l, 0, N) {
                    if (k == l) continue;
                    if (X[l] == X[k] - p && Y[l] == Y[k] - q) {
                        connect_count++;
                    }
                    
                }
                if (connect_count == 1)
                    minus += 1;
                if (connect_count >= 2)
                    minus += 2;
  
            }
            ans = min(ans, N - minus);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template<int mod>
struct ModInt{
    int x;

    ModInt() : x(0) {}
    
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    
    ModInt &operator+=(const ModInt &p){
        if((x += p.x) >= mod)   x -= mod;
        return *this;
    }
    
    ModInt &operator-=(const ModInt &p){
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &p){
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }

    ModInt &operator/=(const ModInt &p){
        *this *= p.inverse();
        return *this;
    }
    
    ModInt operator-() const {return ModInt(-x);}

    ModInt operator+(const ModInt &p) const {return ModInt(*this) += p;}

    ModInt operator-(const ModInt &p) const {return ModInt(*this) -= p;}

    ModInt operator*(const ModInt &p) const {return ModInt(*this) *= p;}

    ModInt operator/(const ModInt &p) const {return ModInt(*this) /= p;}

    bool operator==(const ModInt &p) const {return x == p.x;}

    bool operator!=(const ModInt &p) const {return x != p.x;}

    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0){
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(int64_t n) const{
        ModInt ret(1), mul(x);
        while(n > 0){
            if(n & 1)   ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p){
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a){
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }

    static int get_mod() {return mod;}
};

using modint = ModInt<mod>;

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

    int N;
    cin >> N;
    vector<int> c(N + 1, 0);
    c[0] = 3;
    modint ans = 1;
    for(int i = 0; i < N; ++i){
        int A;
        cin >> A;
        if(!c[A]){
            cout << 0 << endl;
            return 0;
        }
        ans *= c[A]--;
        ++c[A + 1];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int a;
  cin>>a;
  if(a%10==3){
    cout<<"bon";
  }else if(a%10==0||a%10==1||a%10==6||a%10==8){
    cout<<"pon";
  }else{
    cout<<"hon";
  }
}

Measured memory_bytes: 3596
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int t1,t2;
	std::cin >> t1 >> t2;
	int a1,a2,b1,b2;
	std::cin >> a1 >> a2 >> b1 >> b2;
	int top = (a1-b1)*t1;
	int bottom = top + (a2-b2)*t2;
	if(bottom==0) {
		print("infinity");
		return 0;
	}
	if((top>0&&bottom>0) || (top<0&&bottom<0)) {
		print(0);
		return 0;
	}
	if(top<0)top*=-1;
	if(bottom<0)bottom*=-1;
	int count = 2*(top/bottom)+1;
	if(top%bottom==0) count--;
	print(count);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;
const int MAXN = 4e5+5;
multiset<int> s1;
int arr[MAXN];
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
        if(i == 1){
            s1.insert(arr[i]);
            continue;
        }
        
        auto it = s1.lower_bound(arr[i]);
        if(it != s1.begin()){
            it--;
        }
        
        
        if(*it>=arr[i]){
           
            s1.insert(arr[i]);
            
        }else{
             
            s1.erase(it);
            s1.insert(arr[i]);
        }
    }
    cout<<s1.size()<<endl;
}

Measured memory_bytes: 5376
import java.io.*;
import java.util.*;

public class Main {
    private static final boolean N_CASE = false;

    private void solve() {
        int L = sc.nextInt();
        double t = L / 3.0;
        double ans = t * t * t;
        System.out.println(ans);
    }

    private void run() {
        int T = N_CASE ? sc.nextInt() : 1;
        for (int t = 0; t < T; ++t) {
            solve();
        }
    }

    private static MyWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        private MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        int[] nextArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        List<Integer> nextList(int n) {
            List<Integer> list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                list.add(nextInt());
            }
            return list;
        }
    }

    private static class MyWriter extends PrintWriter {
        private MyWriter(OutputStream outputStream) {
            super(outputStream);
        }

        void printArray(int[] a) {
            for (int i = 0; i < a.length; ++i) {
                print(a[i]);
                print(i == a.length - 1 ? '\n' : ' ');
            }
        }

        void printlnArray(int[] a) {
            for (int v : a) {
                println(v);
            }
        }

        void printList(List<Integer> list) {
            for (int i = 0; i < list.size(); ++i) {
                print(list.get(i));
                print(i == list.size() - 1 ? '\n' : ' ');
            }
        }

        void printlnList(List<Integer> list) {
            list.forEach(this::println);
        }
    }

    public static void main(String[] args) {
        out = new MyWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().run();
        out.close();
    }
}

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

int main(){
               string S;cin >> S;int flag=0;
               for (int i = 1; i < 3; i++) {
                              if (S[i-1]==S[i] or S[i+1]==S[i]){
                                             flag ++;
                                             break;
                              }
               }
               if (flag != 0){
                              cout <<"Bad"<<endl;
               }else{
                              cout <<"Good"<<endl;
               }
}

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

using namespace std;

int main() {

	long n;
	cin >> n ;

	vector<pair<long,long>> a(n + 1);
	for (long i = 1; i <= n; i++) {
		cin >> a[i].first;
		a[i].second = i;
	}
	sort(a.begin(), a.end());

	for (long i = 1; i <= n-1; i++) {

		cout << a[i].second << " ";
	}
	cout << a[n].second << endl;
}

Measured memory_bytes: 2432
from operator import itemgetter

def solution(a):
    n = len(a)
    lhs, rhs = {-1 : 0}, {-1 : 0}
    for i in xrange(0, n, 2):
        if a[i] not in lhs:
            lhs[a[i]] = 0
        lhs[a[i]] += 1
    for i in xrange(1, n ,2):
        if a[i] not in rhs:
            rhs[a[i]] = 0
        rhs[a[i]] += 1
    lhs = sorted(lhs.items(), key = itemgetter(1), reverse = True)
    rhs = sorted(rhs.items(), key = itemgetter(1), reverse = True)
    if lhs[0][0] != rhs[0][0]:
        return n - lhs[0][1] - rhs[0][1]
    else:
        return min(n - lhs[0][1] - rhs[1][1], n - lhs[1][1] - rhs[0][1])

def main():
    n = int(raw_input().strip())
    a = [int(i) for i in raw_input().strip().split()]
    print solution(a)

if __name__ == '__main__':
    main()


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

const string YES = "Yes";
const string NO = "No";

void solve(long long a, long long b, long long c){
    const ll ab = a + b;
    if(c < ab){
        cout << NO << endl;
        return;
    }
    if(4 * a * b < (c * c + ab * ab - 2 * c * ab)){
        cout << YES << endl;
    }else{
        cout << NO << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    long long c;
    scanf("%lld",&c);
    solve(a, b, c);
    return 0;
}


Measured memory_bytes: 256
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

N = iin()
S = [input() for _ in range(N)]

s = collections.Counter(S)

mv = s.most_common()[0][1]
ans = []
for k,v in s.items():
    if v == mv:
        ans.append(k)
ans = sorted(ans)
for a in ans:
    print(a)



Measured memory_bytes: 46824
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>

using namespace std;

int main()
{
	int n;
	vector<int> arr, sol;
	vector<int>::iterator it;
	int i;
	int input;
	int lmin = 1000000001;

	scanf("%d", &n);

	for (i = 0; i < n; i++)
	{
		scanf("%d", &input);

		arr.push_back(input);
	}

	sol.push_back(arr[0]);

	for (i = 1; i < n; i++)
	{
		it = lower_bound(sol.begin(), sol.end(), arr[i]);

		if (it == sol.begin())
		{
			sol.insert(sol.begin(), arr[i]);
		}

		else
		{
			*--it = arr[i];
		}
	}

	printf("%d\n", sol.size());

	return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
string str;

int main(){
	cin >> str;
	ll n = str.size();
	
	ll ans = 0;
	for(ll i = 1; i <= n; i++){
		for(ll j = 0; j <= n-i; j++){
			ans += max((ll)pow(2, j-1), 1LL)*stoll(str.substr(j, i))*max((ll)pow(2, n-i-j-1), 1LL);
			//cout << ans << endl;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256