akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<functional>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    string s,ans="";
    cin>>s;
    rep(i,s.size()){
        if(s[i]=='0'){
            ans+="0";
        }
        else if(s[i]=='1'){
            ans+="1";
        }
        else{
            if(ans.size()>0)ans.erase(ans.end()-1);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		char[] s = scan.next().toCharArray();
		int x,y;
		x = (s[0]-'0')*10 +(s[1]-'0');
		y = (s[2]-'0')*10 + (s[3] - '0');// your code goes here
		int mask= 0;
		if(x<=12&&x>0){
			mask |= 1;
		}
		if(y<=12&&y>0){
			mask |=2;
			
		}
		if(mask==3){
			System.out.println("AMBIGUOUS");
		}else if(mask==2){
			System.out.println("YYMM");
		}else if(mask==1){
			System.out.println("MMYY");
		}else{
			System.out.println("NA");
		}
		
		
		
	}
}

Measured memory_bytes: 23764
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

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

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n)
        cin >> a[i];

    double bunbo = 0.0;
    REP(i, n){
        bunbo += 1.0 / a[i];
    }
    printf("%.14f\n", 1.0 / bunbo);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
  ll ans=1;
  for(int i=1;i<=n;i++)
       ans*=a;
    return ans;
}

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

ll a,b,h,m;
cin>>a>>b>>h>>m;
long double angle=abs(6*m- 0.5*(h*60+m));
angle=min(360-angle,angle);
cout<<setprecision(11)<<sqrt(a*a+b*b-2*a*b*(cos((PI*angle)/180)))<<endl;

return 0;
}



Measured memory_bytes: 4180
#include<bits/stdc++.h>
using namespace std;
#define p pair<int,int>
int N, M;
char A[10];
int num[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
string dp[10010];

int main(){
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        cin >> A[i];
        if(dp[num[A[i] - '0']] == ""){
            dp[num[A[i] - '0']] = A[i];
        }else if(dp[num[A[i] - '0']][0] - '0' < A[i] - '0'){
            dp[num[A[i] - '0']] = A[i];
        }
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            if(dp[i] == "") continue;
            string str1 = dp[i] + A[j];
            string& str2 = dp[i + num[A[j] - '0']];
            if(str2.size() < str1.size()){
                str2 = str1;
            } else if(str2.size() == str1.size()){
                for(int k = 0; k < str1.size(); k++){
                    if(str2[k] - '0' > str1[k] - '0') break;
                    else if(str2[k] - '0' < str1[k] - '0'){
                        str2 = str1;
                        break;
                    }
                }
            }
        }
    }
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 37504
#include <bits/stdc++.h>
 
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
 
using namespace std;

ll dp[111][4][2];
string n;
int k;

ll solve(int i, int n0, bool less){
	if(n0 > k) return 0;
	if(i == (int) n.size()) return n0==k;
	ll &aux = dp[i][n0][less];
	if(aux!=-1) return aux;
	aux =0;

	if(less){
		for(int j=0;j<10;j++){
			aux += solve(i + 1, n0 + (j > 0), true);
		}
	}
	else{
		int dig = int(n[i] - '0');
		for(int j=0;j<dig;j++){
			aux+= solve(i+1, n0 + (j > 0), true);
		}
		aux+= solve(i + 1, n0 + (dig>0), false);
	}

	return aux;
}
 
int32_t main(){
	memset(dp,-1, sizeof dp);

	cin >> n >> k;
	cout << solve(0,0,0) << endl;
	return 0;
}

Measured memory_bytes: 256
void main() {
	auto ip = readAs!(ulong[]), X = ip[0], Y = ip[1];
	if(X % Y == 0) {
		writeln(-1);
		return;
	}
	writeln(X);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  using ll = long long;
  int n;
  cin >> n;
  vector<ll> a(n);
  for (auto&& e : a) {
    cin >> e;
    e *= 2;
  }
  auto judge = [&](ll rain0) {
    vector<ll> rain(n + 1);
    rain[0] = rain0;
    for (int i = 0; i < n; i++) {
      rain[i + 1] = a[i] - rain[i];
    }
    if (rain[0] == rain[n]) {
      return 0;
    } else if (rain[0] > rain[n]) {
      return 1;
    } else {
      return -1;
    }
  };
  ll ans0;
  ll upper = 2 * (ll)1e9 + 1;
  ll lower = -1;
  while (true) {
    ll mid = upper + (lower - upper) / 2;
    if (judge(mid) == 0) {
      ans0 = mid;
      break;
    } else if (judge(mid) == 1) {
      upper = mid;
    } else {
      lower = mid;
    }
  }
  vector<ll> ans(n);
  ans[0] = ans0;
  cout << ans[0];
  for (int i = 0; i < n - 1; i++) {
    ans[i + 1] = a[i] - ans[i];
    cout << ' ' << ans[i + 1];
  }
  cout << '\n';
  return 0;
}


Measured memory_bytes: 4996
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

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

	cout << N * (N + 1) / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        while (true) {
            String line = br.readLine();
            if (line.length() == 1 && line.charAt(0) == '0') {
                break;
            }

            int sum = 0;
            for (int i = 0; i < line.length(); i++) {
                sum += line.charAt(i) - '0';
            }
            System.out.println(sum);
        }

    }
}

Measured memory_bytes: 24252
#include <iostream>

using namespace std;

int H, W;

void solve() {
    if(H == 0 && W == 0) return;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            if(i == 0 || i == H -1) {
                cout << "#";
            }else {
                if(j == 0 || j == W - 1) {
                    cout << "#";
                }else {
                    cout << ".";
                }
            }
        }
        cout << endl;
    }
    cout << endl;
}

int main() {
    do {
        cin >> H >> W;
        solve();
    }while(H != 0 || W != 0);
}


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

int kai(int x) {
	int y = x;
	int k = 1;
	while(1) {
		if (y / 10 == 0)
          	break;
      	else {
          	k++;
          	y /= 10;
        }
    }
	stack<int> s;
	for (int i = 1; i <= k/2; i++) {
      	s.push(x%10);
		x /= 10;
    }
 	if (k%2 == 1)
      	x /= 10;
	for (int i = k/2 + 1 + k%2; i <= k; i++) {
		if (s.top() == x%10) {
			s.pop();
			x /= 10;
        }
    }
	if (s.empty())
		return 1;
	else
		return 0;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	int ans = 0;
	for (int i = a; i <= b; i++) {
		ans += kai(i);
    }
	cout << ans << endl;
  	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

const ll MOD = 1000000007;

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n, m;
  cin >> n >> m;
  vector<bool> ng(n+5, false);
  rep(i,m) {
    int a;
    cin >> a;
    ng[a] = true;
  }
  vector<ll> dp(n+5,0);
  dp[0] = 1;
  for (int i = 0; i <= n; ++i) {
    if (!ng[i+1]) {
      dp[i+1] += dp[i];
      dp[i+1] %= MOD;
    }
    if (!ng[i+2]) {
      dp[i+2] += dp[i];
      dp[i+2] %= MOD;
    }
  }
  cout << dp[n] << endl;
  return 0;
}

Measured memory_bytes: 1024
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
H, W = MAP()

a = [input() for _ in range(H)]

for _ in range(W+2):
	print("#", end = "")
print()

for i in range(H):
	print("#" + a[i] + "#")

for _ in range(W+2):
	print("#", end = "")
print()

Measured memory_bytes: 5200
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

const int mod = 1e9 + 7;
const int MX = 4000;
ll inv[MX], f[MX], invf[MX];
void calc(){
	inv[0] = inv[1] = f[0] = f[1] = invf[0] = invf[1] = 1;
	for (int i = 2; i < MX; i++){
		inv[i] = mod - mod / i * inv[mod % i] % mod;
		f[i] = f[i - 1] * i % mod;
		invf[i] = invf[i - 1] * inv[i] % mod;
	}
}
inline ll C(ll n, ll k){
	return f[n] * invf[k] % mod * invf[n - k] % mod;
}

int sum[MX];
ll dp[2][3001];

ll solve(vector<pi> v){
	{
		int last = v.back().second, first = v[0].first;
		v.insert(v.begin(), pi(first, first));
		v.emplace_back(last, last);
	}
	
	//dbg(v);
	
	int n = v.size(), cur = 0, next = 1;
	memset(dp, 0, sizeof(dp));
	dp[0][0] = 1;
	
	for(int i = 1; i + 1 < v.size(); i++){
		memset(dp[next], 0, sizeof(dp[next]));
		
		for(int j = 0; j <= v[i].second - v[i + 1].first; j++){
			int x = sum[v[i].second] - sum[v[i - 1].second];
			
			int l = max(0, j - x);
			int r = min(v[i - 1].second - v[i].first, j - x + v[i + 1].first - v[i].first);
			
			for(int k = l; k <= r; k++){
				ll s = C(v[i + 1].first - v[i].first, x + k - j);
				dp[next][j] += s * dp[cur][k] % mod;
			}
		}
		rep(j, 3001) dp[next][j] %= mod;
		swap(cur, next);
	}
	return dp[cur][0];
}

int main(){
	calc();
	cin.tie(0); cin.sync_with_stdio(0);
	int n, m;
	string s; cin >> n >> m >> s;
	rep(i, n) sum[i + 1] = sum[i] + (s[i] == '1');
	
	vector<vector<pi>> vs;
	vector<pi> v;
	rep(i, m){
		int a, b; cin >> a >> b; a--;
		if(v.size() && v.back().second >= b) continue;
		if(v.size() && v.back().second <= a){
			vs.pb(v);
			v = vector<pi>();
		}
		v.emplace_back(a, b);
	}
	vs.pb(v);
	
	ll ans = 1;
	for(const auto &i : vs) ans = ans * solve(i) % mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
SS = input()
T = input()

len_SS = len(SS)
len_T = len(T)

flag = False
for i in range(len_SS - len_T + 1):
    window = SS[len_SS - len_T - i:len_SS - i]
    matching = True
    for j in range(len_T):
        if not window[j] == "?":
            if window[j] != T[j]:
                matching = False
                break

    if matching:
        flag = True
        break

if flag:
    SS = list(SS)
    SS[len_SS - len_T - i:len_SS - i] = list(T)
    SS = "".join(SS)
    SS = SS.replace("?", "a")
    print(SS)

else:
    print("UNRESTORABLE")


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

typedef struct Data{
  int area,pos;
} Data;

Data t[20000];

int u[20000];

int n,i;

char str[20001];

int T,U;

int ans,A;

Data B,X;

void D_push(Data data){
  t[T++]=data;
}

Data D_pop(){
  return t[--T];
}

void push(int x){
  u[U++]=x;
}

int pop(){
  return u[--U];
}


void init(){
  ans=T=U=0;
}

Data makeData(int x,int y){
  Data res;
  res.area=x;
  res.pos=y;
  return res;
}

int main(){
  init();
  scanf("%s",str);
  n=strlen(str);

  for(i=0;i<n;i++){

    if(str[i]=='/'){

      if(U==0)continue;
      A=pop();
      X=makeData(i-A,A);
      ans+=i-A;
      while(T>0){
	B=D_pop();
	if(B.pos<A){
	  D_push(B);
	  break;
	}
	X.area+=B.area;
	if(B.pos<X.pos)X.pos=B.pos;
      }
      D_push(X);
    }else if(str[i]=='\\'){
      push(i);
    }

  }
  
  printf("%d\n%d",ans,T);
  for(i=0;i<T;i++){
    printf(" %d",t[i].area);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 644
nums = [int(x) for x in input().split()]
H,W = nums[0],nums[1]
N = int(input())
A = [int(x) for x in input().split()]
co_index = [0 for i in range (N)]; co_index[0] = A[0]
for i in range(1,N):
    co_index[i] = co_index[i-1]+A[i]
field = [[0 for i in range(W)] for j in range(H)]

c = 1
check,index = 0,0
for i in range(H):
    for j in range(W):
        field[i][j] = c
        check += 1
        if check >= co_index[index]:
            c += 1
            index += 1

for i in range(H):
    if i % 2 == 1: field[i].reverse()
for line in field:
    line = [str(elem) for elem in line]
    print(" ".join(line))

Measured memory_bytes: 3956
#include <stdio.h>
#include <limits.h>

int main() {
  long int n, a, min = LONG_MAX;
  scanf("%ld", &n);
  for (int i = 0; i < 5; i++) {
    scanf("%ld", &a);
    if (min > a) {
      min = a;
    }
  }
  long int ans = (n-1) / min + 5;
  printf("%ld\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int N; cin >> N;
    vector<int>A = vector<int>(N+1), B=vector<int>(N);
    for(int i = 0; i <=N; i++){
        cin >> A[i];
    }
    for(int i = 0; i<N; i++){
        cin >> B[i];
    }
    long long num_def = 0;
    for(int i = 0; i < N; i++){
        int defi = min(B[i],A[i]);
        int defj = min(B[i]-defi,A[i+1]);
        B[i] -= (defi + defj);
        A[i] -= defi; A[i+1] -= defj;
        num_def += (defi+defj);
    }
    cout << num_def;
	return 0;
}

Measured memory_bytes: 1024
// 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 h, w, n;
vll ans;
map<pll, ll> m;

int main() {
    fast_io; cout_precision;
    cin >> h >> w >> n;
    ans.assign(10, 0);
    ans[0] = (h - 2) * (w - 2);
    for (ll i = 0, a, b; i < n; i++) {
        cin >> a >> b;
        for (ll x = max(a - 1, ll(2)); x <= min(a + 1, h - 1); x++) {
            for (ll y = max(b - 1, ll(2)); y <= min(b + 1, w - 1); y++) {
                ans[m[{x, y}]]--;
                m[{x, y}]++;
                ans[m[{x, y}]]++;
            }
        }
    }
    for (ll i = 0; i < 10; i++) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 56576
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
m = [True] * (10**6+1)
s = list(set(a))
for u in s:
    t = u * 2
    while t <= 10 ** 6:
        m[t] = False
        t += u
r = 0
for u in s:
    if c[u] == 1 and m[u] == True:
        r += 1
print(r)

Measured memory_bytes: 52652
n,y = map(int,input().split())
l=0
for a in range(n+1):
  for b in range(n+1-a):
    c=n-a-b
    if y==a*10000+b*5000+c*1000 and n==a+b+c:
      i=a
      j=b
      k=c
      
      l=1
      break

if l==1:
  print(i,j,k)
else:
  print(-1,-1,-1)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<map>

using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){

    int N;
    cin >> N;

    vector<int> P(N);
    vector<int> Q(N);
    vector<int> v(N);

    int i;
    for(i=0; i<N; i++) cin >> P.at(i);
    for(i=0; i<N; i++) cin >> Q.at(i);
    

    iota(v.begin(), v.end(), 1); 

    int a, b;
    i=1;

    do{
        if(v == P) a = i;
        if(v == Q) b = i;
        i++;
    }while(next_permutation(v.begin(), v.end()));

    
    cout << abs(a - b) << endl;

    return 0;
}



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

int fib(int n, int FIB[]){
    if (FIB[n]) return FIB[n];
    return FIB[n] = fib(n - 1, FIB) + fib(n - 2, FIB);
}

int main(){
    int n;
    cin >> n;
    int FIB[n+1] = {};
    FIB[0] = 1;
    if (n > 0) FIB[1] = 1;
    cout << fib(n, FIB) << endl;

    return 0;
}

Measured memory_bytes: 3104
def resolve():
  n = int(input())
  a1 = list(map(int, input().split()))
  a2 = list(map(int, input().split()))
  s1 = [0] * (n+1)
  s2 = [0] * (n+1)
  for i in range(n):
    s1[i] = a1[i]
    if i > 0:
      s1[i] += s1[i-1]
  for i in range(n):
    s2[n-i-1] = a2[n-i-1]
    if i > 0:
      s2[n-i-1] += s2[n-i]

  ans = 0
  for i in range(n):
    ans = max(ans, s1[i] + s2[i])

  print(ans)

  return

if __name__ == "__main__":
  resolve()


Measured memory_bytes: 3064
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
s1=''.join(s)
t1=''.join(t)
k=[s1,t1]
k.sort()
if s1==t1:print('No')
elif k[0]==s1:print('Yes')
else:print('No')

Measured memory_bytes: 3060
import java.util.*;
import java.lang.*;
import java.io.*;


public class Main {
    public static void main(String[] args) throws java.lang.Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader((System.in)));
        char[] s = br.readLine().toCharArray();
        int a = 0;
        int b = 0;
        for (int i = 0; i < s.length; i++) {
            a += s[i] == 'A' ? 1 : 0;
            b += s[i] == 'B' ? 1 : 0;
        }
        System.out.println((a == 2 || b == 2) ? "Yes" : "No");
    }
}

Measured memory_bytes: 21332
N = int(input())
h = list(map(int,input().split()))

INF = float('inf')

#DPテーブル
dp = [INF] * N

#最初のコストは0
dp[0] = 0

#最小化問題
#i番目のコストの最小値は、i-1 or i -2 番目までのコストからiまでのコストを足したものの小さい方
for i in range(1,N):
    dp[i] = min(dp[i],dp[i-1] + abs(h[i]-h[i-1]))
    #i=1のときは、i-2番目が存在しない
    if (i > 1):
        dp[i] = min(dp[i],dp[i-2] + abs(h[i]-h[i-2]))

print(dp[N-1])


Measured memory_bytes: 52208
n,l=map(int,input().split())

#まず味リスト作る
a=[l+i for i in range(n)]

#味の絶対値リスト作る
b=[abs(a[i]) for i in range(n)]

temp=0

#味の絶対値リストの中で一番ちいさい要素の"配列番号を"記録する
for i in range(n-1):
  if b[i+1]<b[i]:
    temp=i+1

a.pop(temp)
print(sum(a))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
ll arr[sz],k;
void dpdp(ll lim,ll j,ll val,ll i)
{
    if(k>=200000)
        return;
    val*=10;
    val+=j;
    if(lim==i)
    {
        arr[k++]=val;
        return;
    }
    if(j==0)
    {
        dpdp(lim,0,val,i+1);
        dpdp(lim,1,val,i+1);
    }
   else if(j==9)
    {
        dpdp(lim,9,val,i+1);
        dpdp(lim,8,val,i+1);
    }
    else
    {
       dpdp(lim,j,val,i+1);
        dpdp(lim,j-1,val,i+1);
        dpdp(lim,j+1,val,i+1);
    }
}
int main()
{
    for(int i=1;i<=11 && k<=200000;i++)
    {
        for(int j=1;j<=9 && k<=200000;j++)
        {
            dpdp(i,j,0,1);
        }
    }
  //  printf("%lld\n",k);
    sort(arr,arr+k+1);
    scanf("%lld",&k);
    printf("%lld\n",arr[k]);
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cstdio>

using namespace std;

int main()
{
	char S[10];
	scanf("%s", S);
	int ans = 0;
		for (int i = 0; i < 4; i++){
			if (S[i] == '+')
			{
				++ans;
			}
			else --ans;

		}
		cout << ans << endl;

}



Measured memory_bytes: 256
n,x=list(map(int,input().split(" ")))
xi=list(map(int,input().split(" ")))

xi_=list(map(lambda y:abs(y-x),xi))

i=0
while i<=n-2:
    while xi_[i]!=0 and xi_[i+1]!=0:
        (xi_[i],xi_[i+1])=(max(xi_[i],xi_[i+1])%min(xi_[i],xi_[i+1]),min(xi_[i],xi_[i+1]))
    i+=1

print(xi_[n-1])

Measured memory_bytes: 14252
#include<stdio.h>

void swap(int *p,int *q){
  int r;
  r = *p;
  *p = *q;
  *q = r;
}

int main(void){
  int a,b;
  while(1){
    scanf("%d%d",&a,&b);
    if(a==0 && b==0) break;
    if(a>b) swap(&a,&b);
    printf("%d %d\n",a,b);
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
 
const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

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

    t.pop_back();

    if(s == t)cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 3624
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<stdio.h>
using namespace std;

int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if (a >= b)
		cout << "delicious" << endl;
	else {
		if (x >= b - a)
			cout << "safe" << endl;
		else
			cout << "dangerous" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>  
using namespace std; 
int a[100+1][100+1],dp[100+1][100+1];
int main(){
    int a,b;
    char c;
    scanf("%d %c %d",&a,&c,&b);
    if(c=='+')cout<<a+b;
    if(c=='-')cout<<a-b;
    if(c=='*')cout<<a*b;
    if(c=='/')cout<<a/b;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A;
  cin >> A;
  
  if ( A / 100 == 7){
    cout << "Yes" << endl;
  }
  else if ( (A / 10) % 10 == 7){
    cout << "Yes" << endl;
  }
  else if ( A % 10 == 7){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3628
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

typedef long long ll;

ll n, a, b, c, d;

int main()
{
	cin >> n >> a >> b >> c >> d;
	ll dif = abs(b - a);
	for (ll i = 0; i <= n - 1; i++) {
		ll from = -i * d + (n - 1 - i) * c;
		ll to = -i * c + (n - 1 - i) * d;
		if (from <= dif && dif <= to) { printf("YES\n"); return 0; }
	}
	printf("NO\n");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 500000
#define S 1000000001
 
void merge(int *, int, int ,int);
void mergeSort(int *, int, int);
int cnt;

int main(){
  int n,s[N];
  cin>>n;
  for(int i=0;i<n;i++) cin>>s[i];
  mergeSort(s,0,n);
   
  for(int i=0;i<n-1;i++)cout<<s[i]<<' ';
  cout<<s[n-1]<<endl<<cnt<<endl;
  return 0;
}
 
void merge(int *a,int left,int mid,int right){
  int n1 = mid - left;
  int n2 = right - mid;
  int l[n1+1], r[n2+1];
   
  for(int i=0;i<n1;i++) l[i]=a[left + i];  
  for(int i=0;i<n2;i++) r[i]=a[mid + i];
  l[n1]=S;
  r[n2]=S;
  int x=0,y=0;

  for(int k=left;k<right;k++){
    if(l[x]<=r[y]){
      a[k]=l[x];
      x++;
    }
    else{
      a[k]=r[y];
      y++;
    }
    cnt++;
  }
}
 
void mergeSort(int *a, int left, int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(a,left,mid);
    mergeSort(a,mid,right);
    merge(a,left,mid,right);
  }
}



Measured memory_bytes: 7004
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int N=1505;
int n,cnt[N];
int a[N][N],S[N][N];
int L[N][N],R[N][N];
char s[N];
ll ans;
int main(){
	scanf("%d",&n);
	For(i,1,n){
		scanf("%s",s+1);
		For(j,1,n) a[i][j]=(s[j]=='#'?0:s[j]-'0');
		For(j,1,n) S[i][j]=S[i][j-1]+a[i][j];
	}
	For(i,1,n) Rep(j,n+1,1)
		if (!a[i][j]) L[i][j]=n+1,R[i][j]=0;
		else{
			L[i][j]=j;
			R[i][j]=max(R[i][j+1],j);
			ans+=a[i][j]*(S[i][R[i][j]]-S[i][j]); 
		}
	Rep(x,n,1) For(y,x+1,n){
		Rep(j,n,1)
			if (a[x][j]){
				L[y][j]=min(L[y][j],L[y][j+1]);
				R[y][j]=max(R[y][j],R[y][j+1]);
			}
			else{
				L[y][j]=n+1;
				R[y][j]=0;
			}
		For(j,1,n) cnt[j]=0;
		For(j,1,n)
			if (L[y][j]<=R[y][j]){
				ans+=a[x][j]*(S[y][R[y][j]]-S[y][L[y][j]-1]);
				++cnt[L[y][j]];
				--cnt[R[y][j]+1];
			}
		For(j,1,n){
			cnt[j]+=cnt[j-1];
			if (!cnt[j])
				a[y][j]=0;
		}
		For(j,1,n)
			S[y][j]=S[y][j-1]+a[y][j];
	}
	printf("%lld\n",ans);
} 

Measured memory_bytes: 20736
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>

int main() {

    int n;
    scanf("%d", &n);

    if (n % 2 == 0) {
        printf("0.5");
    } else {
        int num = (n / 2) + 1;
        printf("%lf", (double)num / n);

    }

    return 0;

}


Measured memory_bytes: 128
#include <stdio.h>

int main(void){
    int r,g,b, k;
    scanf("%d %d %d", &r, &g, &b);
    scanf("%d", &k);
    while(g<=r){
        g = g*2;
        k = k-1;
        if(k<0){
            printf("No\n");
            break;
        }

    }

    if(k>=0){
        while(b<=g){
            b = b*2;
            k = k-1;
            if(k<0){
                printf("No\n");
                break;
            }
        }
    }



    if(k>=0){
        printf("Yes\n");
    }

    return 0;
}


Measured memory_bytes: 1660
#include<bits/stdc++.h>
#define ll long long int
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
    return (a.second < b.second);
}
int main()
{
    FAST();
    ll t,i,j,k,n,l,x,y;
    vector<ll>v;
    map<ll,ll>m;
    string s;
    cin>>s;
    for(i=0;i<3;i++)
    {
        cout<<s[i];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3644
import collections

N = int(input())
L = [int(i) for i in input().split()]
M = max(L)
c = collections.Counter(L)
li = [c[i] for i in range(M+1)]

ans = 0
for i in range(1,M+1):
    for j in range(i,M+1):
        if i == j:
            ans += int(li[i] * (li[i] - 1) * (li[i] - 2) / 6)
            ans += int(sum(li[j+1:min(M+1, i+j)]) * li[i] * (li[i] - 1) / 2)
        else:
            ans += int(li[i] * li[j] * (li[j] - 1) / 2)
            ans += li[i] * li[j] * sum(li[j+1:min(M+1, i+j)])
print(int(ans))


Measured memory_bytes: 97928
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
#define ll              long long int
#define vll             vector<ll>
#define vs              vector <string>                                    
#define mll             map<ll,ll>
#define pll             pair<ll, ll>
#define vpll            vector < pair<ll,ll> >
#define itr             vll::iterator
#define all(c)          c.begin(),c.end()
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pb              push_back
#define mb              make_pair
#define ff              first
#define ss              second
#define max3(a,b,c)     max(max(a,b),c)                                    
#define min3(a,b,c)     min(min(a,b),c)  
#define mod             1000000007
#define inf             1000000000000000001
#define from(i, n)      for(__typeof(n) i = 0; i <  n; ++i)
#define fromj(i, j, n)  for(__typeof(n) i = j; i <  n; ++i)
#define printv(v)       from(i,v.size())cout<<v[i]<<" ";cout<<"\n";
#define w(x)            int x; cin>>x; while(x--)
 
using namespace std;
using namespace __gnu_pbds; 
 
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
}
 
bool func(const pll &a, const pll &b){
    if(a.ss==b.ss)return a.ff<b.ff;
    return a.ss < b.ss;
}
 
typedef tree<int, null_type, less<int >, rb_tree_tag, 
             tree_order_statistics_node_update> pbds; 
 
double v[301][301][301];
double sus(ll x,ll y,ll z,ll &n){
	if(x==0&&y==0&&z==0)return 0;
	if(x<0||y<0||z<0)return 0;
	if(abs(v[x][y][z]-0.0)>1e-9)return v[x][y][z];
	v[x][y][z]=(n + x*sus(x-1,y,z,n) + y*sus(x+1,y-1,z,n) + z*sus(x,y+1,z-1,n))/(x+y+z);
	return v[x][y][z];
}
int main(){
    c_p_c();
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n,x=0,y=0,z=0;
    cin>>n;
    from(i,n){
    	int temp;
    	cin>>temp;
    	if(temp==1)x++;
        if(temp==2)y++;
        if(temp==3)z++;
    }	
    cout<<ps(sus(x,y,z,n),13);
}    

Measured memory_bytes: 111180
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vrsort(v) sort((v).rbegin(), (v).rend())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 2000000009
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  ll n;cin>>n;vll a(n);ll i;ll sum=0;ll od=0;ll ev=0;
  for(i=0;i<n;i++){cin>>a[i];sum+=a[i];if(i%2){ev+=a[i];}else{od+=a[i];}}
  //caricurate
  if(n%2){
    ll fi=sum-2*ev;
    cout<<fi;
    for(i=1;i<n;i++){
      cout<<" "<<(a[i-1]*2-fi)<<endl;
      fi=(a[i-1]*2-fi);
    }
   return 0; 
  }
  ll fi=sum-(od+ev-a[0])/2;
  cout<<fi;
    for(i=1;i<n;i++){
      cout<<" "<<(a[i-1]*2-fi)<<endl;
      fi=(a[i-1]*2-fi);
    }
   return 0; 
}

Measured memory_bytes: 2176
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>

using namespace std;
#define MAX_N 100000

struct S{
	int idx, data;
	bool operator <(const S &a)const{
		return data<a.data;
	}
};

int N;
vector<S> v;
int arr[MAX_N+1];
int ans = 0;

int main(){
	scanf("%d", &N);
	for(int i=0; i<N; i++){
		S tmp;
		scanf("%d", &tmp.data);
		tmp.idx = i;
		v.push_back(tmp);
	}
	sort(v.begin(), v.end());
	for(int i=0; i<N; i++){
		arr[v[i].idx] = i;
	}
	for(int i=0; i<N; i+=2){
		if(arr[i]%2==1)	ans++;
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 1524
// atcoder/abc168/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

pair<double, double> rot(double x, double y, double th)
{
  double p = x * cos(th) - y * sin(th);
  double q = x * sin(th) + y * cos(th);
  return {p, q};
}

double dist(pair<double, double> a, pair<double, double> b)
{
  double x = a.first - b.first;
  double y = a.second - b.second;
  return sqrt(x * x + y * y);
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  double a, b, h, m;
  while (cin >> a >> b >> h >> m) {
    double p, q;

    p = ((2 * M_PI) / 12.0 * h) + ((2 * M_PI) / 12.0 / 60.0 * m);
    q = (2 * M_PI) / 60.0 * m;

    pair<double, double> x = rot(0, 1, p);
    pair<double, double> y = rot(0, 1, q);

    x.first *= -a;
    x.second *= -a;

    y.first *= -b;
    y.second *= -b;

    cout << dist(x, y) << endl;
  }

  return 0;
}


Measured memory_bytes: 4120
ctlist = [0 for i in range(26)]
str1 = open(0).read()

for i in str1:
    if i.isupper():
        ctlist[ord(i) - ord('A')] += 1
    elif i.islower():
        ctlist[ord(i) - ord('a')] += 1

for i in range(26):
    print(chr(i + ord('a')), ":", ctlist[i])


Measured memory_bytes: 5572
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;


public class Main {

    public static void main(String[] args) {
    
    	FastScanner scan = new FastScanner();
    	
    	int k = scan.nextInt();
    	for(int i=0; i<k; i++) System.out.print("ACL");
    }

   
    static class FastScanner{
    	
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
    	String next() {
    		while(!st.hasMoreTokens())
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e){
    				e.printStackTrace();
    			}
    		return st.nextToken();
    	}
    	
    	int nextInt() {
    		return Integer.parseInt(next());
    	}
    	
    	int [] readArray(int n) {
    		int [] a = new int[n];
    		for(int i=0; i<n ; i++) a[i] = nextInt();
    		return a;
    	}
    	
    	long nextLong() {
    		return Long.parseLong(next());
    	}
    	
    	
    }
    
   
}



Measured memory_bytes: 32628
#include<iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		bool array[1000500];
		for(int i=0;i<=n;i++){
			array[i]=true;
		}

		int count=0;
		array[0]=array[1]=false;
		for(int i=1;i<=n;i++){
			if(array[i]){
				count++;
				for(int j=i*2;j<=n;j+=i){
					array[j]=false;
				}
			}
		}
		cout<<count<<endl;
	}
	return 0;
}

Measured memory_bytes: 2132
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.RegularExpressions;
using System.Text;
using System.Diagnostics;
using static System.Math;
using static System.Array;

//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{

    class Solve
    {
        const int mod = 1000000007;
        const int INF = 2147483647;
        const long SINF = 9223372036854775807;

        static int N;
        static List<Tuple<int, int>> X;
        
        
        

        public static void Input()
        {
            var cin = new Scanner();
            N = int.Parse(Console.ReadLine());
            X = new List<Tuple<int, int>>(N);
            var input = cin.SplitReader();
            for(var i = 0; i < N; i++)
            {
                X.Add(new Tuple<int, int>(input[i], i));
            }
        }

        static void Main(string[] args)
        {
            Input();

            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            X.Sort();
            int[] ans = new int[N];
            for(var i = 0; i < N; i++)
            {
                if (i <= (N / 2) - 1)
                {
                    ans[X[i].Item2] = X[N / 2].Item1;
                }
                else
                {
                    ans[X[i].Item2] = X[(N / 2) - 1].Item1;
                }
            }

            for(var i = 0; i < N; i++)
            {
                Console.WriteLine(ans[i]);
            }

            //Console.Out.Flush();

        }





    }

    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }

    }

    public class Graph
    {
        
    }
}

    



Measured memory_bytes: 44332
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		String str = scan.next();//空白文字までの入力を取得
		String str2 = "";
		for(int i = 0;i < str.length();i++) {
			str2 = str2 + "x";
		}
		
		System.out.println(str2);
		scan.close();
	}

}


Measured memory_bytes: 23764
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline

n=int(input())
aa=list(map(int,input().split()))
bb=list(map(int,input().split()))

ans=0
for i,b in enumerate(bb):
    if b<=aa[i]:
        ans+=b
    else:
        ans+=aa[i]
        b-=aa[i]
        if b<=aa[i+1]:
            aa[i+1]-=b
            ans+=b
        else:
            ans+=aa[i+1]
            aa[i+1]=0
print(ans)


Measured memory_bytes: 19228
#include <iostream>
#include <cstring>

using namespace std;

int main(){
	string s;
	cin>>s;
	bool st=true;
	int len=s.length();
	for(int i=0;i<len;i++){
		if(st&&s[i]=='C'){
			st=false;
		}
		else if(!st&&s[i]=='F'){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
from sys import stdin, setrecursionlimit


def main():
    n = int(stdin.readline())
    a = list(map(int, stdin.readline().split()))

    if n == len(set(a)):
        print('YES')
    else:
        print('NO')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Measured memory_bytes: 92756
#define _USE_MATH_DEFINES
#include<iostream>
#include <math.h>
#include <climits>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
using namespace std;

/* sample input

*/
long n;
long a[100000];
long amin = INT_MAX;
long amax = 0;
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		if (a[i] < amin){
			amin =a[i];
		}
		if (a[i] > amax){
			amax = a[i];
		}
	}

	if (amax - amin > 1){
		cout << "No";
	}
	else if (amax == amin){
		if (amax <= n / 2||amax+1==n){
			cout << "Yes";
		}
		else{
			cout << "No";
		}
	}
	else {
		int count = 0;//孤立色の数
		for (int i = 0; i < n; i++){
			if (a[i] == amin){
				count++;
			}
		}

		//色の種類はcount +1 ~ count + (n-count)/2 

		if (amax < count+1  || count + (n - count) / 2 < amax){
			cout << "No";
		}
		else{
			cout << "Yes";
		}
	}

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <vector>
#include <utility>
#include <iomanip>

using namespace std;


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

    int64_t t1,t2,t3;
    t1 = 1;
    t2 = 1;
    t3 = 1;

    for(int i=0;i<N;++i){
        t1 *=10;
        t2*=9;
        t3*=8;

        t1 = t1 % (int)(1*pow(10,9) +7) ;
        t2 = t2 % (int)(1*pow(10,9) +7) ;
        t3 = t3 % (int)(1*pow(10,9) +7) ;

    }

    int64_t num =(t1 -(t2 - t3)*2 -t3) % (int)(1*pow(10,9) +7);
    num += (int)(1*pow(10,9) +7);
    num %= (int)(1*pow(10,9) +7);

    cout << num<<endl;


}



Measured memory_bytes: 3600
import java.util.*;

public class Main{
	int [] table = {10, 50, 100, 500};

	private void doit(){
		Scanner sc = new Scanner(System.in);
		boolean isfirst = true;
		while(true){
			
			int value = sc.nextInt();
			if(value == 0) break;
			if(isfirst){
				isfirst = false;
			}
			else{
				System.out.println();
			}
			int [] num = new int[4];
			int sum = 0;
			for(int i = 0; i < 4; i++){
				num[i] = sc.nextInt();
				sum += num[i];
			}
			int min = 1 << 24;
			int [] ans = new int[4];
			for(int i = 0; i <= num[0]; i++){
				for(int j = 0; j <= num[1]; j++){
					for(int k = 0; k <= num[2]; k++){
						for(int m = 0; m <= num[3]; m++){
							int nowvalue = i * 10 + j * 50 + k * 100 + m * 500;
							
							if(value <= nowvalue){
								int nowdiff = nowvalue - value;
								int count = 0;
								for(int ii = table.length - 1; ii >= 0; ii--){
									while(nowdiff >= table[ii]){
										count++;
										nowdiff -= table[ii];
									}
								}
								
								int res = sum - (i + j + k + m) + count;
								
								if(min > res){
									min = res;
									ans[0] = i;
									ans[1] = j;
									ans[2] = k;
									ans[3] = m;
								}
							}
						}
					}
				}
			}
			StringBuilder sb = new StringBuilder();
			
			for(int i = 0; i < 4; i++){
				if(ans[i] > 0){
					sb.append(table[i] + " " + ans[i] + "\n");
				}
			}
			System.out.print(sb.toString());
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 35708