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

int main() {
	
 int n,a(0),b(0);
  cin >> n;
 vector<int> A(n);
  for(int i  = 0;i < n;i++){
    cin >> A[i];
  }
  sort(A.begin(),A.end());
  for(int i = 0 ; i < n;i++){
   if(i % 2 == 0){
     a += A[i];
  }else{
     b += A[i]; 
   }
  }
	cout << abs(b - a);
}


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

#define test(t) while(t--)

#define ll  long long int

#define in  cin>>
#define out cout<<
#define en "\n"
#define sp " "
#define pb push_back
#define fast()  ios_base::sync_with_stdio(false);cin.tie(0);



using namespace std;

void solve()
{ll s;
 in s;
 ll n = s%10;
 if(n==2||n==4||n==5||n==7||n==9)
    out "hon"<<en;
 else if(n==0||n==1||n==6||n==8)
    out "pon"<<en;
 else
    out"bon"<<en;
}

int main(){ fast()
             //freopen("input.txt","r",stdin);
             //freopen("output.txt","w",stdout);
             ll t=1;
            //cin>>t;
            test(t){
            solve();
            }
return 0;}


Measured memory_bytes: 3688
def print_A():
    for k, e in enumerate(A):
        if k == N - 1:
            print(e)
        else:
            print(e, end=' ')


N = int(input())
A = [int(n) for n in input().split()]
print_A()
for i in range(1, N):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print_A()



Measured memory_bytes: 5980
import math
a,b,h,m = map(int,input().split())
ra = h * 30 + m * 0.5
rb = m * 6
r = math.radians(abs(ra-rb))
# (abs(ra-rb)*math.pi)/180
print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(r)))


Measured memory_bytes: 62424
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()


string s,t;
 
void solve(){
 cin >> s >> t;
 ll n=s.size();
 vvll p(26);
 rep(i,0,n) p[s[i]-'a'].eb(i); 
 rep(i,0,n) p[s[i]-'a'].eb(i+n);
  
 ll res=0,x=0;
 for(auto c:t){ 
   c-='a';
   if(p[c].size()==0) {
     cout << -1 << endl;
     return;
   }
   x=*lower_bound(all(p[c]),x)+1;
   if(x>=n){
   x-=n;
   res+=n;
   }
 }
  res+=x;
  cout << res << endl;
}

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

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ULL unsigned long long
#define LL long long

using namespace std;

ULL sum=0;
int N;
string S;
int SS[5000];
int mem[5000][3];//RGB mem[a][1]=a以上の要素に1が含まれる数


void count(int first,int second){
	//3番目
	if(first!=-1 && second!=-1){
		if(mem[second+1][3-SS[first]-SS[second]]!=-1){
			sum+=mem[second+1][3-SS[first]-SS[second]];
			if(second*2-first<N){
				if(SS[second*2-first]==3-SS[first]-SS[second]){
					sum--;
				}
			}
		}else{
			int sum_=0;
			for(int third=second+1;third<N;third++){
				if(SS[third]==3-SS[first]-SS[second]){
					sum_++;
				}
			}
			mem[second+1][3-SS[first]-SS[second]]=sum_;
			sum+=sum_;
			if(second*2-first<N){
				if(SS[second*2-first]==3-SS[first]-SS[second]){
					sum--;
				}
			}
		}
	}else if(first!=-1){//2番目
		for(second=first+1;second<N;second++){
			if(SS[second]!=SS[first]){
				count(first,second);
			}
		}
	}else{//1番目
		for(first=0;first<N;first++){
			count(first,-1);
		}
	}
}
int main(){
	for(int i=0;i<5000;i++){
		SS[i]=-1;
		mem[i][0]=mem[i][1]=mem[i][2]=-1;
	}
	
	cin >> N >> S;
	rep(i,N){
		if(S.at(i)=='R'){
			SS[i]=0;
		}else if(S.at(i)=='G'){
			SS[i]=1;
		}else{
			SS[i]=2;
		}
	}
	
	count(-1,-1);
	cout << sum << endl;
	
	return 0;
}

Measured memory_bytes: 3728
import heapq
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort()
apples = p[:x] + q[:y]
heapq.heapify(apples)
while r:
    val = r.pop()
    apple = heapq.heappop(apples)
    if apple>= val:
        heapq.heappush(apples,apple)
        break
    else:
        heapq.heappush(apples,val)
print(sum(apples))

Measured memory_bytes: 99284
/***
 **   A S M Atikur Rahman
 **   Update: 26-03-2020
***/

//#include <bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<cstring>
#include<time.h>
#include<limits.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<bitset>
#include<utility>
#include<iterator>
#include<algorithm>
#include<cassert>
#include<iomanip> ///setprecision


#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define sci(x) scanf("%d%*c", &(x))
#define scll(x) scanf("%lld%*c", &(x))
#define scd(x) scanf("%lf%*c", &(x))
#define scstr(x) scanf("%s", x)
#define pfi(x) printf("%d", (x))
#define pfll(x) printf("%lld", (x))
#define pfd(x) printf("%f", (x))
#define pfstr(x) printf("%s", (x))
#define ps printf(" ")
#define pn printf("\n")
#define pfdot printf("..")

#define For(a,n) for(int i=(a); i<(n); i++)
#define rFor(n,a) for(int i=n-1; i>=0; i--)
#define trav(a,x) for (auto& a : x)
#define Mset(ara, val) memset(ara, val, sizeof(ara))

#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound

#define pi  (2*acos(0))


using namespace std;

using ll=long long;
using pii= pair<int,int>;
using pll= pair<long long, long long>;
using pcc= pair<char, char>;
using pdd= pair<double, double>;

#define V(a) vector<a>
using vi= vector<int>;
using vs= vector<string>;
using vll= vector<ll>;
using vpii= vector<pii>;
using vc= vector<char>;
using vd= vector<double>;

//ll POW(ll a,ll b){if(b==0)return 1;ll x=POW(a,b/2);x=(x*x);if(b&1)x=(x*a);return x;}
//ll Sqrt(ll a) { ll x=(ll)sqrt(a); if((x+1)*(x+1)==a) x++; return x; }



int main( int argc, char *argv[] )
{
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stout);
    int x,y,n,ans=0, ara[2100] {0},i,j;
    cin>>n>>x>>y;
    //for(int k=1; k<n; k++)
    {
        for(i=1; i<n; i++)
        {
            for(j=i+1; j<=n; j++)
            {
                int tmp;
                //printf("%d %d..", i, j);
                if(x>=i && y<=j)
                {
                    tmp=(j-i)-(y-x)+1;
                }
                else if(i>=x && j<=y)
                {
                    tmp=min(j-i, i-x+y-j+1);
                }
                else if(j>=x && j<=y)
                {
                    tmp =x-i;
                    tmp+=min(j-x, y-j+1);
                }
                else if(i>=x && i<=y)
                {
                    tmp=j-y;
                    tmp+=min(y-i, i-x+1);
                }
                else tmp=j-i;
                ara[tmp]++;
                //printf("%d..\n", tmp);
            }
        }
    }
    for(i=1; i<n; i++)
    {
        printf("%d\n", ara[i]);
    }






    return 0;
}
























Measured memory_bytes: 256
# coding: utf-8

# https://atcoder.jp/contests/abc081/tasks/arc086_a
# 14:07-14:14 done


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    A = sorted(A)

    cnt = {}
    for a in A:
        if a in cnt:
            cnt[a] += 1
        else:
            cnt[a] = 1
    
    num_cnts = [[k, v] for k, v in cnt.items()]

    if len(num_cnts) <= K:
        return 0

    num_cnts = sorted(num_cnts, key=lambda x: x[1], reverse=True)
    ans = sum([cnt for num, cnt in num_cnts[K:]])

    return ans


print(main())


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

int main(void) {
  int n, count = 0, ans;
  scanf("%d", &n);
  while (n > 0) {
    n = n / 2;
    count++;
  }
  ans = (int)pow(2, count - 1);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 384
N=int(input())
if N==3:
  print(61)
  exit()
dp=[[0]*64 for i in range(N+1)]
dp[3]=[1]*64
dp[3][11],dp[3][14],dp[3][35]=0,0,0
NG=[]
mask=63
mod=10**9+7
for i in range(4):
  NG.append(64*i+16*0+4*2+3)
  NG.append(64*0+16*2+4*i+3)
  NG.append(64*0+16*i+4*2+3)
  NG.append(64*i+16*0+4*3+2)
  NG.append(64*i+16*2+4*0+3)
for i in range(3,N):
  for k in range(64):
    for s in range(4):
      flag=True
      for ng in NG:
        if ng==((k<<2)+s):
          flag=False
          break
      if flag:
        dp[i+1][((k<<2)+s)&mask]+=dp[i][k]
        dp[i+1][((k<<2)+s)&mask]%=mod
ans=0
for k in range(64):
  ans+=dp[N][k]
  ans%=mod
print(ans)

Measured memory_bytes: 39792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define f first
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
using namespace std;
typedef pair<ll, ll> pii;
typedef vector<vector<ll>> mat;
const ll mod = 1e9+7;
const int MAXN = 1e5+5;

int fat[1005];


int main() {
	int k,a , b;
	cin >> k >> a >> b;
	for(int i = a; i <= b; i++)
		if(i%k == 0) {
			cout << "OK" << endl;
			return 0;
		}
	cout <<"NG" << endl;
}


Measured memory_bytes: 3624
//#if 1
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
//#endif
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {

	string s;
	long long k;
	cin >> s >> k;
	for (int i = 0; i < k; i++) {
		if (s[i] != '1') {
			cout << s[i] << endl;
			return 0;
		}
		
	}
	cout << '1' << endl;




	return(0);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            Console.WriteLine(S.Replace("2017","2018"));
        }
    }
}

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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef unordered_set<int> si;
typedef pair<int, int> pp;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)


template <typename T>
void printV(vector<T> A) {
    if (A.empty()) cerr << "EMTPY\n";
    else { 
        cerr << "\n[";
        for (int i = 0; i < A.size() -1 ; ++i) {
            cerr << A[i] << ", ";
        }
        if (A.size()) cerr << A.back() << "]\n";
    }
}


template <typename T>
void printVV(vector<vector<T>> A) {
    cerr << "\n[";
    for (auto v : A) {
        printV<T>(v);
    }
    cerr << "]\n";
}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&& ...args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " |";
    __f(comma + 1, args...);
}

int main(int argc, char **argv) {
    ios::sync_with_stdio(false);
    string s, t;
    int n;
    cin >> n >> s >> t;

    string ans = "";
    for (int i = 0; i < n; ++i) {
        ans += string(1, s[i]) + string(1, t[i]);
    }

    cout << ans << endl;

    return 0;
}



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

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> V(N);
    for(int i=0; i<N; i++)
        cin >> V[i];

    int ans = 0;
    for(int a=0; a<=N; a++){
        for(int b=0; b<=N-a; b++){
            for(int aa=0; aa<=a; aa++){
                for(int bb=0; bb<=b; bb++){
                    if(a + b + aa + bb > K) continue;
                    vector<int> x(a);
                    vector<int> y(b);
                    for(int i=0; i<a; i++) x[i] = V[i];
                    for(int i=0; i<b; i++) y[i] = V[N-1-i];
                    sort(x.begin(), x.end(), greater<int>());
                    sort(y.begin(), y.end(), greater<int>());
                    int tmp = 0;
                    for(int i=0; i<a-aa; i++)
                        tmp += x[i];
                    for(int i=0; i<b-bb; i++)
                        tmp += y[i];
                    ans = max(ans, tmp);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())

H = [0] * N
for i in range(N):
    H[i] = int(input())
H.sort()

d = H[K-1] - H[0]
for i in range(1, N-K+1):
    d = min(H[i+K-1] - H[i], d)
print(d)

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

int H, W, K;
vector<vector<char>> s;
int strayberry_number = 1;
vector<vector<int>> ans;


int numStrayberry(int h_start, int h_end, int w_start, int w_end) {

    int strayberry = 0;
    for (int i = h_start; i <= h_end; ++i)
    {
        for (int j = w_start; j <= w_end; ++j)
        {
            if(s[i][j] == '#') {
                strayberry++;
            }
        }
    }

    return strayberry;
}

void print() {
    for (int i = 0; i < ans.size(); ++i)
    {
        for (int j = 0; j < ans[i].size(); ++j)
        {
            printf("%d ", ans[i][j]);
        }
        cout << endl;
    }
    cout << endl;
}


void paint(int h_start, int h_end, int w_start, int w_end) {
    for (int i = h_start; i <= h_end; ++i)
    {
        for (int j = w_start; j <= w_end; ++j)
        {
            ans[i][j] = strayberry_number;
        }
    }
    // printf("---- print ----\n");
    // print();

    strayberry_number++;
}

void cut(int h_start, int h_end, int w_start, int w_end) {
    // printf("--- rec start ---\n");
    // printf("w_start : %d\n", w_start);
    // printf("w_end   : %d\n", w_end);
    // printf("h_start : %d\n", h_start);
    // printf("h_end   : %d\n", h_end);

    //矩形内のいちごの個数が1個になったら分割終了
    if(numStrayberry(h_start, h_end, w_start, w_end) == 1) { 
        paint(h_start, h_end, w_start, w_end); //矩形を番号で塗り潰す
        return;
    }

    //最初に見つかるいちごの位置
    int strayberry_h = 0;
    int strayberry_w = 0;
    for (int i = h_start; i <= h_end; ++i) {
        for (int j = w_start; j <= w_end; ++j) {
            if(s[i][j] == '#') {
                strayberry_h = i;
                strayberry_w = j;
                goto LABEL_EXIT;
            }
        }
    }

    LABEL_EXIT:
    //切る範囲をできるだけ下の方へ伸ばす
    int cut_h = strayberry_h;
    int cut_w = strayberry_w;
    for (int i = strayberry_h + 1; i <= h_end; ++i)
    {
        for (int j = w_start; j <= strayberry_w; ++j) //幅は最初にいちごが見つかったところまで
        {
            if(s[i][j] == '#') {
                cut_h = max(cut_h, i-1);
                goto LABEL_EXIT2;
            }
        }

        //最後まで到達したら、縦に切ることになる
        if(i == h_end) {
            cut_h = h_end;
        }
    }


    LABEL_EXIT2:
    //分割して再帰
    // printf(" ==> cut : %d, %d\n", cut_h, cut_w);
    if(cut_h < h_end) { //横に切る
        cut(h_start  , cut_h, w_start, w_end);
        cut(cut_h + 1, h_end, w_start, w_end);
    } else if(cut_w < w_end){ //縦に切る
        cut(h_start, h_end, w_start  , cut_w);
        cut(h_start, h_end, cut_w + 1, w_end);
    }

    return;
}




int main() {
    cin >> H >> W >> K;

    for (int h = 0; h < H; ++h){
        vector<char> tmp;
        vector<int> ans_tmp;

        for (int w = 0; w < W; ++w)
        {
            char c;
            cin >> c;
            tmp.push_back(c); //ケーキ

            ans_tmp.push_back(0); //答えの初期化

        }
        s.push_back(tmp); //ケーキ

        ans.push_back(ans_tmp); //答えの初期化
    }

    // printf("---- paint ----\n");
    // paint(0, W-1, 0, H-1);

    cut(0, H-1, 0, W-1);
    // printf("---- print ----\n");
    print();

    

	return 0;
}

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

double pi=3.14159265358979;

typedef struct P{
  double x;
  double y;
}point;

void printp(point );
void koch(int ,point ,point );

int main(){
  int n;
  point p1,p2;
  
  p1.x=0;
  p1.y=0;

  p2.x=100;
  p2.y=0;
  
  scanf("%d",&n);
  
  printp(p1);
  koch(n,p1,p2);
  
  printp(p2);
  return 0;
}

void printp( point p){
  printf("%.8f %.8f\n",p.x,p.y);
}

void koch(int n,point p1,point p2){
  if(n==0) return ;
  point a,b,c;
  
  a.x=(2*p1.x+p2.x)/3;
  a.y=(2*p1.y+p2.y)/3;
  
  b.x=(p1.x+2*p2.x)/3;
  b.y=(p1.y+2*p2.y)/3;
  
  c.x=(b.x-a.x)*cos(pi/3)-(b.y-a.y)*sin(pi/3)+a.x;
  c.y=(b.x-a.x)*sin(pi/3)+(b.y-a.y)*cos(pi/3)+a.y;
  
  koch(n-1,p1,a);
  printp(a);
  
  koch(n-1,a,c);
  printp(c);
  
  koch(n-1,c,b);
  printp(b);
  
  koch(n-1,b,p2);
  return ;
}



Measured memory_bytes: 2112
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#include<algorithm>
#include<map>
#include<set>
#include<functional>

using namespace std;

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

int X, A;

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

	if (X < A) {
		cout << 0 << endl;
	}
	else {
		cout << 10 << endl;
	}


}

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


int main(void){
  string a,b;
  int cnt=0;
  cin>>a>>b;
  r(i,3){
    if(a.at(i)==b.at(i))cnt++;
  }
  cout<<cnt<<endl;


return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int one,two;
  string mark;
  cin >> one>> mark >> two;
 
  if(mark=="+"){
    cout << one + two << endl;
  }
  if(mark=="-"){
    cout << one - two << endl;
  }
 
}

Measured memory_bytes: 256
/* ex4_3
   takafumi_ueki */
#include <stdio.h>
#include <math.h>
//プロトタイプ宣言
int tower(int n);
int main(void){
    int dif, height_west, height_east, ans;
    scanf("%d %d",&height_west,&height_east);
    //雪に埋れていても埋もれていなくても西と東の塔の高さの差は変わらない
    //西と東の塔の高さの差であるdifを求めることで、東の塔の高さが(1+2+…+dif)メートルと分かる
    dif = height_east - height_west;
    //東の塔の高さから雪に埋もれていない部分の高さを引いた値が積もっている雪の高さである。
    ans = tower(dif) - height_east;
    printf("%d\n",ans);
    return 0;
}
//関数の定義
int tower(int n){
    int hight;
    hight = n*(n + 1)/2;
    return hight;
}


Measured memory_bytes: 128
#include<stdio.h>
main(){
  int w,n,a[100],b[100],i,j,ww[100],www[100],temp,wwww[1000];
  scanf("%d %d",&w,&n);
  for(i=0;i<n;i++){
    scanf("%d,%d",&a[i],&b[i]);
  }
  for(j=1;j<=w;j++){
    ww[j]=j;
    www[j]=j;
    for(i=0;i<n;i++){
      if(ww[j]==a[i]){
	ww[j]=b[i];
      }
      else if(ww[j]==b[i]){
	ww[j]=a[i];
      }
    }
  }
  //ツバツブツδ仰ソツーツト
  for(i=w;i>0;i--){
    for(j=1;j<i;j++){
      if(ww[j]>ww[j+1]){
	temp=www[j];
	www[j]=www[j+1];
	www[j+1]=temp;
	temp=ww[j];
	ww[j]=ww[j+1];
	ww[j+1]=temp;
      }
    }
  }
  for(i=1;i<=w;i++){
    printf("%d\n",www[i]);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	int n;
	cin >> n;
	unordered_set<string> set;
	while (n--) {
		string s;
		cin >> s;
		set.insert(s);
	}
	cout << set.size() << endl;
}



Measured memory_bytes: 17700
#include <stdio.h>

int main(void)
{
	float BMI[100],weight[100],height[100];
	int Num[100];
	int i=0,count=0;
	while(scanf("%d,%f,%f",&Num[i],&weight[i],&height[i])!=EOF){
		i++;
		count++;
	}
	
	for(i=0;i<count;i++){
		BMI[i]=weight[i]/(height[i]*height[i]);
	}
	
	for(i=0;i<count;i++){
		if(BMI[i]>=25.00) printf("%d\n",Num[i]);
	}
	return 0;
}

Measured memory_bytes: 624
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
#define mod 1000000007
#define mk make_pair
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n+1]={0};
    ll dp[n+1][n+1][2];
    for(ll i=1;i<=n;i++)
    cin>>a[i];
    for(int i=0;i<=n;i++)
    {dp[i][i][0]=a[i];dp[i][i][1]=0;}
    for(int k=1;k<=n-1;k++)
    {   for(int i=1;i<n;i++)
        {
          int j=i+k;
          if(j>n)
          continue;
          else
          {
              ll t1=a[j]+dp[i][j-1][1];
              ll j1=dp[i][j-1][0];
              ll t2=a[i]+dp[i+1][j][1];
              ll j2=dp[i+1][j][0];
              if(t1-j1>t2-j2)
              {
                  dp[i][j][0]=t1;
                   dp[i][j][1]=j1;
              }
              else
              {
                   dp[i][j][0]=t2;
                  dp[i][j][1]=j2;
              }
          }
        }
    }
    
    ll ans=(dp[1][n][0]-dp[1][n][1]);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 140672
function main(input) {
    const args = input.split(' ');
    const a = parseInt(args[0], 10);
    const b = parseInt(args[1], 10);

    if ((a * b) % 2 === 0) {
        console.log('Even');
    } else {
        console.log('Odd');
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main()
{
	int n, d, i, j, k, sum, count=0;
	double dis;
	cin >> n >> d;
	int point[n][d];
	for( i = 0; i < n; i++ )
		for( j = 0; j < d; j++)
			cin >> point[i][j];
	for(i = 0; i < n; i++)
		for(j = i+1; j < n; j++)
		{
			sum = 0;
			for(k = 0; k < d; k++)
			{
				sum += pow(point[i][k]-point[j][k], 2);
			}
			dis = sqrt(sum);
			if(dis-(int)dis == 0)
				count++;
		}
	cout << count << endl;
}




Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int N;
  	char S[50];
  	int count=0;
  	int i;
  	scanf("%d",&N);
  	scanf(" %c",&S[0]);
  	for(i=1;i<N;i++){
      scanf("%c",&S[i]);
  	}
  	for(i=0;i<=N-3;i++){
    	if(S[i]=='A'&&S[i+1]=='B'&&S[i+2]=='C'){
        	count++;
        }
    }
  	printf("%d\n",count);
  	return 0;
}


Measured memory_bytes: 1684
#include <iostream>

int main(){
    int a, b, c;
    std::cin >> a >> b;
    if(a<13){
        if(a<6){
            c = 0;
        }else{
            c = b /2;
        }
    }else{
        c = b;
}
std::cout<<c<<std::endl;
}

Measured memory_bytes: 256
using System;
class Program
 {
        static void Main(string[] args)
        {
    　	string a = Console.ReadLine(); //標準入力
          
        
		string[] words = a.Split(' ');
			
          int N = int.Parse(words[0]);
          int X= int.Parse(words[1]);
          int T= int.Parse(words[2]);
          int count = (int)((double)T*Math.Ceiling((double)N/(double)X));
          Console.WriteLine("{0}", count);//改行付き出力
        }
 }

Measured memory_bytes: 27492
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

const int xdir[4] = {0, 1, 0, -1};
const int ydir[4] = {1, 0, -1, 0};

int w, h;
bool vis[1001][1001];
int a[1001][1001];

class St{
public:
  int x, y, s;

  St() {}
  St(int _x, int _y, int _s): x(_x), y(_y), s(_s) {}

  bool operator>(const St& st) const {
    return s > st.s;
  }

  bool operator<(const St& st) const {
    return s < st.s;
  }
};

int bfs()
{
  priority_queue<St, vector<St>, greater<St> > que;
  que.push(St(0, 0, 0));
  fill(&vis[0][0], &vis[h][0], true);
  vis[0][0] = false;
  St st;
  int dy, dx;

  while(!que.empty()){
    st = que.top();
    que.pop();

    if(a[st.y][st.x] == -2) return st.s;

    for(int i = 0; i < 4; ++i){
      dy = st.y+ydir[i];
      dx = st.x+xdir[i];
      if(0 <= dx && dx < w && 0 <= dy && dy < h && vis[dy][dx] && a[dy][dx] != -1){
	vis[dy][dx] = false;
	que.push(St(dx, dy, max(st.s, a[dy][dx])));
      }
    }
  }

  return -1;
}

int main()
{
  int m, x, y;
  char ch;

  while(cin>>w>>h && h+w){
    for(int i = 0; i < h; ++i)
      for(int j = 0; j < w; ++j){
	cin >> ch;
	if(ch == 't') a[i][j] = -2;
	if(ch == '.') a[i][j] = 0;
	if(ch == '#') a[i][j] = -1;
      }

    cin >> m;
    for(int i = 1; i <= m; ++i){
      cin >> x >> y;
      if(a[y][x] == -1) a[y][x] = i;
    }

    cout << bfs() << endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>

using namespace std;

void swap(int &a,int &b,int &count){
    int tmp = a;
    a = b;
    b = tmp;
    count++;
}

void show(vector<int> vec){
    int cnt = 0;
    for(auto a: vec){
        cout << a;
        if(cnt!= vec.size()-1) cout << " ";
        else cout << endl;
        cnt++;
    }
}

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    for(int i=0;i < n;i++){
        cin >> A.at(i);
    }
    int cnt = 0,min_idx;
    for(int i=0;i < A.size();i++){
      min_idx = i;
      for(int j=i;j < A.size();j++){
        if(A.at(j) < A.at(min_idx)){
          min_idx = j;
        }
      }
      if(i != min_idx) swap(A.at(i),A.at(min_idx),cnt);
    }
    show(A);cout << cnt << endl;
    return 0;
}


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

const long long int INF = 50000000;

int main(){

    string s1,s2;

    cin >> s1 >> s2;

    int size1,size2;

    size1 = s1.size();
    size2 = s2.size();

    long long int dp[size1+1][size2+1];

    for(int i=0; i<size1+1; i++){
      for(int j=0; j<size2+1;j++){
        dp[i][j] = INF;
      }
    }

    for(int i=0;i<size1+1;i++){
      dp[i][0] = i;
    }
    for(int i=0;i<size2+1;i++){
      dp[0][i] = i;
    }


    for(int i=1; i<size1+1; i++){
      for(int j=1; j<size2+1; j++){

        dp[i][j] = min(dp[i-1][j]+1,dp[i][j-1]+1);

        if(s1[i-1] == s2[j-1]){
          dp[i][j] = min(dp[i][j],dp[i-1][j-1]);
        }
        else{
          dp[i][j] = min(dp[i][j],dp[i-1][j-1]+1);
        }

      }

    }

    cout << dp[size1][size2] << endl;

    return 0;
}

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

int main(void){
    // Your code here!
    int n;
    cin >> n;
    vector<int> t(n+1);
    vector<int> x(n+1);
    vector<int> y(n+1);
    t.at(0) = 0;
    x.at(0) = 0;
    x.at(0) = 0;
    for (int i = 1 ; i <= n ; i++) {
        cin >> t.at(i) >> x.at(i) >> y.at(i);
    }
   
    bool can = true;
    for (int j = 1; j <=n; j++) {
        int dt = t.at(j) - t.at(j-1) ;
        int dis = abs(x.at(j)-x.at(j-1)) + abs(y.at(j)-y.at(j-1));
        if (dt <dis) can = false;
        if (dt % 2 != dis %2 ) {
                can = false;
            }
           
    }
    if (can) cout << "Yes" << endl;
    else cout << "No" << endl;
    }
  

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mem(dp, v) memset(dp, v, sizeof dp)
using namespace std;
const ll N = 1e5 + 7, inf = 1e17;
ll ar[N], br[N];
//string s;
//ll foo(int i, int j)
//{//cout<<"dsa";
//    ll &ret = dp[i][j];
//    if(i == j) return 1;
//    if(i > j) return 0;
//    if(ret != -1) return ret;
//    ll ans = 0;
//    if(s[i] == s[j]) ans = (1 + foo(i + 1, j - 1)) + foo(i + 1, j) + foo(i, j - 1)- foo(i + 1, j - 1);
//    else ans = foo(i + 1, j) + foo(i, j - 1) - foo(i + 1, j - 1);
//    return ret = ans;
//}
int main()
{
    string s, t, u;
    ll n, a, b;
    cin>>s>>t;
    cin>>a>>b;
    cin>>u;
    if(u == s) a--;
    else if(u == t) b--;
    cout<<a<<" "<<b<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
//桁
int kt(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
int a,b;
vector<int> graph[10];
  int answer=0;
  bool visited[10];
void dfs(int c,int d){
  visited[c]=true;
  d++;
  if(d==a){
    answer++;
  }
  for(int e:graph[c]){
    if(!visited[e])
      dfs(e,d);
  }
  visited[c]=false;
}
signed main(){
  cin>>a>>b;
  rep(i,b){
    int A,B;
    cin>>A>>B;
    graph[B-1].push_back(A-1);
    graph[A-1].push_back(B-1);
  }
  dfs(0,0);
  cout<<answer<<endl;
}
  


Measured memory_bytes: 256
#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 MOD 998244353
//#define MAX 100100
//#define NIL -1
//#define INFTY 1000000000000000000

int main(){
    LL n;
    LL ans=0;
    cin >> n;
    for(LL i=1; i<n; i++){
        ans+=(n-1)/i;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
using namespace std;

typedef long long ll;
ll n, ans;

int main() {
    cin >> n;
    n--;
    ans = n * (n + 1) / 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

long long int H, W;


int main(void) {

	cin >> H >> W;

	long long int ans = 0;

	ans += W*(H / 2);
	if ((H % 2) == 1) { ans += ((W + 1) / 2); }

	if (H == 1 || W == 1) { cout << 1 << endl; }
	else {
		cout << ans << endl;
	}

	//cout << (H*W + 1) / 2 << endl;
	return 0;
}

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

int main()
{
    int N;
    string s;
    scanf("%d", &N);
    cin>>s;
    long long red, green, blue, result;
    red = green = blue = 0;
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == 'R')
            red++;
        if(s[i] == 'G')
            green++;
        if(s[i] == 'B')
            blue++;
    }
    result = red * green * blue;
    for(int i = 0; 2 * i < N; i++)
    {
        for(int j = 0; 2 * i + j < N; j++)
        {
            if(s[j] != s[i + j] && s[j] != s[2 * i + j] && s[i + j] != s[2 * i + j])
            {
                result--;
            }

        }
    }
    printf("%lld", result);
    return 0;
}



Measured memory_bytes: 3768
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define light ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define REP(i,a,b) for(ll i = a; i < b; i++)
#define REPE(i,a,b) for(ll i = a; i <= b; i++)
#define REPR(i,a,b) for(ll i = a; i >= b; i--)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define bins(v, x) binary_search(v.begin(), v.end(), x)
const double pi = 2*acos(0.0);
const int INF = 1e9+1;
const int MOD = 1e9+7;
const int MOD1 = 998244353;

using ll = long long;
using ld = long double;
using vi = vector<int>;

#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define osetll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
 
ll modExp(ll base, ll exp, ll mod) {
   ll res = 1;
   while (exp > 0) {
    	if (exp % 2 == 1) {
        	res= (res * base) % mod;
		}
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}

ll inverse(ll base, ll exp, ll mod) {
   return modExp(base, exp - 2, mod);
}

bool compare(const pair<int,int> &i, const pair<int,int> &j) {
   return (i.S > j.S || (i.S == j.S && i.F > j.F));
}

void test() {
   int n;
   cin >> n;
   vector<vector<int>> dp(n+1, vector<int>(3, 0));

   for(int i = 1; i <= n; i++) {
      vector<int> cost(3);
      for(int j = 0; j < 3; j++) {
         cin >> cost[j];
      }
      dp[i][0] = cost[0] + max(dp[i-1][1], dp[i-1][2]);
      dp[i][1] = cost[1] + max(dp[i-1][0], dp[i-1][2]);
      dp[i][2] = cost[2] + max(dp[i-1][0], dp[i-1][1]);   
   }
   cout << max({dp[n][0], dp[n][1], dp[n][2]});
}

int main() {
   //freopen("input.txt","r",stdin);
   //freopen("output.txt","w",stdout);
   light;
   cout.precision(15);
   cout << fixed;

   int t = 1;
   //cin >> t;
   for(int i = 1; i <= t; i++) {
      //cout << "Case #" << i << ": ";
      test();
   }
   return 0;
}


Measured memory_bytes: 8684
#include<stdio.h>
#include<math.h>
int main()
{
    int N,M,i,sum=0.0;
    scanf("%d%d",&N,&M);
    int A[M];
    for(i=0;i<M;i++)
    {
        scanf("%d",&A[i]);
        sum+=A[i];
    }
    if(sum>N)printf("-1");
    else printf("%d",N-sum);
    
    return 0;
}

Measured memory_bytes: 1760
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
ll gcd(ll a, ll b) {
  if (b == 0) return a;

  return gcd(b, a % b);
}

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

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) {
    res[n]++;
  }
  return res;
}

ll N, M;
ll b[101010];

int main() {
  cin >> N >> M;
  ll a;
  cin >> a;
  ll cnt = 0;
  while (a % 2 == 0) {
    ++cnt;
    a /= 2;
  }
  b[0] = a;

  rep(i, 1, N) {
    cin >> a;
    ll cnt2 = 0;
    while (a % 2 == 0) {
      ++cnt2;
      a /= 2;
    }
    if (cnt2 != cnt) {
      cout << 0;
      return 0;
    }
    b[i] = a;
  }

  ll div = 1;
  rep(i, 0, cnt - 1) { div *= 2; }
  M /= div;

  ll l = 1;
  rep(i, 0, N) { l = lcm(l, b[i]); }

  cout << (M / l + 1) / 2 << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define MAX(a,b) (((a)>(b))?(a):(b))
using namespace std;

int main(){
    int n, i;
    cin >> n;
    int a[n];
    int m1 = 0, m2 = 0;
    for(i = 0; i < n; i++){
        cin >> a[i];
        if(m1 < a[i]){
            m2 = m1;
            m1 = a[i];
        }
        else if(m2 < a[i]){
            m2 = a[i];
        }
    }
    for(i = 0; i < n; i++){
        if(m1 != a[i]){
            cout << m1 << endl;
        }
        else{
            cout << m2 << endl;
        }
    }
}

Measured memory_bytes: 2432
from collections import deque
H,W=map(int,input().split())
s=[]
for i in range(H):
    si=input()
    s.append(si)

queue=deque()
sy,sx=(0,0)
gy,gx=(H-1,W-1)
reached=[[-1 for i in range(W)] for j in range(H)]
queue.append([sy,sx])
reached[sy][sx]=0
dx=[1,-1,0,0]
dy=[0,0,1,-1]
while(queue):
    p=queue.pop()
    for i in range(4):
        y=p[0]+dy[i]
        x=p[1]+dx[i]
        if x<0 or x>=W or y<0 or y>=H or s[y][x]=="#":
            continue
        if reached[y][x]!=-1:
            continue
        reached[y][x]=reached[p[0]][p[1]]+1
        queue.appendleft([y,x])
n=H*W
for i in range(H):
    for j in range(W):
        if s[i][j]=="#":
            n-=1
if reached[gy][gx]==-1:
  n=-1       
print(n-reached[gy][gx]-1)

Measured memory_bytes: 40816
#include <bits/stdc++.h>
using namespace std;
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;

int main(){
    int n;
    cin>>n;
    int a[n][3];
    int dp[n][3];
    for(int i=0;i<n;i++)for(int j=0;j<3;j++)cin>>a[i][j];

    dp[0][0]=a[0][0];
    dp[0][1]=a[0][1];
    dp[0][2]=a[0][2];

    for(int i=1;i<n;i++){
        dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][0]);
    }
    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
}


Measured memory_bytes: 2560
command = raw_input().split(" ")
stack = []

for i in command:
    if i == "+":
        b = int(stack.pop())
        a = int(stack.pop())
        stack.append(a + b)
    elif i == "-":
        b = int(stack.pop())
        a = int(stack.pop())
        stack.append(a - b)
    elif i == "*":
        b = int(stack.pop())
        a = int(stack.pop())
        stack.append(a * b)
    elif i == "/":
        b = int(stack.pop())
        a = int(stack.pop())
        stack.append(a / b)
    else:
        stack.append(i)

print(stack.pop())

Measured memory_bytes: 6468
#include <stdio.h>


int main(void){
    int N;
    scanf("%d",&N);
    long long int po[5]={};
    for(int i=0;i<N;i++){
        char a[19];
        scanf("%s",a);
        if(a[0]=='M')po[0]++;
        if(a[0]=='A')po[1]++;
        if(a[0]=='R')po[2]++;
        if(a[0]=='C')po[3]++;
        if(a[0]=='H')po[4]++;
    }
    long long int ans=0;
    ans+=po[0]*po[1]*po[2];
    ans+=po[0]*po[1]*po[3];
    ans+=po[0]*po[1]*po[4];
    ans+=po[0]*po[2]*po[3];
    ans+=po[0]*po[2]*po[4];
    ans+=po[0]*po[3]*po[4];
    ans+=po[1]*po[2]*po[3];
    ans+=po[1]*po[2]*po[4];
    ans+=po[1]*po[3]*po[4];
    ans+=po[2]*po[3]*po[4];
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 128
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const double PI = atan2(1, 1) * 4.0;

int main() {
    fastio();

    long double a, b, h, m;

    cin >> a >> b >> h >> m;

    long double r1 = 2.0 * PI * (h / 12.0 + m / (60.0 * 12.0));
    long double r2 = 2.0 * PI * m / 60.0;

    //cout << r1 << " " << r2 << endl;

    auto c = complex(a * cos(r1), a * sin(r1));
    auto d = complex(b * cos(r2), b * sin(r2));

    cout << setprecision(20) << abs(c - d) << endl;

    return 0;
}

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

int main()
{
    // read
    int n;
    cin >> n; 
    int number[100];
    for(int i = 0; i < n; i++){
        int t;
        cin >> t;
        number[i] = t;
    }

    for(int i = n-1; i >= 0; i--){
        printf("%d", number[i]);
        if(i != 0)
            printf(" ");
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 3124
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

const int M = 1000000;

int main(void) {
  int k, x;
  cin >> k >> x;
  vector<int> res;
  for(int i = -M; i <= M; ++i) {
    if(abs(x-i) < k) {
      res.push_back(i);
    }
  }
  REP(i, res.size()) {
    printf("%d%c", res[i], i == (int)res.size() - 1 ? '\n' : ' ');
  }
  
  return 0;
}


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

int main(){
    using namespace std;
    using tuplis = array<int, 3>;
    const int sq = 1400;
    
    int n, q;
    cin >> n >> q;
    vector<int> c(n);
    for(int& i : c){
        cin >> i;
        i--;
    }
    vector<tuplis> query(q);
    for(int i = 0; i < q; i++){
        int l, r;
        cin >> l >> r;
        l--; r--;
        query[i] = {l, r, i};
    }
    sort(query.begin(), query.end(), [&](const tuplis& a, const tuplis& b){ if(a[0] / sq == b[0] / sq) return a[1] < b[1]; return a[0] < b[0]; });
    vector<int> ans(q);
    vector<int> cnt(n);
    int types = 0, L = 0, R = -1;
    for(auto [l, r, i] : query){
        while(L < l){
            cnt[c[L]]--;
            types -= !cnt[c[L]];
            L++;
        }
        while(L > l){
            L--;
            types += !cnt[c[L]];
            cnt[c[L]]++;
        }
        while(R > r){
            cnt[c[R]]--;
            types -= !cnt[c[R]];
            R--;
        }
        while(R < r){
            R++;
            types += !cnt[c[R]];
            cnt[c[R]]++;
        }
        ans[i] = types;
    }
    for(int i : ans) cout << i << ' ';
}

Measured memory_bytes: 15452
#include <iostream>

int main(){
    int m, d;
    int d1, d2, count=0;
    std::cin>>m>>d;
    for (int i = 1; i <=m; i++)
    {
        for (int j = 1; j <=d; j++)
        {
            d1 = j%10;
            d2 = (j%100 - d1)/10;
            // std::cout<<d1<<" "<<d2<<"\n";
            if (d1*d2 == i && d1>1 && d2>1)
            {
                count++;
            }
            
        }
        
    }
    std::cout<<count;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
 
li = []
for i in range(N):
  x, l = map(int, input().split())
  li.append([x+l, x-l])
 
li.sort()
right = -10**9

ans = 0
for r, l in li:
  if l >= right:
    right = r
    ans += 1
    
print(ans)

Measured memory_bytes: 20104
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

template<typename T>
vector<T> gen_v(size_t a) { return vector<T>(a); }
template<typename T, typename ...Ts>
auto gen_v(size_t a, Ts... ts) { return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...)); }
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	int cnt = 0;
	rep(i, 1, N + 1) {
		int j = N - i;
		if (i >= j)continue;
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int H, W, N, A[101010];
int ans[1010][1010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> H >> W >> N;
    rep(i, 0, N) cin >> A[i];

    int cu = 0;
    rep(y, 0, H) rep(x, 0, W) {
        ans[y][x] = cu + 1;
        A[cu]--;
        if (!A[cu]) cu++;
    }

    rep(y, 0, H) {
        rep(_x, 0, W) {
            int x;
            if (y % 2 == 0) x = _x;
            else x = W - 1 - _x;

            if (_x) printf(" ");
            printf("%d", ans[y][x]);
        }
        printf("\n");
    }
}

Measured memory_bytes: 2816
tate, yoko = map(int,input().split())
map_list = []
for t in range(tate):
    map_list.append(list(input()))

new_map_list = [[0] * (yoko + 1) for i in range(tate + 1)]

def outofrange_check(t, y):
    if t >= tate or y >= yoko:
        return True


for t in range(tate):
    for y in range(yoko):
        if map_list[t][y] == '#':
            for t_2 in range(t-1, t+2):
                for y_2 in range(y-1, y+2):
                    new_map_list[t_2][y_2] += 1


for t in range(tate):
    for y in range(yoko):
        if map_list[t][y] == '#':
            new_map_list[t][y] = '#'

for i in range(tate):
    for j in range(yoko):
        print(new_map_list[i][j], end='')
    print()

Measured memory_bytes: 3444
function parent(i) {
	return Math.floor((i + 1) / 2);
}
function left(i) {
	return (i + 1) * 2;
}
function right(i) {
	return (i + 1) * 2 + 1;
}

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.trim().split('\n');

var size = +lines.shift()
var vals = lines.shift().split(' ');
var heap = [];
for (var i = 0; i < size; i++) {
	heap.push(+vals[i]);
}

heap.forEach(function(val, idx) {
	var pidx = parent(idx) - 1;
	var lidx = left(idx) - 1;
	var ridx = right(idx) - 1;

	var str = 'node ' + (idx + 1) + ': key = ' + val + ', ';
	if (pidx >= 0) {
		str += 'parent key = ' + heap[pidx] + ', ';
	}
	if (lidx < heap.length) {
		str += 'left key = ' + heap[lidx] + ', ';
	}
	if (ridx < heap.length) {
		str += 'right key = ' + heap[ridx] + ', ';
	}
	console.log(str);
});

Measured memory_bytes: 9524
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

const int mod = 1e9+7;

int main(){
	ll ans = 1;
	int n;
	cin >> n;
	rep2(i, 1, n+1){
		ans *= i;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256