akhauriyash/Code-Regression huggingface dataset:
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

int main() {
    ll N;
    cin >> N;
    string S;
    cin >> S;
    unordered_map<char, vector<ll>> cnt;
    for (char c : {'R', 'G', 'B'}) {
        cnt[c] = vector<ll>(N+1);
    }
    rrep(i,N,0) {
        for (char c : {'R', 'G', 'B'}) {
            cnt[c][i] = cnt[c][i+1];
        }
        cnt[S[i]][i]++;
    }
    ll ans = 0;
    rep(i,0,N) {
        rep(j,i+1,N) {
            if (S[i] == S[j]) {
                continue;
            }
            unordered_set<char> chars = {'R', 'G', 'B'};
            chars.erase(S[i]);
            chars.erase(S[j]);
            char c = *chars.begin();
            ans += cnt[c][j+1];
            ll k = j + (j - i);
            if (k < N && S[k] == c) {
                ans--;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3368
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){

  string t;
  cin >> t;
  


  //t.replace(1, 2, "c");//開始位置，長さ，置き換え文字

  //pos = t.fine("a");//位置
  //len = s.length();//検索文字列の長さ
  //t.replace(pos, len, "c")
  
  std::replace(t.begin(), t.end(), '?', 'D');


  cout << t << endl;
  
}

Measured memory_bytes: 3760
use List::Util qw(max min sum);

my ($a,$b,$c,$k) = split(/\s+/, <>);

my $ans = min($k,$a);
$k-=$ans;

if ($k>0) {
    $k-=$b;
    if ($k>0) {
	$ans -= min($k,$c);
    }
}
print $ans, "\n";


Measured memory_bytes: 5440
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

bool is_prime(const unsigned n) {
    switch(n) {
        case 0:  // fall-through
        case 1:
            return false;
        case 2:  // fall-through
        case 3:
            return true;
    }  // n > 3 が保証された

    if(n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である

    // 6の倍数前後の数を使って試し割りをする
    for(unsigned i = 5; i * i <= n; i += 6) {
        if(n % i == 0) return false;        // (6の倍数)-1
        if(n % (i + 2) == 0) return false;  // (6の倍数)+1
    }

    return true;
}

int main() {
    int Q;
    cin >> Q;
    vector<int> v(100010);
    v[0] = 0;
    for(int i = 1; i < 100010; i++) {
        v[i] = v[i - 1];
        if(is_prime(i) && is_prime((i + 1) / 2)) v[i]++;
    }
    for(int i = 0; i < Q; i++) {
        int l, r;
        cin >> l >> r;
        cout << v[r + 1] - v[l - 1] << "\n";
    }
    return 0;
}

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

int main() {
 string s;
 cin >> s;
 int m=s.size();
 int cnt=0;
 for(int i=0;i<m;i++){
   if(s[i]=='o')cnt++;
 }
 int n=15-m;
 if(n+cnt>=8)cout << "YES" << endl;
 else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	int cnt_5 = 0;
	int cnt_7 = 0;
	for (int i = 0; i < 3; i++) {
		int a; cin >> a;
		if (a == 5) cnt_5++;
		else if (a == 7) cnt_7++;
	}
	if (cnt_5 == 2 && cnt_7 == 1)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
 }

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

#define int long long
#define DBG 0
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#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 each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int N, k; cin >> N >> k;
	int ans = 0;
	rep(i, 0, N - 1) {
		ans += ans / (k - 1) + 1;
		dump(ans);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main()
{
    string s;
    cin>>s;
    int m=0,n=0;
    int len=s.length();
    string ss;
    ss=s;
    for(int i=1;i<len;i++){
        if(ss[i]==ss[i-1]){
            ss[i]='1'-ss[i-1]+'0';
            m++;
        }
    }
    for(int i=len;i>0;i--){
        if(s[i]==s[i-1]){
            s[i-1]='1'-s[i]+'0';
            n++;
        }
    }
    cout<<min(m,n)<<endl;
    return 0;
}


Measured memory_bytes: 512
# coding: utf-8
#lines = <<'EOS'
#4 3 90
#EOS

lines = $stdin.read

array = lines.split("\n")

str = array[0]

# a ?????????, b ?????????, C?????§???????????????
a = str.split(" ")[0].to_i
b = str.split(" ")[1].to_i
C = str.split(" ")[2].to_i

# ????§???¢?????¢??? S => a*b*sin(C) / 2
printf "%f\n", a * b * Math.sin(C * Math::PI / 180) / 2
S = a * b * Math.sin(C * Math::PI / 180) / 2
# ??¨????????? L
# c**2 = a**2 + b**2 - 2*a*b*cos(C)
c = Math.sqrt(a**2 + b**2 - 2*a*b*Math.cos(C * Math::PI / 180))
printf "%f\n", a + b + c
# a ???????????¨????????¨???????????? h
printf "%f\n", 2 * S / a

Measured memory_bytes: 8964
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String[] s = sc.next().split("");
        int[] len = new int[n + 3];
        int index = 0;
        boolean is0 = false;
        for (int i = 0; i < s.length; i++) {
            if (s[i].equals("0")) {
                if (!is0)index++;
                is0 = true;
            } else {
                if (is0)index++;
                is0 = false;
            }
            len[index]++;
        }
        int res = 0;
        for(int j=0;j<2*k+1;j++){
            if(j>index)break;
            res += len[j];
        }
        int final_res = res;
        for (int i = 2; i <= index; i += 2) {
            int tmp = 0;
            if(i+2*k-1>index)break;
            tmp = res - len[i-2] - len[i-1] + len[i+2*k] + len[i+2*k-1];
            res = tmp;
            final_res = Math.max(tmp, final_res);
        }
        System.out.println(final_res);
    }
}

Measured memory_bytes: 32828
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>

using std::cin;
using std::cout;
using std::endl;
using std::terminate;
using std::string;
using std::reverse;

void solve() {
    string s; cin >> s;
    int q; cin >> q;

    int direction = 0;
    for (int a = 1; a <= q; ++a) {
        int t; cin >> t;
        if (t == 1) {
            direction++;
            direction %= 2;
        } else {
            int f; cin >> f;
            char c; cin >> c;
            if (direction == 0 && f == 1 || direction == 1 && f == 2) {
                // 先頭に文字を追加
                s.insert(s.begin(), c);
            } else {
                // 末尾に文字を追加
                s.append(1, c);
            }
        }
    }

    if (direction == 1) {
        reverse(s.begin(), s.end());
    }

    cout << s << endl;
}

int main() {

#ifdef DEV
    std::ifstream in("input");
    cin.rdbuf(in.rdbuf());

    int t; cin >> t;
    for (int x = 1; x <= t; ++x) {
        solve();
    }
#else
    solve();
#endif

    return 0;
}


Measured memory_bytes: 3860
#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>
#include <utility>
#include <map>
#include <functional>
#include <initializer_list>
#include <string>
using namespace std;

typedef long long int ll;

int main(){
        ll A, B;
        cin >> A >>B;
        if((A+B)%2 == 0)cout << (A+B)/2;
        else cout << "IMPOSSIBLE";


}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $a);
fscanf(STDIN, "%s", $slime);

$slimes = str_split($slime);
$num = "";
$count = 0;
foreach ($slimes as $sl) {
  if($num !== $sl) 
    $count++;
    $num = $sl;
}

echo $count;

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

//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

//bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;


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

    stack<char> stack;


    for (char c : s) {
        if (stack.empty()) stack.push(c);
        if (stack.top() == c) continue;
        if (stack.top() != c) stack.push(c);
    }

    cout << stack.size() - 1 << endl;

}



Measured memory_bytes: 512
#include <iostream>
#include <queue>
#include <string.h>
using namespace std;

int k;
deque<pair<int,int> > q;
bool used[100010];

int main()
{
	cin>>k;
	
	q.push_back({1,1});
	while(!q.empty())
	{
		pair<int,int> x=q.front();q.pop_front();
		if(!x.first) {cout<<x.second;return 0;}
		
		if(!used[x.first])
		{
			used[x.first]=1;
			q.push_front({(x.first*10)%k,x.second});
			q.push_back({x.first+1,x.second+1});
		}
	}
	
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;
#define HERE cout<<"    "<<"HERE"<<en

int main(){
  int n;
  cin>>n;
  int a[105];
  for(int i=1; i<=n; i++) cin>>a[i];
  
  int maxl=0;
  for(int i=1; i<=n; i++){
    int renzoku=0;
    for(int j=i; j<=n; j++){
      if(a[j]) renzoku++;
      else break;
    }
    maxl=max(maxl,renzoku+1);
  }
  
  cout<<maxl<<en
}



Measured memory_bytes: 3112
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	string s;
	cin >> s;
	int n = s.size();
	int ans = 0;
	for(int i = 1;i <= n/2;i++){
		string t1 = "";
		string t2 = "";
		for(int j = 0;j < i;j++){
			t1 += s[j];
		}
		for(int j = i;j < 2 * i;j++){
			t2 += s[j];
		}

		if(t1 == t2 && 2 * i != n){
			ans = max(ans,2*i);
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define pi pair<int,int>
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);i++)
#define repd(i, l, r) for (int i=(int)(l);i>=(int)(r);i--)
#define clrg(i, l, r) for(int i=(int)(l);i<(int)(r);i++)vis[i]=0,v[i].clear();
int power(int x, unsigned int y){int res = 1;while (y > 0){ if (y & 1){res = res*x;} y = y>>1;x = x*x;}return res;}
int powermod(int x, unsigned int y, int p){int res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
#define print2d(mat,n,m){for(int i=0;i<(int)(n);i++){for(int j=0;j<(m);j++){cout<<mat[i][j]<<" ";}cout<< endl;}}
#define clr(a,x) memset(a,x,sizeof(a))
#define rr(v) for(auto &val:v)
#define print(v) for (const auto itr : v){cout<<itr<<' ';}cout<<"\n";
#define ln length()
#define sz size()
#define mod 1000000007
#define elif else if
int32_t main(){

    string s;
     cin>>s;
    if(s[0]=='R' and s[1]=='R' and s[2]=='R'){
        cout<<3<<"\n";
    }
    elif(s[0]=='R' and s[1]=='R'){
        cout<<2<<"\n";
    }
    elif(s[1]=='R' and s[2]=='R'){
        cout<<2<<"\n";
    }
    elif(s[0]=='R' or s[1]=='R' or s[2]=='R')cout<<1<<"\n";
    else cout<<0<<"\n";
   return 0;
}
/*
Edge cases? n=1? a[i]<=0?
long vs int? 1LL? 64bits?
Re-read question. Is it as easy as it seems?
KEEP CORRECTING AND SUBMITTING!
*/


Measured memory_bytes: 3568
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
   int N;
   cin >> N;
   int A[N];
   bool dividable[1000001];
   memset(dividable,false,sizeof(dividable));
   for (int i = 0; i < N; i++) {
      cin >> A[i];
   }
   sort(A,A+N);
   int ans = 0;
   for(int i = 0 ; i < N; i++){
      if(i+1<N&&A[i]==A[i+1]){
         int tmp=A[i];
         while(i<N&&A[i]==tmp){
            i++;
         }
         i--;
         for(int j = tmp; j < 1000001; j+=tmp){
            dividable[j]=true;
         }
      }
      else{
         if(dividable[A[i]]==false){
            ans++;
            for(int j = A[i]; j < 1000001; j+=A[i]){
               dividable[j]=true;
            }
         }
      }
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 5388
n, m = map(int, input().split())

l = [-1] * n

for _ in range(m):
    s, c = map(int, input().split())
    s -= 1

    if l[s] == -1:
        l[s] = c

    elif l[s] != c:
        print(-1)
        exit()

if n > 1 and l[0] == 0:
    print(-1)
    exit()

if l[0] == -1:
    if n == 1:
        l[0] = 0
    else:
        l[0] = 1

for i in range(n):
    if l[i] == -1:
        l[i] = 0

print(*l, sep='')

Measured memory_bytes: 3064
#include<iostream>
#include<map>
using namespace std;
int main(){
	string st;
	map<string,int> mp;
	map<string,int>::iterator iter;
	int maxc=0;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>st;
		mp[st]++;
		if(mp[st]>maxc) maxc=mp[st];
	}
	
	for (iter = mp.begin();iter != mp.end(); iter++){
        if(iter->second==maxc) cout<<iter->first<<endl;
    }
	
}

Measured memory_bytes: 26240
#include <iostream>

int main(int argc, char const *argv[]) {
  int a, b;
  std::cin >> a >> b;
  for (float i = 1; i <= 1000; i++) {
    if(int(i*0.08) == a && int(i*0.1) == b){
      std::cout << i << std::endl;
      return 0;
    }
  }
  std::cout << -1 << std::endl;
  return 0;
}


Measured memory_bytes: 256
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
minus=[]
plus=[]
cnt=Counter(a)
zerocnt=cnt[0]
minuscnt=0
pluscnt=0
for i in range(n):
    if a[i]<0:
        minuscnt+=1
        minus.append(a[i])
    elif a[i]>0:
        pluscnt+=1
        plus.append(a[i])


if n==k:
    ans=1
    for i in range(n):
        ans*=a[i]
        ans%=mod
    print(ans%mod)
    quit()

if minuscnt==n:
    ans=1
    if k%2==0:
        for i in range(k):
            ans*=a[i]
            ans%=mod
        print(ans)
    else:
        for i in range(k):
            ans*=a[-1-i]
            ans%=mod
        print(ans)
    quit()

if minuscnt%2==1:
    minuscnt-=1

# print(minus)
plus.reverse()
# plus.append(0)
# plus.append(0)
# print(plus)

ans=1
nokori=k
m,p=0,0
# minuscnt=max(minuscnt,1)

while nokori:
    # print(pluscnt,p,m,nokori)
    if m==minuscnt:
        if p!=pluscnt:
            ans*=plus[p]
            p+=1
            nokori-=1
        else:
            ans=0
            nokori=0
    elif p==pluscnt:
        if nokori==1:
            ans=0
            nokori-=1
        else:
            ans*=minus[m]*minus[m+1]
            m+=2
            nokori-=2
    elif p+1==pluscnt:
        if nokori%2==0:
            ans*=minus[m]*minus[m+1]
            m+=2
            nokori-=2
            # if nokori==1:
        else:
            ans*=plus[p]
            p+=1
            nokori-=1
            # elif plus[p]>minus[m]*minus[m+1]:
            #     ans*=plus[p]
            #     p+=1
            #     nokori-=1
            # else:
            #     ans*=minus[m]*minus[m+1]
            #     m+=2
            #     nokori-=2
    elif nokori==1:
        ans*=plus[p]
        nokori-=1
    elif plus[p]*plus[p+1]>minus[m]*minus[m+1]:
        # if nokori%2==0:
        #     ans*=plus[p]*plus[p+1]
        #     p+=2
        #     nokori-=2
        # else:
        ans*=plus[p]
        p+=1
        nokori-=1
    else:
        ans*=minus[m]*minus[m+1]
        m+=2
        nokori-=2
    ans%=mod
print(ans%mod)


Measured memory_bytes: 134440
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int sx = sc.NextInt();
        int sy = sc.NextInt();
        int tx = sc.NextInt();
        int ty = sc.NextInt();

        StringBuilder sb = new StringBuilder();

        int dx = tx - sx;
        int dy = ty - sy;

        for (int i = 0; i < dy; i++)
        {
            sb.Append("U");
        }
        for (int i = 0; i < dx; i++)
        {
            sb.Append("R");
        }
        for (int i = 0; i < dy; i++)
        {
            sb.Append("D");
        }
        for (int i = 0; i < dx; i++)
        {
            sb.Append("L");
        }

        sb.Append("L");
        for (int i = 0; i < dy + 1; i++)
        {
            sb.Append("U");
        }
        for (int i = 0; i < dx + 1; i++)
        {
            sb.Append("R");
        }
        sb.Append("D");

        sb.Append("R");
        for (int i = 0; i < dy + 1; i++)
        {
            sb.Append("D");
        }
        for (int i = 0; i < dx + 1; i++)
        {
            sb.Append("L");
        }
        sb.Append("U");

        string answer = sb.ToString();

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27592
#include <iostream>

using namespace std;

int main() {
  int N, K;
  string S;
  cin >> N >> S >> K;
  char c = S[K - 1];
  for (auto &s : S) {
    s = (s == c ? s : '*');
  }
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.*;

public class Main {
    
    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] in1 = br.readLine().split(" ");
        int N = Integer.parseInt(in1[0]);
        int x = Integer.parseInt(in1[1]);
        br.close();

        int[] ans = new int[2*N - 1];
        
        if(x == 1 || x == 2 * N - 1){
            System.out.println("No");
            return;
        }

        System.out.println("Yes");
        
        if(N == 2){
            System.out.println(1);
            System.out.println(2);
            System.out.println(3);
            return;
        }

        boolean[] used = new boolean[2*N];

        ans[N-1] = x;
        used[x] = true;
        if(x == 2){
            ans[N] = 1; used[1] = true;
            ans[N-2] = 3; used[3] = true;
            ans[N+1] = 4; used[4] = true;
        }else{
            ans[N] = x+1; used[x+1] = true;
            ans[N-2] = x-1; used[x-1] = true;
            ans[N+1] = x-2; used[x-2] = true;
        }

        int cnt = 0;
        for(int i = 1; i <= 2 * N - 1; i++){
            if(used[i]) continue;
            while(ans[cnt] != 0) cnt++;
            ans[cnt] = i;
            cnt++;
            used[i] = true;
        }
        for(int i = 0; i < 2 * N - 1; i++){
            System.out.println(ans[i]);
        }
    }
}

Measured memory_bytes: 54196
import numpy as np
import math

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
enda = list([n+1])
endb = list([n+1])
numa = 0
numb = 0

for i in range(0,n-1):
  enda.append(a[i])
  endb.append(b[i])
  aa,bb = 0,0
  for j in range(0,i+1):
    if enda[j] < a[i]:
      aa += 1 
  a[i] = a[i] - aa
  for j in range(0,i+1):
    if endb[j] < b[i]:
      bb += 1
  b[i] = b[i] - bb
  
  numa += (a[i] -1) * math.factorial(n-1-i)
  numb += (b[i] -1) * math.factorial(n-1-i)

print(abs(numa - numb))

Measured memory_bytes: 21132
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int X;
  cin>>X;
  cout<<10-X/200<<endl;
  return 0;
}


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

using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i < (n); --i)
#define all(x) (x).begin(), (x).end()
#define gsort(x, n) sort((x), (x + n) greater<int>())
#define rv(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed(n) fixed << setprecision(n)
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).flont_back(a)
#define eb(x, a) (x).emplaes_back(a)
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9 + 7;

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

   int a[40] = { 1,
                 1,
                 1,
                 2,
                 1,
                 2,
                 1,
                 5,
                 2,
                 2,
                 1,
                 5,
                 1,
                 2,
                 1,
                 14,
                 1,
                 5,
                 1,
                 5,
                 2,
                 2,
                 1,
                 15,
                 2,
                 2,
                 5,
                 4,
                 1,
                 4,
                 1,
                 51 };
                 int k;
                 cin>>k;

                 cout<<a[k-1]<<'\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int a, n, m, ans;

int main() {

	cin >> a >> n >> m;

	REP(ya, 1, 10101) {
		ll x = 1;
		rep(i, n)x *= ya;
		if (x > m)break;
		int y = 0;
		while (x) {
			y += x % 10;
			x /= 10;
		}
		if (y + a == ya) {
			ans++;
		}
	}
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3080
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] count = new int[n];
        Arrays.fill(count, 1);
        boolean[] possible = new boolean[n];
        possible[0] = true;
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt() - 1;
            int y = sc.nextInt() - 1;
            if (possible[x]) {
                possible[y] = true;
            }
            count[x]--;
            count[y]++;
            if (possible[x] && count[x] == 0) {
                possible[x] = false;
            }
        }
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (possible[i]) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 64268
use std::io::*;

fn main() {
    let stdin = stdin();

    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut s: Vec<u8> = buf.trim().bytes().collect();

    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let t: Vec<u8> = buf.trim().bytes().collect();

    let mut replaced = false;
    for i in (0..s.len()+1-t.len()).rev() {
        if matches(&t, &s[i..i+t.len()]) {
            for j in 0..t.len() {
                s[i+j] = t[j];
            }
            replaced = true;
            break;
        }
    }
    if replaced {
        let s_str: String = s.iter().map(|&s| s as char).collect();
        println!("{}", s_str.replace("?", "a"));
    } else {
        println!("UNRESTORABLE")
    }
}

fn matches(s: &[u8], p: &[u8]) -> bool {
    for i in 0..s.len() {
        if p[i] != b'?' && s[i] != p[i] {
            return false;
        }
    }
    true
}


Measured memory_bytes: 4352
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2019-12-16 21:43:02
*/

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

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int r, D, x;
    cin >> r >> D >> x;

    int prev = x;
    for (int i = 0; i < 10; i++) {
        int ans = r*prev - D;
        cout << ans << endl;

        prev = ans;
    }

    return 0;
}


Measured memory_bytes: 256
import string
lisL = list(string.ascii_lowercase)
dic = dict(zip(lisL,list(range(26))))
s = input()
t = input()
lisT = list(reversed(sorted(t)))
lisS = list(sorted(s))
for sitem,titem in zip(lisS[0:min( len(lisT),len(lisS) )],lisT[0:min( len(lisT),len(lisS) )]):
  if dic[sitem] < dic[titem]:
    print ("Yes")
    break
  elif dic[sitem] > dic[titem]:
    print ("No")
    break
else:
  if len(lisT) > len(lisS):
    print ("Yes")
  else:
    print ("No")

Measured memory_bytes: 3960
import java.util.Scanner;
class Main {
    static Scanner scan = new Scanner(System.in);
    public static void main(String[] args) {
        String S = scan.next();
        String T = scan.next();
        int i = 0;
        int j = 0;
        int count = 0;
        while(i < S.length() && j < T.length()) {
            if(S.charAt(i) != T.charAt(j)){
                count++;
            }
            i++;
            j++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 40984
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cassert>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<limits>
#include<ctime>
#include<stack>
#include<bits/stdc++.h>
#include<string>
#include<stdlib.h>
#include<stdio.h>
#define long long

using namespace std;
int main() {
	int n;
	cin>>n;
	cout<<n*(n+1)/2;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  
  int n;
  cin>>n;
  int p[n];
  int cnt=0;
  REP(i,n){
    cin>>p[i];
    if(p[i]==i+1){
      continue;
    }else{
      cnt++;
    }
  }
  
  if(cnt<=2){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System;

public class A
{
	public static void Main(string[] args)
	{
        string[] input = Console.ReadLine().Split(' ');

        int A = int.Parse(input[0]);
        int B = int.Parse(input[1]);

        bool possible = false;

        if(A%3 == 0)
        {
            possible = true;
        }
        else if(B%3 == 0)
        {
            possible = true;
        }
        else if((A+B)%3 == 0)
        {
            possible = true;
        }

        if (possible)
        {
            Console.WriteLine("Possible");
        }
        else
        {
            Console.WriteLine("Impossible");
        }

	}
}


Measured memory_bytes: 13140
//author : Yogi79

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

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   
      double n,ans;
      cin>>n;
      if(int(n)%2 == 1)
      {
       double m = (int(n)/2)*1.0 + 1.0;
       ans = m/n;  
      }
      else
      {
       ans = 0.5;
      }
      cout<<fixed<<setprecision(12)<<ans;
}

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

int main() {
    string s,t;
    cin >> s >> t;
    bool flag = true;
    for(int i=0;i<s.length();i++){
        if(s[i] != t[i]) flag = false;
    }
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	int n;
	Scanner scan=new Scanner(System.in);
	n=scan.nextInt();
	int a[]=new int[n];
	for(int i=0;i<n;i++)
	    {
		a[i]=scan.nextInt();
	    }
	for(int i=n-1;i>=0;i--)
	    {
		System.out.print(a[i]+((i>0)?" ":"\n"));
	    }
    }
}

Measured memory_bytes: 18988
// input macro 
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){
    input!{
        s: String,
    }
    let ans = 2 * std::cmp::min(s.match_indices("0").count(), s.match_indices("1").count());
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <stdlib.h>
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
#define ll long long
const ll INF=0x3f3f3f3f;
#define mod 109
using namespace std;
//priority_queue
const ll Maxn=1e5;
ll gcd(ll a,ll b)
{
    return b==0?a:gcd(b,a%b);
}
ll kc(ll a,ll b)
{
    ll c=1;
    while(b)
    {
        if(b&1)c=(c*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return c;
}
bool cmp(double x,double y)
{
    return x>y;
}

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

int a[100003];
int t;
cin>>t;
for(int i=1;i<=t;i++)
    cin>>a[i];
sort(a+1,a+1+t);
if(a[t/2]==a[t/2+1])cout<<0<<endl;
else cout<<a[t/2+1]-a[t/2];
}


Measured memory_bytes: 640
import itertools
n, m = map(int, input().split())

node = [[False]*n for _ in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  node[a-1][b-1] = True
  node[b-1][a-1] = True

ans = 0
for value in itertools.permutations([int(x) for x in range(1, n)]):
  if not node[0][value[0]]:
    continue
  flag = True
  for i in range(n-2):
    if not node[value[i]][value[i+1]]:
      flag = False
  if flag:
    ans += 1

print(ans)

Measured memory_bytes: 3064
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*
import kotlin.comparisons.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val (a, b) = readListOfInt()    
    val ans = if(a > 0) 1 else if(a==0 || b >= 0) 0 else {
        val num = Math.abs(a - b - 1)
        if(num % 2 == 1) -1 else 1 
    }
    println(when(ans) {
        1 -> "Positive"
        0 -> "Zero"
        else -> "Negative"
    })
    pw.flush()
}

/****** Declared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j]) % MOD
        }
    }
    return v.map { it.toList() }.toList()
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
    if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
    a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


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

int main()
{
    int k, n, ans=1e9;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    sort(h.begin(), h.end());
    rep(i,n-k+1) {
        ans = min(ans, h[i+k-1] - h[i]);
    }

    cout << ans << endl;

    return 0;
}


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

void solve()
{
	ll a;
	cin>>a;
	printf("%lld\n", a+a*a+a*a*a);
}

int main()
{
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 3748
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define mp make_pair
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

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

int sort_greater(int m, int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(), greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
	return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t, sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;

map<string, int> memo;

using P=pair<int, int>;

/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
ll findIndex(int value, vector<ll> a)
{

	for (ll i = 0; i < (ll)a.size(); i++) {
		if (a[i] == value) {
			return i;
		}
	}
	return -1;
}

ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}

void comb(vector<vector <long long int> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (ll j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}

const int INF = 1001001001;

int main() {
	int a, b, h, m;
	cin >> a >> b >> h >> m;
	double ans,d;
	d = abs(5.5 * m - 30 * h); //cout << d<<endl;
	d = d*PI / 180;
	//cout << d << endl;
	ans = sqrt(a * a + b * b - 2 * a * b * (cos(d)));
	printf("%.10lf", ans);
	return 0;
}













Measured memory_bytes: 4156
#include<iostream>
using namespace std;
int main () {
  int can[100002];
  int N, K, Q;
  cin >> N >> K >> Q;
  for (int i = 1; i <= N; i ++) {
    can[i] = 0;
  }
  for (int i = 0; i < Q; i ++) {
    int a;
    cin >> a;
    can[a] ++;
  }
  for (int i = 1; i <= N; i ++) {
    if (can[i] > Q - K) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


Measured memory_bytes: 1024
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
r = a[::-1]

ga = [0] * (n + 1)
gr = [0] * (n + 1)
g = []

for i in range(n):
    ga[i + 1] = gcd(ga[i], a[i])
    gr[i + 1] = gcd(gr[i], r[i])

for j in range(n):
    g.append(gcd(ga[j], gr[n - j - 1]))

print(max(g))

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

int main(void){
  long long int n;
  cin >> n;
  for(long long int i=sqrt(n);i>=1;--i){
    if(n%i==0){
      long long int j=n/i;
      long long int mx = j, cnt=0;
      while(mx>=1){
        ++cnt;
        mx /= 10;
      }
      cout << cnt << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
h, w = map(int, input().split())
masu = []

for i in range(h):
    line = list(input())
    if line != ["."] * w:
        masu.append(line)

h = len(masu)
del_i = []
for i in range(w):
    for j in range(h):
        if masu[j][i] != ".":
            break
    else:
        del_i.append(i)
w = len(del_i)
for j in range(w):
    for i in range(h):
        masu[i].pop(del_i[j] - j)

for i in range(h):
    print("".join(masu[i]))


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }
template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int x1min = INF, x1max = -INF;
	int x2min = INF, x2max = -INF;
	int x3min = INF, x3max = -INF;

	int y1min = INF, y1max = -INF;
	int y2min = INF, y2max = -INF;
	int y3min = INF, y3max = -INF;

	int N; cin >> N;	
	for (int i = 0; i < N; i++) {
		int x, y; char d; cin >> x >> y >> d; x *= 2, y *= 2;
		if (d == 'U') {
			chmin(x2min, x);
			chmax(x2max, x);
			chmin(y1min, y);
			chmax(y1max, y);
		}
		if (d == 'D') {
			chmin(x2min, x);
			chmax(x2max, x);
			chmin(y3min, y);
			chmax(y3max, y);
		}
		if (d == 'L') {
			chmin(x3min, x);
			chmax(x3max, x);
			chmin(y2min, y);
			chmax(y2max, y);
		}
		if (d == 'R') {
			chmin(x1min, x);
			chmax(x1max, x);
			chmin(y2min, y);
			chmax(y2max, y);
		}
	}
	
	ll ans = LLINF;
	for (int T = 0; T <= 4e8; T++) {
		int xmin = min({x1min, x2min, x3min});
		int xmax = max({x1max, x2max, x3max});
		int ymin = min({y1min, y2min, y3min});
		int ymax = max({y1max, y2max, y3max});
		chmin(ans, (ll)(xmax-xmin) * (ll)(ymax-ymin));
		x1min++, x1max++;
		x3min--, x3max--;
		y1min++, y1max++;
		y3min--, y3max--;
	}
	cout << (double)ans / 4 << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 384