akhauriyash/Code-Regression huggingface dataset:
import sys
bbn=1000000007
	
#+++++

		
def main():
	jk=10**9
	n,k,s = map(int, input().split())
	if n == jk and k==1 and s==jk:
		ret = ['1']*jk
		print(' '.join(ret))
		return
	bb=jk if s !=jk else 1
	ret =([str(s)] * k) + ([str(bb)]*(n-k))
	print(' '.join(ret))
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 7036
C = [parse.(split(readline())) for _ in 1:3]
ans = 1
for i in 1:2
  if C[i+1][3] - C[i][3] ==  C[i+1][1] - C[i][1]  && C[i+1][2] - C[i][2] ==  C[i+1][1] - C[i][1]
    continue
  else
    ans = 0
  end
end

for i in 1:2
  if C[3][i+1] - C[3][i] ==  C[1][i+1] - C[1][i]  && C[2][i+1] - C[2][i] ==  C[1][i+1] - C[1][i]
    continue
  else 
    ans = 0
  end
end

if ans == 1
  print("Yes")
else
  print("No")
end

Measured memory_bytes: 125384
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;

bool check(int a, int b) {
	return a > b;
}

int main() {
	int x;
	cin >> x;
	int a[4];
	int cnt = 0;
	rep(i, 4) {
		a[3 - cnt] = x % 10;
		x /= 10;
		cnt++;
	}
	cout << a[0];
	int tmp;
	rep(i, 8) {
		cnt = a[0];
		tmp = i;
		rep(j, 3) {
			if (tmp % 2 == 0) {
				cnt += a[j + 1];
			}
			else {
				cnt -= a[j + 1];
			}
			tmp /= 2;
		}
		if (cnt == 7) {
			tmp = i;
			rep(j, 3) {
				if (tmp % 2 == 0) {
					cout << "+" << a[j + 1];
				}
				else {
					cout << "-" << a[j + 1];
				}
				tmp /= 2;
			}
			cout << "=7" << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
/*
[abc148] E - Double Factorial
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

ll N;

ll solve() {
    if (N % 2 == 1) {
        return 0;
    }

    ll ans = 0;
    for (ll p = 10; p <= N; p *= 5) {
        ans += N / p;
    }

    return ans;
}

int main() {
    cin >> N;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){
  int n, k;
  string s;
  cin >> n >> k >> s;
  s[k-1] -= ('A' - 'a');
  cout << s << endl;
}

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

int n, a, b, c, d;
unordered_map<int, int> q;

int solve(int n) {
    if (n == 0)
        return 0;
    if (n == 1)
        return d;
    if (q[n])
        return q[n];
    int mans = n * d;
    if (n > 9e18 / d)
        mans = 9e18;
    if (n % 2 == 0)
        mans = min(mans, a + solve(n / 2));
    else if (n % 2 == 1)
        mans = min(mans, a + d + min(solve(n / 2), solve(n / 2 + 1)));
    if (n % 3 == 0)
        mans = min(mans, b + solve(n / 3));
    else if (n % 3 == 1)
        mans = min(mans, b + d + solve(n / 3));
    else if (n % 3 == 2)
        mans = min(mans, b + d + solve(n / 3 + 1));

    if (n % 5 == 0)
        mans = min(mans, c + solve(n / 5));
    else if (n % 5 == 1)
        mans = min(mans, c + d + solve(n / 5));
    else if (n % 5 == 2)
        mans = min(mans, c + d + d + solve(n / 5));
    else if (n % 5 == 3)
        mans = min(mans, c + d + d + solve(n / 5 + 1));
     else if (n % 5 == 4)
        mans = min(mans, c + d + solve(n / 5 + 1));
    //cout << n << ' ' << mans << endl;
    return q[n] = mans;


}

signed main()
{
    int t;
    cin >> t;
    while(t--) {
        q.clear();
        cin >> n >> a >> b >> c >> d;
        cout << solve(n) << "\n";
    }
    return 0;
}


Measured memory_bytes: 4120
package main

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

//=====I/O=====

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInt64() int64 {
	sc.Scan()
	a,_ := strconv.ParseInt(sc.Text(),10,64)
	return a
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

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

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//=====main=====

func main() {
	sc.Split(bufio.ScanWords)

	x,y := scanInt(), scanInt()

	if (x+y)%3 != 0 || (x<y&&x*2<y) || (x>y&&y*2<x) {
		fmt.Println(0)
	} else {
		facInit(x+y)
		fmt.Println(comb((x+y)/3, x-(x+y)/3))
	}
}

const mod = 1000000007

var (
	fac []int
	ifac []int
)

func facInit(n int) {
	fac = make([]int,n+1)
	ifac = make([]int,n+1)
	
	mpow := func (x,n int) int {
		a := 1
		for {
			if n&1 == 1 {
				a = a*x %mod
			}
			x = x*x %mod
			n = n >> 1
			if n == 0 {
				break
			}
		}
		return a
	}

	fac[0] = 1
	ifac[0] = 1
	for i := 0; i < n; i++ {
		fac[i+1] = fac[i]*(i+1)%mod
		ifac[i+1] = ifac[i]*mpow(i+1,mod-2)%mod
	}
}

func comb(a,b int) int {
	if a == 0 && b == 0 {
		return 1
	}
	return (fac[a]*ifac[b]%mod)*ifac[a-b]%mod
}


Measured memory_bytes: 32896
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#if defined(_MSC_VER)
#pragma warning(disable : 4996)  // VSでscanfを使う．
#endif

signed main() {
  int n, l;
  cin >> n >> l;

  int sum = 0;
  int abs_min = 1e9;
  int abs_min_idx = -1;

  for (int i = 0; i < n; i++) {
    int t = l + i;
    sum += t;

    if (abs_min > abs(t)) {
      abs_min = abs(t);
      abs_min_idx = i;
    }
  }

  cout << sum - (l + abs_min_idx) << endl;

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3.4

# abc128_b

def main():
    # Input
    n, = [int(s) for s in input().split()]
    reports = [input().split()+[i+1] for i in range(n)]
    # Get ans
    for repo in reports:
        repo[1] = int(repo[1])
    reports.sort(key=lambda r: (r[0], -r[1]))
    # Output
    for repo in reports:
        print(repo[2])

if __name__ == '__main__':
    main()



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

// ans=10^n-9^9-9^9

const long long mod=1e9+7, maxn=1e6+2;
long long facto[maxn];
long long n;

long long modpow(long long x, int y){
	long long ret=1;
	while (y>0){
		if (y&1){
			ret*=x;
			ret%=mod;
		}
		x*=x;
		x%=mod;
		y>>=1;
	}
	return ret;
}

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

long long comb(long long x, long long y){
	return (((facto[x]*modinv(facto[x-y]))%mod)*modinv(facto[y]))%mod;
}

void init(){
	facto[0]=1;
	for (int i=1;i<maxn;i++) facto[i]=(facto[i-1]*i)%mod;
}

int main(){
	init();
	cin >> n;
	if (n==1) cout << 0 << "\n";
	else cout << ((((modpow(10,n)-modpow(9,n)+mod)%mod-modpow(9,n)+mod)%mod+modpow(8,n))%mod) << "\n";
}

Measured memory_bytes: 11436
#include<stdio.h>

int main()
{
	int A,B,C;

	scanf("%d %d %d",&A,&B,&C);

	if(A==B)printf("%d\n",C);

	if(A==C)printf("%d\n",B);

	if(B==C)printf("%d\n",A);

	return 0;
}


Measured memory_bytes: 128
#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <tuple>
#include <utility>
#include <limits>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

template<typename T, size_t N>
constexpr size_t NELEMS(T (&)[N]) { return N; }

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

int INF = 999999999;

int N, M;
int CS[21];

void solve()
{
    // i???????????§????????????????????£???j???????????¨??????????°??????°
    int dp[21][50001];

    // ???????????????????????????0??????????????¨?????§??????
    dp[0][0] = 0;
    // ???????????????????????????1?????\?????????????????¨?????§?????????
    for(int i = 1; i <= N; ++i) {
        dp[0][i] = INF;
    }

    // DP
    // i?????????????????????????????????????????§??´?????????
    // ?????????j < CS[i] ??????i????????????????????????????????????????????§????????´??????
    //   ?????????????????? dp[i-1][j]         ?????????
    //   ????????????     1 + dp[i][j-CS[i]] ?????????
    FOR(i, 1, M+1) {
        FOR(j, 0, N+1) {
            if(j < CS[i]) {
                dp[i][j] = dp[i-1][j];
            }
            else {
                dp[i][j] = min(dp[i-1][j], 1+dp[i][j-CS[i]]);
            }
        }
    }

    cout << dp[M][N] << "\n";
}

int main()
{
    cin >> N >> M;
    REP(i, M) {
        cin >> CS[i+1];
    }

    solve();

    return 0;
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.rbegin(), a.rend());

	long long sum = 0;
	bool f = true;
	int it = 0;
	for (int i = 1; i < n; i++) {
		sum += a[it];

		if (f) {
			f = false;
			it++;
		}
		else {
			f = true;
		}
	}
	cout << sum << endl;

	return 0;
}

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

int main(){
  int A,B,r=0;
  cin >> A >> B;
  for(int i=A; i<=B; i++){
    int x=i%10, k=i/10000%10;
    int y=i/10%10, z=i/1000%10;
    if(x==k && y==z){
      r++;
    }
  }
  cout << r << endl;
}

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

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 i,k;

    cin>>k;
    for(i=0;i<32;i++)
    {
        if(i==(k-1))
        {
            cout<<a[i]<<endl;
            return 0;
        }
    }
}


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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


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

    rep(i,s.size())
    {
        if( i == 3 ) cout << 8;
        else cout << s[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    char a;
    scanf("%c",&a);

    switch(a){
    case 'a':
         case 'e':
         case 'i':
         case 'o':
         case 'u':
        printf("vowel");
        break;
         default:
            printf("consonant");
            break;

    }
    return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    int N, K;
    cin >> N >> K;
    int cnt = 0;
    while (N>0) {
        N /= K;
        cnt++;
    }
    cout << cnt << endl;


	return 0;
}


Measured memory_bytes: 256
from itertools import product

n, m = map(int, input().split())
k = []
s = []
for _ in range(m):
    a, *b = map(int, input().split())
    k.append(a)
    s.append(b)
p = list(map(int, input().split()))
print(sum(all(sum(i[b - 1] for b in a) % 2 == x for a, x in zip(s, p)) for i in product((0, 1), repeat=n)))

Measured memory_bytes: 9104
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=chomp(readline())
    n=length(s)
    k=parseInt(readline())
    res=1
    cnt=[]
    for i in 2:n+1
        if i==n+1 || s[i]!=s[i-1]
            push!(cnt,res)
            res=1
        else
            res+=1
        end
    end
    ans=sum(map(x->x÷2,cnt))*k
    if s[1]==s[end]
        if length(cnt)==1
            ans=sum(map(x->x,cnt))*k÷2
        else
            ans=sum(map(x->x÷2,cnt))*k
            ans-=(cnt[1]÷2+cnt[end]÷2-(cnt[1]+cnt[end])÷2)*(k-1)
        end
    end
    println(ans)
end
main()

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

int main(){
  string s; cin>>s;
  long long ans=0,t;
  for(int i=0;i<(1<<(s.size()-1));i++){
    t=s[0]-'0';
    for(int j=0;j<s.size();j++){
      if(j==s.size()-1||i&1<<j){
        ans+=t;
        t=0;
      }
      t*=10;
      t+=s[j+1]-'0';
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
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;
}


ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}
 
ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}

using namespace std;

void solve()
{
	int n;
	cin>>n;
	vector<ll>a(n);
	rep(i,n)cin>>a[i];
	rep(i,n){
		if(a[i]==0){
			cout<<0;
			return;
		}
	}
	const ll m=1000000000000000000;
	ll mul=1;
	rep(i,n){
		if(mul>(m+a[i]-1)/a[i]){
			cout<<-1;
			return;
		}
		mul*=a[i];
		if(mul>m){
			cout<<-1;
			return;
		}
	}
	cout<<mul;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 3940
/*
問題
すぬけ君は、AtCoder s Contest という名前のコンテストを開こうとしています。 ここで、s は長さ 1 以上の文字列であり、1 文字目は英大文字、2 文字目以降は英小文字です。
すぬけ君は、このコンテストの略称を AxC に決めました。 ここで、x は s の先頭の英大文字です。
コンテストの名前が与えられるので、コンテストの略称を出力してください。
*/

/*
基本方針
strは空白で切れてしまうので3つのstrを作って2番目の先頭を参照したい
*/


#include<iostream>
#include<string>

int main(){
	int temp;
	std::string str[3]; //strを三つ
	
	for (int i = 0; i < 3; i++){
		std::cin >> str[i];
	}

	std::cout << "A"<<str[1][0]<<"C"; //2番目の1文字目が欲しいかった

	return 0;
}

//エラーは出ないけど謎の挙動をした

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			int n = cin.Int();
			int m = cin.Int();
			var uf = new UnionFind(n);
			for (int i = 0; i < m; i++) {
				int x = cin.Int();
				int y = cin.Int();
				int z = cin.Int();
				uf.TryUnite(x - 1, y - 1);
			}

			Console.WriteLine(uf.GroupCount);
		}
	}

	public class UnionFind
	{
		private List<int> sizes_;
		private List<int> parents_;

		public int Count { get; private set; }
		public int GroupCount { get; private set; }

		public UnionFind(int count)
		{
			parents_ = new List<int>(count);
			sizes_ = new List<int>(count);

			Count = 0;
			GroupCount = 0;

			ExtendSize(count);
		}
		public bool TryUnite(int x, int y)
		{
			int xRoot = Find(x);
			int yRoot = Find(y);
			if (yRoot == xRoot) {
				return false;
			}

			int parent = sizes_[xRoot] < sizes_[yRoot] ? yRoot : xRoot;
			int child = sizes_[xRoot] < sizes_[yRoot] ? xRoot : yRoot;

			GroupCount--;
			parents_[child] = parent;
			sizes_[parent] += sizes_[child];

			return true;
		}
		public IEnumerable<int> AllRepresents => parents_.Where(x => x == parents_[x]);
		public int GetSize(int x) => sizes_[Find(x)];

		public int Find(int x)
		{
			while (x != parents_[x]) {
				parents_[x] = parents_[parents_[x]];
				x = parents_[x];
			}

			return x;
		}

		public void ExtendSize(int treeSize)
		{
			if (treeSize <= Count) {
				return;
			}

			parents_.Capacity = treeSize;
			sizes_.Capacity = treeSize;
			while (Count < treeSize) {
				parents_.Add(Count);
				sizes_.Add(1);
				Count++;
				GroupCount++;
			}
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;
		
		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int()
		{
			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] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			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] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			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] = Double() + add;
			}
			return Array;
		}
	}
}


Measured memory_bytes: 17880
package main

import (
	"fmt"
	"sort"
)

func main() {
  
  Rally()
 
}

//Rally test
func Rally() {

	var N int

	fmt.Scan(&N)

	coordinates := make([]int, N)

	for i := 0; i < N; i++ {

		fmt.Scan(&coordinates[i])
	}

	sort.Sort(sort.IntSlice(coordinates))

	min := coordinates[0]

	max := coordinates[N-1]

	count := (max - min) + 1

	result := make([]int, count)

	sum := 0

	icount := 0

	for i := min; i <= max; i++ {

		for j := 0; j < N; j++ {

			sum += (coordinates[j] - i) * (coordinates[j] - i)

		}

		result[icount] = sum

		icount++
		sum = 0

	}

	sort.Sort(sort.IntSlice(result))

	fmt.Println(result[0])

}

Measured memory_bytes: 512
import java.io.*;
import java.math.*;
import java.util.*;
 
public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;
 
    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);
 
    private void solve(Scanner sc) {
        int N = sc.nextInt();
        int[] s = new int[N];
        for (int i = 0; i < N; ++i) {
            s[i] = sc.nextInt();
        }
 
        int sum = Arrays.stream(s).sum();
        if (sum % 10 != 0) {
            _out.println(sum);
        } else {
            Arrays.sort(s);
            for (int i = 0; i < N; ++i) {
                if (s[i] % 10 != 0) {
                    _out.println(sum - s[i]);
                    return;
                }
            }
            _out.println(0);
        }
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();
 
        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();
 
        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 27092
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  ll n,k; cin >>n>>k;
  ll ans=0;
  rep2(i,k+1,n+1){
    ans+=n/i*(i-k);
    if(n%i>=k){
      if(k!=0)ans+=n%i-k+1;
      else ans+=n%i-k;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3604
n,m=map(int,input().split())
l=[set(map(int,input().split())) for _ in range(m)]
S=set()
G=set()
for x in l:
	if 1 in x:S.add(max(x))
	elif n in x:G.add(min(x))
S=sorted(S)
G=sorted(G)
i=0
Glen=len(G)
for x in S:
	if i==Glen:break
	elif G[i]<x:
		while i<Glen and G[i]<x:
			i+=1
	if i<Glen and x==G[i]:
		print('POSSIBLE')
		exit()
print('IMPOSSIBLE')


Measured memory_bytes: 68876
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin

mod = 1000000007

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

def main():
    N, K = map(int, input().split())
    A = [int(x) for x in input().split()]

    ini = 0
    for i in range(N):
        for j in range(N):
            if i < j and A[i] > A[j]:
                ini += 1


    diff = 0
    for i in range(N):
        for j in range(N):
            if A[i] > A[j]:
                diff += 1

    #ans = int(( 2*ini + (K-1)*diff ) * K / 2)
    ans = ((2*ini+(K-1)*diff) % (10**9+7)) * K % (10**9+7)
    ans = ans * mod_inv(2,mod) % (10**9+7)
    print(ans)

input = lambda: stdin.readline().rstrip()
main()

Measured memory_bytes: 3564
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("5 3 5");
            WillReturn.Add("1");
            WillReturn.Add("2");
            WillReturn.Add("3");
            WillReturn.Add("6");
            WillReturn.Add("12");
            //3
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("6 3 3");
            WillReturn.Add("7");
            WillReturn.Add("6");
            WillReturn.Add("2");
            WillReturn.Add("8");
            WillReturn.Add("10");
            WillReturn.Add("6");
            //3
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
        int N = wkArr[0];
        int C = wkArr[1];
        int K = wkArr[2];

        int[] TArr = InputList.Skip(1).Select(X => int.Parse(X)).ToArray();
        Array.Sort(TArr);

        var JyoukyakuList = new List<int>();
        int NeedBusCnt = 0;
        foreach (int EachT in TArr) {
            bool WillClear = false;

            //バスの定員に達している場合
            if (JyoukyakuList.Count == C) WillClear = true;

            //待ち時間を超える場合
            if (JyoukyakuList.Count > 0) {
                if (JyoukyakuList[0] + K < EachT) WillClear = true;
            }

            if (WillClear) {
                JyoukyakuList.Clear();
                NeedBusCnt++;
            }

            JyoukyakuList.Add(EachT);
        }
        NeedBusCnt++;
        Console.WriteLine(NeedBusCnt);
    }
}


Measured memory_bytes: 26332
#include <algorithm>
#include <iostream>
#include <vector>
#include <cassert>
using namespace std;
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }

int main() {
    int n; cin >> n;
    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
    bool pari = (abs(x[0]) + abs(y[0])) % 2;
    for (int i = 0; i < n; i++) {
        if ((abs(x[i]) + abs(y[i])) % 2 != pari) return !(cout << -1 << endl);
    }
    vector<int> ds;
    for (int i = 30; i >= 0; i--) ds.emplace_back(1 << i);
    if (!pari) ds.emplace_back(1);
    cout << ds.size() << endl << ds << endl;
    for (int i = 0; i < n; i++) {
        int gu = x[i] + y[i], gv = x[i] - y[i];
        for (int d: ds) {
            if (gu >= 0) {
                if (gv >= 0) cout << "R", gu -= d, gv -= d;
                else cout << "U", gu -= d, gv += d;
            } else {
                if (gv >= 0) cout << "D", gu += d, gv -= d;
                else cout << "L", gu += d, gv += d;
            }
        }
        cout << endl;
        assert(gu == 0 && gv == 0);
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n;
	cin>>n;
	while(n--){
		int a,b;
		cin>>a>>b;
		int out=127*(a-1);
		rep(i,a-1)b^=127;
		cout<<out+b<<endl;
	}
}








Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=float('inf')
for i in range(2**n):
    x=format(i,'015b')
    Max=0
    yen=0
    for j in range(1,n+1):
        if x[-j]=='1':
            if Max<a[j-1]:
                Max=a[j-1]
            else:
                Max+=1
                yen+=Max-a[j-1]
        else:
            Max=max(Max,a[j-1])
    #print(x)
    temp=0
    for j in range(15):
        temp+=int(x[j])
    #print(temp,k)
    if temp>=k:
        ans=min(ans,yen)
print(ans)

Measured memory_bytes: 9212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF=1e18,MOD=1e9+7;
int main(){
	int n;
	cin>>n;
	vector<int>h(n);
	for(int i=0;i<n;i++)cin>>h[i];
	int ans=0;
	bool flag;
	ans++;
	for(int i=1;i<n;i++){
		flag=true;
		for(int j=0;j<i;j++){
			if(h[i]<h[j])flag=false;
		}
		if(flag)ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MAXSIZE 10000000;

bool comp(const pair<string,int> a, const pair<string,int> b) {
  if (a.first != b.first)
    return a.first < b.first; // 高い順に並べたいので演算子を逆に
  else{
      return a.second > b.second;
  }
}

int Dx[6] = { 0, 0, 1, 1,-1,-1};
int Dy[6] = { 1,-1, 1, 0, 0,-1};

//priority_queue<long long int,vector<long long int>, greater<long long int>> PQ;
//priority_queue<long long int> PQ1;
int main(){
    int N;
    string boins = "aiueo";
    vector <int> ansList;

    while(cin >>N,N){
        vector<string> name;
        vector<string> codes;
        int maxLen = -1;
        int k = -1;

        for(int i = 0;i<N;i++){
            string s;
            cin >>s;
            name.push_back(s);
        }

        for(int i = 0;i<N;i++){
            string code = "";
            code += name[i][0];

            for(int j = 1;j<(int)name[i].size();j++){
                if(boins.find(name[i][j-1]) != std::string::npos){
                    code += name[i][j];
                }
            }
            codes.push_back(code);

            maxLen = max(maxLen,(int)code.size());
        }
        int ans = -1;

        for(int i = 1;i<51;i++){
            set<string> st;
            for(int j = 0;j<N;j++){
                st.insert(codes[j].substr(0,i));
            }
            if(st.size() == N){
                ans = i;
                break;
            }
        }
        ansList.push_back(ans);
    }

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

/*Syakutori
while(cin >>b && b)){
      ll t = 1;
      long long int ansS = 1,ansT=0;
      long long int sum = 0;

      for(ll s = 1;s < 50000000;s++){

        while(t <  50000000 && sum+Rsum[t] < b){
          sum += Rsum[t];
          t++;
        }
        if(b == sum+Rsum[t]){
          if(ansT - ansS < t-s){
            ansS = s;
            ansT = t;
          }
          cout <<ansS<<" "<<ansT-ansS + 1<<endl;
          break;
        }
        if(t == s)++t;
        else sum -= Rsum[s];
        }
    }

*/


Measured memory_bytes: 3176
#include <stdio.h>



int main() {
    int i, j, Min, p, q, r, n, w[101][101], key[101], d[101];
    scanf("%d", &n);
    for ( i = 0; i < n; i++ ) {
        key[i] = 0;
        d[i] = 200001;
        for ( j = 0; j < n; j++ ) {
            w[i][j] = -1;
        }
    }
    for ( i = 0; i < n; i++ ) {
        scanf("%d %d", &p, &q);
        for ( j = 0; j < q; j++ ) {
            scanf("%d", &r);
            scanf("%d", &w[p][r]);
        }
    }
    d[0] = 0;
    while ( 1 ) {
        Min = 200001;
        for ( i = 0; i < n; i++ ) {
            if ( key[i] != 1 && d[i] < Min ) {
                Min = d[i];
                p = i;
            }
        }
        if ( Min == 200001 ) break;
        for ( i = 0; i < n; i++ ) {
            if ( w[p][i] != -1 && key[i] != 1 && d[p] + w[p][i] < d[i] )
            d[i] = d[p] + w[p][i];
        }
        key[p] = 1;
    }
    for ( i = 0; i < n; i++ ) {
        printf("%d %d\n", i, d[i]);
    }
    return 0;
}



Measured memory_bytes: 2080
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_9_A
// Heaps - Complete Binary Tree

#define SUBMIT

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <limits>
#include <numeric>
#include <functional>
#include <set>
#include <cmath>
#include <cstring>
#include <climits>
#include <memory>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

const int MAX_H = 250;
int A[MAX_H + 1];

int parent_index(int i) { return i / 2; }

int left_index(int i) { return 2 * i; }

int right_index(int i) { return 2 * i + 1; }

int main() {
    memset(A, 0, sizeof(A));
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> A[i];

    for (int i = 1; i <= n; ++i) {
        cout << "node " << i << ": key = " << A[i] << ", ";
        if (parent_index(i) >= 1) cout << "parent key = " << A[parent_index(i)] << ", ";
        if (left_index(i) <= n) cout << "left key = " << A[left_index(i)] << ", ";
        if (right_index(i) <= n) cout << "right key = " << A[right_index(i)] << ", ";
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
long long n,q,h,s,d,minn,maxn,ans;
int main()
{
  scanf("%d%d%d%d%d",&q,&s,&h,&d,&n);
  minn=min(q*4,min(s*2,h));
  maxn=min(min(q*8,s*4),min(h*2,d));
  ans=(n%2?(n-1)*maxn/2+minn:n*maxn/2);
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int P;

ll powmod(ll n, ll k) {
    ll r = 1, t = n % P;
    for (; k != 0; k /= 2) {
        if (k & 1) r = r * t % P;
        t = t * t % P;
    }
    return r;
}
ll inv(ll n) {
    return powmod(n, P - 2);
}

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

    int n;
    cin >> n >> P;

    string s;
    cin >> s;
    for (int i = 0; i < n; i++) {
        s[i] -= '0';
    }

    ll ans = 0;
    if (10 % P == 0) {
        for (int i = 0; i < n; i++) {
            if (s[i] % P == 0) ans += i + 1;
        }
        cout << ans << endl;
        exit(0);
    }

    vector<int> r(P), r2(n + 1), d(n);

    d[n - 1] = 1;
    for (int i = n - 2; i >= 0; i--) {
        d[i] = d[i + 1] * 10 % P;
    }

    r2[n] = 0;
    for (int i = n - 1; i >= 0; i--) {
        r2[i] = (r2[i + 1] + d[i] * s[i]) % P;
    }

    int t = 0;
    for (int i = 0; i < n; i++) {
        r[t]++;
        t += s[i] * d[i];
        t %= P;

        //s[i]が最下位になるような取り方のとき
        //x * d[i] == r0 - r2[i + 1] - ; y*d[i]

        int b = (r2[0] - r2[i + 1]);
        b %= P;
        if (b < 0) b += P;

        //cout << b << ' ' << r[b] << endl;
        ans += r[b];
    }

    cout << ans << endl;

    //下k桁をPで割ったあまりは求まる
    //上k桁をPで割ったあまりは求まる
    //最下位がk桁目になるような取り方のとき、10^k倍して下k桁のあまりを足せばいい あまりが何になれば割り切れるかわかる
    //10^kしたときに
    //5で割り切れるかどうかって10をかけることで変わるわ それ以外なら変わらないから元の位置で考えられる！

    return 0;
}

Measured memory_bytes: 2196
#include<iostream>
#include<string>
//#include<cmath>
#include<array>
#include<algorithm>
//#include<deque>
#include<vector>
//#include<utility>
//#include<set>
//#include<map>
//#include<list>
//#include<bitset>
#include<iomanip>

using namespace std;
using LLI = long long int;
LLI N;

//array<int, 8>dir_x = { 0,0,1,1,1,-1,-1,-1 };
//array<int, 8>dir_y = { 1,-1,1,0,-1,1,0,-1 };
//array<int, 4>dir_x2 = { 0,0,1,-1 };
//array<int, 4>dir_y2 = { 1,-1,0,0 };
//char alp[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };

//class UnionFind {
//public:
//	vector<int>data;
//	UnionFind(int size) :data(size, -1) {};
//	bool unionset(int x, int y) {
//		x = root(x), y = root(y);
//		if (x != y) {
//			if (data[y] < data[x]) {
//				swap(x, y);
//			}
//			data[x] += data[y];
//			data[y] = x;
//		}
//		return x != y;
//	}
//	bool findset(int x, int y) {
//		return root(x) == root(y);
//	}
//	int root(int x) {
//		return data[x] < 0 ? x : data[x] = root(data[x]);
//	}
//	int size(int x) {
//		return -data[root(x)];
//	}
//};

//LLI gcd(LLI x, LLI y) {
//	LLI  r;
//	if (x < y) {
//		swap(x, y);
//	}
//	r = x % y;
//	while (r != 0) {
//		x = y;
//		y = r;
//		r = x % y;
//	}
//	return y;
//}
//LLI lcm(LLI x, LLI y) {
//	return x / gcd(x, y) * y;
//}

//long nCr(int n, int r) {
//	long ans = 1;
//	for (int i = n; i > n - r; i--) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1; i++) {
//		ans = ans / i;
//	}
//	return ans;
//}

//const int n_max = 8;
//array<array<bool, n_max>, n_max>graph;
//int dfs(int v,int N,array<bool,n_max>visited) {
//	int ret = 0;
//	bool all_visited = true;
//	for (int i = 0; i < N;i++) {
//		if (visited[i] == false) {
//			all_visited = false;
//		}
//	}	
//	if (all_visited) {
//		return 1;
//	}
//	for (int i = 0; i < N;i++) {
//		if (graph[v][i] == false) {
//			continue;
//		}
//		if (visited[i] == true) {
//			continue;
//		}
//		visited[i] = true;
//		ret += dfs(i,N,visited);
//		visited[i] = false;
//	}
//	return ret;
//}

//vector<vector<int>>sub;
//int dfs(int id) {
//	if (sub[id].size() == 0) {
//		return 1;
//	}
//	int minP = (int)1e9;
//	int maxP = 0;
//	for (int i : sub[id]) {
//		int P = dfs(i);
//		minP = min(minP, P);
//		maxP = max(maxP, P);
//	}
//	return minP + maxP + 1;
//}

//#define debug(x) cerr << #x << " : " << x << endl
//#define debugv(x) cerr << #x << " : "; for(auto i:x) cerr << i << ", "; cerr<<endl

int main(void) {
	LLI A, B,r,D,x;
	cin >> r >> D >>x;
	for (int i = 0; i < 10;i++) {
		x = x * r - D;
		cout << x << endl;
	}
}


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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    Int n;
    cin >> n;
    vector<Int> a(n);
    for (Int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }
    Int res = 0;
    vector<bool> used(n, false);
    for (Int i = 0; i < n; i++) {
        if (used[i]) continue;
        if (a[a[i]] == i) {
            used[i] = used[a[i]] = true;
            res++;
        }
    }
    dump(res);
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d=0,e,f,i;
    cin>>a>>b>>c;
   for(i=a;i<=b;i++)
   {
       if(i%c==0)
       {
           d++;
       }
   }
   cout<<d;
}

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

using namespace std;

using pii = pair<int, int>;
using pll = pair<long long, long long>;

int main() {
    int k;
    cin >> k;
    string s;
    cin >> s;
    for (int i = 0; i < min((int)s.size(), k); i++) {
        cout << s[i];
    }
    if (s.size() > k) {
        cout << "..." << endl;
    }
    else {
        cout << endl;
    }
}

Measured memory_bytes: 3624
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace ABC127
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int A = int.Parse(s[0]);
            int B = int.Parse(s[1]);
            
            Console.WriteLine((A <= 5)? 0:
                              (A < 13)? B / 2: B);
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <limits.h>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
#define INF LLONG_MAX/3
#define inf INT_MAX/3
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a / gcd(a, b)*b;
}
int modpow(int a, int b) {
	if (b == 0)return 1;
	if (b == 1)return a % MOD;
	if (b % 2)return modpow(a, b - 1)*a%MOD;
	else return modpow(a, b / 2)*modpow(a, b / 2) % MOD;
}
int comb(int a, int b) {
	if (b == 0 || a == b)return 1;
	if (b == 1)return a % MOD;
	return (comb(a - 1, b - 1) + comb(a - 1, b)) % MOD;
}
// Library End !

string s;
int m;
int a[100];
int main() {
	while (1) {
		cin >> s;
		if (s == "-")break;
		cin >> m;
		rep(i, m) {
			cin >> a[i];
			s = s.substr(a[i]) + s.substr(0, a[i]);
		}
		cout << s << endl;
	}

	return 0;
}


Measured memory_bytes: 3176
import math
n,k = map(int,input().split())
A = list(map(int,input().split()))

low = 1
high = max(A)

while low != high:
    mid = (low + high)// 2
    cnt = 0
    for i in A:
        cnt += math.ceil(i/mid) - 1
    if cnt > k :
        low = mid + 1
    else:
        high = mid

print(low)

Measured memory_bytes: 104128
st_num = int(input())
st_hei = list(map(int, input().split() ))
max_hei = st_hei[-1]
this_bool = True
for i in reversed(range(0, st_num)):
 this_dif = (st_hei[i] - max_hei)
 if this_dif > 1:
  this_bool = False
  break
 elif this_dif > 0:
  max_hei = max_hei
 else:
  max_hei = st_hei[i]

if this_bool:
 print("Yes")
else:
 print("No")

Measured memory_bytes: 14252
#include <stdio.h>
int main(void){
    int H, N;
    int A;
    scanf("%d %d", &H, &N);
    for(int i=0; i < N; i++){
        scanf("%d", &A);
        H-=A;
    }
    puts((H > 0)? "No": "Yes");
    
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>

using namespace std;


bool is_prime[1299709 + 1];

int main(){
  
  
  for(int i = 0; i <= 1299709; ++i){
    is_prime[i] = true;
  }

  for(int i = 2; i * i <= 1299709; ++i){
    if(is_prime[i]){
      for(int j = 0; i * (j + 2) <= 1299709; ++j){
        is_prime[i * (j+2)] = false;
      }
    }
  }

  while(1){
    int k;
    cin >> k;
    if(k == 0) return 0;
    
    if(is_prime[k] == true){
      cout << "0\n";
    }else{
      int left = k, right = k;
      while(is_prime[left] == false){
        left--;
      }
      while(is_prime[right] == false){
        right++;
      }
      cout << right - left << "\n";
    }
  }
    
}


Measured memory_bytes: 4364
<?php
list($h,$w) = explode(" ",trim(fgets(STDIN)));
$n = trim(fgets(STDIN));
$a = explode(" ",trim(fgets(STDIN)));

$i = 0;
while($i < $h){
$j = 0;
while($j < $w){
$g[$i][$j] = 0;
++$j;
}
++$i;
}


$f = 0;
$o = 0;
$i = 0;
while($i < $n){
$j = 0;
while($j < $a[$i]){
if($f % 2 == 0){
if($o < $w){
$g[$f][$o] = $i + 1;
++$o;
}else{
++$f;
$o = $w - 1;
$g[$f][$o] = $i + 1;
--$o;
}
}else{
if($o >= 0){
$g[$f][$o] = $i + 1;
--$o;
}else{
++$f;
$o = 0;
$g[$f][$o] = $i + 1;
++$o;
}
}
++$j;
}
++$i;
}

foreach($g as $v){
echo join(" ",$v) . PHP_EOL;
}

Measured memory_bytes: 6900
N, M = map(int, input().split())

S = []
for _ in range(M):
    tmp = [int(x) for x in input().split()]
    k = tmp[0]
    S.append(tmp[1:])
P = [int(x) for x in input().split()]

ret = 0
for pt in range(1<<N):
    allOn = True
    for i in range(M):
        swcnt = 0
        for s in S[i]:
            if pt & (1 << (s-1)):
                swcnt += 1
        if swcnt % 2 != P[i]:
            allOn = False
    if allOn:
        ret += 1

print(ret)


    

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

typedef unsigned long ul;
typedef pair<ul, ul> P;

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

    int n, a, b;
    cin >> n >> a >> b;
    int p[n];

    REP(i, n) {
        cin >> p[i];
    }

    int c1 = 0;
    int c2 = 0;
    int c3 = 0;
    REP(i, n) {
        if (p[i] <= a) {
            c1++;
        } else if ((a < p[i]) && (p[i] <= b)) {
            c2++;
        } else {
            c3++;
        }
    }

    int ans = c1;

    if (ans > c2) {
        ans = c2;
    }
    if (ans > c3) {
        ans = c3;
    }

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


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    A, B, C, X, Y = map(int, input().split())
    M = max(X, Y)
    ans = INF
    for i in range(0, 2 * M + 1, 2):
        tmp = i * C
        rest_a = max(X - i // 2, 0)
        rest_b = max(Y - i // 2, 0)
        tmp += rest_a * A + rest_b * B
        if tmp < ans:
            ans = tmp

    print(ans)


if __name__ == "__main__":
    main()


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

int main() {
    int a,b;
    cin >> a >> b;
    vector<int> v;
    v.push_back(a+b);
    v.push_back(a-b);
    v.push_back(a*b);
    cout << *max_element(v.begin(), v.end());
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
main() {
  int d[31];
  int buf,i,w,n,a,b;
  scanf("%d%d",&w,&n);
  for(i=1;i<=w;i++) {
    d[i]=i;
  }
  for(i=0;i<n;i++) {
    scanf("%d,%d",&a,&b);
    buf=d[a];d[a]=d[b];d[b]=buf;
  }
  for(i=1;i<=w;i++) printf("%d\n",d[i]);
}

Measured memory_bytes: 0
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


S = input()
print('Yes' if S[2] == S[3] and S[4] == S[5] else 'No')

Measured memory_bytes: 38384
#include <stdio.h>

using namespace std;

long long Fibonacci[43] = {0};

long long fibo(int n){
	if(n == 0)	return 1;
	else if(n == 1)	return 1;
	else{
		if(Fibonacci[n-1] != 0 && Fibonacci[n-2] != 0){
			//Do nothing
		}else if(Fibonacci[n-1] != 0){
			Fibonacci[n-2] = fibo(n-2);
		}else if(Fibonacci[n-2] != 0){
			Fibonacci[n-1] = fibo(n-1);
		}else{
			Fibonacci[n-1] = fibo(n-1);
			Fibonacci[n-2] = fibo(n-2);
		}
		return Fibonacci[n-1] + Fibonacci[n-2];
	}
}

int main(){
	int n;
	scanf("%d",&n);
	printf("%lld\n",fibo(n));
}



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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> Pair;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
// const int MOD = 1e9 + 7;
const int MOD = 998244353;
const ll LINF = 1e18;
int N;
V X, Y;

int main() {
    double pi = atan(1) * 4;
    cin >> N;
    X.resize(N);
    Y.resize(N);
    REP(i, N) cin >> X[i] >> Y[i];
    REP(i, N) {
        vector<double> D;
        REP(j, N) if(i != j) {
            ll dx = X[j] - X[i];
            ll dy = Y[j] - Y[i];
            D.push_back(-atan2(dx, dy));
        }
        sort(All(D));
        D.push_back(D[0] + 2 * pi);
        double ret = 0;
        REP(j, D.size() - 1) {
            if(D[j + 1] - D[j] >= pi) ret = (D[j + 1] - D[j]) - pi;
        }
        printf("%.12lf\n", ret / (2 * pi));
    }
}


Measured memory_bytes: 256