akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

int main(void) {
	char buf[10001], comp[2][4] = {"JOI", "IOI"};
	int cou[2], i,c, t[2];
	
	while(scanf("%s", buf) != EOF){
		cou[0] = 0;
		cou[1] = 0;
		for(i = 0; strlen(buf)-2 > i; i++){
			t[0] = 0;
			t[1] = 0;
			for(c = 0; 3 > c; c++){
				if(comp[0][c] != buf[i + c]) t[0] = 1;
				if(comp[1][c] != buf[i + c]) t[1] = 1;
			}
			if(t[0] == 0)cou[0]++;
			if(t[1] == 0)cou[1]++;
		}
		printf("%d\n%d\n", cou[0],cou[1]);
	}
	return 0;
}

Measured memory_bytes: 980
N=int(input())
#N=list(map(int,input().split()))

min=10**12
for i in range(int(N**0.5)):
 if (N % (i+1))==0 and min>((N//(i+1))+i+1):
    min=(N//(i+1))+i+1
  
print(min-2)

Measured memory_bytes: 2940
/* - - - - - - - - - - - - - - -
	User : 		VanishD
	problem :	[abc101C]
	Points : 	
- - - - - - - - - - - - - - - */
# include <bits/stdc++.h>
# define 	ll 		long long
using namespace std;
const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
int read(){
	int tmp = 0, fh = 1; char ch = getchar();
	while (ch < '0' || ch > '9'){ if (ch == '-') fh = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9'){ tmp = tmp * 10 + ch - '0'; ch = getchar(); }
	return tmp * fh;
}
int n, k, id;
int main(){
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	n = read(), k = read();
	for (int i = 1; i <= n; i++){
		int num = read();
		if (num == 1){
			id = i;
			continue; 
		}
	}
	int l = id - 1, r = n - id, ans = inf;
	for (int i = 1; i <= k - 1; i++){
		int nowr = r - i, nowl = l - (k - i - 1), tmp = 1;
		if (nowl > 0) tmp += (nowl - 1) / (k - 1) + 1;
		if (nowr > 0) tmp += (nowr - 1) / (k - 1) + 1;
		ans = min(ans, tmp);
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(void)
{
	int T;
	cin>>T;
	int tx=0,ty=0,tt=0;
	while(T--){
		int t,x,y;
		cin>>t>>x>>y;
		int m=abs(tx-x)+abs(ty-y);
		int ttt1 = t-tt;
		if(m > ttt1){
			puts("No");
			return 0;
		}
		if((ttt1-m)%2==1){
			puts("No");
			return 0;
		}
		tx=x;
		ty=y;
		tt=t;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;
const int MAXN = 9e5 + 10 , MOD = 1e9 + 7;
int fac[MAXN] , ifac[MAXN] , f3[MAXN];
void init(){
	fac[0] = fac[1] = 1;
	for(int i = 2 ; i < MAXN ; ++ i)
		fac[i] = 1ll * fac[i - 1] * i % MOD;
	ifac[0] = ifac[1] = 1;
	for(int i = 2 ; i < MAXN ; ++ i)
		ifac[i] = MOD - 1ll * ifac[MOD % i] * (MOD / i) % MOD;
	for(int i = 2 ; i < MAXN ; ++ i)
		ifac[i] = 1ll * ifac[i - 1] * ifac[i] % MOD;
	f3[0] = 1;
	for(int i = 1 ; i < MAXN ; ++ i)
		f3[i] = 1ll * f3[i - 1] * 3 % MOD;
}

int C(int a , int b){
	if(b < 0 || b > a) return 0;
	return 1ll * fac[a] * ifac[b] % MOD * ifac[a - b] % MOD;
}
int n , m , k;
int main(){
	init();
	cin >> n >> m >> k;
	int ans = 0 , last = 1 , st = 0 , ed = 0;
	for(int i = 0 ; i <= m + k ; ++ i){
		ans = (ans + 1ll * last * f3[m + k - i] % MOD * C(n + i - 1 , n - 1)) % MOD;
		last = 2ll * last % MOD;
		last = (last + C(i , st - 1)) % MOD;
		last = (last + MOD - C(i , ed)) % MOD;
		if(i - st >= m){
			last = (last + MOD - C(i + 1 , st)) % MOD;
			st ++;
		}
		if(ed < k){
			ed ++;
			last = (last + C(i + 1 , ed)) % MOD;
		} 
		if(st > ed) break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 10752
class UnionFind():
    def __init__(self,n):
        self.n = n
        self.parents = [-1]*n

    def find(self,x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x,y = y,x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def _size(self,x):
        return -self.parents[self.find(x)]

    def same(self,x,y):
        return self.find(x) == self.find(y)

    def members(self,x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i,x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return "\n".join("{}:{}".format(r,self.members(r)) for r in self.roots())


N,M = map(int,input().split())

U = UnionFind(N)

for i in range(M):
    A,B = map(int,input().split())
    A -= 1
    B -= 1
    U.union(A,B)

print(len(U.roots())-1)

Measured memory_bytes: 12948
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int main(){
    int n;
    cin >> n;
    if(n % 2 == 1)cout << n*2 << endl;
    else cout << n << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  long double v[n];
  for (int i=0;i<n;i++){
    cin >> v[i];
  }
  sort(v,v+n);
  for (int i=1;i<n;i++){
    v[i] = (v[i] + v[i-1])/2.0;
  }
  cout << v[n-1]<<endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DDigitSumReplace solver = new DDigitSumReplace();
        solver.solve(1, in, out);
        out.close();
    }

    static class DDigitSumReplace {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int m = in.nextInt();
            int[] d = new int[m];
            long[] c = new long[m];
            for (int i = 0; i < m; i++) {
                d[i] = in.nextInt();
                c[i] = in.nextLong();
            }

            long semivariant = 0;
            for (int i = 0; i < m; i++) {
                semivariant += 9 * c[i];
                semivariant += d[i] * c[i];
            }

            long answer = semivariant / 9 - 1;
            if (semivariant % 9 == 0)
                answer--;
            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 44376
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    ll N;
    cin >> N;
    map<ll, ll>mp;
    ll imos = 0;
    ll ans = 0;
    mp[0] = 1;
    for(ll i = 0; i < N; i++){
        ll a;
        cin >> a;
        imos += a;
        ans += mp[imos];
        mp[imos]++;
    }
    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 12800
<?php
fscanf(STDIN,"%d",$operand);

// 処理
// 商と余りを出力する関数
function quotientAndReminder($operand, $operator) {
  $reminder = $operand % $operator;
  $quotient = ($operand - $reminder) / $operator;
  $result = array($quotient, $reminder);
  return $result;
}



// 500円玉による嬉しさを算出
$result_500 = quotientAndReminder($operand, 500);
$happy_500 = $result_500[0] * 1000;

// 5円玉による嬉しさを算出
$operand = $result_500[1];
$result_5 = quotientAndReminder($operand, 5);
$happy_5 = $result_5[0] * 5;

echo $happy_500 + $happy_5;
?>

Measured memory_bytes: 3828
#include <stdio.h>

int main(void) {
	int N,i;
	scanf("%d",&N);
	for(i=0;i<N;i++) {
		int x,y,b,p;
		int ret=0;
		scanf("%d%d%d%d",&x,&y,&b,&p);
		if(b>=5 && p>=2) {
			ret=(x*b+y*p)*8/10;
		} else {
			int b2,p2,ret2;
			ret=x*b+y*p;
			b2=(b>=5?b:5);
			p2=(p>=2?p:2);
			ret2=(x*b2+y*p2)*8/10;
			if(ret2<ret)ret=ret2;
		}
		printf("%d\n",ret);
	}
	return 0;
}

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

int main(){
    int X, N;
    cin >> X >> N;
    if (N == 0) {
        cout << X << endl;
        return 0;
    }
    set<int> S;
    rep(i,N) {
        int a;
        cin >> a;
        S.insert(a);
    }

    auto ite0 = S.find(X);
    if (ite0 == S.end()) {
        cout << X << endl;
        return 0;
    }
    rep1(i,100) {
        auto ite1 = S.find(X-i);
        if (ite1 == S.end()) {
            cout << X-i << endl;
            return 0;
        }
        auto ite2 = S.find(X+i);
        if (ite2 == S.end()) {
            cout << X+i << endl;
            return 0;
        }
    }



}

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

int main() {
	long n,T,k=0;
	cin>>n>>T;
	long t[n];
	for(int i=0;i<n;i++)cin>>t[i];
	if(n==1)cout<<T<<endl;
	else{
	for(int i=0;i<n-1;i++){
		if((t[i+1]-t[i]-T)>0)k+=(t[i+1]-t[i]-T);
	}
	
	cout<<t[n-1]-k+T<<endl;
	}
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<unordered_set>
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<char>>v(h,vector<char>(w));
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>v[i][j];
        }
    }
    unordered_set<int>row,column;
    for(int i=0;i<h;i++)
    {
        bool no=false;
        for(int j=0;j<w;j++)
        {
            if(v[i][j]!='.'){
                no=true;
                break;
            }
        }
        if(!no){
            row.insert(i);
        }
    }
    for(int i=0;i<w;i++)
    {
        bool no=false;
        for(int j=0;j<h;j++)
        {
            if(v[j][i]!='.'){
                no=true;
                break;
            }
        }
        if(!no){
            column.insert(i);
        }
    }
    for(int i=0;i<h;i++)
    {
        if(row.find(i)!=row.end()){
            continue;
        }
        for(int j=0;j<w;j++)
        {
            if(column.find(j)!=column.end()){
                continue;
            }
            else
            cout<<v[i][j];
        }

        cout<<endl;
    }
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

const int N=2e5+5;
int A[N];
map<int,int> mp;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    REP(i,n) cin>>A[i];
    REP(i,n) mp[A[i]]++;
    LL ans=0;
    for(auto it:mp) {
        LL m=it.second;
        if(m>=2) {
            ans+=(m-1)*m/2;
        }
    }
    REP(i,n) {
        LL m=mp[A[i]];
        if(m<2) cout << ans << '\n';
        else if(m==2) cout << ans-1 << '\n';
        else {
            cout << ans-m*(m-1)/2+(m-1)*(m-2)/2 << '\n';
        }
    }

    return 0;
}

Measured memory_bytes: 8320
H, W, K = map(int, input().split())

hw = []
for i in range(H):
    w = list(input())
    hw.append(w)


def check(h_ok, w_ok):
    sum = 0
    for h in range(H):
        for w in range(W):
            if h_ok[h] == 0 and w_ok[w] == 0 and hw[h][w] == "#":
                sum+=1
    return sum == K


result = 0

for h1 in [0, 1]:
    for h2 in [0, 1]:
        for h3 in [0, 1]:
            for h4 in [0, 1]:
                for h5 in [0, 1]:
                    for h6 in [0, 1]:
                        for w1 in [0, 1]:
                            for w2 in [0, 1]:
                                for w3 in [0, 1]:
                                    for w4 in [0, 1]:
                                        for w5 in [0, 1]:
                                            for w6 in [0, 1]:
                                                h_ok = {}
                                                w_ok = {}
                                                h_ok[0] = h1
                                                h_ok[1] = h2
                                                h_ok[2] = h3
                                                h_ok[3] = h4
                                                h_ok[4] = h5
                                                h_ok[5] = h6
                                                w_ok[0] = w1
                                                w_ok[1] = w2
                                                w_ok[2] = w3
                                                w_ok[3] = w4
                                                w_ok[4] = w5
                                                w_ok[5] = w6
                                                if check(h_ok, w_ok):
                                                    result+=1
for h in range(6-H+6-W):
    result /= 2

print(int(result))



Measured memory_bytes: 70104
import scala.math._

object Main {
  val sc = new java.util.Scanner(System.in)
  def find(s: String, t: String): Boolean = {
    for(i <- 0 until t.size) {
      val u = t.drop(i) ++ t.take(i)
      if(u.startsWith(s)) {
        return true
      }
    }
    return false
  }
  def main(args: Array[String]) {
    val s = sc.next
    val n = sc.nextInt
    var ans = 0
    for(i <- 1 to n) {
      val t = sc.next
      if(find(s, t)) {
        ans += 1
      }
    }
    println(ans)
  }
}

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

using namespace std;

int main() {
  int N, M, X, Y;
  vector<int> x;
  vector<int> y;

  cin >> N >> M >> X >> Y;

  int num;
  for (int i = 0; i < N; i++) {
    cin >> num;
    x.push_back(num);
  }
  sort(x.begin(), x.end(), std::greater<int>());
  for (int i = 0; i < M; i++) {
    cin >> num;
    y.push_back(num);
  }
  sort(y.begin(), y.end());

  int x_max = x[0];
  int y_min = y[0];
  // cout << "x_max:" << x_max << endl;
  // cout << "y_min:" << y_min << endl;

  // cout << x_max << " < Z <= " << y_min << endl;

  for (int i = X+1; i <= Y; i++) {
    if (i > x_max && i <= y_min) {
      // cout << i << endl;
      cout << "No War" << endl;
      return 0;
    }
  }
  cout << "War" << endl;
}


Measured memory_bytes: 256
A, B = map(int, input().split())

for i in range (1,1010):
  if i != 1009:
    if int(i * 0.08) == A and int(i * 0.10) == B:
      print(i)
      break
      
  if i == 1009:
    if int(i * 0.08) == A and int(i * 0.10) == B:
      print(i)
      break
      
    else:
      print('-1')
    
  
  

Measured memory_bytes: 3060
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)


int main(){

	string s;
	while(cin >> s){

		int n=s.size();
		int a=0; int b=0;

		rep(i,n-2){
		if(s[i]=='J' && s[i+1]=='O' && s[i+2]=='I') a++;
		if(s[i]=='I' && s[i+1]=='O' && s[i+2]=='I') b++;
		}

		cout << a << endl;
		cout << b << endl;

	}

	return 0;
}

Measured memory_bytes: 1196
a, b, c = map(int, input(). split())
if a > b:
    a, b = b, a
if b > c:
    c, b = b, c
#　なぜもう一度　a>bなのかは
#　紙とペンで考えてみて
if a > b:
    a, b = b, a
print(a, b, c)


Measured memory_bytes: 5600
#include<string>
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)

int main() {
    string T;
    cin >>T;
    string ans = T;
    rep(i,ans.length()){
        if(T[i] == '?'){ 
            ans[i] = 'D';
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3484
#include<stdio.h>
int main()
{
    int N;
    int K;
    int X;
    int Y;
    int money;

    scanf("%d", &N);
    scanf("%d", &K);
    scanf("%d", &X);
    scanf("%d", &Y);

    if ((N - K) > 0)
    {
        money = K * X + (N - K) * Y;
        printf("%d\n", money);
    }
    else
    {
        money = N * X ;
        printf("%d\n", money);
    }



    return 0;
}




Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;
ll x, y;
int main() {
  int r = 0;
  cin >> x >> y;
  while (x <= y) {
    x *= 2;
    r++;
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[1005];
int main()
{
	scanf("%s",s);
	int n=strlen(s);
	for(int i=0;i<n-8;i++)
	{
		putchar(s[i]);
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define SIZE_OF_ARRAY(a) (sizeof(a)/sizeof(a[0]))



int main(){
    int ans;
    string ans2;
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int M;
    cin >> M;
    ans = N + M / 2;
   cout << ans << "\n";
}

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved
int main(){
    double l;
    cin>>l;
    double ans=(l*l*l)/27;

    printf("%.6lf\n",ans);


    return 0;

}
/*


*/


Measured memory_bytes: 256
let rec f i x a=let w=truncate(2.**(float i))in if w=x then w::a else if w<x then f(i-1)(x-w)(w::a)else f(i-1)x a and q()=q(List.iteri(fun i e->Printf.printf(if i=0then"%d"else" %d")e)(f 9(read_int())[]);print_newline());;try q()with _->()

Measured memory_bytes: 2408
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        char keep = line.charAt(0);
        int cnt = 0;


        for(int i = 1; i<line.length();i++){
            if(keep != line.charAt(i)){
                cnt++;
            }
            keep = line.charAt(i);
        }
        if(cnt!=0){
        System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

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

using namespace std;
typedef long long int ll;

int main()
{
    int A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;
    int ans = 0;
    for(int z = 0; z/2 <= max(X,Y);z++)
    {
        int a = max(0,X - z/2);
        int b = max(0,Y - z/2);
        int sum = A*a + B*b +C*z;
        if(ans == 0) ans = sum;
        else ans = min(ans,sum);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

const int N=1e5+10;
pair<LL, LL> A[N];

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

    LL n,m;
    cin >> n >> m;
    REP(i, n) cin >> A[i].first >> A[i].second;
    sort(A, A+n);
    
    LL ans=0;
    for(int i=0; i<n && m>0; i++) {
        ans += A[i].first*min(m, A[i].second);
        m-=min(m, A[i].second);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.io.*;
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer; 
import java.util.*;


public  class Main 
{

	   
	   static class FastReader 
	    { 
	        BufferedReader br; 
	        StringTokenizer st; 
	       
	  
	        public FastReader() 
	        { 
	            br = new BufferedReader(new
	                     InputStreamReader(System.in)); 
	        } 
	  
	        String next() 
	        { 
	            while (st == null || !st.hasMoreTokens()) 
	            { 
	                try
	                { 
	                    st = new StringTokenizer(br.readLine()); 
	                } 
	                catch (IOException  e) 
	                { 
	                    e.printStackTrace(); 
	                } 
	            } 
	            return st.nextToken();
	            
	        } 
	  
	        int nextInt() 
	        { 
	            return Integer.parseInt(next()); 
	        } 
	  
	        long nextLong() 
	        { 
	            return Long.parseLong(next()); 
	        } 
	  
	        double nextDouble() 
	        { 
	            return Double.parseDouble(next()); 
	        } 
	  
	        String nextLine() 
	        { 
	            String str = ""; 
	            try
	            { 
	                str = br.readLine(); 
	            } 
	            catch (IOException e) 
	            { 
	                e.printStackTrace(); 
	            } 
	            return str; 
	        }

			public Character charAt(int i) {
				// TODO Auto-generated method stub
				return null;
			} 
	    } 

  

	  // Complete the hurdleRace function below.
//    public static void solve() {
//    	FastReader s=new FastReader();

   
    public static void main(String[] args) throws IOException {
    	FastReader s=new FastReader();
    	int n = s.nextInt();
    	int a = s.nextInt();
   
    	System.out.println((n+a-1)/a);
    	
    	
    	
    	
    }	
}


Measured memory_bytes: 32476
#include<stdio.h>
int main(void)
{
	int a,b,c,d;
	
	scanf("%d %d %d",&a,&b,&c);

	if(b < a){
		d=a;
		a=b;
		b=d;
	}
	else{
	}
	if(c < b){
		d=c;
		c=b;
		b=d;
	}
	else{
	}
	if(b < a){
		d=a;
		a=b;
		b=d;
	}

	printf("%d %d %d\n",a,b,c);

	return 0;
}


Measured memory_bytes: 2064
#include<stdio.h>

int main(){
    int N;
    int A[200];
    int i, j, k;
    int nmin, tmp;
    int count=0;

    scanf("%d", &N);
    for(i=0; i<N; i++){
        scanf("%d", &A[i]);
    }
    for(i=0; i<N-1; i++){
        nmin = i;
        for(j=i+1; j<N; j++){
            if(A[j]<A[nmin]){
                nmin = j;
            }
        }
        if(i!=nmin){
            tmp = A[i];
            A[i] = A[nmin];
            A[nmin] = tmp;
            count += 1;
        }
    }

    for(i=0; i<N; i++){
        if(i>0){
            printf(" ");
        }
        printf("%d", A[i]);
    }
    printf("\n%d\n", count);

    return 0;
}


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

const int MAX = 1000000;
const int MOD = 1e9+7;

long mpow(long x, long n){
    long ans = 1;
    while(n != 0){
        if(n%2==1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n/2;
    }
    return ans;
}

long mfact(long n){
  long ans = 1;
  for(long i=2; i<=n; i++){
    ans = ans*i % MOD;
  }
  return ans;
}

long mcomb(long n, long m){ //aCbをmod計算
    if(n == 0 && m == 0) return 1;
    if(n < m || n < 0) return 0;
    long ans = mfact(n)*mpow(mfact(m), MOD-2) %MOD;
    ans = ans*mpow(mfact(n-m), MOD-2) %MOD;
    return ans;
}

int main(){
  int X, Y;
  cin >> X >> Y;
  if((X+Y)%3!=0 || X>2*Y || Y>2*X){
    cout << "0" << endl;
    return 0;
  }
  int n=X, m=Y;
  int p, q;
  if(X>=Y){
    while((n/m)!=2){
      n++, m--;
    }
    p=m; q=Y-m;
  }else{
    while((m/n)!=2){
      n--, m++;
    }
    p=n; q=X-n;
  }
  if(q==0){
    cout << "1" << endl;
    return 0;
  }
  cout << mcomb(p, q) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<deque>
#include<stack>
#include<ctime>
#include<queue>
#include<vector>
#include<cstdio>
#include<cstring>
#include<climits>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
int read(){
	int f=1,x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f*x;
}
#define MAXN 200000
#define INF 0x3f3f3f3f
int main(){
	int a=read(),b=read();
	if(1<=a&&a<=9&&1<=b&&b<=9)
		printf("%d\n",a*b);
	else puts("-1");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(){

    int a = 500;//infinite coin
    int b = 1;//limited

    int N,A;

    scanf("%d",&N);// harga
    scanf("%d",&A);//jumlah 1 yen

    int totalYen = b * A; //total

    int a2 = N % a;
    int a3 = totalYen -  a2;


    if(a3 >=0){

        printf("Yes");

    }


    else{
        printf("No");
    }


    return 0;
}


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

const int P = 1e9+7;
const int MAXN = 2e6+10;

LL fac[MAXN];
LL invf[MAXN];

LL fp(LL a, int n){
    if(n==0)
        return 1;

    LL h = fp(a, n/2);
    h = h*h%P;
    if(n&1){
        h = h * a % P;
    }
    return h;
}

int main(){
    int n, len;
    string s;

    cin >>n>>s;
    len = s.length() + n;

    fac[0] = fac[1] = invf[0] = invf[1] = 1;
    for(int i=2;i<MAXN;i++){
        fac[i] = fac[i-1] * i % P;
        invf[i] = invf[i-1] * fp(i, P-2) % P;
    }

    LL ans = 0;
    for(int i=s.length();i<=len;i++){
        LL c = fac[i-1] * invf[s.length()-1] % P * invf[i-s.length()] % P;
        ans += c * fp(25, i-s.length()) % P * fp(26, len-i) % P;
        ans %=P;
    }

    cout << ans;

}


Measured memory_bytes: 35564
#include "bits/stdc++.h"

// Begin Header {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

#define all(x) x.begin(), x.end()
#define rep(i, n) for (intmax_t i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (intmax_t i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (intmax_t i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

constexpr size_t    operator""_zu(unsigned long long value) { return value; };
constexpr intmax_t  operator""_jd(unsigned long long value) { return value; };
constexpr uintmax_t operator""_ju(unsigned long long value) { return value; };

constexpr int INF = 0x3f3f3f3f;
constexpr intmax_t LINF = 0x3f3f3f3f3f3f3f3f_jd;

template <class T, class Compare = less<>>
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template <class T, class Compare = greater<>>
using MinHeap = priority_queue<T, vector<T>, Compare>;

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

template <class T>
inline istream& operator>>(istream &is, vector<T> &vec) {
    for (auto &e: vec) {
        is >> e;
    }
    return is;
}

inline void output() { cout << "\n"; }
template <class Head, class... Tail>
inline void output(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) {
        cout << " ";
    }
    output(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e: vec) {
        os << e << delim[&e == &vec.back()];
    }
    return os;
}

template <class T>
inline vector<T> makeVector(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeVector(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeVector<T>(initValue, args...))>(sz, makeVector<T>(initValue, args...));
}

template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}

    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};

template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}

template <class T>
inline bool chmax(T &a, const T &b) noexcept {
    return b > a && (a = b, true);
}

template <class T>
inline bool chmin(T &a, const T &b) noexcept {
    return b < a && (a = b, true);
}

template <class T>
inline T diff(const T &a, const T &b) noexcept {
    return a < b ? b - a : a - b;
}
// End Header }}}

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

    var(intmax_t, N); output((N + 1) * N / 2);

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <deque>
#include <assert.h>
#include <random>
#include <bitset>
#include <string>
#include <cstring>
#include <memory.h>

using ll = long long;

const int inf = 1e9;
const ll infll = 1e18;

using namespace std;

struct Solution {
	Solution() {
		string s;
		string t;
		int n;
		cin >> n >> s >> t;
		reverse(s.begin(), s.end());
		reverse(t.begin(), t.end());
		string ans;
		while (s.size()) {
			ans.push_back(s.back());
			ans.push_back(t.back());
			s.pop_back();
			t.pop_back();
		}
		cout << ans;
	}
};

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
	//cin >> t;
	for (; t; t--) {
		Solution s;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int n, b, f, r, v;
    int i, j, k;
    int nums[4][3][10] = {{{}}};

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d %d %d %d", &b, &f, &r, &v);
        nums[b-1][f-1][r-1] += v;
    }

    for (i = 0; i < 4; i++) {
        for (j = 0; j < 3; j++) {
            for (k = 0; k < 10; k++) {
                printf(" %d", nums[i][j][k]);
            }
            printf("\n");
        }
        if (i < 3) printf("####################\n");
    }

    return 0;
}



Measured memory_bytes: 2104
type ABC(stream:System.IO.TextReader) =
  member this.Scan1 f = stream.ReadLine() |> f
  member this.Scan2 f = stream.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1]))
  member this.Scan3 f = stream.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1], a.[2]))
  member this.Scan4 f = stream.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1], a.[2], a.[3]))
  member this.ScanVecH f = stream.ReadLine().Split() |> Array.map f
  member this.ScanVecV n f = [| for i in 1..n -> stream.ReadLine() |> f |]
  member this.ScanMatrix n f  = [| for i in 1..n -> stream.ReadLine().Split() |> Array.map f |]
  member this.ScanCharMatrix n = [| for i in 1..n -> stream.ReadLine().ToCharArray() |]
  member this.Close () = stream.Close()

let util = ABC(stdin)

let N, M, X, Y = util.Scan4 int
let xs = util.ScanVecH int
let ys = util.ScanVecH int
let xmax = Array.max xs
let ymin = Array.min ys

let check1 = xmax < ymin
let check2 = X < (min ymin Y)
let check3 = (max xmax X) < Y
let check = check1 && check2 && check3

if check then "No War" else "War"
|> printfn "%s"



util.Close()


Measured memory_bytes: 14160
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define lp(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  string a,b;
  int c=0;
  cin>>a>>b;
  lp(i,3){
  if(a.at(i)==b.at(i))c++;
  }
  cout<<c;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;


public class Main {
    public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	int r = input.nextInt();
    	for(int i = 0 ; i < r ; i++){
    		//x^2 + y^2 + lx + my + n = 0
    		double x1 = input.nextDouble();
    		double y1 = input.nextDouble();
    		double x2 = input.nextDouble();
    		double y2 = input.nextDouble();
    		double x3 = input.nextDouble();
    		double y3 = input.nextDouble();

    		double x = ((y1-y3)*(y1*y1 -y2*y2 +x1*x1 -x2*x2) -(y1-y2)*(y1*y1 -y3*y3 +x1*x1 -x3*x3)) / (2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3));
    		double y = ((x1-x3)*(x1*x1 -x2*x2 +y1*y1 -y2*y2) -(x1-x2)*(x1*1 -x3*x3 +y1*y1 -y3*y3)) / (2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));
    		System.out.println(new BigDecimal(x).setScale(3, BigDecimal.ROUND_HALF_UP)+" "+new BigDecimal(y).setScale(3, BigDecimal.ROUND_HALF_UP)+" "+new BigDecimal(Math.sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y))).setScale(3, BigDecimal.ROUND_HALF_UP));
    	}
    }
}

Measured memory_bytes: 20456
#include <stdio.h>

    int gcd(int x, int y){
    int r = 1;
    while(r!=0){
        r = x%y;
        x = y;
        y = r;
    }
    return x;
}

int main(){
    int n;
    int a, b, c;
    int sum = 0;

    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        a = i;
        for(int j = 1; j <= n; j++){
            b = j;
            for(int k = 1; k <= n; k++){
                c = k;
                sum += gcd(gcd(a, b), c);
            }
        }
    }
    printf("%d", sum);

    }

Measured memory_bytes: 1736
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
vector<ll> v;
set<int> s;
vector<int> to;
int solve(int n){
    if(s.find(n) != s.end()) return n;
    else{
        s.insert(n);
        to.push_back(n);
        solve(int(v[n]));
    }
}
int main(){
    cout << fixed << setprecision(10);
    ll n,k;
    cin >> n >> k;
    rep(i,n){
        int x;
        cin >> x;
        x--;
        v.push_back(x);
    }
    int num = solve(0);
    int beg = 0;
    rep(i,int(to.size())){
        if(to[i] == num){
            beg = i;
        }
    }
    if(k < int(to.size())){
        cout << to[k] + 1 << endl;
        return 0;
    }
    vector<int> loop;
    for(int i = beg; i < int(to.size()); i++){
        loop.push_back(to[i]);
    }
    ll div = k - to.size();
    cout << loop[div%(loop.size())] + 1 << endl;
    return 0;
}


Measured memory_bytes: 21124
import java.util.Scanner;
public class Main {
	
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static int lcm (int a, int b) {return a*b/gcd(a,b);}
	static long Lgcd (long a, long b) {return b>0?Lgcd(b,a%b):a;}
	static long Llcm (long a, long b) {return a*(b/Lgcd(a,b));}
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan=new Scanner(System.in);
		long ans=1;
		int a=scan.nextInt();
		for(int i=0;i<a;i++) {
			long b=scan.nextLong();
			if(ans!=b) {
			ans=Llcm(ans,b);
		}
			}
		System.out.println(ans);
		
	}

}


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

int main() {
	int a, b, c;
	char r;
	int rec, loz;
	rec = 0;
	loz = 0;
	while (cin >> a >> r >> b >> r >> c){
		if (a == b){
			loz += 1;
		}else if (a * a + b * b == c * c){
			rec += 1;
		}
	}
	cout << rec << endl << loz << endl;
}

Measured memory_bytes: 3004
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int g[25][25];

void solve() {
  int n, d;
  cin >> n >> d;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < d; j++) {
      cin >> g[i][j];
    }
  }
  int ret = 0;
  for(int i = 0; i < n; i++) {
    for(int j = i+1; j < n; j++) {
      int curr = 0;
      for(int k = 0; k < d; k++) {
        int xx = g[i][k] - g[j][k];
        curr += xx*xx;
      }
      int now = (int)sqrt(curr);
      if(now*now == curr) ret++;
    }
  }
  cout << ret << "\n";
}

void casesolve() {
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << " ";
    solve();
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  // casesolve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int INF=1e9+7;
ll find(ll aa[],ll nn,ll kk)
{
    vector<ll> dp(nn,INF);
    dp[0]=0;
    for(ll i=0;i<nn;i++)
    {
        for(ll j=i+1;j<=(i+kk);j++)
        {
           if(j<nn) dp[j]=min(dp[j],dp[i]+abs(aa[i]-aa[j]));
           else break;
        }
    }
    return dp[nn-1];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll nn,kk; cin>>nn>>kk;
    ll aa[nn];
    for(ll i=0;i<nn;i++) cin>>aa[i];
    cout<<find(aa,nn,kk);
}

Measured memory_bytes: 4748
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout<<fixed<<setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

string add(const string&_arg1, const string&_arg2)
{
	string arg1 = _arg1, arg2 = _arg2;
	string zero;
	REP(i, abs((ll)arg1.length() - (ll)arg2.length()))zero.push_back('0');
	if (arg1.length() < arg2.length()) {
		arg1 = zero + arg1;
	} else {
		arg2 = zero + arg2;
	}
	string ret;
	int carry = 0;
	auto ctoi = [](char c) {return c - '0'; };
	auto itoc = [](int n) {return (char)('0' + n); };
	REPR(i, arg1.length()) {
		int foo = ctoi(arg1[i]) + ctoi(arg2[i]) + carry;
		ret.push_back(itoc(foo % 10));
		carry = foo / 10;
	}
	if (carry != 0)ret.push_back(itoc(carry));
	reverse(ALL(ret));
	return ret;
}
signed main()
{
	string inpt;
	while (cin >> inpt) {
		bool f = false;
		REP(i, 10) {
			string cp = inpt;
			replace(ALL(cp), 'X', (char)('0' + i));
			replace(ALL(cp), '+', ' ');
			replace(ALL(cp), '=', ' ');
			string arg1, arg2, ans;
			stringstream ss(cp);
			ss >> arg1 >> arg2 >> ans;
			if (add(arg1, arg2) == ans) {
				cout << i << endl;
				f = true;
				break;
			}
		}
		if (!f) {
			cout << "NA" << endl;
		}
	}
}


Measured memory_bytes: 3136
#include<iostream>
using namespace std;
typedef pair<int,int> P;
int main()
{
  P p[4];
  cin >> p[0].first >> p[0].second
    >> p[1].first >> p[1].second;
  int dx = p[1].first - p[0].first;
  int dy = p[1].second - p[0].second;
  p[2].first = p[1].first - dy;
  p[2].second = p[1].second + dx;
  p[3].first = p[2].first - dx;
  p[3].second = p[2].second - dy;
  cout << p[2].first << " " << p[2].second << " "
    << p[3].first << " " << p[3].second << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

static const double pi = 3.141592653589793;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(10)<<fixed;
  double a, b, x;
  cin>>a>>b>>x;
  // if(a*a*b==x){
  //   cout<<0<<'\n';
  //   return 0;
  // }
  if(a*a*b/2<x){
    double lb=0, ub=90;
    REP(_, 10000){
       double mid=(lb+ub)/2;
      if(a*a*b-0.5*a*a/tan(pi/180*mid)*a>x){
        ub=mid;
      }
      else{
        lb=mid;
      }
    }
    cout<<90-ub<<'\n';
  }
  else{
    double lb=0, ub=90;
    REP(_, 10000){
      double mid=(lb+ub)/2;
      if(0.5*b*b*tan(pi/180*mid)*a>x){
        ub=mid;
      }
      else{
        lb=mid;
      }
    }
    cout<<90-ub<<'\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;

const ll mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint dp[55][55][1305];

int main() {
  int n, score;
  cin >> n >> score;
  dp[0][0][0] = 1;
  rep(i,n) {
    rep(j,i+1)rep(k,score/2+1) {
      {
        int nj = j;
        dp[i+1][nj][k+nj] += dp[i][j][k];
      }
      {
        int nj = j+1;
        dp[i+1][nj][k+nj] += dp[i][j][k];
      }
      {
        int nj = j;
        mint x = j*2;
        dp[i+1][nj][k+nj] += dp[i][j][k]*x;
      }
      if (j >= 1) {
        int nj = j-1;
        mint x = j*j;
        dp[i+1][nj][k+nj] += dp[i][j][k]*x;
      }
    }
  }
  mint ans = dp[n][0][score/2];
  if (score&1) ans = 0;
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 34484
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int X[] = new int[N];
    for(int i=0;i<N;i++){
      X[i]=sc.nextInt();
    }
    int P[] = new int[100];
    for(int i=1;i<=100;i++){
      for(int j=0;j<N;j++){
        P[i-1]=P[i-1]+(i*i-2*i*X[j]+X[j]*X[j]);
      }
    }
    Arrays.sort(P);
    System.out.println(P[0]);
  }
  

  
}

Measured memory_bytes: 22740
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>
using namespace std;

typedef long long ll;
typedef string S;
typedef pair<int,int> P;
typedef vector<int> vi;
const int mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,sum=0;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
        sum+=a[i];
    }
    for(int i=0;i<n;i++){
        if(sum-a[i]<=a[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

ll N, M;

int main(){
	cin >> N >> M;
	if(N==M){
		p("Yes");
	}else{
		p("No");
	}

	return 0;
}

Measured memory_bytes: 256
import heapq
n,m = list(map(int, input().split()))
a = list(map(lambda x: int(x) * -1, input().split()))
heapq.heapify(a)
for i in range(m):
    tmp=heapq.heappop(a)
    heapq.heappush(a, -((-tmp) // 2))
print(-sum(a))


Measured memory_bytes: 14252
/// WA

#include<bits/stdc++.h>
     
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()

using namespace std;

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

const int MOD = 1e9 + 7;
const int INF32 = 1e9 + 1e2;

void stndrtin() {
#ifdef ADIL    
    freopen(".in", "r", stdin);
#endif
}
              
const int N = 1e5+10;

bool dp[N];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr), stndrtin();
    int n, w;
    cin >> n >> w;
    vector<int> a(n);
    for (int& x : a)
        cin >> x;
    dp[0] = 0;
    for (int x = 1; x <= w; ++x) {
        dp[x] = 0;
        for (int y : a) {
            if (y > x) 
                break;
            if (!dp[x-y]) 
                dp[x] = 1;
        }
    }
    cout << (dp[w] ? "First" : "Second");
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
 
int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    ll total = 0;
    for(int i=0; i<N; i++) {
        int a;
        cin >> a;
        A[i] = a;
        total += a;
    }
 
    ll sum = 0;
    for(int i=0; i<N-1; i++) {
        total -= A[i];
        sum += (A[i] * (total % (1000000000+7)));
        sum %= 1000000000+7;
    }
    cout << sum % (1000000000+7) << endl;
}

Measured memory_bytes: 4740