akhauriyash/Code-Regression huggingface dataset:
#pragma region
#include <assert.h>
#include <math.h>

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;

template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &v) {
  return os << v.first << ' ' << v.second << '\n';
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  for (T t : v) os << t << ' ';
  return os << '\n';
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &t : v) is >> t;
  return is;
}
#pragma endregion

#define int long long
int mod = 1e9 + 7;  // 998244353;

void solvetestcase() {
  int n;
  cin >> n;
  vector<int> factors(n + 5, 0);
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j += i) {
      factors[j]++;
    }
  }
  int ans = 0;
  for (int i = 1; i < n; i++) {
    ans += factors[n - i];
  }
  cout << ans;
}

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

  int t = 1;
  // cin >> t;

  for (int T = 1; T <= t; T++) {
    // cout << "Case #" << T << ": ";
    solvetestcase();
    cout.flush();
  }

  return 0;
};

/*
    AUTHOR:     KUNAL TAWATIA
    EDUCATION:  INDIAN INSTITUTE OF TECHNOLOGY, JODHPUR
*/


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

int main() {
	int X;
	cin >> X;
	if (X == 1) {
		cout << 1;
		return 0;
	}
	int d=10000;
	int ans = 0;
	int n = sqrt(X);
	for (int i = 2; i <= n; i++) {
		int foo = i;
		while (i * foo <= X) {
			foo*= i;
		}
		if (X - foo < d) {
			d = X - foo;
			ans = foo;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int H,W;
string a[100];

int main(){
    cin>>H>>W;
    rep(i,H) cin>>a[i];

    int r[100],c[100];
    fill(r,r+100,0);
    fill(c,c+100,0);
    rep(i,H){
        rep(j,W){
            if(a[i][j]=='#'){
                r[i]=1;
                c[j]=1;
            }
        }
    }

    rep(i,H){
        if(r[i]==1){
            rep(j,W){
                if(c[j]==1){
                    cout<<a[i][j];
                }
            }
            cout<<endl;
        }
    }
}

Measured memory_bytes: 256
import sys
import itertools
for line in sys.stdin:
	try:
		p, q = map(int, line.split())
	except ValueError:
		break
	p, r = p / q, p % q * 10
	visited = {}
	visited[r] = 0
	res = ''
	for i in itertools.count(1):
		p, r = r / q, r % q * 10
		res += str(p)
		if r == 0:
			print res
			break
		elif r in visited:
			print res
			n = visited[r]
			print ' ' * n + '^' * (i - n)
			break
		visited[r] = i

Measured memory_bytes: 5912
#include <iostream>
#include <string.h> 
#define ll long long
using namespace std;
const ll me = 97;
const ll mod = 1234567898765;
const ll maxn = 5e3+5;
string str;int len;
ll hash_value[maxn];
ll hash_str(int l,int r)
{
	ll re=0,mid=1;
	for(int i=l;i<=r;i++)
	{
		re=(re+1ll*mid*str[i])%mod;
		mid=(mid*me)%mod;
	}
	return re;
}
bool solve(int x)
{
	memset(hash_value,-1,sizeof(hash_value));
	for(int i=0;i+x-1<len;i++)
	{
		hash_value[i]=hash_str(i,i+x-1);
	}
	for(int i=0;i+x-1<len;i++)
	{
		for(int j=i+x;j<len;j++)
		{
			if(hash_value[j]==-1)break;
			if(hash_value[j]==hash_value[i]){return true;}
		}
	}
	return false;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n;cin>>n;
	cin>>str;len=str.size();
	int l=0,r=len/2;
	int ans,mid;
	while(l<=r)
	{
		mid=(l+r)>>1;
//		cout<<"l: "<<l<<" r: "<<r<<'\n';
		if(solve(mid)){ans=mid;l=mid+1;}
		else r=mid-1;
		
//		system("pause");
	}
	cout<<ans<<'\n';
}

Measured memory_bytes: 384
#include<cmath>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<functional>
#define INF 1e16
#define N (1000000000+7)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> Q;



int main(void){
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
        Integer input = Integer.parseInt(scan.nextLine());
 
        if(input == 1) {
        	System.out.println(1);
        } else {
        	int passKindCount = passKindCountCalc(input);
        	System.out.println(passKindCount);
        }
        scan.close();
	}
	
	private static int passKindCountCalc(int passKind) {
		
		int num = passKind * passKind * passKind;
		return num;
		
	}

}


Measured memory_bytes: 23764
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	w := lcm(a[0], a[1])
	for i := 2; i < n; i++ {
		w = lcm(w, a[i])
	}
	fmt.Println(w)

}
func lcm(a, b int) int {
	return a * b / gcd(a, b)
	// return a / gcd(a, b) * b   桁あふれ対策
}
func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}



Measured memory_bytes: 1148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I=(B-1);I>=(A);I--)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
const ll INF=1e18+7;
const ll MOD=1e9+7;
const ll N = 1003;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	bool ok=false;
	FOR(i,0,26){
		ll k=n-4*i;
		if(k<0)break;
		if(k%7==0)ok=true;
	}
	if(ok)pri("Yes");
	else pri("No");

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;

LL inf = 1000000000000;
LL mod = 1000000007;

int main()
{
	LL A, B, M;
	cin >> A >> B >> M;

	vector<LL> a(A), b(B);

	LL mina = inf, minb = inf;
	for (auto &e : a) {
		cin >> e;
		mina = min(mina, e);
	}

	for (auto &e : b) {
		cin >> e;
		minb = min(minb, e);
	}

	
	LL mn = 1000000000000;
	for (LL i = 0; i < M; ++i) {
		LL x, y, c;
		cin >> x >> y >> c;
		x--, y--;

		mn = min(mn, a[x]+b[y]-c);
	}

	mn = min(mn, mina+minb);
	
	cout << mn << "\n";
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&y);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */


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

    int ss = s.size();

    int ans = s.size();

    rep(i,s.size()-1){
        if(s[i] != s[i+1]){
            if(i+1<ss-(i+1)){
                mins(ans,ss-(i+1));
            }else{
                mins(ans,i+1);
            }
        }
    }

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


Measured memory_bytes: 512
// 150 c

#include <bits/stdc++.h>
using namespace std;

void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}
int main() {
    int n;
    int n_ban;

    cin >> n;
    vector <int> p(n);
    vector <int> q(n);
    vector <int> p_d(n);

    int p_v;
    int q_v;

    for (int i = 0; i < n; ++i) {
        cin >> p[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> q[i];
    }
    
    p_v = 0;
    for (int i = 0; i < n; i++) {
        p_v = p_v + p[i] * pow(10, n - i - 1);
    }
    q_v = 0;
    for (int i = 0; i < n; i++) {
        q_v = q_v + q[i] * pow(10, n - i - 1);
    }


    n_ban = 1;
    for (int i = 1; i <= n; i++) {
        n_ban = n_ban * i;
    }
    vector <int> p_value(n_ban);
    vector <int> q_value(n_ban);
    
    sort (p.begin(), p.end());
    sort (q.begin(), q.end());
    int count = 0;
  do {
    // print (p);
    int v = 0;
    for (int i = 0; i < n; i++) {
        v = v + p[i] * pow(10, n - i - 1);
    }
    p_value[count] = v;
    count++;
  } while (std::next_permutation(p.begin(), p.end()));

  count = 0;
  do {
    int v = 0;
    for (int i = 0; i < n; i++) {
        v = v + q[i] * pow(10, n - i - 1);
    }
    q_value[count] = v;
    count++;
  } while (std::next_permutation(q.begin(), q.end()));

    int p_position = 10;
    int q_position = 10;
    for (int i = 0; i < n_ban; i++) {
        if (p_v == p_value[i]) {
            p_position = i;
            break;
        }
    }

    for (int i = 0; i < n_ban; i++) {
        if (q_v == q_value[i]) {
            q_position = i;
            break;
        }
    }

    int ans = abs(p_position - q_position);
    cout << ans << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<string>data(n);
  vector<int>sum(n,0);
  vector<int>pos;
  sum[0] = 1;
  int max = 0;
  for(int i = 0;i < n;i++){
    cin >> data[i];
  }
  sort(data.begin(),data.end());
  for(int i = 1;i < n;i++){
    if(data[i] == data[i-1]){
      sum[i] = sum[i-1]+1;
      if(i == n-1 && sum[i] >= max){
        if(sum[i] > max){
          vector<int>().swap(pos);
        }
        pos.push_back(i);
      }
    }
    else if(sum[i-1] >= max){
      if(sum[i-1] > max){
        vector<int>().swap(pos);
      }
      max = sum[i-1];
      pos.push_back(i-1);
      sum[i] = 1;
      if(i == n-1 && max == 1){
        pos.push_back(i);
      }
    }
    else{
      if(i == n-1 && max == 1){
        pos.push_back(i);
      }
      sum[i] = 1;
    }
  }
  vector<string>ans(pos.size());
  for(int i = 0;i < pos.size();i++){
    ans[i] = data.at(pos.at(i));
  }
  sort(ans.begin(),ans.end());
  for(int i = 0;i < ans.size();i++){
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 17528
#include <iostream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <sstream>
#include <numeric>
#include <iomanip>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>

///////////////////////////////////////////////////////////////
// namespace
///////////////////////////////////////////////////////////////
using namespace std;
// namespace mp = boost::multiprecision;

///////////////////////////////////////////////////////////////
// types
///////////////////////////////////////////////////////////////
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
// using mpi = mp::cpp_int;
// using mpf = mp::number<mp::cpp_dec_float<1024>>;

///////////////////////////////////////////////////////////////
// mod https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a
///////////////////////////////////////////////////////////////
// ll MOD = 1000000007;
//
//  ll mod(ll val) {
//      ll res = val % MOD;
//      if (res < 0) res += MOD;
//      return res;
//  }
//
// ll modinv(ll a) {
//     ll b = MOD, u = 1, v = 0;
//     while (b) {
//         ll t = a / b;
//         a -= t * b; swap(a, b);
//         u -= t * v; swap(u, v);
//     }
//     u %= MOD;
//     if (u < 0) u += MOD;
//     return u;
// }
//
// const int MAX = -1;
// ll fac[MAX], finv[MAX], inv[MAX];
// void com_init() {  // initialize nCk table with O(N)
//     fac[0] = fac[1] = 1;
//     finv[0] = finv[1] = 1;
//     inv[1] = 1;
//     for (int i = 2; i < MAX; i++){
//         fac[i] = fac[i - 1] * i % MOD;
//         inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
//         finv[i] = finv[i - 1] * inv[i] % MOD;
//     }
// }
// ll com(int n, int k){  // nCk
//     if (n < k) return 0;
//     if (n < 0 || k < 0) return 0;
//     return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
// }


int main() {
    string S, T; cin >> S >> T;
    if (S.size() + 1 != T.size()) {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < S.size(); ++i) {
        if (S[i] != T[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
    // cout << setprecision(10);
    return 0;
}


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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amin(T& a,T2 b){ if(a > b) a = b;}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, ma, mb;
	cin >>n >>ma >>mb;
	VI a(n), b(n), c(n);
	rep(i, n) cin >>a[i] >>b[i] >>c[i];
	
	const int jmx = n*11;
	vector<VL> dp(jmx+11, VL(jmx+11, MD));
	dp[0][0] = 0;
	rep(i, n){
		repr(j, jmx, 0) repr(k, jmx, 0) if(dp[j][k] < MD){
			amin(dp[j+a[i]][k+b[i]] , dp[j][k] + c[i]);
		}
	}

	ll ans = MD;
	rep2(j, 1, jmx){
		if( j*mb % ma) continue;
		ll tk = (ll)j * mb / ma;
		if( tk > jmx) continue;
		if(dp[j][tk] < MD) ans = min(ans, dp[j][tk]);
	}
	cout << (ans !=MD? ans: -1) <<"\n";
	return 0;
}


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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    int  n, k;
    cin >> n >> k;

    int ans = k;
    for (int i = 1; i < n; i++) {
        ans *= (k-1);
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
        public static void main(String[] args) {
// 標準入力からデータを読み込む準備
            Scanner sc = new Scanner(System.in);
// 2つの文字の固まりをそれぞれ整数値と想定して読み込む
            int a = sc.nextInt();
            int b = sc.nextInt();
            int area =a*b /* ここを変えて面積を求めよう */;
            int length =(a+b)*2 /* ここを変えて周囲の長さを求めよう */;
            System.out.println(area + " " + length);
        }
}



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

const int INF = 0x3f3f3f3f;

struct dsu_t {
    vector<int> dsu;
    dsu_t(int n): dsu(n) { iota(dsu.begin(), dsu.end(), 0); }
    int& operator [] (int i) {
        int p = i, f;
        while (i != dsu[i]) i = dsu[i];
        while (p != dsu[p]) f = dsu[p], dsu[p] = i, p = f;
        return dsu[i];
    }
};

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    dsu_t dsu(n + m + m);
    map<long long, int> index;
    auto get = [&](long long a) {
        auto it = index.find(a);
        if (it == index.end())
            it = index.emplace(a, index.size()).first;
        return it->second;
    };
    for (int i = 0, u, v ,c; i < m; i++) {
        scanf("%d%d%d", &u, &v, &c);
        --u, --v, --c;
        u = dsu[get(1ll * c * n + u)];
        v = dsu[get(1ll * c * n + v)];
        if (u != v) dsu[u] = v;
    }
    vector<vector<int>> G(n + m + m);
    for (pair<const long long, int> it : index) {
        it.second = dsu[it.second] + n;
        G[it.first % n].push_back(it.second);
        G[it.second].push_back(it.first % n);
    }
    vector<int> dis(n + m + m, INF);
    queue<pair<int, int>> q;
    q.emplace(0, 0);
    dis[0] = 0; 
    for (int u, v, w; !q.empty();) {
        tie(w, u) = q.front(); q.pop();
        for (const int v : G[u]) {
            if (dis[u] + 1 < dis[v]) {
                dis[v] = dis[u] + 1;
                q.emplace(dis[v], v);
            }
        }
    }
    printf(dis[n - 1] == INF ? "-1\n" : "%d\n", dis[n - 1] / 2);
    return 0;
}

Measured memory_bytes: 51584
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdio>
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <cstring>
#include <string>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <iterator>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
const int INF = 0x3f3f3f3f;

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

int N, W;
int dp[2][101000];
pii arr[110];

int main(){
    scanf("%d%d", &N, &W);
    for (int i = 1; i <= N; i++) scanf("%d%d", &arr[i].second, &arr[i].first);
    memset(dp, INF, sizeof(dp));
    int flag = 0;
    dp[flag][0] = 0;
    for (int i = 1; i <= N; i++){
        for (int j = 0; j <= 100000; j++){
            dp[flag^1][j] = min(dp[flag^1][j], dp[flag][j]);
            if (j >= arr[i].first && dp[flag][j-arr[i].first]+arr[i].second <= W) dp[flag^1][j] = min(dp[flag^1][j], dp[flag][j-arr[i].first]+arr[i].second);
        }
        flag ^= 1;
    }
    int ans = 0;
    for (int i = 0; i <= 100000; i++){
        if (dp[flag][i] <= W) ans = max(ans, i);
    }
    printf("%d", ans);
}


Measured memory_bytes: 4584
#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

//typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main(){
    int N;
    int M;
    int Q;
    cin >> N >> M >> Q;
    int l;
    int r;
    vector<vector<int>> x(N, vector<int>(N, 0));
    vector<vector<int>> c(N, vector<int>(N, 0));
    vector<int> p(Q);
    vector<int> q(Q);
    int tmp_p;
    int tmp_q;
    for(int i=0; i<M; i++){
        cin >> l >> r;
        l--;
        r--;
        x[l][r]++;
    }
    for(int i=0; i<Q; i++){
        cin >> tmp_p >> tmp_q;
        tmp_p--;
        tmp_q--;
        p[i]=tmp_p;
        q[i]=tmp_q;
    }
    for(int i=0; i<N; i++){
        for(int j=i; j<N; j++){
            c[i][j]+=x[i][j];
            if(j!=i){
                c[i][j]+=c[i][j-1];
            }
        }
    }

    for(int i=0; i<Q; i++){
        int ans=0;
        for(int j=p[i]; j<=q[i]; j++){
            ans+=c[j][q[i]];
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3712
N=int(input())
M=["3","5","7"]
S=""

def dfs (S, N):
  global ans
  for m in M:
    T=m+S
    
    if int(T)>N:
      continue
    else:
      
      if len(set(T))==3:
        ans+=1
        
      
      dfs(T, N)
  return
ans=0
dfs(S, N)
print(ans)



Measured memory_bytes: 3060
#include <stdio.h>
#define INF 2147483647

int minmin(int,int);

int main(){
  int i,n,rc[101],mm[101][101],k,d,j,q;

  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%d%d",&rc[i],&rc[i + 1]);
    mm[i + 1][i + 1] = 0;
    // printf("(%d) %d %d\n",i,rc[i],rc[i + 1]);
  }

  for(i = 2;i < n + 1;i++){
    for(k = 1;k <= n - i + 1;k++){
      d = k + i - 1;
      mm[k][d] = (1 << 21);
      for(j = k;j < d;j++){
	q = mm[k][j] + mm[j + 1][d] + rc[k - 1] * rc[j] * rc[d];
	mm[k][d] = minmin(mm[k][d],q);
      }
    }
    // printf("(%d)%d\n",i,n);
  }

  printf("%d\n",mm[1][n]);
  
  return 0;
}

int minmin(int a,int b){
  if(a > b) return b;
  else return a;
}



Measured memory_bytes: 2108
#include<iostream>
using namespace std;
int main()
{
  	int flag=0;
	string h;
	cin>>h;
  for(int i=0;i<h.size();i++)
  {
    if(h[i]=='h' && h[i+1]=='i')
    {
      flag+=2;
      i++;
    }
  }
  if(flag==h.size())
  {
    cout<<"Yes"<<endl;
  }
  else
  {
	cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <complex>
#include <queue>
#include <set>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
typedef complex<double> P;

int bitcount(int b) { int c = 0; while(b) { b &= b-1; c++; } return c; }

int n, x[64], y[64], r[64], c[64], g[64][64];

int solve() {
    rep(i, n) for(int j=i+1; j<n; j++) {
        const double d = abs(P(x[i], y[i])-P(x[j], y[j]));
        g[i][j] = d<r[i]+r[j];
    }
    int ans = 0;
    set<int> vis;
    queue<int> q;
    q.push(0);
    vis.insert(0);
    while(!q.empty()) {
        int x = q.front();
        q.pop();
        ans = max(ans, bitcount(x));
        int can = ~x;
        rep(i, n) if((x&(1<<i))==0) {
            for(int j=i+1; j<n; j++) if(g[i][j]) can &= ~(1<<j);
        }
        rep(i, n) if(can&(1<<i)) rep(j, i) if(can&(1<<j) && c[i]==c[j]) {
            const int nx = x|(1<<i)|(1<<j);
            if(vis.find(nx)==vis.end()) {
                q.push(nx);
                vis.insert(nx);
            }
        }
    }
    return ans;
}

int main() {
    for(;;) {
        scanf("%d", &n);
        if(n==0) return 0;
        rep(i, n) scanf("%d%d%d%d", x+i, y+i, r+i, c+i);
        printf("%d\n", solve());
    }
}

Measured memory_bytes: 0
/////////////////////////////
//* Code By: SANSKAR SETH *//
/////////////////////////////


/*----------HEADER FILES AND TEMPLATES----------*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define pob pop_back
#define pf pop_front()
#define puf push_front()
#define mp make_pair
#define loop(i,a,b) for(int i=a ; i<b ; ++i)
#define rloop(i,a,b) for(int i=a ; i>=b ; --i)
#define ip(a) int a; cin>>a
#define ip2(a,b) int a,b; cin>>a>>b
#define ip3(a,b,c) int a,b,c; cin>>a>>b>>c
#define ipv(v,n) vi v(n); loop(i,0,n) cin>>v[i]
#define pv(v) loop(i,0,v.size()) cout<<v[i]<<" "
#define ips(s) string s; cin>>s
#define F first
#define S second
#define si(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define coutfl(l,p) fixed << setprecision(p) << l

typedef pair<int, int> pii;
typedef unordered_set<int> usi;
typedef set<int> si;
typedef map<int, int>   mii;
typedef map<char, int>  mci;
typedef vector<int>    vi;
typedef vector<char>   vc;
typedef vector<pii>    vpii;
typedef vector<vi>     vvi;

const int M = 1e9 + 7;
const int N = 5e5;

/*----------SOLUTION----------*/

int mod(int x)
{
	return ((x % M + M) % M);
}

int add(int a, int b)
{
	return mod(mod(a) + mod(b));
}

int mul(int a, int b)
{
	return mod(mod(a) * mod(b));
}

int sub(int a, int b)
{
	return mod(mod(a) - mod(b));
}

void solve()
{
	ip(n);
	int ans = 1;
	int p10 = 1, p8 = 1, p9 = 1;

	loop(i, 0, n)
	{
		p10 = mul(10, p10);
		p9 = mul(9, p9);
		p8 = mul(8, p8);
	}

	ans = sub(add(p10, p8), mul(2, p9));

	cout << ans << endl;

}

/*----------MAIN FUNCTION----------*/
int32_t main()
{
	fastIO;

#ifndef ONLINE_JUDGE
	freopen("input.txt" , "r" , stdin);
	freopen("output.txt" , "w" , stdout);
#endif
	/*----MAIN PART----*/

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

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

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

typedef long long Data;

struct SegTreeLazy {
  static const int MAX_DEPTH = 18;
  static const int STsize = 1 << MAX_DEPTH;
  Data data[STsize];
  Data lazy[STsize]; int n;
  SegTreeLazy(void) : n(STsize / 2) {
    REP(i,STsize){
      data[i]=lazy[i]=0;
    }
  }
  void update (int pos, Data value) {
    data[pos] += value;
    while (pos < 2*n-1) {
      int l = pos, r = pos^1;
      pos = pos / 2 + n;
      data[pos] = data[l] + data[r];
    }
  }
  void add(int fr, int to, Data val) { upd_sub(fr, to, 2*n-2, 0, n, val); }
  Data sum(int fr, int to) { return sum_sub(fr, to, 2*n-2, 0, n); }
 private:
  void upd_sub(int fr, int to, int node, int la, int ra, Data val) {
    if (ra<=fr || to<=la) return;
    if (fr<=la && ra<=to) {
      lazy[node] += val; return;
    }
    data[node] += (min(to, ra) - max(fr, la)) * val;
    upd_sub(fr, to, (node-n)*2+0, la, (la+ra)/2, val);
    upd_sub(fr, to, (node-n)*2+1, (la+ra)/2, ra, val);
  }
  Data sum_sub(int fr, int to, int node, int la, int ra) {
    if (ra<=fr || to<=la) return Data(0);
    if (fr<=la && ra<=to) return data[node];// + lazy[node]*(ra-la);
    Data res = 0;//lazy[node] * (min(to, ra) - max(fr, la));
    res += sum_sub(fr, to, (node-n)*2+0, la, (la+ra)/2);
    res += sum_sub(fr, to, (node-n)*2+1, (la+ra)/2, ra);
    return res;
  }
};

/*
int main() {
  SegTreeLazy sgt;
  int n,q;
  cin >> n >> q;
  REP(i,n) {
    int x;
    cin >> x;
    sgt.update(i, x);
  }
  REP(i,q) {
    int x, y;
    char c;
    cin >> c >> x >> y;
    if(c == 'C') {
      int v;
      cin >> v;
      sgt.add(x-1, y, v);
    } else {
      cout << sgt.sum(x-1, y) << endl;
    }
  }
  return 0;
}
*/
int main() {
  SegTreeLazy sgt;
  int n,q;
  cin>>n>>q;
  REP(i,q){
    int c,x,y;
    cin>>c>>x>>y;
    if(c==0){
      sgt.update(x,y);
    }else{
      cout<<sgt.sum(x,y+1)<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 5256
n,k = map(int,input().split())
p = list(map(int,input().split()))
ep = list(map(lambda x:(x+1)/2,p))
m = -1
epp = [0 for i in range(n+1)]
for i in range(n):
  epp[i+1] = ep[i]+epp[i]
for i in range(n-k+1):
  if (epp[i+k]-epp[i]>m):
    m = epp[i+k]-epp[i]
print(m)

Measured memory_bytes: 25060
#include "bits/stdc++.h"
using namespace std;

int mod = 1e9 + 7;

long long exp(long long a, int b) {
	int res{1};
	while (b) {
		if (b&1) res = (res*a)%mod;
		a = (a*a)%mod;
		b /= 2;
	}
	return res;
}

int nCr(int n, int r) {
	long long res{1};
	for (int i = 1; i <= r; i++) {
		res = (res*(n - i + 1))%mod;
		res = (res*exp(i, mod - 2))%mod;
	}
	return res;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	int n;
	cin >> n;
	long long ans{};
	for (int i = n/3; i; i--) {
		ans += nCr(n - 2*i - 1, i - 1);
		ans %= mod;
	}
	cout << ans;
}

Measured memory_bytes: 3640
# -*- coding: utf-8 -*-
N, K = map(int, input().split(' '))

import math
ret = 0
log_k = math.log(K)
for n in range(1, N+1):
    prob = 1
    while n < K:
        prob *= 0.5
        n *= 2

    ret += prob


print(ret / N)





Measured memory_bytes: 39152
#include <iostream>
#include <algorithm>
#include <complex>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <cstdlib>

#define rep(i, b) for(int i = 0; i < b; i++)
#define repi(i, a, b) for(int i = a; i < b; i++)
#define all(c) c.begin(),c.end()
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define MAX_V 1001
#define MAX_E 401
#define INF INT_MAX
#define MOD 1000000007
#define EPS 1e-7
typedef long long ll;
inline int toInt(std::string s) { int v; std::istringstream sin(s); sin >> v; return v; }
template<class T> inline std::string toString(T x) { std::ostringstream sout; sout << x; return sout.str(); }
using namespace std;

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
#define X real()
#define Y imag()
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
	ll N;
	cin >> N;
	vector<ll> P(N);
	vector<ll> pp(N);
	vector<ll> mode(N);

	rep(i, N)
	{
		cin >> P[i];
		pp[i] = 0;
		mode[i] = 0;
	}
	
	ll count = 1;
	for (ll i = N - 1; i > -1; i--)
	{
		if (i == N - 1)
		{
			pp[P[i] - 1] = count;
		}
		else if (P[i] == N)
		{
			count++;
			pp[P[i] - 1] = count;
		}
		else {
			if (pp[P[i]] != 0)
			{
				pp[P[i] - 1] = pp[P[i]];
			}
			else {
				count++;
				pp[P[i] - 1] = count;
			}
		}
	}

	
	rep(i, N)
	{
		mode[pp[i] - 1]++;
	}
	ll res = 0;
	rep(i, N)
	{
		res = max(mode[i], res);
	}
	cout << N - res << endl;

	return 0;
}

Measured memory_bytes: 4992
let N = Int(readLine()!)!

func solveB(array: [Int]) -> Int? {
    guard array.first(where: { $0 == 0 }) == nil else { return 0 }
    var result = 1
    for a in array {
        let (partialValue, overflow) = result.multipliedReportingOverflow(by: a)
        if overflow || partialValue > 1_000_000_000_000_000_000 {
            return nil
        } else {
            result = partialValue
        }
    }

    return result
}

print(solveB(array: readLine()!.split(separator: " ").map { Int($0)! }) ?? "-1")


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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a == b && b == c)cout << 1;
    else if(a == b && b != c)cout << 2;
    else if(a == c && c != b)cout << 2;
    else if(b == c && b != a)cout << 2;
    else cout << 3;
    return 0;
}

Measured memory_bytes: 256
import bisect

n,m=map(int,input().split())
l=[[] for _ in range(n)]
d=list()

for i in range(m):
  p,q=map(int,input().split())
  l[p-1].append(q)
  d.append([p-1,q])
 
for i in range(n):
  if len(l[i])>0:
    l[i].sort()

for i in range(m):
  o = bisect.bisect_left(l[d[i][0]], d[i][1])+1
  print(str(d[i][0]+1).zfill(6)+str(o).zfill(6))


Measured memory_bytes: 32812
#include <stdio.h>
 
char n[4] ;
 
int main(void){
 
    scanf ("%s",n) ;
    
    if ( n[0]==n[2] ){
        printf ("Yes\n") ;
    } else {
        printf ("No\n") ;
    }
 
 
    return 0 ;
    
}

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

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REPO(i,n) for(int (i)=1; (i)<=(int)(n); (i)++)
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;

struct PT {
	int x, y, ix;
	PT() {}
	PT(int xx, int yy, int ii) : x(xx), y(yy), ix(ii) {}
};
struct ED {
	int a, b, c;
	ED() {}
	ED(int aa, int bb, int cc) : a(aa), b(bb), c(cc) {}
};

const int MAX_N = 1e5 + 100;

int N; vector<PT> Ps;
int UNF[MAX_N];
int F(int v) {return UNF[v]==v?v:UNF[v]=F(UNF[v]);}
bool U(int a, int b) {a = F(a), b = F(b); UNF[a] = b; return a != b;}
int main() {
	cin >> N;
	REP(i, N) {
		int x, y; scanf("%d%d", &x, &y);
		Ps.push_back(PT(x, y, i));
	}
	sort(ALL(Ps), [&](PT a, PT b) {
		return a.x < b.x;
	});
	vector<ED> Es;
	REP(i, N-1) Es.push_back(ED(Ps[i].ix, Ps[i+1].ix, Ps[i+1].x - Ps[i].x));
	sort(ALL(Ps), [&](PT a, PT b) {
		return a.y < b.y;
	});
	REP(i, N-1) Es.push_back(ED(Ps[i].ix, Ps[i+1].ix, Ps[i+1].y - Ps[i].y));

	sort(ALL(Es), [&](ED a, ED b) {
		return a.c < b.c;
	});
	REP(i, N) UNF[i] = i;

	ll ans = 0;
	for(ED &e : Es) if(U(e.a, e.b)) ans += e.c;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 6132
#include <iostream>
using namespace std;
int main(void){
    string s;
    cin >> s;
    for(int i=1;i<4;i++){
        if(s[i] == s[i-1]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
}


Measured memory_bytes: 256
import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List

judge [m,f,r]
  | m==(-1) || f==(-1) = "F"
  | c>=80 = "A"
  | c>=65 = "B"
  | c>=50 || (c>=30 && r>=50) = "C"
  | c>=30 = "D"
  | otherwise = "F"
  where c = m + f

main = do
    --d <- fmap (map judge . takeWhile (all (==(-1))) . map (map read . words) . lines) $ getContents 
    d <- map judge . takeWhile (any (/=(-1))) . map (map read . words) . lines <$> getContents 
    mapM_ putStrLn d

Measured memory_bytes: 4036
/*

    two pointer on the number segment
    set of modular equations
    checking the validity by the regular crt condition while adding and removing

*/
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define ll long long
typedef pair<int,int> pii;
const int maxn=1e5+10;
int cnt,nd[maxn][2],n,root,cnt1,cnt2;
ll l,rez;

void ins(int x,string &s,int dep){

    for(int i=0;i<s.size();i++){

        int c=s[i]-48;

        if(nd[x][c]==0){
            nd[x][c]=++cnt;
            x=cnt;
        }
        else{
            x=nd[x][c];
        }

    }

}

void dfs(int x,int lvl){

    if(nd[x][0]==0){}
    else dfs(nd[x][0],lvl+1);

    if(nd[x][1]==0){}
    else dfs(nd[x][1],lvl+1);

    if((nd[x][1]==0 && nd[x][0]!=0)||(nd[x][1]!=0 && nd[x][0]==0)){
        rez^=((l-lvl)&(-(l-lvl)));
    }
}

int main(){

    ///freopen("test.txt","r",stdin);

    cin>>n>>l;
    for(int i=1;i<=n;i++){
        string s;
        cin>>s;
        ins(root,s,0);
    }

    dfs(root,0);


    if(rez!=0)cout<<"Alice"<<endl;
    else cout<<"Bob"<<endl;

	return 0;
}


Measured memory_bytes: 9204
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) int(a.size())
#define clr(a) memset(a,0,sizeof(a))
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int inf=1e9;
const ll Inf=1e18;
const int mod=998244853;
const int base=131;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };
template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };
int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }
int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }
void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }
void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }
string s;
int n;
map<string,int> L,R;
void dfs(int x,int to,string r,string b) {
    if(x==to) {
        if(to==n) ++L[r+'#'+b];
        else reverse(all(r)),reverse(all(b)),++R[b+'#'+r];
        return;
    }
    dfs(x+1,to,r+s[x],b),dfs(x+1,to,r,b+s[x]);
}
int main() {
    cin>>n>>s;
    dfs(0,n,"",""),dfs(n,n<<1,"","");
    ll ans=0;
    for(auto x:L) ans+=1ll*x.se*R[x.fi];
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 84352
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

# define INF 0x3f3f3f3f

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

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

  string S;
  ll K;
  cin >> S >> K;
  REP(i, K) {
    if (S[i] != '1') {
      cout << S[i] << endl;
      return 0;
    }
  }

  cout << "1" << endl;
  return 0;
}


Measured memory_bytes: 256
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
 
if A < B:
	if A + (V*T) >= B + (W*T):
		print("YES")
	else:
		print("NO")
else:
	if A - (V*T) <= B - (W*T):
		print("YES")
	else:
		print("NO")

Measured memory_bytes: 9192
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}
func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0
	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 1
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}
	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	a := getNextFloat64(scanner)
	b := getNextFloat64(scanner)
	h := getNextFloat64(scanner) * 30
	m := getNextFloat64(scanner) * 6
	h += m / 12
	r := h - m
	if r > 180 {
		r = 360 - r
	}

	fmt.Fprintln(writer, math.Sqrt(math.Pow(a, 2)+math.Pow(b, 2)-2*a*b*math.Cos(float64(r)*math.Pi/180)))
}


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

long long n;
char c;
set<char> s;
int main() {
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> c;
        s.insert(c);
    }
    cout << (s.size() == 3 ? "Three" : "Four");
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int dp[110][10010];
int main(){
    int N, W; cin >> N >> W;
    int v[110], w[110];
    for (int i = 0; i < N; i++) {
        cin >> v[i] >> w[i];
    }
    

    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            if(j >= w[i]){
                dp[i+1][j] = max(dp[i+1][j], dp[i][j-w[i]]+v[i]);
            }

            dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
        }
    }

    cout << dp[N][W] << endl;
    
    return 0;
}


Measured memory_bytes: 6992
import heapq

n,m = map(int,input().split())

roots = [[] for _ in range(n)]

for _ in range(m):
    a,b = map(int,input().split())
    roots[a-1].append(b-1)
    roots[b-1].append(a-1)

def dijkstra(edges, s):
    hq = []
    d = [-1] * n
    d[s] = 0
    heapq.heappush(hq, (0, s))
    while hq:
        d1, p = heapq.heappop(hq)
        for i in edges[p]:
            if d[i] == -1 or d[i] > d1 + 1:
                d[i] = d1 + 1
                heapq.heappush(hq, (d1+1, i))
    return d

d = dijkstra(roots, 0)

if d[-1] == 2:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 46644
#include <bits/stdc++.h>
#define int long long
#define double long double
const int INF = (int) 1e9 + 9;
const int maxn = (int) 1e6 + 6;
//const mod = (int) 1e9 + 7;
using namespace std;

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

      int cnt = 0;
      while(h > 0) {
            h /= 2;
            cnt++;
      }

      int ans = pow(2, cnt);
      cout << ans - 1;

return 0;

}

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

#define Rep0(i, n)  for (int i=0; i<n; i++)
#define Sort(P) sort(P.begin(), P.end())

int main() {
    int n;
    cin >>n;
    vector<vector<int>> A(n, vector<int> (3, 0));
    Rep0(i, n)
        Rep0(j, 3)
            cin >>A.at(i).at(j);
    Sort(A);
    vector<int> Parent(n, -1);
    vector<int> Sibling(n, -1);
    vector<int> Degree(n, 0);
    vector<bool> Leaf(n, false);
    Rep0(i, n) {
        int S1=A.at(i).at(1);
        int S2=A.at(i).at(2);
        if (-1!=S1) {
            Degree.at(i)++;
            Parent.at(S1)=i;
        }
        if (-1!=S2) {
            Degree.at(i)++;
            Parent.at(S2)=i;
        }
        if (2==Degree.at(i)) {
            Sibling.at(S1)=S2;
            Sibling.at(S2)=S1;
        } else if (0==Degree.at(i))
            Leaf.at(i)=true;
    }
    list<int> q;
    vector<int> Depth(n, -1);
    Rep0(i, n)
        if (-1==Parent.at(i)) {
            Depth.at(i)=0;
            q.push_back(i);
            break;
        }
    while(!q.empty()) {
        int i=q.front();
        q.pop_front();
        int S1=A.at(i).at(1);
        int S2=A.at(i).at(2);
        if (-1!=S1) {
            Depth.at(S1)=Depth.at(i)+1;
            q.push_back(S1);
        }
        if (-1!=S2) {
            Depth.at(S2)=Depth.at(i)+1;
            q.push_back(S2);
        }
    }
    vector<int> Height(n, -1);
    Rep0(i, n)
        if (Leaf.at(i)) {
            Height.at(i)=0;
            q.push_back(i);
        }
    while(!q.empty()) {
        int i=q.front();
        q.pop_front();
        int S1=Parent.at(i);
        if (-1!=S1) {
            if (Height.at(S1)<Height.at(i)+1) {
                Height.at(S1)=Height.at(i)+1;
                q.push_back(S1);
            }
        }
    }
    Rep0(i, n) {
        cout <<"node " <<A.at(i).at(0)
            <<": parent = " <<Parent.at(i)
            <<", sibling = " <<Sibling.at(i)
            <<", degree = " <<Degree.at(i)
            <<", depth = " <<Depth.at(i)
            <<", height = " <<Height.at(i)
            <<", ";
        if (-1==Parent.at(i))
            cout <<"root" <<endl;
        else if (0==Height.at(i))
            cout <<"leaf" <<endl;
        else
            cout <<"internal node" <<endl;
    }
    return 0;
}



Measured memory_bytes: 3160
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

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

ll sum(ll front,ll back){
    ll tmp=0;
    for(ll i=front;i<=back;i++) tmp+=i;
    return tmp;
}

int main()
{
    ll n,a,b,now=0;
    bool o=true;
    cin >> n;
    vpll ab(n);
    rep(i,n){
        cin >> a >> b;
        ab[i]=m_p(b,a);
    }
    sort(all(ab));
    rep(i,n){
        now+=ab[i].second;
        if(now>ab[i].first) o=false;
    }
    cout << (o?"Yes\n":"No\n");
    return 0;
}

Measured memory_bytes: 3328
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <tuple>
#include <set>
#include <map>

int main() {
  int r;
  scanf("%d", &r);

  printf("%d\n", 3*r*r);
}


Measured memory_bytes: 128
s=list(str(raw_input()))

n=len(s)

if n%2==0:
	list1=[str(0),str(1)]*(n//2)
	list2=[str(1),str(0)]*(n//2)
else:
	list1=[str(0),str(1)]*(n//2)
	list1.append(str(0))
	list2=[str(1),str(0)]*(n//2)
	list2.append(str(1))

ctr1=0
ctr2=0

for i in range(n):
	if s[i]!=list1[i]:
		ctr1+=1
	if s[i]!=list2[i]:
		ctr2+=1

print min(ctr1,ctr2)




Measured memory_bytes: 8196
#include<iostream>
#include<vector>
#include<queue>

using ll = long long;
using namespace std;

const int INF = 1001001001;
const int MOD = 1000000007;

int main(void){
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	while(1){
		c -= b;
		if (c <= 0){
			cout << "Yes" << endl;
			break;
		}
		a -= d;
		if (a <= 0){
			cout << "No" << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<set>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define INF 10000000000000
#define rep(i,n) for (int i=0;i<n;i++)

int main(){
    ll N;
    cin >> N;
    vector<pair<ll,ll>> v;
    for(ll i=1;i<=sqrt(N);i++){
        if(N%i==0){
            v.push_back(make_pair(i, N/i));
        }
    }
    
    ll min=INF;
    for(auto x:v){
        if(x.first-1+x.second-1<min){
            min = x.first-1+x.second-1;
        }
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 3248
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
  int x;
  cin >> x;
  int ld = 0;
  int rd = 100000;
  while(rd - ld > 1){
    int md = (rd + ld) / 2;
    if((ll)md * (md + 1) < 2 * (ll)x)ld = md;
    else rd = md;
  }
  cout << rd << endl;
	return 0;
}


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

void solve()
{
    int n, k;
    cin >> n >> k;
    vector<int> height(n);
    for (int i = 0; i < n; i++)
        cin >> height[i];
    
    // if (k > n)
    // {
    //     cout << abs(height[n] - height[0]);
    //     return;
    // }

    vector<int> v(n, 0);
    // for (int i = 1; i <= k; i++)
    //     v[i] = abs(height[i] - height[0]);

    for (int i = 1; i < n; i++)
    {
        v[i] = INT_MAX;
        for (int j = 1; j <= k && i-j>=0; j++)
            v[i] = min(v[i], abs(height[i] - height[i - j]) + v[i - j]);
    }
    // for (auto x : v)
    //     cout << x << " ";
    // cout << endl;
    cout << v[n - 1];
}

int32_t main()
{
    solve();
}

Measured memory_bytes: 1792