akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

ll g1(ll n, int p) { // p need to be a prime number
    if (n == 0) return 0;
    return n/p + g1(n/p, p);
}

ll g2(ll n, int p) { // p need to be a prime number
    if (n%2 == 1) {
        return g1(n, p) - g2(n-1,p);
    }
    ll res = g1(n/2, p);
    if (p == 2) res += n/2;
    return res;
}

int main()
{
    ll n;
    cin >> n;
    ll ans = 0;
    if (n % 2 == 1) {
        ans = 0;
    }
    else {
        ans = g2(n,5);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
arr = gets.strip.split(" ").map!(&:to_i)
five_counter = 0
seven_counter = 0
3.times do |i|
  if(arr[i] == 5) then
    five_counter += 1
  elsif(arr[i] == 7) then
    seven_counter += 1
  end
end

if(five_counter == 2 && seven_counter == 1) then
  puts "YES"
else
  puts "NO"
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b) cout << c << endl;
    else if(b == c) cout << a << endl;
    else cout << b << endl;
    
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<int,int>;

const int MOD = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int n;
    cin >> n;
    vector<int> v(n);
    vector<int> ans;
    rep(i, n){
        cin >> v[i];
    }

 

    int tmp;
    rep(i, n-1){
        tmp = 0;   
        if(v[0] != 1){
            cout << -1 << endl;
            return 0;
        }
        rep(j, v.size()){
            if(v[j] == j+1){
                tmp = j;
            }
        }

        ans.push_back(v[tmp]);
        v.erase(v.begin()+tmp);
    }

    if(v[0] != 1){
        cout << -1 << endl;
        return 0;
    }
    ans.push_back(1);
    reverse(all(ans));
    for (auto& p : ans) {
        cout << p << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,k;
ll a[1005];
vector<ll>vec;
int main(){
	cin>>n>>k;
	repn(i,n) cin>>a[i];
	for(int i=1;i<=n;i++){
		ll s = 0;
		for(int j=i;j<=n;j++){
			s += a[j];
			vec.pb(s);
		}
	}
	SORT(vec);
	ll cur = 0;
	for(int i=40;i>=0;i--){
		ll ncur = cur+(1LL<<i);
		int ok = 0;
		rep(j,vec.size()){
			if( (ncur & vec[j]) == ncur ) ok++;
		}
		if(ok>=k) cur = ncur;
	}
	cout<<cur<<endl;
}

Measured memory_bytes: 6512
n = int(input())
s = input()

r = []
g = []
b = set()

for i in range(n):
  if s[i] == 'R':
    r.append(i + 1)
  elif s[i] == 'G':
    g.append(i + 1)
  else:
    b.add(i + 1)

summary = 0
for i in r:
  for j in g:
    min_value = min(i, j)
    max_value = max(i, j)
    count = 0
    dif = max_value - min_value
    if min_value - dif in b:
      count += 1
    if max_value + dif in b:
      count += 1
    if max_value - (dif / 2) in b:
      count += 1
    summary += len(b) - count

print(summary)

Measured memory_bytes: 69284
a = [int(a) for a in input().split(' ')]
N = a[0]
K = a[1]
    
def abs_met(N):
    N = N % K
    if N > abs(N - K):
        N = abs(N - K)
        abs_met(N)
    else:
        print(N)
        
if K == 1:
    print(0)
else:
    abs_met(N)

Measured memory_bytes: 3060
n = int(input())
if 1 <= n <= 9:
  print(n)
elif 10 <= n <= 99:
  print(9)
elif 100 <= n <= 999:
  print(n - 90)
elif 1000 <= n <= 9999:
  print(909)
elif 10000 <= n <= 99999:
  print(n - 9090)
else:
  print(90909)

Measured memory_bytes: 3060
use std::cmp::max;
use std::io;
fn main() {
    let mut buft = String::new();
    io::stdin().read_line(&mut buft).unwrap();
    let n: usize = buft.trim().parse().unwrap();
    buft.clear();
    io::stdin().read_line(&mut buft).unwrap();
    let hs: Vec<i32> = buft
        .trim()
        .split_whitespace()
        .map(|x| x.parse::<i32>().unwrap())
        .collect();
    let mut i: usize = 1;
    let mut ans :usize = 0;
    while i < n {
        let mut j = i;
        while hs[j] <= hs[j - 1] {
            j += 1;
            if j >= n{
                break;
            }
        }
        ans = max(ans, j - i);
        i = j + 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

    vector<int> v(4, 0);
    rep(i, 3){
        int a, b;
        cin >> a >> b;
        a--; b--;
        v[a]++;
        v[b]++;
    }

    rep(i, 4){
        if(v[i] == 3){
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

	int i, j, n, q, count = 0;
	int dataS[10000], dataT[500];
	cin >> n;
	for (i = 0; i < n; i++){
		cin >> dataS[i];
	}

	cin >> q;
	for (i = 0; i < q; i++){
		cin >> dataT[i];
	}
	for (int j = 0; j < q; j++){
		for (int i = 0; i < n; i++){
			if (dataT[j] == dataS[i]){
				count++;
				break;
			}
		}
	}
	cout << count << "\n";

	return 0;
}

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

using namespace std;
#define MAXSIZE 10005

int Mark[MAXSIZE];
int prime[MAXSIZE];

int Prime(){
    int index = 0;
    memset(Mark,0,sizeof(Mark));
    for(int i = 2; i < MAXSIZE; i++)
    {
        //如果未标记则得到一个素数
        if(Mark[i] == 0){
            prime[index++] = i;
        }
        //标记目前得到的素数的i倍为非素数
        for(int j = 0; j < index && (long long)prime[j] * i < MAXSIZE; j++)
        {
            Mark[i * prime[j]] = 1;
            if(i % prime[j] == 0){
                break;
            }
        }
    }
    return index;
}

int main(){
    int n;
    cin>>n;
    Prime();
   int i=0;
   int j=0;
   while(i<n)
   {
       if(prime[j]%10==3)
       {
           i++;
           if(i==1)
            cout<<prime[j];
           else
            cout<<" "<<prime[j];
       }
       j++;
   }
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a,b;
  long l,n,s[7];

  while(scanf("%ld",&n),n!=0){
    for(l=0;l<7;l++) s[l]=0;
    for(l=0;l<n;l++){
      scanf("%d",&a);
      if((b=a/10)>=6) b=6;
      s[b]++;
    }
    for(l=0;l<7;l++) printf("%ld\n",s[l]);
  }
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <string>
#include <list>
using namespace std;

int main() {
	int x = 0;
	int k = 1;
	list<int> lst;

	while (1) {
		cin >> x;
		if (x == 0) {
			break;
		}
		lst.push_back(x);
	}

	list<int>::iterator it = lst.begin();
	while (it != lst.end()) {
		cout << "Case "<< k << ": " << *it << endl;
		k++;
		++it;
	}
}

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<pii, int> para;
const int inf = 1e9 + 7;
const int maxN = 1e6 + 5;

int n, l, length[maxN];
pii arr[maxN];
int check() {
	RI(i, n - 1) {
		if (arr[i].st + arr[i + 1].st >= l)
			return i;
	}
	return 0;
}

int main() {
	scanf("%d%d",&n,&l);
	RI(i, n) {
		scanf("%d",&arr[i].st);
		arr[i].nd = i;
	}
	int x = check();
	if (x == 0) {
		printf("Impossible\n");
		return 0;
	}
	printf("Possible\n");
	RI(i, x - 1) {
		printf("%d\n", i);
	}
	FORD(i, n - 1, x) {
		printf("%d\n",i);
	}
	//printf("%d\n",x);
	return 0;
}


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

int main() {
    int i = 1, n = 0, x;
    cin >> n;
    do {
        x = i;
        if (x % 3 == 0) {
            cout << " " << i;
            continue;
        }
        do {
            if (x % 10 == 3) {
                cout << " " << i;
                break;
            }
            x /= 10;
        } while (x);
    } while (++i <= n);
    cout << endl;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

int dp[3002][3002];
int main(){
	int a[6], n = 6;
	for(int i = 0;i < n;i++)scanf("%d", &a[i]);
	
	dp[0][0] = 1;
	for(int i = 0;i <= 3000;i++){
		for(int j = 0;j <= 3000;j++){
			if(i-100*a[0] >= 0)dp[i][j] = max(dp[i][j], dp[i-100*a[0]][j]);
			if(i-100*a[1] >= 0)dp[i][j] = max(dp[i][j], dp[i-100*a[1]][j]);
			if(j-a[2] >= 0)dp[i][j] = max(dp[i][j], dp[i][j-a[2]]);
			if(j-a[3] >= 0)dp[i][j] = max(dp[i][j], dp[i][j-a[3]]);
		}
	}
	
	pair<int,int> p = P(1, 0);
	int cnt = 0;
	for(int i = 1;i <= 3000;i++){
		for(int j = 1;j <= 3000;j++){
			if(dp[i][j] && i+j <= a[5] && a[4]*i >= 100*j){
				int x = p.first, y = p.second;
				if(y*(i+j) < j*(x+y)){
					p = P(i, j);
					cnt = 1;
				}
			}
		}
	}
	
	if(cnt == 0)printf("%d 0\n", 100*a[0]);
	else printf("%d %d\n", p.first+p.second, p.second);
	return 0;
}

Measured memory_bytes: 35456
n,w,h=map(int,input().split())
todoku_retu=[0]*(w+1)
todoku_gyou=[0]*(h+1)
for i in range(n):
	x,y,k=map(int,input().split())
	todoku_retu[max(x-k,0)]+=1
	todoku_retu[min(x-1+k,w-1)+1]-=1
	todoku_gyou[max(y-k,0)]+=1
	todoku_gyou[min(y-1+k,h-1)+1]-=1
p=0
d=0
for i in range(len(todoku_retu)-1):
	p+=todoku_retu[i]
	if p<=0:
		d+=1
		break
p=0
for i in range(len(todoku_gyou)-1):
	p+=todoku_gyou[i]
	if p<=0:
		d+=1
		break
if d!=2:
	print("Yes")
else:
	print("No")



Measured memory_bytes: 7176
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s; cin >> s;
    vector<int> v(26);
    for (auto c : s) v[c-'a']++;
    priority_queue<int> q;
    for (int i = 0; i < 26; i++) {
		if (v[i]) q.emplace(-v[i]);
	}
	if (q.size() == 1) {
	    cout << -q.top() << endl;
	    return 0;
	}
	int res = 0;
    while (q.size() > 1) {
        auto v1 = q.top(); q.pop();
        auto v2 = q.top(); q.pop();
        q.emplace(v1 + v2);
		res += -v1 - v2;
    }
	cout << res << endl;
}


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

#define lli long long int
#define ii pair<int, int>
#define ll pair<lli, lli>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define fi first
#define se second

using namespace std;

int main() {
	char c;
	scanf("%c", &c);
	printf("%c\n", c + 1);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
    long double w, h, x, y, num;
    cin >> w >> h >> x >> y;
    if(x == w/2 && y == h/2) {
        num = 1;
    } else {
        num = 0;
    }
    cout << w*h/2.0 << " " << num << '\n';
}


Measured memory_bytes: 256
// ALDS1_7_C Tree Walk
#include <iostream>
#include <vector>
#define NIL -1

struct Node {
    int parent = NIL;
    int L_child = NIL;
    int R_child = NIL;
};

std::vector<Node> tree;

void SetNodeRelation(int node_num, int L_child, int R_child) {
    if (L_child != NIL) {
        tree.at(node_num).L_child = L_child;
        tree.at(L_child).parent = node_num;
    }
    if (R_child != NIL) {
        tree.at(node_num).R_child = R_child;
        tree.at(R_child).parent = node_num;
    }
}

int GetRoot() {
    int root = NIL;
    int tmp = 0;
    while (true) {
        if (tree.at(tmp).parent == NIL) {
            root = tmp;
            break;       
        } else {
            tmp = tree.at(tmp).parent;
        }
    }
    return root;
}

void PreorderTreeWalk(int node_num) {
    int L_child = tree.at(node_num).L_child;
    int R_child = tree.at(node_num).R_child;

    std::cout << " " << node_num;
    if (L_child != NIL) /* -> */ PreorderTreeWalk(L_child);
    if (R_child != NIL) /* -> */ PreorderTreeWalk(R_child);
}

void InorderTreeWalk(int node_num) {
    int L_child = tree.at(node_num).L_child;
    int R_child = tree.at(node_num).R_child;

    if (L_child != NIL) /* -> */ InorderTreeWalk(L_child);
    std::cout << " " << node_num;
    if (R_child != NIL) /* -> */ InorderTreeWalk(R_child);
}

void PostorderTreeWalk(int node_num) {
    int L_child = tree.at(node_num).L_child;
    int R_child = tree.at(node_num).R_child;

    if (L_child != NIL) /* -> */ PostorderTreeWalk(L_child);
    if (R_child != NIL) /* -> */PostorderTreeWalk(R_child);
    std::cout << " " << node_num;
}

int main() {
    int total;
    std::cin >> total;

    tree.resize(total);
    int node_num, L_child, R_child;
    for (int i=0; i<tree.size(); i++) {
        std::cin >> node_num >> L_child >> R_child;
        SetNodeRelation(node_num, L_child, R_child);
    }

    int root = GetRoot();
    std::cout << "Preorder" << "\n";
    PreorderTreeWalk(root);
    std::cout << "\n";

    std::cout << "Inorder" << "\n";
    InorderTreeWalk(root);
    std::cout << "\n";
    
    std::cout << "Postorder" << "\n";
    PostorderTreeWalk(root);
    std::cout << "\n";

}


Measured memory_bytes: 3112
#include "bits/stdc++.h"
#define ff first
#define ss second
#define szof(_x) ((int) (_x).size())
#define TASK_NAME ""

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 7;
const ll INFL = 1e18 + 123;
const double PI = atan2(0, -1);
mt19937 tw(960172);
ll rnd(ll x, ll y) { static uniform_int_distribution<ll> d; return d(tw) % (y - x + 1) + x; }


void solve() {
	int n;
	ll c;
	cin >> n >> c;

	vector<ll> arr;
	vector<int> cost;
	for (int i = 0; i < n; ++i) {
		ll pos;
		int w;
		cin >> pos >> w;
		arr.push_back(pos);
		cost.push_back(w);
	}

	ll ans = 0;
	for (int q = 0; q < 2; ++q) {
		vector<ll> have = {0};
		ll cur = 0;
		for (int i = n - 1; i >= 0; --i) {
			cur += cost[i];
			have.push_back(max(have.back(), cur - (c - arr[i])));
		}

		reverse(have.begin(), have.end());

		cur = 0;
		ll prev = 0;
		for (int i = 0; i < n; ++i) {
			ans = max(ans, cur - prev);
			ans = max(ans, cur + have[i] - prev * 2);
			cur += cost[i];
			prev = arr[i];
		}

		ans = max(ans, cur - prev);

		reverse(arr.begin(), arr.end());
		reverse(cost.begin(), cost.end());
		for (auto& num : arr) {
			num = c - num;
		}
	}

	cout << ans << "\n";
}


int main() {
	//freopen(TASK_NAME ".in", "r", stdin);
	//freopen(TASK_NAME ".out", "w", stdout);
	cerr << fixed << setprecision(15);
	cout << fixed << setprecision(15);
	ios::sync_with_stdio(false);

	int tests = 1;
	// cin >> tests;
	for (int it = 1; it <= tests; ++it) {
		solve();
	}
	
	#ifdef LOCAL
		cerr << "time: " << clock() << " ms\n";
	#endif
	return 0;
}

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const int N=1e5;
int main()
{
    FASTINOUT;
     int A[32] = {1,
                 1,
                 1,
                 2,
                 1,
                 2,
                 1,
                 5,
                 2,
                 2,
                 1,
                 5,
                 1,
                 2,
                 1,
                 14,
                 1,
                 5,
                 1,
                 5,
                 2,
                 2,
                 1,
                 15,
                 2,
                 2,
                 5,
                 4,
                 1,
                 4,
                 1,
                 51};
    int c;
    cin >> c;
    cout << A[c - 1];
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Pi = pair<int, int>;
constexpr int INF = (1<<30)-1;

bool solve() {
    int N, W, H;

    cin >> N >> W >> H;
    if (N == 0 && W == 0 && H == 0) return (false);

    vector<Pi> pieces;
    pieces.emplace_back(W, H);
    for (int i = 0; i < N; i++) {
        int p, s, w, h;
        cin >> p >> s; --p;
        tie(w, h) = pieces[p];
        pieces.erase(begin(pieces) + p);
        s %= ((w + h) << 1);
        if (s < w || w + h <= s && s < w + w + h) {
            if (s >= w) s -= w + h;
            pieces.emplace_back(min(s, w - s), h);
            pieces.emplace_back(max(s, w - s), h);
        } else {
            s -= w;
            if (s >= w + h) s -= w + h;
            pieces.emplace_back(w, min(s, h - s));
            pieces.emplace_back(w, max(s, h - s));
        }
    }
    vector<int> areas;
    for (auto &d : pieces) {
        areas.push_back(d.first * d.second);
    }

    sort(begin(areas), end(areas));
    for (int i = 0; i < areas.size() - 1; i++) cout << areas[i] << " ";
    cout << areas[areas.size() - 1] << endl;
        
    return (true);
}

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


Measured memory_bytes: 3024
#include<bits/stdc++.h>
#define dbug printf("I am here\n");
#define Fast ios_base::sync_with_stdio(false); cin.tie(0);
#define vs              v.size()
#define sot(v)        sort(v.begin(),v.end())
#define rev(v)        reverse(v.begin(),v.end())
#define ii                pair<int, int>
#define int              long long
#define ull              unsigned long long
#define pb              push_back
#define mpp          make_pair
#define Okay         0
#define pi               3.14159

const int inf = 1e6;
const int cont = 1e18;
using namespace std;

void solve(){
    int n;
    cin>>n;
    if(n == 0)cout<<1;
    else cout<<0;
}

int32_t main() {
   Fast;
//   int tst;
//   cin>>tst;
//   while(tst--)
    solve();
    return Okay;
}



Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

int N, K;

const LL MOD = 998244353LL;

LL dpSpecial[3000][3000][2];

LL memoSpecial(int n, int k, bool used) {
	if (!n)
		return 1LL;
	
	if (k < 1)
		return 0LL;
	
	LL &ret = dpSpecial[n][k][used];
	if (ret != -1)
		return ret;
		
	ret = memoSpecial(n, k - 1, false);
	if (!used)
		ret += 2 * memoSpecial(n - 1, k, true);
	else
		ret += memoSpecial(n - 1, k, true);
	
	ret %= MOD;
	
	return ret;
}

LL dp[3000][3000];

LL memo(int n, int k) {
	if (!n)
		return 1LL;
	
	if (k > K)
		return 0LL;
	
	LL &ret = dp[n][k];
	if (ret != -1)
		return ret;
		
	ret = memo(n, k + 1) + memo(n - 1, k);
	ret %= MOD;
	
	return ret;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> K >> N;
	
	SET(dp, 255);
	SET(dpSpecial, 255);
	vector<LL> ret;
	ffor (i, 2, K + 2) {
		LL sum = 0LL;
		FOR (nn, N + 1) {
			if (i % 2 == 0) {
				LL tmp = memoSpecial(nn, i / 2 - 1, false);
				tmp *= memo(N - nn, i);
				sum += tmp;
				sum %= MOD;
				if (nn) {
					tmp = memoSpecial(nn - 1, i / 2 - 1, false);
					tmp *= memo(N - nn, i);
					sum += tmp;
					sum %= MOD;
				}
			}
			else {
				LL tmp = memoSpecial(nn, i / 2, false);
				tmp *= memo(N - nn, i);
				sum += tmp;
				sum %= MOD;
			}
		}
		ret.pb(sum);
	}
	
	FOR (i, ret.sz)
		cout << ret[i] << endl;
	for (int i = ret.sz - 2; i > -1; i--)
		cout << ret[i] << endl;
	return 0;
}

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

int main(){
	int n, q;
	scanf("%d%d", &n, &q);
	vector<queue<int> > que(n);
	for(int i = 0; i < q; i++) {
		int id, t;
		scanf("%d%d", &id, &t);
		if(id == 0) {
			int x;
			scanf("%d", &x);
			que[t].push(x);
		}
		if(id == 1) {
			if(!que[t].empty())
				printf("%d\n", que[t].front());
		}
		if(id == 2) {
			if(!que[t].empty()) {
				que[t].front();
				que[t].pop();
			}
		}
	}
}



Measured memory_bytes: 4480
#include<iostream>
#include<vector>
#include<cstdlib> // absを使う

using namespace std;

#define yes "Yes"
#define no "No"

// (((ARC089A)))
// Problem https://atcoder.jp/contests/abc086/tasks/arc089_a

bool solver(int pointNumber,vector<int> arTime,vector<int> pointX,vector<int> pointY){
    bool result;
    result=true;
    // for(int j=0;j<=pointNumber;j++){
    //     cout << "Time=" << arTime.at(j) << ",x=" << pointX.at(j) << ",y=" << pointY.at(j) << endl;
    // }
    // 戦略 この移動が出来るためには
    // (条件1)移動時間が2点の移動する長さより多いこと
    // (条件2)移動時間が偶数であれば移動する長さも偶数であること
    //        奇数であれば移動する長さも奇数であること
    for(int j=1;j<=pointNumber;j++){
        int moveTime,moveDist;
        moveTime=arTime.at(j)-arTime.at(j-1);
        moveDist=abs(pointX.at(j)-pointX.at(j-1))+abs(pointY.at(j)-pointY.at(j-1));
        // (条件1を満たしていない)
        if(moveTime<moveDist){
            result=false;
            break;
        }
        // (条件2を満たしていない)
        if((moveTime%2)!=(moveDist%2)){
            result=false;
            break;
        }       
    }
    // 全部の条件を満たせた時だけ 最初のresult=true;をそのまま適応している
    return result;
}

int main(void){
    bool answer;
    answer=true;
    int N;
    cin >> N;
    vector<int> ti(N+1,0);
    vector<int> x(N+1,0);
    vector<int> y(N+1,0);
    for(int j=1;j<=N;j++){
        cin >> ti.at(j) >> x.at(j) >> y.at(j);
    }
    answer = solver(N,ti,x,y);
    if(answer){
        cout << yes << endl;
    }
    else{
        cout << no << endl;
    }
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i)

struct Parser{
    using Iter=string::const_iterator;
    Iter it;
    Parser(Iter it):it(it){}
    void cmp(char expected){
        if(*it!=expected){
            throw 0;
            cerr<<*it<<" is not "<<expected<<endl;
        }
    }

    vector<vector<vector<int>>> sub;

    // LRUD
    string LRUD = "LRUD";
    const int di[4] = {0, 0, 1, -1};
    const int dj[4] = {1, -1, 0, 0};
    int id[128];

    int N;
    int NN;
    void init(int n){
        N = n;
        NN = N * N;
        sub.assign(4, vector<vector<int>>(N, vector<int>(NN)));
        for(int i = 0; i < 4; i++)
            id[LRUD[i]] = i;
        rep(d, 0, 4) {
            rep(k,0,n){
                rep(i, 0, n)rep(j,0,n){
                    if((d<2&&i==k)||(d>=2&&j==k)){
                        int ni = (i + di[d] + n) % n, nj = (j + dj[d] + n) % n;
                        sub[d][k][i*n+j]=ni*n+nj;
                   }else
                        sub[d][k][i*n+j]=i*n+j;
                }
            }
        }
    }

    vector<int> mul(const vector<int> &a, const vector<int> &b) {
        vector<int> r(NN);
        rep(i,0,NN){
            r[i] = a[b[i]];
        }
        return r;
    }

    vector<int> seq(){
        vector<int> v(NN);
        iota(v.begin(),v.end(),0);
        while(*it!='$' && *it!=')'){
            if(*it=='('){
                it++;
                vector<int> res = seq();
                it++;
                int num=integer();
                //行列累乗
                vector<int> a = res;
                vector<int> r(NN); iota(r.begin(), r.end(), 0);
                while(num) {
                    if(num&1)r=mul(r,a);
                    a=mul(a,a);
                    num>>=1;
                }
                v=mul(v,r);
            }else{
                char shift=*it;
                it++;
                int num=integer()-1;
                v=mul(v,sub[id[shift]][num]);
            }
        }
        return v;
    }
    int integer(){
        int ret=0;
        while(isdigit(*it)){
            ret*=10;
            ret+=*it-'0';
            it++;
        }
        return ret;
    }
};

signed main(){
    int N, L; cin>>N>>L;
    string S;cin>>S;S+="$";
    Parser p(S.begin());
    p.init(N);
    vector<int> res = p.seq();
    rep(i,0,N) {
        rep(j,0,N){
            if(j!=0)cout<<" ";
            cout<<res[i*N+j]+1;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 31724
Sprime = input()
T = input()

if len(T) > len(Sprime):
    print('UNRESTORABLE')
else:
    ans = -1
    for i in range(len(Sprime)-len(T)+1):
        for j in range(len(T)):
            if Sprime[i:i+len(T)][j] != '?' and\
            Sprime[i:i+len(T)][j] != T[j]:
                break
        else:
            ans = max(i,ans)
    if ans == -1:
        print('UNRESTORABLE')
    else:
        Sprime = list(Sprime)
        Sprime[ans:ans+len(T)] = T
        Sprime = ''.join(Sprime)
        print(Sprime.replace('?','a'))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
int N;
vector<int> vec;
ll dfs(int i, int x){
    if(i == N){
        if(x == 75)return 1;
        else return 0;
    }
    if(x > 75)return 0;
    ll res = 0;
    rep(j,0,vec[i]+1){
        res += dfs(i+1, x * (j+1));
    }
    return res;
}
main(){
    
    cin >> N;
    vec.resize(N+1);
    rep(i,1,N+1){
        int m = i;
        rep(j,2,i+1)while(m % j == 0){
            m /= j;
            vec[j]++;
        }
    }
    cout << dfs(0, 1) << endl;
}

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

is_tkhs = True
for _ in range(100000):
  if is_tkhs:
    C -= B
  else:
    A -= D
    
  is_tkhs = not (is_tkhs)
    
  if C <= 0 or A <= 0:
    break
      
print('No' if A <= 0 else 'Yes')

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

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

  vector<string> s(2);
  rep(i, 2) cin >> s[i];

  const ll mod = 1000000007;
  ll ans = 3;

  rep(i, n - 1) {
    // s0s2
    // s1s3
    vector<char> ss = {s[0][i], s[1][i], s[0][i + 1], s[1][i + 1]};

    if (ss[0] == ss[1] && ss[2] == ss[3]) {
      // ab
      // ab
      ans *= 2;
      ans %= mod;
    } else if (ss[0] == ss[1] && ss[2] != ss[3]) {
      // ab
      // ac
      ans *= 2;
      ans %= mod;
    } else if (ss[0] != ss[1] && ss[2] != ss[3] && ss[0] != ss[2]) {
      // ac
      // bd
      ans *= 3;
      ans %= mod;
    } else {
      if (i == 0) {
        ans *= 2;
        ans %= mod;
      }
      // aa    ac
      // bb or bc
      // skip
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3588
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoderBS
{
    class Program
    {
        static void Main(string[] args)
        {
            // input
            long[] nm = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            long n = nm[0];
            long m = nm[1];

            // Solve,Output
            if (n == 1 && m == 1)
            {
                Console.Write(1);
            }
            else if (n == 1 || m == 1)
            {
                Console.Write(n * m - 2);
            }
            else
            {
                Console.Write((n - 2) * (m - 2));
            }
            Console.Read();
        }
    }
}


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

typedef long long ll;

ll m;

ll f(ll x) { return x*x%m; }

int main()
{
	ll n, x;
	scanf("%lld%lld%lld", &n, &x, &m);
	ll t = f(x), h = f(f(x));
	while (t != h) t = f(t), h = f(f(h));
	ll m = 0, l = 1;
	for (h = x; h != t; h = f(h), t = f(t), ++m);
	for (h = f(h); h != t; h = f(h), ++l);
	if (n <= m) {
		ll ans = x;
		while (--n) x = f(x), ans += x;
		printf("%lld\n", ans);
	}
	else {
		ll ans = 0, loop = 0;
		while (m--) ans += x, x = f(x), --n;
		for (int i = l; i > 0; --i) loop += x, x = f(x);
		for (int k = n%l; k--; ans += x, x = f(x));
		printf("%lld\n", ans+loop*(n/l));
	}
}

Measured memory_bytes: 3800
n,m=map(int,input().split())
l=[int(i) for i in input().split()]
ans=t=0
d={0:1}
for i in l:
    t=(t+i)%m
    if t in d: d[t]+=1
    else: d[t]=1
for i in d:
    ans+=d[i]*(d[i]-1)
print(ans//2)


Measured memory_bytes: 62576
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t x, a, b;
  cin >> x;
  a=x/11;
  b=x%11;
  if(b==0)
    cout << 2*a;
  else if(b<7)
    cout << 1+2*a;
  else
    cout << 2+2*a;
  return 0;
}

Measured memory_bytes: 3632
n,k = map(int,input().split())
mod = 10**9+7
ans = 0
m = {}
for i in range(k,0,-1):
  chk = pow(k//i,n,mod)
  t = k//i
  if t > 1:
    for j in range(2,t+1):
      chk -= m[i*j]
  m[i] = chk%mod
  ans += chk*i%mod
  ans %= mod
print(ans)

Measured memory_bytes: 20632
#include <bits/stdc++.h>
using namespace std;
int main(){
	int p, q, r;
	scanf("%d%d%d", &p, &q, &r);
	int ans=100000000;
	ans=min(ans, p+q);
	ans=min(ans, q+r);
	ans=min(ans, r+p);
	printf("%d\n", ans);
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }


signed main()
{
	int K;
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	cin >> K;

	for (int i = 0; i < K; i++)
	{
		ARY_SORT(a, 3);
		a[2] *= 2;
	}

	cout << (a[0] + a[1] + a[2]) << endl;
}



Measured memory_bytes: 3160
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;	
	bool flag = false;
    for(int i=x;i>=0;i--)
    {
		if(y==(x-i)*2+i*4)
		{
			cout<<"Yes";
			flag = true;
			break;
		}
	}
	if(flag==false)
	{
		cout<<"No";
	}
}

Measured memory_bytes: 3648
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
from functools import reduce
import sys
import math
import bisect
import random
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return list(map(float, sys.stdin.readline().split()))
def LS():return sys.stdin.readline().split()
def SR(n): return [list(sys.stdin.readline())[:-1] for i in range(n)]
def IR(n): return [int(sys.stdin.readline()) for i in range(n)]
def LIR(n): return [list(map(int, sys.stdin.readline().split())) for i in range(n)]
def LSR(n): return [list(map(list, sys.stdin.readline().split())) for i in range(n)]
_gcd = lambda x, y: _gcd(y, x%y) if (x%y) else y
_lcm = lambda x, y: x*y // _gcd(x, y)
def gcd(*numbers):
    return reduce(_gcd, numbers)
def lcm(*numbers):
    return reduce(_lcm, numbers)
sys.setrecursionlimit(1000000)
INF = float('inf')
mod = 1000000007
dire4 = [(1,0), (0,1), (-1,0), (0,-1)]
dire8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]


A, B = LI()

print(max(A+B, A-B, A*B))

Measured memory_bytes: 39408
// ConsoleApplication1.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int main()
{
    
    int A, B;
    cin >> A >> B;
    double Mean;
    
    Mean = (A + B) * 0.5;

    int Ans;
    int MeanCut = int(Mean);
    if (MeanCut == Mean) {
        Ans = MeanCut;
    }
    else {
        Ans = MeanCut + 1;
    }

    cout << Ans;
    return 0;

}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
#include<ctime>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#define file(x)freopen(x".in","r",stdin);freopen(x".out","w",stdout)
#define rt register int
#define l putchar('\n')
#define ll long long
#define r read()
using namespace std;
inline ll read(){
    ll x=0;char zf=1;char ch=getchar();
    while(ch!='-'&&!isdigit(ch))ch=getchar();
    if(ch=='-')zf=-1,ch=getchar();
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();return x*zf;
}
void write(ll y){if(y<0)putchar('-'),y=-y;if(y>9)write(y/10);putchar(y%10+48);}
void writeln(const ll y){write(y);putchar('\n');}
int k,m,n,x,y,z,cnt,ans;
char c[2000010];
void win(){
	puts("Yes");exit(0);
}
void lose(){
	puts("No");exit(0);
}
int main(){
	n=r;int A=r,B=r,C=r,D=r;
	scanf("%s",c+1);
	for(rt i=1;i<n;i++)if(c[i]=='#'&&c[i+1]=='#'&&((i>A&&i<C)||(i>B&&i<D)))lose();
	if(C>D){
		for(rt i=B;i<=D;i++)if(c[i-1]=='.'&&c[i]=='.'&&c[i+1]=='.'&&i-1>=1&&i+1<=n)
		win();lose();
	}
	win();
	return 0;
}


Measured memory_bytes: 384
n = int(input())
arr = list(map(int, input().split()))
res, i = 0, 0
while i < n:
    j = i
    while j < n-1 and arr[j]>=arr[j+1]:
        j += 1
    res = max(res, j-i)
    i = j+1
print(res)

Measured memory_bytes: 63984
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int MOD = 1e9+7;
using ll = long long;
using vi = vector<int>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(x) x.begin(), x.end();
int main() {
  int a,b;
  cin >> a >> b;
  int c,MIN = 1000000;
  rep(i,a){
    cin >> c;
    b-=c;
    MIN = min(MIN,c);
  }
  cout << a + b/MIN;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

//a,b x
int main(){
	ll N,W; cin>>N>>W;
	vector<P> p(N);
	ll X[4]={1,0,0,0};

	ll A,B; cin>>A>>B;
	p[0]=mp(A,B);
	ll w1=p[0].a;
	for(int i=1;i<N;i++){
		ll A,B; cin>>A>>B;
		if(A==w1) X[0]++;
		else if(A==w1+1) X[1]++;
		else if(A==w1+2) X[2]++;
		else X[3]++;

		p[i]=mp(A,B);
	}
	sort(p.bg,p.ed);

	ll ans=0;
	for(int i=0;i<=X[0];i++){
		for(int j=0;j<=X[1];j++){
			for(int k=0;k<=X[2];k++){
				for(int l=0;l<=X[3];l++){
					//重量オーバーについて
					if(w1*i+(w1+1)*j+(w1+2)*k+(w1+3)*l<=W){
						ll value=0;
						for(int q=X[0]-1;q>=X[0]-i;q--) value+=p[q].b;
						for(int w=X[0]+X[1]-1;w>=X[0]+X[1]-j;w--) value+=p[w].b;
						for(int e=X[0]+X[1]+X[2]-1;e>=X[0]+X[1]+X[2]-k;e--) value+=p[e].b;
						for(int r=X[0]+X[1]+X[2]+X[3]-1;r>=X[0]+X[1]+X[2]+X[3]-l;r--) value+=p[r].b;

						ans=max(ans,value);
					}
				}
			}
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;
const double pi = acos(-1);

int main(){
    fastcin();
    cout << decimal;
    double a, b, x;
    cin >> a >> b >> x;
    x /= a;
    if(x*2 == a*b){
        cout << atan2(a, b)*180./pi << endl;
    }else if(x < a*b/2.){
        double h = 2.*x/b;
        // cout << h << endl;
        cout << atan2(b, h)*180./pi << endl;
    }else{
        x = a*b - x;
        double h = 2.*x/a;
        // cout << h << endl;
        cout << atan2(h, a)*180./pi << endl;
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    string s,t;
    cin >> s >> t;
    string a(s.size(),'\0');
    rep(j,s.size()){
        rep(i,s.size()-1){
            a[i+1]=s[i];
        }
        a[0]=s[s.size()-1];
        s=a;
    //    cout << a << endl;
        if(s==t){
            cout << "Yes" << endl;
            return 0;
        } 
    }
    cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
x = input().split(" ")
for i in range(n):
	x[i] = int(x[i])
b = 1000000
for i in range(1, 101):
	t = 0
	for j in range(n):
		t = t + (i - x[j]) * (i - x[j])
	if t < b:
		b = t
print(b)

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

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

int v[100010];
int counter[2][100010];


signed main()
{
    int n; cin >> n;
    rep(i, n) cin >> v[i], counter[i%2][v[i]]++;
    
    vector<pair<int, int>> p[2];
    rep(i, 2) {
        rep1(j, 100000) {
            p[i].push_back(pair<int, int>(n / 2 - counter[i][j], j));
        }
    }
    rep(i, 2)
        sort(begin(p[i]), end(p[i]));

    int ans = 1e9;

    rep(i, 2) rep(j, 2) {
        if (p[0][i].second != p[1][j].second) {
            ans = min(ans, p[0][i].first + p[1][j].first);
        }
    }

    cout << ans << endl;
}


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

int main(){
  string s;
  cin >> s;
  
  int index_A, index_Z;
  for(int i = 0; i < s.size(); i++){
    if(s.at(i) == 'A'){
      index_A = i;
      break;
    }
  }
  for(int i = s.size() -1; i >= 0; i--){
    if(s.at(i) == 'Z'){
      index_Z = i;
      break;
    }
  }
  cout << index_Z - index_A + 1 << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#define ALLRANGE(x) x.begin(), x.end()
#define REPF(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
  int x, t;
  cin >> x >> t;
  cout << (x-t>=0 ? x-t: 0) << endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N = int(input())
A = list(map(int, input().split()))

# どこで反転するかを記録する
pre = [0] * N
pre_index = 0
old_a = A[0]
if A[0] > A[1]:
    old_coef = -1
elif A[0] < A[1]:
    old_coef = 1
else:
    old_coef = 0

for i in range(1, N):
    if A[i] > old_a:
        coef = 1
    elif A[i] < old_a:
        coef = -1
    else:
        coef = 0
    if coef != 0 and coef != old_coef:
        for j in range(pre_index, i):
            pre[j] = i - 1
        pre_index = i
        old_coef = coef
    old_a = A[i]
for j in range(pre_index, N):
    pre[j] = N - 1
# print("pre: {}".format(pre))

shojikin = 1000
stock = 0
if A[0] < A[pre[0]]:
    q, mod = divmod(shojikin, A[0])
    stock += q
    shojikin = mod
elif pre[0] == N - 1:
    # 何もしないほうが良い場合
    print('1000')
    quit()

# print("1st shojikin: {} stock: {}".format(shojikin, stock))

pre = list(set(pre))
pre.sort()
# print("sorted: {}".format(pre))
for deal_index in pre:
    if stock:
        shojikin += stock * A[deal_index]
        stock = 0
        # print("uri deal: {} shojikin: {} stock: {}".format(deal_index, shojikin, stock))
    else:
        q, mod = divmod(shojikin, A[deal_index])
        stock += q
        shojikin = mod
        # print("kai deal: {} shojikin: {} stock: {}".format(deal_index, shojikin, stock))
# 下がり続けた場合は払い戻し
if stock:
    shojikin += stock * A[deal_index]
    stock = 0
print(shojikin)

Measured memory_bytes: 9304
N = int(input())
AB = [list(map(int,input().split())) for _ in [0]*(N-1)]

def dist_bfs(N,E,start):
    d = [-1]*N
    d[start] = 0
    q = [start]
    while q:
        qq = []
        for i in q:
            di = d[i]
            for j in E[i]:
                if d[j]!=-1:continue
                d[j] = di+1
                q.append(j)
        q = qq
    return d

E = [[] for _ in [0]*N]
for a,b in AB:
    a -= 1
    b -= 1
    E[a].append(b)
    E[b].append(a)


D = dist_bfs(N,E,0)

e = []
o = []
cnt = 0
for i,d in enumerate(D):
    if d%2==0:
        e.append(i)
        cnt += 1
    else:
        o.append(i)
if cnt > N-cnt:
    e,o = o,e
    cnt = N-cnt
ans = [0]*N
if cnt <= N//3:
    done = set()
    j = 3
    for i in e:
        ans[i] = j
        done.add(j)
        j += 3
    j = 1
    for i in o:
        ans[i] = j
        j += 1
        while j in done:
            j += 1
else:
    done = set()
    j = 1
    for i in e:
        ans[i] = j
        done.add(j)
        j += 3
        if j > N: j = 3
    j = 2
    for i in o:
        ans[i] = j
        j += 1
        while j in done:
            j += 1
print(*ans)

Measured memory_bytes: 109116
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<signed(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 20000000000;
struct edge {int to,cost;};
#define VMAX 51
typedef std::pair<int,int> P;

    string S,T,A;
    int pos=-1;
    ll ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>S>>T;
    REP(i,S.size()-T.size()+1){
        REP(j,T.size()){
            if(S[i+j]!='?'){
                if(S[i+j]!=T[j])break;
            }
            if(j==T.size()-1){pos=i;}
        }
    }
    if(pos==-1)cout<<"UNRESTORABLE";
    else{
        REP(i,S.size()){
            if(S[i]!='?')cout<<S[i];
            else{
                if(pos<=i&&i<pos+T.size()){
                    cout<<T[i-pos];
                }else cout<<"a";
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
/*input

*/

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <math.h>
#include <iomanip>
#include <utility>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;
using ll = long long;
using ld = long double;

ll MOD = 1000000007;
const int SINF = 1000000009;
const ll INF =  1000000000000000018;

#define sp          cout << " "
#define nl          cout << "\n"
#define inv(a)      powr((a), (MOD - 2))
#define all(c)      (c).begin(),(c).end()
#define rep(i,a,b)  for(ll i = (a); i < (b); i ++)
#define prec(n)     cout << fixed << setprecision(n)
#define PI          3.14159265358979323846264338327951
#define ifalse      ios_base::sync_with_stdio(false), cin.tie(NULL)

template<typename T> void toInt(string s, T &a) { istringstream(s) >> a; }
ll gcd(ll a, ll b) { ll t; while(a) { t = a; a = b%a; b = t; } return b; }
ll sub(ll a, ll b) { a -= b; a = (a + MOD) % MOD; return a; }
ll mul(ll a, ll b) { return ((a % MOD) * (b % MOD)) % MOD; }
ll add(ll a, ll b) { a += b; a %= MOD; return a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }

ll powr(ll a, ll b) {
  ll x = 1LL;
  while(b) {
    if(b & 1) x = mul(x, a);
    a = mul(a, a), b >>= 1;
  }
  return x;
}

bool check(ll n)
{
  if(n == 1) return 0;
  if(n == 2 or n == 3) return 1;
  if(n%2 == 0 or n%3 == 0) return 0;
  for(ll i = 5; i*i <= n; i += 6) if(n%i == 0 or n % (i+2) == 0) return 0;
  return 1;
}

/*********************************START**********************************/
const int N = 100005;

int main()
{
  ifalse;
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  if(s[k - 1] == 'A') {
    s[k - 1] = 'a';
  }
  else if(s[k - 1] == 'B') {
    s[k - 1] = 'b';
  }
  else if(s[k - 1] == 'C') {
    s[k - 1] = 'c';
  }
  cout << s;
  return 0;
}

Measured memory_bytes: 256