akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <vector>

using namespace std;
using namespace chrono;

#ifdef DEBUG
	//~ #define LOCAL_INPUT_FILE
#else
	//~ #define USE_FILE_IO
#endif

#ifdef USE_FILE_IO
	#define INPUT_FILE "input.txt"
	#define OUTPUT_FILE "output.txt"
	#define cin ____cin
	#define cout ____cout
	ifstream cin(INPUT_FILE);
	ofstream cout(OUTPUT_FILE);
#else
	#ifdef LOCAL_INPUT_FILE
		#define cin ____cin
		ifstream cin("input.txt");
	#endif
#endif

const int infinity = (int)1e9 + 42;
const int64_t llInfinity = (int64_t)1e18 + 256;
const int module = (int)1e9 + 7; 
const long double eps = 1e-8;

mt19937_64 randGen(system_clock().now().time_since_epoch().count());

inline void raiseError(string errorCode) {
	cerr << "Error : " << errorCode << endl;
	exit(42);
}

signed main() {
	#ifndef USE_FILE_IO
		ios_base::sync_with_stdio(false);
	#endif
	int x; cin >> x;
	cout << 360 / gcd(x, 360) << endl;
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define ll long long
const int N = 1e6 + 10;
using namespace std;
int n;
int t;
set<int> s;
int main() {
  ios::sync_with_stdio(false);
  cin>>n;
 for(int i=0;i<n;i++){
      cin>>t;
      s.insert(t);
  }
  int ans=s.size();
  if(ans==n)  cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
#define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
#define pll pair<ll,ll>
#define pii pair<int,int>
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}
 
ll gcd(ll a,ll b){ if(b==0) return a; return gcd(b,a%b) ;} 

template <typename T>
string NumberTostring(T Number )
{
	ostringstream ss;
	ss<<Number;
	return ss.str();
}
 

 
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
 	ll n;
 	cin>>n;
 	string ans = "";
 	while(n>0){
 		char cur ;
 		if(n%26==0){
 			
 			cur= 26 + 96;
 			n--;
 		}
 		else{
 			cur = n%26+96;
 		}
 		ans = cur+ans;
 		n = n/26;
 	}   
 	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define sf1(n) scanf("%d",&n)
#define sf2(n,q) scanf("%d %d",&n,&q)
#define f first
#define ss second
#define pb push_back
#define lli long long
#define mem(ar,false) memset(ar,false,sizeof(ar))
#define mpr make_pair
#define endl "\n"
#define mod 1000000007
#define inf 9000000000000000000LL
using namespace std;

int ar[102];
lli dp[100005];

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

    int n,k;
    cin >> n >> k;

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

    dp[0] = 1;
    for(int i=0;i<n;i++)
    {
        vector<lli>sum(k+3,0);
        for(int j=k;j>=0;j--)
        {
            int l = j+1;
            int r = j+ar[i];
            r = min(r,k);
            if(l<=r)
            {
                sum[l]+=dp[j];
                sum[r+1]-=dp[j];
            }
        }
        lli pre = 0;
        for(int j=0;j<=k;j++)
        {
            pre += sum[j];
            dp[j] += pre;
            dp[j]+=mod;
            dp[j]%=mod;
        }
    }
    cout << dp[k] << endl;
    return 0;

}



Measured memory_bytes: 5100
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    set<int> st;
    map<int, int> wa;
    int ans = 0;
    rep(i,m){
        int p;
        string s;
        cin >> p >> s;
        if(s == "AC"){
            st.insert(p);
        }
        else{
            if(st.find(p) == st.end()) ++wa[p];
        }
    }
    cout << st.size() << " ";
    for(auto p : st){
        ans += wa[p];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 12972
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if(b % a == 0) cout << a + b << endl;
  else cout << b - a << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

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

    int n[33] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << n[k - 1] << '\n';
    return 0;
} 


Measured memory_bytes: 256
/**
 * Created by hiramekun at 19:37 on 2019-10-06.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    string s;
    cin >> s;
    ll k;
    cin >> k;

    bool isOne = true;
    ll n = s.size();
    rep(i, n - 1) {
        if (s[i] != s[i + 1]) {
            isOne = false;
            break;
        }
    }

    ll halfk = ll(ceil(k / 2.0));
    ll halfn = ll(ceil(n / 2.0));

    if (isOne) {
        if (n % 2 == 0) {
            cout << n / 2 * k << '\n';
        } else {
            cout << (n - halfn) * halfk + halfn * (k - halfk) << '\n';
        }
    } else {
        if (s[0] != s.back()) {
            ll ans = 0;
            rep(i, n - 1) {
                ll cnt = 1;
                while (i + 1 < n && s[i] == s[i + 1]) {
                    cnt++;
                    i++;
                }
                ans += cnt / 2;
            }
            cout << ans * k << '\n';
        } else {
            ll l = 1, r = 1;
            ll il = 0, ir = n - 1;
            while (s[il] == s[il + 1]) {
                l++;
                il++;
            }
            while (s[ir] == s[ir - 1]) {
                r++;
                ir--;
            }

            ll ans = 0;
            rep(i, n - 1) {
                if (s[i] == s[0]) continue;
                ll cnt = 1;
                while (i + 1 < n && s[i] == s[i + 1]) {
                    cnt++;
                    i++;
                }
                ans += cnt / 2;
            }
            ans *= k;
            ans += (k - 1) * ((l + r) / 2);
            ans += l / 2;
            ans += r / 2;
            cout << ans << '\n';
        }
    }
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

using namespace std;
const int maxn = 1e5+10;;
int main()
{
	int n;
	cin >> n;
	int a[maxn];
	for(int i = 0;i < n;i ++){
		cin >> a[i];
	}
	int ans = a[0];
	for(int i = 1;i < n;i ++){
		ans = __gcd(ans,a[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = LLONG_MAX;
/* テンプレートここまで */

int main() {
  ll N; cin >> N;
  vector<pair<ll,ll> > ab(N);
  REP(i, N){
    ll a, b; cin >> a >> b;
    ab[i] = {b, a};
  }
  sort(ALL(ab));
  ll cur = 0;
  REP(i, N){
    cur += ab[i].second;
    if(cur > ab[i].first){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 3456
//       THIS IS MY NINJA WAY
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ctime>
#include<vector>
#include<algorithm>

#define str string
#define dbl double
#define ll long long int
#define ull unsigned long long int
#define vl vector<ll> 
#define vs vector<str>
#define pll pair<ll,ll> 
#define vll vector<pll>
#define sl set<ll>
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define BS binary_search
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define fr(i,a,b) for(long long i=a; i<b; i++)
#define nfr(i,a,b) for(long long i=a; i<=b; i++)
#define psl pair<str,ll>
#define pls pair<ll,str>
#define pss pair<str,str>
#define lcm(a,b) (a*b)/__gcd(a,b)
#define ALL(a) a.begin(),a.end()
#define stl stack<ll>
#define coml complex<ll>
#define INF 0x3f3f3f3f3f3f3f3f
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define read(v,n) fr(i,0,n)cin>>v[i];
#define print(x) fr(i,0,x.size())cout<<x[i]<<" ";cout<<"\n";
const ll MOD = 1e9+7;
const ll N = 2e5 + 5;
using namespace std;
using namespace __gnu_pbds;
void solve(){
	ll n,k;
	cin>>n>>k;
	vl v(n);
	read(v,n);
	vl dp(n,INF);
	dp[0]=0,dp[1]=abs(v[0]-v[1]);
	// fr(i,2,k){
	// 	fr(j,1,k+1){
	// 		if(i-j>=0)dp[i]=min(dp[i],dp[i-j]+abs(v[i]-v[i-j]));
	// 	}
	// }
	fr(i,2,n){
		fr(j,1,k+1){
			if(i-j>=0)dp[i]=min(dp[i],dp[i-j]+abs(v[i]-v[i-j]));
		}
	}
	//print(dp);
	cout<<dp[n-1];
}
int main()
{
	fast
	

	ll t;
	t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

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

int main(){
    int n; cin>>n;
    string s; cin>>s;
    int cnt=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R')cnt++;
    }
    if(cnt>n-cnt){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
long long ans[2005];
void solve(){
	int n;
    cin >> n;
    ans[3] = 1;
    ans[4] = 1;
    for (int i = 5; i <= n; i++) {
        ans[i] = 1;
        for (int j = 3; j <= i - 3; j++) ans[i] += ans[j], ans[i] %= mod;
    }
    cout << ans[n] << endl;
}

int main(){

/*#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif*/
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//int t;cin >> t;while(t--){solve();}
	solve();
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main()
{
    auto check = [](int p, int q) {
        const auto squareNorm = p * p + q * q;
        // enumerate all natural numbers
        for (int n = 0;; ++n) {
            // clang-format off
            // if <m, n> . <x, y> = <p, q> then (m^2 + n^2) * (x^2 + y^2) = p^2 + q^2
            // so, if n^2 > p^2 + q^2 then (x^2 + y^2) < 1. there is no such integers.
            // clang-format on
            if (n * n > squareNorm) {
                break;
            }
            for (int m = 0; m <= n; ++m) {
                if (m * m > squareNorm) {
                    break;
                }
                // m^2 + n^2 > 0
                if (n * n + m * m <= 0) {
                    continue;
                }
                auto f = [p, q](int n_, int m_) {
                    // clang-format off
                    // trivial solution
                    if ((n_ ==  1 && m_ ==  0) ||
                        (n_ ==  0 && m_ ==  1) ||
                        (n_ == -1 && m_ ==  0) ||
                        (n_ ==  0 && m_ == -1) ||
                        (n_ ==  p && m_ ==  q) ||
                        (n_ == -q && m_ ==  p) ||
                        (n_ == -p && m_ == -q) ||
                        (n_ ==  q && m_ == -p)) {
                        return false;
                    }
                    // clang-format on
                    // is divisor?
                    // note: this equation can derive from solving Ginkgo multiplication definition
                    return (n_ * p + m_ * q) % (n_ * n_ + m_ * m_) == 0 &&
                           (n_ * q - m_ * p) % (n_ * n_ + m_ * m_) == 0;
                };
                if (f(n, m) || f(n, -m) || f(-n, m) || f(-n, -m)) {
                    return false;
                }
            }
        }
        return true;
    };

    int N;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        int n, m;
        cin >> n >> m;
        cout << (check(n, m) ? 'P' : 'C') << endl;
    }
}


Measured memory_bytes: 3012
import java.util.Scanner;

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

        if (b <= a) {
            System.out.println("delicious");
        }
        else if (b > a && b <= (a + x)) {
            System.out.println("safe");
        }
        else {
            System.out.println("dangerous");
        }
    }
}


Measured memory_bytes: 21972
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
long long a,b,c,x,y,ans;
int main()
{
	cin>>a>>b>>c>>x>>y;
	if (2*c>=a+b)
	{
		cout<<x*a+y*b;
		return 0;
	}
	long long maxn=min(x,y);
	x-=maxn; y-=maxn;
	ans+=maxn*c*2;
	if (x) ans+=min(x*a,2*x*c);
	if (y) ans+=min(y*b,2*y*c);
	cout<<ans;
} 

Measured memory_bytes: 256
import collections
 
n = int(input())
v = [int(i) for i in input().split()]
 
v1 = [v[i] for i in range(0,n,2)]
v2 = [v[i] for i in range(1,n,2)]
 
count1 = collections.Counter(v1).most_common(2)
count2 = collections.Counter(v2).most_common(2)

if count1[0][0] != count2[0][0]:
    res = len(v1) - count1[0][1] + len(v2) - count2[0][1]
    print(res)
else:
    if len(count1) == 1:
        print(len(v1))
    else:
        res1 = len(v1) - count1[0][1] + len(v2) - count2[1][1]
        res2 = len(v1) - count1[1][1] + len(v2) - count2[0][1]
        print(min(res1,res2))

Measured memory_bytes: 15964
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<set>
#include<queue>
#include<algorithm>
#include<climits>
#include<map>
#include<unordered_map>
#define ll long long

bool isPrime(ll n){
    if(n%2==0 || n%3==0) return false;
    if(n<=1)  return false;
    if(n<=3)  return true;
    for(ll i=5;i*i<=n;i=i+6)
        if(n%i==0||n%(i+2)==0)
           return false;
    return true;
}

#define w(t) ll t,tt=1;	cin>>t;		while(t--)
#define ps(x,y) fixed<<setprecision(y)<<x
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define pb push_back
#define mp make_pair

#define vi vector<int>
#define vll vector<ll>
#define mii map<ll,ll>
#define umii unordered_map<ll,ll>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>

#define mod 1e9+7
#define inf 1e18

#define lln ll n; cin>>n
#define intn int n; cin>>n
#define YES cout<<"Yes"
#define NO cout<<"No"
#define strr    string str; cin>>str;
#define strn   n=str.length()
#define fr(a,n) for(ll i=a;i<n;i++)
#define loop for(ll i=0;i<n;i++)

using namespace std;

void solve (){
    intn;
    ll x,ans=0;
    ll prevx;
    cin>>prevx;
    while(--n){
        cin>>x;
        if(prevx>x){
            ans+=(prevx-x);
        }
        else
            prevx=x;
    }
    cout<<ans;
}

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


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int K,X;
  cin >> K >> X;
  REP(i,K-1) cout << X-(K-i)+1 << " ";
  cout << X;
  REP(i,K-1) cout << " " << X+i+1;
  cout << endl;
}

Measured memory_bytes: 256
/** Programming problem solution 4.
 *  Copyright (c) 2020 Peter Winchester. All rights reserved.
 *  
 *  This program is written by Peter Winchester.
 *  Peter use this program to solve a programming problem.
 *  If you are not allowed to copy the code, don't copy the
 *  following code.
 */

// code:
#include <iostream>
#include <cstring>

using namespace std;

int ans;
string n;

int main()
{
	cin >> n;
	for (int i = 0; i < n.length(); i++)
	{
		ans += n[i] - '0';
		ans %= 9;
	}
	if (ans == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3688
#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>;

void Main()
{
  int R;
  cin >> R;
  cout << 2.0 * acos(-1) * R << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

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

using namespace std;

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

  int n; 
  cin >> n;
  string s;
  cin >> s;
  int res = 1;
  for (int i = 1; i < n; ++i) {
    if (s[i] != s[i-1]) res++;
  }
  cout << res << endl;

  return 0;
}



Measured memory_bytes: 512
use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let nums : Vec<i32> = input.split_whitespace().map(|x| x.parse().ok().unwrap()).collect();
    if nums[1] == 1 {
        println!("0");
    }else{
        println!("{}", nums[0] - nums[1]);
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
#define N 12

int num[ N ];
int check[ N ], count[ N ];
int cnt, cur;

int transform( int n ) {
  int i, j;

  for( i = 0; i < n; i++ ) {
    check[ i ] = 0;
    count[ i ] = 0;
  }

  for( i = 0; i < n; i++ ) {
    cnt = 0;
    if( !check[ i ] ) {
      cnt++;
      cur = num[ i ];
      check[ i ] = 1;
      for( j = i+1; j < n; j++ )
        if( num[ j ] == cur ) {
          cnt++;
          check[ j ] = 1;
        }
      for( j = i; j < n; j++ )
        if( check[ j ] == 1 ) {
          check[ j ] = 2;
          count[ j ] = cnt;
        }
    }
  }

  for( i = 0; i < n; i++ )
    if( count[ i ] != num[ i ] )
      return 1;

  return 0;
}

int main( void ) {
  int i, j, n;

  while( 1 ) {
    scanf( "%d", &n );
    if( !n ) break;

    for( i = 0; i < n; i++ )
      scanf( "%d", &num[ i ] );

    for( i = 0; transform( n ); i++ )
      for( j = 0; j < n; j++ )
        num[ j ] = count[ j ];

    printf( "%d\n", i );

    for( i = 0; i < n; i++ ) {
      printf( "%d", count[ i ] );
      if( i < n-1 )
        printf( " " );
    }
    printf( "\n" );
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    int A, B;
    cin >> A >> B;
    char a = '0' + A, b = '0' + B;
    string S = "", T = "";
    for(int i = 0; i < B; i++) S += a;
    for(int i = 0; i < A; i++) T += b;

    if(S > T) cout << T << endl;
    else cout << S << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <array>
#include <algorithm>
#include <iostream>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <math.h>
#include <assert.h>
#include <queue>
#include <deque>
#include <iomanip>
#include <numeric>
#include <fstream>

using namespace std;

typedef long long ll;
typedef long double ld;

#define fi first
#define se second

#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvd;
typedef vector<string> vs;
typedef vector<bool> vb;

typedef pair <int, int> pii;
typedef pair <ll, ll> pll;


int main() {
    cout << setprecision(30);
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    ll a, b;
    cin >> a >> b;
    cout << max(a + b, max(a - b, a * b)) << endl;

    return 0;
}

Measured memory_bytes: 764
import math

A,B,H,M = map(int,input().split())

H = H*5 + (5/60)*M

comp = abs(H-M)

if(comp>=30):
    comp = 60-comp

pre = ((comp*6)/360)*2*math.pi

ans = A*A + B*B -2*A*B*math.cos(pre)

print(math.sqrt(ans))

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

int n;
int A[200010],B[200010];
int main(){
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> A[i];
	}
	int a = 1,b = n,count = 0;
	for(int i=n;i>0;i--){
		if(count%2==0){
			B[a] = A[i];
			a++;
		}else{
			B[b] = A[i];
			b--;
		}
		count++;
	}
	for(int i=1;i<=n;i++){
		if(i!=n) cout << B[i] << " ";
		else cout << B[i] << endl;
	}
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

int n;
int h[100010];
int ans;
int t;
int cnt;

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

    t = h[0];
    for (int i = 1; i < n; i++) {
        if (t >= h[i]) {
            cnt++;
        } else {
            ans = max(ans, cnt);
            cnt = 0;
        }
        t = h[i];
    }
    ans = max(ans, cnt);

    cout << ans << endl;
}


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

typedef long long ll;

int main(){
  ll N, K, R, S, P; cin >> N >> K >> R >> S >> P;
  string T; cin >> T;
  vector<ll> hand(N, 0);
  vector<bool> dup(N, 0);
  vector<ll> sc(3, 0);
  sc[0] = R, sc[1] = S, sc[2] = P;
  for(ll i = 0; i < N; i++){
    if(T[i] == 's') hand[i] = 0;
    if(T[i] == 'p') hand[i] = 1;
    if(T[i] == 'r') hand[i] = 2;
  }
  ll ans = 0LL;
  
  for(ll i = 0; i < N; i++){
    if(i < K) ans += sc[hand[i]];
    else{
      if(hand[i] != hand[i - K]){
        ans += sc[hand[i]];
      }else{
        if(dup[i - K]){
          ans += sc[hand[i]];
        }else{
          dup[i] = true;
        }
      }
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1280
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
const int N = 3010; 
int a, b, c, d, e, f;
int dp[N][N];
int main()
{
	cin >> a >> b >> c >> d >> e >> f;
	a *= 100;
	b *= 100;
	dp[0][0] = 1;
	for(int i = 0; i <= f; i += 100)
		for(int j = 0; i + j <= f; ++j)
		{
			if(i >= a) dp[i][j] |= dp[i - a][j];
			if(i >= b) dp[i][j] |= dp[i - b][j];
			if(j >= c) dp[i][j] |= dp[i][j - c];
			if(j >= d) dp[i][j] |= dp[i][j - d];
		}
	int mass = -1, sugar = -1;
	for(int i = 100; i <= f; i += 100)
		for(int j = 0; i + j <= f; ++j) if(dp[i][j] && j <= (i / 100) * e)
		{		
			if(mass == -1 || sugar == -1 || (double)j / (double)(i + j) > (double)sugar / (double)mass)
			{
				sugar = j;
				mass = i + j;
			}
		}
	printf("%d %d\n", mass, sugar);	
	return 0;
}

Measured memory_bytes: 33024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		int ans = 0;
		for(int i = 0; i < b; i++) {
			if((a-1)*i+1 >= b) {
				break;
			}
			ans++;
		}
		System.out.println(ans);
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

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


int main(void){

	int N;  cin >> N;
	int ans = 0;
	REP(i,N){
		REP(j,N){
			REP(k,N){
				ans++;
			}
		}
	}

	cout << ans << endl;
	

	return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
  int n;
  long long count=0;
  scanf("%d",&n);
  for(int i=1;i<n;i++){
    count+=(n-1)/i;
  }
  printf("%lld",count);
  return 0;
}


Measured memory_bytes: 1736
#include <stdio.h>
#include <string.h>

int main(void)
{	char data[1024];
	while(gets(data)!=NULL){
		int i,len;
		len=strlen(data);
		while(1){
			if(strstr(data,"the")!=NULL) break;	
			if(strstr(data,"this")!=NULL) break;
			if(strstr(data,"that")!=NULL) break;	//OK
			for(i=0;i<len;i++){
				if(islower(data[i])!=0){
					data[i]=++data[i]%'a'%26+'a';
				}
			}
		}
		puts(data);
	}
	return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <iomanip>
#include <math.h>
#include <fstream>

using namespace std;

long long mod = 1000000007;

long long gcd(long long a, long long b)
{
    if (b == 0)
    {
        return a;
    }
    return gcd(b, a % b);
}

long long binpow(long long x, long long k)
{
    if (k == 0)
    {
        return 1LL;
    }
    long long temp = binpow(x, k / 2);
    if (k % 2 == 1)
    {
        return (((temp * temp) % mod) * x) % mod;
    }
    else
    {
        return (temp * temp) % mod;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cin.tie();
    cout.tie();
    // ifstream cin("in.txt");
    // ofstream cout("out.txt");
    
    
    // int t;
    // cin >> t;
    // for (int qwe = 0; qwe < t; qwe++)
    // {
    //     cout << "Case #" << qwe + 1 << ": ";
    // }


    int n;
    cin >> n;
    vector<pair<long long, long long>> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i].first >> v[i].second;
        if (v[i].first == 0 && v[i].second == 0)
        {
            continue;
        }
        long long x = gcd(max(abs(v[i].first), abs(v[i].second)), min(abs(v[i].first), abs(v[i].second)));
        if (x != 0)
        {
            v[i].first /= x;
            v[i].second /= x;
        }
        if (v[i].first < 0 || (v[i].first == 0 && v[i].second < 0))
        {
            v[i].first *= -1;
            v[i].second *= -1;
        }
    }
    map<pair<long long, long long>, int> mp;
    set<pair<long long, long long>> st;
    for (int i = 0; i < n; i++)
    {
        mp[v[i]]++;
        st.insert(v[i]);
    }
    long long rez = 1;
    set<pair<long long, long long>> done;
    for (set<pair<long long, long long>>::iterator it = st.begin(); it != st.end(); it++)
    {
        if (it->first == 0 && it->second == 0)
        {
            continue;
        }
        if (done.find(*it) != done.end())
        {
            continue;
        }
        pair<long long, long long> val = *it;
        if (val.second < 0)
        {
            val = { -val.second, val.first };
        }
        // cout << val.first << " " << val.second << " " << (binpow(2, mp[val]) + binpow(2, mp[{ val.second, -val.first }]) - 1) << '\n';
        rez *= (binpow(2, mp[val]) + binpow(2, mp[{ val.second, -val.first }]) - 1) % mod;
        rez %= mod;
        done.insert(val);
        done.insert({ val.second, -val.first });
    }
    cout << (rez + mp[{ 0, 0 }] + mod - 1) % mod << '\n';

    return 0;
}


Measured memory_bytes: 68380
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		//入力表示
			int N = sc.nextInt();
			
			List<String> list = new ArrayList<String>();
			
			for(int i=0;i<N;i++) {
			list.add(sc.next());
			}
			
			List<String> ans = list.stream().distinct().collect(Collectors.toList());

			System.out.println(ans.size());
	}
}

Measured memory_bytes: 68852
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  //XORってなんだ
  //1,6,3
  //001
  //110
  //011
  //-----
  //100が最大
  //各桁の0の数調べて、半分未満なら1、半分以上なら0を選べばOKっぽ
  //10^5くらいならX決定後に再計算しても間に合いそうな気がする
//4=      100
//100=1100100
//123=1111011
//    1100011=99次点
//ベストと比較。K=0,X=1だった箇所は、X=0にする。
//K=1,X=0があらわれたら、そこ以降はXのまま
  ll N,K,X=0;
  cin>>N>>K;
  ll k=K, a=0;
  while(k>0){
    k/=2;
    a++;
  }
  vector<ll>Z(a,0);
  vector<ll>Y(N,0);
  for(int i=0; i<N; i++){
    ll A,j=a-1;
    cin>>A;
    Y[i]=A;
    while(A>0 && j>=0){
      if(A%2==1)
        Z[j]++;
      A/=2;
      j--;
    }
  }
  //bestXつくる
  vector<ll>Xs(a,0);  
  for(int i=0; i<a; i++){
    X*=2;
    if(Z[i]<(N+1)/2){
      X++;
      Xs[i]++;
    }
  }
  //Kにあわせる
  if(X>K){
    ll k=K, j=a-1;
    X=0;
    vector<ll>Ks(a,0);
    while(k>0){
      if(k%2==1)
        Ks[j]++;
      k/=2;
      j--;
    }
    for(int i=0; i<a; i++){
      if(Ks[i]==1 && Xs[i]==0)
        break;
      if(Ks[i]==0 && Xs[i]==1)
        Xs[i]=0;
    }
    for(int i=0; i<a; i++){
      X*=2;
      if(Xs[i]==1)
        X++;
    }  
  }
  ll ans=0;
  for(int i=0; i<N; i++)
    ans+=X^Y[i];
  cout<<ans<<endl;
}

Measured memory_bytes: 1152
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String x = br.readLine();
		String y = x.substring(1, 2);

		int a = Integer.parseInt(x);

		System.out.println(a >= 90 || y.equals("9") ? "Yes" : "No");

	}
}

Measured memory_bytes: 21204
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
ll n;
 
int main() {
  cin >> n;
  ll price = 0;
  ll a[n];
  ll sum=0;
  for(ll i=0; i<n; i++){
    cin >> a[i];
    sum += a[i];
  }
  ll a_left[n];
  ll a_right[n];
  ll sum_left = 0;
  ll sum_right = 0;
  ll a_turn = 0;
  for(ll j=0; j<n; j++){
    if(sum_left < (sum/2) && j!=(n-1)){
      sum_left += a[j];
    }else{
      if(sum_right == 0){
        a_turn = a[j-1];
      }
      sum_right += a[j];
    }
  }
  price = min(abs(sum_left-sum_right),abs((sum_right+a_turn)-(sum_left-a_turn)));
  cout << price << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    int l = 0, ans = 0;
    while (l < n) {
        ++ans;
        bool inc = 0, dec = 0;
        int r = l + 1;
        while (r < n) {
            if (a[r] == a[r - 1]) {

            }
            else if (a[r] > a[r - 1]) {
                if (dec)
                    break;
                inc = 1;
            }   
            else {
                if (inc)
                    break;
                dec = 1;
            }   
            ++r;
        }   
        l = r;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    int n;cin >> n;
    vector<LL> a(n+1),b(n);
    for (int i = 0; i < n+1; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    LL ans=0;
    for (int i = 0; i < n; i++) {
        if(a[i]<b[i]){
            ans+=a[i];
            b[i]-=a[i];
            a[i]=0;
        }
        else{
            a[i]-=b[i];
            ans+=b[i];
            b[i]=0;
        }
        if(a[i+1]<b[i]){
            ans+=a[i+1];
            b[i]-=a[i+1];
            a[i+1]=0;
        }
        else{
            a[i+1]-=b[i];
            ans+=b[i];
            b[i]=0;
        }
    }
    cout << ans << endl;
    return 0;
}


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

bool isAGCT(char c) {
  return (c == 'A' || c == 'G' || c == 'C' || c == 'T');
}

int main() {
  string S;
  cin >> S;
  S = 'X' + S;
  int N = S.size();
  int res = 0;
  for (int i = 0; i < N;) {
    if (!isAGCT(S[i])) {
      int j = i+1;
      while (j < N && isAGCT(S[j])) ++j;
      res = max(res, j - i - 1);
      i = j;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back

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

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

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

const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const long double PI = 3.14159265358979323846;

// ****************************************CODE***************************************//

int main(){
    int n,m,r;
    cin >> n >> m >> r;
    vector<int> R(r);
    vector<vector<int>> dist(n, vector<int>(n, 1e9));

    for (int i = 0; i < r; i++)
    {
        cin >> R[i];
        R[i]--;
    }

    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        dist[a][b] = c;
        dist[b][a] = c;
    }

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            for (int k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }

    sort(all(R));
    int ans = 1e9;
    do
    {
        int here = 0;
        for (int i = 0; i < r - 1; i++)
        {
            here += dist[R[i]][R[i+1]];
        }
        chmin(ans, here);
    }while(next_permutation(all(R)));

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll, ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define all(a) a.begin(), a.end()
#define rev(a) reverse(all(a)
#define ld long double
const ll mod=1e9+7;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
bool ispal(string s){
    int n=s.length();
    for(int i=0; i<n/2; i++){
        if(s[i]!=s[n-1-i]) return false;
    }
    return true;
}
int main() {
    ll n;
    cin >> n;
    ll x=n*n*n;
    ld ans=x/27.0;
    cout << fixed << setprecision(12) << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int i,j,q,f,e,co=0;
	char str[1000],re[100],rep[1000],letter,ans[1000][1000];
	
	scanf("%s",&str);
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%s %d %d",&re,&f,&e);
		if(re[2]=='p'){
			scanf("%s",&rep);
			for(j=0;j<e-f+1;j++){
				str[j+f]=rep[j];
			}
		}
		else if(re[2]=='v'){
			for(j=0;j<(e-f+1)/2;j++){
				letter=str[f+j];
				str[f+j]=str[e-j];
				str[e-j]=letter;
			}
		}
		else{
			co++;
			for(j=0;j<e-f+1;j++){
				
				ans[co-1][j]=str[j+f];
			}
		}
	}
	for(i=0;i<co;i++){
		for(j=0;j<1000;j++){
			if(ans[i][j]=='\0')break;
			printf("%c",ans[i][j]);
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2112
def gcc(x, y):
    if x == 0:return y
    return gcc(y % x, x)

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

g = 0

A.sort()

for item in A:
    g = gcc(g, item)

if g != 1:
    print("not coprime")
    exit()

primes = []

is_prime = [True] * 1100000

is_prime[0] = is_prime[1] = False

for i in range(2, 1100000):
    if not is_prime[i]:continue
    for j in range(i*i, 1100000, i):
        is_prime[j] = False

A_prime = [item for item in A if is_prime[item]]
A_notprime = [item for item in A if not is_prime[item]]

primes = [p for p in range(1100) if is_prime[p]]
used = [False] * 1100000

for item in A_prime:
    used[item] = True

for a in A_notprime:
    for p in primes:
        if a == 1:break
        if a % p != 0:continue

        if used[p]:
            print("setwise coprime")
            #互いに素でない（共通素因数pで割れる）ペアがAの中にあると，それはsetwise_coprime
            exit()

        used[p] = True

        while a % p == 0:
            a //= p

    if a > 1:
        if used[a]:
            print("setwise coprime")
            exit()
        used[a] = True


print("pairwise coprime")

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

int main(){
    
    cout<<fixed<<setprecision(6);
    
    int a,b;
    
    cin>>a>>b;
    
    cout<<a/b<<" ";
    
    cout<<a%b<<" ";
    
    cout<<(double)a/b<<endl;
    
    return 0;
}


Measured memory_bytes: 3256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 1000005
#define eps 1e-10
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,P;
int a[55];
int64 dp[55][2];
void Solve() {
    read(N);read(P);
    for(int i = 1 ; i <= N ; ++i) read(a[i]);
    dp[0][0] = 1;
    for(int i = 1 ; i <= N ; ++i) {
	int k = a[i] & 1;
	dp[i][0] = dp[i - 1][0];dp[i][1] = dp[i - 1][1];
	dp[i][k ^ 0] += dp[i - 1][0];
	dp[i][k ^ 1] += dp[i - 1][1];
    }
    out(dp[N][P]);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


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

using namespace std;

#define INF (1ll << 62)
#define pb push_back
#define ii pair<int,int>
#define OK cerr <<"OK"<< endl
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define endl '\n'

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

  int n;

  cin >> n;

  vector<int> dp(n + 1);
  vector<int> arr(n + 1);

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

  dp[2] = abs(arr[2] - arr[1]);
  for(int i = 3; i <= n; i++) {
  	dp[i] = min(abs(arr[i] - arr[i - 2]) + dp[i - 2], abs(arr[i] - arr[i - 1]) + dp[i - 1]);
  }

  cout << dp[n] << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
#define max(p,q)((p>q)?(p):(q))

int dp[10010];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	while(n--){
		int v,w;
		scanf("%d%d",&v,&w);
		for(int i=m-w;i>=0;i--)dp[i+w]=max(dp[i+w],dp[i]+v);
	}
	printf("%d\n",dp[m]);
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N = 3e5+50;
const ll oo = 1e18;
const ll mod = 1e9+7;

int main(){
    int n;
    cin>>n;
    if(n<1200)
        cout<<"ABC";
    else if(n<2800)
        cout<<"ARC";
    else
        cout<<"AGC";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

// GCC __gcd(long long A, long long B)

ll gcd(ll a, ll b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}

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

ll power(ll k, ll n, int M) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * k % M;
    k = k * k % M;
    n /= 2;
  }
  return res;
}

int main() {
  int N;
  int counter0 = 0;
  map<pair<ll, ll>, int> counter;
  map<pair<ll, ll>, bool> used;

  scanf("%d", &N);

  for (int i = 0; i < N; i++) {
    ll A, B;
    scanf("%lld%lld", &A, &B);

    if (A == 0 && B == 0) {
      counter0++;
      continue;
    }

    ll g = gcd(A, B);
    A /= g;
    B /= g;

    counter[{A, B}]++;
  }

  ll ans = 1;

  for (auto p : counter) {
    ll A = p.first.first;
    ll B = p.first.second;

    if (used[{A, B}]) continue;

    ll x = counter[{A, B}] + counter[{-A, -B}];
    ll y = counter[{B, -A}] + counter[{-B, A}];

    used[{A, B}] = true;
    used[{-A, -B}] = true;
    used[{B, -A}] = true;
    used[{-B, A}] = true;

    ll z = (power(2, x, mod) + power(2, y, mod) - 1) % mod;
    ans = z * ans % mod;

    debug(x, y, z);
  }

  printf("%lld\n", (ans + mod - 1 + counter0) % mod);

  return 0;
}

Measured memory_bytes: 103812
#include<stdio.h>
int main(void)
{
	int d,l,Jc;
	scanf("%d %d",&d,&l);
	Jc=0;
	while(d>0){
		if(d>=l){
			d=d-l;
			Jc++;
		}
		else{
			d=d-1;
			Jc++;
		}
//		if(d==0){
//			break;
//		}
	}
	printf("%d\n",Jc);
	return 0;
}


Measured memory_bytes: 2696
import java.util.*


fun main(args: Array<String>) {
    val ss = readLine()!!
    val q = getInt()

    val s: Deque<Char> = LinkedList()
    ss.forEach { s.addLast(it) }
    var reversed = false
    repeat(q) {
        val a = readLine()!!.split(" ")
        if (a[0][0] == '1') { // reverse
            reversed = !reversed
        } else {
            if (a[1][0] == '1') { // add ci to beginning
                if (reversed) {
                    s.addLast(a[2][0])
                } else {
                    s.addFirst(a[2][0])
                }
            } else { // add ci to end
                if (reversed) {
                    s.addFirst(a[2][0])
                } else {
                    s.addLast(a[2][0])
                }
            }
        }
    }

    if (reversed) {
        println(s.reversed().joinToString(""))
    } else {
        println(s.joinToString(""))
    }
}


fun getInt() = readLine()!!.toInt()
fun getInts() = readLine()!!.split(" ").map { it.toInt() }
fun getLong() = readLine()!!.toLong()
fun getLongs() = readLine()!!.split(" ").map { it.toLong() }


Measured memory_bytes: 80836