akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

struct Status{
  std::string s;
  int pos_back;
};

Status Cipher(const std::string&,int);
Status String(const std::string&,int);
Status Letter(const std::string&,int);

Status Cipher(const std::string& s,int pos_front){
  Status result;
  for(int i=pos_front;i<s.size();i++){
    Status str_result=String(s,i);
    result.s+=str_result.s;
    result.pos_back=str_result.pos_back;
    i=result.pos_back;
    if(i+1<s.size()&&s[i+1]==']'){
      return result;
    }
  }
  return result;
}


Status String(const std::string& s,int pos_front){
  if(s[pos_front]=='['){
    Status cip_result=Cipher(s,pos_front+1);
    std::reverse(cip_result.s.begin(), cip_result.s.end());
    cip_result.pos_back++;
    return cip_result;

  }else{
    Status let_result=Letter(s,pos_front);
    return let_result;
  }
}

char IncrementChar(char c, int increment){
  increment%='Z'-'A'+1;
  c+=increment;
  if(c>'Z'){
    c-='Z'-'A'+1;
  }else if(c<'A'){
    c+='Z'-'A'+1;
  }
  return c;
}

Status Letter(const std::string& s,int pos_front){
  int increment=0;
  for(int i=pos_front;i<s.size();i++){
    if(s[i]=='+'){
      increment++;
    }else if(s[i]=='-'){
      increment--;
    }else{
      Status result;
      result.s=std::string{IncrementChar(s[i],increment)};
      result.pos_back=i;
      return result;
    }
  }
}

std::string Solve(std::string s){
  std::vector<std::string> result;
  bool found_hatena=false;
  for(int i=0;i<s.size();i++){
    if(s[i]=='?'){
      found_hatena=true;
      for(char c='A';c<='Z';c++){
        std::string replaced=s;
        replaced[i]=c;
        result.push_back(Solve(replaced));
      }
      break;
    }

  }
  if(!found_hatena){  result.push_back(Cipher(s,0).s);}


  std::sort(result.begin(), result.end());
  // cerr<<result.front()<<endl;
  return result.front();
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  while(1){
    std::string s;
    cin>>s;
    if(s=="."){
      break;
    }
    cout<<Solve(s)<<endl;
  }



  return 0;
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  int w,h,x,y; cin>>w>>h>>x>>y;
  double ans = (double)w*h/2.0;
  printf("%0.6f %d\n", ans, (w/2.0==(double)x&&h/2.0==(double)y));
}

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


Measured memory_bytes: 256
import java.text.DecimalFormat;
import java.util.*;

public class Main {
    public static void main(String[] args)  throws java.io.IOException{
        Scanner sc = new Scanner(System.in);
        while(true){
            int h = sc.nextInt();
            int w = sc.nextInt();
            if(h==0&&w==0){
                break;
            }
            String elem = "";
            for (int i=1;i<=w;i++){
                elem+="#";
            }
            for (int i = 1;i<=h;i++){
                System.out.println(elem);
            }
            System.out.println("");
        }
        sc.close();
    }
}

Measured memory_bytes: 21096
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<cmath>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n-1; 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(a, n) sort(a, a+n)
#define VSORT(v) sort(v.begin(), v.end())

using namespace std;

int main()
{
    long long x;

    cin >> x;

    long long coin = 100;
    long long i = 0;

    while(coin < x) {
        coin = (long long)(coin / 100.0 * 101.0);
        i += (long long)(1);
    }

    cout << i << endl;

    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>

int main(){
  double w;
  int f;
  
  while(scanf("%lf",&w)!=EOF){
    if(w<=48)f=1;
    else if(w<=51)f=2;
    else if(w<=54)f=3;
    else if(w<=57)f=4;
    else if(w<=60)f=5;
    else if(w<=64)f=6;
    else if(w<=69)f=7;
    else if(w<=75)f=8;
    else if(w<=81)f=9;
    else if(w<=91)f=10;
    else f=11;
    switch(f){
    case 1:printf("light fly\n");break;
    case 2:printf("fly\n");break;
    case 3:printf("bantam\n");break;
    case 4:printf("feather\n");break;
    case 5:printf("light\n");break;
    case 6:printf("light welter\n");break;
    case 7:printf("welter\n");break;
    case 8:printf("light middle\n");break;
    case 9:printf("middle\n");break;
    case 10:printf("light heavy\n");break;
    case 11:printf("heavy\n");break;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;

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

    while (true) {
        cin >> n;
        if (n == 0) {
            break;
        }

        int sum = 0;
        int points[n];

        for (int i = 0; i < n; i++) {
            cin >> points[i];
            sum += points[i];
        }

        double m = 1.0 * sum / n;
        double dist = 0.0;

        for (int i = 0; i < n; i++) {
            dist += (m - points[i]) * (m - points[i]);
        }

        double stdDeviation = sqrt(dist / n);
        printf("%lf\n", stdDeviation);
    }
}



Measured memory_bytes: 3220
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <bitset>
#include <functional>
#include <tuple>
#include <complex>

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;

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

const ll INF = 1.2e9; 

ll calc(const vector<ll> &a, ll b) {
    ll sum = 0;

    for (int i = 0; i < sz(a); ++i) {
        sum += abs(a[i] - (b + i));
    }

    return sum;
}

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

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout); 

    int n;
    cin >> n;
    vector<ll> a(n);

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

    ll lf = -INF, rg = INF;

    while (rg - lf > 2) {
        ll md1 = (2 * lf + rg) / 3;
        ll md2 = (lf + 2 * rg) / 3;

        if (calc(a, md1) < calc(a, md2)) {
            rg = md2;
        } else {
            lf = md1;
        }
    }

    ll res = calc(a, rg);
    for (int i = lf; i < rg; ++i) {
        res = min(res, calc(a, i));
    }

    cout << res << endl;



    
    return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
import sys, math, fractions, itertools, collections, copy, heapq

MOD = 2  # type: int

def solve(N: int, P: int, A: "List[int]"):
    if len([a for a in A if a % 2 == 0]) == N:
        if P == 0:
            print(int(2**N))
        else:
            print(0)
    else:
        print(int(2**(N-1)))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    P = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, P, A)

if __name__ == '__main__':
    main()


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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++){
        cin >> p[i];
        p[i]--;
    }


    int ans = 0;
    for(int i = 0; i< n-1; i++){
        if(p[i] == i) {
            swap(p[i], p[i+1]);
            ans++;
        }
    }
    if(p[n-1] == n-1) ans++;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef   long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI 3.1415926535

ve<ll> vec[100005];
bool vis[100005];
pair<ll,ll> dp[100005];

pair<ll,ll> dfs(ll n1)
{
    if(!vis[n1])
    {
        ll w=1,b=1;
        pair<ll,ll> x;
        x.first=0;
        x.second=0;
        vis[n1]=true;
        for(auto i=vec[n1].begin();i!=vec[n1].end();i++)
            if(!vis[*i])
            {
                x=dfs(*i);
                w=(w*(x.first+x.second))%A;
                b=(b*(x.first))%A;
            }
        dp[n1]={w,b};
    }
    return dp[n1];
}

int main() 
{
    FAST;
    ll n;
    cin>>n;
    ll x,y;
    for(int i=1;i<n;i++)
    {
        cin>>x>>y;
        vec[x].pb(y);
        vec[y].pb(x);
    }
    pair<ll,ll> xx=dfs(1);
    cout<<(xx.first+xx.second)%A;
    return 0;
}

Measured memory_bytes: 12928
a,b = gets.split(" ").map(&:to_i)

ab_s = ""
ba_s = ""

(1..b).each do |n|
  ab_s += a.to_s
end

(1..a).each do |n|
  ba_s += b.to_s
end

array = [ab_s,ba_s]
array = array.sort

puts array[0]

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int a,b;
  cin>>a>>b;
  int ans = 0;
  FOR(x,a,b+1){
    int y = 0;
    int t = x;
    REP(i,5){
      y *= 10; y += t%10; t /= 10;
    }
    if(x==y)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
i=0
cands=[]
count=0
while i<n-1:
    if lis[i]>=lis[i+1]:
        count+=1
    else:
        cands.append(count)
        count=0
    i+=1
cands.append(count)
#print(cands)
print(max(cands))
 


    
    



    
    


    
    

Measured memory_bytes: 20572
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int res = 0;
    for (int i = 0; i < N; i++) {
      int l = scanner.nextInt();
      int r = scanner.nextInt();
      res += r - l + 1;
    }
    System.out.println(res);
  }
}


Measured memory_bytes: 25808
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	s := getString()

	ans := len(s)
	for i := 1; i < len(s); i++ {
		if s[i] != s[i-1] {
			// out(i, i-1)
			ans = min(ans, max(i, len(s)-i))
		}
	}
	out(ans)
}


Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

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

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n,w;
    cin >> n >> w;
    vector<ll> z(n);
    vector<ll> x(n);
    vector<vector<ll>> dp(n + 1, vector<ll>(w + 1));
    for (int i = 0; i < n; i++) {
        cin >> z[i] >> x[i];
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < w+1; j++) {
            dp[i + 1][j] = dp[i][j];
        }
        for (int j = 0; j < w+1; j++) {
            if (z[i] + j > w)break;
            dp[i + 1][j + z[i]] = max(dp[i + 1][j + z[i]], dp[i][j] + x[i]);
        }
    }
    ll ans = 0;
    for (int j = 0; j < w + 1; j++) {
        ans = max(ans, dp[n][j]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 83184
import java.util.Scanner;

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        if( A >= 10 || B >= 10){
            System.out.println(-1);
        } else {
            System.out.println(A * B);
        }
    }
}


Measured memory_bytes: 22868
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit

@njit('(i4[:],)')
def solve(S):
    dp = np.zeros(2019, np.int64)
    pow10 = 1
    answer = 0
    for x in S[::-1]:
        dp[0] += 1
        x = x * pow10 % 2019
        newdp = np.zeros_like(dp)
        newdp[x:] += dp[:-x]
        newdp[:x] += dp[-x:]
        answer += newdp[0]
        pow10 *= 10
        pow10 %= 2019
        dp = newdp
    return answer


S = np.array(list(read().rstrip()), dtype=np.int32) - ord('0')
print(solve(S))


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

int main() {

  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if (ceil((double) C / B) <= ceil((double) A / D)) {
    cout << "Yes" << endl;
  } else{
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>a>>b;
    rep(i,2){
        if(a>=b){
            ans+=a;
            a--;
        }
        else{
            ans+=b;
            b--;
        }
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<climits>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<unordered_set>
#include<unordered_map>
#include<utility>
#include<algorithm>
#include<queue>
#include<stack> 
using namespace std;
#define ff              first
#define ss              second
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define si              set<int>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define sp(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(t)            int t; cin>>t; while(t--)
#define asc(i,a,n)      for (int i=a;i<n;i++)
#define dsc(i,a,n)      for (int i=n-1;i>=a;i--)
#define sz(x)           ((int)(x).size())
#define flg             if(flag==0)cout<<"Yes"<<endl;else{cout<<"No"<<endl;}
#define FLG             if(flag==0)cout<<"YES"<<endl;else{cout<<"NO"<<endl;}
#define input(arr,n)    for(int i=0; i<n ; i++) cin>>arr[i];
#define output(arr,n)   for(int i=0; i<n ; i++) cout<<arr[i]<<" ";
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"



int32_t main()
{

  long double a,b,c;
  cin>>a>>b;


  c=a*b;

 int ans = c;
  

  string an="";


  while(ans)
  {
    char digit = ans%10 +'0';


    ans=ans/10;

    an = digit + an;

  }

  if(an=="")
  {
    cout<<0<<endl;
    return 0;
  }

  cout<<an<<endl;







    


    








  


    return 0;
}





Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define INF 1e18
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
#define MAX 1000
#define ll long long
#define P pair<int,int>
const double PI=3.14159265358979323846;
using namespace std;
const int mod = 1000000007;
//char c[MAX][MAX];
int step[MAX][MAX];
int H,W,N; 
int vy[4] ={1,-1,0,0}, vx[4] = {0,0,-1,1}; //up,down,left,right 

signed main(){
    double a,b,h,m; cin >> a >> b >> h >> m;
    double gap = 360*(m/60) - (360*(h/12) + 30*(m/60));
    if(abs(gap) == 180){
        cout << a+b << endl;
        return 0;
    } 
    if(abs(gap) > 180) gap = 360 - abs(gap);
    else gap = abs(gap);
    //cout << "gap" << ":" << gap << endl;
    //cout << "naka" << 2*a*b*cos(gap/360*2*PI)<< endl;
    double k = a*a + b*b - 2*a*b*cos(gap/360*2*PI);
    //cout << k << endl;
    printf("%.16f",sqrt(k));
    return 0;
}

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

int n;
typedef pair<int, int> P;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n;
	vector<int> v[n+1];
	vector<string> w;
	w.push_back("");
	for(int i=1; i<=n; ++i){
		int k;
		cin >> k;
		v[k].push_back(i);
		string s;
		cin >> s;
		w.push_back(s);
	}
	bool f[n+1] = {};
//	for(int i=0; i<=n; ++i)
//		for(int j=0; j<v[i].size(); ++j)
//			cout << v[i][j] << (j+1 == v[i].size() ? "\n" : " ");
	stack<P> st;
	st.push(P(1, 0));
	while(!st.empty()){
		P t = st.top();
		st.pop();
		for(int i=0; i<v[t.first].size(); ++i)
			st.push(P(v[t.first][v[t.first].size()-i-1], t.second+1));
		f[t.first] = true;
		for(int i=0; i<t.second; ++i) cout << ".";
		cout << w[t.first] << "\n";
	}
}


Measured memory_bytes: 3412
char buf[2000000];
sz;
main()
{
	read(0,buf,2000000);
	int N=0;
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	int now=1;
	for(int i=0;i<N;i++)
	{
		int A=0;
		for(;;)
		{
			char k=buf[sz++];
			if(k<'0')break;
			A=A*10+k-'0';
		}
		if(A==now)now++;
	}
	printf("%d\n",now==1?-1:N-now+1);
}


Measured memory_bytes: 1536
#include <stdio.h>          // printf(), scanf()
#include <math.h>           // M_PI

int
main(int argc, char** argv)
{
	double r;

	scanf("%lf", &r);
	printf("%.5f %.5f\n", r * r * M_PI, 2 * r * M_PI);
	return 0;
}

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

int main() {
  int64_t n;
  cin>>n;
vector<int64_t> vec(n);
  for(int64_t i=0;i<n;i++){
  cin>>vec.at(i);
  }
  vector<int64_t> ans(n);
  ans.at(0)=vec.at(0);
  for(int64_t i=1;i<n;i++){ans.at(i)=max(ans.at(i-1),vec.at(i));}
  int64_t a;
  a=0;
  
  for(int64_t i=0;i<n;i++){a+=ans.at(i)-vec.at(i);}
  cout<<a<<endl;
  
}

Measured memory_bytes: 6420
/** coder Mohammad Al-Hussein *_^ */
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define mp make_pair
#define All(v) v.begin(),v.end()
#define mod  1000000007
#define write freopen("output.txt","w",stdout)
#define read freopen("test (1).txt","r",stdin)
#define FIO std::ios_base::sync_with_stdio(false);
using namespace std;
int a[105];
int main()
{
    int k,T;
    cin >> k >> T;
    for(int i=0;i<T;i++)
        cin >> a[i];
    sort(a,a+T);
    int sum = accumulate(a,a+T-1,0)+1;
    int mx = a[T-1];

    cout << max(mx - sum,0) << '\n';




    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int i, j, n;
  scanf("%d", &n);
  char s[n + 20];
  scanf("%s", s);
  for(i = 1; i < n; ++i) if(s[i] == 'x' && s[i - 1] == 'x') break;
  printf("%d\n", i);
  return 0;
}


Measured memory_bytes: 2848
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string>
using namespace std;

int main(){
	long long n, ans;
	cin >> n;
	ans = n;
	int i;
	for(i = n;i > 1;i--){
		if(n == 1){
			cout << n << endl;
		}
		else{
			ans = ans * (i - 1);
			
		}
	}
	cout << ans << endl;

	return 0;
}

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

int main()
{
  int a, b, c;
  cin >> a >> b;
  c = a + b;
  if(c % 2 == 0) {
    cout << c / 2 << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(void)
{
    int H, W, i, j, f;
    for (;;) {
        scanf("%d %d", &H, &W);
        if ((H|W) ==0) exit(0);
        for (i=1; i<=H; i++) {
            f = i % 2;
            for (j=1; j<=W; j++) {
                if (f==1) printf("#");
                else printf(".");
                f ^= 1;
            }
            printf("\n");
        }
        printf("\n");
    }
}




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

int main() {
  char c;
  cin >> c;
   if ((c =='a')||(c =='i')||(c =='u')||(c =='e')||(c =='o'))
   cout << "vowel" << endl;
   else
   cout << "consonant" << endl; 
 }
  

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;

void main(){
  auto N=readln.chomp.to!int;
  auto K=readln.chomp.to!int;
  auto X=readln.chomp.to!int;
  auto Y=readln.chomp.to!int;
  if(N>K)writeln(X*K+(N-K)*Y);
  else writeln(N*X);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
ll N, K, ans;
int main()
{
	cin >> N >> K;
	for (ll i = K; i <= N + 1; i++)
	{
		ans = (ans + i * (N - i + 2) - i + 1) % MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N, A, B;
    cin >> N >> A >> B;
    vc<ll> X(N);
    rep(i, N) cin >> X[i];

    ll ans = 0;
    repe(i,1,N){
        ll dx = X[i] - X[i - 1];
        ans += min(A * dx, B);
    }

    cout << ans << endl;
}

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

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

void solve(long long H, long long N, std::vector<long long> A){
    long long sum = 0;
    // REP(i, N) sum += A[i];
    sum = accumulate(A.begin(), A.end(), 0LL);
    if (sum >= H) cout << YES << '\n';
    else cout << NO << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long H;
    scanf("%lld",&H);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(H, N, std::move(A));
    return 0;
}


Measured memory_bytes: 1024
L = list(map(int, list(input())))
N = len(L)
mod = 10**9+7
dp = [[0]*(2) for _ in range(N+1)]
dp[0][0] = 1

for i in range(N):
    if L[i] == 0:
        dp[i+1][0] = dp[i][0]
        dp[i+1][1] = dp[i][1] * 3 % mod
    else:
        dp[i+1][0] = dp[i][0] * 2 % mod
        dp[i+1][1] = (dp[i][0] + dp[i][1] * 3) % mod

print((dp[N][0]+dp[N][1]) % mod)

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

int main() {
  int N, M;
  cin >> N >> M;
  int mx = (N == 1) ? 9 : (N == 2) ? 99 : 999;
  int mi = (N == 1) ? 0 : (N == 2) ? 10 : 100;
  vector<pair<int, int>> V(M);
  for (int i = 0, s, c; cin >> s >> c; i++) V.at(i) = {s, c};
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < M; j++) {
      if (V.at(i).first == V.at(j).first && V.at(i).second != V.at(j).second) return cout << -1 << "\n", 0;
    }
  }
  for (int i = mi; i <= mx; i++) {
    string tmp = to_string(i);
    for (int j = 0; j < M; j++) {
      if (tmp.at(V.at(j).first - 1) - '0' != V.at(j).second) goto NG;
    }
    return cout << i << "\n", 0;
    NG:;
  }
  cout << -1 << "\n";
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<int,int>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
int n;
cin>>n;
V<bool> used(n,false);
V<int> a(n);
for(int i=0;i<n;i++){
    cin>>a[i];a[i]--;
}
int cnt=0,now=0;
while(1){
    if(used[now])break;
    if(now==1){
        cout<<cnt<<endl;
        return 0;
    }
    used[now]=true;
    now=a[now];
    cnt++;
}
cout<<-1<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d,x;
  long long la,lb;
  double da,db;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> a >> b >> c;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------
ans = c;
  rep(i,0,10){
  	ans = a*ans - b;
    cout << ans << endl;
  }
  
  

}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <map>
#include <set>
#include <chrono>
#include <queue>
#include <string>
#include <cassert>
#include <bitset>
#include <stack> 

#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 1000000007
#define BASE 77747
#define PI acos(-1.0)
#define MAXLEN 29

using namespace std;

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

bool dp[100001];
int k;
int n;
int arr[100];

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++) scanf("%d", arr + i);
	dp[0] = false;
	for (int i = 1; i <= k; i++) {
		dp[i] = false;
		for (int j = 0; j < n; j++) {
			if (arr[j] > i) continue;
			if (!dp[i - arr[j]]) dp[i] = true;
		}
	}
	if (dp[k]) cout << "First" << endl;
	else cout << "Second" << endl;
	return 0;
}

Measured memory_bytes: 384
N=int(input())
p_list = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
p_c_list = [0 for i in range(len(p_list))]
for i in range(1,1+N):
    for j in range(len(p_list)):
        for k in range(1,8):
            if i%((p_list[j])**k)==0:
                p_c_list[j]+=1
            else:
                break
count=0
for i in range(len(p_list)):
    for j in range(i+1,len(p_list)):
        for k in range(j+1,len(p_list)):
            if min(p_c_list[i],p_c_list[j],p_c_list[k])>=2 and max(p_c_list[i],p_c_list[j],p_c_list[k])>=4:
                if (p_c_list[i]<4 and p_c_list[j]<4) or (p_c_list[k]<4 and p_c_list[j]<4) or (p_c_list[i]<4 and p_c_list[k]<4):
                    count+=0
                elif p_c_list[i]<4 or p_c_list[j] < 4 or p_c_list[k] < 4:
                    count+=1
                else:
                    count+=3

for i in range(len(p_list)):
    if p_c_list[i]>=74:
        count+=1

for i in range(len(p_list)):
    for j in range(i+1,len(p_list)):
        if max(p_c_list[i],p_c_list[j])>=24 and min(p_c_list[i],p_c_list[j])>=2:
            if p_c_list[i]>=24 and p_c_list[j]>=24:
                count+=2
            else:
                count+=1
        if max(p_c_list[i],p_c_list[j])>=14 and min(p_c_list[i],p_c_list[j])>=4:
            if p_c_list[i]>=14 and p_c_list[j]>=14:
                count+=2
            else:
                count+=1        
        
print(count)

Measured memory_bytes: 3192
#include<iostream>
#include<string>

using namespace std;

int main(){

    int n;
    string s;
    cin >>n >> s;
    for(int i=0;i<s.length();i++){
        cout << char((int(s[i])-int('A')+n)%26 + int('A')) << (i==s.length()-1?"\n": "");
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdint.h>
int main(void) {
        int64_t n;
        int64_t tp[5];
        scanf("%ld", &n);
        for (int i=0;i<5;i++) scanf("%ld", &tp[i]);
        int64_t tpmin = tp[0];
        int tpindex = 0;
        for (int i=0;i<5;i++) {
                if (tp[i]<tpmin) {
                        tpmin = tp[i];
                        tpindex = i;
                }
        }
        int64_t mov = 0;
        mov += (n/tpmin)+((n%tpmin)?1:0)-1+5;
        printf("%ld\n",mov);
        return 0;
}

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

vector<pair<ll,ll>> prime_factorize(ll N){
    vector<pair<ll,ll>> ret;
    for(ll a = 2; a * a <= N; a++){
        if(N % a != 0) continue;
        ll ex = 0;
        while(N % a == 0){
            ex++;
            N /= a;
        }
        ret.push_back({a, ex});
    }
    if(N != 1) ret.push_back({N, 1});
    return ret;
}

int main(){
    ll N, P;
    cin >> N >> P;
    auto R = prime_factorize(P);
    ll ans = 1;
    for(auto r : R){
        while(r.second >= N){
            ans *= r.first;
            r.second -= N;
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
const int MOD = (1e9 + 7);
struct Combi
{
	vector<int> fact;
	vector<int> ifact;
	vector<int> inv;
	vector<int> pow2;
	const int MOD = (1e9 + 7);
	int add(int a, int b)
	{
		a+=b;
		while(a>=MOD) a-=MOD;
		return a;
	}
	int mult(int a, int b)
	{
		return (a*1LL*b)%MOD;
	}
	int modpow(int a, int b)
	{
		int r=1;
		while(b)
		{
			if(b&1) r=mult(r,a);
			a=mult(a,a);
			b>>=1;
		}
		return r;
	}
	int choose(int a, int b)
	{
		if(a<b) return 0;
		if(b==0) return 1;
		if(a==b) return 1;
		return mult(fact[a],mult(ifact[b],ifact[a-b]));
	}
	int inverse(int a)
	{
		return modpow(a,MOD-2);
	}
	void init(int _n)
	{
		fact.clear(); ifact.clear(); inv.clear(); pow2.clear();
		fact.resize(_n+1);
		ifact.resize(_n+1);
		inv.resize(_n+1);
		pow2.resize(_n+1);
		pow2[0]=1;
		ifact[0]=1;
		fact[0]=1;
		for(int i=1;i<=_n;i++)
		{
			pow2[i]=add(pow2[i-1],pow2[i-1]);
			fact[i]=mult(fact[i-1],i);
			//ifact[i]=mult(ifact[i-1],inv[i]);
		}
		ifact[_n] = inverse(fact[_n]);
		for(int i=_n-1;i>=1;i--)
		{
		    ifact[i] = mult(ifact[i + 1], i + 1);
		}
		for(int i=1;i<=_n;i++)
		{
		    inv[i] = mult(fact[i-1],ifact[i]);
		}
	}
};

int dp[3011][3011][2];
Combi combi;

void add(int &a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	combi.init(3111);
	ll n, m; cin>>n>>m;
	for(int i=0;i<=n;i++) 
	{
		dp[0][i][i==0] = 1;
	}
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<=n;j++)
		{
			for(int k=0;k<2;k++)
			{
				int v=dp[i][j][k];
				//cerr<<i<<' '<<j<<' '<<k<<' '<<v<<'\n';
				if(v==0) continue;
				//RR
				if(j>=1)
				{
					add(dp[i+1][j-1][k|(j-1==0)],v);
				}
				//BB
				if(j+1<=n)
				{
					add(dp[i+1][j+1][k|(j==0)],v);
				}
				//RB
				if(j-1>=0)
				{
					add(dp[i+1][j][k|(j-1==0)],v);
				}
				//BR
				if(j+1<=n)
				{
					add(dp[i+1][j][k|(j==0)],v);
				}
			}
		}
	}
	int ans=0;
	for(int i=0;i<=n;i++)
	{
		add(ans,dp[m][i][1]);
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 70912
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int N;
    cin >> N;
    int res = 1;
    while (1) {
        if (res * 2 <= N) {
            res *= 2;
        } else {
            break;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-8
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define MOD 100000
typedef long long ll;
typedef pair < int , int > Pii;
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	rep(i,m){
		int a,b;
		scanf("%d%d",&a,&b);
		//printf("---%d---\n",n/2);
		if(n%2 == 1){
			if(a > n/2+1)a=(n/2+1)-(a-(n/2+1));
			if(b > n/2+1)b=(n/2+1)-(b-(n/2+1));
		}
		else{
			if(a > n/2)a=(n/2) - (a-n/2)+1;
			if(b > n/2)b=(n/2) - (b-n/2)+1;
		}
		//printf("a = %d b = %d\n",a,b);
		int x = min(a,b);
		printf("%d\n",x%3==0?3:x%3);
	}
	return 0;
}

Measured memory_bytes: 1188
#include<iostream>
#include<cstdio>

#include<vector>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
const int INF = 1e9+1;
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;}

int main() {
    ll X, Y;
    cin >> X >> Y;
    ll count = 1;
    while (X * 2 <= Y) {
        X *= 2;
        count++;
    }
    cout << count << endl;

}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        a,b,c = LI()
        if a == 0:
            break
        r = inf
        x = inf
        y = inf
        for i in range(c*5):
            t = a * i
            if t < c and (c - t) % b == 0:
                tr = c
                tx = i
                ty = (c-t) // b
                if x+y > tx+ty or (x+y==tx+ty and r > tr):
                    r = tr
                    x = tx
                    y = ty

            if  t >= c and (t-c) % b == 0:
                tr = t - c + t
                tx = i
                ty = (t-c) // b
                if x+y > tx+ty or (x+y==tx+ty and r > tr):
                    r = tr
                    x = tx
                    y = ty

            if (t+c) % b == 0:
                tr = t + c + t
                tx = i
                ty = (t+c) // b
                if x+y > tx+ty or (x+y==tx+ty and r > tr):
                    r = tr
                    x = tx
                    y = ty

        rr.append('{} {}'.format(x,y))

    return '\n'.join(map(str,rr))


print(main())




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

using namespace std;
using ll = unsigned long long;
constexpr int mod = 1e9+7;
constexpr int md = mod;
int main(){
    int a,b;
    cin>>a>>b;
    cout << max(a+b,max(2*a-1,2*b-1)) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
 
using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU 
typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);
 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vi coin({25, 10, 5, 1});
    int ans = 0;
    REP(i, 4) {
        while (coin[i] <= N) {
            N -= coin[i];
            ans++;
        }
    }
    cout << ans << endl;
    PAU;
    return 0;
}


Measured memory_bytes: 3208
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	int n;
	cin >> n;

	vector<int> a;

	int cnt = 0;
	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		for (; ; x /= 2)
		{
			if (x % 2 == 1)
			{
				break;
			}
			cnt++;
		}
	}

	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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;
}

int main(void) {
    ll X;
    cin >> X;

    vector<ll> origs;
    vector<ll> elems;
    ll x = 1;
    origs.push_back(0);
    elems.push_back(0);
    origs.push_back(1);
    elems.push_back(1);
    ll prev = 1;
    while (1) {
        x += 1;
        ll pows = x * x * x * x * x;
        // if (x * x * x * x * x > X) {
        //     break;
        // }
        if (pows - prev > X) {
            break;
        }
        origs.push_back(x);
        elems.push_back(pows);
        prev = pows;
    }

    // for (int i = 0; i < (int) elems.size(); i++) {
    //     cout << elems[i] << endl;
    // }

    for (int i = 0; i < (int) elems.size(); i++) {
        for (int j = 0; j < (int) elems.size(); j++) {
            ll a = elems[i];
            ll b = elems[j];
            if (a + b == X) {
                printf("%lld %lld\n", origs[i], -1 * origs[j]);
                return 0;
            } else if (a - b == X) {
                printf("%lld %lld\n", origs[i], origs[j]);
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3716
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

char s[maxn][maxn];

const int kx[4]={0,0,1,-1};
const int ky[4]={1,-1,0,0};

queue <int> qx,qy;
int d[maxn][maxn],n,m;

int main()
{
	n=read(); m=read(); rep(i,1,n) scanf("%s",s[i]+1);
	rep(i,1,n) rep(j,1,m) d[i][j]=inf;
	rep(i,1,n) rep(j,1,m) if(s[i][j]=='#') qx.push(i),qy.push(j),d[i][j]=0;
	while(!qx.empty())
	{
		int x=qx.front(),y=qy.front(); qx.pop(); qy.pop();
		rep(k,0,3)
		{
			int tx=x+kx[k],ty=y+ky[k];
			if(tx<=0||tx>n||ty<=0||ty>m) continue;
			if(d[tx][ty]!=inf) continue;
			d[tx][ty]=d[x][y]+1; qx.push(tx); qy.push(ty);
		}
	}
	int ans=0;
	rep(i,1,n) rep(j,1,m) ans=max(ans,d[i][j]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 16348
#include <iostream> // cout, endl, cin
#include <vector> // vector
using namespace std;

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

	vector <int> p(N);

	for (int i = 0; i < N; i++) {
		cin >> p[i];
	}

	int tmp;
	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			if (p[j] < p[i]) {
				tmp = p[i];
				p[i] = p[j];
				p[j] = tmp;
			}
		}
	}

	int sum = 0;

	for (int i = 0; i < K; i++) {
		sum += p[i];
	}


	cout << sum << endl;
}


Measured memory_bytes: 3192