akhauriyash/Code-Regression huggingface dataset:
A, B, C = map(int, input().split())
K = int(input())

for _ in range(K):
    if A >= B:
        B *= 2
    elif B >= C:
        C *= 2
    else:
        C *= 2

if (B > A) and (C > B):
    print ('Yes')
else:
    print ('No')

Measured memory_bytes: 9120
#include <iostream>

int main()
{
	int n, same_color_count = 0;
	std::cin >> n;

	char last_ch, before_ch;
	std::cin >> before_ch;

	for (int i = 0; i < n-1; i++) {
		std::cin >> last_ch;
		same_color_count += last_ch == before_ch ? 1 : 0;
		before_ch = last_ch;
	}

	std::cout << n - same_color_count;
}

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

// Library

//
int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int a, b, c;
    cin >> a >> b >> c;
    int ans = a * b / 2;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int n,k,i,a=1,b=0;
	scanf("%d%d",&n,&k);
	for(i=1; i<=n; i++){
		a=a*2;	b=b+1;
		if(a>k){
			break;
		}
	}
	printf("%d\n",a+(n-b)*k);
	return 0;
}

Measured memory_bytes: 128
temp=input().split()
N=int(temp[0])
A=int(temp[1])
B=int(temp[2])

big=A+B*(N-1)
small=A*(N-1)+B

if(big<small):
	print(0)
elif(N==1 and big!=small):
	print(0)
else:
	print(big-small+1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
#define fastio1 ios_base::sync_with_stdio(false)
#define fastio2 cin.tie(NULL)
#define LL long long
#define MOD 1000000007
using namespace std;
 
int main(){
    fastio1; fastio2;
	LL n, k; cin >> n >> k;
	vector<LL> a(n);
	int tracker[42] = {0};
	
	for (int i = 0; i < n; i++){
		cin >> a[i];
		LL temp = a[i];
		int b = 1;
		while(temp > 0){
			tracker[42-b] += temp % 2;
			temp /= 2;
			b++;
		}
	}
	
	LL x = 0;
	for (int i = 0; i < 42;i++){
		if (x + (tracker[i] < n-tracker[i])*(1LL<<(41-i)) <= k){
			x += (tracker[i] < n-tracker[i])*(1LL<<(41-i));
		}
	} 
	
	LL total = 0;
	for (int i = 0; i < n; i++){
		total += x^a[i];
	}
	cout << total << endl;
}

Measured memory_bytes: 1024
h,w = map(int,input().split())
l = []
for i in range(h):
    l.append([x for x in input()])

for i in range(h-1,-1,-1):
    if "#" not in l[i]:
        del l[i]
z = list(zip(*l))

for i in range(len(z)-1,-1,-1):
    if "#" not in z[i]:
        for j in range(len(l)):
            del l[j][i]
            
for i in range(len(l)):
    print("".join(l[i]))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int n,m;cin>>n>>m;
	vector<int> a(n);
	int sum = 0;
	for(int i = 0; i < n; i++) {
		cin>>a[i];
		sum += a[i];
	}
	sort(ALL(a),greater<int>());
	for(int i = 0; i < m; i++) {
		if(a[i] >= (sum + 4 * m - 1) / (4 * m)){
			continue;
		}
		cout << "No" << endl;
		return  0;
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    #a,b=list(map(int,input().split()))
    pi=3.141592653589793
    r=float(input())
    print(r*r*pi,r*2*pi)
main()



Measured memory_bytes: 5592
#include<iostream>
#include<atcoder/all>
using namespace std;
typedef long long li;
#define MOD 998244353
#define binom2(n) ((n)*(n-1)/2)
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

struct modint{
  li num;

  modint(li a=0){
    num=(a%MOD+MOD)%MOD;
  }
  modint operator+(modint a) {return{(num+a.num)%MOD};} 
  modint operator-(modint a) {return{((num-a.num)%MOD+MOD)%MOD};}
  modint operator*(modint a) {return{num*a.num%MOD};}
  modint inv(const modint& a);
  modint operator/(modint a) {return (*this)*inv(a);}
  modint& operator+=(modint a) {
    (num += a.num)%=MOD;
    return *this;
  }
  modint& operator*=(modint a) {
    (num*=a.num)%=MOD;
    return *this;
  }
};

std::ostream& operator<<(std::ostream& os, const modint& m){
  // ここでストリームに obj を書き込みます。
  li a=m.num;
  a%=MOD;
  a+=MOD;
  a%=MOD;
  cout << a;
  return os;
}

std::istream& operator>>(std::istream& os,modint& m){
  // ここでストリームに obj を書き込みます。
  li a; cin >>a;
  m=a;
  return os;
}
// modint inv(modint a){
//     // unordered_map 必須 O(1)
//     static unordered_map<li,modint> f;
//     f[1]=1;
//     if(f.find(a.num)!=f.end())return f[a.num];
//     modint m=MOD%a.num;
//     return f[a.num]=(modint)(MOD/a.num*(-1))*inv(m);
// }


modint pow(modint a,int r){
  modint b=a,ans=1;
  while(r){
    if(r%2) ans*=b;
    b*=b;
    r/=2;
  }
  return ans;
}

int n;

vector<modint> p;


modint inv(modint a){
  // MOD: prime
  return pow(a,MOD-2);
}

modint i9=inv((modint)9);


struct mono{
  modint v;
  int len;
  mono(modint x=0,li l=0){ v=x; len=l;};
  mono operator*(mono m){ return {(m.v*p[len]+v),len+m.len}; };
};
mono e(){return mono();}
mono op(mono m1, mono m2){ return m1*m2; }

std::ostream& operator<<(std::ostream& os, const mono& m){
  // ここでストリームに obj を書き込みます。
  cout << m.v ;
  return os;
}


struct gr{
  int val;
  gr(int x=0){ val=x; };
  gr operator*(gr g){ if(val==0) return g.val; else return val; };
  mono operator*(mono m){
    if(val==0) return m;
    modint a=(p[m.len]-1)*i9;
    return {a*val,m.len};
  };
};
mono sayo(gr g,mono m){ return g*m; }
gr comp(gr a,gr b){return a*b;}
gr id(){return gr();}



int main(){
  int q; cin >>n >>q;
  //  mono operator*(mono m){ return {(v*pow(10,m.len)+m.v),len+m.len}; };
  p.resize(n,1);
  rep(i,n){
    p[i+1]=p[i]*10;
  }
  vector<mono> v(n,{1,1});
  atcoder::lazy_segtree<mono,op,e,gr,sayo,comp,id> lz(v);
  if(df)print(lz.all_prod());
  gr g=3; mono m={11324,5},m2={23,2};
  
  if(df){
    print(m*m2);
    print(g*m,g*m2);
    print(g*(m*m2));
  }
  rep(_,q){
    int t,r,l; cin >>r >>l >>t ; r=n-r+1; l=n-l;
    if(df)print(l,r);
    lz.apply(l,r,t);
    print(lz.all_prod());
    if(df){
      rep(i,n){
        cout << lz.get(i);
      } print("");
      print(lz.all_prod());
    }
    
  }
  
  
}


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

using namespace std;

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

    string S; cin>>S;
    if (S == "Sunny") {
      cout << "Cloudy" << endl;
    } else if (S == "Cloudy") {
      cout << "Rainy" << endl;
    } else {
      cout << "Sunny" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <deque>
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
//#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


const ll MOD=1e9+7;
const int N=500000;

ll gcd(ll x,ll y){
    if(x) return gcd(y%x,x);
    else return y;
}

main(){
    string s;
    cin>>s;
    int ans=(s.size())/2;
    rep(i,s.size()/2){
        if(s[i]==s[s.size()-1-i])ans--;
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/irange.hpp>
#include <cmath>
#include <map>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
namespace mp = boost::multiprecision;
typedef long long ll;
const ll M = 1000000007;

int main(){
	int h, w, n;
	cin >> h >> w >> n;

	int tmp = max(h, w);
	if (n % tmp == 0) {
		cout << n / tmp;
		return 0;
	}

	cout << (n / tmp) + 1;
	return 0;
}


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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	string s[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>s[i];
		sort(s[i].begin(), s[i].end());
	}
	sort(s,s+n);
	long long ans=0;
	for (int i = 0; i < n-1; ++i)
	{
		if (s[i]==s[i+1])
		{
			int cnt=2;
			++i;
			while (i<n-1&&s[i]==s[i+1])
			{
				++cnt;
				++i;
			}
			ans+=(long long)cnt*(cnt-1LL)/2LL;
			cnt=0;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 7296
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	X := sc.nextInt()
	c1 := X / 500
	X = X % 500
	c2 := X / 5

	fmt.Fprintln(wtr, c1*1000+c2*5)
}


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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"

int main(){
    int n;string s;
    cin >> n >> s;
    int count_r=0,count_w=0;
    REP(i,n){
        if(s[i]=='R')count_r++;
        else count_w++;
    }
    int count_r2=count_r;
    REP(i,count_r){
        if(s[i]=='R'){
            count_r2--;
        }
    }
    COUT(min({count_r,count_w,count_r2}));
}

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

int main()
{
  int a[6] = {1, 5, 10, 50, 100, 500};
  int n;

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

  if (sum >= 1000){
    cout << 1 << endl;
    return 0;
  }
  cout << 0 << endl;

  return 0;
}

Measured memory_bytes: 1160
#from line_profiler import LineProfiler
 
N, K = map(int, input().split())
mod = 10**9 + 7
def main():
  b = N
  blis = []
  c = 0
  while b >0:
    if b & 1 == 1:
      blis.append(c)
    c += 1
    b >>= 1


  def modpow(a, blis= blis, c = c):
    if a == 1:
      return 1
    else:
      res = 1
      li = []
      for _ in range(c):
        li.append(a%mod)
        a = a*a%mod
      for item in blis:
        res = res *li[item] %mod
      return res

    
  fact_count = [0 for _ in range(K+1)]
  for k in range(1, K+1):
    fact_count[k] = K//k

  ans = 0
  count = [0 for _ in range(K+1)]
  for k in range(K, 0, -1):
    x = 1*fact_count[k]
    cc = modpow(x)
    j = 2*k
    l = 2
    while(j<=K):
      cc -= count[j]
      l += 1
      j = k*l
    count[k] = cc
    cc = cc*k%mod
    ans += cc
    ans %= mod
  print(ans)
if __name__ == '__main__':
  main()
#prof = LineProfiler()
#prof.add_function(main)
#prof.runcall(main)
#prof.print_stats()


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

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>

using namespace std;
typedef long long ll;

int H, W;
static const int MAX = 400;
vector<string> S;
ll ans = 0;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
ll b = 0, w = 0;
vector<vector<bool> > visited(MAX, vector<bool>(MAX, false));

void dfs(int row, int column, bool black) {
    int n_row, n_column;
    if (black) {
        for (int i = 0; i < 4; i++) {
            n_row = row + dx[i];
            n_column = column + dy[i];
            if (0 <= n_row and n_row < H  and 0 <= n_column and n_column < W ) {
                if (visited[n_row][n_column] == false and S[n_row][n_column] == '.') {
                    visited[n_row][n_column] = true;
                    b += 1;
                    dfs(n_row, n_column, false);
                }
            }
        }
    }
    
    else {
        for (int i = 0; i < 4; i++) {
            n_row = row + dx[i];
            n_column = column + dy[i];
            if (0 <= n_row and n_row < H  and 0 <= n_column and n_column < W ) {
                if (visited[n_row][n_column] == false and S[n_row][n_column] == '#') {
                    visited[n_row][n_column] = true;
                    w += 1;
                    dfs(n_row, n_column, true);
                }
            }
        }
    }
}

int main() {

    cin >> H >> W;

    string s;
    for (int i = 0; i < H; i++) {
        cin >> s;
        S.push_back(s);
    }
    
    vector<int> black_row, black_column;
    for (int row = 0; row < H; row++) {
        for (int column = 0; column < W; column++) {
            if (S[row][column] == '#') {
                black_row.push_back(row);
                black_column.push_back(column);
            }
        }
    }

    for (int i = 0; i < black_row.size(); i++) {
        b = 0, w = 0;
        dfs(black_row[i], black_column[i], true);
        ans += b * w;
    }

    cout << ans << '\n';
}


Measured memory_bytes: 18764
// https://atcoder.jp/contests/abc149/tasks/abc149_a
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(size_t i = 0; i < (n); ++i)

int main()
{
    string S, T;
    cin >> S >> T;
    T.insert(T.end(), S.begin(), S.end());
    cout << T << endl;
    return 0;
}


Measured memory_bytes: 3576
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        long n = scanner.nextLong();
        long A = scanner.nextLong();
        long B = scanner.nextLong();
 
        long s = n / (A + B);
        long t = n % (A + B);
        long count = 0;
 
        count = s * A;
        if(t >= A){
            count += A;
        }else{
            count += t;
        }
        System.out.println(count);
        
	}
}


Measured memory_bytes: 35736
n, m = list(map(int, input().split(' ')))
aabb = []

for i in range(n):
    a, b = list(map(int, input().split(' ')))
    aabb.append((a, b))
aabb = sorted(aabb)
ans = 0
for (a, b) in aabb:
    hoge = min(m, b)
    ans += a * hoge
    m -= hoge
    if not m:
        break
print(ans)

Measured memory_bytes: 17752
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));

  $z=0;
  for ($i=0; $i<$n; $i++) {
    list($a,$b) = explode(" ", trim(fgets(STDIN)));
    if($a==$b){
      $z++;
      if($z==3){
        echo "Yes";
        exit;
      }
    }else{
      $z=0;
    }
  }
  echo "No";


Measured memory_bytes: 16180
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;

int main(){
    int a[3];
    string ans = "No";
    for (int i = 0; i < 3; i++) {
        cin >> a[i];
    }
    sort(a,a+3);
    if(a[0] + a[1] == a[2]) ans = "Yes";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/*
g++ -ggdb -fsanitize=address -std=c++14 E.cpp && ./a.out <<< "1 2 2 2 1
2 4
5 1
3"
*/

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = a; i < (b); i++)
#define trav(a, x) for (auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename A>
string to_string(A v) { int cnt = 0; string res; for (const auto &x : v) { if (cnt++) res += " "; res += to_string(x); } return "[" + res + "]"; }
string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);

    int X, Y, A, B, C; cin >> X >> Y >> A >> B >> C;
    vi CostA(A); rep(i, 0, A) cin >> CostA[i];
    vi CostB(B); rep(i, 0, B) cin >> CostB[i];
    vi CostC(C); rep(i, 0, C) cin >> CostC[i];

    sort(all(CostA), [&](int a, int b){ return a > b; });
    sort(all(CostB), [&](int a, int b){ return a > b; });
    sort(all(CostC), [&](int a, int b){ return a > b; });

    vector<int> RG;
    rep(i, 0, X) RG.push_back(CostA[i]);
    rep(i, 0, Y) RG.push_back(CostB[i]);
    sort(all(RG), [&](int a, int b){ return a > b; });

    vector<ll> PreRG(sz(RG) + 1);   // PreRG[i] = sum(RG[0..i))
    PreRG[0] = 0;
    for (int i = 1; i <= sz(RG); i++)
        PreRG[i] = PreRG[i - 1] + RG[i - 1];

// debug(CostA);
// debug(CostB);
// debug(CostC);
// debug(RG);
// debug(PreRG);

    ll ans = 0;
    ll sumC = 0;
    for (int c = 0; c <= C; c++) {
        int take = X + Y - c;
        if (take < 0 || take >= sz(PreRG)) continue;

        ll cand = sumC + PreRG[take];

// debug(c, sumC, cand);

        ans = max(ans, cand);

        if (c < C)
            sumC += CostC[c];
    }

    cout << ans << endl;
}

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// テーブルを作る前処理
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        ll num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

vector<int> enum_div(int n)
{
	std::vector<int> ret;
	for(int i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

int n;
ll dp[100005][13];

int main(){
    string s;
    cin >> s;

    dp[0][0] = 1;
    for (int i = 0; i < s.size(); i++) {
        int c;
        if (s[i] == '?') c = -1;
        else c = s[i] - '0';

        for (int j = 0; j < 10; j++) {
            if (c != -1 && c != j) continue;
            for (int ki = 0; ki < 13; ki++) {
                dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki];
            }
        }
        for (int j = 0; j < 13; j++) dp[i + 1][j] %= MOD;
    }

    pl(dp[s.size()][5])

    return 0;    
}


Measured memory_bytes: 10752
# ABC049C 白昼夢/Daydream
s = input()[::-1]
flag = True
pivot = 0
while pivot<len(s):
	if s[pivot]=='m':				# dream
		t = s[pivot:pivot+5]
		if t=='maerd':
			pivot += 5
		else:
			flag = False
			break
	elif s[pivot]=='e':			# erase
		t = s[pivot:pivot+5]
		if t=='esare':
			pivot += 5
		else:
			flag = False
			break
	elif s[pivot]=='r':
		if s[pivot+2]=='m':		# dreamer
			t = s[pivot:pivot+7]
			if t=='remaerd':
				pivot += 7
			else:
				flag = False
				break
		elif s[pivot+2]=='s':	# eraser
			t = s[pivot:pivot+6]
			if t=='resare':
				pivot += 6
			else:
				flag = False
				break
		else:
			flag = False
			break
	else:
		flag = False
		break
print('YES' if flag else 'NO')


Measured memory_bytes: 3188
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
using VB = vector<bool>;
using VVB = vector<VB>;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
	//i=m -> n-1(昇順)
#define RREP(i,m,n) for(int i=(m);i>=(n);i--)
	//i=m -> n(降順)

int main(){
  int n;
  cin >> n;
  VI h(n),dp(n+10,100000000);
  REP(i,0,n){
    cin >> h[i];
  }
  dp[0]=0;
  dp[1]=abs(h[1]-h[0]);
  
  REP(i,2,n){
    int cost_1 = abs(h[i]-h[i-1]);
    int cost_2 = abs(h[i]-h[i-2]);
    dp[i] = min(dp[i-1]+cost_1, dp[i-2]+cost_2);
  }
    
  
  cout << dp[n-1] << endl;
  
  return 0;
}


Measured memory_bytes: 4032
// 10/06/19 // 10:03 AM //

#include <iostream>
#include <cmath>
#include <cstring>

using namespace std;

#define MAXN 100010

int n;
int h[MAXN];
int memo[MAXN];

int funcao(int i){
    if(memo[i]>=0) return memo[i];

    if(i>=n) return 0;

    if(i==n-1)
        return memo[i] = abs(h[i]-h[i+1])+funcao(i+1);

    return memo[i] = min(abs(h[i]-h[i+1])+funcao(i+1),abs(h[i]-h[i+2]) + funcao(i+2));
}

int main(){

    memset(memo, -1, sizeof(memo));

    cin >> n;

    for(int i=1; i<=n; i++) cin >> h[i];

    cout << funcao(1) << "\n";

    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(){
	int  x, y; 
	
	while (1)
	{
		cin >> x >> y;
		if (x == 0 &&y == 0)break;
		if (x>y)
		{
			cout << y << " " << x << endl;
		}
		else { cout << x << " " << y << endl; }
	}
}



Measured memory_bytes: 3020
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

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

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  ll N, X;
  cin >> N >> X;
  vll x(N);
  rep(i, N) cin >> x[i];
  
  if(N == 1) {
    fin(abs(x[0] - X));
    return 0;
  }
  
  rep(i, N) {
    x[i] = abs(x[i] - X);
  }
  
  ll gc = x[0];
  for(int i=1; i<N; i++) {
    gc = gcd(gc, x[i]);
  }
  
  fin(gc);
  return 0;
}

Measured memory_bytes: 1024
/// --- In the name of ALLAH --- ///


//#include <cmath>
#include<bits/stdc++.h>
//#include<iostream>
using namespace std;


typedef long long              ll;
typedef vector<int>            vi;
typedef vector<ll>             vl;
typedef vector<vi>             vvi;
typedef vector<vl>             vvl;
typedef pair<int,int>          pii;
typedef pair<double, double>   pdd;
typedef pair<ll, ll>           pll;
typedef vector<pii>            vii;
typedef vector<pll>            vll;
typedef double                 dl;

#define endl                   '\n'
#define PB                     push_back
#define F                      first
#define S                      second
#define all(a)                 (a).begin(),(a).end()
#define rall(a)                (a).rbegin(),(a).rend()
#define sz(x)                  (ll)x.size()
#define wt                     ll t; cin>>t; while(t--)
#define input(a,n)             for(int i=0;i<n;i++) cin>>a[i];

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;


#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))
#define mod 10000007
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }


const ll mx=1e9;




int main()
{
    optimize();

    int n,i,j=0;
    cin>>n;
    int a[n+1],b[n+1],c[n+1];
    for(i=1;i<=n;i++)
        cin>>a[i];

    for(i=1;i<=n;i++)
        cin>>b[i];

    for(i=1;i<=n;i++)
        {
            c[i]=a[i]-b[i];
        }
    sort(c+1,c+n+1,greater<int>());
    for(i=1;i<=n;i++)
        {
            if(c[i]>0)
                j=j+c[i];
        }
       // if(j==0)
            //j=j+c[1];
    cout<<j<<endl;










    return 0;
}






























































































Measured memory_bytes: 3588
#!/usr/bin/env python3
import sys
from collections import deque

YES = "Yes"  # type: str

class Room:
    def __init__(self,index):
        self.index = index
        self.nPath = -1
        self.refs = []

    def connect(self,ref):
        self.refs.append(ref)
        ref.refs.append(self)

    def recSolve(self,queue):
        for r in self.refs:
            if r.nPath == -1:
                queue.append()

    def __str__(self):
        c = ""
        for r in self.refs:
            c += f"{r.index},"
        return f"{self.index}->{c} ({self.nPath})"

def solve(N: int, M: int, A: "List[int]", B: "List[int]"):
    rooms = [Room(i) for i in range(N)]
    for j in range(M):
        rooms[A[j]-1].connect(rooms[B[j]-1])
    current = deque()
    current.append((rooms[0],0))
    while len(current) > 0:
        next = deque()
        for r in current:
            if r[0].nPath == -1:
                r[0].nPath = r[1]
                for k in r[0].refs:
                    if k.nPath == -1:
                        next.append((k,r[0].index))
        current = next
    # for r in rooms:
    #     print(r)
    print(YES)
    for r in rooms[1:]:
        print(r.nPath+1)
    return


# Generated by 1.1.7.1 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
    M = int(next(tokens))  # type: int
    A = [int()] * (M)  # type: "List[int]"
    B = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, M, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 106468
#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<utility>
#include<cctype>
using namespace std;

#define ull unsigned long long
#define stt(it,order) sort(it.begin(),it.end(),order)
#define STT(it,n,order) sort(it,it+n,order)
#define st(it) sort(it.begin(),it.end())
#define ST(it,n) sort(it,it+n)
#define ll long long
#define rep(i,j) for(int i=0;i<j;++i)
#define loop(i,a,j) for(int i=a;i<j;++i)
#define mpi(it,table,T,E) for(map<T,E>::iterator it = table.begin();it!=table.end();++it)
#define PI 3.141592654
#define pb(v,e) v.push_back(e)
#define ms(a,v) memset(a,v,sizeof(a))
#define cp(a,b,n) rep(i,n)a[i] = b[i]
#define pi(a) printf("%d\n",a)
#define ps(a) printf("%s\n",a)
#define si(a) scanf("%d",&a)
#define print_int_matrix(mat,n) rep(i,n-1){printf("%d ",mat[i]);}printf("%d\n",mat[n-1]);
#define print_string_matrix(mat,n) rep(i,n-1){printf("%s ",mat[i]);}printf("%s\n",mat[n-1]);
#define mkp(a,b) make_pair(a,b)
#define fnd(table,e) (find(table.begin(),table.end(),e) != table.end())

//TYPOS DE DATOS PERSONALES
typedef unsigned int _set;
typedef unsigned long _lset;
typedef pair<int,int> pii;

string sint(int i){
   stringstream buf;
   buf<<i;
   return buf.str();
}

/*
ifstream fin("input.txt");
ofstream fout("output.txt");
#define cin fin
#define cout fout
*/

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


int main(){
   int n;
   while( si(n) != EOF , n){
      map<int,int> table;
      table[0] = 0;
      table[1] = 0;
      table[2] = 0;
      table[3] = 0;
      table[4] = 0;
      table[5] = 0;
      table[6] = 0;
      rep(i,n){
         int j;
         si(j);
         if( j >= 60){
            table[6]++;
         }else if(50 <= j && j < 60){
            table[5] ++;
         }else if(40 <= j && j < 50){
            table[4]++;
         }else if(30 <= j && j < 40){
            table[3]++;
         }else if(20 <= j && j < 30){
            table[2]++;
         }else if(10 <= j && j < 20){
            table[1]++;
         }else{
            table[0]++;
         }
      }

      mpi(it,table,int,int){
         printf("%d\n",it->second);
      }

   }
   return 0;
}

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

int main()
{
    string st;
    cin >> st;
    bool fl_a,fl_b;
    fl_a = false;
    fl_b = false;
    
    for(auto x:st){
        if(x == 'A') fl_a=true;
        if(x == 'B') fl_b=true;
    }

    if (fl_a && fl_b)
        cout << "Yes" <<endl;
    else
        cout << "No" <<endl;
    

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll l, r;
    cin >> l >> r;
    if(r-l+1 >= 2019){
        cout << 0 << endl;
        return 0;
    }
    ll ans = inf, MOD = 2019;
    for(int i = l; i <= r; i++){
        for(int j = i+1; j <= r; j++){
            ans = min(ans, (i%MOD)*(j%MOD)%MOD);
        }
    }
    cout << ans << endl;
}
    

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>

int main()
{
	long long int n;
	scanf("%lld", &n);
	int m = n;
	int d = 0;
	while(m != 0)
	{
		d += m%10;
		m = m/10;
	}
	if(n % d == 0)	printf("Yes\n");
	else
	{
		printf("No\n");
	}
}


Measured memory_bytes: 128
def main():

    N = int(input())
    p = list(map(int, input().split()))

    a = dict()
    b = dict()
    for i in range(N):
        v = N * N - N + 2 + i
        a[p[i]] = (p[i]-1) * N +1
        b[p[i]] = v - a[p[i]]

    # print(p)
    print(" ".join(map(str, [a[i] for i in range(1, N+1)])))
    print(" ".join(map(str, [b[i] for i in range(1, N+1)])))

if __name__ == '__main__':
    main()

Measured memory_bytes: 8600
n = int(input())
hh = []
for i in range(n):
    h = list(map(int, input().split()))
    hh.append(h)

c = [[0 for j in range(3)] for i in range(n)]
for i in range(3):
    c[0][i]  = hh[0][i]

for i in range(1,n):
    c[i][0] = max(c[i-1][1], c[i-1][2]) + hh[i][0]
    c[i][1] = max(c[i-1][0], c[i-1][2]) + hh[i][1]
    c[i][2] = max(c[i-1][0],c[i-1][1]) + hh[i][2]
print(max(c[-1]))


Measured memory_bytes: 76632
#include <stdio.h>
int main(void)
{
	int t,b,n,i;
	scanf("%d",&t);
	while(t!=0){
		b=0;
		for(i=0;i!=9;++i){
			scanf("%d",&n);
			b+=n;
		}
		printf("%d\n",t-b);
		scanf("%d",&t);
	}
}

Measured memory_bytes: 2664
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mx=123;
int d[mx];
map<int,int>mp;
int n;
bool check(){
  if(n==2){
    if(mp[1]==2)return true;
    return false;
  }
  pair<int,int>p=*mp.rbegin();
  if(p.second<2)return false;
  int r=p.first/2;
  int from,to,mini;
  if(p.first%2==0){
    from=1,to=r,mini=r+1;
    if(mp[r]==0)return false;
    mp[r]--;
  }
  else{
    from=1,to=r+1,mini=r+2;
  }
  for(int i=from;i<=to;i++){
    if(mp[r+i]<2)return false;
    mp[r+i]-=2;  
  }
  for(pair<int,int>x:mp)if(x.second>0){
    if(x.first<mini)return false;
  }
  return true;
}
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    int v;
    scanf("%d",&v);
    mp[v]++;
  }
  if(check())puts("Possible");
  else puts("Impossible");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
vector<int> z_algorithm(const vector<int> &S) {
    int N = S.size();
    vector<int> A(N);
    int i = 1, j = 0;
    while (i < N) {
        while (i + j < N && S[j] == S[i + j]) ++j;
        A[i] = j;
        if (j == 0) { ++i; continue; }
        int k = 1;
        while (i + k < N && k + A[k] < j) A[i + k] = A[k], ++k;
        i += k, j -= k;
    }
    return A;
}
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<int> A(N), B(N);
    for (auto &a : A) cin >> a;
    for (auto &b : B) cin >> b;
    vector<int> C(3 * N - 3);
    for (int i = 0; i < N - 1; i++) {
        C[i] = B[i] ^ B[i + 1];
    }
    for (int i = 0; i < 2 * N - 2; i++) {
        C[N - 1 + i] = A[i % N] ^ A[(i + 1) % N];
    }
    auto D = z_algorithm(C);
    for (int i = 0; i < N; i++) {
        if (D[N - 1 + i] >= N - 1) {
            cout << i << ' ' << (B[0] ^ A[i]) << '\n';
        }
    }
    return 0;
}

Measured memory_bytes: 9728
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var N = sc.nextInt();
        var X = sc.nextInt();
        var L = sc.ArrayInt(N);
        var cnt = new int[N+1];
        cnt[0] = 0;
        for (int i = 1; i <= N; i++) {
            cnt[i] = cnt[i - 1] + L[i - 1];
        }
        WriteLine(cnt.Where(i => i <= X).Count());
    }
}

class Combination {
    static int mod = 1000000007;

    public static long Calc(int a, int b) {
        if (b > a - b) return Calc(a, a - b);

        long ansMul = 1;
        long ansDiv = 1;
        for (int i = 0; i < b; i++) {
            ansMul *= (a - i);
            ansDiv *= (i + 1);
            ansMul %= mod;
            ansDiv %= mod;
        }
        return ansMul * ModPow(ansDiv, mod - 2) % mod;
    }

    private static long ModPow(long a, int p) {
        if (p == 0) return 1;
        if (p % 2 == 0) {
            long half = ModPow(a, p / 2);
            return half * half % mod;
        } else {
            return a * ModPow(a, p - 1) % mod;
        }
    }
}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


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

int main() {
  string name[11]={"light fly","fly","bantam","feather","light","light welter","welter","light middle","middle","light heavy","heavy"};
  double d[12]={48,51,54,57,60,64,69,75,81,91,1000};
  double x;
  while(cin >> x) {
    int t=distance(d, lower_bound(d, d+11, x));
    cout << name[t] << endl;
  }
  return 0;
}


Measured memory_bytes: 1228
#include<stdio.h>

int main(void){
	int i;
	char str[21];
	
	fgets(str,21,stdin);
	
	for(i=20;i>=0;--i){
		if(str[i]!='\0'){
			printf("%c",str[i]);
		}
	}
	printf("\n");
	
	return 0;
}

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

#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 
int main()
{
    int a[32] = {
    1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int N;
    cin >> N;
    cout << a[N - 1];
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		for (int n; (n = in.nextInt() / 4) > 0;) {
			int sum = 0;
			while (n-- > 0) {
				sum += in.nextInt();
			}
			System.out.println(sum);
		}
	}
}

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

int max(int x, int y) {
	if (x > y) return x;
	else return y;
}


int main() {

	int N;
	cin >> N;
	int* height = new int[N];
	for (int i = 1; i <= N; i++) cin >> height[i];

	bool* break_point = new bool[N];
	for (int i = 1; i <= N; i++) break_point[i] = true;

	for (int i = 2; i <= N; i++) {
		if (height[i - 1] < height[i]) {
			break_point[i] = false;
		}
	}

	int count = 0, max_ans = 0;

	for (int i = 2; i <= N; i++) {

		if (break_point[i]) {
			count++;
		}
		else {
			max_ans = max(max_ans, count);
			count = 0;
		}
	}

	cout << max(max_ans, count) << endl;

	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
#define MOD 1000000007
using namespace std;

int main(){
	int N,M;
	cin >>N>>M;
	bool a[N+1]={};
	ll dp[N+1] = {};
	rep(i,0,M){
		int tmp;
		cin >> tmp;
		a[tmp] = true;
	}	
	dp[0] = 1;
	rep(i,0,N){
		rep(j,i+1,min(N+1,i+3)){
			if(!a[j]){
				dp[j] += dp[i];
				dp[j] %= MOD;
			}
		}
	}
	cout << dp[N] << endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define MP make_pair
using namespace std;
template<typename T>
inline T read(T&x){
    x=0;int f=0;char ch=getchar();
    while (ch<'0'||ch>'9') f|=(ch=='-'),ch=getchar();
    while (ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x=f?-x:x;
}
int main(){
    int n,cnt=0;
    map<char,int>mp;
    char s[2];
    read(n);
    for (int i=1;i<=n;i++){
        scanf("%s",s);
        if (mp.find(s[0])==mp.end()) mp[s[0]]=1,cnt++;
    }
    if (cnt==3) puts("Three");
    else puts("Four");
    return 0;
}


Measured memory_bytes: 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
// #include<C:\Users\J\Desktop\AC\athead.h>
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#define divs 1000000007
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
using namespace std;


int main(){
    int n, m;
  cin >> n >> m;
    multiset<int> a;
    unsigned long long int sum = 0;
    rep(i,n){
        int buf;
        cin >> buf;
        a.insert(buf);
        sum += buf;
    }
   unsigned long long int sakugen = 0;
    rep(i,m){
        auto itr = a.end();
      itr--;
        int targ = *itr;
        sakugen += (targ - targ/2);
        a.erase(itr);
        a.insert(targ/2);
    }
    cout << sum - sakugen;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int cnt = 0;
    rep(i, n) {
        if(h[i] >= k)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}


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

int main(){
  char b;
  cin >> b;
  if(b=='A')
    cout << 'T';
  else if(b=='T')
    cout << 'A';
  else if(b=='G')
    cout << 'C';
  else if(b=='C')
    cout << 'G';
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> N;
	M = N / 11;
	M *= 2;
	N %= 11;
	if (N > 6)M++;
	if (N)M++;
	cout << M << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int k[3];
  rep(i,3)cin >> k[i];
  sort(k,k+3);
  cout << k[1]+k[0] << endl; 
}  


Measured memory_bytes: 256
def main():
    x, y, z, k = map(int, input().split())
    A = sorted(list(map(int, input().split())), reverse=True)
    B = sorted(list(map(int, input().split())), reverse=True)
    C = sorted(list(map(int, input().split())), reverse=True)
    
    anslist = []
    for ai, a in enumerate(A):
        for bi, b in enumerate(B):
            for ci, c in enumerate(C):
                if (ai+1)*(bi+1)*(ci+1)<=k:
                    anslist.append(a+b+c)
                else:
                    break    
    anslist.sort(reverse=True)
    for a in anslist[:k]:
        print(a)
main()

Measured memory_bytes: 8752
import java.util.Scanner;

class Main
{
	public static void main(String[] args)
	{
		Scanner stdIn = new Scanner(System.in);
		String str;
		
		str = stdIn.next();
		for (int i = str.length() - 1; i >= 0; i--){
			System.out.print(str.charAt(i));
		}
		System.out.println();
	}
}

Measured memory_bytes: 17128