akhauriyash/Code-Regression huggingface dataset:
import sys
input=sys.stdin.readline

n=int(input())
l=list(map(int,input().split()))

ans=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]:
                if l[i]+l[j]>l[k] and l[i]+l[k]>l[j] and l[j]+l[k]>l[i]:
                    ans+=1

print(ans)



Measured memory_bytes: 73828
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const ll INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
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;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

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

    vector<int> b(2*m+2,0);
    REP(i,n-1) {
        int l=a[i]+2,r=a[i+1];
        if(a[i]>a[i+1]) {
            r=a[i+1]+m;
        }
        b[l]+=1;
        b[r+1]-=(r-l)+2;
        b[r+2]+=(r-l)+1;
    }
    REP(i,2*m+1) b[i+1]+=b[i];
    REP(i,2*m+1) b[i+1]+=b[i];
    REP(i,m) b[i]+=b[i+m];

    int mx=0,X=0;
    REP(i,m) if(chmax(mx,b[i])) X=i;


    int ans=0;
    REP(i,n-1) {
        int tmp=0;
        if(a[i]<a[i+1]) {
            if(a[i]<X && X<=a[i+1]) {
                tmp=1+a[i+1]-X;
            } else {
                tmp=a[i+1]-a[i];
            }
        } else {
            if(a[i]<X) {
                tmp=1+a[i+1]-(X-m);
            } else if(X<=a[i+1]) {
                tmp=1+a[i+1]-X;
            }else {
                tmp=(a[i+1]+m)-a[i];
            }
        }
        ans+=tmp;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 2560
#include<stdio.h>
#define M 100
int main(){
  int d=0,n,m,l,i,j,k,a[M][M],b[M][M];
long long int c[M][M]={0};

  scanf("%d %d %d",&n,&m,&l);
  /*  printf("input 1\n");*/
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&a[i][j]);
    }
  }
  /*printf("input 2\n");*/

  for(i=0;i<m;i++){
    for(j=0;j<l;j++){
      scanf("%d",&b[i][j]);
    }
  }
  /*printf("cal\n");*/

  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      for(k=0;k<m;k++){

        c[i][j]+=a[i][k]*b[k][j];
      }
      d=0;
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      printf("%lld",c[i][j]);

      if(j!=l-1)printf(" ");
      }
      printf("\n");
  }

  return 0;
}

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

#define MAX_N 100002

using namespace std;

int act[MAX_N][3];

int dp[MAX_N][3];

int n;
int a,b,c;
void solve()
{
    for(int i = 1;i<=n;i++){
        dp[i][0] = max(dp[i-1][1],dp[i-1][2])+act[i-1][0];
        dp[i][1] = max(dp[i-1][0],dp[i-1][2])+act[i-1][1];
        dp[i][2] = max(dp[i-1][0],dp[i-1][1])+act[i-1][2];
    }
}

int main()
{
    cin>>n;
    for(int i = 0;i<n;i++){
        cin>>act[i][0]>>act[i][1]>>act[i][2];
    }
    solve();
    cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<endl;
    return 0;
}


Measured memory_bytes: 2560
N = int(input())
F = []
P = []
Pre = []
for i in range(N):
  F.append(list(map(int, input().split())))
for i in range(N):
  P.append(list(map(int, input().split())))

for loop in range(1,1024):
  rieki = 0
  f = str(format(loop,"b")).rjust(10,"0") #自店の開店時間帯
  for i in range(N): # 全店舗に対し利益計算
    Fnum = 0
    for j in range(10): # 店舗iと同時に営業する時間帯の数
      Fnum = Fnum + F[i][j] * int(f[j])
    #print("loop:{},i:{},j:{}".format(loop,i,j))
    rieki = rieki + P[i][Fnum] # P行列参照
  Pre.append(rieki) 
print(max(Pre))
  

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

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

using namespace std;


string parse(string& str, int& pos) {
	string res;

	int cnt = 0;
	for(; pos < str.size(); ++pos) {
		if(str[pos] == '+') {
			cnt++;	
			if(cnt == 26) {
				cnt = 0;
			}
		} else if(str[pos] == '-') {
			cnt--;
			if(cnt == -26) {
				cnt = 0;
			}
		} else if(str[pos] == '?') {
			res += 'A';
			cnt = 0;
		} else if(str[pos] == '[') {
			pos++;
			string s = parse(str, pos);
			reverse(s.begin(), s.end());
			res += s;
		} else if(str[pos] == ']') {
			return res;
		} else {
			res += 'A' + (str[pos] - 'A' + cnt + 26) % 26;
			cnt = 0;
		}
	}

	return res;
}

int main()
{
	string s;
	while(cin >> s, s!= ".") {
		int pos = 0;
		cout << parse(s, pos) << endl;
	}
}

Measured memory_bytes: 2988
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  int N;
  cin >> N;
  vector<int> A(N), B(N);
  REP(i, N) cin >> A[i];
  REP(i, N) cin >> B[i];
  ll hituyou = 0, yoyuu = 0;
  REP(i, N) {
    hituyou += max(0, B[i] - A[i]);
    yoyuu += max(0, A[i] - B[i]);
  }
  if(yoyuu<hituyou){
    cout << -1 << endl;
    return 0;
  }
  ll ans = 0;
  REP(i,N){
    if (A[i] < B[i]) ans++;
  }
  vector<ll> dif(N);
  REP(i, N) { dif[i] = A[i] - B[i]; }
  sort(dif.begin(), dif.end());
  int i = N - 1;
  while(0<hituyou){
    hituyou -= dif[i];
    i--;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4824
#include <stdio.h>

int A[100005];
int checkA[100005];
int check[100005];

typedef long long ll;

int main() {

	int N;

	scanf("%d",&N);

	int i;

	for (i = 0; i < N; i++) {
		scanf(" %d",&A[i]);
		checkA[A[i]]++;
		if (N - 1 - (2 * i) >= 0) {
			check[N - 1 - (2 * i)]++;
		}
		else {
			check[-(N - 1 - (2 * i))]++;
		}
	}
	int flag = 0;
	for (i = 0; i < N; i++) {
		if (checkA[i] != check[i]) { 
			flag = 1; 
			break; 
		}
	}
	if (flag == 1) { printf("0\n"); }
	else {
		ll ans = 1;
		for (i = 0; i < N; i++) {
			if (check[i] > 0) {
				ans *= check[i];
				ans %= 1000000007;
			}
		}
		printf("%lld\n",ans);
	}

	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    map<ll, ll> m;
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        m[a[i]]++;
    }
    ll q;
    cin >> q;

    ll ans = 0;

    for (ll i = 0; i < n; i++)
    {
        ans += a[i];
    }

    for (ll i = 0; i < q; i++)
    {
        ll b, c;
        cin >> b >> c;

        ans += (c - b) * m[b];

        m[c] += m[b];
        m[b] -= m[b];

        cout << ans << endl;
    }
}

Measured memory_bytes: 9892
#include<stdio.h>
#include<string.h>
int main()
{
	int n,a,b,f=0,i;
	char s[200000];

	scanf("%s",s);

	n=strlen(s);
	for(i=0;i<n;i++)
		if(s[i]=='A'){
			a=i;
			f++;
			break;
		}
	for(i=n;i>a;i--)
		if(s[i]=='Z'){
			b=i;
			f++;
			break;
		}
	if(f==2)
		printf("%d",b-a+1);
	else
		puts(0);
	return 0;
}

Measured memory_bytes: 384
/*-----------Author: Araz Jabrayilov---------*/
/*------------@araz17----(~~)#5371-----------*/

#include <bits/stdc++.h>

#define ll long long
#define endl '\n'

using namespace std;

//int a[105];


int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    string s;
    cin >> s;

    if(s[2] == s[3] && s[4] == s[5]){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }




    return 0;
}


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

#define int long long
#define rep(i, a) for (int i = 0; i < (a); i++)
#define repd(i, a) for (int i = (a)-1; i >= 0; i--)
#define reps(i, a, j) for (int i = (j); i < (a); i++)
#define deb(x) cout << #x << " " << x << endl;
#define debs(x) cout << #x << " " << x << " ";
#define deba(x) for (auto _i:x) cout << _i << " "; cout << endl;
#define ms(a) memset(a,0,sizeof(a));
#define mp make_pair
#define eb emplace_back
#define pii pair < int , int >
#define all(a) a.begin(),a.end()

void solve() {
    int n; cin >> n;
    int arr[n],res = 0;
    rep (i,n) cin >> arr[i];
    for (int i=0,j=0; i<n; i = j) {
        j = i+1;
        while (j<n && arr[j] < arr[i]) {
            res += (arr[i]-arr[j]);
            j++;
        }
    }
    cout << res << endl;

}

signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t; t=1;
    while (t--) solve();
}

Measured memory_bytes: 5240
# frozen_string_literal: true

x, y = gets.split.map(&:to_i)

0.upto(100) do |i|
  0.upto(100) do |j|
    if i + j == x && 2 * i + 4 * j == y
      puts 'Yes'
      exit
    end
  end
end

puts 'No'


Measured memory_bytes: 14344
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

int n,k;
map <int,bool> mp; 

bool fun(int a){
	while (a){
		if (mp[a%10]) return false;
		a /= 10;
	}
	return true;
}

inline void solve(){
    cin >> n >> k ; 
    for (int i=1;i<=k;i++) {
    	int a; cin >> a; 
    	mp[a] = true;
    }
    while (true){
    	if (fun(n)){
    		cout << n << endl;
    		return; 
    	} n++ ; 
    }
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3644
#!/usr/bin/env python3

n = int(input())
h = list(map(int, input().split()))
# print(n, h)

dp = [-1 for _ in range(n)]

dp[0], dp[1] = 0, abs(h[1] - h[0])

for i in range(2, n):
    one_step = dp[i - 1] + abs(h[i] - h[i - 1])
    two_step = dp[i - 2] + abs(h[i] - h[i - 2])
    dp[i] = min(one_step, two_step)

print(dp[n - 1])


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

const int SIZE=100;
int main(){
    vector<string> res(SIZE);
    for(int i=0;i<SIZE;i++){
        for(int j=0;j<SIZE;j++){
            if(i<SIZE/2) res[i]+="#";
            else res[i]+=".";
        }
    }

    int a,b;
    cin>>a>>b;
    a--,b--;
    int h=1;
    int w=1;
    while(a--){
        res[h][w]='.';
        if(w==99){
            h=((h-1)/2)*2+5;
            w=1;
        }
        else{
            if(h%2) h++;
            else h--;
            w++;
        }
    }

    h=53;
    w=1;
    while(b--){
        res[h][w]='#';
        if(w==99){
            h=((h-1)/2)*2+5;
            w=1;
        }
        else{
            if(h%2) h++;
            else h--;
            w++;
        }
    }
    cout<<SIZE<<" "<<SIZE<<endl;
    for(int i=0;i<SIZE;i++){
        cout<<res[i]<<endl;
    }
}

Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=15*10**10
for i in range(2**(n-1)):#1番目は確定だから
    cnt,s,mh=0,0,a[0]+1
    for j in range(n-1):
        if i>>j&1:
            cnt+=1
            x=a[j+1]
            if x>=mh:
                mh=x+1
            else:
                s+=mh-x
                mh+=1
        else:
            mh=max(mh,a[j+1]+1)
    if cnt>=k-1:
        ans=min(ans,s)
print(ans)

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

using namespace std;

#define li long long int
#define FOR(i, a, b) for (int i = a ; i < b ; ++i)
#define REP(i, n) for (int i = 0 ; i < n ; ++i)

int main(void) {
    li a, b;
    cin >> a >> b;
    li s = (a - 1) * (b - 1);
    cout << s;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a, b, k;
    int i;
    scanf("%d %d",&a ,&b);
    i = a+b;
    if(i % 2 == 0){
        k = i/2;
        printf("%d",k);
    }else{
        printf("IMPOSSIBLE");
    }
    return 0;
}

Measured memory_bytes: 128
import math
a, b = map(int, input().split())

prime = [2]
for i in range(3, 10**5, 2):
  flag = True
  for j in prime:
    if j > math.sqrt(i):
      break
    if i % j == 0:
      flag = False
      break
  if flag:
    prime.append(i)

a_dict = dict()
b_dict = dict()
used = set()

for i in prime:
  if a < i and b < i:
    break
  while a % i == 0:
    a /= i
    a_dict[i] = a_dict.get(i, 0) + 1
    used.add(i)
  while b % i == 0:
    b /= i
    b_dict[i] = b_dict.get(i, 0) + 1
    used.add(i)

ab = 1
for i in used:
  ad = a_dict.get(i, 0)
  bd = b_dict.get(i, 0)
  n = ad if ad > bd else bd
  ab = ab * (i**n)
  
print(ab)

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

int main(){
  
  int n,k;
  cin >> n >> k;
  
  int* h = new int[n];
  for(int i=0 ; i<n ; i++)
    cin >> h[i];
  
  int* dp = new int[n];
  for(int i=0 ; i<n ; i++){
  	dp[i] = INT_MAX;
  }
  
  dp[0] = 0;
  dp[1] = abs(h[1]-h[0]);
  
  for(int i=2 ; i<n ; i++){
  	int c=0;
    for(int j=i-1; j>=0 ;j--){
    	int temp = dp[j] + abs(h[i]-h[j]);
      	dp[i] = min(dp[i], temp);
      	if(++c == k){
      		break;
      	}
    }
	}
  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 4336
#include <stdio.h>
#include <algorithm>
using namespace std;
#define N (1010)
int n, m, a, b;
int ans[N][N];
char s[N][N];
int cnt;
void print(){
    for (int i = 1; i <= n; ++i){
        for (int j = 1; j <= m; ++j){
            if (!ans[i][j]){
                s[i-1][j-1] = '.';
            }
            else{
                if (ans[i+1][j] == ans[i][j]){
                    s[i-1][j-1] = '^';
                    s[i][j-1] = 'v';
                }
                else if (ans[i][j+1] == ans[i][j]){
                    s[i-1][j-1] = '<';
                    s[i-1][j] = '>';
                }
                else {
                    s[i][j] = '?';
                }
            }
        }
        s[i-1][m] = 0;
    }
    for (int i = 0; i < n; ++i){
        printf("%s\n", s[i]);
    }
}
#define ver(x,y) ans[x][y]=ans[x+1][y]=++cnt, --b;
#define hor(x,y) ans[x][y]=ans[x][y+1]=++cnt, --a;
int main(){
    scanf("%d%d%d%d", &n, &m, &a, &b);
    if (m & 1)
    for (int i = 1; i+1 <= n && b; i+=2){
        ver(i,m);
    }
    if (n & 1)
    for (int i = 1; i+1 <= m && a; i+=2){
        hor(n,i);
    }
    int nn = n/2*2, mm = m/2*2;
    for (int i = 1; i+1 <= nn; i+=2){
        for (int j = 1; j+1 <= mm; j+=2){
            if (a >= 2) {
                hor(i,j);
                hor(i+1,j);
                continue;
            }
            if (b >= 2){
                ver(i,j);
                ver(i,j+1);
                continue;
            }
            if (a){
                hor(i,j);
                continue;
            }
            if (b){
                ver(i,j);
            }
        }
    }
    if ((n&m&1) && b==1 && !a){
        if (n>1 && m>1 && ans[n-2][m-2]==ans[n-2][m-1]){
            hor(n-2,m-2);
            hor(n,m-1);
            ver(n-1,m-2);
            ver(n-2,m);
            a = b = 0;
        }
    }
    if (a || b){
        printf("NO\n");
    }
    else {
        printf("YES\n");
        print();
    }
}

Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<string> blue(N);
    for (int i=0; i<N; i++) {
        cin >> blue.at(i);
    }
    int M;
    cin >> M;
    vector<string> red(M);
    for (int i=0; i<M; i++) {
        cin >> red.at(i);
    }

    vector<int> money(N,1);

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (i == j) {
                // 何もしない
            }
            else if(blue.at(i) == blue.at(j)) {
                money.at(i)++;
            }
        }
        // blueとredで同じ要素があれば配列から1円ひく
        for (int j = 0; j < M; j++) {
            if (blue.at(i) == red.at(j)) {
                money.at(i)--;
            }
        }
    }
    //money配列から最大値を探す
    int S = money.at(0);
    for (int i = 0; i < N; i++){
        if (S < money.at(i)) {
            S = money.at(i);
        }
    }
    if (S<0) {
        cout << 0 << endl;
    }
    else {
        cout << S << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define RANGE(i,n) for(int i=0;i<n;i++)
typedef long long ll;

using namespace std;

struct union_find{
  vector<ll> par;
  vector<ll> size;

  union_find(ll n): par(n), size(n){
    RANGE(i,n){
      par[i]=i;
      size[i]=1;
    }
  }

  void union_tree(ll i, ll j){
    ll root_i = root(i);
    ll root_j = root(j);
    par[root_i] = root_j;
    size[root_j] = size[root_i] + size[root_j];
  }

  ll root(ll i){
    ll now=i;
    vector<ll> on_route;
    while(par[now]!=now){
      on_route.push_back(now);
      now=par[now];
    }
    for(ll node:on_route)par[node]=now;
    return now;
  }

  bool same(ll i, ll j){
    return root(i) == root(j);
  }

  ll get_size(ll i){
    return size[root(i)];
  }
};

signed main() {
  ll N, M;
  cin >> N >> M;
  ll A[M];
  ll B[M];
  RANGE(i,M){
    ll x, y;
    cin >> x >> y;
    A[i] = x-1;
    B[i] = y-1;
  }
  ll unconf = (N-1)*N /2;
  stack<ll> result;
  union_find tree(N);
  for(ll i=M-1;i>-1;i--){
    result.push(unconf);
    if(!tree.same(A[i], B[i])){
      ll a_size = tree.get_size(A[i]);
      ll b_size = tree.get_size(B[i]);
      unconf -= a_size*b_size;
      tree.union_tree(A[i],B[i]);
    }
  }
  while(!result.empty()){
    cout << result.top() << endl;
    result.pop();
  }
}


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

using namespace std;

void Main() {
    string N;
    cin >> N;
    int ans = 0;
    for (int i = 0; i < N.size(); ++i) {
        ans += atoi(N.substr(i, 1).c_str());
        ans %= 9;
    }
    cout << (ans == 0 ? "Yes" : "No") << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }

int main() {
    int N, X;
    bool flag[200005] = {};
    cin >> N >> X;

    vint vec(2 * N - 1, 0);
    
    if (X == 1 || X == 2 * N - 1) {
        cout << "No" << endl;
        return (0);
    }

    cout << "Yes" << endl;
    if (N == 2) {
        cout << 1 << endl << 2 << endl << 3 << endl;
        return (0);
    }
    
    int center = N - 1;
    if (X == 2) {
        vec[center] = 2;
        vec[center + 1] = 1;
        vec[center + 2] = 3;
        vec[center - 1] = 4;
        fill_n(flag + 1, 4, true);
    } else {
        vec[center] = X;
        vec[center + 1] = X + 1;
        vec[center + 2] = X - 1;
        vec[center - 1] = X - 2;
        fill_n(flag + X - 2, 4, true);
    }
    
    int cnt = 1;
    for (int i = 0; i < 2 * N - 1; i++) {
        if (vec[i]) {
            cout << vec[i] << endl;
            continue;
        }
        while (flag[cnt]) cnt++;
        vec[i] = cnt++;
        cout << vec[i] << endl;
    }
    
    return (0);
}

Measured memory_bytes: 2432
def base4(n):
    r = []
    while 0 < n:
        r.append((0, 7, 5, 3)[n % 4])
        n //= 4
    return r

N = int(input())
count = 0
for i in range(1, 4**9):
    r = base4(i)
    if set(r) != {7,5,3}:
        continue
    x = int(''.join(map(str, r)))
    if x <= N:
        count += 1
print(count)


Measured memory_bytes: 3060
#include<stdio.h>

int hist[6];

int main(){
  int i,n,v;
  unsigned long long ans;
  scanf("%d",&n);
  for(ans=0,i=0;i<n;i++){
    scanf("%d",&v);
    ans+=v;
  }
  printf("%ld\n",ans/n);
  return 0;
}

Measured memory_bytes: 0
//Just have Patience...
#include<bits/stdc++.h>
using namespace std;

#define tarzan ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long 

int rr[] = {0, 1, 1, 1, 0, -1, -1, -1};
int cc[] = {1, 1, 0, -1, -1, -1, 0, 1};

const int mod = 1e9 + 7;
const int N = 300050;

signed main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	tarzan;
	int test = 1;
	//cin >> test;
	while(test--) {
		int n, x, t;
		cin >> n >> x >> t;

		cout << (n + x - 1) / x * t << '\n';
	}
 	return 0;
}

Measured memory_bytes: 3640
#include<stdio.h>


int main()
{
	int a[100] = { 0 }, i, max=0;
	while (scanf("%d", &i) != EOF) a[i - 1]++;
	for (i = 0; i < 100; i++)
		if (max < a[i]) max = a[i];
	for (i = 0; i < 100; i++)
		if (max == a[i]) printf("%d\n", i + 1);
    return 0;
}




Measured memory_bytes: 2020
from collections import defaultdict

def get_renzokuomote(goal, now_num):
    count = 0
    while now_num < goal:
        now_num *= 2
        count += 1
    return count



def main():
    saikoro, goal = map(int, input().split())
    data = defaultdict(float)
    ans = 0
    for i in range(1, saikoro + 1):
        now_num = i
        if now_num % 2 == 0:
            data[now_num] = data[now_num // 2] * 2
        else:
            rennzoku_omote = get_renzokuomote(goal, now_num)
            if rennzoku_omote == 0:
                ans += (saikoro + 1 - now_num) / saikoro
                break
            data[i] = (0.5 ** rennzoku_omote) / saikoro



    for ele in data.values():
        ans += ele
    print(ans)





if __name__ == '__main__':
    main()



Measured memory_bytes: 41200
n = int(input())
aa = [min(8, int(a) // 400) for a in input().split()]
over3200 = aa.count(8)
colors = len(set(aa))
_min = colors - 1 if over3200 and n > over3200 else colors
_max = colors + over3200 - 1 if over3200 else colors
print(_min, _max)

Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <string.h>
using namespace std;

int main()
{
    int N;
    string S;
    cin>>N>>S;
    int counter = 0;
    for(int i=0 ; i<N ; i++)
    {
        if(S[i]=='A'&&S[i+1]=='B'&&S[i+2]=='C')
        {
            counter++;
        }
    }
    cout<<counter<<endl;
    return 0;
}


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

using namespace std;

typedef pair<int, int> p;
typedef long long ll;
const int inf = 1000000007;

int main() {
  ll n, x, m;
  cin >> n >> x >> m;
  vector<ll> a;
  vector<ll> ord(m, -1);
  ll tmp = x;
  ll si = 0;
  ll t = 0;
  ll tsum = 0;
  a.push_back(tmp);
  ord[x] = 0;
  for (int i = 0; i < n; i++) {
    tmp = tmp * tmp % m;
    if (ord[tmp] != -1) {
      si = ord[tmp];
      t = i + 1 - ord[tmp];
      break;
    }
    ord[tmp] = i + 1;
    a.push_back(tmp);
  }
  vector<ll> ruiseki(a.size() + 1, 0);
  rep(i, a.size()) { ruiseki[i + 1] = ruiseki[i] + a[i]; }
  ll ans = 0;
  if (n <= a.size()) {
    ans = ruiseki[n];
    cout << ans << endl;
    return 0;
  }
  ll cnt = (n - si) / t;
  ll id = (n - si) % t;
  ans = (ruiseki[t + si] - ruiseki[si]) * cnt + ruiseki[si] +
        ruiseki[id + si] - ruiseki[si];
  cout << ans << endl;
  // rep(i, a.size()) cout << a[i] << ", ";
  // cout << endl;
  // rep(i, a.size() + 1) cout << ruiseki[i] << ", ";
  // cout << endl;
  // cout << si << endl;
  // cout << t << endl;
  return 0;
}

Measured memory_bytes: 4752
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::min;

fn main() {
    input!{
        n: usize,
        s: chars
    }
    let mut ws: Vec<usize> = vec![0; n + 1];
    let mut bs: Vec<usize> = vec![0; n + 1];
    for i in 0..n {
        if s[i] == '.' {
            ws[i] = 1;
        } else {
            bs[i + 1] = 1;
        }
    }
    for i in 0..n {
        ws[n - i - 1] += ws[n - i];
        bs[i + 1] += bs[i];
    }
    let mut ans = n;
    for i in 0..n + 1 {
        ans = min(ans, ws[i] + bs[i]);
    }
    println!("{}", ans);
}


Measured memory_bytes: 8444
from numba import jit
import sys
input = sys.stdin.readline


@jit
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    for _ in range(K):
        B = [0]*(N+1)
        for i, a in enumerate(A):
            B[max(0, i-a)] += 1
            B[min(N, i+a+1)] -= 1
        for j in range(1, N):
            B[j] += B[j-1]
        if A == B[:-1]:
            A = B[:-1]
            break
        A = B[:-1]

    ans = ' '.join(list(map(str, A)))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 143600
N,K=map(x->parse(Int,x),split(readline()))
if K%2==1
	println(0)
	exit()
end
K>>=1
const dp=[[[0 for _=1:1350] for _=1:53] for _=1:51]
dp[1][1][1]=1
const mod=10^9+7
for i=1:N,j=1:i+1,k=1:K+1
	if dp[i][j][k]==0
		continue
	end
	dp[i+1][j][k+j-1]=(dp[i+1][j][k+j-1]+dp[i][j][k]*(2j-1))%mod
	dp[i+1][j+1][k+j]=(dp[i+1][j+1][k+j]+dp[i][j][k])%mod
	if j>1
		dp[i+1][j-1][k+j-2]=(dp[i+1][j-1][k+j-2]+dp[i][j][k]*(j-1)*(j-1))%mod
	end
end
println(dp[N+1][1][K+1])

Measured memory_bytes: 198544
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

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

  ll cnt = 0, ans = 0;
  for (int i: s) {
    if (i == 'B') {
      cnt++;
    } else {
      ans += cnt;
    }
  }
  cout << ans << endl;
}



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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

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

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  uint64_t g = gcd(m,n);
  if(m%g==0) return (m/g)*n;
  if(n%g==0) return (n/g)*m;
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

/* 
  //エラトステネスのふるい
  int maxNum = 100000;
  char isNotPrime[maxNum+1] = {};
  isNotPrime[0]=isNotPrime[1]=1;
  for(int i=2;i<maxNum;i++){
    if(isNotPrime[i]==1) continue;
    int num = i+i;
    while(num<=maxNum){
      isNotPrime[num]=1;
      num += i;
    }
  }
*/
// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

// 降順ソート vector<int> v;
// sort(v.begin(),v.end(),greater<int>());

signed main() {
  ll x;
  cin >> x;

  // 6,5,6,5,
  ll count = 2*(x/11);

  if( x%11>0 && x%11<=6){
    count += 1;
  }
  else if(x%11 > 6){
    count += 2;
  }
    
  cout << count << endl;

  return 0;
}



Measured memory_bytes: 3680
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int count=0;
    int a,b,c,x;
    scanf("%d %d %d",&a,&b,&c);
    for(int x = a; x <= b; x++){
        if(c%x==0){
            count++;
        }
    }
    printf("%d\n",count);

    return 0;
}



Measured memory_bytes: 2104
/* You can't connect the dots looking forward 
   you can only connect them looking backwards. */

#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<bitset>
#include<queue>
#define ll long long
#define ld long double
#define ull unsigned long long
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout.precision(10);cout << fixed;
#define dbset(x) for(int i=0 ; i<x.size(); i++) cerr << x[i] << " "; cerr << endl;
#define inf 1000000007
#define INF 1000000000000000000LL
#define PI 3.14159265358979323846
#define mod 1000000007
#define mod1 1000696969
#define flusz fflush(stdout);
#define VI vector<int>
#define VPI vector < pair<int,int> >
#define PII pair<int, int>
#define BIT bitset<N>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define REP(x, y) for(int x = 0; x < (y); ++x)
#define FOR(x, y, z) for(int x = y; x <= (z); ++x)
#define FORR(x, y, z) for(int x = y; x >= (z); --x)
using namespace std;

template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)

#define int long long
const int N = 5 * 100*1000 + 7;

int test;

int n;

int t1,x1,y1,t2,x2,y2;

void solve()
{
    cin >> n;

    FOR(i,1,n){
        cin >> t2 >> x2 >> y2;

        int dist = abs(x2-x1) + abs(y2-y1);

        if ( t2 - t1 >= dist && (t2 - t1 - dist) % 2 == 0){
            
        }
        else
        {
            cout << "No";
            return;
        }

        t1 = t2;
        x1 = x2;
        y1 = y2;
    }

    cout << "Yes";

    return;
}

int32_t main()
{
    boost

    test=1;

    while(test--)
    {
        solve();
    }

  return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vvll = vector<vll>;
using vst = vector<st>;
using vch = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b;return true;} return false;}
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b;return true;} return false;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

int main(){
	ll h, w, k;
	cin >> h >> w >> k;
	vst graph(h);
	vin(graph);
	
	ll ans = mod;
	rep(bitt, 0, 1 << (h - 1)){
		bitset<10> bit(bitt);
		vvll v = {{0}};
		rep(i, 0, h - 1){
			if(bit.test(i)) v.push_back({i + 1});
			else v.back().push_back(i + 1);
		} 
		ll n = v.size(), cut = 0;
		vll sum(n, 0);
		bl check1 = false;
		rep(x, 0, w){
			vll now(n);
			rep(i, 0, n) vrep(y, v.at(i)) if(graph.at(y).at(x) == '1') now.at(i)++;
			rep(i, 0, n) if(now.at(i) > k) check1 = true;
			if(check1) break;
			bl check2 = false;
			rep(i, 0, n) if(now.at(i) + sum.at(i) > k) check2 = true;
			if(check2){
				swap(now, sum);
				cut++;
			}
			else rep(i, 0, n) sum.at(i) += now.at(i);
		}
		if(check1) continue;
		chmin(ans, n + cut - 1);
	}
	cout << ans << endl;
}

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

using namespace std;

const	int INF = 2'147'483'647;

void merge(vector<int>& A, int left, int mid, int right, long long& cnt) {
	int lfLen, rtLen;
	lfLen = mid - left;
	rtLen = right - mid;
	vector<int> L(lfLen + 1);
	vector<int> R(rtLen + 1);
	int i, j, k;
	i = j = k = 0;
	for (i = 0;i < lfLen;i++) { L[i] = A[left + i]; }
	for (i = 0;i < rtLen;i++) { R[i] = A[mid + i]; }
	L[lfLen] = INF;
	R[rtLen] = INF;
	i = j = 0;
	for (k = left; k < right; k++)
	{
		int tmp = 0;
		if (L[i] <= R[j]) {
			A[k] = L[i];
			tmp = left + i;
			cnt += k > tmp ? k - tmp : 0;

			i++;
		}
		else
		{
			A[k] = R[j];
			tmp = mid + j;
			cnt += k > tmp ? k - tmp : 0;

			j++;
		}

	}
	return;
}

void mergeSort(vector<int>& A, int left, int right, long long& cnt) {
	int mid = 0;
	if (left + 1 < right) {
		mid = (left + right) / 2;
		mergeSort(A, left, mid, cnt);
		mergeSort(A, mid, right, cnt);
		merge(A, left, mid, right, cnt);
	}

	return;
}

int main() {


	int n = 0;
	long long cnt = 0;
	cin >> n;
	vector<int> A(n);

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

	mergeSort(A, 0, n, cnt);

	cout << cnt << endl;

	return 0;
}



Measured memory_bytes: 4412
import sys
def input():
  return sys.stdin.readline().rstrip()

S=input()
K=int(input())

vec=set()

for i in range(len(S)):
  for j in range(i+1,min(len(S)+1,K+i+1)):
    tmp=S[i:j]
    vec.add(tmp)
vec=list(vec)
vec.sort()

print(vec[K-1])


Measured memory_bytes: 69576
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
const int mod = 1e9 + 7;
int main()
{
	int s1[] = {4, 6, 9, 11};
	int s2[] = {2};
	int x, y;
	int i, j;
	int tag1 = 0, tag2 = 0;
	scanf("%d %d", &x, &y);
	for(i = 0; i < 4; i++)
	{
		if(x == s1[i])
			tag1 = 1;
			if(y == s1[i])
				tag2 = 1;
	}
	if(tag1 == tag2 && x != 2 && y != 2)
		printf("Yes\n");
		else
			printf("No\n");
		if(x == y && x == 2)
			printf("Yes\n");
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<numeric>

using namespace std;


unsigned long long d[2000];

int main()
{
	string str;
	cin >> str;
	if (str[0] == '9' || str[1] == '9')
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
		return 0;
}

Measured memory_bytes: 256
index = int(input())
values = list(map(int, input().split()))

for i in range(index):
  if(i == 0):
    continue
  if(values[i] > values[i-1]):
    values[i] = values[i] - 1
#print(values)
flag = "Yes"
for i in range(index):
  if(i == 0):
    continue
  if(values[i] < values[i-1]):
    flag = "No"

print(flag)

Measured memory_bytes: 14396
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
long long a[100100]={0};
int main()
{

    int n,m,num;
    cin >> n >> m;
    for(int i=0;i<m;i++){
        cin >> num;
        a[num]=-1;
    }
    a[0]=1;
    for(int i=0;i<=n;i++){
        if(a[i]!=-1){
            if(a[i+1]!=-1)
            a[i+1]=(a[i+1]+a[i])%1000000007;
            if(a[i+2]!=-1)
            a[i+2]=(a[i+2]+a[i])%1000000007;
        }
    }
    cout << a[n] << endl;
    return 0;
}


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

string s;

inline int read(){
	int s=0,t=1;
	char c=getchar();
	while((c>'9'||c<'0')&&c!='-')c=getchar();
   	if(c=='-')t=-1,c=getchar();
   	while(c>='0'&&c<='9')s=s*10+c-'0',c=getchar();
   	return s*t;
}

int main(void){
	cin>>s;
	int len=s.size();
	for(int i=0;i<len;i++){
		if(s[i]=='U'||s[i]=='D')continue;
		if(s[i]=='L'&&(i+1)%2==1){
			cout<<"No";
			return 0;
		}
		if(s[i]=='R'&&(i+1)%2==0){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
}


Measured memory_bytes: 256
s= input()
ans = 0
l = 0
r = len(s)-1

while l<r:
    if s[l]==s[r]:
        l+=1
        r-=1
    elif s[l]=="x":
        l+=1
        ans +=1
    elif s[r]=="x":
        r-=1
        ans +=1
    else:
        print(-1)
        exit(0)
print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define float double
int main()
{
  float a,b,x;
  cin>>a>>b>>x;
  float v=a*a*b;
  float s=a*b;
  float y=x/a;
  float tan;
  float ans;
  if(v>=2*x){
    tan=b*b/(2*y);
    ans=atan(tan);
    ans=ans*180/3.141592653589793238;
  }
  else{
    y=s-y;
    tan=2*y/(a*a);
    ans=atan(tan);
    ans=ans*180/3.141592653589793238;
  }
  cout<<setprecision(10)<<ans<<endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author TM
 */


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <numeric>

#define SIZE 100005
#define MOD 1000000007

using namespace std;

class DUnbalanced {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        string s;
        cin >> s;
        map<char, int> counter;
        for (int i = 0; i < s.size() - 1; ++i) {
            if (s[i] == s[i + 1]) {
                cout << i + 1 << " " << i + 2 << endl;
                return;
            }
        }
        for (int i = 0; i < s.size() - 2; ++i) {
            if (s[i] == s[i + 2]) {
                cout << i + 1 << " " << i + 3 << endl;
                return;
            }
        }
        cout << "-1 -1" << endl;
    }
};


int main() {
    DUnbalanced solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 512
import string


N = int(input())
S = string.ascii_lowercase

ans = ''
if N <= 26:
    ans = S[N - 1]

else:
    while True:
        N, b = divmod(N, 26)
        ans = S[b - 1] + ans
        if b == 0:
            N -= 1

        if N <= 26:
            ans = S[N - 1] + ans
            break

print(ans)

Measured memory_bytes: 9968
#include <bits/stdc++.h>
using namespace std;
#define EXCEPTERROR cout << "-1" << endl;
#define rep(k,nu)    for(int i=k; i<nu;  i++)
#define rep2(k,n)   for(int j=k; j<n;  j++)
#define size_a(array) sizeof(array) / sizeof(array[0])
#define INF 1000000000000 //1e+12
#define MOD 10000007 //1e9+7
#define ll long long
#define pb pop_back
template<typename T> inline void chMin(T* a, T* b) {if(*a>*b) *a=*b;}
template<typename T> inline void chMax(T* a, T* b) {if(*a<*b) *a=*b;}
template<typename T> inline int  divUp(T a, T b)   {return ((a+b-1)/b);}
const double PI = acos(-1);


int main(){
    ll n, k; cin >> n >> k;
    ll ans=0, lim = divUp(n,k), tmp;

    ll resVal1 = n%k;
    ll resVal2 = abs(resVal1-k);
    cout << min(resVal1,resVal2) << endl;
    return 0;
}
/*

*/


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k,sum=0;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  sort(a,a+n);
  for(int i=0;i<k;i++)
  {
    sum+=a[i];
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<set>
#include<random>
#include<ctime>
#include<chrono>
using namespace std;
using ll = long long int;

const int C_NUM = 26;
const int D_MAX = 366;
int D;
int c[C_NUM+5];
int s[D_MAX][C_NUM+5];

int t[D_MAX];
set<int> last[C_NUM+5];


int main(){
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
    cin >> D;
    for(int i = 1; i <= C_NUM; i++)cin >> c[i];
    for(int i = 1; i <= D; i++){
        for(int j = 1; j <= C_NUM; j++){
            cin >> s[i][j];
        }
    }
    ll v = 0;
    for(int j = 1; j <= C_NUM; j++)last[j].insert(0);
    for(int i = 1; i <= D; i++){
        ll merit = 0;
        int choice = 0;
        for(int j = 1; j <= C_NUM; j++){
            ll nowm = s[i][j];
            nowm += c[j] * (i - *last[j].rbegin());
            if (nowm > merit){
                merit = nowm;
                choice = j;
            }
        }
        v += merit;
        last[choice].insert(i);
        t[i] = choice;
    }

    for(int j = 1; j <= C_NUM; j++)last[j].insert(D+1);
    random_device rnd;
    int count = 0;
    end = chrono::system_clock::now();
    double ttime = static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0);
    while(count < 500000){
        int sub = 0;
        int day = (rnd() % D) + 1;
        int o = t[day];
        int nowmax = 0;
        int choice = o;
        for(int n = 1; n <= C_NUM; n++){
            if (n == o)continue;
            sub = s[day][n] - s[day][o];
            int bo = *(--last[o].find(day));
            int ao = *(++last[o].find(day));
            sub -= c[o] * (day - bo) * (ao - day);
            last[n].insert(day);
            int bn = *(--last[n].find(day));
            int an = *(++last[n].find(day));
            sub += c[n] * (day - bn) * (an - day);
            if (nowmax < sub){
                nowmax = sub;
                choice = n;
            }
            last[n].erase(day);
        }
        v += nowmax;
        t[day] = choice;
        last[o].erase(day);
        last[choice].insert(day);
        end = chrono::system_clock::now();
        double ttime = static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0);
        count++;
    }
    for(int i = 1; i <= D; i++)cout << t[i] << endl;
    return 0;
}

Measured memory_bytes: 3708
#include<stdio.h>

int main()
{
    long n, check = 1;
    int ans=0,i,flag=0;
    scanf("%ld", &n);
    for (i = 0; i < 100; i++)
    {
        check = check * 10;
        if (n < check)
        {
            ans += n / (check / 10);
            if (flag == 1)
                ans--;
            break;
        }
        else
        {
            ans += 9;
            if ((n+1)%check!=0)
                flag = 1;
        }
    }
    printf("%d", ans);
    return 0;
}

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

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)

#define ll long long
#define ull unsigned ll

void reader(int *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
void reader(ll *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
void reader(double *x){scanf("%lf",x);}
int reader(char c[]){int i,s=0;for(;;){mygc(i);if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF) break;}c[s++]=i;for(;;){mygc(i);if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF) break;c[s++]=i;}c[s]='\0';return s;}
template <class T, class S> void reader(T *x, S *y){reader(x);reader(y);}
template <class T, class S, class U> void reader(T *x, S *y, U *z){reader(x);reader(y);reader(z);}
template <class T, class S, class U, class V> void reader(T *x, S *y, U *z, V *w){reader(x);reader(y);reader(z);reader(w);}

void writer(int x, char c){int s=0,m=0;char f[10];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);}
void writer(ll x, char c){int s=0,m=0;char f[20];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);}
void writer(double x, char c){printf("%.15f",x);mypc(c);}
void writer(const char c[]){int i;for(i=0;c[i]!='\0';i++)mypc(c[i]);}
void writer(const char x[], char c){int i;for(i=0;x[i]!='\0';i++)mypc(x[i]);mypc(c);}
template<class T> void writerLn(T x){writer(x,'\n');}
template<class T, class S> void writerLn(T x, S y){writer(x,' ');writer(y,'\n');}
template<class T, class S, class U> void writerLn(T x, S y, U z){writer(x,' ');writer(y,' ');writer(z,'\n');}
template<class T> void writerArr(T x[], int n){int i;if(!n){mypc('\n');return;}rep(i,n-1)writer(x[i],' ');writer(x[n-1],'\n');}

char memarr[17000000]; void *mem = memarr;
#define MD 1000000007

int main(){
  int i, j, k;
  int A, B, f;

  reader(&A,&B);
  if(A <= 0 && 0 <= B){
    writerLn("Zero");
    return 0;
  }
  f = 0;
  if(B < 0) f = (B-A+1)%2;

  if(f) writerLn("Negative"); else writerLn("Positive");

  return 0;
}


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

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

using namespace std;
using lint=long long;

const long long INF=1LL<<61;

int main(){
	int n; scanf("%d",&n);
	vector<int> a(n);
	rep(i,n) scanf("%d",&a[i]);

	vector<lint> sum(n+1);
	rep(i,n) sum[i+1]=sum[i]+a[i];

	lint dp[400][401];
	rep(l,n) rep(r,n+1) dp[l][r]=INF;
	rep(l,n) dp[l][l+1]=0;
	for(int w=2;w<=n;w++) rep(l,n-w+1) {
		int r=l+w;
		for(int m=l+1;m<r;m++) dp[l][r]=min(dp[l][r],dp[l][m]+dp[m][r]+sum[r]-sum[l]);
	}
	printf("%lld\n",dp[0][n]);

	return 0;
}


Measured memory_bytes: 1536