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

using namespace std;

int n;
int a[200000];

void normalize(vector<pair<int, int>> &a) {
    while (a.size() >= 2) {
        if (a[a.size() - 1].first == a[a.size() - 2].first) {
            a[a.size() - 2].second += a[a.size() - 1].second;
            a.pop_back();
        } else break;
    }
}

bool f(int x) {
    vector<pair<int, int>> s;
    s.emplace_back(0, a[0]);
    for (int i = 0; i + 1 < n; i++) {
        int d = max(0, a[i] - a[i + 1]);
        while (d > 0) {
            if (d >= s.back().second) {
                d -= s.back().second;
                s.pop_back();
            } else {
                s.back().second -= d;
                d = 0;
            }
        }
        if (a[i] >= a[i + 1]) {
            if (s.back().first < x - 1) {
                auto p = s.back();
                s.pop_back();
                if (p.second > 1) {
                    s.emplace_back(p.first, p.second - 1);
                }
                s.emplace_back(p.first + 1, 1);
            } else {
                auto p = s.back();
                s.pop_back();
                if (s.empty()) return false;
                auto q = s.back();
                s.pop_back();
                if (q.second > 1) {
                    s.emplace_back(q.first, q.second - 1);
                }
                s.emplace_back(q.first + 1, 1);
                normalize(s);
                s.emplace_back(0, p.second);
            }
        } else {
            s.emplace_back(0, a[i + 1] - a[i]);
        }
        normalize(s);
    }
    return true;
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int l = 0;
    int r = n;
    while (r - l > 1) {
        int m = (l + r) / 2;
        if (f(m)) {
            r = m;
        } else {
            l = m;
        }
    }
    cout << r << endl;
}



Measured memory_bytes: 1024
def getkey(a):
  return "%6s" % a

n = input()
dic = {}
for i in range(n):
  a, b = raw_input().split()
  b = int(b)
  if a in dic:
    dic[a] += b
  else:
    dic[a] = b
for a in sorted(dic, key=getkey):
  print "%s %d" % (a, dic[a])

Measured memory_bytes: 4516
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
  long long n;
  cin >> n;
  vector<int> answer;
  if (n == 0){
    cout << 0 << endl;
    return 0;
  }
  while (n != 0){
    int tmp = n % (-2);
    if (tmp < 0){
      answer.push_back(1);
      n = n / (-2) + 1;
    }
    else{
      answer.push_back(tmp);
      n /= -2;
    }
  }
  for (int i = answer.size() - 1; i >= 0; i--)
    cout << answer[i];
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input().rstrip())
T = list(map(int, input().rstrip().split()))
M = int(input().rstrip())

for i in range(M):
    P, X = list(map(int, input().rstrip().split()))
    total = 0
    for j in range(len(T)):
        t = 0
        if j == P - 1:
            t = X
        else:
            t = T[j]

        total += t

    print(total)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 998244353;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    sort(all(l), greater<int>());
    int ans = 0;
    rep(i, k) ans += l[i];
    cout << ans << endl;
}


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

int main(){
    ll h, w;

    scanf("%lld %lld", &h, &w);

    ll sum = 0;
    /*
    if((h % 2) == 0){
        sum = (h * w) / 2;
    }else{
        sum = ((h - 1) * w) / 2 + ((w + 1) / 2);
    }
    */

    if((h != 1) && (w != 1)) sum = ((h * w) + 1) / 2;
    else sum = 1;
    /*
    for(ll i = 0; i < h; ++i){
        if((i % 2) == 0){
            sum += ((w + 1) / 2);
        }else{
            sum += (w / 2);
        }
    }
    */

    printf("%lld\n", sum);

    return 0;
}


Measured memory_bytes: 1696
using System;


class Program
{
    static void Main()
    {
        string str1 = Console.ReadLine();
        string str2 = Console.ReadLine();

        string strroop = str1 + str1;

        if (0 <= strroop.IndexOf(str2))
            Console.WriteLine("Yes");
        else
            Console.WriteLine("No");


    }
}

Measured memory_bytes: 9752
import sys
read=lambda:sys.stdin.readline().rstrip()
readi=lambda:int(sys.stdin.readline())
writeln=lambda x:sys.stdout.write(str(x)+"\n")
write=lambda x:sys.stdout.write(x)
A,B,C=read().split()
if A[-1] == B[0] and B[-1] == C[0]:
    writeln("YES")
else:
    writeln("NO")

Measured memory_bytes: 3060
#データ入力
rowNum, columnNum = map(int, input().split())
inMat = [[0] * columnNum for i in range(rowNum)]
inColumnVec = [[0] for i in range(columnNum)]
for row in range(rowNum):
    inMat[row] = [int(i) for i in input().split()]
for column in range(columnNum):
    inColumnVec[column] = int(input())

timesAns = [[0] for i in range(rowNum)]

#行列計算
for row in range(rowNum):
    timesAns[row] = 0
    for column in range(columnNum):
        timesAns[row] = timesAns[row] + inMat[row][column] * inColumnVec[column]

for row in range(rowNum):
    print(timesAns[row])


Measured memory_bytes: 5980
#include<bits/stdc++.h>
using namespace std;
#define ll long long

ll weight[100005], value[100005];

ll knapsack(ll bag_weight, ll item)
{
    ll K[item+1][bag_weight+1];
    for(int i = 0; i <= item; i++)
    {
        for(int w = 0; w <= bag_weight; w++)
        {
            if(i==0 || w==0)
                K[i][w] = 0;
            else if(weight[i-1]<=w)
                K[i][w] = max(K[i-1][w], K[i-1][w-weight[i-1]]+value[i-1]);
            else
                K[i][w] = K[i-1][w];
        }
    }

    return K[item][bag_weight];
}

int main()
{
    ll W, n;
    cin>>n>>W;
    for(int i = 0; i < n; i++)
        cin>>weight[i]>>value[i];
    cout<<knapsack(W,n)<<endl;
    return 0;
}


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

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;


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



int main() {
	string a, b;
	cin >> a >> b;
	string s = a + b;
	int n = s.size();
	int sum = 0;
	REP(i, n) {
		sum+=(s[i]-'0')*pow(10, n - i-1);
	}
	int r = sqrt(sum);
	if (r*r == sum) {
		ANS("Yes")
	}
	else {
		ANS("No")
	}


	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <algorithm>
#include <map>
#include <vector>

using namespace std;

int N;
vector<long long> a;

void solve() {
    map<long long, long long> ma;
    for (int i = 0; i < N; ++i) ma[a[i]]++;
    long long res = 0;
    for (auto it : ma) res += it.second * (it.second - 1) / 2;
    for (int i = 0; i < N; ++i) {
        long long val = ma[a[i]];
        long long before = val * (val - 1) / 2;
        long long after = (val - 1) * (val - 2) / 2;
        cout << res + after - before << endl;
    }
}

int main() {
    cin >> N;
    a.resize(N);
    for (int i = 0; i < N; ++i) cin >> a[i];
    solve();
}

Measured memory_bytes: 12928
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE RankNTypes #-}


import GHC.TypeLits

import Data.Int
import Data.Proxy
import qualified Data.Map.Lazy as Map
import Data.List
import Data.Bits
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.Array.IArray as Array
import Data.Array.MArray
import Data.Array.ST
--import Data.Monoid
--import Data.Semigroup

import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Control.Monad.Primitive
import Control.Monad.State

import Debug.Trace




type M = Mint 1000000007

getInts :: IO [Int]
getInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

main :: IO ()
main = do
  [n, k] <- getInts

  let factorial = factorialTable 200000 :: V.Vector M

  let
    p n k
      | n < k || n < 0 || k < 0 = 0
      | otherwise = (factorial V.! n) * (invMint $ factorial V.! (n-k))
  
  let
    c n k
      | n < k || n < 0 || k < 0 = 0
      | otherwise = (p n k) * (invMint $ factorial V.! k)

  let
    h n k
      | n == 0 && k == 0 = 1
      | otherwise = c (n+k-1) k

  forM_ [1..k] $ \i -> do
    print $ getMintValue $ (c (k-1) (i-1)) * (h (i+1) (n-k-i+1))
    






{-- Mod Int --}
data Mint (m :: Nat) = Mint {getMintValue :: Integer} deriving (Eq, Show)

getMintMod :: forall p. KnownNat p => Mint p -> Integer
getMintMod = natVal

makeMint :: forall p. KnownNat p => Integer -> Mint p
makeMint a
  | 0 <= a && a < p = Mint $ fromInteger $ a
  | otherwise = Mint $ fromInteger $ a `mod` p
  where p = natVal $ (Proxy :: Proxy p)

instance KnownNat p => Num (Mint p) where
  (Mint a) + (Mint b) = makeMint $ a + b
  (Mint a) - (Mint b) = makeMint $ a - b
  (Mint a) * (Mint b) = makeMint $ a * b
  negate (Mint a) = makeMint $ negate a
  abs = id
  signum (Mint a) = if a == 0 then 0 else 1
  fromInteger = makeMint


invMint :: forall p. KnownNat p => Mint p -> Mint p
invMint m = let p = getMintMod m in m ^ (p - 2)

powerMint :: forall p. KnownNat p => Integer -> Integer -> Mint p
powerMint n p
  | p >= 0 = (fromInteger n :: Mint p) ^ p
  | otherwise = invMint $ powerMint n (-p)


factorialTable :: forall p. KnownNat p => Int -> V.Vector (Mint p)
factorialTable n = V.scanl (*) (makeMint 1) (V.fromList $ map (makeMint . fromIntegral) [1..n])


Measured memory_bytes: 25212
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <math.h>
#define INF 1000000000
typedef long long int ll;
using namespace std;

int main() {

    ll n,ans = 0; cin >> n;
	unordered_map<string, ll> data = {};
	for (int i = 0; i < n; i++) {
		string s; cin >> s;
		sort(s.begin(), s.end());
		if (data[s] != 0) { ans += data[s]; }
		data[s]++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 10660
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const ll mod = 1e9+7;

vector<int> graph[100005];
vector<bool> used(100005);
vector<int> ans;
bool finished = false;

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

  int n; cin >> n;
  rep(i, n) {
    int a; cin >> a;
    if (a & 1) {
      cout << "first" << endl;
      return 0;
    }
  }
  cout << "second" << endl;
}

Measured memory_bytes: 2560
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int W = scan.nextInt();
        int H = scan.nextInt();
        String c = scan.next();

        for (int n = H; n >= 1; n--) {
            for (int i = W; i >= 1; i--) {
                if (n == H / 2 + 1 && i == W / 2 + 1) {
                    System.out.print(c);
                } else {
                    if (n < H && n > 1 && i == W || i == 1 && n < H && n > 1) {
                        System.out.print("|");
                    } else {
                        if (n == H && i == W || n == H && i == 1 || n == 1 && i == W || n == 1 && i == 1) {
                            System.out.print("+");
                        } else {
                            if (n == H || n == 1 && i < W && i > 1) {
                                System.out.print("-");
                            } else {
                                System.out.print(".");

                            }
                        }
                    }
                }
            }
            System.out.println("");

        }
    }
}



Measured memory_bytes: 26356
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
      a: usize,
      b: usize,
      k: usize,
    }
    let mut a = a;
    let mut b = b;
    for i in 0..k {
        if i%2==0 {
            // a
            if a%2 == 1 {
                a = a - 1;
            }
            b += a/2;
            a = a/2;
        } else {
            if b%2 == 1 {
                b = b-1;
            }
            a += b/2;
            b = b/2;
        }
    }
    println!("{} {}", a, b);
}


Measured memory_bytes: 4352
fn c() {                                                                                                                     
    input! {                                                                                                                 
        k: u64                                                                                                               
    }                                                                                                                        
                                                                                                                             
    let mut table = vec![false; k as usize];                                                                                 
                                                                                                                             
    let mut ans = 1;                                                                                                         
    let mut v: u64 = 7 % k;                                                                                                  
                                                                                                                             
    loop {                                                                                                                   
        if v == 0 {                                                                                                          
            println!("{}", ans);                                                                                             
            return;
        }
        else if table[v as usize] {
            println!("-1");
            return;
        }
        else {
            table[v as usize] = true;
        }
        ans += 1;
        v = (v * 10 + 7) % k;
    }
}
use proconio::{input, marker:: Chars};

fn main() {
    c();
}


Measured memory_bytes: 2984
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 2e5 + 10; 

int dp[N][4];
int vis[N][4];
int A[N];
int n;

int dfs(int ind,int skip){
   if(ind<=0) return 0;
   if(vis[ind][skip]){
      return dp[ind][skip];
   }
   vis[ind][skip] = 1;
   if(skip == 0){
      dp[ind][skip] = A[ind]+max({dfs(ind-2,0),dfs(ind-3,1),dfs(ind-4,2)});
   }else if(skip == 1){
      dp[ind][skip] = A[ind]+max(dfs(ind-2,1),dfs(ind-3,2));
   }else{
      dp[ind][skip] = A[ind]+dfs(ind-2,2);
   }
   return dp[ind][skip];
}

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   cin >> n;
   f(i,1,n+1){
      cin >> A[i];
   }
   if(n & 1){
      cout << max({dfs(n,0),dfs(n-1,1),dfs(n-2,2)});
   }else{
      cout << max(dfs(n,1),dfs(n-1,2));
   }
   return 0;
}

Measured memory_bytes: 22396
nk=input().split()
N=int(nk[0]);K=int(nk[1])
if (K%2)==0:
    l=[]
    l2=[]
    for i in range(1,N+1):
        if (i%K==0):
            l2.append(i)
        elif (i%K==int(K/2)):
            l.append(i)
    print(str(len(l)*len(l)*len(l)+len(l2)*len(l2)*len(l2)))
else:
    l=[]
    for i in range(1,N+1):
        if i%K==0:
            l.append(i)
    print(str(len(l)*len(l)*len(l)))


Measured memory_bytes: 11044
ss = list(map(ord, input().strip()))
ts = list(map(ord, input().strip()))

bigger = False
non_empty = False
while len(ts) > 0 and len(ss) > 0:
    s = min(ss)
    t = max(ts)
    if s == t:
        ts.remove(t)
        ss.remove(s)
    elif s > t:
        bigger = False
        non_empty = True
        break
    else:
        bigger = True
        non_empty = True
        break

if not non_empty:
    if len(ts) == 0 and len(ss) == 0:
        bigger = False
    elif len(ss) == 0:
        bigger = True
    else:
        bigger = False

if bigger:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#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++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int N, X, Y;

int d(int i, int j) {
	/*
	int res = min(j - i, abs(i - X) + 1 + abs(j - Y));
	db(i); db(j); dbl(res);
	return res;
	*/
	return min(j - i, abs(i - X) + 1 + abs(j - Y));
}

int main() {
	cin >> N >> X >> Y;
	vi ans(N);
	rep2(k, 1, N) ans[k] = N - k;
	dbv(ans);
	rep2(i, 1, N) {
		rep2(j, i + 1, N + 1) {
			int p = d(i, j);
			if (j - i > p) {
				ans[j - i]--; ans[p]++;
			}
		}
	}
	dbv(ans);
	rep2(k, 1, N) {
		cout << ans[k] << endl;
	}
}

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



using ll = long long;
const int M = 100005;

int a[12][12];

using namespace std;
int main()
{
	int x;
	cin >> x;
	for (int y = x;y < M;y++) {
		bool ok = true;
		for (int i = 2;i < y;i++) {
			if (y % i == 0) {
				ok = false;
				break;
			}
		}
		if (ok) {
			cout << y;
			return 0;
		}

	}
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
using namespace std;

vector<int> a,same,memo;
set<int> s;
int dsize;

int main(){
	int n,in;
	cin>>n;
	rep(i,n){
		cin>>in;
		a.pb(in);
		memo.pb(in);
	}
	set<int>::iterator ite;
	int see=0;
	while(see<a.size()){
		ite=s.find(a[see]);
		if(ite!=s.end()){
			same.pb(a[see]);
			a.erase(a.begin()+see);
		}else{
			s.insert(a[see]);
			see++;
		}
	}
	dsize=s.size();
	int res1,res2,result=a.size();
	if(dsize<=1 || dsize==memo.size()){
	}else if(dsize%2){
		res1=same[dsize/2-1],res2=same[dsize/2];
		if(res1>res2){
			int alt=res1;
			res1=res2;
			res2=alt;
		}
		bool alt=true;
		rep(i,n)if(res1<=a[i] && a[i]<=res2)alt=false;
		if(alt)result-=2;
	}else result-=1;
	cout<<result<<endl;
	return 0;
}

Measured memory_bytes: 5748
import scala.io.Source
import scala.math.{ sin, cos, sqrt, Pi }

object Main extends App {
  val Array(bottom: Double, slope: Double, angle: Double) = Source.stdin.getLines.next.split(" ").map(_.toDouble)

  def toRadians(angle: Double) = {
    angle * (math.Pi / 180)
  }

  val h = sin(toRadians(angle)) * slope
  val area = bottom * h / 2
  val length = bottom + slope + sqrt(bottom * bottom + slope * slope - 2 * bottom * slope * cos(Pi * angle / 180))

  println(area)
  println(length)
  println(h)
}

Measured memory_bytes: 44312
import kotlin.math.*

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() //single long
private fun readDouble() = readLn().toDouble() //single double

private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map{it.toLong()} // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles

fun main(){
    val s = readLn()
    if(s.last() == 's'){
        println(s + "es")
    }else{
        println(s + "s")
    }
}

Measured memory_bytes: 37196
package main

import (
  "fmt"
  "time"
)

func main() {
  var S string
  
  fmt.Scan(&S)

  eot, _ := time.Parse("2006/01/02", "2019/04/30") 
  
  t, err := time.Parse("2006/01/02", S)
  if err != nil || t.Sub(eot) > 0 {
    fmt.Println("TBD")
  } else {
    fmt.Println("Heisei")
  }
}

Measured memory_bytes: 512
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1000000000
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));

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

	int A;
	cin>>A;
	int i=2,f=A;
	int n;
	bool flag=true;
	int a[1000001]={0};
	a[A]++;
	while(flag){
		
		if(f%2==0)
			n=f/2;
		else
			n=3*f+1;
		//cout<<n<<endl;
		if(a[n]==1){
			cout<<i<<endl;
			return 0;
		}
		a[n]++;
		f=n;
		i++;
	}
	
	
	return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

void solve()
{
	ll k;
	cin>>k;
	if(k%2==0){
		cout<<-1;
		return;
	}
	ll m=0;
	rep(i,1e6){
		m*=10;
		m+=7;
		m%=k;
		if(m==0){
			cout<<i+1;
			return;
		}
	}
	cout<<-1;
}

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


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

int main(){
    /*
    long long a, b, c, n;
    string s;
    cin >> a, b;
    if (a <= 12 && 5 < a){
        cout << b / 2 << endl;
        return 0;
    }else{
        cout << b;
        return 0;
    }
    cout << 0 << endl;
    
	*/
    long long r, d, x;

    cin >> r >> d >> x;
    for(int i = 0; i < 10; i++){
        cout << x * r - d << endl;
        x = x * r - d;
    }

    return 0;
	/*
    long long n, m, ans = 0;
    cin >> n >> m;
    for(int i = 0; i < m;i ++){
        long long l, r;
        cin >> l >> r;
        if(l <= m && l <= r){
            ans++;
        }
    }
    cout << ans;*/

}


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

int main() {
  int n;
  cin >> n;
  ll ans=0;
  map<string,int> ma;
  rep(i,n){
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    ans+=ma[s];
    ma[s]++;
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 11260
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int main() {
        string s;
        cin >> s;
        if ((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3])) puts("Yes");
        else puts("No");
        return 0;
}



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

const int MOD = 1000000007;
 
vector<long long> fact_inv, inv, Com;
 
/*  init_nCk :二項係数のための前処理
    計算量:O(n)
*/
void init_nCk(int n, int SIZE) {
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
    Com.resize(SIZE + 5);
    Com[0] = 1;
    for (int i = 1; i < SIZE + 5; i++) {
        Com[i] = Com[i - 1] * ((n - i + 1) * inv[i] % MOD) % MOD;
    }
}
 
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int k) {
    assert(!(k < 0));
    return Com[k];
}

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
  long long n, a, b; cin >> n >> a >> b;
  init_nCk(n, min(max(a, b), n));
  long long count = modpow(2, n);
  count -= nCk(a) + nCk(b);
  count = ((count % MOD) + MOD) % MOD;
  cout << count - 1 << endl;
}

Measured memory_bytes: 7880
module IntMap = Map.Make (struct
  type t = int
  let compare = compare
end)

let () = 
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let as_ = Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a)) in
  Array.fold_left (fun m a ->
    IntMap.add a (1 + try IntMap.find a m with Not_found -> 0) m) IntMap.empty as_
  |> (fun m -> IntMap.fold (fun a n m ->
      IntMap.add (a - 1) (n + try IntMap.find (a - 1) m with Not_found -> 0) m
      |> IntMap.add (a + 1) (n + try IntMap.find (a + 1) m with Not_found -> 0)) m m)
  |> IntMap.bindings
  |> List.map snd
  |> List.fold_left max 0
  |> Printf.printf "%d\n"

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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    int a,b;
    scanf("%d%d",&a,&b);
    if(a<=9&&b<=9){
        cout<<a*b;
    }else{
        puts("-1");
    }
    
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    a.append(a[i] + 1)
    a.append(a[i] - 1)
a = sorted(a)
ans = []
c = 1
for i in range(len(a)-1):
    if a[i] == a[i+1]:
        c += 1
    else:
        ans.append(c)
        c = 1
print(max(ans))


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

int main(){
  int N;cin>>N;
  int A[N+10];
  int tmp=0;
  int S=0;
  for(int i=0;i<N;i++){
    cin>>A[i];
    S+=A[i];
    if(i%2!=0)tmp+=A[i];
  }
  int X[N+10];
  X[0]=S-(2*tmp);
  cout<<X[0]<<endl;
  for(int i=1;i<N;i++){
    X[i]=(2*A[i-1])-X[i-1];
    cout<<X[i]<<endl;
  }
}

Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef vector<ll> vl;

int main() 
{
	int N;
	cin >> N;
	vector<vector<vector<vl>>> DP(N + 1); // 0 : C, 1 : G, 2 : A, 3 : T
	rep(i, N + 1) {
		DP[i].resize(4);
		rep(d0, 4) {
			DP[i][d0].resize(4);
			rep(d1, 4)
				DP[i][d0][d1].resize(4);
		}
	}
	DP[0][3][3][3] = 1; // 先頭にTTT追加
	rep(i, N) {
		rep(d0, 4) {
			rep(d1, 4) {
				rep(d2, 4) {
					rep(d3, 4) {
						bool can = true;
						if (d0 == 0 && d1 == 1 && d2 == 2)
							can = false;
						if (d0 == 0 && d1 == 1 && d3 == 2)
							can = false;
						if (d0 == 0 && d2 == 1 && d1 == 2)
							can = false;
						if (d1 == 0 && d0 == 1 && d2 == 2)
							can = false;

						if (d1 == 0 && d2 == 1 && d3 == 2)
							can = false;
						if (d1 == 0 && d3 == 1 && d2 == 2)
							can = false;
						if (d2 == 0 && d1 == 1 && d3 == 2)
							can = false;
						if (d0 == 0 && d2 == 1 && d3 == 2)
							can = false;
						if (can) {
							DP[i + 1][d0][d1][d2] += DP[i][d1][d2][d3];
							DP[i + 1][d0][d1][d2] %= mod;
						}
					}
				}
			}
		}
	}

	ll ans = 0;

	rep(d0, 4) {
		rep(d1, 4) {
			rep(d2, 4) {
				ans += DP[N][d0][d1][d2];
				ans %= mod;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#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++)


int main() {
  string s;
  cin >> s;
  rep(i,s.size()){
    if(s.at(i)=='?'){
      s.at(i)='D';
    }
  }
  
  
    cout<<s<<endl;
  
  
}







Measured memory_bytes: 3756
#標準入力
A,B,C = map(int,input().split())
K=int(input())

cnt = 0

while A >= B:
    B=B*2
    cnt+=1
    if A < B:
        break

while B >= C:
    C=C*2
    cnt+=1
    if B < C:
        break

ans = 'Yes' if cnt <= K else 'No'

print(ans)

Measured memory_bytes: 9184
//usr/bin/env scala $0 $@;exit

object Main{
	def main(args: Array[String]){
		val cin=new java.util.Scanner(System.in)
		var n=cin.nextInt()
		while(n>0){
			val k=cin.nextInt()
			val m=cin.nextInt()
			var r=0
			for(i<-1 until n)r=(r+k)%i
			println((r+m)%n+1)
			n=cin.nextInt()
		}
	}
}

Measured memory_bytes: 45436
//ÕÅ¼ÒÆæÔõÃ´ÓÖAKIOIÁËÑ½£¬ÔõÃ´CSPÒ²Âú·Ö°¡...ÔõÃ´Çå±±ÌìÌì¸øËû´òµç»°°¡...ÔõÃ´»áÓÐÕâÃ´Ç¿µÄÈË°¡
#include<bits/stdc++.h>
#define int long long
#define writeln(x)  write(x),puts("")
#define writep(x)   write(x),putchar(' ')
using namespace std;
inline int read(){
	int ans=0,f=1;char chr=getchar();
	while(!isdigit(chr)){if(chr=='-') f=-1;chr=getchar();}
	while(isdigit(chr)){ans=(ans<<3)+(ans<<1)+chr-48;chr=getchar();}
	return ans*f;
}void write(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}const int M = 2E5+5;
int a[M],b[M],sum[M],n,k,ans;
inline bool check(int mid){
	int cnt=0;
	for(int i=1;i<=n;i++)
		if(sum[i]>mid)cnt+=(sum[i]-mid+b[i]-1)/b[i];
	return cnt<=k;
}
signed main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)cin>>b[i];
	sort(a+1,a+n+1);
	sort(b+1,b+n+1,greater<int>());
	for(int i=1;i<=n;i++)sum[i]=a[i]*b[i];
	int l=0,r=LONG_LONG_MAX;
	while(l<=r){
		int mid=l+r>>1;
		if(check(mid)) r=mid-1,ans=mid;
		else l=mid+1;
	}cout<<ans;
	return 0;
}


Measured memory_bytes: 4992
#include<stdio.h>
int binary(int *a,int k,int n);
int main()
{
  int i,j,n,m,alt,cnt=0,iden;
  scanf("%d",&n);
  int a[n+1];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  scanf("%d",&m);
  for(j=0;j<m;j++){
    scanf("%d",&alt);
    iden=binary(a,alt,n);
    if(iden==1){
      cnt++;
    }
  }
  printf("%d\n",cnt);
  return 0;
}
int binary(int *a,int k,int n){
  int left=0,right=n,mid,i;
  while(left<right){
    mid=(left+right)/2;
    if(a[mid]==k){
      return 1;
    }
    else if(k<a[mid]){
      right=mid;
    }
    else{
      left=mid+1;
    }
  }
  return 0;
}



Measured memory_bytes: 2144
fun main(args: Array<String>) {
	val (w, h, n) = readLine()!!.split(' ').map { it.toInt() }
	val arr = Array(h) { Array(w) { 1 } }
	var ans = 0

	for (i in n - 1 downTo 0) {
		val (xi, yi, a) = readLine()!!.split(' ').map { it.toInt() }

		for (y in 0 until h) {
			for (x in 0 until w) {
				if ((a == 1 && x < xi) || (a == 2 && x >= xi) ||
						(a == 3 && y < yi) || (a == 4 && y >= yi)) {
					arr[y][x] = 0
				}
				if (i == 0) {
					ans += arr[y][x]
				}
			}
		}
	}
	println(ans)
}


Measured memory_bytes: 38252
#include <iostream>
#include <map>

using namespace std;

int main(){
	long long N;
	cin >> N;
	long long A[N], Amin = 0;
	for(int i = 0; i < N; i++){
		cin >> A[i];
		Amin = min(Amin, A[i]);
	}

	map<long long, long long> L, R;
	for(int i = 0; i < N; i++){
		L[i + A[i]]++;
		R[i - A[i]]++;
	}

	long long ans = 0;
	for(long long i = Amin; i <= N - Amin; i++){
		ans += L[i] * R[i];
	}

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


Measured memory_bytes: 47864
//
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <complex>

using namespace std;

#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()

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

const ll inf = INT_MAX;
const double eps = 1e-10;
const double pi = acos(-1.0);
const int di[][2] = {{1,0},{0,1},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};

int main(){

	string str;
	cin >> str;
	string buf = str;
	reverse(ALL(buf));
	rep(i,buf.size()){
		if(buf[i] == 'b') buf[i] = 'd';
		else if(buf[i] == 'd') buf[i] = 'b';
		if(buf[i] == 'p') buf[i] = 'q';
		else if(buf[i] == 'q') buf[i] = 'p';
	}
	printf("%s\n", str == buf? "Yes" : "No");

	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;
const int MOD = 1e9 + 7;
const double PI = 3.14159265358979323846;

signed main() {
	int N;
	cin >> N;
	vector<int>A(N + 2, 0);
	int sum = 0;
	rep(i, N)cin >> A[i + 1];
	rep(i,N+1){
		sum += abs(A[i] - A[i + 1]);
	}
	rep(i, N) {
		int a = A[i];
		int b = A[i + 1];
		int c = A[i + 2];
		if ((a <= b && b <= c) || (c <= b && b <= a))cout << sum << endl;
		else if ((a <= c && c <= b) || (b <= c && c <= a))cout << sum - abs(b - c) * 2 << endl;
		else cout << sum - abs(a - b) * 2 << endl;
	}
}

Measured memory_bytes: 2048
def main():
    n = int(input())
    s = [list(input()) for i in range(n)]
    d = {}
    ans = 0
    for i in s:
        ss = ''.join(sorted(i))
        if ss not in d:
            d.setdefault(ss, 1)
        else:
            d[ss] = d.get(ss) + 1
    for k, v in d.items():
        ans += round(v*(v-1)/2)
    print(ans)
    
if __name__ == '__main__':
    main()

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

using namespace std;

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

    while(1) {
        c -= b;
        if(c <= 0) {
            cout << "Yes" << endl;
            break;
        }

        a -= d;
        if(a <= 0) {
            cout << "No" << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=1; i<=(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    double pi=3.14159265258979323;
    int n;
    cin>>n;
    n*=2;
    cout<<fixed<<setprecision(10);
    cout<<n*pi<<endl;
}


Measured memory_bytes: 3784
import java.util.Scanner;
public class Main {

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

		int a=0,b=0,c=0,d=0;

		for(int i=0;i<6;i++) {
			switch(sc.nextInt()) {

			case 1:
				a++;
				break;
			case 2:
				b++;
				break;
			case 3:
				c++;
				break;
			case 4:
				d++;
				break;
			}

		}

		int c1=0;
		if(a==1) {
			c1++;
		}
		if(b==1) {
			c1++;
		}
		if(c==1) {
			c1++;
		}
		if(d==1) {
			c1++;
		}

		sc.close();

		System.out.println(c1==2 ? "YES" : "NO");


	}

}


Measured memory_bytes: 23764
#include <stdio.h>
int main(void)
{
	int a[10000], min, max, n, i;
	long long sum = 0;
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d", &a[i]);
		sum += a[i];
	}
	max = min = a[0];
	for(i = 1; i < n; i++){
		if(a[i] > max){
		max = a[i];
		}
		if(a[i] < min){
			min = a[i];
			}
	}
	printf("%d %d %lld\n", min, max, sum);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

class BIT {
  vector<long long> dat;
public:
  BIT (int n) {
    dat.resize(n+1, 0LL);
  }
  void add(int i, long long x) {
    i++;
    while (i < (int)dat.size()) {
      dat[i] += x;
      i += i & -i;
    }
  }
  long long sum(int i) {
    long long res = 0;
    while (i > 0) {
      res += dat[i];
      i -= i & -i;
    }
    return res;
  }
};

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  BIT bit(n);
  rep(i, n) {
    ll a;
    cin >> a;
    bit.add(i, a);
  }
  rep(_, q) {
    int que;
    cin >> que;
    if (que) {
      int l, r;
      cin >> l >> r;
      cout << bit.sum(r)-bit.sum(l) << '\n';
    } else {
      int p;
      ll x;
      cin >> p >> x;
      bit.add(p, x);
    }
  }
  return 0;
}

Measured memory_bytes: 8252
N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]

for i in range(N-2):
    if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
        print("Yes")
        break
else:
    print("No")

Measured memory_bytes: 9184
#include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    
    cin >> N;
    
    int A[N];
    
    for(int i = 0; i < N; ++i){
        
        cin >> A[i];
    }
    
    int count[N], ans = 100;
    for(int i = 0; i < N; i++){
        
        count[i] = 0;
        while(A[i] % 2 == 0){
            
            A[i] /= 2;
            count[i]++;
        }
        ans = min(ans,count[i]);

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(void){
    // Your code here!
    long long n,a,b,c,d,e;
    cin>>n>>a>>b>>c>>d>>e;
    long long m=min({a,b,c,d,e});
    cout<<5+(n-1)/m;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.lang.Math.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        try {
            main.solve(args);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void solve(String[] args) throws Exception {
        MyScanner scanner = new MyScanner();
        String A = scanner.next();
        String B = scanner.next();
        String C = scanner.next();
        if (A.charAt(A.length() -1) == B.charAt(0) && B.charAt(B.length() -1) == C.charAt(0)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";

        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String line = br.readLine();
            while (line.equals("")) {
                line = br.readLine();
            }
            s = line.split(reg, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() {
            try {
                return Integer.parseInt(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }

        public double nextDouble() {
            try {
                return Double.parseDouble(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }

        public long nextLong()  {
            try {
                return Long.parseLong(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }
    }
}


Measured memory_bytes: 21204
import math

k = int(input())
hi_gcd = 1
gcd = 1
ans = 0

for h in range(1,k+1):
    for i in range(1,k+1):
        hi_gcd = math.gcd(h,i)
        for j in range(1,k+1):
            ans += math.gcd(hi_gcd,j)

print(ans)


Measured memory_bytes: 9132
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	int N;
	cin >> N;
	for (ll n = 1; n <= 3500; ++n) {
		for (ll w = 1; w <= 3500; ++w) {
			double div = 4 * n * w - N * w - N * n;
			if (div == 0)
				continue;
			double h = N * n * w / div;
			if (h > 0 && fabs(h - round(h)) < 1e-5) {
				ll hh = round(h);
				printf("%lld %lld %lld\n", hh, n, w);
				return 0;
			}
		}
	}

	return 0;
}

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


int main(){
    int n, i, cou = 0, res;
    cin >> n;

    for(i = 1; i < 10; i++){
        res = n/i;
        if(res < 10 && n%i == 0){
            cou = 1;
            break;
        }
    }

    if(cou == 1)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3644
N,K = map(int,input().split())
A = list(map(int,input().split()))
G = [1]

for n in range(N-1):
  G.append(A[G[n]-1])

if len(G)<K:
  a = G.index(G[-1])
  b = len(G)-a-1
  K = (K-a)%b+a

print(G[K])

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


int main(){
  int n, cnt=1;
  cin >> n;
  string s;
  cin >> s;
  
  rep(i,n-1){
    if(s.at(i) == s.at(i+1)) continue;
    else cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
using namespace std;
ll n;
string s;
double a,s1=0;
int32_t main(){
ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
cin>>n;
for(ll i=0;i<n;i++){
    cin>>a;
    cin>>s;
    if(s=="BTC"){
        s1=s1+a*380000.00000000000;
    }else {
    s1=s1+a;
    }
}
cout<<setprecision(8)<<s1;
return 0;}


Measured memory_bytes: 256