akhauriyash/Code-Regression huggingface dataset:
package main

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

/*-----------Main-----------*/

func main() {
	n, k := readI(), readI()
	d := make([]int, k)
	sunuke := make([]bool, n)
	for i := 0; i < k; i++ {
		d[i] = readI()
		for j := 0; j < d[i]; j++ {
			sunuke[readI()-1] = true
		}
	}
	ans := 0
	for _, snk := range sunuke {
		if !snk {
			ans++
		}
	}
	fmt.Println(ans)
}

/*-----------Utilities-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/sample-2.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}

func max(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] > m {
			m = a[i]
		}
	}
	return m
}

func min(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] < m {
			m = a[i]
		}
	}
	return m
}

func sortI(a []int) []int {
	sort.Ints(a)
	return a
}

func reverse(a []int) []int {
	l := len(a)
	r := make([]int, l)
	for i := 0; i < l; i++ {
		r[i] = a[l-i-1]
	}
	return r
}

func countI(a []int, b int) int {
	l := len(a)
	var c int
	for i := 0; i < l; i++ {
		if a[i] == b {
			c++
		}
	}
	return c
}


Measured memory_bytes: 1820
#include <iostream>
#include <vector>
#include <math.h>

int main() {
    long long n;
    std::cin >> n;

    std::vector<int> as;
    as.reserve(n);

    int max = 0;
    int max_idx = -1;

    for (int i = 0; i < n; ++i) {
        int a;
        std::cin >> a;
        as.push_back(a);

        if (a > max) {
            max = a;
            max_idx = i;
        }
    }

    int second_max = 0;
    for (int i = 0; i < n; ++i) {
        if (i == max_idx) {
            continue;
        }
        if (as[i] > second_max) {
            second_max = as[i];
        }
    }

    for (int i = 0; i < n; ++i) {
        if (i != max_idx) {
            std::cout << max << "\n";
        } else {
            std::cout << second_max << "\n";
        }
    }

    return 0;
}


Measured memory_bytes: 2432
import java.util.*;
public class Main {
 public static void main(String...args) {
   final Scanner sc = new Scanner(System.in);
   final int A = sc.nextInt();
   final int B = sc.nextInt();
   final int C = sc.nextInt();
   System.out.println(A == B && B == C ? "Yes" : "No");
 }
}

Measured memory_bytes: 22868
K, N = map(int, input().split())
li1 = list(map(int, input().split()))
i = 0
li2 = []
while i <= N-2:
  li2.append(li1[i+1] - li1[i])
  i += 1
li2.append(li1[0]+K - li1[N-1])
print(K - max(li2))

Measured memory_bytes: 26436
#include<bits/stdc++.h>
using namespace std;
long long f[100001],sons[100001];
int a[100001],b[100001];
long long n,m;
long long now;
vector<long long> out;
int Find(int x){
    return f[x]==x?x:f[x]=Find(f[x]);
}
void merge(int x,int y){
    out.push_back(sons[x]*sons[y]+now);
    now+=sons[x]*sons[y];
    sons[y]+=sons[x];
    f[x]=y;
}
main(){
    cin>>n>>m;
    for(int i=0;i<m;i++)
        cin>>a[i]>>b[i];
    for(int i=0;i<n;i++)
        f[i]=i,sons[i]=1;
    out.push_back(0);
    for(int i=m-1;i>0;i--){
        long long x=a[i],y=b[i];
        if(Find(x)==Find(y)){
            out.push_back(now);
            continue;
        }
        merge(f[x],f[y]);
    }
    long long large=n*(n-1)/2;
    for(int i=out.size()-1;i>=0;i--)
        cout<<large-out[i]<<endl;
    return 0;
}

Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 1e9+7;

int main(){
    char c; cin >> c;
    if(c < 97) cout << "A" << endl;
    else cout << "a" << endl;
}

Measured memory_bytes: 3636
n = int(input())
L = []
for _ in range(n):
    a,b = map(int,input().split())
    L.append(((a+b),a,b))
L.sort(reverse=True)
ta = 0
ao = 0
for i in range(n):
    if i % 2 == 0:
        ta += L[i][1]
    else:
        ao += L[i][2]
print(ta-ao)

Measured memory_bytes: 25872
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N,K;cin>>N>>K;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  int64_t sum=0;
vector<int64_t>B(N);
  for(int i=0;i<N;i++){
  sum=(sum+A.at(i))%K;
    B.at(i)=sum-i;
  }int64_t ans=0;
  for(int i=0;i<N;i++)
    if(B.at(i)==1)ans++;
  map<int64_t,int64_t>M;
  for(int64_t i=0;i<N;i++){
    if(0<=i-K)
    M.at(B.at(i-K))--;
    if(M.count(B.at(i)))
      ans+=M.at(B.at(i));
    if(M.count(K+B.at(i)))
      ans+=M.at(K+B.at(i));
    if(M.count(B.at(i)))
       M.at(B.at(i))++;
       else
       M[B.at(i)]=1;
  }cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 18820
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define int long long

const int INF = 1e16 + 7;

int f(int a, int b) {
    if (a % 2) {
        int mid = (a + 1) / 2;
        return abs(b - mid);
    }
    else {
        if (b <= (a / 2)) return (a / 2) - b;
        else return b - (a / 2) - 1;
    }
}

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

    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];

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

    int mx = a[n - 1];
    int best = INF;
    for (int i = 0; i < n - 1; ++i) {
        if (f(mx, a[i]) < f(mx, best)) best = a[i]; 
    }

    cout << mx << ' ' << best << '\n';
    return 0;
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    char s[123321];
    Scs(s);
    int N = strlen(s);

    int ans = 0;
    Rep(i,N/2){
        ans += (s[i]!=s[N-i-1]);
    }

    printf ("%d\n", ans );

    return 0;
}



Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] line = Stream.of(sc.nextLine().split(" ", 0)).mapToInt(Integer::parseInt).toArray();
		Arrays.sort(line);
		if (line[1] == line[0] && line[1] == line[2]) {
			System.out.println("No");
		}else {
			if (line[1] == line[0] || line[1] == line[2]) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}
}

Measured memory_bytes: 36112
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a < b) {
			System.out.println("a < b");
		}else if (a > b) {
			System.out.println("a > b");
		}else {
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 26156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, begin, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll N;
    vector<ll> A(5);
    cin >> N;
    ll min = 1000000000000000;
    rep(i, 0, 5)
    {
        ll a;
        cin >> a;
        if (min > a)
        {
            min = a;
        }
    }
    if (N % min == 0)
    {
        cout << 4 + N / min << endl;
    }
    else
    {
        cout << 4 + N / min + 1 << endl;
    }
}

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

int     main() {
        int N;
        cin >>N;
        vector<long> X(N);
        vector<long> XX(N);
        for (int i=0; i<N; i++) {
                cin >>X.at(i);
                XX.at(i)=X.at(i);
        }
        sort(XX.begin(), XX.end());
        long X0=XX.at(N/2-1);
        long X1=XX.at(N/2);
        for (int i=0; i<N; i++)
                if (X.at(i)<X1)
                        cout <<X1 <<endl;
                else
                        cout <<X0 <<endl;
        return 0;
};

Measured memory_bytes: 5376
import sys
def slove():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    sc = 0
    for i in range(n + 1):
        if i == 0:
            sc += abs(0 - a[i])
        elif i == n:
            sc += abs(0 - a[i-1])
        else:
            sc += abs(a[i] - a[i-1])
    for i in range(n):
        if i == 0:
            print(sc + abs(a[i+1] - 0) - abs(a[i] - 0) - abs(a[i+1] - a[i]))
        elif i == n - 1:
            print(sc + abs(a[i-1] - 0) - abs(a[i] - 0) - abs(a[i] - a[i-1]))
        else:
            print(sc + abs(a[i-1] - a[i+1]) - abs(a[i-1] - a[i]) - abs(a[i+1] - a[i]))


if __name__ == '__main__':
    slove()


Measured memory_bytes: 64620
#include <cstdio>
#include <iostream>
#include <sstream>

#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <chrono>
#include <random>

using namespace std;
using i64 = int_fast64_t;
using ui64 = uint_fast64_t;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<i64>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<i64, i64>;

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

int main() {
  const double eps = 1e-6;
  double h, w, x, y;
  cin >> w >> h >> x >> y;
  // bool a = (abs(w * y + h * x - h * w) < eps); // taikakusen not
  // bool b = (abs(y - h / w * x) < eps); // taikakusen not
  // bool c = !((abs(y - h/2) < eps) ^ (abs(x - w/2) < eps)); // center not
  // bool d = !(x < eps | y < eps | abs(x-w) < eps | abs(y-h) < eps);
  // cerr << abs(w * y + h * x - h * w) << endl;
  // cerr << abs(y - h / w * x) << endl;
  // cerr << (abs(y - h/2)) << " " << abs(x - w/2) << endl;
  // cerr << a << " " << b << " " << c << endl;
  cout << h * w / 2 << " " << ((abs(y - h / 2) < eps) && (abs(x - w / 2) < eps)) << endl;
  // cout << (d & ((a&b&c) | ((!a)&(!b)&c))) << endl;
  return 0;
}


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

int main() {
  int N;
  cin>>N;
  vector<int> A(N);
  vector<int> X(N);
  for(int j=0;j<N;j++){
    cin>>A[j];
  }
  //int x1=0;
  for(int i=0;i<N;i++){
    if(i%2==1) X[0] -=A[i];
    else X[0]+= A[i];
  }

  for(int i=1;i<N;i++){
    X[i] = (A[i-1]-X[i-1]/2)*2;
  }

  for(int i=0;i<N;i++){
    if(i==N-1) cout<< X[i] <<endl;
    else cout<< X[i] <<" ";
  }



}


Measured memory_bytes: 2048
use std::io::stdin;
use std::cmp::{
    min,
    max,
};
use std::time::SystemTime;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::collections::HashSet;

#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read<T>() -> T
where T: std::str::FromStr
{
    read_line().parse::<T>().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T>() -> Vec<T>
where T: std::str::FromStr
{
    read_line().split(" ").map(|n| n.parse::<T>().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn read_chars() -> Vec<char>
{
    read_line().chars().collect()
}

#[allow(dead_code)]
fn print_time() -> () {
    println!("{:?}", SystemTime::now());
}

trait BinarySearchLeft<T> {
    fn binary_search_left(&self, x: &T) -> Result<usize, usize>;
}

impl<T> BinarySearchLeft<T> for Vec<T>
where T: std::cmp::Ord + std::fmt::Debug
{
    fn binary_search_left(&self, x: &T) -> Result<usize, usize> {
        let index = self.binary_search(x);
        match index {
            Ok(index) => {
                for i in (1..index+1).rev() {
                    if self[i] != self[i - 1] {
                        return Ok(i - 1)
                    }
                }
                
                Ok(index)
            },
            _ => index,
        }
    }
}

#[allow(unused_variables)]
fn main() {
    let nw: Vec<usize> = read_vec();
    let mut l = vec![];
    for _ in 0..nw[0] {
        let m: Vec<usize> = read_vec();
        l.push(m);
    }

    let mut dp: Vec<Vec<usize>> = vec![];
    for _ in 0..nw[0]+1 {
        let v = vec![0; nw[1]+1];
        dp.push(v);
    }

    for i in 0..nw[0] {
        let item = &l[i];
        for j in 0..nw[1]+1 {
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            if j + item[0] <= nw[1] {
                dp[i + 1][j + item[0]] = max(dp[i + 1][j + item[0]], dp[i][j] + item[1]);
            }
        }
    }

    println!("{:?}", dp[nw[0]][nw[1]])
}


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

int main() {
    int N;
    cin >> N;
    map<int, int> mp;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        mp[a]++;
    }

    int cnt1 = 0, cnt2 = 0;
    for (auto p : mp) {
        while (p.second >= 3) {
            p.second -= 2;
        }
        if (p.second == 2) {
            cnt2++;
        } else if (p.second == 1) {
            cnt1++;
        }
    }
    cnt1 += (cnt2 / 2) * 2;
    cnt2 %= 2;
    if (cnt2 > 0) {
        cnt1 = cnt1 + 2 * cnt2 - 2;
    }
    cout << cnt1 << endl;
}


Measured memory_bytes: 4992
n = gets.to_i

x = if n < 10
	  n
	elsif n < 100
	  9
	elsif n < 1000
	  9 + n - 99
    elsif n < 10000
      9 + 999 - 99
    elsif n < 100000
      9 + 999 - 99 + n - 9999
    else
      9 + 999 - 99 + 99999 - 9999
    end

puts x

Measured memory_bytes: 1788
k = 72
kk = k // 4
K = 1<<k
nu = lambda L: int("".join([hex(K+a)[3:] for a in L[::-1]]), 16)
st = lambda n: hex(n)[2:]
li = lambda s, l, r: [int(a, 16) % P if len(a) else 0 for a in [s[-(i+1)*kk:-i*kk] for i in range(l, r)]]

def grow(d, v, h):
    h += [0] * d
    f = [(-1 if (i+d) % 2 else 1) * fainv[i] * fainv[d-i] % P * h[i] % P for i in range(d+1)]
    nuf = nu(f)
    a = d * inv[v] % P
    t = [1] * (3*d+3)
    for i in range(1, 3*d+3): t[i] = t[i-1] * (a - d + i - 1) % P
    ti = [1] * (3*d+3)
    ti[-1] = pow(t[-1], P-2, P)
    for i in range(1, 3*d+3)[::-1]: ti[i-1] = ti[i] * (a - d + i - 1) % P
    iv = [1] * (3*d+3)
    for i in range(1, 3*d+3):
        iv[i] = ti[i] * t[i-1] % P

    ###
    g = [inv[i] for i in range(1, 2*d+2)]
    fg = li(st(nuf * nu(g)), d, d * 2 + 1)
    for i in range(d):
        h[i+d+1] = fg[i] * fa[d+i+1] % P * fainv[i] % P

    ###
    g = [iv[i] for i in range(1, 2*d+2)]
    fg = li(st(nuf * nu(g)), d, d * 2 + 1)
    for i in range(d+1):
        h[i] = h[i] * (fg[i] * t[d+i+1] % P * ti[i] % P) % P

    ###
    g = [iv[i] for i in range(d+2, 3*d+3)]
    fg = li(st(nuf * nu(g)), d, d * 2 + 1)
    for i in range(d):
        h[i+d+1] = h[i+d+1] * (fg[i] * t[2*d+i+2] % P * ti[d+i+1] % P) % P

    return h

# Create a table of the factorial of the first v+2 multiples of v, i.e., [0!, v!, 2v!, ..., (v(v+1))!]
def create_table(v):
    s = 1
    X = [1, v+1]
    while s < v:
        X = grow(s, v, X)
        s *= 2

    table = [1]
    for x in X:
        table.append(table[-1] * x % P)
    return table

def fact(i, table):
    a = table[i//v]
    for j in range(i//v*v+1, i+1):
        a = a * j % P
    return a

N, A, B = map(int, input().split())
P = 10**9+7

v = 1 << (N.bit_length() + 1) // 2
fa = [1] * (2*v+2)
fainv = [1] * (2*v+2)
for i in range(2*v+1):
    fa[i+1] = fa[i] * (i+1) % P
fainv[-1] = pow(fa[-1], P-2, P)
for i in range(2*v+1)[::-1]:
    fainv[i] = fainv[i+1] * (i+1) % P
inv = [0] * (2*v+2)
for i in range(1, 2*v+2):
    inv[i] = fainv[i] * fa[i-1] % P

T = create_table(v)
C = lambda n, k: fact(n, T) * pow(fact(k, T) * fact(n-k, T), P-2, P) % P
 
print((pow(2, N, P) - 1 - C(N, A) - C(N, B)) % P)

Measured memory_bytes: 153920
#include <stdio.h>
int main()
{
    char c;
    scanf("%c",&c);
    switch(c){
    case 'a':
    case 'e':
    case 'i':
    case 'o':
    case 'u':
    printf("vowel");
     break;
    default:
    printf("consonant");}
        return 0;
}


Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        var sc = new Scanner(System.in);
        var k = sc.nextInt();

        var sum = 0l;
        for (int a = 1; a <= k; a++) {
            for (int b = 1; b <= k; b++) {
                for (int c = 1; c <= k; c++) {
                    sum += gcdTriple(a, b, c);
                }
            }
        }

        System.out.println(sum);
        sc.close();
    }

    private static int gcd(int a, int b) {
        if (a < b) {
            var tmp = b;
            b = a;
            a = tmp;
        }

        var mod = a % b;
        if (mod == 0) {
            return b;
        } else {
            return gcd(b, mod);
        }
    }

    private static int gcdTriple(int a, int b, int c) {
        int[] arr = new int[]{ a, b, c };
        Arrays.sort(arr);
        int gcd1 = gcd(arr[1], arr[2]);
        return gcd(arr[0], gcd1);
    }
}


Measured memory_bytes: 53480
r,g,b,n = map(int, input().split())
ans = 0
for i in range(n+1):
    for j in range(n+1):
        k = n - (i*r + j*g)
        if k < 0:
            break
        elif k >= 0 and k%b == 0:
            ans += 1
print(ans)


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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M);
    vector<vector<int>> c(M);
    REP(i, M){
        cin >> a[i] >> b[i];
        c[i].resize(b[i]);
        REP(j, b[i]){
            cin >> c[i][j];
            --c[i][j];
        }
    }
    

    // dp[i][j]: i 番目の鍵まで見たとき、状態 j の宝箱を開けるのに必要な最小のコスト
    vector<vector<int>> dp(M+1, vector<int>(1<<N, 1e+9));
    dp[0][0] = 0;
    REP(i, M){
        REP(j, 1<<N) dp[i+1][j] = dp[i][j];
        int next = 0;
        REP(j, b[i]) next += (1<<c[i][j]);
        REP(j, 1<<N){
            dp[i+1][j|next] = min(dp[i+1][j|next], dp[i][j]+a[i]);
        }
    }

    int ans = dp[M][(1<<N)-1];
    if(ans == 1e+9) cout << -1 << endl;
    else cout << ans << endl;

    return 0;
}

Measured memory_bytes: 16384
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

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

int main() {
  ll N;
  ll a[5];
  cin >> N;
  ll min_n = pow(10, 15);
  rep(i, 5){
    cin >> a[i];
    min_n = min(min_n, a[i]);
  }
  ll ans = 0;
  if (N%min_n == 0) ans += 4 + N/min_n;
  else {
    ans += 5 + N/min_n;
  }
  
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(ll i = 0;i < (n); ++i)
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    string o,e;
    cin >> o >> e;
    int size = o.size() + e.size();
    int a=0,b=0;
    rep(i,size){
        if(i%2 == 0){
            cout << o[a];
            a++;
        }else{
            cout << e[b];
            b++;
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const double PI=3.14159265358979323846;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "

int main(void){
    int k,x;cin>>k>>x;
    for(int i=x-k+1;i<=x+k-1;++i){
        cosp(i);
    }
    cout<<"\n";
}




Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

void solve() {
  string W;
  cin >> W;
  ll ans = 0;
  while (true) {
    string a;
    cin >> a;
    if (a == "END_OF_TEXT") break;
    rep (i, a.size()) if ('A' <= a[i] and a[i] <= 'Z') a[i] += 'a' - 'A';
    if (a == W) ans++;
  }
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}



Measured memory_bytes: 3184
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll H, W;
  cin>>H>>W;
  ll N;
  cin>>N;
  map<pair<int, int> , int> amap;
  vector<pair<int, int> > arr;
  ll a, b;
  for(int i=0;i<N;++i){
    cin>>a>>b;
    a--;
    b--;
    if(a-2>=0 && b-2>=0){
      if(amap[mp(a-1, b-1)]==0) arr.push_back(mp(a-1, b-1));
      amap[mp(a-1, b-1)]++;
    }
    if(b-1>=0 && a-2>=0 && b+1<W){
      if(amap[mp(a-1, b)]==0) arr.push_back(mp(a-1, b));
      amap[mp(a-1, b)]++;
    }
    if(a-2>=0 && b+2<W){
      if(amap[mp(a-1, b+1)]==0) arr.push_back(mp(a-1, b+1));
      amap[mp(a-1, b+1)]++;
    }
    if(a-1>=0 && a+1<H && b-2>=0){
      if(amap[mp(a, b-1)]==0) arr.push_back(mp(a, b-1));
      amap[mp(a, b-1)]++;
    }
    if(a-1>=0 && a+1<H && b-1>=0 && b+1<W){
      if(amap[mp(a, b)]==0) arr.push_back(mp(a, b));
      amap[mp(a, b)]++;
    }
    if(a-1>=0 && a+1<H && b+2<W){
      if(amap[mp(a, b+1)]==0) arr.push_back(mp(a, b+1));
      amap[mp(a, b+1)]++;
    }
    if(a+2<H && b-2>=0){
      if(amap[mp(a+1, b-1)]==0) arr.push_back(mp(a+1, b-1));
      amap[mp(a+1, b-1)]++;
    }
    if(a+2<H && b-1>=0 && b+1<W){
      if(amap[mp(a+1, b)]==0) arr.push_back(mp(a+1, b));
      amap[mp(a+1, b)]++;
    }
    if(a+2<H && b+2<W){
      if(amap[mp(a+1, b+1)]==0) arr.push_back(mp(a+1, b+1));
      amap[mp(a+1, b+1)]++;
    }
  }
  map<int, int> bmap;
  for(int i=0;i<arr.size();++i){
    bmap[amap[arr[i]]]++;
  }
  ll sum = 0;
  for(int i=1;i<10;++i){
    sum += bmap[i];
  }
  cout<<(H-2)*(W-2)-sum<<endl;
  for(int i=1;i<10;++i){
    cout<<bmap[i]<<endl;
  }
}



Measured memory_bytes: 64360
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

let main() =
    let [| a; b |] = reada int
    if (a * b) &&& 1 > 0 then "Odd" else "Even"
    |> puts

    ()

main()
writer.Close()


Measured memory_bytes: 11220
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int a, b, c, ans;
    cin >> a >> b >> c;
    int m = a + b + c;
    int x[3] = {a, b, c};
    sort(x, x+3);

    if(m%2 == x[2]%2) {
        ans = (3*x[2] - m)/2;
    }
    else {
        ans = (3*x[2] + 3 - m)/2;
    }

    cout << ans << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    vec A(N);
    REP(i,0,N) cin >> A[i];

    map<ll,ll> C;
    ++C[0];
    ll d = 0;
    REP(i,0,N) {
        d += A[i];
        ++C[d];
    }

    ll cnt = 0;
    FORR(c,C) cnt += c.second * (c.second - 1) / 2;
    PR(cnt);

    return 0;
}

/*



*/

Measured memory_bytes: 17084
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<vector>
#define R register
#define next mlgvegetable
#define mul mlgvegetable
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
inline ll read();
inline void write(ll x);
inline void writeln(ll x);
inline void writesp(ll x);
ll n;
ll num[1000000];
inline bool check(ll x,ll y){
	ll ans=0;
	for(;x>1;x/=10) ans++;
	for(;y>1;y/=10) ans++;
	if(ans>=20) return false;
	return true;
}
ll mul;
int main(){
	n=read();
	mul=1;
	for(ll i=1;i<=n;i++){
		num[i]=read();
		if(!num[i]){
			writeln(0);
			return 0;
		}
	}
	for(ll i=1;i<=n;i++){
		if(!check(mul,num[i])){
			writeln(-1);
			return 0;
		}
		else{
			mul*=num[i];
			if(mul>1000000000000000000){
				writeln(-1);
				return 0;
			}
		}
	}
	writeln(mul);
}
inline ll read(){
	ll x=0,t=1;char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') t=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*t;
}
inline void write(ll x){
	if(x<0){putchar('-');x=-x;}
	if(x<=9){putchar(x+'0');return;}
	write(x/10);putchar(x%10+'0');
}
inline void writesp(ll x){
	write(x);putchar(' ');
}
inline void writeln(ll x){
	write(x);putchar('\n');
}

Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

int main(){
    int A,B;
  	cin >> A >> B;
  	
  	if(B%A==0){
      	cout << A+B << endl;
    }else{
      	cout << B-A << endl;
    }    
}

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

vector<long long> enum_div(long long n)//nの約数を昇順に列挙
{
	vector<long long> ret1; //小さい方の約数を格納
	vector<long long> ret2; //大きい方の約数を格納
	for(long long i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret1.push_back(i);
			if(i*i!=n)
			{
				ret2.push_back(n/i);
			}
		}
	}
	reverse(ret2.begin(), ret2.end());
	ret1.insert(ret1.end(), ret2.begin(), ret2.end());
	return ret1;
}

int digitNum(long long n){
  int result = 0;
  while(n > 0){
    n /= 10;
    result++;
  }
  return result;
}


int main()
{
  long long N;
  cin >> N;
	vector<long long> r = enum_div(N);
  vector<int> r_digit;
  int r_size = r.size();
  for(int i=0;i<r.size();i++){
    r_digit.push_back(digitNum(r[i]));
    //cout << r_digit[i] << "\n";
  }

  int half_r_size = r_size / 2;
  int result = 100;
  for(int i=0;i<=half_r_size;i++){
    result = min(result, max(r_digit[i], r_digit[r_size-i-1]));
  }

  cout << result << "\n";
	return 0;
}


Measured memory_bytes: 256
from sys import stdin
import math
import bisect
import heapq
import numpy as np

inf = 10**10
li = []
s = stdin.readline().rstrip()
for i in s:
    li.append(i)

li = li[:1]+li[2:]

if li[0]==li[1]:
    print("=")
else:
    lin = sorted(li)
    if li == lin:
        print("<")
    else:
        print(">")

Measured memory_bytes: 12204
from collections import*
v,n=map(int,input().split())
n+=v-1
es=[[int(x)for x in input().split()]for _ in range(n)]
outs=defaultdict(list)
ins=defaultdict(int)
for v1,v2 in es:
    outs[v1].append(v2)
    ins[v2]+=1
q=deque(v1 for v1 in range(v)if not ins[v1])
res=[]
p=[0]*-~v
while q:
    v1=q.popleft()
    res.append(v1)
    for v2 in outs[v1]:
        ins[v2]-=1
        if ins[v2]==0:
            q.append(v2)
            p[v2]=v1
for t in p[1:]:print(t)

Measured memory_bytes: 49336
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

MOD = 10 ** 9 + 7

N, M = list(map(int, sys.stdin.readline().split()))
X = list(map(int, sys.stdin.readline().split()))
Y = list(map(int, sys.stdin.readline().split()))


def ModInt(mod):
    class _ModInt:
        def __init__(self, value):
            self.value = value % mod

        def __add__(self, other):
            if isinstance(other, _ModInt):
                return _ModInt(self.value + other.value)
            else:
                return _ModInt(self.value + other)

        def __radd__(self, other):
            return self.__add__(other)

        def __mul__(self, other):
            if isinstance(other, _ModInt):
                return _ModInt(self.value * other.value)
            else:
                return _ModInt(self.value * other)

        def __truediv__(self, other):
            # TODO: 実装
            raise NotImplementedError()

        def __repr__(self):
            return str(self.value)

    return _ModInt


MI = ModInt(MOD)
X = np.diff(X)
Y = np.diff(Y)
X = np.array([MI(x) for x in X])
Y = np.array([MI(y) for y in Y])

#  あるエリアが何回カウントされるか
xc = np.arange(len(X), -len(X), -2).cumsum()
yc = np.arange(len(Y), -len(Y), -2).cumsum()

print(np.dot(X, xc) * np.dot(Y, yc))


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

int main()
{
    int n;
    cin >> n;
    if (n % 2 != 0)
    {
        cout << (n + 1) / 2 << endl;
    }
    else
    {
        cout << n / 2 << endl;
    }
}


Measured memory_bytes: 256
import collections
from collections import defaultdict
import math
import numpy as np
import re
import itertools


n,m,q=map(int, input().split()) 

s=[list(map(int,list(input().split()))) for i in range(q)] 

ans = 0

for i in itertools.combinations_with_replacement(range(1,m+1), r=n):
    #if i[0] > i[1] or i[0] > i[2] or i[1] > i[2]:
    #    continue
    tmp_ans = 0
    for j in s:    
        #print(i[j[0]-1],i[j[1]-1],j)  
        if i[j[1]-1]-i[j[0]-1] == j[2]:
            tmp_ans += j[3]
    ans = max(ans,tmp_ans)

print(ans)

Measured memory_bytes: 27188
s = input()

max_plus = len(s) - 1

numList = [int(c) for c in s]

sMax = (1 << max_plus) - 1

ans = 0

for plus_pos in range(sMax + 1):
    sum = 0

    num = numList[0]

    for i in range(max_plus):
        if ((plus_pos >> i) & 1) == 1:
            sum += num
            num = numList[i + 1]
        else:
            num = num * 10 + numList[i + 1]

    sum += num
    ans += sum

print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<array>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(){
	int N;
	cin >> N;
  int ans;
ans=0;
vector<int> A(N);
 for(int i=0; i<N; i++){
  cin >>A[i];}
for(int i=0; i<N; i++){
	if(A[i]==A[i+1]){
ans++; i++;
  }
}
  cout << ans << endl;
}

Measured memory_bytes: 256
S = str(input())

a = int(S[:2])
b = int(S[2:])

if a > 12 or a <= 0:
    if b > 12 or b <= 0:
        print('NA')
    else:
        print('YYMM')
else:
    if b > 12 or b <= 0:
        print('MMYY')
    else:
        print('AMBIGUOUS')

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

int main(){
    int N, T, A, B, E = 0;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A >> B;
        T = (B + 1) - A;
        E += T;
    }
    cout << E << endl;
}


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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second

#ifdef OJ
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#else
#define debug(x)
#define debugv(x)
#endif

#define all(x) (x).begin(), (x).end()
#define rsort(x) sort((x).rbegin(), (x).rend())
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return 0;}while(0)

const int MOD = 998244353; //1e9+7;
const int MAXN = 2e5+3;
const int INF = 1e9;

vector<int> primes;
vector<int> smallest;

void sieve(int n) {
    smallest = vector<int>(n+1);
    for (int p=2; p<=n; p++) smallest[p] = p;
    for (int p=2; p<=n; p++) {
        if (smallest[p] == p) {
            primes.pb(p);
            for (int i = p+p; i <= n; i += p)
                smallest[i] = p;
        }
    }
}

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    sieve(2e6);
    //int ntest; cin >> ntest; while(ntest--) 
    {
        LL n; cin >> n;
        if(n == 1) RETURN(0);
        int ans = 0;
        for(auto p : primes) {
            int c = 0;
            while(n%p == 0) {
                c++;
                n /= p;
            }
            int m = sqrt(2*c);
            if(m*(m+1) > 2*c) m--;
            ans += m;
        }
        if(n != 1) ans++;
        cout << ans << endl;
    }

    return 0;
}


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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    int AB = A * B, CD = C * D;
    if(AB < CD){
        cout << CD << endl;
    }
    else{
        cout << AB << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    long long int x;
    long long int a;

    int y[10],i=0,sum=0,j,m;
    scanf("%lld",&x);
    a=x;
    while(x>0)
    {
        y[i]=x%10;
        x=x/10;
        i=i+1;
    }
    sum=y[i-1];
    for(j=i-2;j>-1;j--)
    {
        sum=sum+y[j];
    }

    if (a%sum==0)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
//debug
#define vecprint(v) rep(i,v.size())cout << v[i] << " ";cout << endl;
#define setprint(s) for(auto i=s.begin();i!=s.end();i++)cout << *i << " ";cout << endl;
#define mappairprint(s) for(auto i=s.begin();i!=s.end();i++)cout << i->first << " " << i->second << endl;cout << endl;
//reader
#define r1(a) cin>>(a)
#define r2(a,b) cin>>(a)>>(b)
#define r3(a,b,c) cin>>(a)>>(b)>>(c)
//writer
#define w1(a) cout<<(a)<<" "
#define w2(a,b) cout<<(a)<<" "<<(b)<<" "
#define w3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "
#define wl1(a) cout<<(a)<<endl
#define wl2(a,b) cout<<(a)<<" "<<(b)<<endl
#define wl3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
//variable definition
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
//roop
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define all(c) c.begin(),c.end()
//term
#define elif else if
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
using namespace std;
using ll = long long;
//const
constexpr double PI = 3.141592653589793238462643383279;
vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};


int main() {
  //input
  int d, t, s;
  cin >> d;
  cin >> t >> s;
  
  float x = s * t;
  float y = d;
  
  //process
  if (d <= s * t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  
}


Measured memory_bytes: 3604
import java.util.Scanner;

/**
 * 数球
 */
public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        {
            Long N = sc.nextLong();
            Long A = sc.nextLong();
            Long B = sc.nextLong();

            System.out.println(N/(A+B)*A+Math.min(A, N%(A+B)));
        }
    }
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 1000000007
#define int long long
#define ll long long
#define EPS 0.00000000000001
#define ld long double
#define inf 10000002
#define N 200004
#define K 7


int32_t main()
{
    IOS;

    int n;
    cin >> n;
    vector<int> v(n);
    int sum = 0;
    for(int i = 0;i < n;i++)
    {
        cin >> v[i];
        sum += v[i];
    }
    int c = 0;
    int ans = 10*sum;
    for(int i = 0;i < n;i++)
    {
        c += v[i];
        ans = min(ans,abs(sum - c - c));
    }
    cout << ans;
    
    return 0;

}
 
 

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

int main(){
    long long N,A,B,rot;
    cin>>N>>A>>B;
    rot = N/(A+B);
    if(N-rot*(A+B)>=A){
        cout<<rot*A+A<<endl;
    }else{
        cout<<rot*A+N-rot*(A+B)<<endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
int main(){
   int a,b,c,small,mid,high;
   scanf("%d %d %d",&a,&b,&c);
   small = min(min(a, b),c);
   high = max(max(a, b),c);
   printf("%d %d %d\n",small,a+b+c-small-high,high);

}




Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
namespace whatever{
	int readu(){
		char ch=getchar();
		while(!isdigit(ch))
			ch=getchar();
		int value=ch-'0';
		ch=getchar();
		while(isdigit(ch)){
			value=value*10+ch-'0';
			ch=getchar();
		}
		return value;
	}
	void writeu(int n){
		if(n<10)
			putchar(n+'0');
		else{
			writeu(n/10);
			putchar(n%10+'0');
		}
	}
	void run(){
		cerr<<"time(0): "<<time(0)<<endl;
		int n=readu();
		int i=0;
		for(int sum=0; true; ++i, sum+=i)
			if(sum>n){
				puts("No");
				return;
			}
			else if(sum==n)
				break;
		puts("Yes");
		writeu(i+1);
		putchar('\n');
		vector<vector<int> > result(i+1);
		int index=0;
		for(int j=0; j<=i; ++j){
			for(int k=0; k<j; ++k)
				result.at(j).push_back(index+k);
			for(int k=0; k<j; ++k)
				result.at(k).push_back(index+k);
			index+=j;
		}
		for(int j=0; j<=i; ++j){
			writeu(result.at(j).size());
			putchar(' ');
			for(int value: result.at(j)){
				writeu(value+1);
				putchar(' ');
			}
			putchar('\n');
		}
	}
}
int main(){
	whatever::run();
}

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

const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;
const int MOD = 1000000007;

typedef long long ll;

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

ll LCM(ll x, ll y)
{
    return x * y / GCD(x, y);
}

using Graph = vector<vector<int>>;

typedef pair<int, int> P;

int main()
{
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i, n)
    {
        cin >> l.at(i);
    }
    sort(l.begin(), l.end());
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int bound = lower_bound(l.begin(), l.end(), l.at(i) + l.at(j)) - l.begin();
            int count = bound - 1 - j;
            ans += count;
        }
    }
    cout << ans << endl;
}

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

bool DP(vector<int>& a, int A){    //部分和問題

    vector<vector<bool> > dp(a.size() + 5, vector<bool> (A + 5, false));
    
    //dp初期条件
    dp[0][0] = true;
    
    //dp
    for(int i = 0; i < a.size(); i++){
        for(int j = 0; j <= A; j++){
            dp[i + 1][j] = dp[i][j] || dp[i + 1][j];
            if(j >= a[i]) dp[i + 1][j] = dp[i][j - a[i]] || dp[i + 1][j];
        }
    }
    if(dp[a.size()][A]) return true;
    else return false;
}

int main(void){

    string s; cin >> s;
    s = s + 'T';
    int x, y; cin >> x >> y;
    vector<int> a;
    vector<int> b;
    int j = 0;
    int counter = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'T'){
            if(j == 0){
                x -= counter;
                j++;
                counter = 0;
            }else if(j % 2 == 0){
                if(counter > 0) a.push_back(counter);
                counter = 0;
                j++;
            }else if(j % 2 == 1){
                if(counter > 0) b.push_back(counter);
                counter = 0;
                j++;
            }
        }else{
            counter++;
        }
    }
    

    if(j % 2 == 0){
        if(counter > 0) a.push_back(counter);
    }else{
        if(counter > 0) b.push_back(counter);
    }

    
    
    if(x < 0) x = -x;
    if(y < 0) y = -y;

    a.push_back(x);
    b.push_back(y);
    int sum_a = 0, sum_b = 0;
    for(int i = 0; i < a.size(); i++) sum_a += a[i];

    for(int i = 0; i < b.size(); i++) sum_b += b[i];

    if(sum_a % 2 == 1 || sum_b % 2 == 1){  //sumが偶数であるのは必要条件であるため
        cout << "No" << endl;
        return 0; 
    }

    sum_a = sum_a / 2;
    sum_b = sum_b / 2;
    
    bool flag1, flag2;
    
    flag1 = DP(a, sum_a);  //数列a, A = sum_a の部分和問題
    flag2 = DP(b, sum_b);

    if(flag1 && flag2) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define PI acos(-1)
#define sz 100010
#define RUN_FAST ios::sync_with_stdio(false);
using namespace std;

int main()
{
    RUN_FAST; cin.tie(nullptr);
    ll n, a, b, tmp, sum, mod, cnt;
    cin >> n >> a >> b;
    if (!a) cout << 0 << endl;
    else {
        sum=a+b;
        tmp=n/sum;
        mod=n%sum;
        if (tmp>0) {
            cnt=tmp*a;
            if (mod<a) cnt+=mod;
            else cnt+=a;
        }
        else {
            if (mod<a) cnt=mod;
            else cnt=a;
        }
        cout << cnt << endl;
    }
    return 0;
}


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

int main(void) {
  int N;
  cin >> N;
  map<int, int> ma;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    ma[a]++;
    ma[a + 1]++;
    ma[a - 1]++;
  }
  int ans = -1;
  for (auto m : ma) {
    ans = max(m.second, ans);
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4736
use std::collections::HashSet;
use std::io;
 
fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("Error");
    let s = s.trim();

    let mut set = HashSet::new();
    for c in s.chars() {
        set.insert(c);
    }
    if 2 <= set.len() {
        println!("Yes");
    } else {
        println!("No");
    }
}

Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#define N 205
using namespace std;

typedef long long ll;
#define PI pair<ll, ll>
ll n, m, k, mn, a[N], s[N][1000], u[15];
ll v[N];
bool v2[N][1000];

struct st {
 ll c1, c2, c3;
};

bool operator < (st p, st q) {
	return p.c1 < q.c1;
}
priority_queue<st> qu;
vector<ll> b[N], c[N];
void f(ll p, ll q, ll z) {
	if (v[q] != 0) z = (z | u[v[q]]);
	if (v2[q][z]) return;
	qu.push({p, q, z});
}

int main()
{
	ll i, j, t1, t2, t3;
	st t;
	cin >> n >> m >> k;
	for (i = 1; i <= k; i++) {
		scanf ("%lld", &a[i]);
		v[a[i]] = i;
	}
	for (i = 0; i < m; i++) {
		scanf ("%lld %lld %lld", &t1, &t2, &t3);
		b[t1].push_back(t2);
		c[t1].push_back(t3);
		b[t2].push_back(t1);
		c[t2].push_back(t3);
	}
	u[1] = 1;
	for (i = 2; i <= 10; i++) u[i] = u[i - 1] * 2;
	for (i = 1; i <= n; i++) f(0, i, 0);
	while (!qu.empty()) {
		t = qu.top(); qu.pop();
		if (v2[t.c2][t.c3]) continue;
		v2[t.c2][t.c3] = true;
		if (t.c3 == u[k + 1] - 1) {
			cout << -t.c1;
			return 0;
		}
		for (i =0; i < b[t.c2].size(); i++) {
			f(t.c1 -c[t.c2][i], b[t.c2][i], t.c3);
		}
	}
    return 0;
}


Measured memory_bytes: 199136
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <deque>

int main(){
  int A, B, C, X, Y;
  scanf("%d", &A);
  scanf("%d", &B);
  scanf("%d", &C);
  scanf("%d", &X);
  scanf("%d", &Y);
  int minXY = std::min(X, Y);
  long long ans = 0;
  if (A+B>2*C){
    ans += minXY*C*2;
  } else {
    ans += minXY*(A+B);
  }
  if (X>Y){
    if (A<2*C){
      ans += (long long)A*(X-minXY);
    } else {
      ans += (long long)2*C*(X-minXY);
    }
  } else {
    if (B<2*C){
      ans += (long long)B*(Y-minXY);
    } else {
      ans += (long long)2*C*(Y-minXY);
    }
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, k, n, a, b, c, d;
  scanf("%lld%lld%lld%lld%lld", &n, &a, &b, &c, &d);
  char s[n + 10];
  scanf("%s", s);
  for(i = a; i < c; ++i) if(s[i] + s[i - 1] == 'F') {
    printf("No");
    return 0;
  }
  for(i = b; i < d; ++i) if(s[i] + s[i - 1] == 'F') {
    printf("No");
    return 0;
  }
  if(c > d) {
    for(i = b - 1; i < d; ++i) if(s[i - 1] + s[i] == '\\' && s[i + 1] == '.') {
      printf("Yes");
      return 0;
    }
    printf("No");
    return 0;
  }
  printf("Yes");
  return 0;
}

Measured memory_bytes: 384