akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    vector<int> cnt(n);
    rep(i,0,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        cnt[a]++;
        cnt[b]++;
    }
    rep(i,0,n){
        if(cnt[i]%2==1){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
}


Measured memory_bytes: 640
N = int(input())
S = input()

R = []
G = []
B = []
ans = 0
for i in range(len(S)):
    if S[i] == "R":
        R.append(i)
    if S[i] == "G":
        G.append(i)
    if S[i] == "B":
        B.append(i)
rem = 0
setB = set(B)

for r in R:
    for g in G:
        if g - abs(r - g) in setB:
            rem += 1
        if r - abs(g - r) in setB:
            rem += 1
        if (g + r) / 2 in setB:
            rem += 1
        if g + abs(r - g) in setB:
            rem += 1
        if r + abs(g - r) in setB:
            rem += 1


print(len(R)*len(G)*len(B) - rem)


Measured memory_bytes: 69276
#pragma GCC optimize("Ofast")
#include <map>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)	
using namespace std;
int len,ans;
string s1,s2,s3;
int main()
{
    fast; 
    cin>>len>>s1>>s2>>s3;
    for (int i=0;i<=len-1;i++)
    {
    	if (s1[i]!=s2[i] && s1[i]!=s3[i] && s2[i]!=s3[i])
    	   ans+=2;
    	else if (s1[i]==s2[i] && s1[i]!=s3[i] || s1[i]==s3[i] && s1[i]!=s2[i] || s2[i]==s3[i] && s2[i]!=s1[i])
    	   ans+=1;
    }
    cout<<ans<<endl;
	return 0;
}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

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

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int s,w;
    cin>>s>>w;

    //cout <<fixed<<setprecision(16)<< << endl;

    if(w >= s)cout << "unsafe" <<endl;
    else cout << "safe" <<endl;

    return 0;
}


Measured memory_bytes: 3636
import math
import sys

N = int(input())

m = int(math.sqrt(N))
while m*(m+1) < 2*N:
	m += 1
	
list = [m]
sum = m
for n0 in range(m-1):
	n = m-1 -n0
	if sum == N:
		for num in list:
			print(num)
		sys.exit()
	elif sum + n == N:
		list.append(n)
		for num in list:
			print(num)
		sys.exit()
	elif sum + n < N:
		list.append(n)
		sum += n
if m == 1:
	print(1)

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define m 1000000007
using namespace std;
void add_mod(int& a,int b){
    a+=b;
    if(a>m)
        a-=m;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<vector<int>> a(n,vector<int>(n));
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            cin>>a[i][j];
    vector<int> dp(1<<n);
    dp[0] = 1;
    for(int mask = 0;mask<(1<<n)-1;mask++){
        int i = __builtin_popcount(mask);
        for(int j=0;j<n;j++){
            if(a[i][j]&&!(mask&(1<<j))){
                int temp = mask^(1<<j);
                add_mod(dp[temp],dp[mask]);
            }
        }
    }
    cout<<dp[(1<<n)-1]<<"\n";
    return 0;
}

Measured memory_bytes: 8448
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> a = new ArrayList<>();
        List<Integer> b = new ArrayList<>();
        List<Integer> c = new ArrayList<>();
        for (int i = 0; i < n; ++i) a.add(sc.nextInt());
        for (int i = 0; i < n; ++i) b.add(sc.nextInt());
        for (int i = 0; i < n; ++i) c.add(sc.nextInt());
        Collections.sort(a);
        Collections.sort(c);

        long res = 0;
        for (int i = 0; i < n; ++i) {
            int key = b.get(i);

            int ng = -1;
            int ok = n;
            while (ok - ng > 1) {
                int mid = (ok + ng) / 2;
                if (key <= a.get(mid)) ok = mid;
                else ng = mid;
            }
            long tmpA = ok;

            ng = -1;
            ok = n;
            while (ok - ng > 1) {
                int mid = (ok + ng) / 2;
                if (key < c.get(mid)) ok = mid;
                else ng = mid;
            }
            long tmpC = n - ok;
            res += tmpA * tmpC;
        }

        System.out.println(res);
    }
}

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

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    vector<pair<int,int>> vect;
    for(int i=0;i<n;i++){
        vect.push_back(make_pair(a[i],i+1));

    }
    sort(vect.begin(),vect.end());
    for(int i=0;i<n;i++){
        cout<<vect[i].second<<" ";
    }
    
}

Measured memory_bytes: 2164
N = int(input())
A = list(map(int, input().split()))


def comb2(n):
    return n * (n - 1) // 2


counts = [0] * (N + 1)
for a in A:
    counts[a] += 1
total = sum(map(lambda n: comb2(n), filter(lambda n: n > 1, counts)))

for a in A:
    print(total - (counts[a] - 1))


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

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

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

int main()
{
  string s;
  cin >> s;
  stack<char> st;
  for(auto c : s) {
    if(c == 'B') {
      if(!st.empty()) st.pop();
    }
    else st.push(c);
  }
  string ans = "";
  while(!st.empty()) {
    ans = st.top() + ans; st.pop();
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
char s[105],ans[105];
int main()
{
	cin>>s;
	int len=strlen(s),tot=0;
	for(int i=0;i<len;i++)
	{
		if(s[i]=='0')	ans[++tot]='0';
		if(s[i]=='B'&&tot>0)	tot--;
		if(s[i]=='1')	ans[++tot]='1';
	}
	for(int i=1;i<=tot;i++)
	{
		cout<<ans[i];
	}
	return 0;
}

Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const X = parseInt(arg[0].split(" ")[1]);
    
    const Ls = arg[1].split(" ").map(n=>parseInt(n));
    
    let list = [];
    
    for(let i=0; i<=N; i++) {
        if(i == 0) {
            list.push(0);
        } else {
            let temp = list[i-1] + Ls[i-1];
            list.push(temp);
        }
    
    }

    console.log(list.filter(n=>n<=X).length)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0; i<(n); ++i)
#define rep1(i,n) for(ll i=1; i<=(n); ++i)
#define repi(i,a,b) for(ll i=a; i<=(b); ++i)
#define rrep(i,n) for(ll i=(n-1); i>=0; --i)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define print(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
using Edge = pair<ll,ll>;
using Graph = vector<vector<Edge>>;
typedef pair<ll,ll> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
ll MOD = 1e9 + 7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll devc(ll x, ll y){return 1 + (x-1)/y;}
ll modpow(ll x, ll y, ll m) {
    if (y == 0) return 1;
    ll res = modpow(x, y / 2, m);
    return res * res % m * (y & 1 ? x : 1) % m;
}
ll modinv(ll x) { return modpow(x, MOD - 2, MOD); }

int main(){
    string N; ll K; cin >> N >> K;
    
    vector<ll> n; 
    for(auto s : N) n.pb(s-'0');
    ll l = sz(n);
    ll dp[150][2][5];
    
    dp[0][0][0] = 1;
    
    for(int i = 0; i < l; i++){
        for(int smaller = 0; smaller < 2; smaller++){
            for(int j = 0; j <= 4; j++){
                for(int x = 0; x <= (smaller ? 9 : n[i]); x++){
                    dp[i + 1][smaller || x < n[i]][min(j + (x != 0), 4)] += dp[i][smaller][j];
                }
            }
        }
    }
    
    print(dp[l][0][K] + dp[l][1][K]);
    return 0;
}

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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

const int N = 1000006;
bool isp[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int x;
    cin >> x;
    isp[0] = isp[1] = true;
    for (int i = 2; i * i < N; i++) {
		if (isp[i] == false) {
			for (int j = i * i; j < N; j += i) {
				isp[j] = true;
			}
		}
	}
	for (; x < N; x++) {
		if (!isp[x]) {
			break;
		}
	}
	cout << x;
    return 0;
}


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


#define M 1000000007
#define pb push_back
#define mp make_pair
#define s second
#define f first
#define mod 998244353
#define sz(v) (int)(v).size()

#define pii pair<int, int>
#define vi vector<int>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)

ll add(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a+b)%M;
	return (p+M)%M;
}

ll mul(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a*b)%M;
	return (p+M)%M;
}


int main()
{
	fastio;
	ll k,i,j,n;
	cin>>n;
	ll ans=0;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			for(k=1;k<=n;k++)
				ans+=__gcd(i,__gcd(j,k));
		}
	}
	cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=2005, P=1000000007;
int f[N][N], fac[N*N], ifac[N*N];

int C(int n, int m){return fac[n]*ifac[m]%P*ifac[n-m]%P;}
int Pow(int x, int t)
{
	int res=1;
	while (t) {if (t&1) res=res*x%P; x=x*x%P; t>>=1;}
	return res;
}

signed main()
{
	int n, k; scanf("%d%d", &n, &k);
	if (k==1) {puts("1"); return 0;}
	f[0][0]=fac[0]=1; 
	for (int i=1; i<=4e6; i++) fac[i]=fac[i-1]*i%P; 
	ifac[(int)4e6]=Pow(fac[(int)4e6], P-2);
	for (int i=4e6-1; ~i; i--) ifac[i]=ifac[i+1]*(i+1)%P;
	for (int i=1; i<=n; i++)
		for (int j=0; j<=i; j++)
			f[i][j]=f[i-1][j]+(j!=0)*
				(f[i][j-1]*(n-j+1)%P*C(n*k-i-(j-1)*(k-1)-1, k-2)%P)%P;
	printf("%d\n", f[n][n]);
	return 0;
}


Measured memory_bytes: 94464
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <numeric>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600
#define long long long

bool check(int n){
  if(n<10) return true;
  int d = n%10;
  n/=10;
  while(n>0){
    if(d-1 != n%10) return false;
    d = n%10;
    n/=10;
  }
  return true;
}

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

  int res=-1;
  rep(i,n) repl(j,i+1,n){
    int m = vec[i]*vec[j];
    if(check(m)){
      res = max(res, m);
    }
  }
  cout << res << endl;

  return 0;
}

Measured memory_bytes: 3088
n, m = map(int, input().split())

k = m
f = set()
for i in range(1, int(m ** 0.5) + 2):
    d, e = divmod(m, i)
    if e == 0:
        f.add(i)
        f.add(m // i)
ppp = sorted(f)
for p in ppp:
    if p >= n:
        print(m // p)
        break
else:
    print(1)


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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define int long long int
#define maxn 100
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

typedef std::pair<int, int> P;

int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

int lcm(int a, int b) { return a / gcd(a, b) * b; }

int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0) {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x) //bit計算
{
    if (x == 0)
        return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void) {
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++) {
        if (!prime[i]) {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i) {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num) //素数判定
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }

    return true;
}

vector<int> divisor(int n) //約数列挙
{
    vector<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i - 1);
            if (i * i != n) {
                ret.push_back((n / i) - 1);
            }
        }
    }
    sort(ret.begin(), ret.end());
    return (ret);
}

signed main() {
    int N;
    cin >> N;
    cout << N / 2 + N % 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map> // pair
using namespace std;
int main(){
  vector<int> A(5);
  int min_num=130;
  int min_ind=0;
  for(int i=0;i<5;i++){
      cin>>A.at(i);
      if(min_num>A.at(i)%10&&A.at(i)%10!=0){
        min_num=A.at(i)%10;
        min_ind=i;
      }
  }
  int time=0;
  for(int i=0;i<5;i++){
    int add_time;
    if(A.at(i)%10==0)add_time=A.at(i);
    else add_time=10*(A.at(i)/10)+10;
    if(i!=min_ind)time+=add_time;
  }
  time+=A.at(min_ind);
  cout<<time<<endl;
  }


Measured memory_bytes: 256
import sys
s = []

for i in range(int(input())):
    W = input()
    if W in s:
        print("No")
        sys.exit()
    if len(s) != 0 and s[-1][-1] != W[0]:
        print("No")
        sys.exit()
    s.append(W)
print("Yes")

Measured memory_bytes: 9044
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<functional>
#include<ctime>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>

using namespace std;

#define rep(i,a,b) for(unsigned (i)=(a);(i)<(b);(i)++)
#define ull unsigned long long
#define sharp '#'
#define ZERO 'a'
#define ZET 'z'
#define ALPHA_NUM 26

string correct;
vector<string> answer;
bool flag[ALPHA_NUM+1];


void func(const char* str, unsigned pt){
	string test = string(str);
	if (pt == correct.length()){
		answer.push_back(test);
		return;
	}
	if (flag[correct[pt] - ZERO]){
		string tmp = test + correct[pt];
		func(tmp.c_str(), pt + 1);
	}
	if (!flag[correct[pt] - ZERO + 1]){
		string tmp = test + (++correct[pt]);
		--correct[pt];
		flag[correct[pt] - ZERO + 1] = true;
		func(tmp.c_str(), pt + 1);
		flag[correct[pt] - ZERO + 1] = false;
	}
}

int main(void){
	flag[0] = flag[ALPHA_NUM] = true;
	while (true){
		cin >> correct;
		if (correct[0] == sharp)return(0);
		answer.clear();
		rep(i, 1, ALPHA_NUM)flag[i] = false;
		func("", 0);
		cout << answer.size() << endl;
		if (answer.size() <= 10)rep(i, 0, answer.size())cout << answer[i] << endl;
		else{
			rep(i, 0, 5)cout << answer[i] << endl;
			rep(i, answer.size() - 5, answer.size())cout << answer[i] << endl;
		}
	}
	return(0);



}

Measured memory_bytes: 2344
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
int main(void) {
  int x, a, b;
  cin>>x>>a>>b;
  if(x+a-b>=0) {
    if(a-b>=0) {
      cout<<"delicious"<<endl;
    } else {
      cout<<"safe"<<endl;
    }
  } else {
    cout<<"dangerous"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    string s;
    cin >> s;
    rep(i,s.size()-8){
        cout << s.at(i);
    }
    cout << endl;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
string s;
int main(){
  cin>>s;ll l=-1; ll r=-1;
  ll N=s.size();vector<ll>a(N);
  for(ll i=0;i<26;i++){
    char c='a'+i;
  for(ll j=0;j<N;j++)
    if(s[j]==c)
     a[j]=1;
    else
      a[j]=0;
    for(ll j=0;j<N-1;j++)
      if(a[j]==1 && a[j+1]==1){l=j+1;r=j+2;break;}
    for(ll j=0;j<N-2;j++)
      if(a[j]==1 && a[j+2]==1){l=j+1;r=j+3;break;}
    if(l!=-1)break;
  }cout<<l<<" "<<r<<endl;
  return 0;
}

Measured memory_bytes: 4296
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
        int h, a;
        cin >> h >> a;

        cout << (h + a - 1) / a << endl;

        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {

    string s;
    int Q;
    cin >> s;
    cin >> Q;
    bool ish = true;
    int mode, mode1;
    char c;
    string f = "";
    string b = ""; 
    REP(i, Q){
        cin >> mode;
        if (mode==1) ish ^= true;
        else {
            cin >> mode1;
            cin >> c;
            if ((mode1 == 1) ^ !ish) f += c;
            else b += c;
        }
    }
    reverse(f.begin(), f.end());
    s = f + s + b;
    if (!ish) reverse(s.begin(), s.end());
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 1348
from collections import Counter

N = int(input())
counter = [Counter(input()) for _ in range(N)]

c = counter[0]
for i in range(1, N):
  for k, v in c.items():
    c[k] = min(counter[i][k], c[k])

c = sorted(c.items())
ans = ""
for k, v in c:
  ans += k * v
print(ans)

Measured memory_bytes: 3316
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a = sc.nextInt();
    long b = sc.nextInt();
    long c = sc.nextInt();
    long d = sc.nextInt();

    BigInteger ac = BigInteger.valueOf(a * c);
    BigInteger ad = BigInteger.valueOf(a * d);
    BigInteger bc = BigInteger.valueOf(b * c);
    BigInteger bd = BigInteger.valueOf(b * d);

    System.out.println(ac.max(ad).max(bc).max(bd));
  }
}


Measured memory_bytes: 27244
module Main where

import           Control.Monad
import           Debug.Trace
import qualified Data.Vector.Unboxed           as VU
import           Data.List
import qualified Data.ByteString               as BS
import qualified Data.ByteString.Char8         as BSC8
import           Data.Char
import           Data.Maybe

tuplify2 (x : y : _) = (x, y)
tuplify2 _           = undefined

getVUIntFromInputLineAtBSC8 :: IO (VU.Vector Int)
getVUIntFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
getVUIntListFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine

readInt = fst . fromJust . BSC8.readInt
readIntTuple = tuplify2 . map readInt . BSC8.words
readIntList = map readInt . BSC8.words

getInt = readInt <$> BSC8.getLine
getIntList = readIntList <$> BSC8.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BSC8.getLine
getIntMatrix = map readIntList . BSC8.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BSC8.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BSC8.getLine
getIntTuples = map readIntTuple . BSC8.lines <$> BSC8.getContents

main :: IO [()]
main = do
    [aN, aK] <- getIntList
    aNumList <- getIntList
    let numList = foldl (\acc x -> delete x acc) [0 .. 9] aNumList
    let minDigit =
            foldl (\acc x -> if (10 ^ x - 1) < aN then succ acc else acc)
                  0
                  [0 .. 4]
                - 1
    let digitList = (reverse [0 .. minDigit])
    let priceList = foldl
            (\acc x -> acc ++ [div (mod aN (10 ^ (x + 1))) (10 ^ x)])
            []
            digitList
    let ret = getListOfSpecialPrice priceList numList
    mapM (putStr . show) ret

getListOfSpecialPrice :: [Int] -> [Int] -> [Int]
getListOfSpecialPrice []                 numList = []
getListOfSpecialPrice priceList@(x : xs) numList = if elem x numList
    then [x] ++ getListOfSpecialPrice xs numList
    else 
        let better = (filter (\y -> y > x) numList)
        in if better == [] 
            then getMin (reverse [0 .. length xs + 1]) numList
            else [head (filter (\y -> y > x) numList)] ++ (getMin (reverse [0 .. length xs - 1]) numList)



getMin :: [Int] -> [Int] -> [Int]
getMin digitList numList = foldl (\acc x -> acc ++ [head numList]) [] digitList


Measured memory_bytes: 508
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int R = sc.nextInt();
        
        System.out.println(R + ((N >= 10)?0:(100 * (10 - N))));
        
    }
}

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

using namespace std;

typedef long long ll;

class Fenwick {
  vector<ll> tree;
  int length;
  
public:
  Fenwick (int _length) : length(_length) {
    tree = vector<ll> (length, 0);
  }

  void add (int idx, ll val) {
    for (int i = idx; i < length; i += i & -i) {
      tree[i] += val;
    }
  }

  ll get (int idx) {
    ll ans = 0;
    for (int i = idx; i > 0; i -= i & -i) {
      ans += tree[i];
    }
    return ans;
  }

  ll range (int l, int r) {
    return get(r) - get(l - 1);
  }
};

// for each element, count the # of smaller elements to the right
ll count_inv (vector<int> perm) {
  ll ans = 0;

  vector<pair<int, int>> elems;
  for (int i = 0; i < (int) perm.size(); i++) {
    elems.push_back(make_pair(perm[i], i + 1));
  }
  sort(elems.begin(), elems.end());

  int n = elems.size();
  Fenwick fen (n + 5);
  for (pair<int, int> pr : elems) {
    int pos = pr.second;
    ans += fen.range(pos + 1, n);
    fen.add(pos, 1);
  }
  return ans;
}

const int ALPHA = 200;

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

  string s;
  cin >> s;
  
  vector<int> cnt (ALPHA, 0);
  for (char c : s) {
    cnt[c]++;
  }

  int oddc = 0;
  for (int i = 0; i < ALPHA; i++) {
    if (cnt[i] % 2 == 1) oddc++;
  }

  if (oddc > 1) {
    cout << -1 << endl;
    return 0;
  }

  vector<int> cur_cnt (ALPHA, 0);
  vector<int> sides;
  
  vector<pair<char, int>> left;
  vector<pair<char, int>> right;

  for (char c : s) {
    if (cnt[c] % 2 == 1 && cur_cnt[c] == cnt[c] / 2) {
      sides.push_back(0);
    } else if (cur_cnt[c] < cnt[c] / 2) {
      sides.push_back(-1);
      left.push_back(make_pair(c, cur_cnt[c]));
    } else {
      sides.push_back(1);
      right.push_back(make_pair(c, cnt[c] - cur_cnt[c] - 1));
    }
    cur_cnt[c]++;
  }
  
  map<pair<char, int>, int> idx;
  for (int i = 0; i < (int) right.size(); i++) {
    idx[right[i]] = i;
  }

  vector<int> lperm;
  for (int i = 0; i < (int) left.size(); i++) {
    lperm.push_back(idx[left[i]]);
  }
  reverse(lperm.begin(), lperm.end());

  cout << count_inv(sides) + count_inv(lperm) << endl;
}


Measured memory_bytes: 14340
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    int N, K, S;
    scan(N, K, S);

    auto a = new int[](N);

    if (S == 1) {
        foreach (i ; 0 .. N) {
            a[i] = (i < K ? 1 : 2);
        }
    }
    else if (S == 2) {
        foreach (i ; 0 .. N) {
            a[i] = (i < K ? 2 : 3);
        }
    }
    else {
        foreach (i ; 0 .. N) {
            a[i] = (i < K ? S : S - 1);
        }
    }

    writefln("%(%s %)", a);
}




void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


Measured memory_bytes: 3452
from itertools import groupby, accumulate, product, permutations, combinations
from copy import copy, deepcopy
def solve():
    k = int(input())
    minus = []
    plus = []
    dic = {}
    for i in range(k):
        r,c = map(int, input().split())
        dic[r] = c
        minus.append(r-c)
        plus.append(r+c)
    for p in permutations(range(8),8):
        mi = copy(minus)
        pl = copy(plus)
        for i in range(8):
            if i in dic:
                if dic[i]!=p[i]:
                    break
                else:
                    continue
            mi.append(i-p[i])
            pl.append(i+p[i])
        else:
            if len(set(mi))==8 and len(set(pl))==8:
                break
    ans = []
    for i in p:
        row = ['.']*8
        row[i] = 'Q'
        ans.append(''.join(row))
    return ans
print(*solve(),sep='\n')


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

#define show(x) cout << #x << " = " << x << endl

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz=" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = 1e9 + 7;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

struct Graph {
    Graph(int n)
    {
        edge.resize(n);
    }
    void addEdge(int from, int to)
    {
        edge[from].push_back(to);
    }
    vector<vector<int>> edge;
};

int main()
{
    int N;
    cin >> N;
    Graph g(N);
    for (ll i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        g.addEdge(a - 1, b - 1);
        g.addEdge(b - 1, a - 1);
    }

    vector<bool> checked(N, false);
    deque<int> anext;
    deque<int> bnext;
    deque<int> anext_;
    deque<int> bnext_;
    anext.push_back(0);
    bnext.push_back(N - 1);
    checked[0] = true;
    checked[N - 1] = true;
    int anum = 1;
    int bnum = 1;

    while ((not anext.empty()) or (not bnext.empty())) {
        while (not anext.empty()) {
            const int p1 = anext.front();
            anext.pop_front();
            for (const int to : g.edge[p1]) {
                if (not checked[to]) {
                    anum++;
                    checked[to] = true;
                    anext_.push_back(to);
                }
            }
        }

        while (not bnext.empty()) {
            const int p2 = bnext.front();
            bnext.pop_front();
            for (const int to : g.edge[p2]) {
                if (not checked[to]) {
                    bnum++;
                    checked[to] = true;
                    bnext_.push_back(to);
                }
            }
        }
        anext = anext_;
        bnext = bnext_;
        anext_.clear();
        bnext_.clear();
    }

    if (anum > bnum) {
        cout << "Fennec" << endl;
    } else {
        cout << "Snuke" << endl;
    }

    return 0;
}


Measured memory_bytes: 5888
target_num = int(input())
num_list = [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]

ans_num = num_list[target_num-1]
print(ans_num)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = ~(1<<31);
const int MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

ll dp[100010][4];

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

	dp[0][0] = 1;
	for(int i = 0; i < s.size(); i++){
		for(int j = 0; j < 4; j++){
			dp[i+1][j] += dp[i][j] * (s[i] == '?' ? 3 : 1);
			dp[i+1][j] %= MOD;
		}
		for(int j = 0; j < 3; j++){
			if(s[i] == '?' || s[i] == 'A'+j){
				dp[i+1][j+1] += dp[i][j];
				dp[i+1][j+1] %= MOD;
			}
		}
	}

	cout << dp[s.size()][3];

	return 0;
}

Measured memory_bytes: 3584
/**
 * @brief ユーザ定義リテラル
 * @author えびちゃん
 */

#ifndef H_int_literals
#define H_int_literals

#include <cstddef>
#include <cstdint>

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

#endif  /* !defined(H_int_literals) */

#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <utility>

int main() {
  size_t n;
  scanf("%zu", &n);

  std::vector<intmax_t> a(n), b(n+1, 0);
  for (auto& ai: a) scanf("%jd", &ai), ++b[ai];

  intmax_t res = 0;
  for (size_t i = 1; i <= n; ++i) {
    res += b[i] * (b[i]-1) / 2;
  }

  for (size_t i = 0; i < n; ++i) {
    intmax_t cur = res;
    intmax_t bi = b[a[i]];
    cur -= bi * (bi-1) / 2;
    cur += (bi-1) * (bi-2) / 2;
    printf("%jd\n", cur);
  }
}


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

int main(){
  int H, N, ATK = 0;
  cin >> H >> N;
  
  vector<int> A(N);
  
  for(int i = 0; i < N; i++)
    cin >> A.at(i);
  
  for(int i = 0; i < N; i++)
    ATK = ATK + A.at(i);
  
  if(ATK >= H)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <complex>

using namespace std;

int main()
{
    int W,H,N;
    int x,y;
    long long ans=0;

    pair<int,int> now;

    cin >> W >> H >> N;

    for(int i=0; i<N; ++i) {
        cin >> x >> y;
        if(i==0) {
            now={x,y};
            continue;
        }
        while(now.first!=x || now.second!=y) {
            if(now.first<x && now.second<y) {
                ++now.first;
                ++now.second;
                ++ans;
            } else if(now.first>x && now.second>y) {
                --now.first;
                --now.second;
                ++ans;
            } else {
                ans+=abs(now.first-x)+abs(now.second-y);
                now.first=x; now.second=y;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

ll solve(ll T, ll A, ll B) {
    if (B - A <= 1) return 1 + T;
    ll K = min(T, A - 1);
    T -= K;
    ll X = 1 + K;
    if (T == 0) return X;
    if (T % 2 == 1) {
        T--;
        X++;
    }
    X += T / 2 * (B - A);
    return X;
}

int main() {
    ll T, A, B;
    cin >> T >> A >> B;
    cout << solve(T, A, B) << endl;
}


Measured memory_bytes: 256
from collections import Counter
N,K,Q = map(int,input().split())
A_list = []
for _ in range(Q):
  A = int(input())
  A_list.append(A)
A_Counter = Counter(A_list)
for i in range(1,N+1):
  print("Yes" if K + A_Counter[i] - Q > 0 else "No")

Measured memory_bytes: 16840
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
int main()
{
    int n,sum,s;
    int a[5][105]={0};
    while(cin>>n)
    {
        sum=0;
      for(int i=0;i<n;i++)
        cin>>a[0][i];
      for(int i=0;i<n;i++)
        cin>>a[1][i];
        int p=1,maxn=0;
          for(int i=0;i<n;i++)
            {
              sum=sum+a[0][i];
              s=sum;
            for(int j=i;j<n;j++)
            {sum=sum+a[1][j];
            //cout<<sum<<endl;
            }
          if(sum>maxn)
            {maxn=sum;}
            sum=s;
            }
          cout<<maxn<<endl;

      }

    }



Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int n,i;
	long long int l[1000];
	scanf("%d",&n);
	l[0]=2;
	l[1]=1;
	for(i=2;i<=n;i++){
		l[i]=l[i-2]+l[i-1];
	}
	printf("%lld\n",l[n]);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main()
{
    int x, i;
    i = 1;
    x = 0;
    
    while (i < 10001) {
        scanf ("%d", &x);
        if (x == 0 || x < 1 || x > 10000) {
            break;
        }
        printf ("Case %d: %d\n", i, x);
        i++;
    }
    
    return 0;
}

Measured memory_bytes: 596
#include <iostream>

using namespace std;

int main(void) {
    long long A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    long long price = 0;
    if (A + B >= 2 * C) {
        price += min(X, Y) * 2 * C;
    } else {
        price += min(X, Y) * (A + B);
    }

    if (X >= Y) {
        X -= Y;
        if (A >= 2 * C) {
            price += X * 2 * C;
        } else {
            price += X * A;
        }
    } else {
        Y -= X;
        if (B >= 2 * C) {
            price += Y * 2 * C;
        } else {
            price += Y * B;
        }
    }

    cout << price << endl;
    return 0;
}

Measured memory_bytes: 256
//Author: ReseeCher
#include<bits/stdc++.h>
#define LL long long
#define F(x,y,z) for(int x=y;x<=z;++x)
#define D(x,y,z) for(int x=y;x>=z;--x)
#define ckmax(a,b) (a)=max(a,b)
#define ckmin(a,b) (a)=min(a,b)
#define pb push_back
using namespace std;
const int P=1000000007;
const int N=3010;
const LL Inv2=(P+1)/2;
LL R(){
    LL ans=0,f=1;char c=getchar();
    for(;c<'0'||c>'9';c=getchar()) if (c=='-') f=-1;
    for(;c>='0'&&c<='9';c=getchar()) ans=ans*10+c-'0';
    return ans*f;
}
int n,Q;
int a[N];
LL g[N][N],b[N],c[N];
LL Pow(LL x,LL bs){
    x%=P;
    LL an=1;
    for(;bs;bs>>=1,x=x*x%P)
        if(bs&1)an=an*x%P;
    return an;
}
void Work(){
	int x=R(),y=R();
	F(i,1,n)
		b[i]=Inv2*(g[x][i]+g[y][i])%P;
	F(i,1,n)
		c[i]=Inv2*(g[i][x]+g[i][y])%P;
	F(i,1,n)if(i!=x&&i!=y)g[x][i]=b[i];
	F(i,1,n)if(i!=x&&i!=y)g[y][i]=b[i];
	F(i,1,n)if(i!=x&&i!=y)g[i][x]=c[i];
	F(i,1,n)if(i!=x&&i!=y)g[i][y]=c[i];
	int g1=g[x][y],g2=g[y][x];
	g[x][y]=Inv2*(g1+g2)%P;
	g[y][x]=Inv2*(g1+g2)%P;
}
int main(){
	//freopen("1.in","r",stdin);
	//freopen("1.out","w",stdout);
    n=R();int ss=Q=R();
    F(i,1,n)a[i]=R();
    F(i,1,n)F(j,1,n)
    	g[i][j]=(a[i]>a[j]);
    while(Q--)Work();
    LL ans=0;
    F(i,1,n)
    	F(j,i+1,n)ans+=g[i][j];
    ans%=P;
    ans*=Pow(2,ss);
    ans%=P;
    cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 74172
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    string s;
    cin>>s;
    if(s.size()%2==1){
        cout<<"No"<<endl;
        return 0;
    }
    sort(s.begin(),s.end());
    for(int i=0;i<s.size();i+=2){
        if(s[i]==s[i+1]){
        }
        else{
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b, c;
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		Set<Integer> set = new HashSet<>();
		for (int i = 0; i < b; i++) {
			set.add((i * a) % b);
		}
		System.out.print(set.contains(c) ? "YES" : "NO");
	}
}

Measured memory_bytes: 23764
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const double pi = 3.14159265358979;

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

    double a, b, x;
    cin >> a >> b >> x;

    cout << fixed << setprecision(12);
    if (2 * x <= a * a * b) {
        cout << atan(a * b * b / 2 / x) * 180.0 / pi << '\n';
    } else {
        cout << atan(2 * b / a - 2 * x / a / a / a) * 180.0 / pi << '\n';
    }

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    lint N;
    cin >> N;
    if(N%2!=0) cout << 0 << endl;
    else{
        lint ans=0;
        rep(i,27) ans+=N/((lint)pow(5,i+1)*2);
        cout << ans << endl;
    }
}

Measured memory_bytes: 640
// ABEY SAALE
// QUESTION KHUD KR SOLUTION KYU DEKH RHA H
 
 
 
 
 
 
 
 
//MAAF KIJIYEGA ME GUSSE ME IDHAR UDHAR NIKAL JATA HU
#include<bits/stdc++.h>
#define mod 1000000007
#define fr first
#define se second
#define ll long long
#define PI 3.1415926535 
#define pb push_back
#define mpr make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define senky_bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;

ll fac[2000005];
void pre(){ fac[0]=1; fac[1]=1; for(int i=2;i<200005;i++) fac[i]=(i*fac[i-1])%mod;}
ll power(ll a,ll b){ll res=1;while(b){if(b&1) res=(res*a)%mod;a=(a*a)%mod;b=b/2;}return res%mod;}
ll ncr(ll n,ll r){return ((fac[n]*power(fac[r],mod-2))%mod*power(fac[n-r],mod-2))%mod;}
// DEKHIYE JI  WALID JO THE ABBA HAMARE WO YEH function CHHOD KR GYE THE

signed main()
{   



      
      senky_bansal
      IIIT_ALLAHABAD
      
      // pre();
      ll t;
      // cin>>t;
      t=1;
      while(t--)
      { 
         ll h,w,k;
    cin>>h>>w>>k;
    ll c[h][w];
    int c1=0;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            char d;
            cin>>d;
            c[i][j]=d-'0';
            if(d=='1')
            {
                c1++;
            }
        }
    }
    ll lim=(1<<(h-1));
    ll ans=INT_MAX;
    if(c1<=k)
    {
        cout<<0<<endl;
        return 0;
    }
    for(int i=1;i<lim;i++)
    {
        vector <int> v;
        for(int j=0;j<h-1;j++)
        {
            if(i&(1<<j))
            {
                v.pb(j+1);
            }
        }
        ll bnum[v.size()+1];
        int id=1,cnt=1;
        for(auto it:v)
        {
            while(id<=it)
            {
                bnum[id++]=cnt;
            }
            cnt++;
        }
        while(id<=h)
        {
            bnum[id++]=cnt;
        }
        ll sum[v.size()+2];
        memset(sum,0,sizeof(sum));
        int cut=0;
        int l=0,cur=-1,flag=0;
        vector <int> tmp;
    
        for(int j=0;j<w;j++)
        {
            for(int p=0;p<h;p++)
            {
                if(c[p][j])
                sum[bnum[p+1]]++;
            }
            
            int f=0;

            for(int p=1;p<v.size()+2;p++)
            {
                if(sum[p]>k)
                {
                    tmp.push_back(j);
                    cur=j;
                    cut++;
                    f=1;
                    break;
                }
            }
            if(f)
            {

                j--;
                for(int p=0;p<v.size()+2;p++)
                {
                    sum[p]=0;
                }
                if(l==cur)
                {
                    flag=1;
                    break;
                }
                l=j;
            }
        }
        if(flag==0)
        {
             ll p1 = cut;
             p1+=v.size();
            ans=min(ans,p1);
        }
    }
    cout<<ans<<endl;
         

      }
      






}



























Measured memory_bytes: 384
n=int(input())
li=list(map(int,input().split()))
li.sort()
sum=0

#print(li)
for i in range (n-1):
  #print(li[i])
  sum=sum+li[i]
  #print(sum)

if li[n-1]<sum:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,D,x,y,a=0;cin>>N>>D;
  int A[N][D];
  for(int i=0;i<N;i++)for(int j=0;j<D;j++)cin>>A[i][j];
  for(int i=0;i<N;i++)for(int j=0;j<i;j++){
    x=0;
    for(int k=0;k<D;k++)x+=(A[i][k]-A[j][k])*(A[i][k]-A[j][k]);
    y=sqrt(x);
    if(y*y==x)a++;
  }
  cout<<a<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
const int MAXN=5005,MOD=1000000007;

char str[MAXN];
long long dp[MAXN][MAXN];

int main()
{
	int N;
	scanf("%d%s",&N,str);
	
	dp[0][0]=1;
	for(int i=1;i<=N;i++)
		for(int j=0;j<=N;j++)
		{
			(dp[i][j]+=dp[i-1][j+1]*2%MOD)%=MOD;
			(dp[i][j]+=dp[i-1][j==0?0:j-1])%=MOD;
		}
	
	printf("%lld\n",dp[N][strlen(str)]);
	
	return 0;
}


Measured memory_bytes: 195712
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define F first
#define S second
int n;
ll ans,s,m;
P x[500005];
int main(void){
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%lld%lld",&x[i].F,&x[i].S);
    sort(x,x+n);
    m=-x[0].F;
    for(int i=0;i<n;i++){
        s+=x[i].S;
        ans=max(ans,s-x[i].F-m);
        m=min(m,s-x[i+1].F);
    }
    printf("%lld\n",ans);
}



Measured memory_bytes: 11056
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

signed main() {
    string W;
    cin >> W;
    vector<string> T;
    transform(W.cbegin(), W.cend(), W.begin(), ::toupper);
    while (true) {
        string temp;
        cin >> temp;
        if (temp == "END_OF_TEXT") break;
        else {
            transform(temp.cbegin(), temp.cend(), temp.begin(), ::toupper);
            T.push_back(temp);
        }
    }

    int ans = 0;
    for (int i = 0; i < T.size(); i++) {
        if (W == T[i]) ++ans;
    }
    cout << ans << endl;
}



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

int main() {
	int A,B;
    cin >> A >> B;
    vector<int> s(3);
    s.at(0) = A+B;
    s.at(1) = A-B;
    s.at(2) = A*B;
    sort(s.begin(),s.end());
    cout << s.at(2) << endl;
}


Measured memory_bytes: 256