akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

using namespace std;

int main(void){
	int n, cnt;
	
	while(cin>>n){
		cnt=0;
		for(int a=0;a<=9;a++){
			for(int b=0;b<=9;b++){
				for(int c=0;c<=9;c++){
					for(int d=0;d<=9;d++){
						if(a+b+c+d==n)
							cnt++;
					}
				}
			}
		}
		cout<<cnt<<endl; 
	}
	return 0;
} 


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  string S;
  cin >> S;
  
  int N = 26;
  
  
  bool moji[N] = {false};
  
  for (int i = 0; i < S.size(); i++) {
    moji[S.at(i) - 'a'] = true;
  }
  for (int i = 0; i < N; i++) {
    if (!moji[i]) {
      cout << char (i + 'a') << endl;
      return 0;
    }
    
    if (i == N-1) {
      cout << "None" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 512
#include<stdio.h>
int main(){
  int n,i,j;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    if(i%3==0)printf(" %d",i);
    else if(i%10==3)printf(" %d",i);
    else if(i%100>=30 && i%100<40)printf(" %d",i);
    else if(i%1000>=300 && i%1000<400)printf(" %d",i);
    else if(i%10000>=3000 && i%10000<4000)printf(" %d",i);
  }
  printf("\n");
  return(0);
}

Measured memory_bytes: 600
#include<stdio.h>

int S[100000], n;

int binarySearch(int key){

  int left = 0;
  int right = n;
  int mid;

  while ( left < right ) {
    mid = (left + right) / 2;
    if ( S[mid] == key ) return 1;
    else if ( key < S[mid] ) right = mid;
    else left = mid + 1;
  }
  return 0;
}

int main(){

  int q, i, t, count;
  count = 0;

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &S[i]);

  scanf("%d", &q);
  for ( i = 0; i < q; i++){
    scanf("%d", &t);
    if ( binarySearch( t ) ) count++;
  }
  printf("%d\n", count);  

  return 0;

}

Measured memory_bytes: 2076
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
int main(){
  int n;
  cin>>n;
  int ans=1e9;
  int a[n];
  r(i,n)cin>>a[i];
  for(int i=-100;i<=100;i++){
    int sum=0;
    r(j,n)sum+=(i-a[j])*(i-a[j]);
    ans=min(sum,ans);
  }
  cout<<ans<<endl;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int n;cin >>n;
    vector<int>p(n);
    for (int i = 0; i < n; ++i) {
        cin >>p[i];
        p[i]--;
    }
    int ans=0;
    for (int i = 0; i < n; ++i) {
        if(p[i]==i){
            ans++;
            if(i!=n-1) {
                if (p[i + 1] == i + 1)i++;
            }
        }
    }
    cout <<ans<<endl;
}


Measured memory_bytes: 3788
import bisect

n = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

ans = 0

for b in B:
  i = bisect.bisect_left(A, b)
  j = bisect.bisect_right(C, b)
  ans += i*(n-j)
  
print(ans)

Measured memory_bytes: 23092
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a)  (a).begin(),(a).end()
 
const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;
 
template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}
 
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main(){
  char c;
  cin >> c;
  c++;

  cout << c <<endl;

}


Measured memory_bytes: 256
#include <iostream>

int main(){
	unsigned int N;
	int Nmod0 = 0, Nmod1 = 0, Nmod2 = 0;
	int tmp;
	int ans = 0;

	std::cin >> N;

	for(int i = 0; i < N; i++){
		std::cin >> tmp;
		switch(tmp % 3){
			case 0:
				Nmod0++;
				break;
			case 1:
				Nmod1++;
				break;
			default:
				Nmod2++;
				break;
		}
	}
	if(Nmod2 == 0 && Nmod1 == 0){
		ans = 1;
	}else{
		ans += Nmod0 + 1;
		if(Nmod2 >= Nmod1){
			tmp = 2;
			Nmod2--;
		}else{
			tmp = 1;
			Nmod1--;
		}
		while(true){
			if(tmp == 1){
				Nmod1--;
				if(Nmod1 < 0){
					break;
				}
				tmp += 1;
			}else if(tmp == 2){
				Nmod2--;
				if(Nmod2 < 0){
					break;
				}
				tmp += 2;
			}
			tmp %= 3;
			ans++;
		}
	}
	if(Nmod1 > 0 || Nmod2 > 0) ans++;

	std::cout << ans << std::endl;
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
int a,b,c,d;
#define ll long long
int main(){
    cin>>a>>b>>c>>d;
    int x=(a+d-1)/d;
    int y=(c+b-1)/b;
    if(x>=y)
    	cout<<"Yes";
	else
		cout<<"No";
	return 0;
}


Measured memory_bytes: 3596
program kadomatsu
  implicit none
  integer :: n,a,b,c,i,j,k,count,distro
  integer :: bar(4)
  integer, allocatable :: l(:)
  integer, allocatable :: mp(:)

  read *, n,a,b,c
  allocate(l(n))
  do i = 1, n
    read*, l(i)
  end do
  allocate(mp(4**n))
    do j = 1, 4**n!pattern of junction
      bar = 0
      mp(j) = 0
      count = j
      do k = n,1,-1!number of bamboo
        distro = count/4**(k-1) + 1
        bar(distro) = bar(distro) + l(k)
        if (distro /= 4) mp(j) = mp(j) + 10
        count = mod(count,4**(k-1))
      end do
      if (bar(1)*bar(2)*bar(3) == 0) then
        mp(j) = 10000
      else
        mp(j) = mp(j) + abs(a-bar(1)) + abs(b-bar(2)) + abs (c-bar(3)) - 30
      end if
    end do
  print '(i0)', minval(mp)
  stop
end program kadomatsu


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){

    int m,d;
    cin>>m>>d;
    int cnt =0;
    for(int i=22;i<=d;i++){
        int a = (i%10);
        int b = i/10;
        if(a*b<=m && a>1 && b>1)cnt++;
    }
    cout<<cnt<<" ";

}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { std::fill( (T*)array, (T*)(array+N), val ); }
#define INF 1e9
#define PI (acos(-1))
#define mod (int)1e9+7
int main() {
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
std::vector<int>A['   '];int N,M,S['   '],B,L,R,I;int U(int z,int u){while(z<=N)S[z]+=u,z+=z&-z;}main(){scanf("%d%d",&M,&N);for(;~scanf("%d%d",&L,&R);)A[R-L+1].push_back(L);for(L=1;L<=N;L++){B=M;for(I=L;I<=N;I+=L){R=I;while(R)B+=S[R],R-=R&-R;}for(int u:A[L])U(u,1),U(u+L,-1),M--;printf("%d\n",B);}}

Measured memory_bytes: 53760
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let ma: i32 = input();
    let mb: i32 = input();
    let abc: Vec<(usize, usize, i32)> = (0..n)
        .map(|_| {
            let a = input();
            let b = input();
            let c = input();
            (a, b, c)
        })
        .collect();

    let mut dp = vec![vec![vec![i32::max_value(); 401]; 401]; n + 1];
    dp[0][0][0] = 0;
    for i in 0..n {
        let (a, b, c) = abc[i];
        for x in 0..401 {
            for y in 0..401 {
                if dp[i][x][y] == i32::max_value() {
                    continue;
                }
                dp[i + 1][x][y] = std::cmp::min(dp[i + 1][x][y], dp[i][x][y]);
                dp[i + 1][x + a][y + b] = std::cmp::min(dp[i + 1][x + a][y + b], dp[i][x][y] + c);
            }
        }
    }

    let mut ans = i32::max_value();
    for x in 1..401 {
        for y in 1..401 {
            if ma * y as i32 == mb * x as i32 {
                ans = std::cmp::min(ans, dp[n][x][y]);
            }
        }
    }

    if ans == i32::max_value() {
        ans = -1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 33020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1)
    {
        cerr << name << " = " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args)
    {
        const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " = " << arg1 << " || ";
        __f(comma+1, args...);
    }
#else
#define debug(...)
#endif
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll k;
 	cin >> k;
 	string s;
 	cin >> s;
 	if (sz(s) <= k) cout << s << endl;
 	else {
 		cout << s.substr(0, k);
 		cout << "..." << endl;
 	}   
	return 0;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
    public static void main(String... args){
        Scanner scan = new Scanner(System.in);
        String w = scan.next();
        w = w.toLowerCase();
        int count = 0;
        while(true){
            String s = scan.next();
            if(s.equals("END_OF_TEXT"))break;
            s = s.toLowerCase();
            if(w.equals(s))count++;
        }
        System.out.println(count);

        scan.close();
    }

}


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

int main() {
	// your code goes here
	ll n;
	cin>>n;
	ll a[n],s;
	for(ll i=0;i<n;i++)
	   cin>>a[i];
	s=a[0]^a[1];   
	for(ll i=2;i<n;i++)
	    s=s^a[i];
	for(ll i=0;i<n;i++)
	   cout<<(s^a[i])<<" ";
}


Measured memory_bytes: 5160
#include<stdio.h>
int main(void)
{
    int a,b; /* 数の箱*/
    char c, p; /* 文字の箱*/
    do{
        scanf("%d ",&a);
        scanf("%c",&c);/*文字は %c */
        scanf(" %d",&b);
        switch(c){ 
        case '-':
            printf("%d\n",a-b);
            break;
        case '+':
            printf("%d\n",a+b);
            break;
        case '*':
            printf("%d\n",a*b);
            break;
        case '/':
            printf("%d\n",a/b);
            break;
        case '%':
            printf("%d\n",a%b);
            break;
        default: /*どれにも当てはまらない場合*/
            break;
        }
    }while(c!='?'); /*cが'？'になるまで繰り返す*/
    return 0;
}


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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

constexpr long long MOD = 1000000007;
constexpr long long MOD2 = 998244353;
constexpr double EPS = 1e-10;
constexpr int INF = 1001001001;
constexpr ll LINF = 1001001001001001001ll;



int main() {
    int N, M; cin >> N >> M;
    PQ<double> q;
    rep(i, N) {
        double a; cin >> a;
        q.push(a);
    }

    rep(i, M) {
        double a = q.top(); q.pop();
        q.push(a / 2.0);
    }

    ll ans = 0;

    rep(i, N) {
        ans += (ll)floor(q.top());
        q.pop();
    }

    cout << ans << endl;

}




Measured memory_bytes: 1400
def slove(nodelist):
    for i in range(len(nodelist)):
        out = 'node %d: key = %d, ' % (i + 1, nodelist[i])
        if i > 0:
            out += 'parent key = %d, ' % (nodelist[(i - 1)//2])
        if 2 * i + 1 < len(nodelist):
            out += 'left key = %d, ' % (nodelist[2 * i + 1])
        if 2 * i + 2 < len(nodelist):
            out += 'right key = %d, ' % (nodelist[2 * i + 2])
        print(out)

if __name__ == '__main__':
    n = input()
    nodelist = [int(num) for num in input().split(' ')]
    slove(nodelist)


Measured memory_bytes: 5624
#include<stdio.h>
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a<b){
		printf("a < b\n");
	}
	else if(a>b){
		printf("a > b\n");
	}
	else{
		printf("a == b\n");
	}
	return 0;
}


Measured memory_bytes: 2108
#include<stdio.h>

int main(){
  int h = 0;
  int w = 0;
  int a = 0;
  int b = 0;
  int i = 0;
  int j = 0;
  scanf("%d %d %d %d",&h,&w,&a,&b);
  //h = 3;w = 3;a = 1;b=1;
  if(h/2<b || w/2<a){
    printf("No");
  }else{
    
  for(i=0;i<b;i++){
    for(j=0;j<a;j++){
      printf("0");
    }
    for(j=0;j<w-a;j++){
      printf("1");
    }
    printf("\n");
  }
  for(i=0;i<h-b;i++){
    for(j=0;j<a;j++){
      printf("1");
    }
    for(j=0;j<w-a;j++){
      printf("0");
    }
    printf("\n");
  }
  }
  return 0;
}

Measured memory_bytes: 1152
N,M=map(int,input().split())
request=[]
for _ in range(M):
    request.append(list(map(int,input().split())))
request.sort(key=lambda x: x[0])
    
memory=request[0][1]
head = request[0][0]
index = 0
ans = 0

def equal():
    if index == M-1: return False
    else: return head == request[index+1][0]

while head <= N:
    if head == memory:
        ans +=1
        memory = N+1
    elif equal():
        index +=1
        memory=min(request[index][1],memory)
    else: head +=1
        
print(ans)

Measured memory_bytes: 29068
A, B, H, M = map(int, input().split())
#A = float(A)
#B = float(B)
#H = float(H)
#M = float(M)

import numpy as np

angle = 2*np.pi*H/12 - 2*np.pi*M*11/(12*60)
length_squared = A**2 + B**2 - 2*A*B*np.cos(angle)
length = np.sqrt(length_squared)
#print('{:10f}'.format(length))
# 4.56425719433005567605

print(length)



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

int main() {
  int n; cin>>n;
  vector<vector<ll>> A(n, vector<ll>(n));
  rep(i, n) rep(j, n) cin>>A[i][j];

  ll INF=1e15;
  bool ok=true;
  vector<vector<ll>> dp(n, vector<ll>(n, INF));
  rep(i, n) rep(j, n) dp[i][j]=A[i][j];

  rep(k, n) {
    rep(i, n) {
      rep(j, n) {
        if(k==i||k==j||i==j) continue;
        if (dp[i][k]==INF||dp[k][j]==INF) continue;
        if (A[i][j]>dp[i][k]+dp[k][j]) ok=false;
        if (A[i][j]==dp[i][k]+dp[k][j]) dp[i][j]=INF;
      }
    }
  }
  if (ok) {
    ll res=0;
    rep(i, n) {
      rep(j, n) {
        if (dp[i][j]!=INF) res+=dp[i][j];
      }
    }
    cout<<res/2<<endl;
  }
  else cout<<-1<<endl;
}


Measured memory_bytes: 1664
//Robs Code
/***********HEADER***************/
#include <iostream>
#include <bitset>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <set>
#include <queue>
#include <map>
/***********MACROS***************/
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define pii pair<int,int>
using namespace std;
int n,m,i,j,l,k,x,y,a,b,cnt[3],sum[3];
/***********MAIN**************/
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int r,b,g,n;
	cin>>r>>g>>b>>n;
	int cnt = 0;
	for(int x=0;x<=3000;x++){
		for(int y=0;y<=3000;y++){
			if((n - r*x - g*y)>=0 && (n - r*x - g*y)%b == 0){
				cnt++;
			}
		}
	}
	cout<<cnt;
    return 0;
}
//.........

Measured memory_bytes: 256
(defun osum (a b c)
  (+ (* a 10000) (* b 5000) (* c 1000)))

(defun o (n y)
  (let ((res10k -1)
        (res5k -1)
        (res1k -1)
        (c 0))
    (dotimes (a (1+ n))
      (dotimes (b (- (1+ n) a))
        (setf c (- n a b))
        (when (= y (osum a b c))
          (setf res10k a)
          (setf res5k b)
          (setf res1k c))))
    (list res10k res5k res1k)))

(defun main ()
  (let* ((n (read))
         (y (read))
         (res (o n y)))
    (format t "~A ~A ~A" (car res) (cadr res) (caddr res))))

(main)


Measured memory_bytes: 6504
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

const int trans[6][6] =
{
	{1, 3, 5, 2, 4, 6},
	{5, 1, 3, 4, 6, 2},
	{4, 2, 1, 6, 5, 3},
	{3, 2, 6, 1, 5, 4},
	{2, 6, 3, 4, 1, 5},
	{6, 5, 3, 4, 2, 1}	
};

struct Cube
{
	vector<string> colors;
	Cube() : colors(6) {}
	
	Cube rotate(int s)
	{
		vector<string> tmp(6);
		rep(i, 6) tmp[trans[s][i]-1] = colors[i];
		colors = tmp;
		
		return *this;
	}
};

bool same(Cube a, Cube b)
{
	rep(i, 6) if(a.colors[0] == b.colors[i]) b.rotate(i);
	
	rep(i, 4) if(a.colors == b.rotate(0).colors) return true;
	
	return false;
}

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
	int count() {
		int res = 0;
		rep(i, data.size()) res += data[i] < 0;
		return res;
	}
};

int main()
{
    int n;
	while(cin >> n && n)
	{
		UnionFind uft(n);
		vector<Cube> cubes(n);
		
		rep(i, n) rep(j, 6) cin >> cubes[i].colors[j];
		
		rep(i, n) REP(j, i+1, n) if(same(cubes[i], cubes[j])) uft.unite(i, j);
		
		cout << n - uft.count() << endl;
	}
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;

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

    double a,b,x;
    cin>>a>>b>>x;
    x/=a;
    double PI=acos(-1);
    double half=a*b/2;
    cout<<fixed<<setprecision(10);
    if(half>=x){
        double hight=x/b*2;
        cout<<90-(atan(hight/b)*180/PI)<<endl;
    }else{
        double hight=(a*b-x)*2/a;
        cout<<90-(atan(a/hight)*180/PI)<<endl;
    }
}

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

using namespace std;

int n, m;
long long a[5005];
int b[5005][205], tg[205], Max[205];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i < n; i++)
    {
        cin >> a[i];
    }
    a[n] = 0;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            cin >> b[i][j];
        }
    }
    long long Resuft = 0, Length, Sum;
    for (int i = 1; i <= n; i++)
    {
        Sum = 0;
        for (int j = 1; j <= m; j++)
        {
            tg[j] = b[i][j];
            Sum += b[i][j];
            Max[j] = i;
        }
        Resuft = max(Resuft, Sum);
        Length = a[i];
        int dem = m;
        for (int j = i + 1; j <= n && dem > 0; j++)
        {
            Sum = 0;
            for (int k = 1; k <= m; k++)
            {
                if(tg[k] <= b[j][k])
                {
                    tg[k] = b[j][k];
                    if (Max[k] == i)
                    {
                        dem--;
                    }
                    Max[k] = j;
                }
                Sum = Sum + tg[k];
            }
            Resuft = max(Resuft, Sum - Length);
            Length = Length + a[j];
        }
    }
    cout << Resuft;
    return 0;
}


Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

		int num = Integer.parseInt(br.readLine());

		String[] vectorX = br.readLine().split(" ");
		String[] vectorY = br.readLine().split(" ");

		double[] vectorElement = new double[num];

		double distanceP1 = 0;
		double distanceP2 = 0;
		double distanceP3 = 0;
		double max = 0;

		for(int i = 0; i < num;i++){
			double convertX = Double.parseDouble(vectorX[i]);
			double convertY = Double.parseDouble(vectorY[i]);

			vectorElement[i] =Math.abs(convertX - convertY);
			distanceP1 += vectorElement[i];

			double power2Abs = Math.abs(vectorElement[i] * vectorElement[i]);
			distanceP2 += power2Abs;

			double power3Abs = Math.abs(vectorElement[i] * vectorElement[i] * vectorElement[i]);
			distanceP3 += power3Abs;

			if (i == 0){
				max = vectorElement[0];
			} else if (i > 0){
				max = Math.max(max, vectorElement[i]);
			}
		}
		System.out.printf("%.6f\n", distanceP1);

		double distanceP2Sqrt = Math.sqrt(distanceP2);
		System.out.printf("%.6f\n", distanceP2Sqrt);

		double distanceP3Cbrt = Math.cbrt(distanceP3);
		System.out.printf("%.6f\n", distanceP3Cbrt);

		System.out.printf("%.6f\n", max);

		br.close();
	}
}

Measured memory_bytes: 24908
n = int(input())
cnt = 0 
s = list(map(int,input().split()))
for i in range(n-2):
	
	t=[]
	t.append(s[i])
	t.append(s[i+1])
	t.append(s[i+2])

	t.sort()
	#print(t)
	if t[1] == s[i+1]:
		cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

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

    int n;
    cin >> n;
    vector<vector<int>> vvi = vector<vector<int>>(2+1, vector<int>(n+1, 0));
    for (int i = 1; i <= n; ++i) cin >> vvi[1][i];
    for (int i = 1; i <= n; ++i) cin >> vvi[2][i];
    int mscr = 0;
    for (int i = 1; i <= n; ++i)
    {   
        int k = 1;
        int scr = 0;
        for (int j = 1; j <= n; ++j)
        {
            scr += vvi[k][j];
            if (i == j) k = 2, scr += vvi[k][j];
        }
        mscr = max(mscr, scr);
    }
    cout << mscr << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
std::string replaceAll(std::string &replacedStr, std::string from, std::string to) {
    unsigned int pos = replacedStr.find(from);
    int toLen = to.length();
 
    if (from.empty()) {
        return replacedStr;
    }
 
    while ((pos = replacedStr.find(from, pos)) != std::string::npos) {
        replacedStr.replace(pos, from.length(), to);
        pos += toLen;
    }
    return replacedStr;
}
int main() {


//long long a,b;
//int *num=new int[4];
//char *s=new char[3];
string s;
cin >> s;

string te="";

int count=0;
for(int i=0;i<4;i++){
te+=s[count];
count++;
}
te+=' ';
for(int i=0;i<8;i++){
te+=s[count];
count++;
}



cout << te<<"\n";


}


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

//n*mの行列Aとm*lの行列Bの積行列Cを出力

int main()
{
	//型は適宜変更
	int n, m, l, A[100][100], B[100][100];
	long C[100][100] = { 0 }, x = 0;

	//列の長さを出力
	cin >> n >> m >> l;

	//行列A入力
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> A[i][j];
		}
	}

	//行列B入力
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			cin >> B[i][j];
		}
	}

	//計算
	for (int i = 0; i < n; i++) {//行列Aの縦
		for (int j = 0; j < l; j++) {//行列Bの横
			for (int k = 0; k < m; k++) {//行列Aの横,行列Bの縦
				x += A[i][k] * B[k][j];//一時的に格納
			}
			C[i][j] = x;//行列Cに代入
			x = 0;//xの初期化
		}
	}

	//出力
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			cout << C[i][j];
			if (j == l - 1) {
				cout << endl;
			}
			else {
				cout << " ";
			}
		}
	}

	return 0;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (int i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (int i = x.size()-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define fst first
#define scd second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int n;
set<int> st;

int main()
{
    cin>>n;
    st.insert(0);
    REP(i,n) {
        int d;
        cin>>d;
        if (d == 0) {
            cout<<0<<endl;
            return 0;
        }
        else if (!st.count(d)) {
            st.insert(d);
        } else if (!st.count(24 - d)) {
            st.insert(24 - d);
        } else {
            cout<<0<<endl;
            return 0;
        }
    }

    RREP(t,12+1) {
        //cout<<"t = "<<t<<" : ";
        set<int> c(st);
        c.insert(24);
        auto itr = c.begin();
        auto nitr = next(itr);
        bool flag = true;
        while (nitr != c.end()) {
            //cout<<*itr<<"-"<<*nitr<<"  ";
            if (*nitr - *itr >= t) {
                itr++;
                nitr++;
            } else if (*nitr < 12 && !st.count(24 - *nitr)) {
                c.insert(24 - *nitr);
                c.erase(nitr);
                nitr = next(itr);
            } else {
                flag = false;
                break;
            }
        }
        //nextline;

        if (flag) {
            cout<<t<<endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
// #pragma GCC optimize("O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

template<typename T>
void read(vector<T>& vec) {
    for (auto& v : vec) {
        cin >> v;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
	int x;
	cin >> x;
	int y = 360 * x / __gcd(360, x);
	cout << y / x << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()

int32_t main(){
	int n,m=1e16,tmp;
	cin>>n;
	for(int i=1;i<=5;i++){
		cin>>tmp;
		m=min(m,tmp);
	}
	cout<<n/m+5-(m==1);
}


Measured memory_bytes: 256
#coding:utf-8
N=int(input())
fizz_buzz=list()
for i in range(1,N+1):
	if i%3==0 and i%5==0:
		fizz_buzz.append(0)
	elif i%3==0:
		fizz_buzz.append(0)
	elif i%5==0:
		fizz_buzz.append(0)
	else:
		fizz_buzz.append(i)

print(sum(fizz_buzz))

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


int main(){
    int n,m,x;
    cin >> n >> m >> x;
    int c[n],a[n][m];
    for(int i=0; i<n; i++){
        cin >> c[i];
        for(int j=0; j<m; j++) cin >> a[i][j];
    }
    int ans = 10000000;
    for(int i=0; i<pow(2,n); i++){
        int t = i;
        int b[m];fill(b,b+m,0);
        int s=0;
        for(int j=0; j<n; j++){
            if(t%2){
                s += c[j];
                for(int h=0; h<m; h++){
                    b[h] += a[j][h];
                }
            }
            t /= 2;
        }
        bool judge = true;
        for(int j=0; j<m; j++){
            if(b[j] < x) judge = false;
        }
        if(judge) ans = min(ans,s);
    }
    if(ans != 10000000) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 4004
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <functional>
#include <queue>
#include <map>
#include <set>
#include <string>

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

char str[5];

int main()
{
	int A,B;
	scanf("%d %d",&A,&B);
	if(A<=B)
	{
		puts("Impossible");
		return 0;
	}
	vector <int> nxt;
	for(int i=0;i<A+B;i++) nxt.push_back(i);
	while(nxt.size()>A-B)
	{
		vector <int> zan;
		for(int i=0;i<nxt.size();i+=2)
		{
			if(i+1<nxt.size())
			{
				printf("? %d %d\n",nxt[i],nxt[i+1]);
				fflush(stdout);
				scanf("%s",&str);
				if(str[0]=='Y')
				{
					zan.push_back(nxt[i+1]);
				}
			}
			else zan.push_back(nxt[i]);
		}
		nxt=zan;
	}
	int v=nxt[0];
	vector <int> ans;
	for(int i=0;i<A+B;i++)
	{
		printf("? %d %d\n",v,i);
		fflush(stdout);
		scanf("%s",&str);
		ans.push_back(str[0]=='Y'?1:0);
	}
	printf("! ");
	for(int i=0;i<ans.size();i++) printf("%d",ans[i]);
	puts("");
	return 0;
}


Measured memory_bytes: 724
import java.util.Scanner;

public class Main {
	static int  min=Integer.MAX_VALUE;
	static int w[] = {200,300,500};
	static int p[] = {380,550,850};
	static int e[] = {5,4,3};
	static double r[] = {0.8,0.85,0.88};

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			min = Integer.MAX_VALUE;
			solve(0,n,0);
			System.out.println((int)min);
		}
	}

	public static void solve(int k, int rest,int cost) {
		if (rest == 0){
			min = Math.min(min, cost);
			return;
		}
		if(k==3||rest<0)return;
		for(int i=0;i<=5000/w[k];i++){
			solve(k+1,rest-w[k]*i,cost+(int)((i-i%e[k])*r[k]*p[k]+i%e[k]*p[k]));
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint INF = 1e18;
#define rep(i, n) for(int i = 0; i < int(n); i++)

signed main(){
	int k, x; cin >> k >> x;
	for(int i = max(x - k + 1, -1000000); i <= min(x + k - 1, 1000000); i++){
		cout << i << " ";
	}
	cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
	while (1) {
		int k, n, num[100010] = {}, pre = 1, now_max = 0, flag = 0, numorg;
		cin >> n >> k;
		if (n == 0 && k == 0) {
			break;
		}
		for (int i = 0; i < k; i++) {
			int a;
			cin >> a;
			num[a] = 1;

		}
		numorg = num[0];
		for (int i = 1; i <= n; i++) {
			if (num[i] == 1) {
				if (num[i + 1] == 1) {
					pre++;
				}
				else {
					if (num[i + 2] == 1 && num[0] == 1) {
						pre += 2;
						num[0] = 0;
					}
					else {
						now_max = max(pre, now_max);
						pre = 1;
						num[0] = numorg;
					}
				}
			}
		}

		cout << now_max << endl;
	}
	return 0;
}

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

char tolower(char ch) 
{
	if ('A' <= ch && ch <= 'Z') {
		return ch-'A'+'a';
	} else {
		return ch;
	}
}

int main()
{
	int count = 0;
	string W;

	cin >> W;

	string str;
	while (true) {
		cin >> str;

		if (str == "END_OF_TEXT")
			break;

		for (int i = 0; i < (int)str.size(); i++)
			str[i] = tolower(str[i]);

		if (str == W)
			count++;

	}

	cout << count << '\n';
	return 0;
}


Measured memory_bytes: 3204
fun main(args: Array<String>) {
    val (a, b, c) = readLine()!!.split(' ').map { it.toLong() }
    val d = c - a - b
    if (d > 0 && 4*a*b < d*d) {
        println("Yes")
    } else {
        println("No")
    }
}


Measured memory_bytes: 38256
#include <bits/stdc++.h>
typedef unsigned long long ll;
#define INF 1000000000
using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        return gcd(b,a);
    }
    while(b!=0){
        ll r=a%b;
        a=b;
        b=r;
    }
    return a;
}
int main(void){
    int n;
    cin>>n;
    vector<ll>t(n);
    for(int i=0;i<n;i++){
        cin>>t[i];
    }
    if(n==1){
        cout<<t[0]<<endl;
        return 0;
    }
     ll lcm=t[0]*(t[1]/gcd(t[0],t[1]));
    for(int i=2;i<n;i++){
        //cout<<lcm<<" "<<gcd(lcm,t[i])<<endl;
        ll tmp=lcm*t[i];
        lcm=lcm*(t[i]/gcd(lcm,t[i]));
    }
    cout<<lcm<<endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <climits>
#include <algorithm>

int min(int x, int y)
{
	return x>y ? y : x;
}

int main ()
{
	int n, m, r;
	std::cin >> n >> m;
	
	int** D = new int*[n];
	for (int i=0; i<n; i++) D[i] = new int[n];
	
	for (int i=0; i<n; i++) {
		for (int j=0; j<n; j++) D[i][j] = (i==j) ? 0 : INT_MAX;
	}
	
	for (int k=0; k<m; k++) {
		int i, j, w;
		std::cin >> i >> j >> w;
		D[i][j] = min(D[i][j], w);
	}
	
	for (int k=0; k<n; k++) {
		for (int i=0; i<n; i++) {
			for (int j=0; j<n; j++) {
				if (D[i][k] == INT_MAX || D[k][j] == INT_MAX) continue;
				if (D[i][j] > D[i][k] + D[k][j]) D[i][j] = D[i][k] + D[k][j];
			}
		}
	}
	
	bool negative_cycle = false;
	for (int i=0; i<n; i++) {
		if (D[i][i] < 0) {
			negative_cycle = true; break;
		}
	}
	
	if (negative_cycle) {
		std::cout << "NEGATIVE CYCLE" << std::endl;
	}
	else {
		for (int i=0; i<n; i++) {
			if(D[i][0] < INT_MAX) std::cout << D[i][0];
			else std::cout << "INF";
			for (int j=1; j<n; j++) {
				if(D[i][j] < INT_MAX) std::cout << " " << D[i][j];
				else std::cout << " INF";
			}
			std::cout << std::endl;
		}
	}

	
	return 0;
}



Measured memory_bytes: 3144
// Add compile option "-std=c++11" for C++11 compile.

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

// Macro
#define rep(i, N) for(int i=0; i<(int)N; i++)
#define rrep(i, N) for(int i=(int)N-1; i>=0; i--)

// Type
template <typename T> using P = pair<T, T>;
using ll = long long;
using ull = unsigned long long;

// Constants
const ll INF = 1e18;
const ll MOD = 1000000007;

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

  int H[N];
  rep(i, N) cin >> H[i];

  int canViewN = 0;
  int maxH = 0;
  rep(i, N) {
    if(H[i] >= maxH) {
      canViewN++;
      maxH = H[i];
    }
  }

  cout << canViewN << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, int> P;
#define MOD (1000000007ll)

ll sq(ll x){
	return x*x;
}

int main(void){
	ll a,b,x;
	cin >> a >> b >> x;
	if(a){
		a--;
		b /= x;
		a /= x;
		cout << (b-a) << endl;
	}else{
		cout << ((b/x)+1) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <math.h>

using namespace std;

typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
const int MOD = 1000000007;
const int INF = INT_MAX;



int main(int argc, char const *argv[])
{
    
    
    int a, b;
    cin >> a >> b;

    int min1 = max(a+b, a-b);
    int min2 = max(a-b, a*b);

    cout << max(min1, min2) << endl;
    



    return 0;
}




//              g++ -std=c++1z  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b; cin >> a >> b;
  if (a < b) cout << "a < b" << endl;
  if (a > b) cout << "a > b" << endl;
  if (a == b) cout << "a == b" << endl;
  return 0;
}


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

using namespace std;
#define _for(i,j,N) for(int i = (j); i < (N);i++)
#define _rep(i,j,N) for(int i = (j); i <= (N);i++)
#define ALL(x) x.begin(),x.end()
#define ESP 1e-15
#define LL long long


vector<LL> vl;
vector<int> vn;
const LL num = 1000000000000000;

LL get_ans(int n){
    stack<int> digit;
    while(n > 0){
        if(n < 9){
            digit.push(n);
        }
        else digit.push(9);
        n -= 9;
    }

    LL ans = 0;
    while(!digit.empty()){
        int d = digit.top();digit.pop();
        ans = ans*10+d;
    }
    return ans;
}

bool bigger(double x,double y){
    return x - ESP > y;
}

int main()
{
    int n = 1;

    while(true){
        LL ans = get_ans(n);
        if(ans > num) break;
        double frac = (double)ans/n;
       if(ans > 1000){
            int dig = log10(ans)-ESP;

            _for(j,1,10){
                //cout << frac <<" "<< ans-j*pow(10,dig-1) << " "<<n-j<<endl;
                if(frac > (double)(ans-j*pow(10,dig-1))/(n-j)){
                   vl.push_back(ans-j*pow(10,dig-1));
                   frac = (double)(ans-j*pow(10,dig-1))/(n-j);
                }
            }

            _for(j,1,10){
                if(frac > (double)(ans-9*pow(10,dig-1) - j*pow(10,dig-2))/(n-9-j)){
                    vl.push_back((ans-9*pow(10,dig-1) - j*pow(10,dig-2)));
                    frac = (ans-9*pow(10,dig-1) - j*pow(10,dig-2))/(n-9-j);
                }
            }

       }

        vl.push_back(ans);
        n++;
    }

    sort(ALL(vl));
    unique(ALL(vl));
    int q;
    scanf("%d",&q);
    _for(i,0,q){
        printf("%lld\n",vl[i]);
    }
    return 0;
}

Measured memory_bytes: 768
#include <string.h>
#include <algorithm>
#include <vector>
#include <functional>
#include <fstream>
#include <iostream>
#define mod 1000000007
using namespace std;
ifstream f("rick.in");
ofstream g("rick.out");


string s;
int main()
{
cin>>s;
if(s[2]==s[3]&&s[4]==s[5])
{
    cout<<"Yes";
}
else cout<<"No";

}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i =(b)-1;i>=(a);--i)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
typedef vector<int> vi;
const int mod = 1e9 + 7;
const int maxn = 2e6 + 10;
map<int,ll> sb;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	ll ans = 0;
	sb[0]++;
	reverse(all(s));
	ll p = 1;
	for(auto it:s){
		ans += (it - '0')*p;
		p = (p*10)%2019;
		ans %= 2019;
	//	cout << ans << '\n';
		sb[ans]++;
	}
	ll at = 0;
	for(auto it:sb){
		at += it.se * (it.se - 1)/2;
	}
	cout << at;
	return 0;
}


Measured memory_bytes: 3748
import sys
input = sys.stdin.readline
from collections import deque

nn = 200200
mod = 10**9+7

fa = [1] * (nn+1)
fainv = [1] * (nn+1)
inv = [1] * (nn+1)
for i in range(nn):
    fa[i+1] = fa[i] * (i+1) % mod
fainv[-1] = pow(fa[-1], mod-2, mod)
for i in range(nn)[::-1]:
    fainv[i] = fainv[i+1] * (i+1) % mod
for i in range(1, nn)[::-1]:
    inv[i] = fainv[i] * fa[i-1]

N = int(input())
X = [[] for i in range(N)]
for i in range(N-1):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    X[y-1].append(x-1)

P = [-1] * N
Q = deque([0])
R = []
while Q:
    i = deque.popleft(Q)
    R.append(i)
    for a in X[i]:
        if a != P[i]:
            P[a] = i
            X[a].remove(i)
            deque.append(Q, a)

unit = 1
f = lambda a, b: a * b % mod
g_bu = lambda a, i=-1: a * inv[SI[i]] % mod
g_td = lambda a, i=-1: a * inv[N - SI[i]] % mod

SI = [1] * N
for i in R[::-1]:
    for j in X[i]:
        SI[i] += SI[j]

BU = [unit] * N
TD = [unit] * N
for i in R[::-1]:
    a = 1
    for j in X[i]:
        a = f(a, BU[j])
    BU[i] = g_bu(a, i)

AX = [1] * N
for i in R:
    ac = unit
    for j in X[i]:
        AX[j] = ac
        ac = f(ac, BU[j])
    ac = unit
    for j in X[i][::-1]:
        AX[j] = f(AX[j], ac)
        TD[j] = g_td(f(TD[i], AX[j]), j)
        ac = f(ac, BU[j])

print(*[BU[i] * SI[i] % mod * TD[i] % mod * fa[N - 1] % mod for i in range(N)], sep = "\n")

Measured memory_bytes: 137608
#include"bits/stdc++.h"
using namespace std;
typedef long long int ll;
#define crap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mx 100005

vector<int> gr[mx];
bool visited[mx]={0};
int indegree[mx]={0};
int dp[mx] = {0};

void dfs( int v){
	assert(!visited[v]);
    visited[v] = true;
    
    for( auto x:gr[v]){
    	dp[x] = max(dp[x],1+dp[v]);
    	indegree[x]--;
        if( indegree[x] == 0 )
            dfs(x);
    }
}

int main() {
	crap;
	int n,e;
	cin >> n >> e;
    for( int i=0; i<e; i++ ){
        int x,y;
        cin >> x >> y;
        gr[x].push_back(y);
        indegree[y]++;
    }
    
    int ans = 0;
    for( int i=1; i<=n; i++ ){
        if( !visited[i] && indegree[i] == 0 ){
            dfs(i);
        }
    }
    for( int i=1;i<=n; i++ ){
    	ans = max(ans,dp[i]);
    	//cout << dp[i] << " ";
	}
    cout << ans;
	return 0;
}

Measured memory_bytes: 14504
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
typedef long long ll;
//*******************************************************
// Tree
//*******************************************************

// status of edge
template <typename X>
struct Edge{
  int from;
  int to;
  X cost;

  Edge() = default;

  Edge(int from, int to, X cost) : from(from), to(to), cost(cost) {}
};

//status of node
template <typename X>
struct Node{
  int idx;
  int par;
  X depth;
  vector<Edge<X>> edge;
  
  Node() = default;

  explicit Node(int idx) : idx(idx) {
  }
  
};

// tree
template <typename X>
class Tree{
private:
  int n; // number of node
  vector<Node<X>> node;

  void Init_Node() {
    rep(i,n) node.emplace_back(i);    
  }
  
public:
  Tree() = default;

  explicit Tree(int n) : n(n) {
    Init_Node();
  }

  // no-weight
  Tree(int n, vector<int> a, vector<int> b) : n(n) {
    Init_Node();
    rep(i,n-1) {
      add_edge(a[i], b[i]);
      add_edge(b[i], a[i]);  // indirected edge
    }
  }

  Tree(int n, vector<int> a, vector<int> b, vector<X> c) : n(n) {
    Init_Node();
    rep(i,n-1) {
      add_edge(a[i], b[i], c[i]);
      add_edge(b[i], a[i], c[i]);  // indirected edge
    }
  }  

  void add_edge(int from, int to, X cost = 1) {
    node[from].edge.emplace_back(from, to, cost);
  }

  void DFS_Init(int v, int p, int d) {
    node[v].par = p;
    node[v].depth = d;
    for(auto next: node[v].edge) {
      int w = next.to;
      X cost = next.cost;
      if(w == p) continue;
      DFS_Init(w, v, d + cost);
    }
  }

  // make rooted tree
  void Make_root(int root) {
    DFS_Init(root, -1, 0);
  }

  void Solve() {
    Make_root(0);
    rep(i,n) {
      if(node[i].depth % 2 == 0) cout << 0 << "\n";
      else cout << 1 << "\n";
    }
  }
  
};

int main()
{
  int n; cin >> n;
  vector<int> u(n-1),v(n-1);
  vector<ll> w(n-1);
  rep(i,n-1) {
    cin >> u[i] >> v[i] >> w[i];
    u[i]--; v[i]--;
  }
  Tree<ll> tr(n, u, v, w);
  tr.Solve();
  
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	char c[2][3];

	for (int i = 0;i < 2;i++){
		for (int j = 0;j < 3;j++){
			cin >> c[i][j];
		}
	}

	for (int i = 0;i < 2;i++){
		for (int j = 0;j < 3;j++){
			if(c[i][j] != c[1-i][2-j]){
				cout << "NO" << endl;
				return 0;
			}
		}
	}

	cout << "YES" << endl;

	return 0;

}


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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

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

  int n;
  while(true){
    cin >> n;
    if(n==0) break;
    string s[n+1];
    for(int i=0;i<n;i++) cin >>s[i];
    int res=0;
    for(int i=0;i<n/2;i++){
      if(s[2*i]=="lu" && s[2*i+1]=="ru") res++;
      else if(s[2*i+1]=="lu" && s[2*i]=="ru") res++;
      else if(s[2*i+1]=="ld" && s[2*i]=="rd") res++;
      else if(s[2*i]=="ld" && s[2*i+1]=="rd") res++;
    }
    cout << res <<endl;
  }
}

Measured memory_bytes: 3208
def sc(x, y):
    if abs(y) > abs(x):
        if x > 0 and y > 0:
            res = y - x
        elif x > 0 and y < 0:
            res = -y - x + 1
        elif x <= 0 and y > 0:
            res = y + x + 1
            if x == 0:
                res -= 1
        elif x <= 0 and y < 0:
            res = -y + x + 2
            if x == 0:
                res -= 1
    else:
        if y >= 0 and x > 0:
            res = x - y + 2
            if y == 0:
                res -= 1
        elif y >= 0 and x < 0:
            res = -x - y + 1
            if y == 0:
                res -= 1
        elif y < 0 and x > 0:
            res = x + y + 1
        elif y < 0 and x < 0:
            res = -x + y
    return res


if __name__ == "__main__":
    x, y = map(int, input().split())
    print(sc(x, y))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double dbl;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<long long> vl;
typedef vector< pair<int, int> > vii;
#define mp make_pair
#define pb push_back
#define invec(a, n) for(ll i = 0; i < n; i++) {cin >> a[i];}
#define rep(n) for(ll i = 0; i < n; i++)
#define fr(i,j,k) for(ll i = j; i < k; i++)
#define FR(i,j,k) for(ll i = j; i >= 0; i--)
#define MOD 1000000007
#define all(v) v.begin(), v.end()
#define INF 1000000
#define xx first
#define yy second
#define pl cout<<endl;
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
		return os<<"("<< p.first << "," << p.second<<")";
}
template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
os << "{";
typename vector< T > :: const_iterator it;
for( it = v.begin(); it != v.end(); it++ ) {
		if( it != v.begin() ) os << ", ";
		os << *it;
}
return os << "}";
}
template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
os << "[";
typename set< T > :: const_iterator it;
for ( it = v.begin(); it != v.end(); it++ ) {
		if( it != v.begin() ) os << ", ";
os << *it;
}
return os << "]";
}
template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
		os << "[";
		typename map< F , S >::const_iterator it;
for( it = v.begin(); it != v.end(); it++ ) {
if( it != v.begin() ) os << ", ";
os << it -> first << " = " << it -> second ;
}
return os << "]";
}
#define deb(x) cout << #x << " = " << x << endl;
 
#define er(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}
 
void fast()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}

 
int main()
{															
	double a,b;
	cin>>a>>b;

	double num=b-a;
	double dem=a-1;

	int ans=ceil(num/dem)+1;

	cout<<ans<<endl;
}

Measured memory_bytes: 256