akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    string S, T;
    vector<vector<int> > tapi; //追加する文字
    vector<vector<pair<int, int> >> pt; //ポインタ

    void input() {
        cin >> S >> T;
        tapi.resize(S.size(), vector<int>(T.size(), -1));
        pt.resize(S.size(), vector<pair<int, int>>(T.size(), make_pair(-1, -1)));
    }

    int lcs(int n, int m) {
        if (n < 0 || m < 0) {
            return 0;
        } else if (tapi[n][m] != -1) return tapi[n][m];


        if (S[n] == T[m]) {
            pt[n][m] = make_pair(n - 1, m - 1);
            return tapi[n][m] = 1 + lcs(n - 1, m - 1);
        }

        int tmp1 = lcs(n - 1, m);
        int tmp2 = lcs(n, m - 1);

        if (tmp1 > tmp2) {
            pt[n][m] = make_pair(n - 1, m);
            return tapi[n][m] = tmp1;
        } else {
            pt[n][m] = make_pair(n, m - 1);
            return tapi[n][m] = tmp2;
        }

    }

    void solve() {
        input();

        lcs(S.size() - 1, T.size() - 1);
        string ans;
        int n = S.size() - 1, m = T.size() - 1;
        while (n >= 0 && m >= 0) {
            if (S[n] == T[m]) {
                ans += S[n];
            }
            int nn = pt[n][m].first;
            int nm = pt[n][m].second;
            n = nn;
            m = nm;
        }
        reverse(all(ans));
        cout << ans << endl;
    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 106368
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int h, n;
    cin >> h >> n;
    int x;
    for (int i = 0; i < n; i++) {
        cin >> x;
        h -= x;
    }
    if (h > 0) {
        cout << "No\n";
        rr;
    }
    cout << "Yes\n";
    rr;
}


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

int main(){
  int a[3];
  fol(i,3){
    cin>>a[i];
  }
  sort(a,a+3);
  cout << a[0]+a[1]+a[2]*10<<endl;
  return 0;
}


Measured memory_bytes: 764
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <tuple>
#include <algorithm>
using namespace std;

const int INF = 1010;
pair<int, int> calc(string s) {
    // 全体の合計、負になった時の絶対値最大
    int A = 0, B = 0;
    for(size_t i=0; i<s.length(); i++) {
        if(s[i] == '(') A++;
        if(s[i] == ')') A--;

        if(A < 0) B = max(B, -A);
    }
    return make_pair(A, B);
}

bool solve(vector< pair<int, int> > vals) {
    sort(vals.begin(), vals.end(), [&](pair<int, int> L, pair<int, int> R) {
        if(L.second != R.second) return L.second < R.second;
        return L.first < R.first;
    });

    int pre = 0, N = vals.size();
    vector<int> checked(N);
    for(int z=0; z<N; z++) {
        int ma = -INF, idx = -1;
        for(int i=0; i<N; i++) {
            if(checked[i]) continue;
            if(pre < vals[i].second) break;

            if(ma < vals[i].first) {
                ma = vals[i].first;
                idx = i;
            }
        }

        if(idx < 0) return false;
        checked[idx] = true;
        pre += vals[idx].first;
        // printf("take: A = %d, B = %d\n", vals[idx].first, vals[idx].second);
    }

    return true;
}

int main() {
    int N; cin >> N;
    vector< pair<int, int> > posi, nega;

    int sum = 0;
    for(int i=0; i<N; i++) {
        string s; cin >> s;
        
        pair<int, int> tmp = calc(s);
        if(tmp.first >= 0) {
            posi.push_back(tmp);
        }
        else {
            int A = tmp.first, B = tmp.second;
            A = abs(A), B = B - A;
            nega.push_back(make_pair(A, B));
        }
        sum += tmp.first;
    }

    if(sum != 0) {
        cout << "No" << endl;
    }
    else {
        bool ans = solve(posi) && solve(nega);
        cout << (ans ? "Yes" : "No") << endl;
    }
    return 0;
}


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

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


}



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

int main() {
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  
  int sum=0;
  for (int i=0; i<N; i++){
    if (i<K){
      sum += X;
    }
    else{
      sum += Y;
    }
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(void)
{
  	int N;
  	int count=0;
  	int i=0;
    // 整数の入力
    scanf("%d",&N);
  	int P[N],min;
  	for(i=0;i<N;i++){
      	scanf("%d",&P[i]);
    }
    // 処理
    min=P[0];
   	for(i=0;i<N;i++){
    	if(P[i]<=min){
          	count++;
          	min=P[i];
        }
    }
      printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 896
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

long s, w;

int main(){
    scanf("%ld%ld", &s, &w);
    if(s <= w){
        printf("unsafe\n");
    }else{
        printf("safe\n");
    }
}


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

using namespace std;

#define ll long long


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

    int n;
    cin >> n;

    set<int> a;

    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        a.insert(x);
    }

    cout << (a.size() == n ? "YES" : "NO");
    return 0;
}

Measured memory_bytes: 9600
#include "bits/stdc++.h"
using namespace std;
#define REP(i,a) for(int i = 0; i < (a);i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector < vector<int>>;
long int sum[200020] = {};
int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if (k < e-a) {
		cout << ":(";
	}
	else {
		cout << "Yay!";
	}
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
// clang-format on

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

    vector<int> v;
    v.pb(a[n - 1]);
    for (int i = n - 2; i >= 0; --i) {
        v.pb(a[i]);
        v.pb(a[i]);
    }

    ll ans = 0;
    rep(i, n - 1) ans += v[i];
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 6080
#include<bits/stdc++.h>
#define ull unsigned long long int
#define ll long long
#define FOR(i,n) for(int i = 0;i<n ;i++)
#define ii pair<int,int>
#define vii vector<ii>
#define vi vector<int>
#define mii map<int,int>
#define uii unordered_map<int,int>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define pb push_back
#define MOD 1e9+7
#define INF 0x3f3f3f3f
#define print(x) cout<<x<<"\n";

//#include<boost/multiprecision/cpp_int.hpp>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//(Uncomment when needed and be sure it not give TLE bcoz it requires time)
//#pragma GCC optimize "trapv"//to check integer overflow and gives RE.
//typedef tree<pair<int,int>,null_type, 
//less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>   ordered_set;
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN NEEDED)\
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("O3")
//uncoment for large int requirement
//using boost::multiprecision::cpp_int;
//using namespace _gnu_pbds;

using namespace std;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
//use it with unordered_map<T,T,custom_hash> safe_map

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

int main()
{fast_io

int t;
//cin>>t;
t = 1;
while(t--)
{int n;
cin>>n;
   string s;
   cin>>s;
  vi r;
  vi w;
  for(int i = 0 ;i<s.length();i++){
      if(s[i]=='R')
      r.push_back(i);
      else 
      w.push_back(i);
  }
  int i =  0 ;int j = r.size()-1 ;
  int cnt = 0 ; 
  while(i<w.size() and j>=0 and r[j]>w[i]){
      cnt++;
      i++;
      j--;
  }
  cout<<cnt<<endl;
}
}


Measured memory_bytes: 4736
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
#define SIZE 20200000
ll inv[SIZE + 1];
void invinit()
{
	inv[1] = 1;
	for (int i = 2; i <= SIZE; i++)
	{
		inv[i] = mod - (mod / i)*inv[mod%i] % mod;
	}
}
int main()
{
	ll mx, my, k;
	scanf("%lld%lld%lld", &mx, &my, &k);
	invinit();
	ll tim = 1;
	for (ll i = mx + my - k + 1; i <= mx + my; i++)tim = tim*i%mod;
	ll p0 = 1;
	ll p1 = k*inv[mx + my] % mod;
	ll p2 = k*(k - 1) % mod*inv[mx + my] % mod*inv[mx + my - 1] % mod;
	ll q0 = k*p0%mod;
	ll q1 = (k + 1)*(mod + 1) / 2 % mod*p1%mod;
	ll q2 = 0;
	ll s = 2 * inv[k] * inv[k - 1] % mod;
	for (ll i = 1; i <= k; i++)
	{
		q2 += (i - 1)*(k - i + 1) % mod*s;
		q2 %= mod;
	}
	q2 = q2*p2%mod;
	//printf("%lld %lld %lld\n", p0, p1, p2);
	//printf("%lld %lld %lld\n", q0, q1, q2);
	ll ans = (q0 * 1 + q1*(mx + my) + q2*mx%mod*my) % mod;
	printf("%lld\n", tim*ans%mod);
}

Measured memory_bytes: 157952
#include<stdio.h>
int main(void){
    int n,i;
    int res_flag=0;
    int RESULT_OK;
    RESULT_OK = scanf("%d",&n);

    if (RESULT_OK ==1){

        for (i=9;i>1;i--){
            if(n%i==0 && n/i <10){
                res_flag =0;
                break;
            }else{
                res_flag =1;

            }
        }
        if(n==1){
            res_flag =0;
        }
        if(res_flag==1){
            printf("No\n");
        }else{
            printf("Yes\n");
        }
    }
    else{
        return 0;
    }
    return 0;
}


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

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)
#define EB emplace_back
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define INT(n) int n;assert(0<scanf("%d",&n))

int main(){
  INT(n);
  vector<pair<int, int>> vp;
  ll t = 0;
  REP(n){INT(a); INT(b); vp.EB(b, a);}
  sort(vp.begin(), vp.end());
  for(auto p: vp){
    int a = p.second, b = p.first;
    t += a;
    if (b < t){
      t = 0; break;
    }
  }
  if (t){
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 2420
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;

int main(){
    cin >> n;
    cout << 180*(n - 2) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N int(3e3)+10
using namespace std;

double coins(double p[N],int n,int i,int heads){
	if(i==n){
		if(heads>n-heads){
			return 1;
		}
		return 0;
	}
	return p[i]*coins(p,n,i+1,heads+1) + (1-p[i])*coins(p,n,i+1,heads);
}

double memo[N][N];
double coins_dp(double p[N],int n){
	for(int j=0;j<=n;j++){
		memo[n][j] = (j>n-j);
	}

	for(int i=n-1;i>=0;i--){
		for(int j=i;j>=0;j--){
			memo[i][j] = p[i]*memo[i+1][j+1] + (1-p[i])*memo[i+1][j];
		}
	}

	return memo[0][0];
}

int main(){
	int n;
	double p[N];

	cin >> n;
	for(int i=0;i<n;i++){
		cin >> p[i];
	}
	printf("%.15lf\n",coins_dp(p,n));
	return 0;
}

Measured memory_bytes: 69120
#include<stdio.h>

int main(){
  int input,h,m,s;
  scanf("%d",&input);
  h = input/(60*60);
  m = (input-(60*60*h))/60;
  s = (input-(60*60*h))%60;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}


Measured memory_bytes: 2136
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll A[1202020];
ll mo=998244353;
ll S[1202020];
ll S2[1202020];

const int NUM_=1400001;
static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];

vector<int> D[1010101];
ll ret;
ll T[1010101];
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>x;
		//x=1LL*rand()*rand()%1000000;
		A[x]++;
	}
	inv[1]=fact[0]=factr[0]=1;
	for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
	for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	
	ll ret=0;
	for(i=1;i<=1000000;i++) {
		(ret+=A[i]*(A[i]-1)/2%mo*i)%=mo;
		for(j=i;j<=1000000;j+=i) {
			(S2[i]+=(A[j]*j)%mo*S[i])%=mo;
			(S[i]+=A[j]*j)%=mo;
		}
	}
	for(i=1000000;i>=1;i--) {
		for(j=2*i;j<=1000000;j+=i) S2[i]+=mo-S2[j];
		S2[i]%=mo;
		(ret+=S2[i]*inv[i])%=mo;
	}
	
	
	
	cout<<ret<<endl;
	
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 86656
#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() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  int mx = 0;
  ll ans = 0;
  rep(i, n - 1) {
    mx = max(mx, a[i]);
    if (mx > a[i + 1]) {
      ans += mx - a[i + 1];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4044
h, w = [int(i) for i in input().split()]
a = [[0 for j in range(w)] for i in range(h)]
b = [[0 for j in range(w)] for i in range(h)]
for i in range(h):
    a[i] = [int(i) for i in input().split()]

for i in range(h):
    for j in range(w):
        b[i][j] = a[i][j]

counter = 0
for i in range(h):
    for j in range(w-1):
        if (a[i][j] % 2) != 0:
            a[i][j+1] += 1
            a[i][j] -= 1
            counter += 1
for i in range(h-1):
    if (a[i][-1] % 2) != 0:
        a[i+1][-1] += 1
        a[i][-1] -= 1
        counter += 1

print(counter)
for i in range(h):
    for j in range(w-1):
        if b[i][j] % 2 != 0:
            b[i][j+1] += 1
            b[i][j] -= 1
            print("{} {} {} {}".format(i+1, j+1, i+1, j+2))
for i in range(h-1):
    if b[i][-1] % 2 != 0:
        b[i+1][-1] += 1
        b[i][-1] -= 1
        print("{} {} {} {}".format(i+1, w, i+2, w))


Measured memory_bytes: 9204
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 1000000007;

     signed main(){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)cin>>a[i];
sort(a,a+n);
int ans=a[n-1];
for(int i=1;2*i<n;i++)ans+=2*a[n-1-i];
if(n%2)ans-=a[n-1-n/2];
cout<<ans<<endl;

     }


 


 






    





      

        


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

using lint = long long;
using pint = pair<int, int>;
#define x first
#define y second

int N;

void exe(int tc) {
	lint ans = 0;

	vector<pint> a, b;

	cin >> N;
	for (int i=0; i<N; i++) {
		int k, l, r;
		cin >> k >> l >> r;
		if (l > r) {
			ans += r;
			a.emplace_back(k, l-r);
		} else {
			ans += l;
			b.emplace_back(N-k, r-l);
		}
	}

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());

	priority_queue<int, vector<int>, greater<int> > qa, qb;

	for (pint p : a) {
		qa.push(p.y);
		ans += p.y;

		while (qa.size() > p.x) {
			ans -= qa.top();
			qa.pop();
		}
	}

	for (pint p : b) {
		qb.push(p.y);
		ans += p.y;

		while (qb.size() > p.x) {
			ans -= qb.top();
			qb.pop();
		}
	}

	cout << ans << '\n';
}

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

	int tc;
	cin >> tc;
	for (int i=1; i<=tc; i++) exe(i);
}

Measured memory_bytes: 6136
#include <iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#include <unordered_set>
#include <unordered_map>

#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
typedef set<LL> SLL;
typedef unordered_set<LL> USLL;
typedef string STR;

template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
template<class T> void _R(std::vector<T>& v) { for (auto& e : v) { _R(e); } }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;

LL calc_MEX(const std::vector<LL>& v) {
  std::unordered_set<LL> values;
  for (const auto& e : v) {
    values.insert(e);
  }
  for (LL k = 0; k <= (LL)v.size(); ++k) {
    if (values.find(k) == values.end()) {
      return k;
    }
  }
  return v.size();
}

int main() {
  LL n;
  R(n);
  VL a(n);
  R(a);
  std::sort(a.begin(), a.end(), std::greater<LL>());
  LL ans = a.front();
  for (auto it = a.begin() + 1; it != a.begin() + 1 + ((n - 2) / 2); ++it) {
    // W(ans);
    ans += *it * 2;
  }
  // W(ans);
  ans += ((n - 2) % 2 == 0 ? 0 : (a[(n - 2) / 2 + 1]));
  W(ans);
  return 0;
}


Measured memory_bytes: 4856
# coding: utf-8

x = int(input())

# 1 <= x <= 10^9
# a^5 - b^5 > 10^9
# n^5 - (n-1)^5 > 10^9 ~ 118
nmax = 119
dic = {}
for a in range(nmax+1):
    for b in range(nmax+1):
        a5 = a**5
        b5 = b**5
        m = a5 - b5
        if m not in dic:
            dic[m] = [a, b]

        n = a5 + b5
        if n not in dic:
            dic[n] = [a, -b]

#print(dic)
#print([dic[key] for key in dic if dic[key][0] < 0 or dic[key][1] < 0])
a,b = dic[x]
print(a, b)


Measured memory_bytes: 12264
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define time_taken_start int begtime = clock();
#define time_taken_end int endtime = clock(); \
cerr << "\n\n" << "Time elapsed: " << \
(endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
return 0;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.000000000001
#define pi acosl(-1)
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vpl vector<pll>
#define vll vector<ll>
#define mseti multiset <ll>
#define msetd multiset <ll,greater<ll>>
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound 
#define stp fixed<<setprecision(20)
#define endl '\n'
void solve()
{
    ll n;
    cin>>n;
    ll m=0;
    ll x,ans=0;
    for(ll i=0;i<n;i++)
    {
        cin>>x;
        ans+=max((ll)0,m-x);
        m=max(m,x);
    }
    cout<<ans;
}
int main()
{
    FAST
    #ifdef ayk_16
    freopen("input.txt","rt",stdin);
    freopen("output.txt","wt",stdout);
    #endif
    time_taken_start
    ll t=1;
    //cin>>t;
    for(ll i=0;i<t;i++)
    {
        //cout<<"Case #"<<i+1<<": ";
        solve();
    }
    time_taken_end
}



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



int main() 
{
    ll n;
    cin >> n;
    ll ans = 100100100100100;
    ll a = pow(n, 0.5);
    for (int i = 1; i <= a+1; i++)
    {
        if(n%i==0)
        {
            ll b = n / i;
            if(i+b<ans)
            {
                ans = i + b;
            }
        }
    }
        cout << ans - 2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void) {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a < b && b < c) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> b(n-1);
    for(int i = 0; i < n-1; i++) cin >> b[i];
    int ans = b[0];
    if(n == 2){
        ans += b[0];
    }else{
        for(int i = 0; i < n-1; i++){
            if(i != n - 2 && b[i] <= b[i+1]) {
                ans += b[i];
            }else if(i != n-2){
                ans += b[i+1];
            }else{
                ans += b[n-2];
            }
        }
    }
    cout << ans << 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;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 2LL << 60;
using ll = long long;
using P = pair<ll, ll>;

int main(int argc, char const *argv[]) {
    ll x;
    ll bank=100;
  	cin >> x;
    int cnt=0;
    while(bank<x){
        bank=bank*1.01;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3592
#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 << 45;
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()
{
  int k;
  string s;
  cin >> k >> s;
  if(s.size() <= k) cout << s << endl;
  else {
    cout << s.substr(0, k) << "..." << endl;
  }
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(){
    int n;
    int x;
    int i;
    scanf("%d", &n);
    for(i = 1;i <= n;i++){
        x = i;
        if(i % 3 == 0){
            printf(" %d", i);
            continue;
        }
        while(x){
            if(x % 10 == 3){
                printf(" %d", i);
                break;
            }
            x /= 10;
        }
    }
    printf("\n");
    return 0;
}


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

int main() {
    int H, W, K; cin >> H >> W >> K;
    vector<string> G(H);
    for(int i=0; i<H; ++i) cin >> G[i];

    string emp = string(W, '.');
    vector<vector<int>> res(H, vector<int>(W));
    int first = 0;
    int c = 1;
    while(G[first] == emp) ++first;
    
    for(int i=first; i<H; ++i) {
        if(G[i] == emp) {
            res[i] = res[i - 1];
        } else {
            int cnt = count(begin(G[i]), end(G[i]), '#');
            if(cnt == 1) {
                for(int j=0; j<W; ++j) res[i][j] = c;
                ++c;
            } else {
                for(int j=0; j<W; ++j) {
                    if(G[i][j] == '.') res[i][j] = c;
                    else if(cnt > 1) {res[i][j] = c++; --cnt;}
                    else {res[i][j] = c;}
                }
                ++c;
            }
        }
    }

    for(int i=0; i<first; ++i) res[i] = res[first];

    for(int i=0; i<H; ++i) {
        for(int j=0; j<W; ++j) cout << res[i][j] << (j+1==W ? '\n' : ' ');
    }
}

Measured memory_bytes: 1280
str = gets.strip.split("")
if str[0] == "0"
	ptn0 = "0"
	ptn1 = "1"
else
	ptn0 = "1"
	ptn1 = "0"
end
sample = []
cnt = 0
str.length.times do | i |
	if i % 2 == 0
		sample << ptn0
	else
		sample << ptn1
	end
	if str[i] != sample[i]
		cnt += 1
	end
end
puts cnt

Measured memory_bytes: 7836
#define _USE_MATH_DEFINES
#include <iostream>
#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(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()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
//max_element


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

	string ans = "";

	while (N != 0)
	{
		N--;
		int a = N % 26;
		char c = a + 'a';
		ans = c + ans;
		N /= 26;
	}

	cout << ans << endl;
}



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

using namespace std;

void setIO() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef DEBUG
    //freopen("solution.out", "w", stdout);
    freopen("1.in", "r", stdin);
#endif
}

const int maxn = 1e5;
int dp[maxn][3];

int main() {
    setIO();

    int n;
    cin >> n;
    int val[n][3];
    for (int i = 0; i < n; ++i) {
        cin >> val[i][0] >> val[i][1] >> val[i][2];
    }
    dp[0][0] = val[0][0];
    dp[0][1] = val[0][1];
    dp[0][2] = val[0][2];
    for (int i = 0; i < n - 1; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (j != k) {
                    dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + val[i + 1][k]);
                }
            }
        }
    }
    cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}) << "\n";
    return 0;
}


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

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
mt19937 rnd(time(0));
#define ioss ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("avia.in", "r", stdin); freopen("avia.out", "w", stdout);
#define _GLIBCXX_DEBUG
#define s second
#define f first
#define pb push_back
#define add insert
#define del erase
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pii pair<int,int>
#define res resize
#define PI acos(-1)
const ll INF = 1e9;//9223372036854775807L; //LONG_MAX;
constexpr ll mod = 1e9 + 7;


void solve() {
    int a, b;
    cin >> a >> b;
    cout << 6 - a - b << '\n';
}

signed main() {
    ioss
    //file
    //id.resize(3e5);
    int t = 1;                                                                                                                                                                        //ll
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int main(){
  long long X;
  long long n = 100;
  int res = 0;
  rd(X);
  while(n < X){
    n += n / 100;
    res++;
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200419-1

// --- original code ---
// {
//   ll X, n = 100;
//   int res = 0;
//   rd(X);
//   while(n < X){
//     n += n / 100;
//     res++;
//   }
//   wt(res);
// }


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

long long i,j,n,m,k;

/*int main(){
    int x, ans = INT_MAX;
    bool ok = false;
    cin >> n >> m >> x;
    long long c[n][m];
    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){
            cin >> c[i][j];
        }
    }
    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){
            cin >> c[i][j];
        }
    }
    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){

        }
    }
}*/

int main(){
    cin >> n >> k;
    int a[n];
    int lst[n];
    map<int , int> p;
    for(i = 0; i < n; i++){
        cin >> a[i];
    }
    lst[0] = 1;
    for(i = 1; i < n; i++){
        lst[i] = a[lst[i-1]-1];
        if(i == k){
            cout << lst[i];
            return 0;
        }
    }
    int pre, post;
    for(i = 0; i < n; i++){
        if(!p.count(lst[i])) p[lst[i]] = i;
        else{
            pre = p[lst[i]];
            post = i;
            break;
        }
    }
    k -= pre;
    k %= post - pre;
    cout << lst[k+pre] << endl;
}

Measured memory_bytes: 12584
#include <bits/stdc++.h>
#include <bitset> 
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define dd(x) cout<<#x<<" = "<<x<<" "
#define mes(p) memset(p,0,sizeof(p))
#define all(x) x.begin(),x.end()
#define rson mid+1,r,rt<<1|1
#define sz(x) (int)x.size()
#define lson l,mid,rt<<1
#define mp make_pair 
#define pb push_back
#define ls (rt<<1)
#define se second
#define rs (ls|1)
#define fi first
//typedef pair <int ,int > pi;
typedef vector <int > vi;
typedef long long ll;
const int maxn=2e6+5;
const int mod= 1e9+7;
const double pi = acos(-1);
int main(){
//	ios_base::sync_with_stdio(0);
  //  cin.tie(0);
	double a, b, x;
	cin >> a>> b>> x;
	double xx =x;
	double ans ;
	if(x<= a*a*b/2.0) {
		double y = 2*x/a/b;
		 ans = 90- atan(y/b)*180/pi;
	}else {
		x = a*a*b - x;
		double y = 2*x/a/a;
		 ans = atan(y/a)*180/pi;
	}
	printf("%.10f", ans);
	return 0; 
}


Measured memory_bytes: 256
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;

int main() {
	string S; cin >> S;
	map<char, int> p;
	for (int i = 0; i < S.length(); i++) {
		if (p[S[i]] != 0) {
			cout << "no" << endl;
			return 0;
		}
		else {
			p[S[i]] = 1;
		}
	}

	cout << "yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
vector<string> v[5];
map<string,int> mp;
map<int,string> p;
int main()
{
    mp["AC"]=1;mp["WA"]=2;mp["TLE"]=3;mp["RE"]=4;
    p[1]="AC";p[2]="WA";p[3]="TLE";p[4]="RE";
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        string str;
        cin>>str;
        int x=mp[str];
        v[x].push_back(str);
    }
    for(int i=1;i<=4;i++){
        cout<<p[i]<<" "<<"x"<<" "<<v[i].size()<<endl;
    }
    return 0;
}


Measured memory_bytes: 7396
#include <bits/stdc++.h>    //C++の標準ライブラリのヘッダを全て読み込む
using namespace std;
#define _GLIBCXX_DEBUG

 
int main() {
    int h,w,nh = 0,nw = 0;
    cin >> h >> w;
    vector<vector<char>> a(h,vector<char>(w,'.'));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> a.at(i).at(j);
        }
    }

    for (int i = 0; i < h; i++) {
        bool result = true;
        for (int j = 0; j < w; j++) {
            if(a.at(i).at(j) == '#'){
                result = false;
            } else {

            }
        }
        if(result == true){
            for (int j = 0; j < w; j++) {
                a.at(i).at(j) = '-';
            }
        } else {
        }
    }

    for (int i = 0; i < w; i++) {
        bool result = true;
        for (int j = 0; j < h; j++) {
            if(a.at(j).at(i) == '#'){
                result = false;
            } else {

            }
        }
        if(result == true){
            for (int j = 0; j < h; j++) {
                a.at(j).at(i) = '-';
            }
        } else {
        }
    }

    for (int i = 0; i < h; i++) {
        bool result = false;
        for (int j = 0; j < w; j++) {
            if(a.at(i).at(j) != '-'){
                result = true;
                cout << a.at(i).at(j);
            }
        }
        if(result == true){
            cout << endl;
        }
    }

}

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

using namespace std;

int main()
{
        int n;
        cin >> n;
        int a[100010];
        bool pushed[100010] = {false};
        REP(i,n) cin >> a[i];
        int button = 0;
        int cnt = 0;
        while(true){
                if(pushed[button]){
                        cout << -1 << endl;
                        return 0;
                }
                if(button == 1){
                        cout << cnt << endl;
                        return 0;
                }
                pushed[button] = true;
                button = a[button]-1;
                cnt++;
        }
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

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

int main(){
   int n; cin >> n;
   vector<ll> data(n);
   map<ll,ll> map1, map2;
    rep(i,n){
        cin >> data[i];
        map1[(i+1)+data[i]]++;
        map2[(i+1)-data[i]]++;
    }
    ll ans = 0;
    loop(i,1,n+1) if(map1[i]>0 && map2[i]>0) ans += map1[i]*map2[i];
    cout << ans << endl;
}



Measured memory_bytes: 39736
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	ll n;
	int ans=0;
	cin >>n;
	n--;
	deque<ll> s;
	if(n==0){
		s.push_back(0);
	}
	while(n>0LL){
		s.push_front(n%26LL);
	
		n/=26LL;
		n--;
		if(n==0){
			s.push_front(0);
		}
	//	clog<<s.front()<<" ";
	}
	
	while(!s.empty()){
		cout<<char(s.front()+'a');
		s.pop_front();
	}

	cout<<endl;
	//cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
ll int MOD=1e9+7;
#define INF 2*1e9
#define N 310000 
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");

main(){
    string s;
    cin>>s;
    int ans=0,temp=0;
    rep(i,s.size()){
        if(s[i]=='T'&&temp==0){
            ans+=2;
        }
        else if(s[i]=='S') temp++;
        else if(s[i]=='T') temp--;
    }
    cout<<ans;
}



Measured memory_bytes: 640
#include <iostream>
#include<string>
#include <cmath> 
using namespace std;   
int main()  
{ 
    long long m,n;
    cin>>n>>m;
    if(m<=n*2)cout<<m/2<<endl;
    else cout<<(m-2*n)/4+n<<endl;
    
    system("pause");
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	while(cin>>n, n>0){
		int state = 0;
		int l = 0, r = 0;
		int ans = 0;
		rep(i, n){
			string s; cin>>s;
			if (s=="ld") l = 0;
			if (s=="lu") l = 1;
			if (s=="rd") r = 0;
			if (s=="ru") r = 1;
			if (state==0){
				if (r==l && r==1){
					ans++;
					state = 1;
				}
			}else{
				if (r==l && r==0){
					ans++;
					state = 0;
				}
			}
		}
		cout << ans << "\n";
	}
	return 0;
}


Measured memory_bytes: 3148