akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

// ================================================= //

/*
 update : [s,t) を x に変更
 query :  [s,t) の最小(大)値を出力
 */
const ll INIT = INT_MAX;
struct SegTree {
    int N;
    ll init_v;
    vector<ll> node, lazy;
    
    SegTree(int _N):init_v(INIT) {
        N = 1;
        while (N < _N) N *= 2;
        node.resize(2 * N - 1, init_v);
        lazy.resize(2 * N - 1, -1);
    }
    
    void lazy_evaluate(int k) {
        if (lazy[k] == -1) return;
        node[k] = lazy[k];
        if (k < N - 1) {
            lazy[2 * k + 1] = lazy[k];
            lazy[2 * k + 2] = lazy[k];
        }
        lazy[k] = -1;
    }
    
    /* [a,b) 引数の範囲に注意!! s~tまでを更新→update(s,t+1,~) */
    void update(int a, int b, int x) { update(a, b, 0, 0, N, x); }
    void update(int a, int b, int k, int l, int r, int x) {
        if (r <= a || b <= l) return;
        if (a <= l && r <= b) {
            lazy[k] = x;
            lazy_evaluate(k);
        }
        else {
            lazy_evaluate(k);
            update(a, b, 2 * k + 1, l, (l + r) / 2, x);
            update(a, b, 2 * k + 2, (l + r) / 2, r, x);
        }
    }
    
    /* [a,b) 引数の範囲に注意!! */
    ll query(int a, int b) { return query(a, b, 0, 0, N); }
    ll query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return init_v;
        if (a <= l && r <= b) {
            lazy_evaluate(k);
            return node[k];
        }
        else {
            lazy_evaluate(k);
            ll vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
            ll vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
            return min(vl, vr);
        }
    }
};



int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int n,q; cin >> n >> q;
    
    SegTree ST(n);
//    BIT bit(n);
    while(q--){
        int com; cin >> com;
        if(com == 0){
            int s,t,x; cin >> s >> t >> x;
            ST.update(s,t+1,x);
//            ST.update(x,y);
           // bit.add(x,y);
        }else{
            int i; cin >> i;
            cout << ST.query(i,i+1) << endl;
            //cout << ST.query(x-1,y) << endl;
            //cout << bit.sum(y) - bit.sum(x-1) << endl;
        }
    }
    
    return 0;
}



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




       
void solve(){

  string s;
  cin >> s;
  if(s=="RRR"){ cout << 3 << endl;}
  else if(s=="RRS"|| s=="SRR"){ cout << 2 << endl;}
  else if(s=="SSS" ){ cout << 0 << endl;}
  else {cout << 1 << endl;}

}

   int main(){
   long long m;
   m=1;
   while(m--){ solve();}
   return 0;
}
   

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

int main(){
  int n;
  cin >> n;
  vector<ll> h(n);
  
  for(int i=0;i<n;i++) cin >> h[i];
  
  int ans = 0;
  int mx = 0;
  
  for(int i=0;i<n-1;i++){
    if(h[i]>=h[i+1]){
      ans ++;
    }
    if(h[i]<h[i+1]){
      mx = max(mx,ans);
      ans = 0;
      continue;
    }
  }
  mx = max(mx,ans);
  cout << mx << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(){
	int total, n[110],sum=0, ans=1000000000;
	scanf("%d",&total);
	for(int i=0; i<total; i++){
		scanf("%d",&n[i]);
	}
	for(int i=-100; i<=100; i++){
		sum=0;
		for(int j=0; j<total; j++){
			sum+=(i-n[j])*(i-n[j]);
		}
		if(sum<ans)
			ans=sum;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <limits>

constexpr int MAXN = 100;
int G[MAXN][MAXN];
int P[MAXN];
int D[MAXN];
int C[MAXN];

int main(){
    int n;
    std::cin >> n;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            std::cin >> G[i][j];
            if (G[i][j] == -1) {
                G[i][j] = std::numeric_limits<int>::max();
            }
        }
    }

    for (int i = 0; i < n; i++) {
        D[i] = std::numeric_limits<int>::max();
    }

    D[0] = 0;
    P[0] = -1;
    while (true) {
        int m;
        int mincost = std::numeric_limits<int>::max();
        for (int i = 0; i < n; i++) {
            if ((C[i] == 0) && (D[i] < mincost)) {
                mincost = D[i];
                m = i;
            }
        }

        if (mincost == std::numeric_limits<int>::max()) {
            break;
        }

        C[m] = 1;
        D[m] = mincost;

        for (int i = 0; i < n; i++) {
            if ((G[m][i] < std::numeric_limits<int>::max()) && (C[i] == 0) && (G[m][i] < D[i])) {
                D[i] = G[m][i];
                P[i] = m;
            }
        }
    }


    int sum = 0;
    for (int i = 0; i < n; i++) {
        if (D[i] != std::numeric_limits<int>::max()) {
            sum += D[i];
        }
    }
//    for (int i = 0; i < n; i++) {
//        std::cout << i << ": " << D[i] << std::endl;
//    }
    std::cout << sum << std::endl;

}


Measured memory_bytes: 3132
a_1 = list(map(int, input().split()))
a_2 = list(map(int, input().split()))
a_3 = list(map(int, input().split()))

a = [a_1, a_2, a_3]

n = int(input())

b = []

for i in range(n):
    b.append(int(input()))


for c in b:
    if c in a_1:
        a_1[a_1.index(c)] = 'O'
    elif c in a_2:
        a_2[a_2.index(c)] = 'O'
    elif c in a_3:
        a_3[a_3.index(c)] = 'O'

for d in range(3):
    if a_1[d] == 'O' and a_2[d] == 'O' and a_3[d] == 'O':
        print('Yes')
        exit()
    if a_1.count('O') == 3 :
        print('Yes')
        exit()
    if a_2.count('O') == 3 :
        print('Yes')
        exit()
    if a_3.count('O') == 3 :
        print('Yes')
        exit()

if a_1[0] == 'O' and a_2[1] == 'O' and a_3[2] == 'O':
    print('Yes')
    exit()
if a_1[2] == 'O' and a_2[1] == 'O' and a_3[0] == 'O':
    print('Yes')
    exit()

print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for (int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for (int (i) = (a) - 1; (i) >= (b); (i)--)
#define PI acos(-1.0)
#define DEBUG(C) cout<< C <<endl;
#define VI vector <int>
#define VII vector <VI>
#define VL vector <LL>
#define VLL vector <VL>
#define VD vector <double>
#define VDD vector <VD>
#define PII pair <int, int>
#define PDD pair <double, double>
#define PLL pair <LL, LL>
#define VPII vector <PII>
#define ALL(a) ((a).begin(), (a).end())
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define EP emplace_back
#define FORE(a, b) for (auto &&a:b)
#define FIND(s, n) (s.find(n) != s.end())

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF = 1e9;
const int MOD = INF + 7;

int main(void) {
    string s; cin >> s;
    string sa = s.substr(0,4);
    string sb = s.substr(4);
    cout << sa << " " << sb << endl;
}


Measured memory_bytes: 256
#include<stdio.h>


int main(){
  int i,j,k,l,num,N,array[100];

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

  for(i=1;i<=N;i++){
    
    for(k=0;k<N;k++){
      printf("%d",array[k]);
      if(k!=N-1) printf(" ");
      else  printf("\n");
    }
    
    num=array[i];
    j=i-1;
    while(j>=0 && array[j]>num){
      array[j+1]=array[j];
      j--;
    }
    array[j+1]=num;
   
  }
      

   
  
  return 0;
}    



Measured memory_bytes: 2044
const   fi='CL.inp';
        fo='CL.out';
var d:array[0..100]of longint;
        n,x,min,max,i:longint;

procedure nhap;
begin
        read(n);
        for i:=1 to n do
        begin
                read(x);
                case x of
                        1..399:d[1]:=1;
                        400..799:d[2]:=1;
                        800..1199:d[3]:=1;
                        1200..1599:d[4]:=1;
                        1600..1999:d[5]:=1;
                        2000..2399:d[6]:=1;
                        2400..2799:d[7]:=1;
                        2800..3199:d[8]:=1;
                        else inc(d[9]);
                        end;

        end;
end;

procedure xuly;
begin
        for i:=1 to 8 do
                if d[i]=1 then inc(min);
		max:=min+d[9];
		if min=0 then min:=1;
		write(min,' ',max);
end;

begin

                nhap;
                xuly;
end.


Measured memory_bytes: 128
//Sasayego! Sasayego! Shinzou wo Sasageyo!

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bitset>
#include <ctime>
#define debug(x)  cerr << #x << " = " << x << endl
#define lid (id << 1)
#define rid (lid ^ 1)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

const int maxN = 1e5 + 5;
const int maxA = 15;
const int maxK = (1 << maxA) + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int a[maxN], cnt[16];
int l = 0, b[maxN];
int arumin[2][maxK];

int main(){
	time_t START = clock();
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; scanf("%d", &n);
	for (int i = 1; i < n; i++){
		int u, v, w; scanf("%d%d%d", &u, &v, &w);
		a[u] ^= w;
		a[v] ^= w;
	}
	for (int i = 0; i < n; i++)
		cnt[a[i]]++;
	int ans = 0;
	for (int i = 1; i < 16; i++){
		ans += (cnt[i] >> 1);
		cnt[i] &= 1;
		if (cnt[i])
			b[l++] = i;
	}
	for (int mask = 1; mask < (1 << l); mask++){
		int lb = __builtin_ctz(mask);
		arumin[0][mask] = b[lb] ^ arumin[0][mask ^ (1 << lb)];
		if (arumin[0][mask] == 0){
			arumin[1][mask] = 1;
			for (int sub = mask & (mask - 1); sub > 0; sub = (sub - 1) & mask)
				if (arumin[0][sub] == 0)
					arumin[1][mask] = max(arumin[1][mask], arumin[1][sub] + arumin[1][mask ^ sub]);
		}
	}
	ans += l - arumin[1][(1 << l) - 1];
	printf("%d\n", ans);
	time_t FINISH = clock();
	cerr << "Execution time: " << (ld)(FINISH - START) / CLOCKS_PER_SEC * 1000.0 << " milliseconds.\n";
	return 0;
}
 



Measured memory_bytes: 4472
n = int(input())
lis=[]
count=0
for i in range(n):
    li=[None]*2
    x, l = map(int, input().split())
    li[0] = x+l
    li[1] = x-l
    lis.append(li)
lis.sort()
kari_r = -(10 ** 18)
for r, l in lis:
        if kari_r > l:
            continue
        count+=1
        kari_r = r
            
print(count)

Measured memory_bytes: 20096
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
using namespace std;
using ll = long long;

int main()
{
    int q;
    cin >> q;
    priority_queue<ll> l;
    priority_queue<ll, vector<ll>, greater<ll>> r;

    ll ans = 0;
    ll sum_b = 0;
    while(q--){
        int qry;
        cin >> qry;
        if(qry == 1){
            ll a, b;
            cin >> a >> b;
            sum_b += b;
            l.push(a);
            r.push(a);
            if(l.top() > r.top()){
                ll x = l.top();
                ll y = r.top();
                r.pop();
                l.pop();
                r.push(x);
                l.push(y);
                ans += abs(x-y);
            }
        }
        else{
            cout << l.top() << " " << ans + sum_b << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 4588
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;int p=0;
  cin>>s;
  int l=s.length();
  for(int i=0;i<l/2;i++)
  {
    if(s[i]!=s[l-1-i])
      p++;
  }
  cout<<p;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const int MOD = 100000;

// Binary Indexed Tree
class Bit
{
    int n;
    vector<int> data;
public:
    Bit(int n){
        this->n = n;
        data.assign(n+1, 0);
    }
    void add(int k, int x){
        ++ k;
        while(k <= n){
            data[k] += x;
            data[k] %= MOD;
            k += k & -k;
        }
    }
    int sum(int k){
        ++ k;
        int ret = 0;
        while(k > 0){
            ret += data[k];
            ret %= MOD;
            k -= k & -k;
        }
        return ret;
    }
    int sum(int a, int b){
        return sum(b) - sum(a-1);
    }
};

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

    Bit bit(n-1);
    for(int i=0; i<n-1; ++i){
        int a;
        cin >> a;
        bit.add(i, a);
    }

    int ret = 0;
    int prev = 0;
    for(int i=0; i<m; ++i){
        int a;
        cin >> a;
        if(a > 0)
            ret += bit.sum(prev, prev+a-1);
        else
            ret += bit.sum(prev+a, prev-1);
        ret %= MOD;
        prev += a;
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 1260
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		String O=s.nextLine();
		String E=s.nextLine();
	
		int i=0;
		
		for(i=0;i<O.length()+E.length();i++){
			if(i%2==0)System.out.print(O.charAt(i/2));
			else System.out.print(E.charAt(i/2));
		}

	}

}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF (1LL<<25)     //33554432
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

  int x[3][3];
  REP(i, 101) {
    REP(j, 3) REP(k, 3) x[j][k] = 0;
    x[0][0] = a;
    x[0][1] = b;
    x[1][1] = c;
    int sum = a+b+i;
    x[0][2] = i;
    x[2][1] = sum - x[0][1] - x[1][1];
    x[2][0] = sum - x[0][2] - x[1][1];
    x[2][2] = sum - x[0][0] - x[1][1];
    x[1][0] = sum - x[0][0] - x[2][0];
    x[1][2] = sum - x[0][2] - x[2][2];

    bool flag = true;
    if(x[0][0] + x[0][1] + x[0][2] != sum) flag = false;
    if(x[1][0] + x[1][1] + x[1][2] != sum) flag = false;
    if(x[2][0] + x[2][1] + x[2][2] != sum) flag = false;
    if(x[0][0] + x[1][0] + x[2][0] != sum) flag = false;
    if(x[0][1] + x[1][1] + x[2][1] != sum) flag = false;
    if(x[0][2] + x[1][2] + x[2][2] != sum) flag = false;
    if(x[0][0] + x[1][1] + x[2][2] != sum) flag = false;
    if(x[0][2] + x[1][1] + x[2][0] != sum) flag = false;

    if(flag) {
      REP(j, 3) {
        REP(k, 3) {
          cout << x[j][k] << " ";
        }
        cout << endl;
      }
    }
  }

  return 0;
}


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

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf

int n;
int mx, sum;

int main() { 

  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    sum += x;
    mx = max(mx, x);
  }

  cout << sum - mx / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;

#define dlog(str) cout << "====" << str << endl;
#define INF 999999999
#define MOD 1000000009
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define REPR(i, n) for(int i = n-1; 0 <= i; i--)
#define FOR(i, s, e) for(int i = s; i <= e; i++)
#define FORR(i, s, e) for(int i = s; e <= i ; i--)
#define LLI long long int
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main(){
    
int A,B,C;
cin>>A>>B>>C;
cout<<min(A+B,min(A+C,B+C));
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
const int M = 1000005;
void solve() {
	int N; cin >> N;
	map<int, int> cnt_num;
	vector<int> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i < N; ++i) {
		cnt_num[a[i]]++;
		if (cnt_num[a[i]] == 1) {
			for (int j = a[i] * 2; j < M; j+=a[i]) {
				cnt_num[j]++;
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		if (cnt_num[a[i]] == 1) ans++;
	}	
	cout << ans << endl;
	return;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 50964
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S, T; cin >> S >> T;

    cout << T << S << endl;

    return 0;
}


Measured memory_bytes: 256
import math

a, b, h, m = map(int, input().split())
l = m * 6
s = m * 0.5 + h * 30
th = abs(l - s)
if th == 0:
    print('{:.20f}'.format(abs(a - b)))
    exit()
elif th == 180:
    print('{:.20f}'.format(a + b))
    exit()
if th >= 180:
    th = 360 - th
cos = math.cos(math.radians(th))
ans = a**2 + b**2 - 2 * a * b * cos
print('{:.20f}'.format(math.sqrt(ans)))

Measured memory_bytes: 9352
lines = $stdin.read

def gen_square(a,b,h,w)
  [
    [a-2,b-2],[a-1,b-2],[a,b-2],
    [a-2,b-1],[a-1,b-1],[a,b-1],
    [a-2,b  ],[a-1,b  ],[a,b  ],
  ].select do |elem|
    elem[0] >= 0 and elem[1] >= 0 and elem[0] < h-2 and elem[1] < w-2
  end
end

array = lines.split("\n")
H,W,N = array[0].split(" ").map(&:to_i)
sum = {}

array[1..N].each do |line|
  a,b = line.split(" ").map(&:to_i)
  gen_square(a-1,b-1,H,W).each do |coord|
    key = "#{coord[0]}-#{coord[1]}"
    if sum.has_key?(key)
      sum[key] += 1
    else
      sum[key] = 1
    end
  end
end

ans = Array.new(10,0)
sum.each_value do |value|
  ans[value] += 1
end
ans[0] = (H-2)*(W-2) - sum.length
puts ans

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

int main()
{
	int i, j, H, W;
	char C[201][101];
	scanf("%d %d", &H, &W);
	for (i = 1; i <= H; i++) scanf("%s", &(C[i][1]));
	
	for (i = 2 * H; i >= 2; i--) {
		for (j = 1; j <= W; j++) C[i][j] = C[(i+1)/2][j];
	}
	
	for (i = 1; i <= 2 * H; i++) {
		for (j = 1; j <= W; j++) printf("%c", C[i][j]);
		printf("\n");
	}
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i=0;i< int (n);i++)

int main(void)
{
    ll  X;
    ll  sum;
    
    cin >> X;

    sum = (X / 500)*1000;
    X %= 500;

    sum += (X / 5)*5;

    cout << sum << endl;
}

   

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

using namespace std;

int main()
{
	string s;
	int n,a,p=0;
	cin>>s;
	n=s.size();
	for(int i=0,a=n-1;i<=n/2-1;i++)
	{
		if(s[i]!=s[a])  p++;
		a--;
	}
	cout<<p;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define maxm 100
#define maxn 100

int main(){
    int n, m,c;
    int b[maxm];
    int a[maxn][maxm];
    scanf("%d%d%d", &n, &m, &c);
    for(int i=0; i<m; i++){
        scanf("%d", &b[i]);
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            scanf("%d", &a[i][j]);
        }
    }
    int num, total;
    for(int i=0; i<n; i++){
        total = 0;
        for(int j =0; j<m; j++){
            total += a[i][j] * b[j];
        }
        total += c;
        if(total >0){
            num++;
        }
    }
    printf("%d\n", num);
    return 0;
}


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

int main()
{
    int c[3][3];
    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            cin >> c[j][i];
        }
    }
    string ans = "No";
    if (c[0][0] - c[0][1] == c[1][0] - c[1][1] && c[0][0] - c[0][2] == c[1][0] - c[1][2] && c[0][0] - c[0][1] == c[2][0] - c[2][1] && c[0][0] - c[0][2] == c[2][0] - c[2][2])
    {
        if (c[0][0] - c[1][0] == c[0][1] - c[1][1] && c[0][0] - c[2][0] == c[0][1] - c[2][1] && c[0][0] - c[1][0] == c[0][2] - c[1][2] && c[0][0] - c[2][0] == c[0][2] - c[2][2])
        {
            ans = "Yes";
        }
    }
    cout << ans << endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
template<typename T> bool chmax(T &a, T b) {if(a <= b){a = b; return true;}return false;}
template<typename T> bool chmin(T &a, T b) {if(a >= b){a = b; return true;}return false;}

int lcm(int a, int b){
    while(a % b != 0){
        int c = a % b;
        a = b;
        b = c;
    }
    return b;
}

int main(void){
    int a, b, k;
    cin >> a >> b >> k;
    int count = 0;
    for(int i = min(a, b); 0 < i; i--){
        if(a % i == 0 && b % i == 0){
            count++;
        }
        if(count == k){
            cout << i << endl;
            break;
        }
    }
}

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

const ll MX = 1e18;

int main() {
  int n;
  cin >> n;
  ll ans = 1;
  bool ng = false;
  rep(i,n) {
    ll a;
    cin >> a;
    if (a == 0) {
      cout << 0 << endl;
      return 0;
    }
    if (ng || __int128(ans)*a > MX) {
      ng = true;
    }
    ans *= a;
  }
  if (ng) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}


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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    vector<int> v(100001);
    int minus = 0;
    rep(i, n) {
      int a;  cin >> a;
      v[a]++;
      v[a + 1]++;
      if (a == 0) {
        minus++;
      } else {
        v[a - 1]++;
      }
    }
    sort(v.begin(), v.end(), greater<int>());
    cout << max(v[0], minus) << '\n';

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}
	
vector<bool> primes;
void sieve() {
	for (int i = 2; i * i < (int) primes.size(); ++i) {
		if (primes[i]) {
			for (int j = 2 * i; j < (int) primes.size(); j += i) {
				primes[j] = false;
			}
		}
	}
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	primes = vector<bool> (2 * n, true);
	sieve();
	
	for (int i = n; i < 2 * n; ++i) {
		if (primes[i]) {
			cout << i << "\n";
			return 0;
		}
	} 

	return 0;

}

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

int main() {
  int n; cin >> n;
  vector<int> m(n);
  for (int i = 0; i < n; i++) cin >> m[i];
  
  int ans = 1;
  
  for (int i = 1; i < n; i++) {
    bool ok = true;
    for (int j = 0; j < i; j++) {
      if (m[j] > m[i]) {
        ok = false;
        break;
      }
    }
    if (ok) ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPLL(i, n) for(ll i = 0;i < (n);++i)

#define endl "\n"
#define pb push_back
#define MOD 1000000007LL
#define PI 3.1415926

typedef long long ll;

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T> inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int n, k;
	cin >> n >> k;
	if(k > (n+1)/2) cout << "NO" << endl;
	else cout << "YES" << endl;

	return 0;
}

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

signed main() {
  int N;
  cin >> N;
  
  vector<string> S(N);
  vector<int> A(N);
  for( int i = 0; i < N; i++ ) cin >> S.at(i) >> A.at(i);
  string X;
  cin >> X;
  
  int ans = 0;
  bool fg = false;
  for( int i = 0; i < N; i++ ){
    if( fg ){
      ans += A.at(i);
    }
    if( S.at(i) == X ) fg = true;
  }
  cout << ans << endl;
    
}
  


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

int main(){
  int N;
  cin >> N;
  if(N < 3){
    cout << "0" << endl;
    return 0;
  }
  vector<int> a(N);
  for(int i = 0;i < N;i++){
    cin >> a.at(i);
  }
  int count = 0;
  for(int j = 2;j < N;j++){
    for(int k = 1;k < j;k++){
      for(int l = 0;l < k;l++){
        if((a.at(j) == a.at(k)) || (a.at(k) == a.at(l)) || (a.at(l) == a.at(j)))continue;
        if((a.at(j) < a.at(k) + a.at(l)) && (a.at(k) < a.at(l) + a.at(j)) && (a.at(l) < a.at(j) + a.at(k)))count++;
      }
    }
  }
  cout << count <<endl;
  
}

Measured memory_bytes: 3640
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

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

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> M(N);
    
    for (int k = 0; k < K; ++k) {
        int D;
        cin >> D;
        for (int d = 0; d < D; ++d) {
            int A;
            cin >> A;
            --A;
            ++M[A];
        }
    }

    int Res = 0;
    for (int n = 0; n < N; ++n) {
        if (M[n] == 0) ++Res;
    }
    cout << Res << endl;

    return 0;
}


Measured memory_bytes: 3660
#include <stdio.h>

int main()
{
    int n,flag=0,i;
    scanf("%d",&n);
    int a[n],number[n];
    if(2<=n<=50){
        for(i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            number[i]=i+1;
            if(a[i]!=number[i]){
                flag++;
                
            }
        }
        
        if(flag<=2)printf("YES");
        else printf("NO");
   
        
    }

    return 0;
}

Measured memory_bytes: 128
import math
N, K = map(int, input().split())
H = list(map(int, input().split()))
dp_list = [math.inf] * N
dp_list[0] = 0

for i, h in enumerate(H[:-1]):
  for j in range(1, min(K + 1, N - i)):
    cost_step = abs(H[i] - H[i + j])
    cost_total = dp_list[i] + cost_step
    if dp_list[i + j] > cost_total:
      dp_list[i + j] = cost_total
      
print(dp_list[-1])

Measured memory_bytes: 86348
n = int(input())
A = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

def foo(target, index):
    if target == 0:
        return True

    if index >= n:
        return False

    res = foo(target, index + 1) or foo(target - A[index], index + 1)
    return res

sum = sum(A)

for mi in m:
    if (mi > sum):
        print('no')
        continue

    ret = foo(mi, 0)
    if ret:
        print('yes')
    else:
        print('no')



Measured memory_bytes: 5628
import math
N = int(input())
li = list()

for _ in range(5):
  li.append(int(input()))
ans = N
aa = 0
ll = list()
for i in range(5):
  ak = ans / li[i]
  ll.append(li[i])
  aa += math.ceil(ak)
  
  if ak != 0 and i != 4:
    if min(ll) > li[i+1]:
      ans = N-(li[i+1]*(aa-i-1))
    else:
      ans = N-(min(ll)*(aa-i-1))
print(aa)


Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
	int h,w,i,j;
	while(1){
		scanf("%d %d",&h,&w);
		if(h == 0 && w == 0)
			break;
		for(i = 0;i < h;i++){
			for(j = 0;j < w;j++){
				if((i + j) % 2 == 0){
					printf("#");
					}else{
					printf(".");
					}
			}
			printf("\n");
		}
	printf("\n");
	}
	return 0;
}
				

Measured memory_bytes: 572
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>

using namespace std;

int main(){
	int i, j;
	long long a, b, k;

	cin >> a >> b >> k;
	bool flag = false;

	for (long long i = 0; i < k; i++) {
		if (flag == false) {
			if (a % 2 == 1) {
				a--;
			}
		/*	else {
				b += (a / 2);
				a -= (a / 2);
			}*/

			long aa = a / 2;

			a -= aa;
			b += aa;

			flag = true;
		}
		else if (flag == true) {
			if (b % 2 == 1) {
				b--;
			}
		/*	else {
				a += (b / 2);
				b -= (b / 2);
			}*/

			long bb = b / 2;

			b -= bb;
			a += bb;

			flag = false;
		}


	}


	cout << a << " " << b << endl;



	getchar();
	getchar();
	return 0;
}

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

using namespace std;

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

	vector<long long> d(N);
	for (auto &x : d) {
		cin >> x;
	}

	long long ans = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
long long int dp[100040] = {};
int main() {
	int x, y, z;
	cin >> x >> y >> z;
	cout << (x-z) / (y + z);
}


Measured memory_bytes: 256
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   main.cpp
 * Author: surai
 *
 * Created on 2016/05/21, 18:51
 */

#include <cstdlib>
#include<iostream>
using namespace std;

/*
 * 
 */
int main(int argc, char** argv) {

    int a,b;
    cin >> a >> b;
    if((1<=a)&&(b<=100)){
        cout << a*b << " " << a+a+b+b << endl;  
    }
    return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi= vector<vi>;
using vs = vector<string>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  mp(a,b)  make_pair(a,b)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
const ll INF = 1e9+9, LINF = 1e18;


int main()
{
    string s;
    int a;
    cin>>s>>a;
    rep(i,s.size())if(i%a==0)cout<<s[i];
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
// Code by Nguyen Huu Lam
#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;

typedef long long LL;
typedef long double LD;

#define y0 Sword_Art_Online
#define y1 Your_lie_in_April
#define yn Darling_in_the_Franxx
#define tm Plastic_Memories
#define lr Charlotte
#define norm Weathering_with_you
#define left Violet_Evergarden
#define have Date_a_live
#define ends Your_name
#define prev Five_centimeters_per_second
#define hash Silent_voice
#define endl "\n"

template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

LL Rand(LL l, LL h){
    return uniform_int_distribution<LL>(l, h)(rng);
}

template <typename T> void read(T &t){
    t = 0; char ch = getchar(); int f = 1;
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    do { (t *= 10) += ch - '0'; ch = getchar(); } while (isdigit(ch)); t *= f;
}

const LL MaxN = 1 + 1e6;

LL n, a[MaxN], k;

LL Check(LL val){
    LL cnt = 0;
    for(int i = 0 ; i < n ; ++i){
        if(a[i] == 0)
            if(val > 0) cnt += n;
        if(a[i] > 0){
            cnt += lower_bound(a, a + n, LD(val) / a[i]) - a;
        }
        if(a[i] < 0) {
            cnt += n - (upper_bound(a, a + n, LD(val) / a[i]) - a);
        }
        if(a[i] * a[i] < val) cnt--;
    }
    if(cnt / 2 < k) return 1;
    return 0;
}

void InOut(){
    #define TASK "ABC"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
}

int main(){
    // InOut();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    for(int i = 0 ; i < n ; ++i) cin >> a[i];
    sort(a, a + n);
    LL l = -2e18, r = 2e18;
    while(l < r - 1){
        LL tg = (l + r) / 2;
        if(Check(tg)) l = tg;
        else r = tg;
    }
    if(Check(l)) cout << l << endl;
    else cout << r << endl;

    return 0;
}

Measured memory_bytes: 5156
n = "0" + gets.chomp
kkk = gets.chomp.to_i
# 桁, 回数,  0→それまでの桁と確定してる桁が同じ 1→小さいので何でも入る
dp = Array.new(n.length + 1).map{Array.new(kkk + 1)}.map{|a| a.map{Array.new(2,0)}}
dp[0][0][0] = 1

n.length.times do |i|
	now = n[i].to_i
	(kkk+1).times do |j|
		2.times do |k|
			10.times do |d|
				ii = i + 1; jj = j; kk = k;
				jj += 1 if d != 0
				next if jj > kkk
				if k == 0 then
					next if d > now
					kk = 1 if d < now
				end
				#puts "i:#{i} j:#{j} k:#{k} ii:#{ii} jj:#{jj} kk:#{kk}"
				dp[ii][jj][kk] += dp[i][j][k]
			end
		end
	end
end 
puts dp[n.length][kkk].inject(:+)


# (1..n.length-1).times do |i|
# 	now = n[i].to_i
	

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

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	map<pair<int,int>, int> cnt;
	for(int rep = 0; rep < n; ++rep) {
		double x;
		cin >> x;
		long long i = llround(x * 1e9);
		int two = 0, five = 0;
		while(i % 2 == 0) {
			two++;
			i /= 2;
		}
		while(i % 5 == 0) {
			five++;
			i /= 5;
		}
		++cnt[{two,five}];
	}
	long long ans = 0;
	for (auto p1 : cnt) {
		for (auto p2 : cnt) {
			if (p1.first.first+p2.first.first >= 18 && p1.first.second+p2.first.second >= 18) {
				if (p1 < p2) {
					ans += (long long) p1.second * p2.second;
				} else if (p1 == p2) {
					ans += (long long) p1.second * (p1.second - 1) / 2;
				}
			}
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3732
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  string s,t;cin>>s>>t;
  ll sn=s.size(),tn=t.size();

  vector<ll>v[26];
  rep(i,0,sn){
    v[s[i]-'a'].push_back(i+1);
  }

  ll count=0;ll k=0;
  for(ll i=0;i<tn;i++){
    char c=t[i];
    ll a = c-'a';

    if(v[a].size()==0){out(-1);return 0;}

    vector<ll>::iterator it =upper_bound(v[a].begin(),v[a].end(),k);
    if(it==v[a].end()){
      it=v[a].begin();
      count++;
    }
    k=*it;
  }
  out(count*sn+k);

  return 0;
}

Measured memory_bytes: 1724
x = int(input())
l=[]
for i in range(x):
    l.append(int(input()))
MIN = 999999999999999999999999999999999999999
MAX = -9999999999999999999999999999999999999
for i in l:
    if i - MIN > MAX:
        MAX = i - MIN
    if i < MIN:
        MIN = i
print(MAX)

Measured memory_bytes: 13584
a,b,c=map(int,input().split())
k=int(input())
for i in range(0,k+1):
    asw=False
    for j in range(0,k+1):
        if (i+j<=k and a<b*(2**(i)) and b*(2**(i))< c*(2**(j))):
            print("Yes")
            asw=True
            break
    if (asw):break
else : print("No")

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

int main(){
    int a;
    cin >> a;
    int h,m,s;
    h = a/3600;
    a%=3600;
    m = a/60;
    a%=60;
    s = a;
    cout << h <<":" << m << ":" << s << endl;
return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int h, w, n; cin >> h >> w >> n;
	cout << (n - 1) / max(h, w) + 1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e18;

int main(){
    ll N, A, B;
    cin >> N >> A >> B;
    if((B-A)%2 == 0) cout << (B-A)/2 << endl;
    else{
        ll l = A+(B-A-1)/2;
        ll r = N-B+(B-A+1)/2;
        cout << min(l, r) << endl;
    }
}

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

#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);

    long long a, b, n;
    cin >> a >> b >> n;
    n = min(n, b - 1);
    cout << a * n / b << "\n";
}


Measured memory_bytes: 3652
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    s = S()
    s[3] = "8"
    print("".join(s))
    return

#B
def B():
    n = II()
    d = IR(n)
    d.sort(reverse=True)
    b = float("inf")
    ans = 0
    for i in d:
        if i < b:
            ans += 1
            b = i
    print(ans)
    return

#C
def C():
    return

#D
def D():
    n, h = LI()
    ab = LIR(n)
    ab.sort(reverse=True)
    amax = ab[0][0]
    ab.sort(key=lambda x: x[1], reverse=True)
    ans = 0
    hp = 0
    for a,b in ab:
        if b <= amax:
            break
        ans += 1
        hp += b
        if hp >= h:
            break
    ans += max(math.ceil((h-hp)/amax),0)    
    print(ans)
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 41328
#include<bits/stdc++.h>
//BIAR MANTAB LAH YA
#define Willy using
#define Indrayana namespace
#define Komara std
 
Willy Indrayana Komara;

using ll = long long;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string a, b;
    cin >> a >> b;
    for (int i = 0; i < a.length(); i++)
    {
        if (a[i] != b[i])
        {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
}

Measured memory_bytes: 3648
#include"bits/stdc++.h"

//#include<bits/stdc++.h>
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 100000000;

int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	ll i = 0;
	while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
		ll ha = a / 2, hb = b / 2, hc = c / 2;
		a = hb + hc;
		b = ha + hc;
		c = ha + hb;
		i++;
		if (i > 100000000) { print(-1); return 0; }
	}
	print(i);
	return 0;
}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n,ans;
  cin>>n;
  vector<int> v(n);
  rep(i,n) cin>>v[i];
  ans=v[0];
  rep(i,n){
    ans=gcd(ans,v[i]);
  }
  cout<<ans<<endl;
} 
///////////////////////////





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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, a, b);
  int c = 1;
  int ans = 0;
  while (c < b) {
    ++ans;
    c += a - 1;
  }
  out(ans);
}


Measured memory_bytes: 256