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

using namespace std;

//n <= 100000
//k <= n

int dp[100003];

int main(void){
	int n,k;
	
	while(scanf("%d%d", &n, &k) && n && k){
		int temp;
		int ans=0;
		fill(dp,dp+100000,0);
		
		for(int i = 0; i < k; i++){
			scanf("%d", &temp);
			dp[temp] = 1;
		}
		
		for(int i = 2; i <= n; i++){
			if(dp[i] == 1)dp[i] = dp[i-1]+dp[i];
		}
		/*
		for(int i = 1; i <= n; i++){
			printf("%d ",dp[i]);
		}puts("");
		*/
		temp = 0;
		for(int i = n; i >= 1; i--){
			if(dp[i] == 0)temp = 0;
			else if(temp == 0)temp = dp[i];
			else dp[i] = temp;
		}
		/*
		for(int i = 1; i <= n; i++){
			printf("%d ",dp[i]);
		}puts("");
		*/
		
		if(dp[0]){
			for(int i = 1; i <= n; i++){
				if(dp[i] == 0){
					ans = max(dp[i-1]+dp[i+1]+1,ans);
				}
			}
		}
		else {
			for(int i = 1; i <= n; i++){
				ans = max(dp[i],ans);
			}
		}
		
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
string a,b;
long long int s,cop,copp,last,n;
long long int latte[1000],cafe[1000],all[1000],ans[1000];
int main(){
    int cou=0;
    cin>>n;
    for(int l=0;l<n;l++){
        cou=0;
        fill(latte,latte+1000,0);
        fill(cafe,cafe+1000,0);
        fill(all,all+1000,0);
        fill(ans,ans+1000,0);
        cin>>a>>b;
        if(a.size()>b.size()){
            s=a.size();
            cop=a.size(),copp=b.size(),last=s;
        }
        else {
            s=b.size();
            cop=a.size(),copp=b.size(),last=s;
        }
        if(s>80){
            cout<<"overflow"<<endl;
            continue;
        }
        for(int i=0;i<a.size();i++){
            cop--;
            if(a[i]=='0')latte[cop]=0;
            if(a[i]=='1')latte[cop]=1;
            if(a[i]=='2')latte[cop]=2;
            if(a[i]=='3')latte[cop]=3;
            if(a[i]=='4')latte[cop]=4;
            if(a[i]=='5')latte[cop]=5;
            if(a[i]=='6')latte[cop]=6;
            if(a[i]=='7')latte[cop]=7;
            if(a[i]=='8')latte[cop]=8;
            if(a[i]=='9')latte[cop]=9;
            }
        for(int i=0;i<b.size();i++){
            copp--;
            if(b[i]=='0')cafe[copp]=0;
            if(b[i]=='1')cafe[copp]=1;
            if(b[i]=='2')cafe[copp]=2;
            if(b[i]=='3')cafe[copp]=3;
            if(b[i]=='4')cafe[copp]=4;
            if(b[i]=='5')cafe[copp]=5;
            if(b[i]=='6')cafe[copp]=6;
            if(b[i]=='7')cafe[copp]=7;
            if(b[i]=='8')cafe[copp]=8;
            if(b[i]=='9')cafe[copp]=9;
            }
         for(int i=0;i<=s;i++){
            all[i]+=latte[i]+cafe[i];
            if(all[i]>9){
                all[i]-=10;
                all[i+1]+=1;
            }
         }
         /*for(int i=s-1;i>-1;i--){
            if(all[last]!=0)cout<<all[last];
            cout<<all[i];
            all[last]=0;
         }*/
         for(int i=s-1;i>-1;i--){
            if(all[last]!=0){
                ans[last]=all[last];
                cou++;
                all[last]=0;
            }
            ans[i]=all[i];
            cou++;
         }
         if(cou>80)cout<<"overflow";
         else for(int i=s-1;i>-1;i--){
            if(ans[last]!=0)cout<<ans[last];
            cout<<ans[i];
            ans[last]=0;
         }
         cout<<endl;
    }
}
//99999999999999999999999999999999999999999999999999999999999999999999999999999999

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

using namespace std;

#define PB push_back
#define SZ(a) (int)a.size()
#define MP make_pair

typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;

int main() {

	int N, K;
	scanf("%d%d", &N, &K);

	VI H(N);
	for(int i = 0; i < N; i++) {
		scanf("%lld", &H[i]);
	}

	sort(H.begin(), H.end());

	ll sum  = 0;
	for(int i = 0; i < N-K; i++)
		sum += H[i];

	printf("%lld\n", sum);

	return 0;
}


Measured memory_bytes: 1792
#include<algorithm>
#include<cstdio>
#define mxn 100010
using namespace std;
int n,m,sl,fh,ans,num[mxn];
int rd()
{
	sl=0;fh=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch) {if(ch=='-') fh=-1; ch=getchar();}
	while('0'<=ch&&ch<='9') sl=sl*10+ch-'0',ch=getchar();
	return sl*fh;
}
int main()
{
	n=rd();m=rd();int l,r;
	for(int i=1;i<=m;++i) l=rd(),r=rd(),num[l]++,num[r+1]--;
	for(int i=1;i<=n;++i) num[i]+=num[i-1],ans+=num[i]==m;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>

typedef long double ld;

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	cout << a * b;
	return 0;
}


Measured memory_bytes: 3636
=begin
a = gets.split("").map{|x| x.to_s}
b = gets.split("").map{|x| x.to_s}
count = 0
3.times do |i|
  if a[i] == b[i]
    count += 1
  end
end

p count
=end

=begin
a = gets.split(" ").map{|x| x.to_i}
if a[1] == 1
  p 0
  exit()
end
a[1] -= a[0]
ans = 1
while true
  break if (a[1] <= 0)
  a[1] -= a[0] - 1
  ans += 1
end
p ans
=end

n = gets.to_i
a = gets.split(" ").map{|x| x.to_i}
max = 0

count = 0

(n - 1).times do |i|
  if a[i] >= a[i + 1]
    count += 1
  else
    if(max < count)
      max = count
    end
    count = 0
  end
end
if(max < count)
  max = count
end

p max


Measured memory_bytes: 8580
table = [[[0]*10 for i in range(0, 3)]for j in range(0, 4)]
n = int(input())
for k in range(n):
    h, f, r, v = map(int, input().split())
    table[h-1][f-1][r-1] += v
x = 0
for i in range(4):
    if x != 0:
        print("#"*20)
    x += 1
    for a in range(3):
        for b in range(10):
            print(" %d"%(table[i][a][b]), end="")
        print()


Measured memory_bytes: 5624
N, K, Q = map(int, input().split())
A = list(int(input()) for i in range(Q))

B = [0] * N
for i in A:
    B[i-1] += 1

for i in range(N):
    minus_p = Q - B[i]
    if K - minus_p > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 8640
/**
*Coder: Yeshayah
**/

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int k, a, b;
    cin >> k >> a >> b;
    int p = a / k;
    p += a % k == 0 ? 0 : 1;
    if (b >= p * k) cout << "OK\n";
    else cout << "NG\n";
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <cctype>
#include <utility>
#include <map>
#include <string>
#include <climits>
#include <set>
#include <sstream>
#include <utility>
#include <ctime>
#include <cassert>
#include <fstream>
using namespace std;
typedef long long LL;
#define MS(A) memset(A, 0, sizeof(A))
#define MSV(A,a) memset(A, a, sizeof(A))
#define MAX(a,b) ((a >= b) ? (a) : (b))
#define MIN(a,b) ((a >= b) ? (b) : (a))
#define ABS(a) (((a) > 0) ? (a) : (-a))
#define MP make_pair
#define PB push_back
#define getcx getchar_unlocked
#define INF (int(1e9))
#define INFL (LL(1e18))
#define EPS 1e-12
#define chkbit(s, b) (s & (1<<b))
#define setbit(s, b) (s |= (1<<b))
#define clrbit(s, b) (s &= ~(1<<b))

vector<int> vec[100005];
int visited[100005], ans[100005];
queue<int> q;
vector<int> ter;

void bfs(int st) {

	q.push(st);
	visited[st] = 1;

	while(!q.empty()) {

		int curr = q.front();
		q.pop();

		for(int i = 0 ; i < vec[curr].size(); i++) {

			if(vec[curr][i] == 1) {
				ter.PB(curr);
				ans[curr] = 1;
			}

			if(!visited[vec[curr][i]]) {
				visited[vec[curr][i]] = 1;
				q.push(vec[curr][i]);
			}
		}

	}
}

int main() {

	int n,m,i,a,b;
	cin>>n>>m;

	for(i = 0 ; i < m; i++) {
		cin>>a>>b;
		vec[a].PB(b);
		vec[b].PB(a);
	}

	bfs(2);

	for(int i = 0 ; i < ter.size(); i++) {

		int curr = ter[i];

		for(int j = 0 ; j < vec[curr].size(); j++) {

			if(vec[curr][j] != 1 && ans[vec[curr][j]] == 0) {
				ans[vec[curr][j]] = curr;
				ter.PB(vec[curr][j]);
			}
		}
	}

	int flag = 0;



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

		//printf("%d  ", ans[i]);
		if(ans[i] == 0) {
			flag = 1;
			break;
		}
	}

	if(flag == 1) {

		printf("No\n");
	} else {
		printf("Yes\n");

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

Measured memory_bytes: 11236
#include <bits/stdc++.h> 
using namespace std; 
  
int MinimumNumIncreasingSubsequences(int arr[], int n) 
{ 
    multiset<int> last; 
    for (int i = 0; i < n; i++) { 
  
        multiset<int>::iterator it = last.lower_bound(arr[i]); 
        if (it == last.begin()) 
            last.insert(arr[i]); 
  
        else { 
            it--; 
            last.erase(it); 
            last.insert(arr[i]); 
        } 
    } 
    return last.size(); // our answer is the size of last 
} 
  
// Driver program 
int main() 
{ 
int n;
cin>>n;
int arr[n+1];
for(int i=0;i<n;i++)
{
	cin>>arr[i];
}
    cout << MinimumNumIncreasingSubsequences(arr, n); 
    return 0; 
} 

Measured memory_bytes: 5376
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


N = int(readline())
B = list(map(int, readline().split()))


def main():
    ans = []
    while B:
        for i in range(len(B), 0, -1):
            if i == B[i - 1]:
                ans.append(B.pop(i - 1))
                break
        else:
            print(-1)
            return
    print(*reversed(ans), sep='\n')


if __name__ == '__main__':
    main()


Measured memory_bytes: 38640
// I need some holiday
// But I don't wish that everyday is holiday
// Because I didn't bear the pain
// Because it wasn't a true freedom
//         ——『イヤホンと蝉時雨』·Orangestar

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned int UI;
typedef pair<int, int> pii;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define MP make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline int chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline int chkmax(T &a, const T &b) { return b > a ? a = b, 1 : 0; }
template<typename T> inline T sqr(const T &val) { return val * val; }

namespace fastIO
{
	const int MAX_BUFFER_SIZE = 1 << 16;

	char buffer[MAX_BUFFER_SIZE], *cur = buffer, *ed = buffer;

	inline char getc() { return cur == ed && (ed = (cur = buffer) + fread(buffer, 1, MAX_BUFFER_SIZE, stdin), cur == ed) ? EOF : *cur++; }
}
using fastIO::getc;

template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getc());
	for(; !isdigit(ch); ch = getc()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

inline char *read_str(char *s)
{
	register char ch(getc());
	while(!isgraph(ch)) ch = getc();
	for(; isgraph(ch); ch = getc()) *s++ = ch;
	*s = '\0';
	return s;
}

// END tpl.

const int MAXN = (int) 2e5;

int n, M;

int a[MAXN + 5];

inline void input()
{
	n = read<int>(), M = read<int>();
	for(int i = 1; i <= 2 * n; ++i) a[i] = read<int>();
}

inline int check(int LIM, int type = 0)
{
	static int b[MAXN + 5], c[MAXN + 5];
	for(int i = 1; i <= 2 * n; ++i) b[i] = a[i] + (2 * n - i + 1 <= LIM ? -M : 0);
	merge(b + 1, b + 2 * n - LIM + 1, b + 2 * n - LIM + 1, b + 2 * n + 1, c + 1);

	int res = 0;
	for(int i = 1; i <= 2 * n; ++i)
	{
		if(c[i] + c[2 * n - i + 1] < 0) return 0;
		chkmax(res, c[i] + c[2 * n - i + 1]);
	}
	return type ? res : 1;
}

inline void solve()
{
	sort(a + 1, a + 2 * n + 1);
	int l = 0, r = n;
	while(l < r)
	{
		int mid = (l + r + 1) / 2;
		if(check(mid)) l = mid;
		else r = mid - 1;
	}
	printf("%d\n", check(l, 1));
}

int main()
{
#ifdef K_ON
	freopen("E.in", "r", stdin);
	freopen("E.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}




Measured memory_bytes: 2688
/*
Author : N_o_o_B
Created : April 22 2020 23:11:33 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int x;
    cin >> x;
    repd(i,x,1){
        rep(j,2,x){
            int _i =i;
            int cnt = 0;
            while(_i%j==0){
                _i /= j;
                cnt++;
            }
            if(_i==1 and cnt>=2){
                cout << i << endl;
                return 0; 
            }
        }
    }
    cout << 1 << endl;



    time_taken();
    return 0;
}

Measured memory_bytes: 256
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
from collections import deque

inf = 10 ** 15
mod = 10 ** 9 + 7

n = int(input())
b = list(map(int, input().split()))
ans = []
while b:
    ind = -1
    for i,c in enumerate(b):
        if i+1 == c:
            ind = i
    if ind == -1:
        print(-1)
        sys.exit()
    ans.append(b.pop(ind))
ans.reverse()
for tmp in ans:
    print(tmp)

Measured memory_bytes: 38640
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long ;
using ld=long double;
 
int main(){
    int k,x;
    cin>>k>>x;
    if(k==1)
    cout<<x;
    else{
        int n=x-k+1;
        for(int i=n;i<x+k;i++){
            cout<<i<<" ";
        }
    }
    return 0;
}

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



class Main {

	public static void main(String[] argv){

		FastScanner sc = new FastScanner();
		
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		String s = sc.next();
		
		char[] c = s.toCharArray();
		
		int count = 0,bcount = 1;
		
		for(int i = 0;i<c.length;i++){
			switch (c[i]) {
			case 'a':
				if (count < a+b){
					System.out.println("Yes");
					count++;
				}else{
					System.out.println("No");
				}
				break;
			case 'b':
				if(count < a+b && bcount <= b){
					System.out.println("Yes");
					count++;
					bcount++;
				}else{
					System.out.println("No");
				}
				break;
			case 'c':
				System.out.println("No");
				break;
			}
		}

	}


}

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


Measured memory_bytes: 21552
#include<stdio.h>

const int maxn=2e5;
char s[maxn],sk[maxn],tmp;
int cnt=0;

int main(){
	
	scanf("%s",s);
	
	for(int i=0;s[i]!='\0';i++){
		
		if(!cnt){
			sk[cnt]=s[i];
			cnt++;
		}
		else if(s[i]=='T' && sk[cnt-1]=='S'){
			cnt--;
		}
		else{
			sk[cnt]=s[i];
			cnt++;
		}
		
	}
	
	printf("%d\n",cnt);
	
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)

int main()
{
  ll N, M;
  cin >> N >> M;
  vector<pair<ll, ll> > pairs(N);

  rep(i, N) {
    ll A, B;
    cin >> A >> B;
    pairs[i] = mp(A, B);
  }

  sort(all(pairs));

  ll ans = 0;

  rep(i, N) {
    if (M == 0) break;
    ll minv = min(M, pairs[i].S);
    ans += pairs[i].F * minv;
    M -= minv;
  }

  cout << ans << endl;
}


Measured memory_bytes: 1792
# ????????????????????°??????
import sys

def main():
    while True:
        m, f, r = [int(i) for i in sys.stdin.readline().strip().split(' ')]
        if m == -1 and f == -1 and r == -1:
            break

        sum = m + f
        
        if m == -1 or f == -1:
            rank = 'F'
        elif sum >= 80:
            rank = 'A'
        elif sum >= 65:
            rank = 'B'
        elif sum >= 50:
            rank = 'C'
        elif sum >= 30:
            if r >= 50:
                rank = 'C'
            else:
                rank = 'D'
        else:
            rank = 'F'

        print(rank)

if __name__ == '__main__':
    main()

Measured memory_bytes: 7768
def binary_search(ok, ng, error, test):
    """
    :param ok: solve(x) = True を必ず満たす点
    :param ng: solve(x) = False を必ず満たす点
    """
    while abs(ok - ng) > error:
        mid = (ok + ng) / 2
        if test(mid):
            ok = mid
        else:
            ng = mid
    return ok

def max2(x,y):
    return x if x > y else y

def min2(x,y):
    return x if x < y else y

def test(y):
    return (a**3*tan(y)/2 + (b-a*tan(y))*cos(y)*a**2/cos(y) if b-a*tan(y) >= 0 else b**2*a*tan(pi/2-y)/2 ) >= x

from math import *
a, b, x = map(int, input().split())


print(binary_search(0,pi/2,10**(-8), test)*180/pi)








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

char s[100010];
char s1[100010];

int main()
{
	cin>>s;
	int l = strlen(s);
	if(l&1)
	{
		cout<<"No"<<endl;
		return 0;
	}
	for(int i=0;i<l;i++) s1[i] = s[l-i-1]; 
	for(int i=0;i<l;i++)
	{
		if(s1[i] == 'b') s1[i] = 'd';
		else if(s1[i] == 'd') s1[i] = 'b';
		else if(s1[i] == 'p') s1[i] = 'q';
		else s1[i] = 'p';
	}
	if(!strcmp(s1, s)) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

#define PB          push_back
#define PF          push_front
#define MP          make_pair
#define FI          first
#define SE          second
#define SIZE( A )   int( ( A ).size( ) )
#define ALL( A )    ( A ).begin( ), ( A ).end( )
#define ALLR( A )   ( A ).rbegin( ), ( A ).rend( )

using namespace std;

typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         lf;
typedef pair< int, int >    pii;
typedef pair< ll, ll >      pll;
typedef vector< bool >      vb;
typedef vector< lf >        vd;
typedef vector< ll >        vll;
typedef vector< int >       vi;
typedef vector< pii >       vpii;

const int MAXN = int( 2e5 )+10;
const int MOD  = int( 1e9 )+7;
const int oo   = INT_MAX;

int n;
string str;
int nxt[ MAXN ][ 255 ];

int dp[ MAXN ];

int go( int i ) {
  if( i == -1 ) {
    return 0;
  }
  int& r = dp[ i ];
  if( r != -1 ) {
    return r;
  }
  r = oo;
  for( int j = 'a'; j <= 'z'; ++j ) {
    r = min( r, go( nxt[i][j] )+1 );
  }
  return r;
}

void rebuild( int i ) {
  if( i == -1 ) {
    return ;
  } 
  for( int j = 'a'; j <= 'z'; ++j ) {
    if( nxt[i][j] == -1 || dp[ i ] == dp[ nxt[i][j] ]+1 ) {
      cout << char(j);
      rebuild( nxt[i][j] );
      return ;
    }
  }
  assert( false );
}

int main( ) {

  #ifdef LOCAL
    freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
  #else
    //freopen( ".in", "r", stdin );
    //freopen( ".out", "w", stdout );
    ios_base::sync_with_stdio( 0 );
    cin.tie( 0 );
  #endif

  while( cin >> str ) {
    n = SIZE( str );
    memset( nxt, -1, sizeof( nxt ) );
    for( int i = n-1; i >= 0; --i ) {
      for( int j = 0; j < 255; ++j ) {
        nxt[ i ][ j ] = nxt[ i+1 ][ j ];
      }
      nxt[ i ][ str[ i ] ] = i+1;
    }
    memset( dp, -1, sizeof( dp ) );
    int len = go( 0 );
    rebuild( 0 ); cout << '\n';
  }

  return 0;
}

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

using namespace std;

int main() {
    string in;
    stack<int> s;
    while(cin >> in)
    {
        if(in == "+") {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(b + a);
        } else if(in == "-") {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(b - a);
        } else if(in == "*") {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(b * a);
        } else if(in == "/") {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(b / a);
        } else {
            s.push(atoi(in.c_str()));
        }
    }
    
    cout << s.top() << endl;

    
}
    



Measured memory_bytes: 3216
#include<iostream>

int main(){
	int a, b, c, max;

	std::cin >> a >> b >> c;

	if (a - b >= 0){
		if (a - c >= 0){
			std::cout << 10 * a + b + c << std::endl;
		}
		else{
			std::cout << 10 * c + a + b << std::endl;
		}
	}
	else if (b - c >= 0){
		std::cout << 10 * b + a + c << std::endl;
	}
	else{
		std::cout << 10 * c + a + b << std::endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define NMAX 2000000
#define AMAX 10000
int n=AMAX;
void CountingSort(unsigned short *,unsigned short *,int);
int main(){
  int i;
  unsigned short *A;
  unsigned short *B;
  int k;
  

  scanf("%d",&k);

  A=malloc(sizeof(short)*k+1);
  B=malloc(sizeof(short)*k+1);
  
  for(i=0;i<k;i++){
    scanf("%hu",&A[i+1]);
  }
  //  printf("ok1\n");
  CountingSort(A,B,k);
  return 0;
}

void CountingSort(unsigned short *A,unsigned short *B,int k){
  int i,j;
  int C[AMAX+1];
  //printf("ok2\n");
  for(i=0;i<=AMAX;i++){
    C[i]=0;
  }
  //printf("ok3\n");
  for(j=0;j<k;j++){
    C[A[j+1]]++;
  }
  //printf("ok4\n");
  for(i=1;i<=AMAX;i++){
    C[i]=C[i]+C[i-1];
  }
  //printf("ok5\n");
  for(j=1;j<=k;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  //printf("ok6\n");
  for(i=1;i<=k;i++){
    if(i>1)
      printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
}




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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}
void _main();
int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); return 0;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

void _main(){
  int N0,N,K; cin >> N0 >> K ;
  vi a;
  int ans = 0;
  rep(i,N0){
    int aa; cin >> aa ;
    if(aa>=K){
      ans++;
      continue;
    }
    a.pb(aa);
  }
  N = a.size();
  vvi dp1(N+1,vi(K+1)),dp2(N+1,vi(K+2));
  dp1[0][0] = 1;
  rep(i,N){
    dp1[i+1] = dp1[i];
    rep(j,K) if(j+a[i]<=K) dp1[i+1][j+a[i]] |= dp1[i][j];
  }
  dp2[N][0] = 1;
  RREP(i,N,1){
    dp2[i-1] = dp2[i];
    rep(j,K) if(j+a[i-1]<=K) dp2[i-1][j+a[i-1]] |= dp2[i][j];
  }
  rep(i,N+1){
    vi ss(K+2);
    rep(j,K+1) ss[j+1] = ss[j] + dp2[i][j]; 
    dp2[i] = ss;
  }
  rep(i,N){
    rep(j,K+1){
      if(dp1[i][j]==0) continue;
      if(dp2[i+1][K-j]-dp2[i+1][max(K-a[i]-j,0)]==0) continue;
      ans++;
      break;
    }
  }
  cout << N0-ans << endl;
}

Measured memory_bytes: 196096
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include<stack>
#include<string>
#include<algorithm> 
#include <set>
#include<list>
#include <bit>
#include <bitset>
#include <cstdint>
#include <initializer_list>
typedef long long int ll;
using namespace std;
const int MOD = 1000000007;


ll modPow(ll a, ll n, ll p) {
    if (n == 0) return 1; 
    if (n == 1) return a % p;
    if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
    long long t = modPow(a, n / 2, p);
    return (t * t) % p;
}

ll ModuleFrac(ll N,ll K, ll M) {
    ll modu = 1;
    for (int i = 0; i <K; i++) {
        modu = (modu * (N-i)) % M;
    }
    return modu;
}
int main() {
    ll N, a, b; cin >> N >> a >> b;
    ll ans;
    ans = (modPow(2, N, MOD)) % MOD;
    ans -= ((ModuleFrac(N, a, MOD)) * (modPow(ModuleFrac(a, a, MOD), MOD - 2, MOD))) % MOD;
    ans -= ((ModuleFrac(N, b, MOD)) * (modPow(ModuleFrac(b, b, MOD), MOD - 2, MOD))) % MOD;
    ans--;
    while (ans < 0) {
        ans += MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3524
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)				// repeat
#define repr(i, begin, end) for (ll i = begin - 1; end <= i; i--)		// repeat reverse

#endif


int main(void)
{
	ll m; cin >> m;

	cout << 24 + (24 - m);

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	
	
	public static void main(String[] args) {
		new Main().Kei();
	}
	
	void Kei() {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int g=a*b;
		if((g%2)==0)
			System.out.println("Even");
		else
			System.out.println("Odd");
	}
	
}




Measured memory_bytes: 21716
#include<stdio.h>
main(){
  int i,n,k=100000;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    k=k*1.05;
    if(k%1000>0){
      k=k/1000;
      k++;
      k=k*1000;
    }
  }
  printf("%d\n",k);
  return 0;
}

Measured memory_bytes: 592
import java.util.Scanner;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        boolean[] dp = new boolean[k+1];
        for (int i = 0; i <= k; i++) {
            for (int a : arr){
                if(a<=i) {
                    if(!dp[i-a]){
                        dp[i]=true;
                    }
                }
            }
        }
        System.out.println((dp[k]?"First":"Second"));
    }
}


Measured memory_bytes: 36548
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(void){
  string n;
  cin >> n;

  for(auto& c : n){
    if(c=='1'){
      c = '9';
    }else if(c=='9'){
      c = '1';
    }
  }
  cout << n << endl;
}


Measured memory_bytes: 256
// ARC100
// D - Equal Cut

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 200000;
const ll INF = 1e18;

int N;
int A[MAX_N];
ll s[MAX_N + 1];

int search(int a, int b) {
    int l = a + 1, r = b - 1;
    while (r - l > 1) {
        int m = (l + r) / 2;
        if (s[m] - s[a] <= s[b] - s[m]) {
            l = m;
        } else {
            r = m;
        }
    }
    return l;
}

ll solve() {
    s[0] = 0;
    for (int i = 1; i <= N; i++) {
        s[i] = s[i - 1] + A[i - 1];
    }

    ll ans = INF;
    for (int i = 1; i < N; i++) {
        int pq = search(0, i);
        int rs = search(i, N);
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                ll pqrs[4] = {
                    s[pq + j] - s[0],
                    s[i] - s[pq + j],
                    s[rs + k] - s[i],
                    s[N] - s[rs + k],
                };
                sort(pqrs, pqrs + 4);
                ans = min(ans, pqrs[3] - pqrs[0]);
            }
        }
    }
    return ans;
}

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

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 2560
#include <cstdio>

int main(){
    long n;
    long long hold, min, max, sum;
    sum = 0;
    max = -1000000;
    min = 1000000;
    scanf("%ld", &n);
    for(int i=0; i < n; i++){
      scanf("%lld", &hold);
      if(hold<min)min=hold;
      if(hold>max)max=hold;
      sum += hold;
    }
    printf("%lld %lld %lld\n", min, max, sum);
  return 0;
}

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

int main() {
  int n; cin >> n;
  string res = "No";

  for (int i = 1; i <= 9; ++i) {
    int t = n / i;
    if (n % i == 0 && t <= 9) {
      res = "Yes";
    }
  }

  cout << res << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define int long long

int sumofdigits(int x) {
  int sum = 0;
  while (x > 0) {
    sum += x % 10;
    x /= 10;
  }
  return sum;
}

void PrintMap(std::map<std::string, int>& m) {
  for (auto iter: m) {
    std::cout << iter.first << " => " << iter.second << "\n";
  }
}

signed main() {
  int n, m;
  std::cin >> n;
  std::map<std::string, int> s;
  
  std::string key;
  for (int i = 0; i < n; i++) {
    std::cin >> key;
    if (s.find(key) != s.end()) {
      s.at(key) += 1;
    } else {
      s[key] = 1;
    }
  }
  
  std::cin >> m;
  std::map<std::string, int> t;
  for (int i = 0; i < m; i++) {
    std::cin >> key;
    if (t.find(key) != t.end()) {
      t.at(key) += 1;
    } else {
      t[key] = 1;
    }
  }
  
  /*
  PrintMap(s);
  PrintMap(t);
  */
  
  int score, max;
  max = 0;
  for (auto iter: s) {
    key = iter.first;
    if (t.find(key) != t.end()) {
      score = iter.second - t.at(key);
    } else {
      score = iter.second;
    }
    if (score > max) {
      max = score;
    }
  }
  
  std::cout << max << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int r,g,b;
  cin >> r >> g >> b;
  int ans;
  ans = 100*r + 10*g + b;
  if(ans % 4 == 0){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
    int i, L, R, d, count = 0;
 
    scanf("%d %d %d", &L, &R, &d);
    for (i = L; i <= R; i++)
    {
        if (i % d == 0)
        {
            ("%3d,", i);
            count++;
        }
    }
    printf("%d\n",count);
}

Measured memory_bytes: 1712
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値

// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}

int main() {
ll n;
cin>>n;
ll a[n]={};
for(ll i=0; i<n; i++){
cin>>a[i];}
ll b=a[0];
ll c=a[0];
ll d;
for(ll i=1; i<n; i++){
c=__gcd(a[i],c);
}
cout<<c<<endl;}


Measured memory_bytes: 4408
import java.util.Scanner

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)

    val a, b, c, k = sc.nextInt()
    val ans =
      if (a >= k) k
      else if (a + b >= k) a
      else a - (k - a - b)

    println(ans)
  }

  def f(n: Int): Int = {
    if (n < 0) n + 360
    else if (n > 360) n % 360
    else n
  }

  //region

  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }

  def printExecTime(process: => Unit): Unit = {
    val start = System.currentTimeMillis
    process
    debug("処理時間： " + (System.currentTimeMillis - start) + " ミリ秒")
  }

  def bitSearch[T](n: Int, choice: Vector[T]): Vector[Vector[T]] = {
    @tailrec
    def bitSearchLogic(n: Int,
                       choice: Vector[T],
                       acc: Vector[Vector[T]]): Vector[Vector[T]] = {
      if (n == 0) acc
      else {
        val newAcc =
          acc.flatMap(vec => {
            choice.map(c => vec :+ c)
          })
        bitSearchLogic(n - 1, choice, newAcc)
      }
    }

    val firstAcc = choice.map(i => Vector(i))
    bitSearchLogic(n - 1, choice, firstAcc)
  }
  //endregion
}


Measured memory_bytes: 55336
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;

    ll a = H1*60 + M1;
    ll b = H2*60 + M2;
    ll c = b - a - K;
    cout << c;
}

Measured memory_bytes: 3620
import java.util.Arrays;
import java.util.Scanner;

//Sergeant Rian
public class Main{
  
	class N{
		int id, go, back, order, parent;
		boolean leaf;
		boolean[] child;
		public N(int id) {
			this.id = id;
			parent = -1;
			child = new boolean[n+1];
		}
		public void f(){
			leaf = true;
			for(int i=1;i<=n;i++){
				if(t[id][i]==1<<29||parent==i)continue;
				node[i].parent = id;
				child[i] = true;
				leaf = false;
				node[i].f();
			}
			order = visit++;
		}
		public void calc(){
			int min = 1<<29;
			for(int i=1;i<=n;i++){
				if(!child[i]||node[i].leaf||parent==i)continue;
				int cost = t[id][i] + node[i].go;
				for(int j=1;j<=n;j++){
					if(!child[j]||i==j||parent==j||node[j].leaf)continue;
					cost += t[id][j]*2 + node[j].back;
				}
				min = Math.min(min, cost);
			}
			if(min!=1<<29)go = min;
			else go = 0;
			for(int i=1;i<=n;i++){
				if(!child[i]||node[i].leaf||parent==i)continue;
				back += t[id][i]*2 + node[i].back;
			}
		}
	}
	
	int n, visit;
	N[] node;
	int[][] t;
	
	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			n = sc.nextInt();
			if(n==0)break;
			node = new N[n+1];
			t = new int[n+1][n+1];
			for(int []a:t)Arrays.fill(a, 1<<29);
			for(int i=1;i<=n;i++)node[i]=new N(i);
			for(int i=0;i<n-1;i++){
				int a = sc.nextInt();
				int b = sc.nextInt();
				int c = sc.nextInt();
				t[a][b] = t[b][a] = c;
			}
			visit = 0;
			node[1].f();
			for(int o=0;o<n;o++)for(int i=1;i<=n;i++)if(node[i].order==o)node[i].calc();
			System.out.println(node[1].go);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
// Charan Sriramula
 
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long int ll;
 
const ll logx=30;
const ll N=1e3+5;
const ll INF=1e18+5;
const ll mod=1e9+7;
const double PI = 3.14159265358979323846;
 
#define ints(n) scanf("%d",&n)
#define intp(n) printf("%d\n",n)
#define longs(n) scanf("%intd",&n)
#define longp(n) printf("%intd\n",n)
 
inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
 
#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define ms(dp,val) memset(dp,val,sizeof(dp))
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1ll;x=(x*x)%m;}return ans%m;}
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
int main()
{
  ll a,b;
  cin>>a>>b;
  ll maxi=-INF;
  maxi=max(maxi,a*b);
  maxi=max(maxi,a+b);
  maxi=max(maxi,a-b);
  cout<<maxi<<endl;
}

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

int main() {
	string s;
	while(1){
		getline(cin, s);
		if(s == ".")
			break;
		stack<char> k;
		bool ok = true;
		for(int i = 0; i < s.size(); ++i){
			if(s[i] == '('){
				k.push('(');
			}
			else if(s[i] == ')'){
				if(k.empty()){
					ok = false;
					break;
				}
				char c = k.top();
				k.pop();
				if(c != '('){
					ok = false;
					break;
				}
			}
			else if(s[i] == '['){
				k.push('[');
			}
			else if(s[i] == ']'){
				if(k.empty()){
					ok = false;
					break;
				}
				char c = k.top();
				k.pop();
				if(c != '['){
					ok = false;
					break;
				}
			}
		}
		if(k.empty() && ok){
			cout << "yes" << endl;
		}
		else{
			cout << "no" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1180
@s=<>=~/./g;
$l=0;$r=$#s;
while($l<$r){
	$s[$l]eq$s[$r]?
		(++$l,--$r)
	:$s[$l]eq'x'?
		(++$l,++$%)
	:$s[$r]eq'x'?
		(--$r,++$%)
	:exit!print-1,$/
}
print$%,$/


Measured memory_bytes: 13952
#include<stdio.h>
#include<string.h>
#define cmp(day) strcmp(s,day)==0
int main()
{
	char s[4];

	scanf("%s",s);

	if(cmp("SUN"))
		puts("7");
	else if(cmp("MON"))
		puts("6");
	else if(cmp("TUE"))
		puts("5");
	else if(cmp("WED"))
		puts("4");
	else if(cmp("THU"))
		puts("3");
	else if(cmp("FRI"))
		puts("2");
	else
		puts("1");
	return 0;
}

Measured memory_bytes: 1568
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(readline())
    H = int(readline())
    W = int(readline())
    ans = (N-H+1)*(N-W+1)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

ll dp[104][104][500];

int main() {
    ll N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    for (int i = 0; i < N; i++) {
        cin >> w.at(i) >> v.at(i);
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            for (int x = 0; x <= N * 3; x++) {
                chmax(dp[i + 1][j + 1][x + (w[i] - w[0])], dp[i][j][x] + v[i]);
                chmax(dp[i + 1][j][x], dp[i][j][x]);
            }
        }
    }

    ll ans = 0;
    for (int j = 0; j <= N; j++) {
        for (int x = 0; x <= N * 3; x++) {
            if (j * w[0] + x <= W) {
                chmax(ans, dp[N][j][x]);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 40832
/**
 *    author        : Sudipta Banik Trisha 
 *    created       : August 04, 2020 4:21 PM
 *    Problem Name  : B - Magic 2
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_b
 *    @genarated by : ai-virtual-assistant
**/

#include<bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);

    int a,b,c;
    cin >> a >> b >> c;

    int k;
    cin >> k;

    if( a < b && b < c ){
        cout << "Yes" << endl;
        return 0;
    }

    while(k--){
        if( a >= b ){
            b = b*2;
        }

        else if( b >= c ){
            c = c*2;
        }

        if( a < b && b < c ){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0 ;
}


Measured memory_bytes: 3592
H, W = map(int, input().split())
state = [list(map(str, input().split())) for _ in range(H)]

A = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for h in range(H):
  for w in range(W):
    if state[h][w] == 'snuke':
      ans = A[w] + str(h+1)
print(ans)


Measured memory_bytes: 3060
N = int(input())
S = input()
R = S.count("R")
G = S.count("G")
B = S.count("B")
 
ans = R*G*B
for i in range(N-2):
    for j in range(i,N-1):
        k = 2*j - i
        if k < N:
            tmp = []
            tmp.append(S[i])
            tmp.append(S[j])
            tmp.append(S[k])
            if len(set(tmp)) == 3:
                ans -= 1
 
print(ans)

Measured memory_bytes: 68228
import java.util.Scanner;
public class Main {
	public static void main( String[] args ) {
		Scanner sc = new Scanner( System.in ) ;
		int w = sc.nextInt() ;
		int h = sc.nextInt() ;
		int x = sc.nextInt() ;
		int y = sc.nextInt() ;
		int r = sc.nextInt() ;
		if ( x >= r && y >= r && (h-y) >= r && (w-x) >= r ) {
			System.out.println( "Yes" ) ;
		} else {
			System.out.println( "No" ) ;
		}
	}
}

Measured memory_bytes: 17360
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n + 1];

		for (int i = 0; i <= n; i++) {
			a[i] = sc.nextLong();
		}

		long h = 0;
		long b;
		long d = 0;
		for (int i = 0; i <= n; i++) {
			if (i!=n) {
				b = sc.nextLong();
			} else {
				b = 0;
			}
			if (h <= a[i]) {
				d += h;
				a[i] -= h;
			} else  {
				d += a[i];
				a[i] = 0;
			}
			if (b <= a[i]) {
				d += b;
				h = 0;
			} else {
				d += a[i];
				h = b - a[i];
			}
		}
		System.out.println(d);
	}
}


Measured memory_bytes: 65284
nums = gets.strip.split(' ').map(&:to_i)

current = nums[0].abs
t=(current.abs/(nums[2])).to_i
if nums[1]<t
  puts (current.abs - (nums[1]*nums[2])).abs
else
  current = current.abs - nums[2]*t
  nums[1]-=t
  puts nums[1]%2==0 ? current : (current.abs-nums[2]).abs
end

Measured memory_bytes: 14308
def main():
    N = int(input())
    numbers = list(map(int, input().split(" ")))
    sorted_numbers = sorted(numbers)
    medians = [sorted_numbers[N // 2], sorted_numbers[N // 2 - 1]]
    for number in numbers:
        if number <= medians[1]:
            print(medians[0])
        else:
            print(medians[1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 25220