akhauriyash/Code-Regression huggingface dataset:
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	h := getNextInt(scanner)
	a := getNextInt(scanner)
	fmt.Fprintln(writer, (h-1)/a+1)
}


Measured memory_bytes: 640
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

void solve() {
  int r;
  scan(r);
  double ans = 2 * r * M_PI;
  print(ans);

}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 3236
#include <iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int K;
	cin >> K;
	int A, B;
	cin >> A >> B;

	for (int i = A; i <= B; i++) {
		if (i % K == 0) {
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;


}





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

vector<vector<ll>> G;

ll solve() {
    ll N;
    cin >> N;
    vector<vector<int>> G(N);
    int a, b;
    for ( int i = 0; i < N-1; i++ ) {
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<int> num(3);
    vector<int> used(N); // b:1, w:2
    queue<int> q;
    q.push(0);
    used[0] = 1;
    num[1]++;
    q.push(N-1);
    used[N-1] = 2;
    num[2]++;
    while ( !q.empty() ) {
        int p = q.front();
        q.pop();
        for ( int v : G[p] ) {
            if ( used[v] == 0 ) {
                int c = used[p];
                used[v] = c;
                num[c]++;
                q.push(v);
                if ( num[c] > N / 2 ) return c;
            }
        }
    }
    if ( N & 1 ) return 1;
    else return 2;
    return 0;
}

int main() {
    auto ans = solve() == 1 ? "Fennec" : "Snuke";
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6144
import Control.Applicative
import Control.Monad

main = do
    n <- readLn
    ts <- map (map read . words) <$> replicateM n getLine
    putStrLn . show $ solve n ts

solve :: Int -> [[Int]] -> Int
solve n (f:ts) = sum $ foldl calc f ts

calc :: [Int] -> [Int] -> [Int]
calc [t, s] [nt, ns]
    | nt < t || ns < s = [nt*a, ns*a]
    | otherwise = [nt, ns]
    where
        a = max (timeTil nt t) (timeTil ns s)

timeTil :: Int -> Int -> Int
timeTil nt t
    | t `mod` nt == 0 = t `div` nt
    | otherwise = t `div` nt + 1


Measured memory_bytes: 1404
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = (int)1e9 + 7;

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

    int t, x;
    cin >> t >> x;
    cout << 1.0 * t / x << endl;

}

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

using namespace std;

int main() {
	vector<int> A;
	int q;
	int query;
	int x;

	cin >> q;

	for (int i = 0; i < q; i++) {
		cin >> query;
		if (query == 0) {
			cin >> x;
			A.push_back(x);
		}
		else if (query == 1) {
			cin >> x;
			cout << A[x] << endl;
		}
		else {
			A.pop_back();
		}	
	}
}




Measured memory_bytes: 3904
{-# LANGUAGE BangPatterns #-}
import Control.Applicative((<$>))
import Control.Monad
import Data.Map ((!))
import qualified Data.Map as M
import qualified Data.List as L
import Data.Maybe (catMaybes)
-- import qualified Data.Char as C
-- import qualified Data.IntSet as I
import Debug.Trace
-- import Text.Regex.Posix ((=~))
--------------------------------------------
readInt    = read :: String -> Int
getInt     = readInt <$> getLine
getIntList = map readInt . words <$> getLine
int2bin 0 =  []
int2bin n =  n `mod` 2 : int2bin (n `div` 2)
----------------------------------------------

counter ans [] =
  let tmp = length ans in
  if tmp == 3 then "Three" else "Four"
counter ans (s:ss)
  | s == ' ' = counter ans ss
  | any (s ==) ans = counter ans ss
  | otherwise = counter (s:ans) ss

main :: IO ()
main = do
  n  <- getInt
  ss <- getLine
  putStrLn $ counter "" ss


Measured memory_bytes: 508
N=int(input())
s=[input().split() for i in range(N)]
M=0
for i in range(N):
  p=int(i)
  if s[p][1]=="JPY":
    M=M+float(s[p][0])
  else:
    M=M+float(s[p][0])*380000.0
print(M)



Measured memory_bytes: 2940
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define cerr if(false) cerr
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
using namespace std;
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a){
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
    for(auto x:v)os << x << ' ';
    return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
    cerr << a;
    if(sizeof...(b))cerr << ", ";
    debug(b...);
}
int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    a *= 4;
    b *= 2;
    ll k = min({a,b,c});
    ll l = min(2*k,d);
    ll n;
    cin >> n;
    cout << min(k*n,l*(n/2)+n%2*k) << endl;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <queue>
# define MOD 1000000000+7
# define INF 1000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
long long int a = 0, b = 0, c = 0, d = 0, e = 0, ans = 0, x = 0, y = 0, z = 0, N = 0, m = 0, maxy = 0, mini = 9999, counter = 0, endp = 0, checker = 0;

std::vector <char> vec{}, vecsec{}, vecth{};
long long int iremono[100010], koware[100001];
long long  int iremono2[100001], check[100001], xpo[10000001], ypo[10000001], hei[1000001];
std::vector<std::string>kinds{}, kaku{};
char maze[1000];
int sx, sy;
int gx, gy;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
bool okada = false, okada2 = false;
long long int dp[4][100003] ,ire[4][100003];
std::string input[103],one,two,three;
char re;

int H, W;//はんい
bool qw = false, er = false, ty = false, ui = false;
std::string code;
int main() {
	x = 99999;
	cin >> a >> b;
	counter = 0;
	rep(i, a) {
		counter += b + i;
		if (x> abs(b + i)) {
			mini = b + i;
			x = abs(b + i);
		
	}
	}
	
	cout << counter - mini;
}




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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const ll INF=1e9;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,n){cout<<arr[i][j]<<" ";}cout<<endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}
ll n,a,b,c,d;
string s;
bool canReach(ll start,ll end){
    ll x=0,y=0,maxX=0,maxY=0;
    REP(i,start,end){
        if(s[i]==*"."){
            x++;
            maxX=max(maxX,x);
            y=0;
        }else{
            y++;
            x=0;
            maxY=max(maxY,y);
        }
    }
    return maxY<2;
}
bool canThrough(ll start,ll end){
    ll x=0,y=0,maxX=0,maxY=0;
    REP(i,start-1,end+2){
        if(s[i]==*"."){
            x++;
            maxX=max(maxX,x);
            y=0;
        }else{
            y++;
            x=0;
            maxY=max(maxY,y);
        }
    }
    return maxX>2;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n>>a>>b>>c>>d;
    cin>>s;
    s='#'+s+'#';

    if(c>d){
        Yes(canReach(a,c)&&canReach(b,d)&&canThrough(b,d));
    }else{
        Yes(canReach(a,c)&&canReach(b,d));
    }
    return  0;
}

Measured memory_bytes: 720
import java.util.Scanner;

class Main {  
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int[] numbers = new int[n];
    for (int i = 0; i < n; i++) {
      numbers[i] = in.nextInt();
    }
    trace(numbers);
    insertionSort(numbers);
  }
  
  public static void insertionSort(int[] array) {
    for (int j = 1; j < array.length; j++) {
      int key = array[j];
      for (int i = j - 1; i >= 0 && array[i] > key; i--) {
        swap(array, i, i + 1);
      }
      trace(array);
    }
  }
  
  public static void swap(int[] array, int p, int q) {
    int temp = array[p];
    array[p] = array[q];
    array[q] = temp;
  }
  
  public static void trace(int[] array) {
    StringBuilder output = new StringBuilder();
    for (int i = 0; i < array.length; i++) {
      output.append(array[i]);
      if (i != array.length -1) output.append(" ");
    }
    System.out.println(output.toString());
  }
}

Measured memory_bytes: 21680
// ABC085 B - Kagami Mochi

package main

import (
    "fmt"
    "sort"
)

var d []int

func main() {
    var N int
    var In int
    var presize int
    var stage int

    fmt.Scan(&N)

    d = make([]int,N)

    for i := 0; i < N; i++ {
        fmt.Scan(&In)
        d[i] = In
    }

//  for i := 0; i < N; i++ {
//    fmt.Printf("init:d[%d]=%d\n",i,d[i])
//  }

    sort.Sort(sort.Reverse(sort.IntSlice(d)))


    stage = 0
    presize = 101

    for i := 0; i < N ; i++ {
        if d[i] < presize {
            stage++
            presize = d[i]
        } else {
            continue
        }
    }

    fmt.Println(stage)
}


Measured memory_bytes: 512
import math
a, b, x = map(int, input().split())
m = a*a*b
if a*a*b > x*2:
    print(90-math.degrees(math.atan(((x/a/b))*2/b)))
else:
    print(math.degrees(math.atan((b-(x/a/a))*2/a)))


Measured memory_bytes: 2940
<?php

$stdin = preg_split('/ /', trim(fgets(STDIN)));
$n = intval(array_shift($stdin));
$m = intval(array_shift($stdin));
$matrix_a = array();
$matrix_b = array();
$matrix_c = array();

for ($i = 0; $i < $n; $i++) {
    $matrix_a[$i] = preg_split('/ /', trim(fgets(STDIN)));
    $matrix_c[$i] = 0;
}
for ($i = 0; $i < $m; $i++) {
    $matrix_b[$i] = intval(trim(fgets(STDIN)));
}

for ($i = 0; $i < $n; $i++) {
    for ($j = 0; $j < $m; $j++) {
        $matrix_c[$i] += $matrix_a[$i][$j] * $matrix_b[$j];
    }
}

for ($i = 0; $i < $n; $i++) {
    print($matrix_c[$i] . "\n");
}

Measured memory_bytes: 8488
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;
	cin>>n;
	map<int,int> mp;
	rep(i,n){
		int a;
		cin>>a;
		mp[a]++;
	}
	int ans=0;
	for(auto itr:mp){
		if(itr.se%2==1) ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4992
import java.util.*;
import java.util.Map.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int a = Integer.parseInt(String.valueOf(str.charAt(0)));
        int b = Integer.parseInt(String.valueOf(str.charAt(1)));
        int c = Integer.parseInt(String.valueOf(str.charAt(2)));
        int d = Integer.parseInt(String.valueOf(str.charAt(3)));
        
        if (a + b + c + d == 7) {System.out.println(String.valueOf(a) + "+" + String.valueOf(b) + "+" + String.valueOf(c) + "+" + String.valueOf(d) + "=7"); return;}
        if (a + b + c - d == 7) {System.out.println(String.valueOf(a) + "+" + String.valueOf(b) + "+" + String.valueOf(c) + "-" + String.valueOf(d) + "=7"); return;}
        if (a + b - c + d == 7) {System.out.println(String.valueOf(a) + "+" + String.valueOf(b) + "-" + String.valueOf(c) + "+" + String.valueOf(d) + "=7"); return;}
        if (a + b - c - d == 7) {System.out.println(String.valueOf(a) + "+" + String.valueOf(b) + "-" + String.valueOf(c) + "-" + String.valueOf(d) + "=7"); return;}
        if (a - b + c + d == 7) {System.out.println(String.valueOf(a) + "-" + String.valueOf(b) + "+" + String.valueOf(c) + "+" + String.valueOf(d) + "=7"); return;}
        if (a - b + c - d == 7) {System.out.println(String.valueOf(a) + "-" + String.valueOf(b) + "+" + String.valueOf(c) + "-" + String.valueOf(d) + "=7"); return;}
        if (a - b - c + d == 7) {System.out.println(String.valueOf(a) + "-" + String.valueOf(b) + "-" + String.valueOf(c) + "+" + String.valueOf(d) + "=7"); return;}
        if (a - b - c - d == 7) {System.out.println(String.valueOf(a) + "-" + String.valueOf(b) + "-" + String.valueOf(c) + "-" + String.valueOf(d) + "=7"); return;}
        
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
int main(){
	int N, K,ans=0;
	cin >> N >> K;
	int l[50];
	for (int i = 0; i < N; i++){
		cin >> l[i];
	}
	sort(l, l + N );
		for (int j = N - K ; j < N; j++){
			ans = ans + l[j];
		}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
using namespace std;
#define fastestiointhewest   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll          long long
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define mii         map<int,int>
#define vi          vector<int>
#define vll         vector<long long>
#define all(a)      (a).begin(),(a).end()
#define clz(a)      __builtin_clz(a) // count leading zeroes
#define ctz(a)      __builtin_ctz(a) // count trailing zeroes
#define popc(a)     __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define SIZE        1000005
#define F           first
#define S           second
#define debug(x)    cerr << #x << " = " << x << endl;
#define mod         998244353

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " = " << arg1<<" |";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define endl        '\n'
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

void solve()
{
   string s; cin>>s;
   int n=s.size();
   string temp1="",temp2="";
   rep(i,0,n)
   {
     if(i&1) temp1+='1',temp2+='0';
     else temp1+='0',temp2+='1';
   }
   int ans1=0,ans2=0;
   rep(i,0,n)
   {
     ans1+=(temp1[i]!=s[i]);
     ans2+=(temp2[i]!=s[i]);
   } 
   cout<<min(ans1,ans2);
} 
int main()
{   
    fastestiointhewest;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;
    while(t--){
       solve();
    }
    return 0;
}

Measured memory_bytes: 720
n = int(input())
cardlist=list(map(str,input().split()))
def BubbleSort(C):
    for i in range(len(C)):
        for j in range(len(C)-1):
            if (C[j][-1:] >C[j+1][-1:]):
                C[j],C[j+1] = C[j+1],C[j]
    return C

def SelectionSort(C):
    for i in range(len(C)):
        minj = i
        for j in range(i,len(C)):
            if (C[j][-1:] < C[minj][-1:]):
                minj = j
        C[i],C[minj] = C[minj],C[i]
    return C
cardlist1 = cardlist.copy()
bubble = BubbleSort(cardlist)
print(*bubble)
print('Stable')
selection = SelectionSort(cardlist1)
print(*selection)
if(bubble == selection):
    print('Stable')
else:
    print('Not stable')



Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
 
#define INIT() ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define Rep(i,n) for (int i = 0; i < (n); ++i)
#define For(i,s,t) for (int i = (s); i <= (t); ++i)
#define rFor(i,t,s) for (int i = (t); i >= (s); --i)
#define ForLL(i, s, t) for (LL i = LL(s); i <= LL(t); ++i)
#define rForLL(i, t, s) for (LL i = LL(t); i >= LL(s); --i)
#define foreach(i,c) for (__typeof(c.begin()) i = c.begin(); i != c.end(); ++i)
#define rforeach(i,c) for (__typeof(c.rbegin()) i = c.rbegin(); i != c.rend(); ++i)
 
#define pr(x) cout << #x << " = " << x << "  "
#define prln(x) cout << #x << " = " << x << endl
 
#define LOWBIT(x) ((x)&(-x))
 
#define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())
 
#define ms0(a) memset(a,0,sizeof(a))
#define msI(a) memset(a,inf,sizeof(a))
#define msM(a) memset(a,-1,sizeof(a))

#define MP make_pair
#define PB push_back
#define ft first
#define sd second
 
template<typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &p) {
    in >> p.first >> p.second;
    return in;
}
 
template<typename T>
istream &operator>>(istream &in, vector<T> &v) {
    for (auto &x: v)
        in >> x;
    return in;
}
 
template<typename T1, typename T2>
ostream &operator<<(ostream &out, const std::pair<T1, T2> &p) {
    out << "[" << p.first << ", " << p.second << "]" << "\n";
    return out;
}

inline int gc(){
	static const int BUF = 1e7;
	static char buf[BUF], *bg = buf + BUF, *ed = bg;
	
	if(bg == ed) fread(bg = buf, 1, BUF, stdin);
	return *bg++;
} 

inline int ri(){
	int x = 0, f = 1, c = gc();
	for(; c<48||c>57; f = c=='-'?-1:f, c=gc());
	for(; c>47&&c<58; x = x*10 + c - 48, c=gc());
	return x*f;
}
 
typedef long long LL;
typedef unsigned long long uLL;
typedef pair< double, double > PDD;
typedef pair< int, int > PII;
typedef pair< string, int > PSI;
typedef set< int > SI;
typedef vector< int > VI;
typedef map< int, int > MII;
typedef pair< LL, LL > PLL;
typedef vector< LL > VL;
typedef vector< VL > VVL;
const double EPS = 1e-10;
const LL inf = 0x7fffffff;
const LL infLL = 0x7fffffffffffffffLL;
const LL mod = 1e9 + 7;
const int maxN = 3e5 + 7;
const LL ONE = 1;
const LL evenBits = 0xaaaaaaaaaaaaaaaa;
const LL oddBits = 0x5555555555555555;

// 返回低 x 位全 1 
inline LL allOne(LL x) {
    return (ONE << x) - 1;
}

LL N, M, K;
int oneCounts;

int main(){
	INIT(); 
	cin >> M >> K;
	N = (1 << M) - 1;

	if(K > N) cout << -1 << endl;
	else if(N == 1) {
		if(K == 1) cout << -1 << endl;
		else cout << "0 0 1 1" << endl;
	}
	else {
		For(i, 0, N) if(i != K) cout << i << " ";
		cout << K << " ";
		rFor(i, N, 0) if(i != K) cout << i << " ";
		cout << K << " ";
		cout << endl;
	}
    return 0;
}

Measured memory_bytes: 1792
#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;
  int sum = 0;
  rep(i,m){
    int a;
    cin >>a;
    sum += a;
  }
  if(sum>n) cout << -1 << endl;
  else cout << n-sum << endl;
  return 0;
}

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

using namespace std;
//そのにたどり着くためのパターンは最高でも２通りその２つを比較する。
int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  vector<int> dp(n);
  dp[0] = 0;
  for (int i = 0; i < n; i++)
    cin >> h.at(i);
  //dp
  for(int i = 1; i < n; i++){
    int step1, step2;
    step1 = abs(h[i - 1] - h[i]) + dp[i - 1];
    if(i != 1)
      step2 = abs(h[i - 2] - h[i]) + dp[i - 2];
    if(i == 1)
      dp[i] = step1;
    else{
      dp[i] = min(step1, step2);
    }
  }
  cout << dp[n - 1] << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

char *iitoa(const int a,char *s){
	int b=a,i;
	for(i=0;b;i++)b/=10;
	b=a;
	s[i]=0;
	for(;i;i--)s[i-1]=b%10+'0',b/=10;
	return s;
}

void ope(char *s){
	char buf=s[0];
	unsigned int counter=1;
	char str[200000]={};
	char b[1024]={};
	int i=1;
	s[strlen(s)]='_';
	while(s[i]!='_'){
		if(buf==s[i])counter++;
		else{
			iitoa(counter,b);
			counter=1;
			strcat(str,b);
			str[strlen(str)]=buf;
			buf=s[i];
		}
		i++;
	}
	iitoa(counter,b);
	strcat(str,b);
	str[strlen(str)]=buf;
	strcpy(s,str);
	return;
}


int main(){
	int n;
	char str[200000];
	char b;
	while(1){
		scanf("%d",&n);
		if(!n)return 0;
		scanf("%s",str);
		int i;
		for(i=0;i<n;i++){
			ope(str);
		}
		puts(str);
	}
}

Measured memory_bytes: 616
class Dice:
    def __init__(self,s):
        self.start = [0,1,2,4,3,5]#上 正 右 后 左 下
        self.s = s
        
    #下面的是几个反转方式
    def N(self):
        self.start[0],self.start[1],self.start[3],self.start[5] = \
        self.start[1],self.start[5],self.start[0],self.start[3]
        
    def S(self):
        self.start[0],self.start[1],self.start[3],self.start[5] = \
        self.start[3],self.start[0],self.start[5],self.start[1]
        
    def W(self):
        self.start[0],self.start[2],self.start[4],self.start[5] = \
        self.start[2],self.start[5],self.start[0],self.start[4]
    
    def E(self):
        self.start[0],self.start[2],self.start[4],self.start[5] = \
        self.start[4],self.start[0],self.start[5],self.start[2]    


    #这是特殊的旋转方法
    def roll(self):
        self.start[1],self.start[2],self.start[3],self.start[4] = \
        self.start[4],self.start[1],self.start[2],self.start[3]          
    
    def get_top(self):
        return self.s[self.start[0]]
    
    def get_zhengMian(self):
        return self.s[self.start[1]]
    
    def get_right(self):
        return self.s[self.start[2]]
    
    def get_left(self):
        return self.s[self.start[4]]  
    
def is_same(dice1,dice2):
    FLAG = False
    dice1 = Dice(dice1)
    dice2 = Dice(dice2)
    a,b,c = dice1.get_top(),dice1.get_zhengMian(),dice1.get_right()
    d,e,f = dice2.get_top(),dice2.get_zhengMian(),dice2.get_right()
    
    #我们在这只是转动dice2
    #让上面保持一致
    if d==a:
        FLAG = True
    elif d!=a:
        tmp1,tmp2 = dice2.get_left(),dice2.get_right()
        if tmp1==a:
            dice2.E()
            FLAG = True
        elif tmp2==a:
            dice2.W()
            FLAG = True
        else:
            count = 0
            while True:
                count += 1
                tmp1 = dice2.get_top()
                if tmp1==a:
                    FLAG = True
                    break
                if count == 4:
                    break
                dice2.S()
    
    #让正面保持一致
    if FLAG==False:
        return FLAG
    b,e = dice1.get_zhengMian(),dice2.get_zhengMian()
    if e==b:
        FLAG = True
    elif e!=b:
        count = 0
        while True:
            count += 1
            tmp = dice2.get_zhengMian()
            if tmp==b:
                FLAG = True
                break
            if count==4:
                FLAG = False
                break
            dice2.roll()
    
    if FLAG==False:
        return FLAG
    else:
        f = dice2.get_right()
        if f==c:
            return True
        else:
            return False

if __name__=="__main__":
    dice1 = list(map(int,input().split()))
    dice2 = list(map(int,input().split()))
    tmp1 = dice1.copy();tmp2 = dice2.copy()
    tmp1.sort();tmp2.sort()
    num = 0;
    for i in range(1,6):
        if tmp1[i-1]!=tmp1[i]:
            num += 1
    if num<=2:
        print('Yes')
    else:
        bl = is_same(dice1, dice2)
        if bl == True:
            print('Yes')
        else:
            print('No')


Measured memory_bytes: 5628
let split str =
  let rec split_inner ct b=
    if String.length str = ct then [b]
    else
      match str.[ct] with
        ' ' -> b::split_inner (ct+1) ""
      | c -> split_inner (ct+1) (b^(Char.escaped c))
  in split_inner 0 "";;

let () =
  let _ = read_line ()
  and s = read_line () in
  let l = split s in
  let result = match l with
      [h] -> h
    | h::t -> List.fold_left (fun x y -> y^" "^x ) h t
    | _ -> ""
  in
  Printf.printf "%s\n" result;;

Measured memory_bytes: 2608
N = int(input())
S = []
for n in range(N):
  S.append(input())
M = int(input())
T = []
for m in range(M):
  T.append(input())

ST_set = list(set(S + T))
ans = 0
for i in ST_set:
  money = S.count(i) - T.count(i)
  if ans < money:
    ans = money
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <regex>
#include <stack>
#include <queue>
#include <vector>
#define MAX_N 100
#define INF 10000000

using namespace std;

string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

long n,a,b;
string s;

void solve(){
	if (a + b == 15) cout << "+" << endl;
	else if (a * b == 15) cout << "*" << endl;
	else cout << "x" << endl;
}

int main() {
	cin >> a>>b;
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdint.h>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);
static const ll MOD = 1000000007;

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

void solve(std::vector<long long> H, std::vector<long long> M, long long K) {
  ll d = (H[1] - H[0]) * 60 + M[1] - M[0];
  cout << d - K << endl;
}

int main() {
  std::vector<long long> H(2);
  std::vector<long long> M(2);
  for (int i = 0; i < 2; i++) {
    scanf("%lld", &H[i]);
    scanf("%lld", &M[i]);
  }
  long long K;
  scanf("%lld", &K);
  solve(std::move(H), std::move(M), K);
  return 0;
}


Measured memory_bytes: 3696
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            String[] inputWords = br.readLine().split(" ");
            String firstAbbreviation = getInitialInCapital(inputWords[0]);
            String secondAbbreviation = getInitialInCapital(inputWords[1]);
            String thirdAbbreviation = getInitialInCapital(inputWords[2]);

            System.out.println(firstAbbreviation + secondAbbreviation + thirdAbbreviation);

        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }

    private static String getInitialInCapital(String word) {
        return word.substring(0, 1).toUpperCase();
    }
}

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

using namespace std;

int main(){
    map<string,set<int> >m;
    set<string>s;
    string w;
    int p;
    while(cin>>w>>p){
        if(w==">")break;
        m[w].insert(p);
        s.insert(w);
    }
    set<int>::iterator it;
    set<string>::iterator st;
    for (st = s.begin(); st != s.end(); ++st){
        cout<<*st<<endl;
        it = m[*st].begin();
        if(m[*st].size()>1)
            for (; it != prev(m[*st].end(), 1); ++it)
                cout<<*it<<" ";
        cout<<*it<<endl;
    }
}

Measured memory_bytes: 1240
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n;
string str;
ll alpha[50], bata[50];

int main(){
	cin >> n;
	
	for(ll i = 1; i <= n; i++){
		cin >> str;
		memset(bata, 0, sizeof(bata));
		
		for(ll j = 0; j < str.size(); j++){bata[str[j]-'a']++;}
		
		for(ll k = 0; k < 50; k++){alpha[k] = (i == 1)? bata[k] : min(bata[k], alpha[k]);}
	}
	
	for(ll k = 0; k < 26; k++){
		for(ll l = 1; l <= alpha[k]; l++){
			cout << char('a' + k);
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
public class Main {

	public static void main (String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		
		while ((line = br.readLine()) != null) {
			String[] numbers = line.split(" ");
			int a = Integer.parseInt(numbers[0]);
			int b = Integer.parseInt(numbers[1]);
			int a2 = a;
			int b2 = b;
			
			
			int limit = Math.min(a, b);
			ArrayList<Integer> elements = new ArrayList<Integer>();
			
			for (int i = limit; i > 1; i--){
				if (a % i == 0 && b % i == 0){
					a /= i;
					b /= i;
					elements.add(i);  
					continue;
				}
			}
			
			int gcd = 1;
			for(int i : elements){
				gcd *= i;
			}
			
			int lcm = (a2 / gcd) * b2;
			System.out.println(gcd + " " + lcm);
        }
	}
}

Measured memory_bytes: 17884
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

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

  int n, m; cin >> n >> m;
  int s[15][15] = {};
  vector<int> p(m);
  rep(i, m) {
    int k; cin >> k;
    rep(j, k) {
      int t; cin >> t;
      s[i][--t] = 1;
    }
  }
  rep(i, m) cin >> p[i];

  int ans = 0;
  // スイッチ n 個の全パターン
  for(int i = 0; i < (1<<n); ++i) {
    int j;
    // ランプ m 個
    for(j = 0; j < m; ++j) {
      int tmp = 0;
      rep(l, n) {
        // i を 右へ l bitずらす
        if(s[j][l] && i>>l & 1) ++tmp;  // error : l<<i
      }
      // もし一つでも光らないランプが混じっていたら除外
      if(tmp%2 != p[j]) break;
    }
    // break していなければ全て点灯している
    if(j == m) ++ans;
  }
  cout << ans << '\n';
  return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a.at(i);

    long long sum = 0;
    for (int k = 0; k < n - 1; k++)
    {
        if (a.at(k) > a.at(k + 1))
        {
            sum += a.at(k) - a.at(k + 1);
            a.at(k + 1) = a.at(k);
        }
        else
            continue;
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4028
import std.algorithm;
import std.range;
import std.stdio;
import std.math;
import std.array;
import std.string;
import std.conv;

/// 数列の読み込み
auto readNums(T = int)() {
	return readln().chomp.split.map!(to!T).array;
}

/// 数の読み込み
auto readNum(T = int)() {
	return readNums!T.front;
}

/// 指定行数読み込み
auto readRows(size_t rows) {
	return generate(() => readln().chomp).take(rows).array;
}

void main() {
    immutable n = cast(real) readNum();
    immutable bmax = cast(int) sqrt(n);
    immutable logn = log(n);
    int maxValue = 1;
    foreach(b; 2 .. bmax + 1) {
        maxValue = max(maxValue, b ^^ cast(int)(logn / log(b)));
    }
    writefln("%s", maxValue);
}

Measured memory_bytes: 508
#include<stdio.h>
#include<math.h>
#define true 1
#define false 0
int isPrime(int);

int main(){
  int x[10000],n,i,cnt=0;

  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&x[i]);
    if(isPrime(x[i]) == true) cnt++;
  }
  printf("%d\n",cnt);
  return 0;
}

int isPrime(int x){
  int i;

  if(x == 2) return true;

  if(x < 2 || (x % 2 == 0)) return false;

  i = 3;
  while(i <= sqrt(x)){
    if(x % i == 0) return false;
    i = i + 2;
  }
  return true;
}



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



int main(void){
    int a,b;
    cin >> a >> b;
    if(a>8 || b>8){
        cout << ":(";
    }
    else{
        cout << "Yay!";
    }
    
    return 0;
}




























































Measured memory_bytes: 256
def resolve():
    N = int(input())
    A, B = map(int, input().split())
    P = list(map(int, input().split()))
    ans = [0, 0, 0]
    for i in range(N):
        if P[i] <= A:
            ans[0] += 1
        elif P[i] >= B+1:
            ans[2] += 1
        else:
            ans[1] += 1
    print(min(ans))
resolve()

Measured memory_bytes: 9144
using System;
using System.Collections.Generic;

namespace ABC125_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var str1 = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var str2 = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            List<int> value = new List<int>();
            List<int> cost = new List<int>();
            var sum = 0;

            for (var x=0;x<str1.Length;x++)
            {
                value.Add(str1[x]);
            }

            for (var y=0;y<str1.Length;y++)
            {
                cost.Add(str2[y]);
            }

            for(var i=0;i<N;i++)
            {
                if(value[i] - cost[i] > 0)
                {
                    sum += (value[i] - cost[i]);
                }
            }

            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 11220
#include <stdio.h>
#include <stdlib.h>

int compare(const void *a, const void *b)
{
  return *(int *)b-*(int *)a;
}

int main(void)
{
  int num[5];

  int i;
  for(i=0; i<5; ++i){
    scanf("%d", &num[i]);
  }

  qsort((void *)num, 5, sizeof(int), compare);

  for(i=0; i<5; ++i){
    printf("%d", num[i]);
    printf("%s", i<4 ? " " : "\n");
  }

  return 0;
}

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

using namespace std;

#define FOR(i,s,e) for(int (i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)
#define RFOR(i,e,s) for(int (i)=(e)-1;(i)>=(int)(s);(i)--)
#define RREP(i,e) RFOR(i,e,0)

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

typedef long long ll;
typedef pair<int, int> PII;
typedef priority_queue<int> PQI;
typedef priority_queue<PII> PQII;

const double EPS = 1e-10;
const int INF = 1e9;
const int N = 100;
int n;
int r[N], c[N];
int dp[N+1][N];

int main() {
  scanf("%d ", &n);
  REP(i,n) scanf("%d%d ", r+i, c+i);

  REP(i,n+1) REP(j,n) dp[i][j] = INF;
  REP(j,n) dp[1][j] = 0;
  FOR(i,2,n+1) REP(j,n-i+1) FOR(k,1,i)
    dp[i][j] = min(dp[i][j], dp[k][j] + r[j]*c[j+k-1]*c[i+j-1] + dp[i-k][j+k]);

  printf("%d\n", dp[n][0]);

  return 0;
}

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

int n,m,up[2020][2],ans;
char s[2020];
#define pii pair<int,int>
#define fi first
#define se second
vector<pii>vec;
map<int,int>mp;
map<int,int>::iterator it1,it2,it;
pii p;

int main(){
  cin.tie(0);
  cin>>n>>m; ans=max(n,m);
  for (int i=1;i<=n;++i){
    cin>>s+1;
    vec.clear(), mp.clear();
    for (int j=2;j<=m;++j){
      vec.push_back((pii){i-up[j][s[j]==s[j-1]],j});
      up[j][s[j]!=s[j-1]]=i;
    }
    sort(vec.begin(),vec.end());
    mp[1]=mp[m+1]=1;
    for (int j=0;j<m-1;++j){ p=vec[j];
      it2=it=mp.lower_bound(p.se);
      it1=--it;
      ans=max(ans,p.fi*(it2->fi - it1->fi));
      mp[p.se]=1;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 384
n,k = map(int,input().split())

count_list = [0 for _ in range(k)]
for num in reversed(range(1,k+1)):
    # count = (k//num)**n
    count = pow(k//num,n,1000000007)
    count_list[num-1] = count

for num in reversed(range(1,k+1)):
    if k//num >= 2:
        for i in range(2,k//num+1):
            count_list[num-1] -= count_list[num*i-1]

score = 0
for idx,val in enumerate(count_list):
    score += (idx+1)*val

print(score%1000000007)

Measured memory_bytes: 11468
#include<stdio.h>

int main() 
{
	int N;
	int a[100];
	int A = 0;
	int B = 0;
	int i, j;
	
	scanf("%d",&N);
	for(i=0; i<N; i++){
		scanf("%d",&a[i]);
	}
	
	for(i=0; i<N; i++){
		for(j=N-1; j>i; j--){
			int temp = a[j];
			if( a[j-1] < a[j] ) {
			a[j] = a[j-1];
			a[j-1] = temp;
			}
		}
	}
	for(i=0; i<N; i++){
		if(i%2) B += a[i];
		else A += a[i];
	}
	printf("%d",A-B);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int price = 700;
    if(s[0] == 'o') price += 100;
    if(s[1] == 'o') price += 100;
    if(s[2] == 'o') price += 100;
    cout << price << endl;
    
}


Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
l_max = 0
r_min = n
m.times do |i|
  l, r = gets.split.map(&:to_i)
  l_max = [l_max, l].max
  r_min = [r_min, r].min
end
ans = r_min - l_max
if ans >= 0
  puts ans + 1
else
  puts 0
end


Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

int P,Q,A,N;

int gcd(int a,int b){
  if(b==0)return a;
  return gcd(b,a%b);
}
int lcm(int a,int b){
  return a*b/gcd(a,b);
}

void proc(int &na,int &nb){
  int lim=gcd(na,nb);
  for(int j=2;j*j<=lim;j++){
    if(na%j==0&&nb%j==0){
      na/=j;nb/=j;
      j--;
    }
  }
  // if(na==0){
  //   cout<<a<<" "<<b<<" "<<bunbo<<endl;
  // }
  if(nb%na==0){
    nb/=na;na=1;
  }
  else if(na%nb==0){
    na/=nb;nb=1;
  }
}

// a/b
int dfs(int cnt,int mul,int a,int b,int bunbo){
  if(mul==0)return 0;
  else if(a==0){
    return 1;
  }
  else if(cnt==0)return 0;
  int res=0;
  if(a==1&&bunbo<=b)res+=dfs(cnt-1,mul/b,0,1,bunbo);
  for(int i=bunbo;i*i<=mul;i++){
    if(a==1&&i==b)continue;
    int c=lcm(i,b);
    int nb=c;
    int na=-(c/i)+(a*c/b);
    if(na>=0){
      proc(na,nb);
      res+=dfs(cnt-1,mul/i,na,nb,i);
    }
  }
  return res;
}

int main(){
  while(cin>>P>>Q>>A>>N&&(P|Q|A|N)){
    proc(P,Q);
    int res=dfs(N,A,P,Q,1);
    cout<<res<<endl;
  }

  return 0;
}

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

using namespace std;

int main(){
    int k,n;

    cin >> k >> n;

    int a[n];

    for(auto& i:a)cin >> i;

    //0~1番目の距離→0
    int d[n];

    for(int i=0;i<n-1;i++){
        d[i]=a[i+1]-a[i];
    }

    d[n-1]=k-a[n-1]+a[0];

    sort(d,d+n);

    int ans = 0;

    for(int i=0;i<n-1;i++){
        ans += d[i];
    }

    cout << ans << endl;

    return 0;

}


Measured memory_bytes: 1792
use std::f64;
use std::cmp::min;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn gcd(a: i64, b: i64) -> i64 {
    let mut numa :i64 = 0;
    let mut numb :i64 = 0;

    if a < b {
        numa = b;
        numb = a;
    } else if b < a {
        numa = a;
        numb = b;
    } else {
        return a;
    }
    if numb == 0 {
        return numa;
    }
    return gcd(numb, numa % numb);
}

fn is_prime(n: i64) -> bool {
    if (n == 0) || (n == 1) {
        return false;
    }

    let max = (n as f64).sqrt() as i32;

    for i in 2..max+1 {
        if n % i as i64 == 0 {
            return false;
        }
    }

    return true;
}

fn main() {
    input!{
        a: i64,
        b: i64,
    }

    let gcdnum = gcd(a, b);
    let mut n = 0;

    //let max = (min(a, b) as f64).sqrt() as i64;
    let max = gcdnum;
    let mut tmax = max;
    if is_prime(gcdnum) {
        println!("2");
    } else {
    for i in 2..max+1 {
        if gcdnum % i == 0 {
            if is_prime(i) {
                n = n + 1;
            }
            tmax = max / i;
            if is_prime(tmax) && i < tmax {
                n = n + 1;
                break;
            }
        }
        if i > tmax {
            break;
        }
    }
    println!("{}", n+1);
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000007;
long long inv(long long p){
    long long x=1;
    for(int i=mod-2;i>0;i/=2){
        if(i%2)x=x*p%mod;
        p=p*p%mod;
    }
    return x;
}
int main(){
    int n;
    cin>>n;
    int a[n+1],x[n+1]={};
    long long side;
    for(int i=0;i<=n;i++){
        cin>>a[i];
        if(x[a[i]])side=n-i+x[a[i]]-1;
        else x[a[i]]=i+1;
    }
    long long all=n+1,dup=1;
    for(long long i=1;i<=n+1;i++){
        cout<<(all+mod-dup)%mod<<endl;
        all*=(n+1-i)%mod*inv(i+1)%mod;
        all%=mod;
        dup*=(side+1-i)%mod*inv(i)%mod;
        dup%=mod;
    }
    return 0;
}

Measured memory_bytes: 4292