akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int min = Integer.MAX_VALUE;
            int max = -1;

            for (int i = 0; i < n; i++) {
                int tmp = in.nextInt();
                max = Math.max(max, tmp);
                min = Math.min(min, tmp);
            }
            out.println(max - min);
        }

    }
}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
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++)
using ll = long long;
using P = pair<int,int>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}




int main()
{
    int K,S;
    cin >> K >> S;

    ll ans = 0;
    rep(i,K + 1){
        rep(j,K + 1){
            if((S - i - j) >= 0 && (S - i - j) < K + 1) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef long long ll;

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

class P{
public:
  string name;
  bool file;  //true : is file, false : is folder
  vector<int> child;
  int par;

  P(string _name, bool _file, vector<int> _child, int _par){
    name = _name;
    file = _file;
    child = _child;
    par = _par;
  }
};

vector<string> split(string s){
  vector<string> res;
  int i = 1;
  int n = s.length();

  while(true){
    string ts = "";

    while(i < n && s[i] != '/'){
      ts += s[i];
      i++;
    }

    if(ts != ""){
      res.push_back(ts);
    }

    if(ts == "" || i == n){
      break;
    }
    i++;
  }

  return res;
}

vector<P> t;

int getNext(const vector<int> &v, string s){
  for(int i = 0; i < v.size(); i++){
    int to = v[i];
    if(t[to].name == s){
      return to;
    }
  }

  return -1;
}

void addPage(const vector<string> &v){
  int n = v.size();
  int now = 0;

  for(int i = 0; i < n; i++){
    int next = getNext(t[now].child, v[i]);

    if(next == -1){
      t[now].child.push_back(t.size());
      t.push_back(P(v[i], (i == n - 1), vector<int>(), now));
      now = t.size() - 1;
    }
    else{
      now = next;
    }
  }
}

int getPage(const vector<string> &v, bool flg){
  int n = v.size();
  int now = 0;

  for(int i = 0; i < n; i++){
    //cout << now<<","<<t[now].name<<","<<t[now].file<<","<<i<<endl;

    if(t[now].file && i != n - 2){
      return -1;
    }

    if(v[i] == "."){
      continue;
    }
    if(v[i] == ".."){
      if(t[now].par == -1) return -1;
      now = t[now].par;
      continue;
    }

    int next = getNext(t[now].child, v[i]);

    if(next == -1){
      return -1;
    }
    else{
      now = next;
    }
  }

  if(!t[now].file || flg){
    now = getNext(t[now].child, "index.html");
  }
  if(!t[now].file) return -1;

  return now;
}

void showTree(){
  for(int i = 0; i < t.size(); i++){
    cout << i << " : ";
    cout << t[i].name << "(" << t[i].file << ") : ";
    for(int j = 0; j < t[i].child.size(); j++){
      cout << t[i].child[j] << ",";
    }
    cout<<endl;
  }
}

int main(){
  int n, m;

  while(cin >> n >> m, n || m){
    t.clear();
    t.push_back(P("/", false, vector<int>(), -1));

    for(int i = 0; i < n; i++){
      string s;
      cin >> s;

      vector<string> v = split(s);
      addPage(v);
    }

    //showTree();

    for(int i = 0; i < m; i++){
      string a, b;
      cin >> a >> b;

      vector<string> va = split(a);
      int ida = getPage(va, a[a.length() - 1] == '/');

      vector<string> vb = split(b);
      int idb = getPage(vb, b[b.length() - 1] == '/');

      if(ida == -1 || idb == -1){
        cout << "not found\n";
      }
      else if(ida == idb){
        cout << "yes\n";
      }
      else{
        cout << "no\n";
      }
    }
  }
}

Measured memory_bytes: 0
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

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

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


T, X = list(map(int, sys.stdin.buffer.readline().split()))

a=T/X
print(a)


Measured memory_bytes: 13640
#include <stdio.h>
#include <stdlib.h>
int main(){
  char s[16];
  int S[100],p=0;
  while (scanf("%s ",s)!=EOF){
    int a,b;
    if(*s>'/')
      S[p++]=atoi(s);
    else{
      a=S[--p];b=S[--p];
      if(*s=='*')S[p++]=b*a;
      else if(*s=='+')S[p++]=b+a;
      else if(*s=='-')S[p++]=b-a;
    }
  }
  printf("%d\n", S[--p]);
  return 0;
}

Measured memory_bytes: 552
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, M: int, A: "List[int]", B: "List[int]"):
    ab = sorted(zip(A, B))
    k = 0
    ans = 0
    for Ai, Bi in ab:
        v = min(M - k, Bi)
        k += v
        ans += Ai * v
        if k >= M:
            break
    print(ans)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int()] * (N)  # type: "List[int]"
    B = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, M, A, B)


if __name__ == '__main__':
    main()


Measured memory_bytes: 18652
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <math.h>

#define ll long long
#define ull unsigned long long

using namespace std;

const int inf = 1000000000;
const double eps = 1e-7;

void solve() {
	int n;
	cin >> n;
	vector<int> a(n);
	vector<long long> cnt(n + 1);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		++cnt[a[i]];
	}
	
	long long ans = 0;
	for (int i = 1; i <= n; ++i)
		ans += cnt[i] * (cnt[i] - 1) / 2;
	
	for (int i = 0; i < n; ++i)
		cout << ans - (cnt[a[i]] * (cnt[a[i]] - 1) / 2) + ((cnt[a[i]] - 1) * (cnt[a[i]] - 2) / 2) << endl;
}

int main() {
	int t = 1;
	//cin >> t;
	for (int i = 0; i < t; ++i)
		solve();
	return 0;
}

Measured memory_bytes: 4992
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

char s[3021], t[3021];
int lens, lent;
int dp[3021][3021];
char ans[3021];

int main() {
	scanf("%s", s + 1); lens = strlen(s + 1);
	scanf("%s", t + 1); lent = strlen(t + 1);
	for (int i = 1; i <= lens; ++i) {
		for (int j = 1; j <= lent; ++j) {
			dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			if (s[i] == t[j])
				dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
		}
	}
	int l = lens, r = lent, c = dp[lens][lent];
	while (l >= 1 && r >= 1) {
		if (s[l] == t[r]) {
			ans[--c] = s[l];
			--l; --r;
		} else if (dp[l][r] == dp[l - 1][r]){
			--l;
		} else {
			--r;
		}
	}
	printf("%s\n", ans);
	return 0;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ll long long
#define ld long double
int main(){
  int l,r,d;
  cin>>l>>r>>d;
  int ans=0;
  rep2(i,l,r+1){
    if(i%d==0) ans++;
  }
  cout<<ans<<endl;
return 0;
}

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

ll n,a,b,c;
bool bin(vector<ll> h,ll t)
{
   ll at= 0;
   rep(i,n)
   {
      h[i] -= t*b;
      at += (max(0LL,h[i])+c-1)/c;
   }
   if(at>t)
   {
      return false;
   }
   return true;
}

int main()
{
   
   cin >> n >> a >> b;
   c = a - b;
   vector<ll> h(n);
   rep(i,n)cin >> h[i];
   int left = -1,right = INF;
   while(1)
   {
      ll mid = (left+right)/2;
      if(bin(h,mid))
      {
         right = mid;
      }
      else
      {
         left = mid;
      }
      //cout<<left<<';'<<right<<endl;
      if(right-left<=1)break;
   }
   cout<<right<<endl;
   return 0;
}

Measured memory_bytes: 1792
S = input()
strings = ["AKIHABARA", "KIHABARA", "AKIHBARA", "AKIHABRA", "AKIHABAR", "KIHBARA", "KIHABRA", "KIHABAR", "AKIHBRA", "AKIHBAR", "AKIHABR", "AKIHBR", "KIHABR", "KIHBAR", "KIHBRA", "KIHBR"]
if S in strings:
	print("YES")
else:
	print("NO")


Measured memory_bytes: 2940
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
#define ge getchar 
#define pun putchar('\n')
#define pu putchar
#define puk putchar(' ')
char c,d;
int n,k,m,t,i;
ll g[50];
int sri(){c=ge();int x=0;while(c<'0')c=ge();while(c>='0')x=(x<<3)+(x<<1)+c-'0',c=ge();return x;}
void sc(ll x){int l=0;if(x==0)g[l=1]=0;while(x)g[++l]=x%10,x/=10;for(;l;l--)putchar(g[l]+'0');}
int main(){
	n=sri();k=sri();
	c=ge();while(c<'L')c=ge();d=c;m=1;t=0;
	for(i=2;i<=n;i++){
		c=ge();
		if(c==d)t++;else d=c,m++;
	}
	if(m&1){
		m>>=1;if(k>=m)t+=(m<<1);else t+=(k<<1);
	}else if(m>2){
		m>>=1;m--;if(k>m)t+=(m<<1)+1;else t+=(k<<1);
	}else if(k)t++;
	sc(t);
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
int main() {
  int n, m;
  cin >> n >> m;
  cout << (n == m ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int a, b, c; cin >> a >> b >> c;
    if(a==b) cout << c << endl;
    else if(a==c) cout << b << endl;
    else cout << a << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

const ll N=1e5+10;
vec v(N),d(N),c(N);
mat G(N),dp(N,vec(11));
ll n,m,q;

void dfs(ll f,ll td,ll tc) {
  if(td>=0&&!dp[f][td]) {
    dp[f][td]=tc;
    for(ll t:G[f]) {
      dfs(t, td-1,tc);
    }
  }
}

int main() {
  cin >> n >> m;
  for(ll i=0;i<m;i++) {
    ll a,b;
    cin >> a >> b;
    a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  cin >> q;
  for(ll i=0;i<q;i++) {
    cin >> v[i] >> d[i] >> c[i];
    v[i]--;
  }
  while(q--) {
    for(ll i=d[q];i>=0;i--) {
      dfs(v[q],i,c[q]);
    }
  }
  for(ll i=0;i<n;i++) cout << dp[i][0] << endl;
}

Measured memory_bytes: 23516
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>

using namespace std;


template<typename T>
void ep_(const std::string& name, const T& val) {
    std::cerr << name << ": " << val << " ";
}

#define EP(val) ep_( #val, val )

int main()
{
    int64_t N, C;
    std::cin >> N >> C;

    struct S {
        int64_t x;
        int64_t v;
    };

    std::vector<S> sr;
    for (size_t i = 0; i < N; ++i) {
        S s;
        std::cin >> s.x >> s.v;
        sr.push_back(s);
    }

    auto sl = sr;

    std::sort(std::begin(sr), std::end(sr),
              [](const auto& a, const auto& b) {
                  return a.x < b.x;
              });

    std::sort(std::begin(sl), std::end(sl),
              [](const auto& a, const auto& b) {
                  return a.x > b.x;
              });


    std::vector<int64_t> rmax, lmax;
    rmax.push_back(0);
    lmax.push_back(0);
    {
        int64_t rm, lm, re, le, rpos, lpos;
        rm = lm = re = le = rpos = 0;
        lpos = C;

        for (size_t i = 0; i < N; ++i) {
            re = re + sr[i].v - (sr[i].x - rpos);
            rm = std::max(rm, re);
            rmax.push_back(rm);
            rpos = sr[i].x;

            le = le + sl[i].v - (lpos - sl[i].x);
            lm = std::max(lm, le);
            lmax.push_back(lm);
            lpos = sl[i].x;
        }
    }

    int64_t rlmax, lrmax;
    {
        int64_t re, le, rpos, lpos;
        rlmax = lrmax = re = le = rpos = 0;
        lpos = C;

        for (size_t i = 0; i < N; ++i) {
            re = re + sr[i].v - (sr[i].x - rpos);
            rlmax = std::max(rlmax, re + lmax[N-i-1] - sr[i].x);
            rpos = sr[i].x;

            le = le + sl[i].v - (lpos - sl[i].x);
            lrmax = std::max(lrmax, le + rmax[N-i-1] - (C - sl[i].x));
            lpos = sl[i].x;
        }
    }

    std::cout
        << std::max(
                   {*std::max_element(rmax.begin(), rmax.end()),
                    *std::max_element(lmax.begin(), lmax.end()),
                    lrmax,
                    rlmax})
        << std::endl;

    return 0;
}


Measured memory_bytes: 6256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

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

    for (int i = 1; i <= n; i++)
    {
        int cnt = 0;
        for (int j = 1; j <= i; j++)
        {
            if (i%2==1 && i % j == 0) ++cnt;
        }
        if (cnt == 8) ++ans;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iomanip>
#include <ios>
#include <iostream>

using namespace std;

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

  int m = static_cast<int>(n) / 2;
  if (static_cast<int>(n) % 2 == 1) {
    m++;
  }

  cout << fixed << setprecision(9) << m / n;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=LLONG_MAX;
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
ll x,y,i,ans;
int main()
{
    //freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>x>>y;
	for(i=x;i<=y;i*=2)ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
// JavaScript source code
"use strict";

let myFunc = (input) => {
    input = input.split("\n");
    let temp = input[0];
    if (temp >= 'A' && temp <= 'Z') console.log('A');
    if (temp >= 'a' && temp <= 'z') console.log('a');
};

myFunc(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    cout<<(n+k-3)/(k-1)<<endl;
    return 0;
}


Measured memory_bytes: 640
import qualified Data.ByteString.Char8 as BC
import Data.Array.IO
import Data.Maybe (fromJust)
import Data.List
import Control.Monad

type Table = IOUArray Int Int

maxX = 10^5

main = do
  q <- readLn :: IO Int
  query <- getInt2DListBC
  table <- newArray (1, maxX) 0 :: IO Table
  prime table 1 maxX [i | i <- [3..maxX], odd i == True]
  p <- filter (/=0) <$> getElems table
  isPrime <- newArray (1, maxX) False :: IO (IOUArray Int Bool)
  foldM check isPrime p
  count <- newArray (0, maxX) 0 :: IO Table
  countMemo isPrime count p 3
  ans <- mapM (solve count) query
  putStr $ unlines . map show $ ans

bsToInt :: BC.ByteString -> Int
bsToInt = fst . fromJust . BC.readInt

getInt2DListBC :: IO [[Int]]
getInt2DListBC = map (map bsToInt . BC.words) . BC.lines <$> BC.getContents

countMemo :: IOUArray Int Bool -> Table -> [Int] -> Int -> IO Table
countMemo isPrime table [] i = do
    c <- readArray table (i-1)
    repeatWrite table (i, maxX) $ c + 1
    return table
countMemo isPrime table (p:ps) i = do
  b <- readArray isPrime $ div (p+1) 2
  if b
    then do
      c <- readArray table (i-1)
      repeatWrite table (i, p-1) $ c + 1
      countMemo isPrime table ps p
    else do
      countMemo isPrime table ps i

check :: IOUArray Int Bool -> Int -> IO (IOUArray Int Bool)
check table i = do
  writeArray table i True
  return table

solve :: Table -> [Int] -> IO Int
solve table [i, j] = do
  l <- readArray table $ i - 1
  r <- readArray table j
  return $ r - l

repeatWrite :: IOUArray Int Int -> (Int, Int) -> Int -> IO (IOUArray Int Int)
repeatWrite memo (i, j) c = do
  return =<< foldM (write c) memo [i..j]

write :: Int -> IOUArray Int Int -> Int -> IO (IOUArray Int Int)
write c memo x = do
  writeArray memo x c
  return memo

prime :: Table -> Int -> Int -> [Int] -> IO Table
prime table pn n []     = return table
prime table pn n x@(i:is) = do
  if i^2 <= n
    then do
      writeArray table (pn+1) i
      let is' = filter ((/=0) . flip mod i) is
      prime table (pn+1) n is'
    else do
      let len = length x
          idx = [pn+1..pn+len]
      prime' $ zip idx x
      return table
            where prime' :: [(Int, Int)] -> IO Table
                  prime' [] = return table
                  prime' ((i, n):ss) = do
                    writeArray table i n
                    prime' ss


Measured memory_bytes: 16380
#include<bits/stdc++.h>
 
using namespace std;
using S = set<long long>;
using D = deque<long long>; //pop_back pop_front push_back push_front front back clear empty
using L = vector<long long>;
using M = map<int,long long>;  //erase  (でキーごと削除) 追加削除検索O(log(N))
using A = vector<vector<long long>>;
using U = unordered_map<int,long long>; //map  (との違いはkeyの順番を保持していない)
using PQL = priority_queue<long long>; //erase  (でキーごと削除) push pop top 
using PQG = priority_queue<long long,L,greater<long long>>; //erase  (でキーごと削除) push pop top 


#define sorted(vector) sort(vector.begin(),vector.end()) //O(nlongn)
#define sortedreverce(vector) sort(vector.rbegin(),vector.rend()) //O(nlongn)
#define vdel(vector,a) vector.erase(vector.begin()+a)
#define vmin(vector) *min_element(vector.begin(),vector.end()) //O(N)
#define vmax(vector) *max_element(vector.begin(),vector.end()) //O(N)
#define vsum(vector) accumulate(vector.begin(),vector.end(),0) //O(N)
#define vcount(vector,a) count(vector.begin(), vector.end(),a) //O(N)
#define vfind(vector,a) find(vector.begin(), vector.end(), a) != vector.end() //遅いからあんまり使うな
#define bisect_left(vector,a) (lower_bound(vector.begin(),vector.end(),a)-vector.begin())
#define bisect_right(vector,a) (upper_bound(vector.begin(),vector.end(),a)-vector.begin())
#define inf 1000000000000000000+10
#define setans long long ans=0;

long long ZERO=0;
long long MOD=1000000007;

template <typename PQ>
long long pqsum(PQ pq){long long tmp=0;while(!pq.empty()){tmp+=pq.top();pq.pop();};return tmp;};

template <typename T>
void print(T a){for (auto b:a){cout<<b<<" ";};cout<<endl;}
template <>
void print(unsigned long a){cout<<a<<endl;}
template <>
void print(char a){cout<<a<<endl;}
template <>
void print(bool a){cout<<a<<endl;}
template <>
void print(long long a){cout<<a<<endl;}
template <>
void print(A a){for (auto b:a){for (auto c:b){cout<<c<<" ";}cout<<endl;};cout<<endl;}
template <>
void print(string a){cout<<a<<endl;}


//存在確認はmap!!!!!!!!!!!!!か配列に埋め込んでcontinueで回避
//__gcd(a,b)はコンパイラがGCC時のみ
//printf("%.16f", ans); 誤差落ち対応君

int main(){
    string s;
    cin>>s;
    s="0"+s;
    A dp(13,L(s.size(),0));
    dp[0][0]=1;
    long long pre=0;
    for(long long i=1  ;i<s.size()  ;i++){
        if (s[i]=='?'){
            for(long long j=0  ;j<13  ;j++){
                for(long long r=0  ;r<10  ;r++){
                    dp[(j*10+r)%13][i]+=dp[j][i-1]%MOD;
                }
            }
        }else{
            pre=s[i];
            pre-=48;
            for(long long j=0  ;j<13  ;j++){
                dp[(j*10+pre)%13][i]+=dp[j][i-1]%MOD;
            }
        }
    }
//    print(dp);
    print(dp[5][s.size()-1]%MOD);
}

Measured memory_bytes: 11388
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
int N, Q;
vector<int> T[200002];
ll X[200002];
ll Ans[200002];

void dfs(int num, ll value){
  rep(i, T[num].size()){
    int next = T[num][i];
    dfs(next, value+X[num]);
  }
  Ans[num] = value+X[num];
}

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

  cin >> N >> Q;
  int a, b;
  rep(i, N-1){
    cin >> a >> b;
    a--; b--;
    T[a].push_back(b);
  }
  int p;
  ll x;
  rep(i, Q){
    cin >> p >> x;
    p--;
    X[p] += x;
  }
  dfs(0, 0);
  rep(i, N) cout << Ans[i] << ' ';
  return 0;
}

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

int main(){
  int n;
  int t;
  
  for(int i = 0;i < 4;i++)
    {
      cin >> t >> n;

      if(t==1)cout << 6000*n << endl;
      if(t==2)cout << 4000*n << endl;
      if(t==3)cout << 3000*n << endl;
      if(t==4)cout << 2000*n << endl;

    }
}



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

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

    double a, b, x;
    cin >> a >> b >> x;
    double y = x / a;
    double pi = 3.1415926535;

    if (2 * y > a * b) {
        cout << fixed << setprecision(10)
             << atan(2 * (a * b - y) / a / a) * 180.0 / pi << endl;
    } else {
        cout << fixed << setprecision(10) << atan(b * b / 2.0 / y) * 180.0 / pi
             << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
ab = []

ans = 0
for i in range(n):
    a, b = map(int, input().split())
    ab.append([a, b])

ab = ab[::-1]

ans = 0
for i in range(n):
    a, b = ab[i]
    a += ans
    if b == 1 or a % b == 0:
        continue
    elif b > a:
        ans += b - a
    else: 
        ans += b - (a % b)

print(ans)

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

int main() {
    int n;
    cin >> n;
    while(true){
        int s = n;
        s = sqrt(n);
        s *= s;
        if(s == n){
            cout << n;
            break;
        }
        n--;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	int N;
	long A,B;
	long []h;
	void solve(){
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		A=sc.nextLong();
		B=sc.nextLong();
		h=new long[N];
		
		for(int i=0;i<N;i++){
			h[i]=sc.nextLong();
		}
		
		int Tmax=1000000000;
		int Tmin=0;
		int T=0;
		//二分探索
		while(Tmax-Tmin>1){
			T=Tmin+(Tmax-Tmin)/2;
			int cnt=0;
			for(int i=0;i<N;i++){
				if(h[i]>B*T){
					cnt+=Math.ceil((double)(h[i]-B*T)/(double)(A-B));
				}
			}
			
			if(cnt>T){
				Tmin=T;
			}
			else if(cnt<=T){
				Tmax=T;
			}
		}
		
		System.out.println(Tmax);
	}
}

Measured memory_bytes: 50796
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<unordered_map>
#include<stack>
#include<string>
#include<algorithm>
#include<functional>
#include<cstring>
#include<complex>
#include<bitset>
#include<iostream>
using namespace std;

/**** Type Define ****/

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

/**** main function ****/

ll A, B, N, ans = 0;

int main() {

	scanf("%lld %lld %lld", &N, &A, &B);


	ans = (N - 2) * (B - A) + 1;
	if (B - A < 0 || N==1) ans = 0;
	if (A == B) ans = 1;

	printf("%lld", ans);

	return 0;
}

Measured memory_bytes: 256
ll = sorted([list(map(int,input().split())) for _ in range(int(input()))],key=lambda k:k[2])
x,y,h = ll[-1]
for cx in range(101):
  for cy in range(101):
    ch = h+abs(x-cx)+abs(y-cy)
    if all(max(ch-abs(x-cx)-abs(y-cy),0)==h for x,y,h in ll): print(cx,cy,ch); exit()

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

using namespace std;

int main()
{
  int n, a;
  cin>>n;
  int res = 0;
  for (int i=1; i<=n; i++)
  {
    cin>>a;
    if (i%2 && a%2) res++;
  }
  
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	vi P(N), Q(N);
	rp(i, 0, N) cin>>P[i];
	rp(i, 0, N) cin>>Q[i];
	vi minV = min(P, Q);
	vi maxV = max(P, Q);
	int c = 0;
	while(minV != maxV){
		c++;
		next_permutation(minV.begin(), minV.end());
	}
	cout<< c <<endl;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**7)
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))

from collections import Counter
from itertools import accumulate
import bisect

n = readint()
a = readints()
b = sorted(Counter(a).values())
exist = len(b)
b = [0]*(n-exist)+b
c = list(accumulate([0]+b))

ans = [n]
for k in range(2,exist+1):
    l = 0
    r = n//k+1
    while r-l>1:
        x = (r+l)//2
        i = bisect.bisect_left(b,x)
        if c[i]+(n-i)*x>=x*k:
            l = x
        else:
            r = x
    ans.append(l)

printrows(ans+[0]*(n-exist))

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }

using namespace std;

int main(int argc, char** argv) 
{
#ifdef HOME
	if(IsDebuggerPresent())
	{
		freopen("../in.txt", "rb", stdin);
		freopen("../out.txt", "wb", stdout);
	}
#endif
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
	string s;
	cin >> s;
	while (s.size() < 15)
		s += 'o';
	int ctr = 0;
	forn(i, s.size())
	{
		if (s[i] == 'o')
			++ctr;
	}
	if (ctr > 7)
	{
		cout << "YES\n";
	}
	else
	{
		cout << "NO\n";
	}
	return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, q;
  string s;
  cin >> n >> q >> s;
  
  vector<char> t(q), d(q);
  for (int i = 0; i < q; i++) cin >> t.at(i) >> d.at(i);
  
  int dead_l = -1, alive_l = n;
  while (alive_l - dead_l > 1) {
    int mid = (dead_l + alive_l) / 2;
    int it = mid;
    for (int i = 0; i < q; i++) {
      if (s.at(it) == t.at(i)) {
        if (d.at(i) == 'L') it--;
        else it++;
      }
      if (it < 0 || it >= n) break;
    }
    if (it < 0) dead_l = mid;
    else alive_l = mid;
  }
  
  int alive_r = -1, dead_r = n;
  while (dead_r - alive_r > 1) {
    int mid = (dead_r + alive_r) / 2;
    int it = mid;
    for (int i = 0; i < q; i++) {
      if (s.at(it) == t.at(i)) {
        if (d.at(i) == 'L') it--;
        else it++;
      }
      if (it < 0 || it >= n) break;
    }
    if (it >= n) dead_r = mid;
    else alive_r = mid;
  }
  
  cout << alive_r - alive_l + 1 << '\n';
}

Measured memory_bytes: 976
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <cmath>

using namespace std;
const int maxn = 100002;
const int mo = 1000000007;

int n, m;

long long c[2][maxn];
long long res[100];

int main()
{
	cin >> n >> m;
	if (n == 1 || m == 1) {
		cout << 1 << endl;
		return 0;
	}

	int flag = 1;
	c[0][0] = c[0][1] = 1;
	for (int i = 2; i <= n+33; ++i){
		c[flag][0] = c[flag][i] = 1;

		for (int j = 1; j < i && j < 31; ++j) {
			c[flag][j] = c[1-flag][j-1] + c[1-flag][j];
			if (c[flag][j] >= mo)
				c[flag][j] -= mo;
		}
		
		if (i >= n)
			res[i-n+1] = c[flag][i-n+1];

		flag = 1-flag;
	}

	int tmp = m;

	long long ans = 1;
	for (int i = 2; i < m && tmp > 1; ++i)
		if (tmp%i == 0) {
			int count = 0;
			while (tmp%i == 0) {
				tmp /= i;
				++count;
			}

			ans = ans * res[count] % mo;
		}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string S,T;
    cin >> S >> T;
    
    string roS,laS;
    for(int i=0; i<(int)S.size(); i++){
        if(S == T){
            cout << "Yes" << endl;
            return 0;
        }
        laS = S.at((int)S.size()-1);
        roS = S.erase((int)S.size()-1,1);
        S = laS + roS;
    }
    cout << "No" << endl;
}



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

typedef long long ll;

#define Canuc80k cin.tie(0); cout.tie(0);
#define I_am ios_base::sync_with_stdio(false);
#define REP(i,a,b) for (int i = a; i < b; i ++)
#define FOR(i,a,b) for (int i = a; i <= b; i ++)
#define FORD(i,a,b) for (int i = a; i >= b; i --)

const int N = 1e6 + 1;
const int M = 1e9 + 7;

string str;
pair<int, int> a[N];
int n, m, h[N], cnt = 0;
bool pp[N];

int main() {
    I_am Canuc80k;

    cin >> n >> m;
    FOR (i, 1, n) {
        cin >> h[i];
        pp[i] = true;
    }

    FOR (i, 1, m)
        cin >> a[i].first >> a[i].second;
        
    sort(a + 1, a + m + 1);

    FOR (j, 1, m) {
        if (h[a[j].second] >=h[a[j].first] ) 
                    pp[a[j].first] = false;
                if (h[a[j].second] <= h[a[j].first]) 
                    pp[a[j].second] = false;
    }   

    FOR (i, 1, n)
        if (pp[i]) cnt ++;
    
    cout << cnt;
}

Measured memory_bytes: 4928
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
typedef long long ll;
int main()
{
    ll n, k;
    cin >> n >> k;
    if (n % k == 0)
    {
        cout << "0" << endl;
        return 0;
    }
    else
    {
        ll tmp = n % k;
        while (true)
        {
            if (abs(tmp - k) < tmp)
                tmp = abs(tmp - k);
            else
            {
                break;
            }
        }
        cout << tmp << endl;
    }
}


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

int main(){
	int A, B, C;
	cin >> A >> B >> C;
	
	if(A>=B && A>=C){
		cout << 10*A+B+C << endl;
		return 0;
	}
	else if(B>=C && B>=A){
		cout << 10*B+C+A << endl;
		return 0;
	}
	else if(C>=A && C>=B){
		cout << 10*C+A+B << endl;
		return 0;
	}
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = int(lines[0])
    v = [int(e) for e in lines[1].split(" ")]

    return (n, v)


def solve(n, v):

    v.sort()

    total = v[0]
    for i in range(1, n):
        total = (total + v[i]) / 2

    return total


def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n)     for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n)    for (int i = 1; i <= (int)(n); ++i)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rrep(i, n)    for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n)   for (int i = (int)(n); i >= 1; --i)
#define allrep(V, v)  for (auto &&V : v)
#define all(x)        (x).begin(), (x).end()
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = 1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;

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

  int n;
  cin >> n;
  vector<lint> x(n), y(n);
  vector<char> d(n);
  rep (i, n) cin >> x[i] >> y[i] >> d[i];
  struct point {
    lint inc, dec, con;
  };
  point xmax, xmin, ymax, ymin;
  xmax.inc = -INF;
  xmax.dec = -INF;
  xmax.con = -INF;
  xmin.inc = INF;
  xmin.dec = INF;
  xmin.con = INF;
  ymax.inc = -INF;
  ymax.dec = -INF;
  ymax.con = -INF;
  ymin.inc = INF;
  ymin.dec = INF;
  ymin.con = INF;
  rep (i, n) {
    if (d[i] == 'R' || d[i] == 'L') {
      if (d[i] == 'R') {
        xmax.inc = max(xmax.inc, x[i]);
        xmin.inc = min(xmin.inc, x[i]);
      } else {
        xmax.dec = max(xmax.dec, x[i]);
        xmin.dec = min(xmin.dec, x[i]);
      }
      ymax.con = max(ymax.con, y[i]);
      ymin.con = min(ymin.con, y[i]);
    }
    if (d[i] == 'U' || d[i] == 'D') {
      if (d[i] == 'U') {
        ymax.inc = max(ymax.inc, y[i]);
        ymin.inc = min(ymin.inc, y[i]);
      } else {
        ymax.dec = max(ymax.dec, y[i]);
        ymin.dec = min(ymin.dec, y[i]);
      }
      xmax.con = max(xmax.con, x[i]);
      xmin.con = min(xmin.con, x[i]);
    }
  }
  set<double> candi{0};
  vector<point*> vec{&xmax, &xmin, &ymax, &ymin};
  allrep (v, vec) {
    candi.insert(max(v->dec - v->inc, 0LL) / 2.0);
    candi.insert(abs(v->dec - v->con));
    candi.insert(abs(v->inc - v->con));
  }
  double mini = INFL;
  allrep (t, candi) {
    double nxmax = max({xmax.inc + t, xmax.dec - t, (double)xmax.con});
    double nxmin = min({xmin.inc + t, xmin.dec - t, (double)xmin.con});
    double nymax = max({ymax.inc + t, ymax.dec - t, (double)ymax.con});
    double nymin = min({ymin.inc + t, ymin.dec - t, (double)ymin.con});
    mini = min(mini, (nxmax - nxmin) * (nymax - nymin));
  }
  cout << mini << endl;
  return 0;
}

Measured memory_bytes: 1920
#define _USE_MATH_DEFINES 
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <math.h>
#include <unordered_set>
#include <iomanip>
#include <cmath>
#include <set>
#include <locale>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
ll Lgcd(ll a, ll b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
using Graph = vector<vector<int>>;
//cout << fixed << setprecision(6);
//cout << setfill('0') << right << setw(2);


int main() {
	int n, a[100000], l[100100], r[100100], ans = 0;
	cin >> n;
	rep(i, n) cin >> a[i];
	l[0] = a[0];
	r[0] = a[n - 1];
	rep(i, n) {
		l[i + 1] = gcd(l[i], a[i]);
		r[i + 1] = gcd(r[i], a[n - i - 1]);
	}
	l[0] = r[n - 1];
	r[0] = l[n - 1];
	rep(i, n) ans = max(ans, gcd(l[i], r[n - i - 1]));
	cout << ans << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;
using P = pair<int, int>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

ll w, h;
struct pqdata {
    ll cost; char x;
    bool operator<(const pqdata &r) const { return cost < r.cost; }
};

int main() {
    cin >> w >> h;
    vector<pqdata> pqvec;
    for(int i = 0; i < w; ++i) {
        pqdata indata;
        cin >> indata.cost;
        indata.x = 'p';
        pqvec.emplace_back(indata);
    }
    for(int i = 0; i < h; ++i) {
        pqdata indata;
        cin >> indata.cost;
        indata.x = 'q';
        pqvec.emplace_back(indata);
    }
    sort(pqvec.begin(), pqvec.end());

    int pqlen = pqvec.size();
    int pnow = h+1; int qnow = w+1;
    ll ans = 0;
    for(int i = 0; i < pqlen; ++i) {
        if(pqvec.at(i).x == 'p') {
            ans += pqvec.at(i).cost*pnow;
            qnow--;
        }else {
            ans += pqvec.at(i).cost*qnow;
            pnow--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6384
// 2011/03/01 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int tol[8][8] = {{  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1},
	                 {  -1,   0, 300, 500, 600, 700,1350,1650},
	                 {  -1, 300,   0, 350, 450, 600,1150,1500},
	                 {  -1, 500, 350,   0, 250, 400,1000,1350},
	                 {  -1, 600, 450, 250,   0, 250, 850,1300},
	                 {  -1, 700, 600, 400, 250,   0, 600,1150},
	                 {  -1,1350,1150,1000, 850, 600,   0, 500},
	                 {  -1,1650,1500,1350,1300,1150, 500,   0}};

	int dis[8][8] = {{  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1},
	                 {  -1,   0,   6,  13,  18,  23,  43,  58},
	                 {  -1,   6,   0,   7,  12,  17,  37,  52},
	                 {  -1,  13,   7,   0,   5,  10,  30,  45},
	                 {  -1,  18,  12,   5,   0,   5,  25,  40},
	                 {  -1,  23,  17,  10,   5,   0,  20,  35},
	                 {  -1,  43,  37,  30,  25,  20,   0,  15},
	                 {  -1,  58,  52,  45,  40,  35,  15,   0}};

	while(true){
		int fic;
		cin >> fic;
		if(fic==0)
			break;

		int fh, fm;
		cin >> fh >> fm;
		int tic;
		cin >> tic;
		int th, tm;
		cin >> th >> tm;

		int fhm = fh*100+fm;
		int thm = th*100+tm;

		if(((fhm>=1730&&fhm<=1930)||(thm>=1730&&thm<=1930))&&dis[fic][tic]<=40)
			cout << (tol[fic][tic]/50+1)/2*50 << endl;
		else
			cout << tol[fic][tic] << endl;
	}

	return 0;
}

Measured memory_bytes: 0
void main()
{
    long[] tmp = rdRow;
    long n = tmp[0], m = tmp[1], v = tmp[2], p = tmp[3];
    long[] a = rdRow;

    a.sort!"a > b";
    long cnt = p;
    long diff;
    foreach (i; p .. n)
    {
        long b = a[i] + m;
        if (v - (n - i) < p)
        {
            if (b >= a[p-1]) ++cnt;
        }
        else
        {
            long ex = v - (n - i) - p + 1;
            long total = diff + (b - a[p-1]) * (i - p + 1);
            if (b >= a[p-1] && total >= ex * m) ++cnt;
            else break;
        }
        diff += a[p-1] - a[i];
    }

    cnt.writeln;
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 4404
#include<bits/stdc++.h>
#define int long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define prev prev1
#define precise(i) cout<<fixed<<setprecision(i)
#define codejam cout<<"Case #"<<ii+1<<": ";
#define impossible cout<<"IMPOSSIBLE"<<endl;
#define error(s) throw runtime_error(s)
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
int myRand(int R) {
	int val=rng() % R;
      assert(val>=0);
      return val;
}
using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=3e18;
const int32_t LOG=21;
const int MOD=MOD1;


int32_t main()
{ 
      getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      { 
          int x[6];
          int ans=1;
          rep(i,1,6)
          {
                cin>>x[i];
                if(x[i]==0)ans=i;
          }
          cout<<ans<<endl; 
      }      
      return 0;                         
}

/*
 TIPS:
 1.) Check for corner cases (like 0 is exception case)
 2.) Check for global memory sizes,memory refreshments and its complexity 
 3.) Check for sorting criteria (if used 1-based indexing)
 4.) Check for numbers overflow (while multiplying and doing MOD)
 5.) Check for typecasting issues like int to float( while dividing numbers)
*/

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
	ll a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			ins[a]++;
			ins[a] = ins[a] % 1000000007;
			n /= a;
		}
		else {
			a++;
		}
	}
	ins[n]++;
}

vector<ll>relation[20], money(20, 1);
int dp[110][110];

int keta(int x) {
	int y = 0;
	while (x > 0) {
		y++;
		x /= 10;
	}
	return y;
}

int main() {
	int k, a, b;
	cin >> k >> a >> b;
	for (int i = a;i <= b;++i) {
		if (i % k == 0) {
			puts("OK");
			return 0;
		}
	}
	puts("NG");
	return 0;
}


Measured memory_bytes: 3636
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    lines = lines[0].split(' ');
    const N = lines[0] - 0;
    const A = lines[1] - 0;
    const B = lines[2] - 0;
    const minAmount = Math.min(N*A, B);
    console.log(minAmount);
});

Measured memory_bytes: 21320
s = input()

cnt1 = 0
cnt2 = 0

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == '0':
            cnt1 += 1
        else:
            cnt2 += 1
    else:
        if s[i] == '0':
            cnt2 += 1
        else:
            cnt1 += 1

print(min(cnt1, cnt2))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265358979323846264338327950L
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1)
    {
        cerr << name << " = " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args)
    {
        const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " = " << arg1 << " || ";
        __f(comma+1, args...);
    }
#else
#define debug(...)
#endif
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll a, b, c, d;
 	cin >> a >> b >> c >> d;
 	ll ans = -1e18;
 	ans = max(ans, a * d);   
 	ans = max(ans, a * c);   
 	ans = max(ans, b * c);   
 	ans = max(ans, b * d);
 	cout << ans << endl;   
	return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  int N, M = 1e9+7;
  cin >> N;
  vector<long long> sum(60);
  for (int i = 0; i < N; i++) {
    long long a;
    cin >> a;
    for (int j = 0; j < 60; j++) sum.at(j) += a >> j & 1;
  }

  long long ans = 0;

  for (int i = 0; i < 60; i++) {
    ans = (ans + (sum.at(i) * (N - sum.at(i)) % M) * ((1LL << i) % M)) % M;
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
//Burn It Dowwwnnnnn.....................
#include<bits/stdc++.h>
#define pi acos(-1)
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long int i,j,k,l,a,b,c,d,q,s,n,m,t=1;
//    cin>>t;
    for(j=0;j<t;j++)
    {
        vector<long long int>vv;
        map<long long int,long long int>uu;
        double x;
        cin>>x;
        cout<<pi*2*x<<endl;

    }
}



Measured memory_bytes: 3840
S = input()
T = input()
ans = len(T)
for num1 in range(len(S)-len(T)+1):
  temp = len(T)
  for num2 in range(len(T)):
    if S[num1+num2] == T[num2]:
      temp -= 1
  if temp < ans:
    ans = temp
print(ans)

Measured memory_bytes: 9060