akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll fexp (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = fexp (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return fexp (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/gcd(num1,num2))*num2;}
// end of Template
int x,a,b;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>x>>a>>b;
    if( b-a > x)cout<<"dangerous\n";
    else if( b-a <= 0)cout<<"delicious\n";
    else cout<<"safe\n";
}


Measured memory_bytes: 256
def cross(c1, c2):
    return c1.real * c2.imag - c1.imag * c2.real

def dot(c1, c2):
    return c1.real * c2.real + c1.imag * c2.imag

def ccw(p0, p1, p2):
    a = p1 - p0
    b = p2 - p0
    cross_ab = cross(a, b)
    if cross_ab > 0:
        return 1
    elif cross_ab < 0:
        return -1
    elif dot(a, b) < 0:
        return 1
    elif abs(a) < abs(b):
        return -1
    else:
        return 0

def intersect(p1, p2, p3, p4):
    # p1 and p2 are end points of a segment.
    # p3 and p4 are end points of the other segment.
    if (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0) and \
       (ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0):
        return True
    else:
        return False

def get_distance_sp(sp1, sp2, p):
    a = sp2 - sp1
    b = p - sp1
    if dot(a, b) < 0:
        return abs(b)
    c = sp1 - sp2
    d = p - sp2
    if dot(c, d) < 0:
        return abs(d)
    return abs(cross(a, b)) / abs(a)

def print_distance(p1, p2, p3, p4):
    # parameters are the same as intersect.
    if intersect(p1, p2, p3, p4):
        print("0.0000000000")
    else:
        d = min(get_distance_sp(p1, p2, p3), get_distance_sp(p1, p2, p4),
                get_distance_sp(p3, p4, p1), get_distance_sp(p3, p4, p2))
        print("{0:.10f}".format(d))
        
n = int(input())
for line in range(n):
    x_p0, y_p0, x_p1, y_p1, x_p2, y_p2, x_p3, y_p3 = map(int, input().split())
    p0 = x_p0 + y_p0 * 1j
    p1 = x_p1 + y_p1 * 1j
    p2 = x_p2 + y_p2 * 1j
    p3 = x_p3 + y_p3 * 1j
    print_distance(p0, p1, p2, p3)



Measured memory_bytes: 5664
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define all(v)           ((v).begin()), ((v).end())
#define sz size()
#define clr(v,d)         memset(v,d,sizeof(v))
#define rep(i, v)        for(int i=0;i<(v).sz;++i)
#define lp(i, n)         for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)     for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)     for(int i=(j);i>=(int)(n);--i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define sci(a)	scanf("%d",&a)
#define scii(a, b)	scanf("%d%d",&a, &b)
#define pri(a)	printf("%d\n",a)
#define prii(a, b)	printf("%d %d\n",a, b)
#define DB1(a)          std::cout<<#a<<"="<<(a)<<endl
#define DB2(a,b)        std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<endl
#define DB3(a,b,c)      std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<endl
#define DB4(a,b,c,d)    std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<endl
#define DB5(a,b,c,d,e)  std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<endl
typedef pair<int, int> pii;
typedef long long ll;
const ll  inf = 1000000000000000000LL;
const double EPS = 1e-9;
const ll mod = 1000000007ll;
#define PI acos(-1)

const int maxn = 300500;

int a[maxn];

int main(){
	int n;
	sci(n);
	lp(i, n) sci(a[i]);
	deque<int> cur;
	lp(i, n){
		if (i % 2) cur.push_front(a[i]);
		else cur.push_back(a[i]);
	}
	if (n % 2 == 1) for (int i = n - 1; i >= 0; i--) printf("%d ", cur[i]);
	else lp(i, n)	 printf("%d ", cur[i]);
}



Measured memory_bytes: 3840
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<numeric>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int INF=1e9+7;
const int MOD=998244353;
const int N = 1e6 + 5;
const ll inv2=499122177;
const double pi=acos(-1);
int main()
{
	double a,b,x,k;
	cin>>a>>b>>x;
	k=x/a;
	if(a*b/2>=k)
	{
		double l=2*k/b;
		printf("%.10f\n",90-atan(l/b)*180/pi);
	}
	else
	{
		double l=(a*b-k)*2/a;
		printf("%.10f\n",(atan(l/a)*180/pi));

	}
    return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main() {
	long long K;
	cin >> K;
	queue<long long > q;
	for (int i = 1; i <= 9; i++) q.push(i);
	while(!q.empty()){
		long long x=q.front(); q.pop();
		K--;
		if (K == 0){cout << x << endl; break; }
		for (int y = (x % 10) - 1; y <= (x % 10) + 1; y++) {
			if (y < 0 || y >= 10) continue;
			q.push(x * 10 + (long long)y);
		}
	}
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

#define N 10000

int check(int);
int i,j,n,q,S[N],T[N],count=0;


int main(){


  scanf("%d",&n);

  for(i=0;i<n;i++){
      scanf("%d",&S[i]);
  }
   
  scanf("%d",&q);

   for(j=0;j<q;j++){
     scanf("%d",&T[j]);
     for(i=0;i<n;i++){
       if(S[i] == T[j]){
	 count++;
	 break;
       }
     }
   }

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

   return 0;
     
}

Measured memory_bytes: 2736
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(void){
    int n; cin >> n;
    ll f[n][10], p[n][11];

    for(int i=0;i<n;i++){
        for(int j=0;j<10;j++){
            cin >> f[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<11;j++){
            cin >> p[i][j];
        }
    }    

    vector<ll>cnt(n,0);
    ll tmp, ans=-1*pow(10,10);

    for(int i=1;i<(1<<10);i++){
        tmp=0;
        for(int j=0;j<n;j++){
            cnt[j]=0;
        }
        for(int j=0;j<n;j++){
            for(int k=0;k<10;k++){
                if((i>>k&1)==1 && f[j][k]==1) cnt[j]++;
            }
        }

        for(int j=0;j<n;j++){
            tmp += p[j][cnt[j]];
        }

        if(ans<tmp){
            // cout << bitset<10>(i) << "  ";
            // for(int j=0;j<n;j++) cout << cnt[j] << '-' << p[j][cnt[j]] << ' ';
            // cout <<tmp<< endl;
            ans = tmp;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i, j;
	int h, m, s;
	char hms[8][8];
	int t, t3;
	
	while (scanf("%d %d %d", &h, &m, &s), h != -1 || m != -1 || s != -1){
		t = 7200;
		t -= (h * 3600) + (m * 60) + s;
		t3 = t * 3;
		h = t / 3600;
		t %= 3600;
		m = t / 60;
		t %= 60;
		s = t;
		for (i = 0; i < 3; i++){
			for (j = 0; j < 2; j++){
				if (i == 0){
					hms[i][j] = h / (10 - j * 9) + '0';
					h %= 10;
				}
				if (i == 1){
					hms[i][j] = m / (10 - j * 9) + '0';
					m %= 10;
				}
				if (i == 2){
					hms[i][j] = s / (10 - j * 9) + '0';
					s %= 10;
				}
			}
			hms[i][j] = '\0';
		}
		printf("%s:%s:%s\n", hms[0], hms[1], hms[2]);
		h = t3 / 3600;
		t3 %= 3600;
		m = t3 / 60;
		t3 %= 60;
		s = t3;
		for (i = 0; i < 3; i++){
			for (j = 0; j < 2; j++){
				if (i == 0){
					hms[i][j] = h / (10 - j * 9) + '0';
					h %= 10;
				}
				if (i == 1){
					hms[i][j] = m / (10 - j * 9 )+ '0';
					m %= 10;
				}
				if (i == 2){
					hms[i][j] = s / (10 - j * 9) + '0';
					s %= 10;
				}
			}
			hms[i][j] = '\0';
		}
		printf("%s:%s:%s\n", hms[0], hms[1], hms[2]);
	}
	
	return (0);
}

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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);


  ll a,b;cin>>a>>b;
  if(a>b)swap(a,b);
  if((b-a)%2==0){
    cout<<(b+a)/2<<endl;
  }else
  {
    puts("IMPOSSIBLE");
  }
  
  
  return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

// https://atcoder.jp/contests/abc167/tasks/abc167_a
public class Main {

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

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		sc.close();



		if(s.equals(t.substring(0, s.length()))) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}


	}
}


Measured memory_bytes: 27000
#include <iostream>


using namespace std;

 

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


Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

int main() {
	int A, B, Q;
	cin >> A >> B >> Q;

	vector<long long> j(A+2);
	vector<long long> t(B+2);

	j[0] = LLONG_MIN / 4;
	t[0] = LLONG_MIN / 4;
	j[j.size() - 1] = LLONG_MAX / 4;
	t[t.size() - 1] = LLONG_MAX / 4;

	for(int i = 1; i < j.size() - 1; i++) cin >> j[i];
	for(int i = 1; i < t.size() - 1; i++) cin >> t[i];

	for(int i = 0; i < Q; i++) {
		long long p;
		cin >> p;
		auto j_it = lower_bound(j.begin(), j.end(), p);
		auto t_it = lower_bound(t.begin(), t.end(), p);

		long long j_l, j_r, t_l, t_r;
		j_l = *(j_it - 1);
		j_r = *j_it;
		t_l = *(t_it - 1);
		t_r = *t_it;

		long long c = LLONG_MAX;

		// s l
		c = min(c, p - min(j_l, t_l));
		// s r
		c = min(c, max(j_r, t_r) - p);
		// l 2 r
		// tera first
		c = min(c, p - t_l + (j_r - t_l));
		// jinja first
		c = min(c, p - j_l + (t_r - j_l));
		// r 2 l
		//tera first
		c = min(c, t_r - p + (t_r - j_l));
		//jinja first
		c = min(c, j_r - p + (j_r - t_l));

		cout << c << endl;
	}

}


Measured memory_bytes: 2944
//1W152348 Yuta MATSUSHIMA
#include <stdio.h>
#define SIZE 110

int main(void){
	int i, j, k, temp, A[SIZE], N;
	int count = 0;
	scanf("%d", &N);

	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}

	for(i = 0; i < N; i++){
		for(j = N - 1; j > i; j--){
			if(A[j - 1] > A[j]){
				temp = A[j];
				A[j] = A[j - 1];
				A[j - 1] = temp;
				count++;
			}
		}
	}

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

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

int main() {
  int N, K;
  cin >> N >> K;
  double ans = 0.0;
  for (int i = 1; i <= N; ++i) {
    int now = i;
    double prob = 1.0 / N;
    while (now < K) {
      now *= 2;
      prob /= 2.0;
    }
    ans += prob;
  }
  cout << setprecision(12) << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        String s[] = new String[h + 2];
        s[0] = "";
        s[h + 1] = "";
        for (int i = 0; i < w + 2; i++) {
            s[0] += " ";
            s[h + 1] += " ";
        }
        for (int i = 1; i < h + 1; i++) {
            s[i] = " " + sc.next() + " ";
        }
        char c[][] = new char[h][w];

        for (int i = 1; i < h + 1; i++) {
            for (int j = 1; j < w + 1; j++) {
                if (s[i].charAt(j) == '#') {
                    c[i - 1][j - 1] = '#';
                } else {
                    int count = 0;
                    if (s[i - 1].charAt(j - 1) == '#') {
                        count++;
                    }
                    if (s[i - 1].charAt(j) == '#') {
                        count++;
                    }
                    if (s[i - 1].charAt(j + 1) == '#') {
                        count++;
                    }
                    if (s[i].charAt(j - 1) == '#') {
                        count++;
                    }
                    if (s[i].charAt(j + 1) == '#') {
                        count++;
                    }
                    if (s[i + 1].charAt(j - 1) == '#') {
                        count++;
                    }
                    if (s[i + 1].charAt(j) == '#') {
                        count++;
                    }
                    if (s[i + 1].charAt(j + 1) == '#') {
                        count++;
                    }
                    c[i - 1][j - 1] = (char)(count + '0');
                }
            }
        }
        for (int i = 0; i < h; i++) {
            System.out.println(c[i]);
        }
    }
}


Measured memory_bytes: 23380
#include<iostream>
#include<cmath>
using namespace std;
int f[10000009];
int s[10000009];
int fa(int a){
    if(f[a]==a)
    return a;
    return f[a]=fa(f[a]);
}
int main(){
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    f[i]=i;
    for(int i=1;i<=m;i++){
        int x,y;
        cin>>x>>y;
        int xx=fa(x);
        int yy=fa(y);
        if(xx!=yy){
            f[fa(xx)]=fa(yy);
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
         s[fa(i)]++;
         ans=max(ans,s[f[i]]);
    }
    cout<<ans<<endl;
    system("pause");
}

Measured memory_bytes: 7096
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

int MOD = 2019;

class mint {
  int n;
public:
  mint(int n_ = 0) : n(n_) {}
  explicit operator int() { return n; }
  friend mint operator-(mint a) { return -a.n + MOD * (a.n != 0); }
  friend mint operator+(mint a, mint b) { int x = a.n + b.n; return x - (x >= MOD) * MOD; }
  friend mint operator-(mint a, mint b) { int x = a.n - b.n; return x + (x < 0) * MOD; }
  friend mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
  friend mint &operator+=(mint &a, mint b) { return a = a + b; }
  friend mint &operator-=(mint &a, mint b) { return a = a - b; }
  friend mint &operator*=(mint &a, mint b) { return a = a * b; }
  friend bool operator==(mint a, mint b) { return a.n == b.n; }
  friend bool operator<(mint a, mint b) { return a.n < b.n; }
  friend bool operator!=(mint a, mint b) { return a.n != b.n; }
  friend istream &operator>>(istream &i, mint &a) { return i >> a.n; }
  friend ostream &operator<<(ostream &o, mint a) { return o << a.n; }
};

mint modinv(mint n) {
  int a = (int)n, b = MOD;
  int s = 1, t = 0;
  while (b != 0) {
    int q = a / b;
    a -= q * b;
    s -= q * t;
    swap(a, b);
    swap(s, t);
  }
  return s >= 0 ? s : s + MOD;
}


int main() {

  int N;
  string S; cin >> S;
  N=S.size();

  map<mint, ll> mp;
  mp[0]++;
  mint s = 0;
  mint p = 1;
  ll ans = 0;
  for (char c : S) {
    s = s * 10 + (c - '0');
    p *= modinv(10);
    ans += mp[s * p]++;
  }
  cout << ans << endl;
}


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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T> constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }

template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& a) { return is >> a.first >> a.second; }
template<typename T> istream& operator>>(istream& is, vector<T>& a) { for (T& x : a) is >> x; return is; }

void LOG(const int& x) { cerr << x << "\n"; }
template<typename T> void LOG(const vector<T>& a) { for (const T& x : a) cerr << x << " "; cerr << "\n"; }
template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }
template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }

i64 ceil(i64 a, i64 b) { return (a - 1) / b + 1; }
i64 gcd(i64 a, i64 b) { while (b != 0) { i64 t = b; b = a % b; a = t; } return a; }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
i64 gcd(const vector<i64>& v) { return accumulate(ALL(v), 1LL, static_cast<i64(*)(i64, i64)>(gcd)); }
i64 lcm(const vector<i64>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<i64(*)(i64, i64)>(lcm)); }
i64 pow(i64 x, i64 y, i64 z) { i64 a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
i64 inv(i64 x, i64 m) { return pow(x, m - 2, m); }

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

const i64 M = 1000000007;
signed main() {
  i64 N;
  cin >> N;
  for (i64 i = 1; i <= N - 1; ++i) {
    for (i64 j = i + 1; j <= N; ++j) {
      i64 d = j - i;
      if (d % 2 == 1) {
        cout << 1 << " ";
      } else {
        i64 a = 0;
        while (d % 2 == 0) {
          d /= 2;
          a += 1;
        }
        cout << (1 + a) << " ";
      }
    }
    cout << "\n";
  }
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <utility>
#include <map>
#include <vector>
using namespace std;

int n, m, k;
string o;
vector<pair<string, vector<string> > > mix;
map<string, int> item;

int sum(vector<string> s) {
	int p = 0;
	for (int i = 0; i < s.size(); i++) {
		p += item[s[i]];
	}
	return p;
}

void update() {
	int p;
	for (int i = 0; i < m; i++) {
		p = sum(mix[i].second);
		if (p < item[mix[i].first]) {
			item[mix[i].first] = p;
		}
	}
}

int main(){
	while (cin >> n && n != 0) {
		item = map<string, int>();
		for (int i = 0; i < n; i++) {
			cin >> o >> k;
			item[o] = k;
		}
		cin >> m;
		mix = vector<pair<string, vector<string> > >(m);
		for (int i = 0; i < m; i++) {
			cin >> mix[i].first >> k;
			for (int j = 0; j < k; j++) {
				cin >> o;
				mix[i].second.push_back(o);
			}
		}
		for (int i = 0; i < 10000; i++) {
			update();
		}
		cin >> o;
		cout << item[o] << endl;
	}

	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

const ll mod = 1000000007LL;
string s[2];

int main(void){
	int n;
	cin >> n;
	rep(i,2) cin >> s[i];

	ll ans = 1LL,start = 1;
	
	if(s[0][0]==s[1][0])
		ans = 3LL;
	else
		ans = 6LL,start++;

	rep(i,start,n){
		if(s[0][i-1]==s[1][i-1]){
			if(s[0][i]==s[1][i]){
				ans = 2LL * ans % mod;
			}else{
				ans = 2LL * ans % mod;
				i++;
			}
		}else{
			if(s[0][i]==s[1][i]){
				ans = 1LL * ans % mod;
			}else{
				ans = 3LL * ans % mod;
				i++;
			}
		}
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
S = input()
li = [-1]
ans = 0
for index,i in enumerate(S):
    if(i!='A' and i!='C' and i!='G' and i!='T'):
        li.append(index)
li.append(len(S))
if(len(li)==1):
    print(len(S))
else:
    for index,i in enumerate(li):
        if(not index==0):
            ans = max(ans,li[index]-li[index-1]-1)

    print(ans)


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

#define int long long

int pow(int v, int p);

signed main() {
  int X, Y;
  cin >> X >> Y;
  int ans = 0;
  const int m = 1e9+7;
  for (int i = 0; i <= X; i++) {
    int x = X - i;
    int y = Y - i * 2;
    if (y * 2 != x) continue;
    int s = i+y;
    int t = 1;
    int u = 1;
    for (int j = 1; j <= i; j++) {
      t = (t * s) % m;
      u = (u * j) % m;
      s--;
    }
    ans += t * pow(u, m-2) % m;
    ans %= m;
  }
  cout << ans << endl;
  return 0;
}

int pow(int v, int p) {
  const int m = 1e9+7;
  if (p==0) return 1;
  if (p%2==0) return pow(v*v%m,p/2);
  return v*pow(v,p-1)%m;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main
{
  public static void main(String[] args) { new Main(); }
  Scanner in = new Scanner(System.in);
  PrintWriter out = new PrintWriter(System.out);
  
  int n, cnt = 0;
  
  Main()
  {
   	n = in.nextInt();
    for (int i = 1; i <= n; i++)
      	if (in.nextInt() != i) cnt++;
    if (cnt == 0 || cnt == 2) out.println("YES");
    else out.println("NO");
    out.close();
  }
}


Measured memory_bytes: 22224
#include <cstdio>
#include <cstdlib>
#include <iostream>

using namespace std;

const int N = 1000000;

int num[N];

void init() {
	num[0] = num[1] = 0;
	for (int i=2; i<N; ++i) num[i] = 1;
	for (int i=2; i<1000; ++i) {
		if (num[i * i]) {
			int j = i + i;
			for (;j < N; num[j] = 0, j += i); 
		}
	}
	for (int i=1; i<N; ++i) num[i] += num[i-1];
}

int main() {
	int n;
	init();
	while (scanf("%d", &n) != EOF) {
		printf ("%d\n", num[n]);
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <iostream>
#include <queue>
using namespace std;

#define NODE_NUM 100

queue<int> que;

class Node
{
private:
	int next_num;
	int next_node_list[NODE_NUM];
public:
	Node();
	void AddNextNode(int id);
	bool Search(int id);
	int dist;
	int check[NODE_NUM + 1];
};

Node::Node()
{
	next_num = 0;
	dist = -1;
	for (int i = 1; i <= NODE_NUM; i++) {
		check[i] = 0;
	}
}

void Node::AddNextNode(int id)
{
	next_node_list[next_num] = id;
	next_num++;
}

Node Node_list[NODE_NUM + 1];

bool Node::Search(int id)
{
	for (int k = 0; k < next_num; k++) {
		if (Node_list[next_node_list[k]].dist == -1) {
			Node_list[next_node_list[k]].dist = dist + 1;
		}
	}

	for (int i = 0; i < next_num; i++) {
		if (next_node_list[i] == id) return true;
	}
	
	for (int j = 0; j < next_num; j++) {
		if (Node_list[next_node_list[j]].check[id] == 0) {
			Node_list[next_node_list[j]].check[id] = 1;
			que.push(next_node_list[j]);
		}
	}
	
	return false;
}

int main(void)
{
	//input
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int u, k;
		cin >> u;
		cin >> k;
		Node_list[u] = Node();
		for (int j = 0; j < k; j++) {
			int v;
			cin >> v;
			Node_list[u].AddNextNode(v);
		}
	}
	
	//dist
	Node_list[1].dist = 0;
	for (int i = 2; i <= n; i++) {
		bool ret = Node_list[1].Search(i);
		while (!ret && !que.empty()) {
			ret = Node_list[que.front()].Search(i);
			que.pop();
		};
		while (!que.empty()) {
			que.pop();
		}
	}

	//output
	for (int i = 1; i <= n; i++) {
		cout << i << " " << Node_list[i].dist << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 3208
V=10**5+5
class UnionFind:
    def __init__(self,n):
        self.parent=[i for i in range(n)]
        self.rank=[0 for _ in range(n)]
        # use for n=2*V
        self.xSize=[1 if i<V else 0 for i in range(n)]
        self.ySize=[0 if i<V else 1 for i in range(n)]

    def find(self,x):
        if self.parent[x]==x:
            return x
        else:
            parentx=self.find(self.parent[x])
            self.parent[x]=parentx
            return parentx

    def union(self,x,y):
        rootx=self.find(x)
        rooty=self.find(y)
        if rootx==rooty:
            return
        if self.rank[rootx]>self.rank[rooty]:
            self.parent[rooty]=rootx
            self.xSize[rootx]+=self.xSize[rooty]
            self.ySize[rootx]+=self.ySize[rooty]
        else:
            self.parent[rootx]=rooty
            self.xSize[rooty]+=self.xSize[rootx]
            self.ySize[rooty]+=self.ySize[rootx]
            if self.rank[rootx]==self.rank[rooty]:
                self.rank[rooty]+=1

n=int(input())
xy=[tuple(map(int,input().split())) for _ in range(n)]
uf=UnionFind(V*2)
for xi,yi in xy:
    uf.union(xi,yi+V)

# for i in range(V*2):
#     uf.find(i)

ans=0
used=set()
for i in range(V*2):
    rooti=uf.find(i)
    if rooti not in used:
        used.add(rooti)
        ans+= uf.xSize[rooti]*uf.ySize[rooti]
print(ans-n)


Measured memory_bytes: 47032
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int N=cin.nextInt();
        int K=cin.nextInt();
        int[] a=cin.ArrayInt(N,0);
        long[] b=new long[N+1];
        double ans=0;
        long max=0;
        for(int i=1;i<N+1;i++)b[i]=a[i-1]+b[i-1]+1;
        for(int i=K;i<N+1;i++)max=Math.Max(max,b[i]-b[i-K]);
        ans=(double)max/2;
        Console.WriteLine(ans);
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

Measured memory_bytes: 29532
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

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

  if(s.size()==2){
	cout << s << endl;
  }else{
	reverse(s.begin(),s.end());
	cout << s<< endl;
  }
  
  return 0;

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int iti,go,juu,gojuu,hyaku,gohyaku,s;
    cin>>iti>>go>>juu>>gojuu>>hyaku>>gohyaku;
    s=iti+go*5+juu*10+gojuu*50+hyaku*100+gohyaku*500;
    if(s>=1000){
        cout<<"1"<<endl;
    }else{
    cout<<"0"<<endl;
    }
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long 
#define INF 1e9
#define LINF 1e18
 
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;
typedef pair<P, P> PP;
 
const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };
 
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int dp[41][401][401];

signed main() {
    int N, Ma, Mb;
    cin >> N >> Ma >> Mb;

    int a[41], b[41], c[41];
    for(int i = 0; i < N; ++i) cin >> a[i] >> b[i] >> c[i];

    for(int k = 0; k <= N; ++k) {
        for(int i = 0; i < 401; ++i) {
            for(int j = 0; j < 401; ++j) {
                dp[k][i][j] = INF;
            }
        }
    }
    dp[0][0][0] = 0;
    for(int k = 0; k < N; ++k) {
        for(int i = 0; i < 401; ++i) {
            for(int j = 0; j < 401; ++j) {
                if(dp[k][i][j] == INF) continue;
                chmin(dp[k + 1][i][j], dp[k][i][j]);
                chmin(dp[k + 1][i + a[k]][j + b[k]], dp[k][i][j] + c[k]);
            }
        }
    }
    int res = INF;
    for(int i = 1; i < 401; ++i) {
        for(int j = 1; j < 401; ++j) {
            if(Mb * i == Ma * j) chmin(res, dp[N][i][j]);
        }
    }
    cout << ((res == INF) ? -1 : res) << endl;
    return 0;
}

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

template<typename T, typename U> void cmax(T &a, U b) { if (a < b) a = b; }
template<typename T, typename U> void cmin(T &a, U b) { if (a > b) a = b; }

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

  long N;
  cin >> N;
  vector<long> A(N), B(N);
  for (long i = 0; i < N; i++) cin >> A.at(i);
  for (long i = 0; i < N; i++) cin >> B.at(i);

  long X = 0, Y = 0;
  for (int i = 0; i < N; i++) {
    if (A.at(i) < B.at(i)) X += (B.at(i) - A.at(i)) / 2;
    else Y += A.at(i) - B.at(i);
  }

  if (Y > X) return cout << "No" << "\n", 0;
  cout << "Yes" << "\n";
}

Measured memory_bytes: 3764
n = int(input())
v = [int(x) for x in input().split()]
big = 10**5+1
even = [0] * big
odd = [0] * big
for i in range(big):
    even[i] = [0] * 2
    odd[i] = [0]*2
    even[i][1] = i
    odd[i][1] = i

for j in range(n):
    if j % 2 == 0:
        even[v[j]][0] += 1
    else:
        odd[v[j]][0] += 1

even = sorted(even, reverse=True)
odd = sorted(odd, reverse=True)

ans = 0
if even[0][1] == odd[0][1]:
    ans = min(n - odd[0][0] - even[1][0], n - even[0][0] - odd[1][0])
else:
    ans = n - even[0][0] - odd[0][0]
print(ans)


Measured memory_bytes: 32528
#include<iostream>
using namespace std;
int A[100];
void print(int A[], int n)
{
	for (int i = 0; i < n-1; ++i)
	{
		cout<<A[i]<<" ";
	}
	cout<<A[n-1]<<endl;
}

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

 	int cnt = 0;
 	for (int i = 0; i < n; ++i)
 	{
 		int minj = i;
 		for (int j = i; j < n; ++j)
 		{
 			if(A[j] < A[minj]) 
 			{
 				minj = j;
 			}

 		}
 		if(minj != i)
 		{
 			int temp;
			temp = A[i];
			A[i] = A[minj];
			A[minj] = temp;
			cnt++;
		}

 	}

 	print(A,n);
 	cout<<cnt<<endl;
 	return 0;
 }

Measured memory_bytes: 3076
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int H[100010];
    rep(i, n) cin >> H[i];
    int ans = 0;
    int len = 0;
    rep(i, n - 1) {
        if(H[i] >= H[i + 1]) len++;
        else len = 0;
        ans = max(ans, len);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)2e5 + 5;

int H, W, K;
vector<string> c;

ll f(int sy, int sx, vector<string> c) {
	bool update;
	ll res = 0;
	c[sy][sx] = '0';
	rep(i, 100) {
		if (test) {
			cout << endl;
			rep(i, H) cout << c[i] << endl;
			dump(res);
		}
		rep(j, W) for (int k = H - 1; k > -1; k--) {
			if (c[k][j] != '0') continue;
			for (int l = k; l > -1; l--)  {
				if (c[l][j] != '0') {
					c[k][j] = c[l][j];
					c[l][j] = '0';
					break;
				}
			}
		}
		if (test) {
			cout << endl;
			rep(i, H) cout << c[i] << endl;
		}
		update = false;
		rep(j, H) rep(begin, W) {
			if (c[j][begin] == '0') continue;
			int end = begin;
			while (c[j][end] == c[j][begin] && end < W) end++;
			if (end - begin < K) continue;
			REP(k, begin, end) {
				update = true;
				res += (c[j][k] - '0') * (1 << i);
				c[j][k] = '0';
			}
		}

		if (not update) {
			return res;
		}
	}
}

int main() {
	cin >> H >> W >> K;
	c.resize(H);
	rep(i, H) cin >> c[i];
	ll best = 0;
	rep(sy, H) rep(sx, W) {
		ll tmp = f(sy, sx, c);
		if (best < tmp) best = tmp;
	}
	cout << best << endl;
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <fstream>
#include<iostream>
#include <cmath>
#include <chrono>
#include <thread>
#include <stack>
#include <memory.h>
#include <numeric>  
#include <iostream>
#include<climits>

//  vector<vector<int>> b(row_size, vector<int>(col_size,n));   //  n->initialized value

#define MOD 1000000007LL
#define ff first
#define fs second
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<long long>
#define vvi vector< vector <int> >
#define vpii vector< pair<int, int> >
#define pii pair<int,int>
#define mii map<int, int>
#define mp make_pair
#define tc                int T;cin>>T;while(T--)
#define fast_io            ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int

using namespace std;

vector<string> order;
map<string, bool> state;
map<string, vector<string>> path;


int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int a, b; cin >> a>> b;
	vector<vector<char>> grid(a, vector<char> (b));
	vector<vector<ll>> paths(a, vector<ll> (b,0));
	for (auto& row : grid)for (auto& d : row)cin >> d;
	paths[0][0] = 1;
	for (int i = 1; i < b; i++)if (grid[0][i - 1] == '.')paths[0][i] = paths[0][i-1];
	for (int i = 1; i < a; i++)if (grid[i][0] == '.')paths[i][0] = paths[i-1][0];
	for(int i=1;i<a;i++)
		for(int j=1;j<b;++j)
			if (grid[i][j] != '#') {
				if (grid[i][j - 1] != '#')paths[i][j] += paths[i][j - 1];
				if (grid[i-1][j] != '#')paths[i][j] += paths[i-1][j];
				paths[i][j] %= 1000000000 + 7;
			}
	cout << paths[a - 1][b - 1];

	return 0;

}


Measured memory_bytes: 9088
X[2001];i,p,g;main(N,S){for(;scanf(S="%d\n",&N)*N;printf(S,g)){for(g=i=0;i<=N+*X;p=1)scanf(S,X+i++);for(i=0;i++<*X;g=g|p<N?g:i)p+=X[N+i],p+=p<N?X[p]:0;}}

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

const ll INF = 1LL << 60;

vector<ll> calc_divisor(ll n) {
    vector<ll> res;
    for (ll i = 1LL; i*i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            ll j = n / i;
            if (j != i) res.push_back(j);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

ll N, M;

int main() {
    cin >> N >> M;
    vector<ll> v = calc_divisor(M);

    reverse(v.begin(), v.end());
    ll ans = 0;
    rep(i, v.size()) {
        // cout << v[i] << endl;
        if (M % v[i] == 0) {
            ll tmp = M / v[i];
            if (tmp >= N) {
                ans = v[i];
                break;
            }
        }
    }
    cout << ans << endl;
}

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

int getLCS(char*, char*);

main(){
	char x[1001], y[1001];
	int q, i;

	scanf("%d", &q);
	for (i = 0; i < q; i++){
		scanf("%s%s", x, y);
		printf("%d\n", getLCS(x, y));
	}
	return 0;
}

int getLCS(char *x, char *y){
	int i, j, lenX, lenY;
	static int C[1001][1001]= {{0}};

	lenX = strlen(x);
	lenY = strlen(y);

	for (i = 1; i <= lenX; i++){
		for (j = 1; j <= lenY; j++){
			if (x[i-1] == y[j-1]) C[i][j] = C[i-1][j-1] + 1;
			else C[i][j] = ((C[i-1][j] >=  C[i][j-1])?  C[i-1][j] : C[i][j-1]);
		}
	}

	return C[lenX][lenY];
}

Measured memory_bytes: 4520
#include<bits/stdc++.h>
using namespace std;
int calc(int c,int h,int w){
   return max({h*c,h/2*(w-c),(h/2+1)*(w-c)})- min({h*c,h/2*(w-c),(h/2+1)*(w-c)});
}
int main(){
  int h,w;
  cin>>h>>w;
  if(h%3==0||w%3==0){
     cout<<0; 
  }else{
     int a=0,b=h*w/3;
     a=min((h%2)?h:h/2,(w%2)?w:w/2); 
     if(h%2&&w%2)
        a=min({a,calc(b/h,h,w),calc(b/h+1,h,w),calc(b/w,w,h),calc(b/w+1,w,h)});
     cout<<a;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

template <typename T> inline void voutput(T &v){
    rep(i, v.size()){
        if (i) cout << " " << v[i];
        else cout << v[i];
    }
    cout << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    string s;
    cin >> s;
    string a = "";
    rep(i, s.size()) {
        if(s[i] != 'x') a += s[i];
    }
    string b = a;
    reverse(all(b));
    if(a != b){
        output(-1);
        return 0;
    }
    
    vector<int> A;
    char c = 'a';
    rep(i, s.size()){
        if(c != 'x'){
            A.pb(0);
        }
        else{
            A.back()++;
        }
        c = s[i];
    }
    if(c != 'x'){
        A.pb(0);
    }
    else{
        A.back()++;
    }
//    voutput(A);
    int ret = 0;
    int sz = (int)A.size();
    rep(i, (sz + 1) / 2) {
        ret += max(A[i], A[sz - 1 - i]) - min(A[i], A[sz - 1 - i]);
    }
    output(ret);
    
    
    return 0;
}


Measured memory_bytes: 1228
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <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 <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  cout << (a + b - 1) / b << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=4000;
typedef double ld;
const ld PI=acos(-1);
typedef complex<ld>C;
C c[N],ans;
int n,L;
int main(){
#ifdef ONLINE_JUDGE
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#endif
	cin>>n>>L;
	for(int i=1;i<=n;++i){
		int x;cin>>x;
		c[i]=C(cos(x*PI/L),sin(x*PI/L));
	}
	for(int i=1;i<=n;++i){
		C tmp(0,0),sum(0,0);
		for(int j=i+1;j<=n;++j){
			ans+=tmp*c[j];
			tmp+=c[j];
			sum+=tmp-C(j-i,0)*c[j];
		}
		ans+=sum*c[i];
	}
	long long count=1ll*n*(n-1)*(n-2)/6;
	cout<<setprecision(15)<<ans.real()/count<<' '<<ans.imag()/count<<endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ; 
# define pb push_back
# define ll long long
# define mp make_pair 
# define endl "\n"
# define vi vector<int>
# define vc vector<char>
# define vll vector<ll> 
# define pi pair<int,int> 
const int MOD = 1e9 + 7 ; 
const ll inf = 1e18 ; 


int main() {
	int n ;
	cin >> n ; 
	vc a(n) ; 
	vi cnt1(n+1) ;
	vi cnt2(n+1) ;  
	for(int i = 0 ; i < n ; ++i){
		cin >> a[i] ; 
	}
	for(int i = 0 ; i < n ; ++i) {
		if(a[i] == '.')
			cnt1[i+1] = 1; 
		else 
			cnt2[i+1] = 1 ; 
	}
	for(int i = 1 ; i <= n ; ++i) {
		cnt1[i] += cnt1[i-1] ; 
		cnt2[i] += cnt2[i-1] ; 
	}
	int ans = n ; 
	for(int i = 0 ; i <=  n ; ++i) {
		//cout << cnt2[i] << " " << cnt1[i] << endl ; 
		ans = min(ans , cnt2[i] + cnt1[n] -  cnt1[i]) ;  
	}
	cout << ans ; 

	return 0; 
}


Measured memory_bytes: 5108
#!/mnt/c/Users/moiki/bash/env/bin/python
# FROM: https://atcoder.jp/contests/abc110/submissions/3364130
# N,M = map(int, input().split())
from collections import defaultdict
import math

N,m=map(int,input().split())
primelist = defaultdict(int)
MOD = 10**9+7

for i in range(2,10**5):
    s = 0
    while m%i == 0 and m > 1:
        m = m //i
        s += 1
    if s>0:
        primelist[i] = s

if m>1: # residual 
    primelist[10**9] = 1 # only this divisor cannot be detected above

def comb(n,k):
    res = 1
    for i in range(1,1+k):
        res = res * (n-i+1)
        res %= MOD
        res *= pow(i, MOD-2, MOD)
    return res
ans = 1
# print(primelist.items())
for l,t in primelist.items(): # for defaultdict
    ans *= comb(N-1+t, t)
    ans %= MOD
print(ans)


Measured memory_bytes: 38896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll solve(ll a[],ll b[],ll c[],int s,int e,ll dp[][3],int prev){
	if(s>e)
	return 0;
	if(prev>=0&&dp[s][prev]!=-1)
	return dp[s][prev];
	ll so1=0,so2=0,so3=0;
	if(prev==-1){
		so1=a[s]+solve(a,b,c,s+1,e,dp,0);
		so2=b[s]+solve(a,b,c,s+1,e,dp,1);
		so3=c[s]+solve(a,b,c,s+1,e,dp,2);
		max(so1,max(so2,so3));
	}
	else{
		if(prev==0){
			so2=b[s]+solve(a,b,c,s+1,e,dp,1);
			so3=c[s]+solve(a,b,c,s+1,e,dp,2);
		}
		else if(prev==1){
			so1=a[s]+solve(a,b,c,s+1,e,dp,0);
			so3=c[s]+solve(a,b,c,s+1,e,dp,2);
		}
		else{
			so1=a[s]+solve(a,b,c,s+1,e,dp,0);
			so2=b[s]+solve(a,b,c,s+1,e,dp,1);
		}
	}
	
	dp[s][prev]=max(so1,max(so2,so3));
	return dp[s][prev];
	
}
int main() {
	int n;
	cin>>n;
	ll a[n];
	ll b[n];
	ll c[n];
	for(int i=0;i<n;i++)
	cin>>a[i]>>b[i]>>c[i];
	ll dp[n][3];
memset(dp,-1,sizeof(dp));
	cout<<solve(a,b,c,0,n-1,dp,-1)<<endl;
	// your code goes here
	return 0;
}

Measured memory_bytes: 15872
/****************************************

                 AOJ 0003

****************************************/

#include<stdio.h>

#define  NUM  1500

#define  squa(x)  ((x)*(x))

int main(void)
{
  int i;
  int num;
  int a, b, c;
  int ans[NUM] = { 0 }; /* "1" : Yes, "0" : No */

  scanf("%d", &num);

  for (i = 0; i < num; i++) {
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);

	if (squa(c) == squa(a) + squa(b))
	  ans[i] = 1;
	if (squa(b) == squa(c) + squa(a))
	  ans[i] = 1;
	if (squa(a) == squa(b) + squa(c))
	  ans[i] = 1;

  }

  for (i = 0; i < num; i++) {
	if(ans[i])
	  puts("YES");
	else
	  puts("NO");
  }

  return 0;
}

Measured memory_bytes: 584
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    string s; cin>>s;
    int r=0,w=0,ans=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R')r++;
        else w++;
    }
    for(int i=0;i<r;i++){
        if(s[i]=='W')ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3680
#include<iostream>
#include <algorithm>

using namespace std;


int main(){

    int N;
    int A[110];

	cin >> N;
  	for(int i=0; i < N; ++i) cin >> A[i];
  	sort(A, A+N, greater<int>());
  	
  	int Alice = 0;
  	int Bob = 0;
  	for(int i= 0; i < N; ++i){
    	if(i%2==0) Alice += A[i];
      	else Bob += A[i];
    }
  	cout << Alice - Bob << endl;
}


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

int main()
{
	long long n, t; cin >> n >> t;

	vector<long long> c(n); 
	
	for (long long i = 0; i < n; i++) cin >> c[i];
	
	long long ans = t;
	for (long long i = 0; i < n - 1; i++) {
		ans += min(c[i + 1] - c[i], t);
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1792
from sys import stdin, stdout
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def main():
	S = rll()[0]
	T = rll()[0]
	n = len(S)
	ans = S == T[:n]
	print("Yes" if ans else "No")
	stdout.close()

if __name__ == "__main__":
	main()

Measured memory_bytes: 84280