akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, vector<T>& v){ for(auto& e : v){ out << e << d; } return out; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<string> ss(h); cin >> ss;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(ss[i][j] == '.'){ continue; }
            if(i + 1 < h && ss[i + 1][j] == '#'){ continue; }
            if(j + 1 < w && ss[i][j + 1] == '#'){ continue; }
            if(i && ss[i - 1][j] == '#'){ continue; }
            if(j && ss[i][j - 1] == '#'){ continue; }
            cout << "No" << '\n';
            return 0;
        }
    }
    cout << "Yes" << '\n';
}


Measured memory_bytes: 256
Public Class Program
  Shared Sub Main()
    Dim n As Integer = Integer.Parse(Console.ReadLine())
    Dim arrayA(0 To n - 1) As Integer
    Dim max As Integer = 1
    Dim secondMax AS Integer = 1
    For i As Integer = 0 To n - 1
      arrayA(i) = Integer.Parse(Console.ReadLine())
      If arrayA(i) > max Then
        secondMax = max
        max = arrayA(i)
      ElseIf arrayA(i) > secondMax Then
        secondMax = arrayA(i)
      End If
    Next
    For i As Integer = 0 To n - 1
      Dim output As Integer = max
      If arrayA(i) = output Then output = secondMax
      Console.WriteLine(output.ToString())
    Next
  End Sub
End Class

Measured memory_bytes: 18472
#include<bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
//g++ -std=c++11 

using namespace std;

long long N;
double X[55];
double Y[55];


double getget(double x, double y) {
	double ans = 0;
	rep(i, N) {
		ans = max(ans, sqrt((X[i] - x) * (X[i] - x) + (Y[i] - y) * (Y[i] - y)));
	}
	return ans;
}



// xを固定した場合の半径の最小
double cal(double x) {
	double starty = 0;
	double endy = 1000;

	double ans = 10001000;

	while(starty + 0.0000001 < endy) {
		double y1 = starty + (endy-starty)/3.0 * 1;
		double y2 = starty + (endy-starty)/3.0 * 2;

		double num1 = getget(x, y1);
		double num2 = getget(x, y2);

		if(num1 < num2) {
			endy = y2;
		} else {
			starty = y1;
		}
	}
	return getget(x, starty);
}

int main(){
	cin >> N;
	rep(i, N) cin >> X[i] >> Y[i];


	double startx = 0;
	double endx = 1000;

	double ans = 10001000;

	while(startx + 0.0000001 < endx) {
		double x1 = startx + (endx-startx)/3.0 * 1;
		double x2 = startx + (endx-startx)/3.0 * 2;

		double num1 = cal(x1);
		double num2 = cal(x2);
		ans = min(ans, num1);
		ans = min(ans, num2);

		if(num1 < num2) {
			endx = x2;
		} else {
			startx = x1;
		}
	}


	printf("%.20f\n", ans);

}


Measured memory_bytes: 3816
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace B
{
    public class Program

    {
        public static void Main(string[] args)
        {
            string s = RSt();

            int cnt = 0;
            int res = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') cnt++;
                else cnt = 0;
                res = Math.Max(res, cnt);
            }
            Console.WriteLine(res);
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}


Measured memory_bytes: 13140
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
using ld = long double;
 
// ------------------------------------------------------------------------------------------------

ll n, l;
vector<string> s;

int main() {
    fast_io; cout_precision;
    cin >> n >> l;
    s.resize(n);
    for (ll i = 0; i < n; i++) {
        cin >> s[i];
    }
    sort(s.begin(), s.end());
    copy(s.begin(), s.end(), ostream_iterator<string>(cout, ""));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
/* constant */
const int INF = 1 << 30;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
struct mint {
    ll x;
    mint(ll x = 0):x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
struct combination {
    // vector size : n + 1
    vector<mint> fact, ifact;
    // precaliculation O(n)
    combination(int n):fact(n+1), ifact(n+1) {
        assert(n < mod);
        // 0! = 1;
        fact[0] = 1;
        // 1! = 0! * 1 ... n! = (n-1)! * n
        for (int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
        // 1/n! = n!^(-1)
        ifact[n] = fact[n].inv();
        // (n-1)!^(-1) = n!^(-1) * n ... 0!^(-1) = 1!^(-1) * 1
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i] * i;
    }
    // combination O(1)
    // nCk = n! / (k! * (n-k)!)
    //     = n! * k!^(-1) * (n-k)!^(-1)
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n-k];
    }
};
/* global variables */
/* function */
/* main */
int main() {
    int n, k;
    cin >> n >> k;
    mint ans = 1;
    combination c = combination(2000);
    ans = c(n + k - 1, k - 1);
    cout << ans << '\n';
}


Measured memory_bytes: 3128
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let x = read::<u64>();
    let res_base : u64 = x/11;
    let res_add : u64 = match x%11 {
        0 => 0,
        1 ... 6 => 1,
        _ => 2
    };
    println!("{}", res_base * 2 + res_add);
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define ALL(x) x.begin(), x.end()
#define DEBUG(args...) { string _s = #args; replace(ALL(_s), ' ', '\0');\
replace(ALL(_s), ',', ' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); _debug(_it, args);}
#define endl "\n"
#define F first
#define S second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void _debug(istream_iterator<string>) {}
template<typename T, typename... Args>
void _debug(istream_iterator<string> it, T first, Args... args) {
    cerr << ">> " << *it << " : " << first << endl; _debug(++it, args...);
}
template <typename T1, typename T2>
inline ostream& operator << (ostream& out, const pair<T1, T2>& p) {
    return out << "(" << p.F << ", " << p.S << ")";
}
template<typename T>
inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty()) return out << "[]";
    else { out << '['; for (auto& e : v) { out << e << ", "; } return out << "\b\b]"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const set<T>& s) {
    if (s.empty()) return out << "{}";
    else { out << '{'; for (auto& e : s) { out << e << ", "; } return out << "\b\b}"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const unordered_set<T>& s) {
    return out << set<T>(ALL(s));
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const map<T1, T2>& m) {
    if (m.empty()) return out << "{}";
    out << '{'; for (auto& p : m) { out << p << ", "; } return out << "\b\b}";
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const unordered_map<T1, T2>& m) {
    return out << map<T1, T2>(ALL(m));
}
template<typename T>
inline ostream& operator << (ostream& out, const ordered_set<T>& s) {
    return out << set<T>(ALL(s));
}

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;
/************************************** MAIN PROGRAM ********************************************/

int main()
{
    //freopen("input.txt", "r", stdin);
    SPEED
    string s;
    cin >> s;
    cout << string(s.size(), 'x');
}
/************************************** END OF PROGRAM ******************************************/
/** Stuff you should look for:
 * int overflow, array bounds, over-counting, graph is not a tree/connected
 * special cases (n=1?), set/unordered_set TLE, multi-set/set error
 * do something instead of nothing and stay organized
 */


Measured memory_bytes: 256
use std::io::*;

type Dict = Vec<u8>;

fn find(d: &Dict, s: &str) -> bool {
	let hash = str_to_hash(s);
	unsafe { *d.get_unchecked(hash >> 3) & 1 << (hash & 7) != 0 }
}

fn insert(d: &mut Dict, s: &str) {
	let hash = str_to_hash(s);
	unsafe { *d.get_unchecked_mut(hash >> 3) |= 1 << (hash & 7) }
}

fn str_to_hash(s: &str) -> usize {
	let mut hash = 0;

	for ch in s.bytes() {
		hash <<= 2;
		hash |= match ch {
			b'A' => 0,
			b'C' => 1,
			b'G' => 2,
			b'T' => 3,
			_ => unreachable!(),
		};
	}
	hash += 0x155555 >> 24 - s.len() * 2 << 2;
	hash
}

fn main() {
	let input = {
		let mut buf = vec![];
		stdin().read_to_end(&mut buf);
		unsafe { String::from_utf8_unchecked(buf) }
	};
	let mut lines = input.split('\n');

	let n = lines.next().unwrap().parse().unwrap();

	let out = stdout();
	let mut out = BufWriter::new(out.lock());

	let mut dict = vec![0u8; 0x1555554 / 8 + 1];

	for line in lines.take(n) {
		let mut iter = line.split(' ');

		let cmd = iter.next().unwrap();
		let s = iter.next().unwrap();

		if cmd.len() == 6 {
			insert(&mut dict, s);
		} else {
			let res = find(&dict, s);
			out.write(if res { b"yes\n" } else { b"no\n" });
		}
	}
}



Measured memory_bytes: 24456
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int max(int a,int b){return (a>b ? a:b);}
int min(int a,int b){return (a<b ? a:b);}

int compare_int(const void *a, const void *b){return *(int*)a - *(int*)b;}
//これは昇べきの順のソート

//int compare_int(const void *a, const void *b){return *(int*)b - *(int*)a;}
//これは降べきの順のソート

//qsort(配列, 長さ, sizeof(int), compare_int);

double BS(int array[],int len,int target);


void merge(long long a1[],long long len_a1,long long a2[],long long len_a2,long long a[]){
    long long i = 0,j = 0;
    while(i<len_a1 || j<len_a2){
        if(j>=len_a2 || (i<len_a1 && a1[i]<a2[j])){
            a[i+j] = a1[i];
            i++;
        }else{
            a[i+j] = a2[j];
            j++;
        }
    }
}
void mergeSort(long long a[],long long len_a){
    if(len_a > 1){
        long long m = len_a/2;
        long long n = len_a - m;
        long long a1[m];
        long long a2[n];
        for(long long i = 0;i < m;i++) a1[i] = a[i];
        for(long long i = 0;i < n;i++) a2[i] = a[m+i];
        mergeSort(a1,m);
        mergeSort(a2,n);
        merge(a1,m,a2,n,a);
    }
}
 
//////////////////////////////////////////

int N;
int H[30];

int main(){
    scanf("%d",&N);
    for(int i = 0;i < N;i++){
        scanf("%d",&H[i]);
    }
    int count = 1;

    for(int i = 1;i < N;i++){
        int mark = 0;
        for(int j = 0;j < i;j++){
            if(H[j] > H[i]) mark = 1;
        }
        if(mark == 0)count++;
    }
    printf("%d\n",count);    
    return 0;
}



///////////////////////////////////////////


double BS(int array[],int len,int target){ //(配列,長さ,見つける値)
    int low,mid,high;

    low = 0;
    high = len-1;

    int mark;

    while(low <= high){
        mid = (low + high) / 2;
        if(array[mid] == target){
            mark = 0;
            break;
        }else if(array[mid] < target){
            low = mid + 1;
            mark = 1;
        }else{
            high = mid - 1;
            mark = -1;
        }
    }
    if(mark == 0){
        return mid; //配列の何番目か（０から）
    }else if(mark == 1){
        return (double)mid + 0.5;//なかったらどこのあいだか
    }else{
        return (double)mid - 0.5;
    }
}


Measured memory_bytes: 128
def solve():
    N = int(input())
    Hs = list(map(int, input().split()))
    As = list(map(int, input().split()))

    def makeBIT(numEle):
        numPow2 = 2 ** (numEle-1).bit_length()
        data = [0] * (numPow2+1)
        return data, numPow2
    def setValue(iA, A):
        iB = iA + 1
        while iB <= numPow2:
            if A > data[iB]:
                data[iB] = A
            iB += iB & -iB
    def getMax(iA):
        iB = iA + 1
        ans = 0
        while iB > 0:
            if data[iB] > ans:
                ans = data[iB]
            iB -= iB & -iB
        return ans


    iHs = list(range(N))
    iHs.sort(key=lambda iH: Hs[iH])
    odrHs = [0]*(N)
    for odrH, iH in enumerate(iHs):
        odrHs[iH] = odrH

    data, numPow2 = makeBIT(N)

    ans = 0
    for odrH in range(N):
        iH = iHs[odrH]
        v = As[iH] + getMax(iH)
        if v > ans:
            ans = v
        setValue(iH, v)

    print(ans)


solve()


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


int d[111];

int main(){

  int n;
  vector<pair<int, int> > v;
  cin >> n;
  for(int i = 0; i <= n; i++){
    v.push_back(make_pair(0,0));
  }
  for(int i = 0; i < (n*(n-1))/2; i++){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    v[a].second = a;
    v[b].second = b;
    if(c > d){
      v[a].first += 3;

    }else if(d > c){
      v[b].first += 3;

    }else {
      v[a].first += 1;
      v[b].first += 1;
    }
  }



  for(int i = 1; i <= n; i++){
    int cnt = 1;
    for(int j = 1; j <= n; j++){
      if(v[i].first < v[j].first){
	cnt++;
      }
    }
    cout << cnt << endl;
  }





}

Measured memory_bytes: 1196
#include <iostream>	
#include <time.h>
#include <vector>
#include <stdio.h>
#include <memory.h>
#include <string>
#include <map>
#include <algorithm>
#include <bitset>
#include <queue>
#include <set>
#include <time.h>
#include <assert.h>
#include <sstream>
//#include <unordered_map>
#include <bitset>
#include <utility>
#include <iomanip>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <math.h>
#include <string.h>
#include <string>
#include <complex>
#include <valarray>
using namespace std;
typedef long long ll;



int main() {
    
    int n;
    scanf("%d",&n);
    int cnt=0;
    for(int i=0;i<n;++i){
        int x;
        scanf("%d",&x);
        cnt+=x&1;
    }
    puts((cnt&1)?"NO":"YES");
    
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  double a,s;
  int i,j,k;
  while((scanf("%lf",&a)) != EOF){
    s = a;
    for(i=2;i<=10;i++){
      if(i%2) a /= 3;
      else a *= 2;
      s += a;
    }
    printf("%.8lf\n",s);
  }
}

Measured memory_bytes: 0
N, M = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]

X.sort()
Y = [X[i+1] - X[i] for i in range(M-1)]

Y.sort(reverse=True)
# print('Y',Y)

res = X[-1] - X[0]
# print('res', res)
for i in Y[:N-1]:
	res -= i
# print('res',res)

print(res)

Measured memory_bytes: 57640
package main

import (
	"fmt"
)

func main() {
	var N, Y int
	var exist bool
	var kumi = make(map[string]int)

	fmt.Scan(&N)
	fmt.Scan(&Y)

	max_a := Y / 10000
	if max_a > N {
		max_a = N
	}
	max_b := Y / 5000
	if max_b > N {
		max_b = N
	}
	max_c := Y / 1000
	if max_c > N {
		max_c = N
	}
	
	for a := 0; a <= max_a && !exist; a++ {
		for b := 0; b <= max_b-a && !exist; b++ {
			c := N - a - b
			if c >=0 && a * 10000 + b * 5000 + c * 1000 == Y {
				exist = true
				kumi["a"] = a
				kumi["b"] = b
				kumi["c"] = c
				break;
			}
		}
	}

	if ! exist {
		kumi["a"] = -1
		kumi["b"] = -1
		kumi["c"] = -1
	}

	fmt.Printf("%d %d %d", kumi["a"], kumi["b"], kumi["c"])
}

Measured memory_bytes: 512
from collections import Counter

n = int(input())
l = list("")
for i in range(n):
    l.append(input())
c = Counter(l)
c = c.most_common()
max = c[0][1]
a = list("")
for i in range(len(c)):
    if c[i][1] == max:
        a.append(c[i][0])
    else:
        break
a.sort()
for i in range(len(a)):
    print(a[i])

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

ll wt[102], val[102];
ll dp[2][100002];

int main() {
  int n, w;
  cin >> n >> w;
  for (int i = 1; i <= n; ++i) cin >> wt[i] >> val[i];

  for (int pos = 1; pos <= n; ++pos) {
    for (int s = 0; s <= w; ++s) {
      dp[1][s] = dp[0][s];
      if ( s - wt[pos] >= 0 ) 
        dp[1][s] = max( dp[1][s], val[pos] + dp[0][s - wt[pos]] );
    }
    for (int s = 0; s <= w; ++s) dp[0][s] = dp[1][s];
  }

  cout << dp[0][w] << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

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

    for (int i = 1; i < 10;++i){
        for (int j = 1; j < 10; ++j){
            if( i*j == N){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

class A{
	public static void Main(){

		int input = int.Parse (Console.ReadLine ());
		int[,,] bill = new int[4,3,10];


		for (int i = 0; i<input; i++) {
			string[] s = Console.ReadLine ().Split (' ');

			int b = int.Parse (s [0]) -1;	
			int f = int.Parse (s [1]) -1;
			int r = int.Parse (s [2]) -1;
			int v = int.Parse (s [3]);
			bill [b,f,r] += v;
		}

		for (int i =0 ;i<4;i++){
			for (int x=0; x<3; x++) {
				for (int y=0; y<10; y++) {
					Console.Write (" {0}", bill [i,x,y]);
				}
				Console.WriteLine ();
			}
			if (i < 3) {
				Console.WriteLine ("####################");
			}
		}
	}
}

Measured memory_bytes: 9188
from itertools import product
def main():
    N, M, X = map( int, input().split())
    A = [ list( map( int, input().split())) for _ in range(N)]

    Alg = [0]*M
    cost = 0
    for a in A:
        cost += a[0]
        for i in range(M):
            Alg[i] += a[i+1]
    for i in range(M):
        if Alg[i] < X:
            print(-1)
            return

    ans = cost
    for P in product( range(2), repeat=N):
        Alg = [0]*M
        cost = 0
        for i in range(N):
            if P[i] == 0:
                continue
            cost += A[i][0]
            for j in range(M):
                Alg[j] += A[i][j+1]
        check = True
        for i in range(M):
            if Alg[i] < X:
                check = False
                break
        if check:
            if cost < ans:
                ans = cost
    print(ans)
        
if __name__ == '__main__':
    main()


Measured memory_bytes: 9256
#include <stdio.h>
 
int main(void) {
    char day[7][10]={"Monday","Tuesday","Wednesday","Thursday"
                    ,"Friday","Saturday","Sunday"};
    int months[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    int i;
    int totaldate;
    int month,date;
    for(i=2;i<13;i++)months[i]+=months[i-1];
    while(1) {
        scanf("%d %d",&month,&date);
        if(month==0)break;
        totaldate=months[month-1]+date;
        printf("%s\n",day[(totaldate+2)%7]);
    }
    return 0;
}

Measured memory_bytes: 584
N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


div = make_divisors(N)
ans = 10**10+3
for d in div:
    d2 = N//d
    tmp = max(len(str(d)),len(str(d2)))
    ans = min(ans,tmp)

print(ans)
    

Measured memory_bytes: 39280
import           Control.Monad (guard, replicateM)

main :: IO ()
main = do
  [n, a, b, c] <- map read . words <$> getLine
  ls <- replicateM n readLn
  print $ solve (a, b, c) ls

solve :: (Int, Int, Int) -> [Int] -> Int
solve (a, b, c) ls = minimum $ do
  [ingredientsA, ingredientsB, ingerdientsC, _] <- partitions 4 ls
  guard $ all (not . null) [ingredientsA, ingredientsB, ingerdientsC]
  pure $ sum $ zipWith mp [a, b, c] [ingredientsA, ingredientsB, ingerdientsC]

mp :: Int -> [Int] -> Int
mp goal bamboos = abs (sum bamboos - goal) + 10 * (length bamboos - 1)

partitions :: Int -> [a] -> [[[a]]]
partitions k = foldr f [replicate k []]
  where
    f :: a -> [[[a]]] -> [[[a]]]
    f x =
      concatMap $ map (\(groups1, group, groups2) -> groups1 ++ [x : group] ++ groups2) . foci

foci :: [a] -> [([a], a, [a])]
foci []     = []
foci (x:xs) = ([], x, xs) : map (\(ys1, y, ys2) -> (x:ys1, y, ys2)) (foci xs)


Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
const ll INF=1e15+7;
const ll N = 100002;
ll n,a[N],ans=0;
priority_queue<ll> gu;

int main(){
	cin>>n;
	FOR(i,0,n){
		cin>>a[i];
	}
	FOR(i,0,n){
		if(i%2==0)gu.push(a[i]);
	}
	sort(a,a+n);
	FOR(i,0,n){
		if(i%2==0)gu.push(a[i]);
	}
	while(1){
		if(gu.empty())break;
		if(gu.size()==1){
			ans++;
			break;
		}
		n=gu.top();
		gu.pop();
		if(n==gu.top()){
			gu.pop();
		}else{
			ans++;
		}
	}
	cout<<ans/2<<endl;
	return 0;
}


Measured memory_bytes: 2168
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'

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

  int n; cin >> n;
  string s; cin >> s;
  stack<char> st;
  for (int i = 0; i < (int) s.size(); ++i){
    if (st.empty()) st.push(s[i]);
    else if (st.top() == '#' && s[i] == '.') st.pop();
    else st.push(s[i]);
  }
  int nokori = st.size();
  print((n - nokori) / 2);

  return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define all(c) c.begin(),c.end()
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;

int main() {
  ll a;
  cin >> a;
  string s;
  cin >> s;
  if (a >= 3200) cout << s << endl;
  else cout << "red" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>

#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <time.h>

#include <string>

const int MAX_KETA = 40;
int L;
int bitL[MAX_KETA];

int graph[100][3];



int main(int argc, char **argv) {
    std::cin >> L;
    int keta = 0;
    int gs = 0;
    for (int i = 0; i < MAX_KETA; i++) {
        if ((1 << i) > L) {
            keta = i - 1;
            break;
        }
        bitL[i] = (L >> i) & 1;
    }
    //std::cout << "keta:" << keta << std::endl;

    for (int i = keta - 1; i >= 0; i--) {
        int weight = (1 << i);
        graph[gs][0] = i + 1;
        graph[gs][1] = i;
        graph[gs][2] = 0;
        gs++;

        graph[gs][0] = i + 1;
        graph[gs][1] = i;
        graph[gs][2] = weight;
        gs++;
    }

    int tmp = 0;
    for (int i = keta; i >= 0; i--) {
        if (bitL[i] == 1) {
            if (i != keta) {
                graph[gs][0] = keta;
                graph[gs][1] = i;
                graph[gs][2] = tmp;
                gs++;
            }
            tmp += (1 << i);
        }
    }

    std::cout << keta + 1 << " " << gs << std::endl;
    for (int i = 0; i < gs; i++) {
        std::cout << graph[i][1] + 1 << " " << graph[i][0] + 1 << " " << graph[i][2] << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

constexpr auto INF = INT_MAX/2;
constexpr auto MOD = 1000000007;

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

	vi p(0);

	rep1(i, n / 2) {
		if (i == 1)continue;
		bool prime = true;
		rep1(j, i - 1)if (j != 1 && i % j == 0)prime = false;
		if (prime)p.push_back(i);
	}

	map<int, int> div;

	rep(i, p.size()) {
		int pp = p[i];
		int k = 0;
		while (n / pp) {
			k += n / pp;
			pp *= p[i];
		}

		div[p[i]] = k;
	}


	map<int, int> slc;

	vi t = { 3,5,15,25,75 };

	rep(i, 5) {
		for (auto x : div)if (x.second >= t[i] - 1)slc[t[i]]++;
	}

	int ans = 0;

	ans += slc[75];

	ans += slc[25] * (slc[3] - 1);

	ans += slc[15] * (slc[5] - 1);

	ans += slc[5] * (slc[5] - 1) * (slc[3] - 2) / 2;

	cout << ans << endl;

}

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

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

    for(int i=0;;i++){
        if(A*i<T+0.5&&A*(i+1)>T+0.5){
            cout<<B*i<<endl;
            return 0;
        } 
    }
}

Measured memory_bytes: 256
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

l=int(input())
r=20
while 2**r>l:
    r-=1
anslst=[]
for i in range(2*r):
    lst=[i//2+1, i//2+2, 0]
    if i%2==1:
        lst[2]=2**((i)//2)
    anslst.append(lst)

for i in range(r):
    if l-2**(r-i-1)>=2**r:
        anslst.append([r-i,r+1,l-2**(r-i-1)])
        l-=2**(r-i-1)

print(*[r+1,len(anslst)])
for i in range(len(anslst)):
    print(*anslst[i])

Measured memory_bytes: 38256
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] p = new int[n];
        int count = 0;
        for(int i = 0;i<n;i++){
            p[i] = Integer.parseInt(sc.next());
        }
        for(int i = 1;i<n-1;i++){
            if((p[i-1] < p[i] && p[i] < p[i+1]) || (p[i-1] > p[i] && p[i] > p[i+1])){
                count += 1;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 21712
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000000

int N;
vector<long long> A;
bool f = true;
long long ans = 0;

long long dfs(int depth,long long x){
	if(depth==N){
		if(x<A[depth])f=false;
		ans += A[depth];
		return A[depth];
	}
	
	
	x-=A[depth];
	
	long long ret = dfs(depth+1,min(x*2,(long long)Inf));
	if(ret>x){
		if((ret+1)/2>x){
			f=false;
			return 0LL;
		}
		else{
			ret = x;
		}
	}
	if(ret<0)f=false;
	ret += A[depth];
	ans += ret;
	return ret;
}

int main(){
	
	cin>>N;
	
	for(int i=0;i<=N;i++){
		long long t;
		cin>>t;
		A.push_back(t);
	}
	
	dfs(0,1);
	
	if(f)cout<<ans<<endl;
	else cout<<-1<<endl;
	
	return 0;
}

Measured memory_bytes: 7192
n, k = [int(i) for i in input().split()]
r, s, p = [int(i) for i in input().split()]
t = input()
a = {"r": p, "s": r, "p": s}
b = {"r": "p", "s": "r", "p": "s"}

ans = 0
u = ""
for i in t:
    if len(u)<k:
        ans += a[i]
        u+=b[i]
    elif u[-k] == b[i]:
        u+="1"
        ans += 0
    else:
        ans += a[i]
        u += b[i]

print(ans)


Measured memory_bytes: 3444
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <climits>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF=1<<29;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N,Ans=0;
	cin>>N;
	vector<ll> A(N+1),B(N);
	for(int i=0;i<N+1;i++) cin>>A[i];
	for(int i=0;i<N;i++) cin>>B[i];
	for(int i=0;i<N;i++){
		ll tmp=min(A[i],B[i]);
		A[i]-=tmp;
		B[i]-=tmp;
		Ans+=tmp;

		ll tmp2=min(A[i+1],B[i]);
		A[i+1]-=tmp2;
		B[i]-=tmp2;
		Ans+=tmp2;
	}
	cout<<Ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
s = input()
t = input()
start = [-1]*30
goal = [-1]*30
count = 0
for i in range(0,len(s)):
    a = ord(s[i])-ord("a")
    b = ord(t[i])-ord("a")
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
elif count == 0:
    print("Yes")

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int r,c;
  cin >> r >> c;
  int a[101][101] = {};

  for(int i=0; i<r; i++)
    for(int j=0; j<c; j++) cin >> a[i][j];

  for(int i=0; i<r; i++)
    for(int j=0; j<c; j++) a[r][c] += a[i][j];

  for(int i=0; i<r; i++){
    int sum = 0;
    for(int j=0; j<c; j++)
    sum += a[i][j];
    a[i][c] = sum;
  }

  for(int j=0; j<c; j++){
    int sum = 0;
    for(int i=0; i<r; i++)
        sum += a[i][j];
    a[r][j] = sum;
  }

 for(int i=0; i<=r; i++){
    for(int j=0; j<=c; j++){
	if(j) cout << " ";
	cout << a[i][j];
    }
    cout<<endl;
  }
  return 0;
}


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

int main() {
  int N;
  double x;
  cin >> N;
  vector<int> vec(N);
  
  if (N%2==0) x=0.5000000000;
  else {
    double y =N/2+1;
    x= y/N;
  }

  cout << x << endl;
}


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

int main() {
	string s;
	while(cin >> s, s[0] != '#') {
		vector<string> res;
		for(int i = 0; i < (1 << s.size()); i++) {
			string p = s;
			bool flg = true;
			bool found[26] = {0};
			found[0] = true;
			for(int j = 0; j < s.size(); j++) {
				if(i & (1 << j)) {
					if(p[j] == 'z') {
						flg = false;
						break;
					}
					else {
						p[j]++;
						if(found[p[j]-'a']) {
							flg = false;
							break;
						}
						found[p[j]-'a'] = true;
					}
				}
				else {
					if(!found[p[j]-'a']) {
						flg = false;
						break;
					}
					found[p[j]-'a'] = true;
				}
			}

			if(flg) {
				res.push_back(p);
			}
		}
		cout << res.size() << endl;
		sort(res.begin(), res.end());
		if(res.size() > 10) {
			for(int i = 0; i < 5; i++)
				cout << res[i] << endl;
			for(int i = 0; i < 5; i++)
				cout << res[res.size()-5+i] << endl;
		}
		else {
			for(int i = 0; i < res.size(); i++)
				cout << res[i] << endl;
		}
	}
}

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

using namespace std;

int N, M;
vector < int > way[2004], wayb[2004];
int stk[1004], top, chk[1004], st;
pair < int, int > gap[1004];

void sol(int num, int last){
    stk[++top] = num, chk[num] = 1;
    int f = 0;
    for(auto&i:way[num]){
        if(chk[i]){
            if(i == st){
                f = 1;
            }
            if(i != st){
                chk[num] = 0;
                --top;
                return;
            }
        }
    }
    for(auto&i:wayb[num]){
        if(chk[i] && i != last){
            chk[num] = 0;
            --top;
            return;
        }
    }
    if(f){
        printf("%d\n", top);
        for(int i = 1; i <= top; ++i){
            printf("%d\n", stk[i]);
        }
        exit(0);
    }
    for(auto&nxt:way[num]){
        sol(nxt, num);
    }
    chk[num] = 0;
    --top;
}

vector < int > vc;

int main(){
    scanf("%d %d", &N, &M);
    for(int i = 1; i <= M; ++i){
        int A, B; scanf("%d %d", &A, &B);
        way[A].push_back(B);
        wayb[B].push_back(A);
    }
    for(int i = 1; i <= N; ++i){
        gap[i].first = (int)way[i].size() + wayb[i].size(), gap[i].second = i;
    }
    sort(gap + 1, gap + N + 1);
    reverse(gap + 1, gap + N + 1);
    for(int j = 1; j <= N; ++j){
        int i = gap[j].second;
        st = i;
        sol(i, -1);
        for(auto&x:way[i]){
            vc.clear();
            for(auto&y:wayb[x]){
                if(y != i){
                    vc.push_back(y);
                }
            }
            wayb[x] = vc;
        }
        for(auto&x:wayb[i]){
            vc.clear();
            for(auto&y:way[x]){
                if(y != i){
                    vc.push_back(y);
                }
            }
            way[x] = vc;
        }
    }
    puts("-1");
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>

int main(void){
    int h,w;
    int i;
    char input[100][101];
    char img[200][101];
    scanf("%d %d",&h,&w);
    for(i=0;i<h;i++){
        scanf("%s",input[i]);
    }
    printf("\n");
    for(i=0;i<h;i++){
        strcpy(img[2 * i],input[i]);
        strcpy(img[2 * i + 1],input[i]);
    }
    for(i=0;i<2*h;i++){
        printf("%s",img[i]);
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

//Starry-Sky木
//計算量 初期化:O(N)、区間加算:O(N)、区間min(max):O(N)、全体更新:O(N)

template<typename Monoid>
struct Starry_Sky_Tree{
    Monoid f(Monoid a, Monoid b){
        return min(a, b);
    }
    Monoid g(Monoid a, Monoid b){
        return a+b;
    }
    const Monoid unit, base = 0;
    int n;
    vector<Monoid> seg, lazy;
    
    Starry_Sky_Tree(int N, const Monoid &x) : unit(x){
        n = 1;
        while(n < N) n <<= 1;
        seg.assign(2*n, base);
        lazy.assign(2*n, base);
    }
    
    void add(int a, int b, const Monoid &x, int i = 1, int l = 0, int r = -1){
        if(r < 0) r = n;
        if(a >= r || b <= l) return;
        if(a <= l && r <= b){
            lazy[i] = g(lazy[i], x);
            return;
        }
        add(a, b, x, 2*i, l, (l+r)/2);
        add(a, b, x, 2*i+1, (l+r)/2, r);
        seg[i] = f(g(seg[2*i], lazy[2*i]), g(seg[2*i+1], lazy[2*i+1]));
    }
    
    Monoid query(int a, int b, int i = 1, int l = 0, int r = -1){
        if(r < 0) r = n;
        if(a >= r || b <= l) return unit;
        if(a <= l && r <= b) return g(seg[i], lazy[i]);
        Monoid vl = query(a, b, 2*i, l, (l+r)/2);
        Monoid vr = query(a, b, 2*i+1, (l+r)/2, r);
        return g(f(vl, vr), lazy[i]);
    }
    
    void update(int i = 1, int l = 0, int r = -1){
        if(r < 0) r = n;
        seg[i] = g(seg[i], lazy[i]);
        if(r-l > 1){
            lazy[2*i] = g(lazy[2*i], lazy[i]);
            lazy[2*i+1] = g(lazy[2*i+1], lazy[i]);
            update(2*i, l, (l+r)/2);
            update(2*i+1, (l+r)/2, r);
        }
        lazy[i] = base;
    }
    
    Monoid operator [] (int i) const {return seg[n+i];}
    
    void clear(){
        fill(seg.begin(), seg.end(), base);
        fill(lazy.begin(), lazy.end(), base);
    }
};

//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_H

int main(){
    int N, Q;
    cin >> N >> Q;
    Starry_Sky_Tree<int> seg(N, inf);
    while(Q--){
        int q, x, y; cin >> q >> x >> y; y++;
        if(q == 0){
            ll a; cin >> a;
            seg.add(x, y, a);
        }
        else cout << seg.query(x, y) << endl;
    }
}


Measured memory_bytes: 4904
#include <stdio.h>
#include <math.h>
#include <limits.h>
#include <stdlib.h>
int N,K;
int  h[100001];
int  dp[100001];
int  INF = INT_MAX;

int 
chmin(int  *a, int b) 
{
	 if (*a > b){
		 *a = b; //	printf("%ld\n",*a);
		 return 1; 
	 }
	 return 0;
}


int 
main(){
	int i;
	scanf("%d %d",&N,&K);
	for(i=0;i<N;i++){
		scanf("%d",&h[i]);
		dp[i]=INF;
	}
	
	dp[0]=0;
	
	#if 1
	for(i=0;i<N;++i){
		for(int j=0;j<=K;j++){
        	chmin(&dp[i + j], dp[i] + abs(h[i] - h[i + j]));
		}
    }
    #else
    for (i = 1; i < N; i++) {
        chmin(&dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1) chmin(&dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    #endif
	
	//for(i=0;i<N;i++){
		printf("%d\n",dp[N-1]);
	
	//}
	
 return 0;
}

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


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int b,r,g,c,s,t,now,cnt;
  while(1){
    cin >> b >> r >> g >> c >> s >> t;
    if(b==0&&r==0&&g==0&&c==0&&s==0&&t==0) break;
    now=100;
    now=now-t*3+(b*5+r*3)+s*3;
    now=now+b*15+b*5*15+r*15+r*3*15+g*7+c*2;
    cout << now << endl;
  }
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <limits>

using namespace std;

int N,X,nr_div2,Max = numeric_limits<int>::max();

int main()
{

    cin >> N;
    while(N--)
    {
        cin >> X;
        nr_div2 = 0;
        while(X > 1 && X % 2 == 0)
            nr_div2++, X /= 2;
        Max = min(Max,nr_div2);
    }
    cout << Max;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main() 
{ 
     int mod=1e9+7;
	int n,k;
	cin>>n>>k;
	int prev[n+1]={0},last[n+1]={0};
	last[0]=n;
	for(int i=1;i<=n;i++)
	{
	     prev[i]=prev[i-1]+i;
	     last[i]=last[i-1]+(n-i);
	}
	/*for(int i=0;i<=n;i++)
	{
	     cout<<prev[i]<<" "<<last[i]<<"\n";
	}*/
	int ans=0;
     for(int i=k;i<=n+1;i++)
     {
          ans+=(last[i-1]-prev[i-1]+1);
          ans=ans%mod;
     }
     cout<<ans<<"\n";
	return 0; 
}

Measured memory_bytes: 6744
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define _ << " _ " <<
#define TRACE(x) cerr << #x << " = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
//#define debug
//#define TRACE(x)

using namespace std;

typedef long long llint;

const int MAXN = 2010;
const llint INF = 1e18;
					     
int n, x, a[MAXN];
llint tot[MAXN], sol;

int main(void) {
  sol = INF;
  
  scanf("%d %d",&n,&x);
  REP(i, n) scanf("%d",&a[i]);

  REP(i, n) {
    int best = a[i];
    REP(rot, n) {
      int j = (i - rot + n) % n;
      best = min(best, a[j]);
      tot[rot] += best;
    }
  }

  REP(rot, n)
    sol = min(sol, tot[rot] + (llint)rot * x);

  printf("%lld\n",sol);
  return 0;
}


Measured memory_bytes: 256
//20171203B
#include <stdio.h>
int main(){
	int N;
	int x=0;
	scanf("%d",&N);
	int i;
	int M=N;
	while((N/10) != 0){
		x = x + (N%10);
		N = N/10;
	}
	if(N/10 == 0){
		x = x + N;
		}
	if(M%x == 0){
		printf("Yes");
	}else{
		printf("No");
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  ll N;
  cin>>N;
  vector<ll> A(N);
  cin>>A;
  reverse(A.begin(),A.end());
  ll cnt=0;
  ll ans=0;
  for(int i=1;i<N;i++){
    if(A[i]>=A[i-1]){cnt++;}
    else{cnt=0;}
    ans=max(ans,cnt);
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;

int main()
{
	int n;
	for(int i = 1;;i++)
	{
		cin >> n;
		if(n == 0)
			break;
		cout << "Case " << i << ": " << n <<"\n";
	}
}

Measured memory_bytes: 3016
#include<bits/stdc++.h>
#define MOD (int)(1e9 + 7)
#define MAX (ll)(6e4 + 7)

using namespace std;
using ll = long long;

int main () {
	ll h, w;
	cin >> h >> w;
	if (h == 1 || w == 1) {
		cout << "1\n";
		return 0;
	}
	cout << (h * w + 1) / 2 << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int n;
    cin>>n;
    cout<<n*n<<endl;
    return 0;
}

Measured memory_bytes: 256
dice = [int(i) for i in input().split()]
dir = input()
dev1 = [0, 1, 5, 4]
dev2 = [0, 3, 5, 2]
dev3 = [1, 3, 4, 2]
current = 0
for i in dir:
    if i == "W":
        current = dev2[dev2.index(current) - 1]
        dev1.reverse()
        dev1, dev3 = dev3, dev1
    elif i == "S":
        current = dev1[dev1.index(current) - 1]
        dev3.reverse()
        dev2, dev3 = dev3, dev2
    elif i == "N":
        if dev1.index(current) == 3:
            current = dev1[0]
        else:
            current = dev1[dev1.index(current) + 1]
        dev2.reverse()
        dev2, dev3 = dev3, dev2
    elif i == "E":
        if dev2.index(current) == 3:
            current = dev2[0]
        else:
            current = dev2[dev2.index(current) + 1]
        dev3.reverse()
        dev1, dev3 = dev3, dev1
print(dice[current])



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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define PI acos(-1.0)
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define MOD 1000000007
#define MOD1 1000000005
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, 1};
int dy4[] = {1, -1, 1, -1};
//#define fio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    int t;
    cin>>t;
    if(t>=30)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<50;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const vi emp;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

int d,n,m;

int main(){
	while(1){
		cin>>d;
		if(!d) break;
		cin>>n>>m;
		vi a(n+1);
		a[0]=0;
		a[n]=d;
		for(int i=1;i<n;i++) cin>>a[i];
		sort(a.begin(),a.end());
		int ans=0;
		for(int i=0;i<m;i++){
			int s,res;
			cin>>s;
			auto it=lower_bound(a.begin(),a.end(),s);
			res=abs(*it-s);
			it--;
			res=min(res,abs(*it-s));
			ans+=res;
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 3280