akhauriyash/Code-Regression huggingface dataset:
n, k = tuple(map(int, input().split()))

ans = 0
for b in range(max(1, k), n+1):
    ans += (b-k)*(n//b)
    if n%b >= k and k>0:
        ans += n%b-k+1
    elif n%b >= k:
        ans += n%b
print(ans)

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

int		main(void)
{
	int n, k;

	cin >> n >> k;
	vector<int> sticks(n);

	for (int i = 0; i < n; i++)
		cin >> sticks[i];
	sort(sticks.begin(), sticks.end());
	reverse(sticks.begin(), sticks.end());
	int ans = 0;

	for (int i = 0; i < k; i++)
		ans += sticks[i];
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000001
vector<vector<ll>> dist;

void warshall_floyd(int n) { // nは頂点数
  for (int i = 1; i <= n; i++)      // 経由する頂点
    for (int j = 1; j <= n; j++)    // 開始頂点
      for (int k = 1; k <= n; k++){  // 終端
    	  if(i==j||j==k||i==k)continue;
        dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
      }
}

int main(){
	ll n,m,r;
	cin>>n>>m>>r;
	vector<ll> a(m),b(m),c(m);
	vector<ll>list(r);
	dist=vector<vector<ll>>(n+1,vector<ll>(n+1,INF));

	for(ll i=0;i<r;i++){
		cin>>list[i];
	}
	sort(list.begin(),list.end());
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i]>>c[i];
		dist[a[i]][b[i]]=c[i];
		dist[b[i]][a[i]]=c[i];
	}
	ll res=INF,tmp=0;
	warshall_floyd(n);
	sort(list.begin(),list.end());
	do{
		tmp=0;
		for(int i=0;i<r-1;i++){
			//cout<<"i:"<<i<<" "<<list[i]<<list[i+1]<<endl;
			//cout<<dist[list[i]][list[i+1]]<<endl;
			tmp+=dist[list[i]][list[i+1]];
		}
		res=min(res,tmp);
	}while(next_permutation(list.begin(),list.end()));

	cout<<res<<endl;
}


Measured memory_bytes: 1024
N = int(input())
a = list(map(int, input().split()))

# a[i]を降順にソート
a.sort(reverse=True)

# A_total = Aliceの点数、B_total = Bobの点数
A_total = 0
B_total = 0

for i in range(N):
    if i % 2 == 0:
        A_total += a[i]
    else:
        B_total += a[i]

print(A_total - B_total)


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

int main() {
  int n;
  cin>>n;
  vector<int>v(n);
  rep(i,n) cin>>v[i];
  v[0]--;
  int pre=0;
  
  for(int i=0; i<n-1; ++i){
    if(v[i]<v[i+1]) {
      v[i+1]--;
      pre=v[i+1];
    }else if(v[i]>v[i+1]){
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}
        
    


Measured memory_bytes: 640
#(46)未提出者は誰だ?
a=[0]
for i in range(28):
    n=int(input())
    a.append(n)

a.append(31)
a.sort()
i=1
j=0
while True:
    if a[i]-a[j]>1:
        print(a[j]+1)
    i+=1
    j+=1
    if i==30:
        break


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359

int main(){
   int N;
   cin >>N;
   unsigned long int A[N];
   for(int i=0;i<N;i++){
       cin >> A[i];
   }
    
    long long sum=0;
    for(int i=0;i<N;i++){
        if(A[i]>A[i+1]){
            sum +=A[i]-A[i+1];
            A[i+1]=A[i];
        }
    }
    cout << sum <<endl;
}

Measured memory_bytes: 5168
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'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'};
char moji2[26]={'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'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;


int main(){
    int n;
    cin >> n;
    vector<string> S;
    REP(i,n){
        string s;
        cin >> s;
        S.push_back(s);
    }
    llong ans = 0;
    REP(ii,n){
        bool flag = true;
        REP(i,n){
            FOR(j,i+1,n){
                if(S[i][j] !=S[j][i]) flag = false;
            }
        }
        if(flag) ans += n;
        string s = *(S.begin());
        S.erase(S.begin());
        S.push_back(s);
    }
    cout << ans << endl;
}

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

public class Main {

	public static void main(String[] args)throws Exception {
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader (is);
		String input[] = br.readLine().split(" ");
		//[x][0] = ボールの個数  -1以上
		//[x][1] = 赤のボールがある 1 0
		//[x][2] = 赤のボールが入れられた 1 0
		int boxCount = Integer.parseInt(input[0]);
		int[][] box =new int [boxCount][3];
		for(int i=0;i<boxCount;i++) {
			for(int j=0;j<3;j++) {
				box[i][j]=0;
			}
		}
		//1番目の箱は赤のボールがある
		box[0][1] = 1;
		box[0][2] = 1;
		int order = Integer.parseInt(input[1]);
		while(br.ready()) {
			String temp[] = br.readLine().split(" ");
			int before = Integer.parseInt(temp[0])-1;
			int after = Integer.parseInt(temp[1])-1;
			if(box[before][0] >= 0) {
				//赤のボールが移されたなら
				if(box[before][1]==1) {
					box[before][1] = 0;
					box[after][1] = 1;
					box[after][2] = 1;
				}
				//赤のボールが入れられた可能性があるなら、受け先も可能性アリにする
				if(box[before][2]==1) {
					box[after][2] = 1;
				}
				//ボールがなくなる場合は赤のボールのある可能性はない
				if(box[before][0] == 0) {
					box[before][2] = 0;
				}
				box[before][0]--;
				box[after][0]++;
			}
		}
		int result = 0;
		for(int i =0 ;i<boxCount ; i++) {
			if(box[i][0] >= 0) {
				if(box[i][2] == 1) {
					result++;
				}
			}
		}
		System.out.println(result);
	}

}

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

bool solve(){
    int n, m;
    cin >> n >> m;
    vector<vector<int> > g(n);
    vector<int> deg(n), ans;
    for(int i=0;i<m;i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        deg[b]++;
    }
    queue<int> que;
    for(int i=0;i<n;i++){
        if(deg[i] == 0){
            que.push(i);
        }
    }
    bool flag = false;
    while(!que.empty()){
        flag |= que.size() >= 2;
        int id = que.front();
        que.pop();
        ans.push_back(id);
        for(auto nxt : g[id]){
            deg[nxt]--;
            if(deg[nxt] == 0){
                que.push(nxt);
            }
        }
    }
    for(int i=0;i<n;i++){
        cout << ans[i]+1 << endl;
    }
    cout << (flag ? 1 : 0) << endl;
    return true;
}

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



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

//#define DEBUG
#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif

int n;

inline string encode(const string& s) {
    string ret;
    ret += s[0];

    for (int i = 0; i < s.size()-1; ++i) {
        if (s[i] == 'a' || s[i] == 'i' || s[i] == 'u' || s[i] == 'e' || s[i] == 'o') {
            ret += s[i+1];
        }
    }

    return ret;
}

inline bool judge(const int& k, const vector<string>& input) {
    set<string> table;
    for (const string& s : input) {
        auto e = s.substr(0, k);
        dump(e);
        if (!table.count(e)) {
            table.insert(e);
        } else {
            return false;
        }
    }
    return true;
}

int main() {
    while (cin >> n, n) {
        vector<string> ed(n);
        string s;
        for (int i = 0; i < n; ++i) {
            cin >> s;
            ed[i] = encode(s);
        }

        bool flag = true;
        for (int i = 1; i < 51; ++i) {
            if (judge(i, ed)) {
                cout << i << endl;
                flag = false;
                break;
            }
        }
        if (flag) {
            cout << -1 << endl;
        }
    }
    return 0;
}



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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var s1 = Console.ReadLine();
            var s2 = Console.ReadLine();

            Console.WriteLine(new string(s1.Reverse().ToArray()) == s2 ? "YES" : "NO");
        }
    }
}

Measured memory_bytes: 13268
import math
n=int(input())
for _ in range(n):
    a,b=map(int,input().split())
    c=int(math.sqrt(a*b))
    if c*(c+1)<a*b: print(2*c-1)
    elif a*b==c*c and a!=b:  print(2*c-3)
    else:  print(2*c-2)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
const int mod = 1000000007;
ll n,b=0,h=0,ans=1000000;
string s;
int main(){
  cin >> n >> s;
  for (size_t i = 0; i < n; i++) if(s[i] == '.')h++;
  for (size_t i = 0; i < n; i++) {
    ans = min(ans,b+h);
    if(s[i] == '#')b++;
    if(s[i] == '.')h--;
  }
  ans = min(ans,b+h);
  cout << ans << endl;
}


Measured memory_bytes: 640
(defn even [e]
  (* e e))

(defn odd [o]
  (* o (+ o 1)))

(defn pair [k]
  (if (even? k)
    (even (quot k 2))
    (odd (quot k 2))))


(let [input (read-line)
      k (Integer/parseInt input)]
  (println (pair k)))

Measured memory_bytes: 66676
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n,tmp1 = (int(i) for i in input().split())
x = list(int(i) for i in input().split())
x.append(tmp1)
x.sort()
query = []
for i in range(n):
  query.append(x[i+1]-x[i])
print(gcd_list(query))

Measured memory_bytes: 16304
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <set>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <numeric>

using namespace std;

typedef long long ll;

#define forn(i, n) for(int i = 0; i < (int)(n);++i)
#define fore(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i)
#define fi first
#define se second
#define pb push_back
#define pll pair<ll,ll>
#define vi vector<int>
#define vb vector<bool>
#define vvi vector<vi>
#define vpll vector<pll>
#define vll vector<ll>
#define vvll vector<vll>
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()


void fastik() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

//ifstream &cin
void solve(){

}

int main() {
    fastik();
    ll n,m;cin>>n>>m;
    ll k;
    vll msk(n,0);
    forn(i,m){
        cin >> k;
        forn(j,k){
            ll s;
            cin >> s;
            msk[i] += 1 << (s-1);
        }
    }
    vll p(m);
    forn(i,m){
        cin >> p[i];
    }
    ll ans=0;
    forn(sw,1<<n){
        ll f=0;
        ll cnt = 0;
        forn(i,m){
            cnt = __builtin_parity(sw&msk[i]);
            if(cnt != p[i]){
                f = 1;
                break;
            }
        }
        if(f==0){
            ans++;
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long n=sc.nextLong(),m=sc.nextLong(),res=0;
    if(n*2>=m) {
    	System.out.println(m/2);
    }else {
    	m=m-n*2;
    	System.out.println(n+m/4);
    }
  }
}


Measured memory_bytes: 21204
N = int(input())
B = list(map(int, input().split()))
A = [0]*N
A[0], A[1] = B[0], B[0]
for i in range(N-1):
    A[i+1] = B[i]
    if A[i] >= B[i]:
        A[i] = B[i]
ans = sum(A)
print(ans)

Measured memory_bytes: 3060
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = 0

if N % 2 == 1:
  ans += A[0]
  ans += A[N//2]
  for i in range(1,N//2):
    ans += A[i]*2
else:
  ans += A[0]
  for i in range(1,N//2):
    ans += A[i]*2
print(ans)

Measured memory_bytes: 31412
use std::io::Read;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let a: u64 = itr.next().unwrap().parse().unwrap();
    let b: u64 = itr.next().unwrap().parse().unwrap();

    let arem: u64 = a % 4;
    let adiv: u64 = a / 4;
    let brem: u64 = (b + 1) % 4;
    let bdiv: u64 = (b + 1) / 4;

    let mut anum: u64 = 0;
    let mut bnum: u64 = 0;
    for i in 0..arem {
        anum ^= adiv * 4 + i;
    }
    for i in 0..brem {
        bnum ^= bdiv * 4 + i;
    }
    println!("{}", anum ^ bnum);
}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	static long a, b;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		a = sc.nextLong();
		b = sc.nextLong();
		long c = sc.nextLong();
		long d = sc.nextLong();

		System.out.println(b - a + 1 - (calc(c) + calc(d) - calc(lcm(c, d))));

	}

	static long calc(long divide) {
		return b / divide - (a - 1) / divide;
	}

	static long gcd(long m, long n) {
		if (m < n)
			return gcd(n, m);
		if (n == 0)
			return m;
		return gcd(n, m % n);
	}

	static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

}


Measured memory_bytes: 21844
import numpy as np
N,K=map(int,input().split())
h=np.array(list(map(int,input().split())))

cost=np.array([-1 for _ in range(N)])


for i in range(N):
    if i==0:
        cost[i]=0
    else:
        siten=max(i-K,0)
        min_cost=np.min(cost[siten:i]+np.abs(h[siten:i]-h[i]))
        cost[i]=min_cost

print(cost[N-1])

Measured memory_bytes: 22828
def check(stmp):
    if len(set(stmp)) == 3:
        return True
    else:
        return False


def next753(stmp):
    dic = {"3": "5", "5": "7"}
    flag = True
    i = len(stmp) - 1
    while((check(stmp) is False) or (flag is True)):
        flag = False
        s = stmp[i]
        if s == "3" or s == "5":
            stmp = stmp[:i] + dic[s] + stmp[i + 1:]
            i = len(stmp) - 1
        else:
            while(stmp[i] == "7"):
                stmp = stmp[:i] + "3" + stmp[i + 1:]
                i -= 1
            stmp = stmp[:i] + dic[stmp[i]] + stmp[i + 1:]
            i = len(stmp) - 1

        # print("a", stmp)

    return(int(stmp))


sN = input()
N = int(sN)

if len(sN) < 3:
    print(0)
    exit()
elif sN[0] == "8" or sN[0] == "9":
    ans = 0
    for i in range(3, len(sN) + 1):
        ans += 3 ** i - 3 * (2 ** i) + 3
    print(ans)
    exit()

ex = len(sN) - 1
ans = 0
for i in range(3, ex + 1):
    ans += 3 ** i - 3 * (2 ** i) + 3
tmp = int("3" * (len(sN) - 2) + "5" + "7")
# print(tmp)
# print(next753(str(tmp)))
while(tmp <= N):
    ans += 1
    tmp = next753(str(tmp))
    # print("next:", tmp)
print(ans)

Measured memory_bytes: 3064
/*
 * written by Yaqi Zhang
 * University of Wisconsin-Madison
 * 2020
 */

#include<algorithm>
#include<cstring>
#include<climits>
#include<iostream>
#include<map>
#include<set>
#include<stdio.h>
#include<vector>

#define INF 0x3f3f3f3f
typedef long long ll;

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int A, B, C;
    cin >> A >> B >> C;
    int a, b, c, new_A, new_B, new_C;
    for(int i = 1; i < n; ++i) {
        cin >> a >> b >> c;
        new_A = a + max(B, C);
        new_B = b + max(A, C);
        new_C = c + max(A, B);
        A = new_A;
        B = new_B;
        C = new_C;
    }
    cout << max(A, max(B, C)) << endl;
    return 0;
}



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

const int N = 200 + 10;
const int B = 62;

long long a[N];
int s[N];
int n;

struct LB {
	long long a[B];

	void insert (long long x) {
		for (int i = B - 1; x && i >= 0; i--) {
			if (x >> i & 1) {
				if (!a[i]) a[i] = x;
				x ^= a[i];
			}
		}
	}

	long long querymn (long long x = 0) {
		long long ret = x;
		for (int i = B - 1; i >= 0; i--)
			ret = min(ret, ret ^ a[i]);
		return ret;
	}

	long long & operator [] (int x) { return a[x]; }

} lb;

int main (void) {
	int kase;
	scanf("%d", &kase);
	while (kase --) {
		scanf("%d", &n);
		for (int i = 1; i <= n; i ++)
			scanf("%lld", a + i);
		for (int i = 1; i <= n; i ++)
			scanf("%1d", s + i);

		int ok = 1;
		memset(lb.a, 0, sizeof(lb.a));
		for (int i = n; i >= 1; i --) {
			if (s[i]) {
				if (lb.querymn(a[i]) != 0) {
					ok = 0;
					break;
				}
			} else 
				lb.insert(a[i]);
		}
		if (ok)
			puts("0");
		else
			puts("1");
	}
}

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

int inf=pow(10,9);

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

  int wt[n],val[n];
    ll sum=0;
  for(int i=0;i<n;i++){
      cin>>wt[i]>>val[i];
    sum+=val[i];


  }


    int dp[n+1][sum+1];


   

    for(int i=0;i<=n;i++){
        for(int j=0;j<=sum;j++){
            dp[i][j]=inf;

        }
    }

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

        dp[i][0]=0;

    }

    

    for(int i=1;i<=n;i++){
        for(int j=1;j<=sum;j++){


            if(val[i-1]<=j){

                dp[i][j]=min(dp[i-1][j],wt[i-1]+dp[i-1][j-val[i-1]]);

            }else{

                dp[i][j]=dp[i-1][j];

            }

        }
    }

    int ans=INT_MIN;


    

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

        if(dp[n][i]<=w){
            ans=i;
        }
    }

    

    cout<<ans;




}


Measured memory_bytes: 39680
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=1e9+7;
const llint big=1e15+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
int main(void){
	string s;cin>>s;SO(s);s.pub('1');
	for(int i=0;i<=3;i++){if(s[i]=='1'){cout<<3-i<<endl;RE;}}
	
}

Measured memory_bytes: 384
s = input()
n = len(s) - 1
cnt = 0
for bit in range(1 << n):
    j = 0
    for i, v in enumerate(bin(bit)[2:][::-1]):
        if v == "1":
            cnt += int(s[j:i + 1])
            j = i + 1
    cnt += int(s[j:])
print(cnt)

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




int main(){
    int N;
    cin >> N;
    int dp[N+1];
    for(int i=0;i<N+1;i++){
        dp[i]=INF;
    }
    dp[0]=0;
    for(int i=0;i<N;i++){
        int s=1;
        while(1){
            if(i+s>N) break;
            dp[i+s]=min(dp[i+s],dp[i]+1);
            s*=6;
        }
        s=1;
        while(1){
            if(i+s>N) break;
            dp[i+s]=min(dp[i+s],dp[i]+1);
            s*=9;
        }
    }
    cout << dp[N] << endl;
    return 0;
}


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

int main(){
	long long a, b, k;
	cin >> a >> b >> k;
	
	if(k <= a) a -= k;
	else{
		b -= k-a;
		a = 0;
	}

	cout << a << " " << max(b, (long long)0) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int i,j,cnt=0,tmp,N,A[100];
	scanf("%d", &N);
	for(i=0;i<N;i++) scanf("%d",&A[i]);
	for(i=N;i>0;i--){
		for(j=0;j<i-1;j++){
			if(A[j]>A[j+1]){
				tmp=A[j];
				A[j]=A[j+1];
				A[j+1]=tmp;
				cnt++;
			}
		}
	}
	printf("%d",A[0]);
	for(i=1;i<N;i++) printf(" %d",A[i]);
	printf("\n");
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 604
import java.util.*

private fun check(L: List<Long>, K: Long): Boolean {
    for (i in L.indices) {
        for (j in i + 1 until L.size) {
            if (L[i] != L[j]) continue

            var p = 0L
            for (k in i..j) {
                p = p xor L[k]
            }

            if (p != K) return false
        }
    }
    return true
}

private fun func1(M: Long, K: Long): List<List<Long>> {
    val res = ArrayList<List<Long>>()
    val cnt = Array(1 shl M.toInt()) {0}
    val l = ArrayList<Long>()


    fun rec() {
        if (l.size == 2 shl M.toInt()) {
            if (check(l, K)) {
                res.add(l.clone() as List<Long>)
            }
        }
        for (i in cnt.indices) {
            if (cnt[i] == 2) continue
            cnt[i]++
            l.add(i.toLong())
            rec()
            l.removeAt(l.size - 1)
            cnt[i]--
        }
    }

    rec()

    return res
}

fun main(args: Array<String>) {
    val (M, K) = readLine()!!.split(" ").map{it.toLong()}

    if (M == 1L && K == 1L || K >= 1L shl M.toInt()) {
        println(-1)
        return
    }

    if (M == 1L && K == 0L) {
        println("0 0 1 1")
        return
    }

    val res = ArrayList<Long>()

    val others = (0 until (1L shl M.toInt())).filter { it != K }
    res.addAll(others)
    res.add(K)
    res.addAll(others.reversed())
    res.add(K)

//    if (!check(res, K)) {
//        System.exit(1)
//    }

    println(res.joinToString(" "))
}


Measured memory_bytes: 58696
#include<stdio.h>
#include<cstring>
#include<stdlib.h>

int main() {
    int d, t, s;
    scanf("%d", &d);
    scanf("%d", &t);
    scanf("%d", &s);
    
    if ((double)d/(double)s <= (double)t) {
        puts("Yes");
    }
    else {
        puts("No");
    }
}



Measured memory_bytes: 1660
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <random>
#include <cmath>
#include <chrono>
#include <cstring>
#include <algorithm>
#include <string>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
using namespace std;
using LL = long long;
#define eps 1e-8
#define fi first
#define se second
#define eb emplace_back
#define close std::ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define FOR(i, x, y) for (LL i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (LL i = (x), _##i = (y); i > _##i; --i)
#define SORT_UNIQUE(c) (sort(c.begin(), c.end()), c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define CASET           \
    int ___T;           \
    scanf("%d", &___T); \
    for (int __CS = 1; __CS <= ___T; __CS++)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
mt19937 dlsrand(random_device{}());
mt19937 mrand(std::chrono::system_clock::now().time_since_epoch().count());
int rnd(int x) { return mrand() % x; }
LL bin(LL x, LL n, LL MOD)
{
    LL ret = MOD != 1;
    for (x %= MOD; n; n >>= 1, x = x * x % MOD)
        if (n & 1)
            ret = ret * x % MOD;
    return ret;
}
inline LL get_inv(LL x, LL p) { return bin(x, p - 2, p); }
const double PI = acos(-1.0);
constexpr int maxn = 1e6 + 10;
constexpr int INF = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3f;
constexpr int mod = 1e9 + 7;
int n, m, k, u, v;
int fa[maxn], deg[maxn], cnt[maxn], sz[maxn];
int get_fa(int x)
{
    return x == fa[x] ? x : fa[x] = get_fa(fa[x]);
}
void unit(int x, int y)
{
    int fx = get_fa(x);
    int fy = get_fa(y);
    if (fx == fy)
        return;
    fa[fy] = fx;
    sz[fx] += sz[fy];
    return;
}
int main()
{
    cin >> n >> m >> k;
    for (int i = 1; i <= n + 10; i++)
    {
        fa[i] = i;
        sz[i] = 1;
    }
    for (int i = 1; i <= m; i++)
    {
        cin >> u >> v;
        deg[u]++;
        deg[v]++;
        unit(u, v);
    }
    for (int i = 1; i <= k; i++)
    {
        cin >> u >> v;
        if (get_fa(u) == get_fa(v)) //不是朋友的数量
            cnt[u]++, cnt[v]++;
    }
    for (int i = 1; i <= n; i++)
        cout << sz[get_fa(i)] - deg[i] - cnt[i] - 1 << ' ';
}

Measured memory_bytes: 12032
s = gets.chomp
K = gets.chomp.to_i

N = s.to_s.size

dp = Array.new(105) { Array.new(4) { Array.new(2, 0) } }

dp[0][0][0] = 1

(0...N).each do |i|
  (0..K).each do |j|
    (0..1).each do |k|
      nd = s[i].to_i
      (0..9).each do |d|
        ni = i + 1
        nj = d == 0 ? j : j + 1
        nk = k == 0 && nd == d ? 0 : 1

        next if nj > K
        next if k == 0 && nd < d
        next if dp[i][j][k] == 0

        dp[ni][nj][nk] += dp[i][j][k]
      end
    end
  end
end

puts dp[N][K][0] + dp[N][K][1]


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

using namespace std;

typedef long long llint;
const long long MOD = 1e9 + 7;

llint dp[2020][2020];

int main() {
  int n, m;
  cin >> n >> m;
  vector<llint> s(n), t(m);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }

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

  dp[0][0] = 1;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      if (i - 1 >= 0 && j - 1 >= 0 && s[i - 1] == t[j - 1]) {
        dp[i][j] += dp[i - 1][j - 1], dp[i][j] %= MOD;
      }
      if (i - 1 >= 0) dp[i][j] += dp[i - 1][j], dp[i][j] %= MOD;
      if (j - 1 >= 0) dp[i][j] += dp[i][j - 1], dp[i][j] %= MOD;
      if (i - 1 >= 0 && j - 1 >= 0) {
        dp[i][j] -= dp[i - 1][j - 1];
        if (dp[i][j] < 0) dp[i][j] += MOD;
      }
    }
  }
  cout << dp[n][m] << endl;

  return 0;
}

Measured memory_bytes: 31872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using pll=pair<ll,ll>;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i,l,r) for(ll i = (l); i <= (ll)(r); i++)
#define rep3(i,l,r) for(ll i = (l); i >= (ll)(r); i--)
#define dup(x,y) (((x)+(y)-1)/(y)) //a/bの除算の切り上げ
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int inf = 1001001001;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const ld pi = acos(-1);
 
//a^b=b^a
//a^(b^c)=(a^b)^c
//a^a=0
//a+b=a^b + 2(a&b)
//(4a)^(4a+1)^(4a+2)^(4a+3)=0
 
// union by size + path having
class UnionFind {
public:
   vector <ll> par; // 各元の親を表す配列
   vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)
 
   // Constructor
   UnionFind(ll sz_): par(sz_),siz(sz_, 1LL){
       for (ll i=0; i<sz_; i++) par[i]=i; // 初期では親は自分自身
   }
   void init(ll sz_){
       par.resize(sz_);
       siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
       for (ll i=0; i<sz_; i++) par[i]=i; // 初期では親は自分自身
  }
 
   // Member Function
   // Find
   ll root(ll x){ // 根の検索
      while (par[x]!=x){
           x=par[x]=par[par[x]]; // x の親の親を x の親とする
       }
       return x;
  }
 
   // Union(Unite, Merge)
   bool unite(ll x, ll y){
       x=root(x);
       y=root(y);
       if (x==y) return false;
       // merge technique（データ構造をマージするテク．小を大にくっつける)
       if (siz[x]<siz[y]) swap(x, y);
       siz[x]+=siz[y];
       par[y]=x;
       return true;
  }
 
  bool same(ll x, ll y){ // 連結判定
       return root(x)==root(y);
  }
 
  ll size(ll x){ // 素集合のサイズ
      return siz[root(x)];
  }
};
 
ll modpow(ll x, ll n){
   x=x%mod;
   if(n==0) return 1;
 
   else if(n%2==1){
       return (x*modpow(x, n-1))%mod;
   }
   else return modpow((x*x)%mod, n/2)%mod;
}
 
ll com(ll n, ll k){
   ll x=1;
   for(int i=n-k+1; i<=n; i++){
      x=x*i%mod;
   }
 
   ll y=1;
   for(int i=1; i<=k; i++){
       y=y*i%mod;
   }
   y=modpow(y,mod-2);
 
   return x*y%mod;
}
 
bool is_prime(const unsigned n){
   switch(n){
       case 0: // fall-through
       case 1: return false;
       case 2: // fall-through
       case 3: return true;
  }
 
   if(n%2==0 || n%3==0) return false;
 
   for(unsigned i = 5; i*i<=n; i+=6) {
       if(n%i==0) return false;
       if(n%(i+2)==0) return false;
   }
 
   return true;
}
 
int digsum(int n){
   int res=0;
   while(n > 0) {
       res+=n%10; //ここをres++;に変えたら桁数を求める関数になる,res+=n%10;なら格桁の和
       n/=10;
   }
   return res;
}
vector<ll> divisor(ll n){
   vector<ll> ret;
   for(ll i=1; i*i<=n; i++){
       if(n%i==0){
           ret.push_back(i);
           if(i*i!=n) ret.push_back(n/i);
       }
   }
   sort(ret.begin(),ret.end());
   return ret;
}
 
int main(){

    ll a;
    cin >> a;
    cout << a*a+a+a*a*a << endl;
 
}

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

int main() {
  int X;
  cin >> X;
  
  int ureshisa = 0;
  ureshisa += (X/500) * 1000;
  X %= 500;
  ureshisa += (X/5) * 5;
    
  cout << ureshisa << endl; 
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
# define ll long long
const int N = 2e5 + 10, mod = 1e9 + 7, INF = 1e9 + 100;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++)cout << 'x';
}


Measured memory_bytes: 256
MOD = 998244353
class mint:
    def __init__(self, x):
        if isinstance(x, int):
            self.x = x % MOD 
        elif isinstance(x, mint):
            self.x = x.x
        else:
            self.x = int(x) % MOD 
    def __str__(self):
        return str(self.x)
    __repr__ = __str__
    def __iadd__(self, other):
        self.x += other.x if isinstance(other, mint) else other
        self.x -= MOD if self.x >= MOD else 0
        return self
    def __isub__(self, other):
        self.x += MOD-other.x if isinstance(other, mint) else MOD-other
        self.x -= MOD if self.x >= MOD else 0
        return self
    def __imul__(self, other):
        self.x *= other.x if isinstance(other, mint) else other
        self.x %= MOD
        return self
    def __add__(self, other):
        return (
            mint(self.x + other.x) if isinstance(other, mint) else
            mint(self.x + other)
        )
    def __sub__(self, other):
        return (
            mint(self.x - other.x) if isinstance(other, mint) else
            mint(self.x - other)
        )
    def __mul__(self, other):
        return (
            mint(self.x * other.x) if isinstance(other, mint) else
            mint(self.x * other)
        )
    def __floordiv__(self, other):
        return (
            mint(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, mint) else
            mint(self.x * pow(other, MOD - 2, MOD))
        )
    def __pow__(self, other):
        return (
            mint(pow(self.x, other.x, MOD)) if isinstance(other, mint) else
            mint(pow(self.x, other, MOD))
        )
    __radd__ = __add__
    def __rsub__(self, other):
        return (
            mint(other.x - self.x) if isinstance(other, mint) else
            mint(other - self.x)
        )
    __rmul__ = __mul__
    def __rfloordiv__(self, other):
        return (
            mint(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, mint) else
            mint(other * pow(self.x, MOD - 2, MOD))
        )
    def __rpow__(self, other):
        return (
            mint(pow(other.x, self.x, MOD)) if isinstance(other, mint) else
            mint(pow(other, self.x, MOD))
        )


n,s = map(int, input().split())
a = list(map(int, input().split()))
import copy
dp = [[0 for _ in range(s+1)] for _ in range(n+1)]
dp[0][0]=pow(2,n,MOD)
div=pow(2,MOD-2,MOD)
for i in range(n):
    for j in range(s+1):
        dp[i+1][j]=dp[i][j]
        if j-a[i]>=0:
            dp[i+1][j]+=dp[i][j-a[i]]*div
        dp[i+1][j]%=MOD
print(dp[n][s])

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

int main(int argc, const char * argv[]) {
    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    
    int sum = a1 + a2 + a3;
    if (sum <= 21) {
        cout << "win" << endl;
    }else {
        cout << "bust" << endl;
    }
    return 0;
}


Measured memory_bytes: 888
#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++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;

int main()
{
  int n;
  cin >> n;
  if (n % 1000 == 0 ) cout << 0 << endl;
  else cout << 1000 - (n % 1000) << endl;
  

  return 0;
}


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

void o(int a,int b,int c) {
	if (a <= c && c <= (a + b)) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	o(a, b, c);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int s=0,m=0,a,t;
  for(int i=5;i--;)
  {
    cin>>a;
    t=(a-1)/10*10+10;
    s+=t;
    if(m<t-a)m=t-a;
  }
  cout<<s-m<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
stack <int> s1;
queue <int> s2;
vector <int> v;
char s[1000006];
int l,a,c=0;
void push(int a)
{
  for(int i=a;i<l;i++){
   // cout<<s[i]<<" "<<i<<endl;
    if(s[i]=='*'){
      c++;
      if(i-c>-1) s[i-c]='*';
    } 
    else{
      c=0;
      if((s[i]=='<') || (s[i]=='>')) return;
    
      else if(s[i]=='#') continue;
      else v.push_back(i);
    }
  }
}
int main()
{
    /*scanf("%s",s);
    l=strlen(s);
    s1.push(0);
    for(int i=1;i<l;i++){
      if(s[i]=='#') c++;
      if(s[i]>='0' && s[i]<='9'){
        if(c%2) s[i]='#';
      }
      if(s[i]=='<') s1.push(i+1);
      if(s[i]=='>') s2.push(i+1);
    }
    
    while(!s1.empty()){
      push(s1.top());
      s1.pop();
    }
    while(!s2.empty()){
      push(s2.front());
      s2.pop();
    }
    l=v.size();
    for(int i=0;i<l;i++){
      if(s[v[i]]!='*') printf("%c",s[v[i]]);
    }*/
      scanf(" %d",&a);
      printf("%d",a+a*a+a*a*a);
    
    return 0;
}

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

using namespace std;
using ll = long long;



int main()
{
    int n;
    cin >> n;
    ll sum = 0;

    for(int i = 1; i <= n; i++){
        if(i % 3 && i % 5)sum += i;
    }

    cout << sum << endl;
}

Measured memory_bytes: 3596
#include<iostream>
#include<cmath>
#include<algorithm>

using namespace std;

int main(){

    long long int a,b,c,x,y;

    cin >> a >> b >> c >> x >> y;

    long long int m=a*x+b*y;

    long long int k=0;
    
    long long int d=0;

    while(k<2*x || k<2*y){
        long long int p=0;
        p=max(d,x-k);
        long long int q=0;
        q=max(d,y-k);
        m=min(m,a*p+b*q+2*c*k);
        int l=0;
        if(m==85002500 && l==0){
            l++;
            cout << k << endl;
        }
        k++;
    }

    cout << m << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  string s;
  cin >> n >> s;
  rep(i, s.size()) cout << (s[i] + n > 'Z' ? char(s[i] + n - 26)
                                           : char(s[i] + n));
  cout << endl;
}

Measured memory_bytes: 3560
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
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(long n, long 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(){
    COMinit();
    long n,k;
    cin >>n >> k;
    
    
    long ans=0;
    
    for (long m=0;m<=k;m++){
        ans+=COM(n,m)*COM(n-1,n-m-1);
        ans%=MOD;
        if(n<m) break;
    }
    cout << ans << endl;
}




Measured memory_bytes: 12160
include Math
a, b, _C = gets.split(" ").map(&:to_f)

rad = _C / 180 * PI
h = b*sin(rad);
printf "%f\n", a * h / 2.0
printf "%f\n", a + b + sqrt(a**2 - 2*a*b*cos(rad) + b**2)
printf "%f\n", h

Measured memory_bytes: 8928
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,d;
    set<int>s;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>d;
        s.insert(d);
    }
    cout<<s.size()<<endl;
}


Measured memory_bytes: 3600
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		FastScanner fs =  new FastScanner();

		double n = 100L;
		Long X = fs.nextLong();
		int y = 0;
		double rate = 0.01;
		while(n < X) {
			n = n + (Math.floor(n*rate));
			y++;
		}
		System.out.println(y);

	}

}


Measured memory_bytes: 25388
import math

def main():
    a,b,x=map(int,input().split())
    if a**2*b/2<x :
        theta=math.atan(2*(a**2*b-x)/a**3)
    else :
        theta=math.pi/2-math.atan(2*x/(a*b**2))
    print(theta*180/math.pi)

main()

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

typedef long long ll;

const int Maxn = 100005;

int n;
int a[Maxn], mx[Maxn];
int res;

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    sort(a, a + n);
    mx[n] = 0;
    for (int i = n - 1; i >= 0; i--)
        mx[i] = max(mx[i + 1] - a[i], (a[i] + 1) / 2);
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        sum += a[i];
        if (sum >= mx[i + 1]) res++;
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
typedef long long ll;
#define inc(i) (++ (i))
#define dec(i) (-- (i))
#define Rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
#define rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i >= i##Limit ; dec(i))
#define Eep(i , u , v) for(int i = Head[u] , v = Node[i] ; i ; v = Node[i = Next[i]])
using namespace std;

const int N = 4000 + 7 , Blo = 2001 , Mod = 1000000000 + 7 , M = 2000000 + 7;
inline int Mul(int A , int B) { return 1ll * A * B % Mod; }
inline int Inc(int A , int B) { A += B; return A >= Mod ? A - Mod : A; }
inline int Dec(int A , int B) { A -= B; return A < 0 ? A + Mod : A; }
inline int KSM(int x , int p) {
	int Ans = 1;
	while(p) {
		if(p & 1) Ans = Mul(Ans , x);
		x = Mul(x , x) , p >>= 1;
	}
	return Ans;
}
int n , Dp[N][N] , tota , totb , Fac[M] , Inv[M];
struct YYZ {
	int a , b;
}A[200000 + 7] , B[200000 + 7];
inline int C(int n , int m) { return Mul(Mul(Fac[n] , Inv[m]) , Inv[n - m]); }
inline int Solve1() {
	int Ret = 0;
	Rep(i , 1 , tota) inc(Dp[Blo - A[i].a][Blo - A[i].b]);
	Rep(i , 1 , (Blo << 1)) Rep(j , 1 , (Blo << 1)) Dp[i][j] = Inc(Dp[i][j] , Inc(Dp[i][j - 1] , Dp[i - 1][j]));
	Rep(i , 1 , tota) Ret = Inc(Ret , Dp[A[i].a + Blo][A[i].b + Blo]);
	Rep(i , 1 , tota) Ret = Dec(Ret , C((A[i].a + A[i].b) << 1 , A[i].b << 1));
	return Ret;
}
inline int Solve2() {
	int Ret = 0;
	Rep(i , 1 , totb) {
		Rep(j , 1 , tota) Ret = Inc(Ret , C(B[i].a + B[i].b + A[j].a + A[j].b , B[i].a + A[j].a));
		Rep(j , 1 , totb) if(i != j) Ret = Inc(Ret , C(B[i].a + B[i].b + B[j].a + B[j].b , B[i].a + B[j].a));
	}
	return Ret;
}

int main() {
	// freopen("gift.in" , "r" , stdin);
	// freopen("gift.out" , "w" , stdout);
	Fac[0] = 1; Rep(i , 1 , M - 1) Fac[i] = Mul(Fac[i - 1] , i);
	Inv[M - 1] = KSM(Fac[M - 1] , Mod - 2); rep(i , M - 2 , 0) Inv[i] = Mul(Inv[i + 1] , i + 1);
	int x , y;
	scanf("%d" , &n);
	Rep(i , 1 , n) {
		scanf("%d%d" , &x , &y);
		if(x >= Blo || y >= Blo) B[inc(totb)] = (YYZ){x , y};
		else A[inc(tota)] = (YYZ){x , y};
	}
	printf("%lld" , 1ll * Inc(Solve1() , Solve2()) * KSM(2 , Mod - 2) % Mod);
	return 0;
}

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

int main(){
    int M, K;
    cin >> M >> K;
    if (K >= (1 << M)) {
        cout << -1 << endl;
        return 0;
    }
    if (M == 1) {
        if (K == 1) cout << -1 << endl;
        if (K == 0) cout << "0 0 1 1" << endl;
        return 0;
    }
    cout << K;
    for (int i = (1 << M)-1; i >= 0; i--) {
        if (i != K) cout << " " << i;
    }
    cout << " " << K;
    for (int i = 0; i <= (1 << M)-1; i++) {
        if (i != K) cout << " " << i;
    }
    cout << endl;
    return 0;
}

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

int main(){
	int h,w;cin>>h>>w;
	vector<vector<char>> a(h,vector<char>(w));
	vector<int> cnt(26,0);
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			cin>>a[i][j];
			cnt[a[i][j] - 'a'] ++;
		}
	}
	if (w % 2 == 0 && h % 2 == 0){
		for(int i = 0; i < 26; i++) {
			if (cnt[i] % 4 != 0){
				cout << "No" << endl;
				return 0;
			}
		}
	}
	else if (w % 2 == 1 && h % 2 == 1){
		int check = 0;
		bool check2 = false;
		for(int i = 0; i < 26; i++) {
			if (cnt[i] % 4 == 0)continue;
			if (cnt[i] % 4 == 2){
				if (check == (h / 2) + (w / 2)){
					cout << "No" << endl;
					return 0;
				}
				else{
					check++;
				}	
			}
			else{
				if (check2){
					 cout << "No" << endl;
					 return 0;
				}
				check2 = true;
			}
		}
	}
	else {
		int check = 0;
		for(int i = 0; i < 26; i++) {
			if (cnt[i] % 2 == 1){
					cout << "No" << endl;
					return 0;
			}
			if (cnt[i] % 4 == 2){
				if ( w % 2 == 1){
					if (check == h / 2){
						cout << "No" << endl;
						return 0;
					}
					else{
						check++;
					}
				}
				else{
					if (check == w / 2){
						cout << "No" << endl;
						return 0;
					}
					else{
						check++;
					}
				}
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll mo=998244353;
const int NUM_=1200001;
static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
ll comb(ll N_, ll C_) {
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}

ll modpow(ll a, ll n = mo-2) {
	ll r=1;a%=mo;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}

int N,M;

void solve() {
	int i,j,k,l,r,x,y; string s;
	comb(0,0);
	cin>>N>>M;
	ll ret=0;
	
	FOR(i,min(N,M)+1) {
		ll pat=comb(N,i)*comb(M,i)%mo*fact[i]%mo*modpow(M+1,N-i)%mo*modpow(N+1,M-i)%mo;
		if(i%2==0) ret+=pat;
		else ret+=mo-pat;
	}
	cout<<ret%mo<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 28416
#include<queue>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define ll long long
#define inf 1000000000LL
#define mod 1000000007
using namespace std;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int vis[105];
int main()
{
    string a,b,c;
    while(cin>>a>>b>>c){
        if(a[a.length()-1]==b[0]&&b[b.length()-1]==c[0]) puts("YES");
        else puts("NO");
    }
    return 0;
}



Measured memory_bytes: 256