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

int main(){
  double a, b, c;
  cin >> a >> b >> c;
  double c_rad = c * acos(-1) / 180;
  c = sqrt(pow(a, 2) + pow(b, 2) - 2*a*b*cos(c_rad));

  double S, L, h;
  S = 0.5 * a * b * sin(c_rad);
  L = a + b + c;
  h = b * sin(c_rad);

  printf("%.8lf\n%.8lf\n%.8lf\n", S, L , h);
}



Measured memory_bytes: 3428
from collections import deque
readline = open(0).readline
writelines = open(1, 'w').writelines

N, Q = map(int, readline().split())
ans = []
A = [deque() for i in range(N)]


def push(t, x):
    A[t].append(x)


def top(t):
    A[t] and ans.append("%d\n" % A[t][0])


def pop(t):
    A[t] and A[t].popleft()


C = [push, top, pop].__getitem__
for i in range(Q):
    t, *a = map(int, readline().split())
    C(t)(*a)
writelines(ans)



Measured memory_bytes: 14464
#include <stdio.h>
main(){
  int h,m,s,S,t,w;
  scanf("%d",&S);
  h=S/3600;
  t=S%3600;
  m=t/60;
  s=t%60;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}

Measured memory_bytes: 592
//A.cpp
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main(){
  int N;
  cin >> N;
  char S;
  map<char, int> chk;
  for(int i = 0; i < N; i++){
    cin >> S;
    ++chk[S];
  }

  int Ans = 0;
  for(auto x: chk){
    ++Ans;
  }

  if(Ans==4) printf("Four\n");
  else printf("Three\n");
  return 0; 
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;



int main()
{

    int n;
    cin >> n;

    vector<int>t(n + 2);

    for (int i = 0;i < n - 1;i++) {
        int x;
        cin >> x;
        t[x]++;
    }

    for (int i = 1;i <= n;i++)cout << t[i] << endl;
  
    


    return 0;

}

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

int main() {
  int num;
  int cnt = 2;
  bool chk = true;
  
  cin >> num;
  
  while(true){
    chk = true;
    for(int i = 2; i*i < num; i++){
      if(num % i == 0){
        chk = false;
        break;
      }
    }      
    if(chk == true){
      break;
    }else{
      num++;
    }
  }
  
  cout << num;
}


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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<int> cnt(20);
  int now = 0;
  long long ans = 0;
  int r = 0;
  for (int l = 0; l < N; l++) {
    while (r < N and ((now & A[r]) == 0)) {
      now ^= A[r];
      r++;
    }
    ans += r - l;
    now ^= A[l];
  }
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 1024
import math
import collections
import fractions
import itertools
import functools
import  operator

def solve():
    n = int(input())
    p = 1
    mod = 10**9+7
    for i in range(1,n+1):
        p *= i
        p %= mod
    print(p)
    return 0

if __name__ == "__main__":
    solve()


Measured memory_bytes: 77324
#include <bits/stdc++.h>
using namespace std;
const int MAX = 100100;
const int MOD = 1e9+7;
template<int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod-p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = (int)(1LL*x*p.x%mod); return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) { t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); }
        return ModInt(u);
    }
    ModInt pow(int e){
        long long a = 1, p = x;
        while(e > 0) {
            if(e%2 == 0) {p = (p*p) % mod; e /= 2;}
            else {a = (a*p) % mod; e--;}
        }
        return ModInt(a);
    }
    friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

struct Combination {
    vector<ModInt<MOD>> fact;
    Combination(int n) : fact(n+1) {
        fact[0] = 1;
        for (int i = 1; i <= n; i++) {
            fact[i] = (fact[i-1] * i);
        }
    }
    ModInt<MOD> operator() (int n, int r) {
        if (r < 0 || r > n) return 0;
        return fact[n]/(fact[n-r]*fact[r]);
    }
};

int main() {
    using mint = ModInt<MOD>;
    Combination com(MAX);
    int n, x, fi = 0, se = 0;
    cin >> n;
    vector<int> a(n+1);
    set<int> b;
    for (auto& e : a) {
        cin >> e;
        if (!b.insert(e).second) x = e;
    }
    
    for (int _ = 0; _ < 2; _++) {
        for (int i = 0; i < n; i++) {
            if (a[i] == x) break;
            if (_&1) se++;
            else fi++;
        }
        reverse(a.begin(), a.end());
    }
    
    for (int k = 1; k <= n+1; k++) {
        mint ans = com(n+1, k);
        ans -= com(fi + se, k-1);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define LIMIT 1000000007 //10^9+7
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()

namespace /* debug */{
  #define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
  #define ldebug(...) do{cout<<"["<<setw(3)<<__LINE__<<"] ";debug(__VA_ARGS__);}while(0) //行数
  #define lDEBUG(...) do{cout<<"["<<setw(3)<<__LINE__<<"] "<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数, 行数
  template<class T>void show(T&x){cout<<x<<" ";} //出力
  template<class T>void showendl(T&x){cout<<x<<endl;} //出力改行
  template<class P,class Q>void show(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<") ";} //pair出力
  template<class P,class Q>void showendl(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<")"<<endl;} //pair出力改行
  template<class H>void debug(H&&h){showendl(h);} //引数1つ
  template<class H,class...Ts>void debug(H&&h,Ts&&...ts){show(h);debug(forward<Ts>(ts)...);} //可変引数
  template<class T>void debug(vector<T>&vt){int i=0;for(auto x:vt)++i!=vt.size()?show(x):showendl(x);} //vector出力
  template<class T>void debug(initializer_list<T>init){int i=0;for(auto x:init)++i!=init.size()?show(x):showendl(x);} //初期化子リスト出力
}

int main(){
	int N;cin>>N;
  vi A(N);rep(i,N)cin>>A[i];
  A.push_back(0);

  ll money = 1000;

  vi list;
  for(int i=0; i<N; i++){
    list.push_back(A[i]);
    //cout<<i<<" ";debug(list);

    /*
    if(i==N-1){
      if(!list.empty()){
        ll buy = money / list.front();
      money -= buy * list.front();
      money += buy * list.back();
      }
      break;
    }
    */

    if(A[i] <= A[i+1]){
      //明日上がる
      ;
    }else{
      //明日下がる
      ll buy = money / list.front();
      money -= buy * list.front();
      money += buy * list.back();
      list.clear();
    }
  }

  cout<<money<<endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const ll MOD = 1000000007;

int main() {
    int n; cin >> n;
    list<int> l;
    string s;
    REP(i,n) {
        while (cin>> s) {
            if(s=="deleteFirst") l.pop_front();
            else if(s=="deleteLast") l.pop_back();
            else {
                int x; cin >> x;
                if(s=="insert") {
                    l.push_front(x);
                }
                else {
                    for(auto itr = l.begin(); itr != l.end(); ++itr) {
                        if(*itr == x) {
                            l.erase(itr);
                            break;
                        }
                    }
                }
            }
        }
    }
    for(auto itr = l.begin(); itr != l.end(); ++itr) {
        if(itr==l.begin()) cout << *itr;
        else cout << ' ' << *itr;
    }
    cout << endl;
    return 0;
}


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

int main() {
  int A,B,C,D,x,y;
  cin >> A >> B >> C >> D;
  
  x = A + B;
  y = C + D;

  if (x > y) {
    cout << "Left" << endl;
  }
  else if (x < y) {
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}


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

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

  if (a >= 100) {
    b = a - 100;
    c++;
  } else {
    b = a;
  }
  
  if (b >= 10) {
    b -= 10;
    c++;
  }
  if (b > 0) {
    c++;
  }
  cout << c << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var N = sc.nextInt();
        var S = sc.next().ToCharArray();
        var ans = 1;
        for (int i = 1; i < N; i++) {
            if (S[i] != S[i-1]) {
                ans++;
            }
        }
        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 Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


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

class UnionFind {
public:
  vector<int> parent;
  UnionFind(int n) { parent = vector<int>(n, -1); }
  int root(int a) {
    if(parent[a] < 0)
      return a;
    return parent[a] = root(parent[a]);
  }
  int size(int a) { return -parent[root(a)]; }
  bool connect(int a, int b) {
    a = root(a);
    b = root(b);
    if(a == b)
      return false;
    if(size(a) < size(b))
      swap(a, b);
    parent[a] += parent[b];
    parent[b] = a;
    return true;
  }
};

int main() {
  int n, m, x, y, o = 0;
  cin >> n >> m;
  vector<int> p(n);
  for(int i = 0; i < n; i++)
    cin >> p.at(i);
  UnionFind uni(n);
  for(int i = 0; i < m; i++){
    cin >> x >> y;
    uni.connect(--x, --y);
  }
  for(int i = 0; i < n; i++)
    if(uni.root(p.at(i)-1)==uni.root(i))
      o++;
  cout << o << endl;
}


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

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

  for (int i = 0; i < str.size(); ++i) {
      for(int j=i+1;j<str.size();++j){
          if(str.at(i)==str.at(j)){
            cout << "no" << endl;
            return 0;
          }
      }
  }

  cout << "yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin >>a>>b;
    if(b>=0&&b<10) c=10;
    else if(b>=10&&b<100) c=100;
    else if(b==100) c=1000;
    c=c*a+b;
   // cout <<c<<endl;
    d=sqrt(c);

    if (c==d*d)
    cout <<"Yes"<<endl;
    else cout <<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
def Lucas(n, k):
    if n&k == k:
        return 1
    else:
        return 0

n = int(input())
a = list(map(int, list(input())))
odd = 0
cnt = 0
for i in range(n):
    a[i] -= 1
    if a[i] == 1:
        odd += Lucas(n-1, i)
        cnt = 1
if odd % 2 == 1:
    print(1)
else:
    if cnt == 1:
        print(0)
    else:
        for i in range(n):
            a[i] //= 2
            if a[i] == 1:
                odd += Lucas(n-1, i)
        print(odd%2 * 2)

Measured memory_bytes: 21588
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const bool debug=true;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

bool strnum_greater(string a, string b){
    if(a.size()!=b.size())return a.size() > b.size();
    rep(i,a.size()){
            if(a[i]!=b[i])return a[i]>b[i];
    }
    return false;

}

int main(void) {
    int n,m;
    cin >> n >> m;
    vector<int> available_n(8,0);
    rep(i,m){
        int tmp;
        cin >> tmp;
        if(tmp==3||tmp==2||tmp==5)available_n[5]=max(available_n[5],tmp);
        if(tmp==1)available_n[2]=max(available_n[2],tmp);
        if(tmp==4)available_n[4]=max(available_n[4],tmp);
        if(tmp==7)available_n[3]=max(available_n[3],tmp);
        if(tmp==8)available_n[7]=max(available_n[7],tmp);
        if(tmp==6||tmp==9)available_n[6]=max(available_n[6],tmp);
    }

    vector<string> dp(n+1,"0");
    rep(i,n){
        if(i!=0&&dp[i]=="0")continue;
        for(int j=2;j<=7;j++){
            if(i+j>n)continue;
            if(available_n[j]!=0&&strnum_greater(dp[i]+to_string(available_n[j]),dp[i+j]))dp[i+j]=dp[i]+to_string(available_n[j]);
        }
    }
    dp[n].erase(dp[n].begin());
    cout << dp[n] << endl;

    return 0;
}


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

static const int maxai = 1000001;

void add(vector<int> &a, int x, int y, vector<pair<int, int>> &ans)
{
	ans.push_back({x + 1, y + 1});
	a[x] += a[y];
}

int main()
{
	int n;
	scanf("%d", &n);
	vector<int> a(n);
	int mx = -maxai, mn = maxai, argmx = 0, argmn = 0;
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
		if (a[i] > mx)
		{
			mx = a[i];
			argmx = i;
		}
		if (a[i] < mn)
		{
			mn = a[i];
			argmn = i;
		}
	}

	vector<pair<int, int>> ans;
	if (mx != mn)
	{
		if (abs(mx) >= abs(mn))
		{
			for (int i = 0; i < n; i++)
				if (a[i] < 0)
					add(a, argmx, i, ans);
			for (int i = 1; i < n; i++)
				add(a, i - 1, i, ans);
		}
		else
		{
			for (int i = 0; i < n; i++)
				if (a[i] > 0)
					add(a, argmn, i, ans);
			for (int i = n - 1; i > 0; i--)
				add(a, i, i - 1, ans);
		}
	}
	printf("%ld\n", ans.size());
	for (int i = 0; i < ans.size(); i++)
		printf("%d %d\n", ans[i].first, ans[i].second);

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_map>
#include<unordered_set>
using namespace std;
typedef long long ll;
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;
#define mul(a,b) a=a*b%mod;
ll h,w,n;
ll id(){
    ll x,y; cin>>x>>y;
    if(y==0)return x;
    if(x==h)return y+h;
    if(y==w)return (h-x)+h+w;
    if(x==0)return (w-y)+h+h+w;
    return -1;
}
vector<pair<ll,ll> >v;
int main(){
  cin>>h>>w>>n;
  for(int i=1;i<=n;i++){
      ll vl=id(),vr=id();
      if(vl>=0&&vr>=0){
          if(vl>vr)swap(vl,vr); //cout<<vl<<" "<<vr<<endl;
          v.push_back(make_pair(vl,+i));
          v.push_back(make_pair(vr,-i));
      }
  }
  sort(v.begin(),v.end());
  bool ans=1;
  vector<ll> s;
  for(auto p:v){
     if(p.second>0) s.push_back(p.second);
     if(p.second<0){
         if(s.back()!=-p.second)ans=0;
         s.pop_back();
     }
  }
  cout<<(ans?"YES":"NO")<<endl;
  return 0;
}


Measured memory_bytes: 6512
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        sc.close();
        String sFront = s.substring(0, n / 2);
        String sBack = s.substring(n / 2, n);
        if (n % 2 != 0 || !sFront.equals(sBack)) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var a=sc.Ia;
		var h=new int[s[1]*2];
		for(int i = 0;i<s[1];i++) {
			h[i]=a[i];
			h[i+s[1]]=a[i]+s[0];
		}
		int ans=int.MaxValue;
		for(int i = s[1]-1;i<h.Length;i++) {
			ans=Min(ans,h[i]-h[i-s[1]+1]);
		}
		Console.WriteLine(ans);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 34652
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>
#include <fstream>

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;

int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	ll a, b; cin >> a >> b;
	cout << max(0LL, a - 2 * b) << endl;
	return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FASTIO ios_base::sync_with_stdio(false);cout.tie(NULL);cout.tie(NULL);
#define inf 1e18

int main(){
    FASTIO;
    ll tt=1;
    //cin>>tt;
    while(tt--){
         ll a,b,c,d;cin>>a>>b>>c>>d;
         for(ll i=0;;i++){
             c-=b;
             if(c<=0){cout<<"Yes";return 0;}
             a-=d;
             if(a<=0){cout<<"No";return 0;}
         }
    }
}


Measured memory_bytes: 3652
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;

int main(){
    while(true){
        int n, q, m, d;
        int mxd=0;
        set<int> s[50];
        int date=0;
        cin >> n >> q;
        if(!(n||q)) break;
        --q;
        for(int i=0;i<n;++i){
            cin >> m;
            for(int j=0;j<m;++j){
                cin >> d;
                s[i].insert(d);
                mxd = max(mxd, d);
            }
        }
        for(int i=1;i<=mxd;++i){
            int cnt=0;
            for(int j=0;j<n;++j){
                if(s[j].find(i)!=s[j].end()) ++cnt;
            }
            if(q<cnt){
                q = cnt;
                date = i;
            }
        }
        cout << date << endl;
    }
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

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

  int i = 0;
  while(n != 0){
    n /= k;
    i++;
  }
  
  cout << i << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
int main(){
  int n,m;cin>>n>>m;
  int a[n+m-1],b[n+m-1];
  vector<int> v[n+1];
  bool oya[n+1];
  int cnt[n+1];
  fill(cnt,cnt+n+1,0);
  fill(oya,oya+n+1,false);
  for(int i=0;i<n+m-1;i++){
    cin>>a[i]>>b[i];
    v[a[i]].push_back(b[i]);
    oya[b[i]]=true;
    cnt[b[i]]++;
  }
  int cn[n+1];
  fill(cn,cn+n+1,0);
  for(int i=1;i<=n;i++)sort(v[i].begin(),v[i].end());
  int d[n+1];
  fill(d,d+n+1,-1);
  int num;
  for(int i=1;i<n+1;i++){
    if(oya[i]==false){
      num=i;
      break;
    }
  }
  d[num]=0;
  queue<pii> q;
  int deff[n+1];
  deff[num]=0;
  q.push(make_pair(1,num));
  while(q.size()>0){
    pii p=q.front();q.pop();
    int pf=p.first;int ps=p.second;
    for(int i=0;i<v[ps].size();i++){
      int now=v[ps][i];
      if(d[now]<pf){
        cn[now]++;
        if(cn[now]>=cnt[now])q.push(make_pair(pf+1,now));
        d[now]=pf;
        deff[now]=ps;
      }
      else if(d[now]==pf){
        int aite=deff[now];
        int y=upper_bound(v[ps].begin(),v[ps].end(),aite)-v[ps].begin();
        if(y==0||v[ps][y-1]!=aite){
          deff[now]=ps;
        }
        else deff[now]=aite;
      }
    }
  }
  for(int i=1;i<=n;i++)cout<<deff[i]<<endl;
}

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

#define MAXCHAR 200000

int main(void)
{
    int c;
    int i = 0;
    char strinput[MAXCHAR];
    while ((c = getchar()) != ' ')
    {
        strinput[i] = c;
        /* printf("%s\n",strinput); */
        i=i+1;
    }
    strinput[i] = '\0';

    double tap= atof(strinput);

    i=0;
    while ((c = getchar()) != EOF)
    {
        strinput[i] = c;
        /* printf("%s\n",strinput); */
        i=i+1;
    }
    strinput[i] = '\0';

    double hope=atof(strinput);

    /* (A-1)(n-1) + A > B */
    /* (A-1)n + 1 > B */
    /* n > (B-1)/(A-1) */

    int result2 = (hope-1)/(tap -1) + 0.9;
    printf("%d",result2);
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
using namespace std;
typedef long long LL;
typedef double db;
const int oo=2139063143;
const int N=3010;
const int P=1000000007,inv2=(P+1)>>1;
const db eps=1e-7;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
    if (x< 0) putchar('-'),x=-x;
    if (x>=10) print(x/10);
    putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
template <typename T1,typename T2>
void chkmax (T1 &A,T2 B) { A=A>=B?A:B; }
template <typename T1,typename T2>
void chkmin (T1 &A,T2 B) { A=A<=B?A:B; }
int del(int x) { return x>=P?x-P:x; }
void add(int &x,int y) { x=del(x+y); }
int ksm (int a,int b)
{
	int ans=1;
	while (b)
	{
		if (b&1) ans=(LL)ans*a%P;
		a=(LL)a*a%P,b>>=1;
	}
	return ans;
}
int n,m,a[N],b[N];
int f[N][N],g[N][N];
int main ()
{
    // freopen (".in","r",stdin);
    // freopen (".out","w",stdout);
	sc(n),sc(m); int s=ksm (2,m);
	for (int i=1; i<=n; i++)
		sc(a[i]),b[i]=a[i];
	for (int i=1; i<=n; i++)
		for (int j=1; j<=n; j++)
			f[i][j]=b[i]< b[j];
	while (m--)
	{
		int x,y; sc(x),sc(y);
		for (int i=1; i<=n; i++)
			g[i][x]=f[i][x],g[i][y]=f[i][y],g[x][i]=f[x][i],g[y][i]=f[y][i];
		for (int i=1; i<=n; i++) if (i!=x&&i!=y)
		{
			f[i][x]=f[i][y]=(LL)inv2*(g[i][x]+g[i][y])%P;
			f[x][i]=f[y][i]=(LL)inv2*(g[x][i]+g[y][i])%P;
		}
		f[x][y]=f[y][x]=(LL)inv2*(g[x][y]+g[y][x])%P;
	}
	int ans=0;
	for (int i=1; i<=n; i++)
		for (int j=1; j< i; j++)
			add(ans,f[i][j]);
	pr((LL)ans*s%P);

    return 0;
}

Measured memory_bytes: 70912
use proconio::input;


fn main() {
    
    let  a : [i128 ; 3 ] = [ 7 ,5 , 3 ];
    let mut _x : i128 ;
    input!{

   x: i128 , 
 
   }

   if a.contains(&x){
       println!("YES");
   }else{
       println!("NO");
   }
}



Measured memory_bytes: 2156
import numpy as np
n = int(input())

l = np.array(list(map(int,input().split())))

l.sort()
l = l[::-1]
ans = 0
for i in range(n-2):
    j = i+1
    k = n-1
    while j < k:
        if l[i] < l[j] + l[k]:
            ans += k - j
            j += 1
        else:
            k -= 1
print(ans)




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

int count_bit(int b) {
  int c = 0;
  for(int i = 0; i <= 10; ++i) {
    if((b & (1 << i)) != 0) {
      c++;
    }
  }
  return c;
}

template <class T> inline bool chmax(T& a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
}

const int INF = 1e9;

int main() {
  int N;
  cin >> N;
  vector<int> fs(N, 0);
  for(int i = 0; i < N; ++i) {
    int f;
    for(int j = 0; j < 10; ++j) {
      cin >> f;
      fs[i] |= (f << j);
    }
  }
  vector<vector<int>> ps(N, vector<int>(11, 0));
  for(int i = 0; i < N; ++i) {
    for(int j = 0; j < 11; ++j) {
      cin >> ps[i][j];
    }
  }
  int ans = -INF;
  for(int i = 1; i < (1 << 10); ++i) {
    int anss = 0;
    for(int j = 0; j < fs.size(); ++j) {
      int c = count_bit(i & fs[j]);
      anss += ps[j][c];
    }
    chmax(ans, anss);
  }
  cout << ans << endl;
  return 0;
}

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

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

using namespace std;



void one_case() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll best = -1e18;
    best = max(best, a * c);
    best = max(best, a * d);
    best = max(best, b * c);
    best = max(best, b * d);
    cout << best;

}


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

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


Measured memory_bytes: 3648
#include<stdio.h>
#include<stdlib.h>

int main(void){

    int W,a,b,distance;

    scanf("%d %d %d",&W,&a,&b);

    if((a <= b && b <= (a+W)) || (b <= a && a <= (b+W))){
        distance = 0;
    }else{
        if(abs(b-(a+W)) < abs(a-(b+W))){
            distance = abs(b-(a+W));
        }else{
            distance = abs(a-(b+W));
        }
    }

    printf("%d",distance);
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int CountDivisors (int a,int b, int c){
	int i;
	int count=0;
	for (i=a; i<=b; i++){
		if (c%i==0){
			count++;
		}
	}
	return count;
}
int main(void){
	int a, b, c, x;
	scanf("%d %d %d", &a, &b, &c);
	x=CountDivisors(a,b,c);
	printf("%d\n", x);
	
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
long long int k,i,d,m,arr[100];
int main()
{
    cin>>k;
    d=k/50;
    m=k%50;
    for(i=0;i<=49;i++)
    {
        arr[i]=i+d;
    }
    for(i=49;i>=0;i--)
    {
        if(m==0)break;
        arr[i]++;
        m--;
    }
    cout<<50<<endl;
    for(i=0;i<50;i++)
    {
        cout<<arr[i];
        if(i!=49)cout<<" ";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int n) { return n & 1; }
constexpr bool even(const int n) { return ~n & 1; }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) break;
    auto s = in(vector<double>(n));
    double m = accumulate(all(s), 0.0) / n;
    double t = 0;
    rep(i, n) t += (s[i] - m) * (s[i] - m);
    cout << prec(32) << sqrt(t / n) << endl;
  }
}



Measured memory_bytes: 3296
#include <stdio.h>

int main(){
	int n, k;
	int m=1;
	scanf("%d %d", &n, &k);
	if(n==1) printf("%d", k);
	if(n>=2){
		for(int i=0; i<n-1; i++){
			m=m*(k-1);
		}
		printf("%d", k*m);
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef long long ll;

ll d[100004];
void cal(int n,int m,ll a[]){
    ll s;
    for(int i=2;i<n;i++){
        s=999999999;
        for(int j=1;j<=m;j++){
            if(j<=i) s = min(d[i-j]+abs(a[i]-a[i-j]) , s);
        }
        d[i]=s;
    }
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0);
    int n,m;
    cin>>n>>m;
    ll a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) d[i]=9999999;
    d[0]=0;
    d[1] = abs(a[1]-a[0]);
    cal(n,m,a);
    //for(int i=0;i<n;i++) cout<<d[i]<<" ";
    cout<<d[n-1];
}

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

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

    if (A >= B) {
        cout << "delicious" << endl;
    }
    else {
        if (B - A <= X) {
            cout << "safe" << endl;
        }
        else {
            cout << "dangerous" << endl;
        }
    }
}

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

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

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

    int n, m;
    cin>>n>>m;
    vector<int> as(m);
    rep(i, m) cin>>as[i];
    if (m == 0) as.push_back(0);

    vector<ll> dp(n + 1);
    dp[0] = 1;
    int j = 0;
    rep(i, n) {
        if (i + 1 == as[j]) {
            if (j < m - 1) j++;
        }
        else if (i + 1 <= n) dp[i + 1] = (dp[i + 1] + dp[i]) % 1000000007;
        if (i + 2 != as[j] && i + 2 <= n) {
            dp[i + 2] = (dp[i + 2] + dp[i]) % 1000000007;
        }
    }
    cout<<dp[n]<<endl;
}

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

int main(){
  ll n, k;
  cin >> n >> k;
  
  double prob = 0;
  for(int i=1; i<=n; i++){
  	if(i >= k){
      prob += (1/(double)n);
      continue;
    }
    double j = 1;
    while((double)i*pow(2.0, j) < k){
      j++;
    }
    prob += (1/(double)n) * pow(0.5, j);
  }
  printf("%9.15lf\n", prob);
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;

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


int flagnum(int i, vector<int>s){
  int temp=0;
  REP(j, s.size()){
    if (i & (1<<(s[j]-1)))
      temp++;
  }

  return(temp);
}


int main () {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> s(m);
  int k;
  int l;
  REP(i, m){
    cin >> k;
    
    REP(j, k){
      cin >> l;
      s[i].push_back(l);
    }
  }
  vector<int> p(m);

  REP(i, m){
    cin >> p[i];
  }
  int ans=0;
  int temp=1;

  REP(i, pow(2, n)){
    temp=1;
    REP(j, m){
      if (flagnum(i, s[j])%2!=p[j]){
	temp=0;
	break;
      }
    }
    if (temp==1)
      ans++;
  }
  cout<<ans;
  return 0;
}


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

using namespace std;

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

typedef long long ll;

const ll mod = 1000000007;
const double pi = 3.1415926535897932384626;

ll powmod(ll a, ll b) {ll res = 1; ll rem = a % mod; for (; b; b >>= 1) {if (b & 1) res = (res * rem) % mod; rem = (rem * rem) % mod;} return res;}

const int N = 108;

ll ara[N];

int main()
{
    //freopen("in", "r", stdin);
    //freopen("out", "w", stdout);
    
    int n = 0;
    ll g = 0ll;
    ll l = 0ll;
    scanf("%d", &n);

    for (int i = 1; i <= n; ++i) {
	ll a = 0ll;
	scanf("%lld", &a);
	if (i == 1) {
	    g = a;
	    l = a;
	}
	else {
	    g = __gcd(l, a);
	    l = (l / g) * a;
	}
    }

    printf("%lld\n", l);
    return 0;
}
	
	


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

typedef pair<int,int> P;

signed main(){
	int n,ma = 0,dp[200010] = {};
	vector<P> vec;
	cin >> n;
	for(int i = 0;i < n;i++){
		int x,s;
		cin >> x >> s;
		vec.push_back(P(x,s));
	}
	sort(vec.begin(),vec.end());
	for(int i = 0;i < n;i++){
		if(!i) dp[i] = vec[i].second;
		else dp[i] = max(vec[i].second,dp[i - 1] + vec[i].second - vec[i].first + vec[i - 1].first);
		ma = max(ma,dp[i]);
	}
	cout << ma << endl;
	return 0;
}

Measured memory_bytes: 7920
#include <cstdio>

int count_white(char *S, int N)
{
    int count = 0;
    for(int i=0; i<N; i++){
        if(*(S+i) == '.')
            count++;
    }
    return count;
}

int search(char *S, int N, int count)
{
    int min = count;
    int tmp = count;
    for(int i=0; i<N; i++){
        tmp += (*(S+i) == '#') ? 1 : -1;
        if(tmp < min)
            min = tmp;
    }
    return min;
}

int main()
{
    int N;
    scanf("%d", &N);
    char S[N+1];
    scanf("%s", S);

    int count = count_white(S, N);
    int min = search(S, N, count);
    printf("%d\n", min);

    return 0;
}


Measured memory_bytes: 384
/* ****mittal**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
using namespace std;

#define N  100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        ll a,b;
        cin>>a>>b;
        for(int i=0;true;i++)
        {
        	if(i*a-i+1>=b)
        	{
        		cout<<i;
        		return 0;
        	}
        }


    }
    return 0;
}

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

template<typename T>
istream &operator >> (istream &istr, vector<T> &v){
    for(T &x: v) istr >> x;
    return istr;
}

template<typename T, typename U>
istream &operator >> (istream &istr, pair<T,U> &p){
    istr >> p.first >> p.second;
    return istr;
}

template<typename T>
ostream &operator << (ostream &ostr, vector<T> &v){
    if(!v.empty()){
        ostr << v.front();
        for(auto itr = ++v.begin(); itr != v.end(); itr++)
            // ostr << *itr;
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream &operator << (ostream &ostr, pair<T,U> &p){
    // ostr << p.first << p.second;
    // ostr << p.first << ", " << p.second;
    ostr << "(" << p.first << ", " << p.second << ")";
    return ostr;
}

template<typename T>
ostream &operator << (ostream &ostr, vector<vector<T>> &vv){
    if(!vv.empty()){
        ostr << vv.front();
        for(auto itr = ++vv.begin(); itr != vv.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream &operator << (ostream &ostr, vector<pair<T,U>> &vp){
    if(!vp.empty()){
        ostr << vp.front();
        for(auto itr = ++vp.begin(); itr != vp.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<double> vd;
// vll v(n); v[i]=x;
typedef vector<vll> vvll;
typedef vector<vc> vvc;
typedef vector<vd> vvd;
// vvll v(m,vll(n)); v[i][j]=x;
typedef pair<ll,ll> pll;
typedef pair<double,double> pd;
typedef vector<pll> vpll;
typedef vector<pd> vpd;
// vpll v(n); v[i]=make_pair(x,y); v[i].first/second;
// v.front() : v[0]
// v.back()  : v[v.size()-1]

#define PI 3.1415926535897932
#define EPS 1e-12
#define INF ((ll)1e+12)
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<=(b); i++)
#define FORR(i,a,b) for(ll i=(b); i>=(a); i--)
#define fix(x) cout << fixed << setprecision(x)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()

template<typename T> T sum(vector<T> &v){return accumulate(all(v), (T)0);}
template<typename T> inline void sort(vector<T> &v){sort(all(v));}
template<typename T> inline void rsort(vector<T> &v){sort(all(v), greater<T>());}
template<typename T> inline void chmin(T &a, T b){if(a>b) a=b;}
template<typename T> inline void chmax(T &a, T b){if(a<b) a=b;}

int main(){
    string s, t;
    cin >> s >> t;
    REP(i,s.size()){
        if(s[i] != t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3592
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long double a, b, c;
    cin >> a >> b >> c;
    cout << fixed << setprecision(10);
    cout << a * b * sin(c * M_PI / 180) / 2 << '\n';
    cout << a + b + sqrt(a * a + b * b - 2 * a * b * cos(c * M_PI / 180)) << '\n';
    cout << b * sin(c * M_PI / 180) << '\n';
  
    return 0;
}


Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  string s;
  cin>>s;
  for(int i=0;i<3;i++){
    if(s.at(i)==s.at(i+1)){
      cout<<"Bad";
      return 0;
    }
  }
  cout << "Good";
  return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        d: f64,
        p: [(f64, f64); n],
    }
    println!(
        "{}",
        p.iter()
            .map(|&(x, y)| (x * x + y * y).sqrt())
            .filter(|&dist| dist <= d)
            .count()
    );
}


Measured memory_bytes: 7812
#include <stdio.h>
int main(void){
	int S;
	int h,m,s;
	
	scanf("%d",&S);
	
	h=S/3600;
	S%=3600;
	m=S/60;
	s=S%60;
	
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592
#include<stdio.h>
#include<math.h>
#include <stdlib.h>
#include<string.h>
#include<limits.h>

int main(){
	char str[1025]={'\0'};
	char len[1000][1025]={'\0'};
	int i,j,k,count=0;
	
	while(fgets(str,sizeof(str),stdin)!=NULL){
	for(i=0,j=0,k=0;i<strlen(str)-1;i++,k++){
		if(str[i]==' '){
			j++;
			i++;
			k=0;
		}
		if(str[i]=='.' || str[i]==',');
		else len[j][k]=str[i];
	}
		for(i=0;i<=j;i++){
			if(strlen(len[i])>=3 && strlen(len[i])<=6){
				if(count==0)printf("%s",len[i]);
				else printf(" %s",len[i]);
				count++;
			}
		}
		printf("\n");
		for(k=0;k<1000;k++){
			for(i=0;i<1025;i++){
				len[k][i]='\0';
			}
		}
		for(i=0;i<1025;i++){
			str[i]='\0';
		}
		count=0;
	}
return 0;
}

Measured memory_bytes: 1532
#include<bits/stdc++.h>
#define IOS                      \
    ios_base::sync_with_stdio(0);\
    cin.tie(0);                  \
    cout.tie(0);
#define eps 1e-6
#define ll long long
//#define int long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
const int mod=1000000007;
using namespace std;
//typedef pair<int ,int> P;
int main()
{
    int x;
    cin>>x;
    int ha=0;
    ha=x/500*1000;
    x=x%500;
    ha+=x/5*5;
    cout<<ha;
}


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

using ll=long long;
int main(){
    ll n,p;
    cin>>n>>p;
    map<ll,int> cnt;
    for(int i=2;i<=1000000;i++){
        while(p%i==0){
            cnt[i]++;
            p/=i;
        }
    }
    if(p!=1){
        cnt[p]++;
    }
    ll res=1;
    for(auto &e:cnt){
        ll v=e.first;
        ll time=e.second/n;
        for(int i=0;i<time;i++){
            res*=v;
        }
    }
    cout<<res<<endl;


    return 0;
}

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

int main(){
  int N,W;
  cin >> N >> W;

  vector<int> w(N);
  vector<long long> v(N);
  for (int i = 0; i < N; i++)
  {
    cin >> w[i] >> v[i];
  }

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

Measured memory_bytes: 80256
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
signed main() {
    IOS;
    int h, a;
    cin >> h >> a;
    cout << (h-1)/a + 1;   
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
const int MXN = 3 * 1e5 + 5;
int n;
int a[MXN];
 
int main() {
	ios_base::sync_with_stdio(false);
	cin>>n;
	for (int i=0; i<3*n; i++) cin>>a[i];
	sort(a, a+3*n);
	int cnt = 0;
	long long res = 0;
	for (int i=3*n-2; i>=0 && cnt < n; i-=2, cnt++) {
		res += a[i];
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>

using namespace std;

int main(){
	
	int i, mozisu;
	string komozi;
	getline(cin, komozi);
	mozisu = komozi.size();

	for(i = 0; i < mozisu; i++){
		if(komozi[i] < 91){
			continue;
		}

		else{
			komozi[i] = komozi[i] - 32;
		}
	}

	cout << komozi << endl;

	return 0;
}

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

using namespace std;
using ll = long long;

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

    int N; cin >> N;

    vector<int> h(N);
    for (int i = 0; i < N; ++i) cin >> h[i];

    vector<int> dp(N, 0);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for (int i = 2; i < N; ++i)
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]),
            dp[i - 2] + abs(h[i] - h[i - 2]));

    cout << dp[N - 1] << "\n";

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  int N;
  cin>>N;
  for (int i(1);i<10;i++){
    for (int j(1);j<10;j++){
      if (N==i*j) {
       cout << "Yes" << endl;
       return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  usaco
//
//  Created by 김현수 on 2020/08/30.
//  Copyright © 2020 김현수. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
    int a;
    scanf("%d", &a);
    if(a%2==0)
    {
        printf("%d",(a/2)*(a/2));
    }
    else if(a%2!=0)
    {
        printf("%d", (a/2)*(a/2+1));;
    }
}


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

int main() {
  double r;
  cin >> r;
  double p = 3.141592653589793238;

  cout << setprecision(15) << r * r * p << " ";
  cout << setprecision(15) << 2 * r * p << endl;
}



Measured memory_bytes: 3288
def main():
    
    end, start, divisor = [int(i) for i in input().split()]
    '''
    end = 1
    start = 1000 000 000 000 000 000
    divisor = 3
    '''

    if end % divisor == 0:
        a = start//divisor - end//divisor + 1
    else:
        a = start//divisor - end//divisor

    print(a)

main()

Measured memory_bytes: 9172