akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int n,m,cnt=0,o,aa[220000],cntl=0;
pair<int,int> p[220000];
string s,ss[220000];
char c,cc[5000][5000]={};
queue<int> que;
signed main(){
    cin>>n;
    printf("%.6f",n*2.0*3.14159265);
}

Measured memory_bytes: 10592
#include <iostream>
using namespace std;
typedef long long ll;
static const ll Z = 1 << 21;
#define rep(i,s,n)for(ll i = s;i<n;i++)
char s[Z];
char t[Z];

ll strlength(const char* c) {
	ll n = 0;
	while (*c++)n++;
	return n;
}

ll strCmpare(const char *s1, const char *s2)
{
	while (*s1 == *s2) {
		if (*s1 == '\0') return 0;
		s1++;
		s2++;
	}
	return (*s1 - *s2);
}

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

	ll sl = strlength(s);
	ll tl = strlength(t);

	if (sl != tl) {
		cout << ((sl > tl) ? "GREATER" : "LESS") << endl;
	}
	else {
		ll r = strCmpare(&s[0], &t[0]);
		cout << ((r == 0) ? "EQUAL" : ((r > 0) ? "GREATER" : "LESS")) << endl;
	}

	return 0;
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int w, h, n;
    cin >> w >> h >> n;
    int x1 = 0, x2 = w, y1 = 0, y2 = h;

    rep(i, n)
    {
        int x, y, a;
        cin >> x >> y >> a;
        switch (a)
        {
        case 1:
            x1 = max(x1, x);
            break;
        case 2:
            x2 = min(x2, x);
            break;
        case 3:
            y1 = max(y1, y);
            break;
        case 4:
            y2 = min(y2, y);
            break;
        }
    }
    if ((x2 - x1) <= 0 || (y2 - y1) <= 0)
        cout << "0" << endl;
    else
        cout << ((x2 - x1) * (y2 - y1)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for(long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for(long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                                                            \
    (upper_bound((V).begin(), (V).end(), X) -                                  \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                                                               \
    {                                                                          \
        cerr << #v << ':';                                                     \
        for(auto xv : v) cerr << xv << ' ';                                    \
        cerr << endl;                                                          \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2> inline bool chmin(T1 &a, const T2 &b) {
    if(a > b) a = b;
    return a > b;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, const T2 &b) {
    if(a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* liblary */

/* main */

signed main() {
    ll N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    S[K - 1] = S[K - 1] - 'A' + 'a';
    cout << S << endl;
}

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

typedef long long ll;
const ll MOD = (ll) 1e9 + 7;

vector<vector<char> > grid(1005, vector<char>(1005));
vector<vector<ll> > dp(1005, vector<ll>(1005));

int main() {
	int n, m;
	cin>>n>>m;
	for(int i=0; i<n; i++) {
		for(int j=0; j<m; j++) {
			cin>>grid[i][j];
		}
	}
	for(int i=0; i<n; i++) {
		for(int j=0; j<m; j++) {
			if(i==0 && j==0) dp[i][j]=grid[i][j]=='.';
			else if(i==0) dp[i][j] = (grid[i][j]=='.') ? dp[i][j-1] : 0;
			else if(j==0) dp[i][j] = (grid[i][j]=='.') ? dp[i-1][j] : 0;
			else dp[i][j] = (grid[i][j]=='.') ? ((dp[i-1][j] + dp[i][j-1])%MOD) : 0;
		}
	}
	cout<<dp[n-1][m-1]<<endl;
}


Measured memory_bytes: 9216
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
char a[4],b[4];
int main()
{
    cin>>a>>b;
    if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0]) cout<<"YES";
    else cout<<"NO";
	   
    return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

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

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

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

	int N;
	cin >> N;

	vector<lint> A(N), B(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < N; i++) cin >> B[i];

	priority_queue<pair<lint, lint>> pq;
	for (int i = 0; i < N; i++) pq.emplace(B[i], i);
	lint ans = 0;
	while (!pq.empty()) {

		lint b, idx;
		tie(b, idx) = pq.top();
		pq.pop();
		if (A[idx] == B[idx]) continue;

		lint sum = B[(idx + 1) % N] + B[(idx + N - 1) % N];
		lint cnt = (B[idx] - A[idx]) / sum;

		if (cnt <= 0) {
			ans = -1;
			break;
		}

		B[idx] -= sum * cnt;
		pq.emplace(B[idx], idx);
		ans += cnt;

	}

	cout << ans << "\n";
	
	return 0;
}

Measured memory_bytes: 9584
import sys
sys.setrecursionlimit(100000)
def depth_dp(v):
    if point[v] == float('inf'):
        point[v] = 0
    flag[v] = True
    for e in E[v]:
        if point[e[0]] == float('inf'):
            point[e[0]] = point[v] + e[1]
        elif point[e[0]] != point[v] + e[1]:
            return False
    for e in E[v]:
        if not flag[e[0]]:
            if not depth_dp(e[0]):
                return False
    return True

N,M = list(map(int,input().split()))
E = [[] for _ in range(N)]
flag = [False]*N
ans = True
point = [float('inf')]*N
for i in range(M):
    L,R,D = list(map(int,input().split()))
    E[L-1].append((R-1,D))
    E[R-1].append((L-1,-D))
for i in range(N):
    if not flag[i]:
        if not depth_dp(i):
            ans = False
            break
if ans:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 134604
local tmp = io.read("l") .. ' @'
local prev = ' '
local c = ' '
local cnt = 0
for i=1,#tmp do
    c = string.sub(tmp, i, i)
    if c == ' ' then
        if prev == string.sub(tmp, i+1,i+1) then
            cnt = cnt + 1
            if cnt == 2 then
                print('YES')
                return
            end
        else
            print('NO')
            return
        end
    end
    prev = c
end


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
    solve();
  }
}

void solve() {
  int a, b;
  cin >> a >> b;
  if (a > 8 || b > 8) {
    cout << ":(" << endl;
  } else {
    cout << "Yay!" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
int Greatest (int ,int);
int main(){
  int x,y,i,d,ny,nx;
  scanf("%d %d",&x,&y);
  printf("%d\n",Greatest(x,y));
    return 0;
}

int Greatest(int x,int y){
  int i,k;
  if(x>=y){}
  else{i=y;
    y=x;
    x=i;}
  while(y>0){
    k=x%y;
    x=y;
    y=k;
  }
  return x;
}
    



Measured memory_bytes: 2124
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n);(i)>=0;(i)--)
typedef long long lint;

int main(){
   lint N,K,Q;
   cin >>N>>K>>Q;
   vector <int> B(Q);
   vector <int> A(N);
     rep(i,Q){
       cin>>B[i];
   }
  A.resize(N);
   rep(i,Q){
       A[B[i]-1]++;
   }
    rep(i,N){
        if(K-(Q-A[i])>0)cout<<"Yes"<<endl;
        else cout <<"No"<<endl;
    }
}

  


Measured memory_bytes: 1408
#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(){

  int n;cin>>n;
  int a[n+10];rep(i,0,n)cin>>a[i];
  sort(a,a+n);

  int ans=0;
  rep(i,0,n-1)ans+=a[i+1]-a[i];

  out(ans);

  return 0;
}


Measured memory_bytes: 256
X = int(input())

if 400<=X<=599:
    print(8)
elif 600<=X<=799:
    print(7)
elif 800<=X<=999:
    print(6)
elif 1000<=X<=1199:
    print(5)
elif 1200<=X<=1399:
    print(4)
elif 1400<=X<=1599:
    print(3)
elif 1600<=X<=1799:
    print(2)
else:
    print(1)

Measured memory_bytes: 9124
//Inshallah , Boys played well..!!

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define pb push_back
#define pf push_front
#define mk make_pair
#define f(i,j,n) for(ll i=j;i<n;i++)
#define r(i,n,j) for(ll i=n-1;i>=j;i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define Test int t;cin>>t;while(t--)
#define mod 1000000007
#define md 998244353
#define MIN INT_MIN
#define MAX INT_MAX
#define inf LLONG_MAX
#define all(container) container.begin() , container.end()
#define rall(container) container.rbegin() , container.rend()
#define sz(container) (int)container.size()
#define vll vector<long long>
#define vi vector<int>
#define pii pair <int , int>
#define pll pair <ll , ll>
#define fi first
#define se second
#define setp(x) setprecision(x)
#define meme(x,i) memset(x,i,sizeof(x))
const int N = 100005;

void solve() {
    string s;
    cin >> s;
    if(s[sz(s)-1]=='s'){
        cout << s << "es";
    }
    else{
        cout << s << "s";
    }
}

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

Measured memory_bytes: 3584
from collections import deque

sa = deque(input())
sb = deque(input())
sc = deque(input())

a = len(sa)
b = len(sb)
c = len(sc)


s = sa.popleft()
a -= 1
while True:
    if s == "a":
        a -= 1
        if a == -1:
            ans = "A"
            break
        else:
            s = sa.popleft()

    elif s == "b":
        b -= 1
        if b == -1:
            ans = "B"
            break
        else:
            s = sb.popleft()

    elif s == "c":
        c -= 1
        if c == -1:
            ans = "C"
            break
        else:
            s = sc.popleft()

print(ans)


Measured memory_bytes: 9320
#include <iostream>
using namespace std;
//dp[i]:1~iまでの黒の石の数
int B[200001]={0};

int main(){
  int N;
  string str;
  cin >> N >> str;
  for(int i=0;i<N;i++){
    B[i+1]=B[i];
    if(str[i]=='#')B[i+1]++;
  }
  int ans=N+1;
  for(int i=0;i<=N;i++)ans=min(B[i]+(N-i)-(B[N]-B[i]),ans);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1412
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

type MyScanner struct {
	sc *bufio.Scanner
}

type MyWriter struct {
	stdout io.Writer
}

type MyPut interface{}

func getScanner(fp io.Reader) *bufio.Scanner {
	sc := bufio.NewScanner(fp)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 500001), 500000)
	return sc
}

func getHugeScanner(fp io.Reader, size int) *bufio.Scanner {
	sc := bufio.NewScanner(fp)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, size), size)
	return sc
}

func (mysc *MyScanner)String() string {
	mysc.sc.Scan()
	return mysc.sc.Text()
}

func (mysc *MyScanner)Int() int {
	i, _ := strconv.Atoi(mysc.String())
	return i
}

func (mysc *MyScanner)Int64() int64 {
	i, _ := strconv.ParseInt(mysc.String(), 10, 64)
	return i
}

func (mysc *MyScanner)Float64() float64 {
	i, _ := strconv.ParseFloat(mysc.String(), 64)
	return i
}

func (mw MyWriter)Puts(v MyPut) {
	_, _ = fmt.Fprintf(mw.stdout, "%v\n", v)
}

func LowerBound(l []int, n int) (int, int) {
	k := sort.Search(len(l), func(i int) bool { return l[i] >= n })
	if k == len(l) {
		return -1, -1
	}
	return k, l[k]
}

func Solve(stdin io.Reader, stdout io.Writer) {
	sc := MyScanner{getHugeScanner(stdin, 5000000)}
	mw := MyWriter{stdout}

	n := sc.Int()
	q := sc.Int()

	s := sc.String()

	cnt := make([]int, n + 1)

	for i := 1; i < n; i++ {
		if s[i - 1 : i + 1] == "AC" {
			cnt[i] = cnt[i - 1] + 1
		} else {
			cnt[i] = cnt[i - 1]
		}
	}

	for i := 0; i < q; i++ {
		l := sc.Int()
		r := sc.Int()
		mw.Puts(cnt[r - 1] - cnt[l - 1])
	}

}

func main() {
	Solve(os.Stdin, os.Stdout)
	return
}

Measured memory_bytes: 5888
s = input()
t = input()

start = [-1 for i in range(26)]
goal = [-1 for i in range(26)]

for i in range(len(s)):
    a = ord(s[i]) - ord('a')
    b = ord(t[i]) - ord('a')
    
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            print("No")
            exit()
    else:
        start[a] = b
        goal[b] = a

print("Yes")

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nt = Input.ar;
        var ar = Input.ar;
        var dif = new long[nt[0]];
        var min = int.MaxValue;
        for(var i=0;i<nt[0];i++)
        {
            min = Min(min, ar[i]);
            dif[i] = ar[i] - min;
        }
        var max = dif.Max();
        WriteLine(dif.Count(v => v == max));
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 21472
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

class BUnevenNumbers {
public:

void solve(std::istream &in, std::ostream &out) {
    int n;
    int cnt = 0;
    in >> n;
    for (int i = 1; i < n+1; ++i) {
        if (i == pow(10, 5)) continue;
        else if( i >= pow(10, 4)) cnt += 1;
        else if ( i >= pow(10, 3)) continue;
        else if (i >= pow(10, 2)) cnt += 1;
        else if ( i >= 10) continue;
        else cnt += 1;
    }
    cout << cnt << endl;
}

};


int main() {
	BUnevenNumbers solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

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>;

int main()
{
    while (1)
    {
        int m, f, r;
        cin >> m >> f >> r;
        if (m == -1 && f == -1 && r == -1)
            break;
        if (m == -1 || f == -1)
            cout << "F" << endl;
        else if (m + f >= 80)
            cout << "A" << endl;
        else if (m + f >= 65)
            cout << "B" << endl;
        else if (m + f >= 50)
            cout << "C" << endl;
        else if (m + f >= 30)
        {
            if (r >= 50)
                cout << "C" << endl;
            else
                cout << "D" << endl;
        }
        else
            cout << "F" << endl;
    }
    return 0;
}


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

#define pb push_back

using namespace std;

int main(){

string str,t;
cin>>str>>t;
int l1,l2;
l1=str.size();
l2=t.size();
int ans=0;
for(int i=0;i<=l1-l2;i++)
{
    int k=0;
    for(int j=i;j<i+l2;j++)
    {
        if(str[j]==t[j-i])
        {
            k++;
        }
    }
    ans=max(ans,k);
}
cout<<l2-ans<<endl;






}


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

#define f first
#define s second
#define pb push_back
#define all(c) c.begin(),c.end()

#define gi(x) scanf("%d", &x)
#define pi(x) printf("%d", x)
#define gl(x) scanf("%lld", &x)
#define pl(x) printf("%lld", x)
#define sp printf(" ")
#define nl printf("\n")

typedef long long int lld;
typedef long double ldb;

// #define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define trace(...)
#endif

#define int lld

int c[100010], a[100010], b[100010];
int ai[100010], bi[100010];

main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i];
    for(int i = 1; i <= n; ++i) cin >> b[i];
    vector <int> vct;
	int sx = 0, sy = 0;
	for(int i = 1; i <= n; ++i){
		sx += b[i] - a[i];
		if(b[i] <= a[i]){
			;
		}
		else{
			int t = b[i] - a[i];
			if(t&1){
				sy += t/2 + 1;
			}
			else{
				// sy++;
				sy += t/2;
			}
		}
	}
	trace(sx, sy);
	if(sx < sy) return cout << "No" << endl,0;
	cout << "Yes";

}


Measured memory_bytes: 384
//question based on principal of inclusion and exclusion
// links to the editorial:-
//https://codeforces.com/blog/entry/79438
//also see the atcoder editorial
//https://cp-algorithms.com/algebra/module-inverse.html(link to study modular inverse of a number)
//refer (account name-probably) submission
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long int MOD=1e9+7;
vector<ll> inverse;
vector<ll> f,f_inverse;
void factorial_initialize(ll max)
{
    vector<ll> a(max+1,1);
    inverse=a;
    f=a;
    f_inverse=a;
    for(ll i=2;i<=max;i++)
    {
        inverse[i]=MOD-inverse[MOD%i]*(MOD/i)%MOD;//(find this relation explaination in above link)
        f[i]=f[i-1]*i%MOD;
        f_inverse[i]=f_inverse[i-1]*inverse[i]%MOD;//inverse of 2! is 1/(2!)
    }
}
ll nCr(ll n,ll r)
{
    if(n<r||r<0)
    return 0;
    /*if(n>=f.size())
    factorial_initialize(n);*/
    return f[n]*f_inverse[r]%MOD*f_inverse[n-r]%MOD;
    
}
int main()
{
    factorial_initialize(1e6);
  //  cout<<nCr(5,2);
  ll n,m;
  cin>>n>>m;
  ll cur=1;
  ll ans=0,add;
    for(ll i=0;i<=n;i++)
    {
         add=0;
        //ans=(ans+cur*nCr(n,i)%MOD*nCr(m-i,n-i)%MOD*f[n-i]%MOD)%MOD;
        ll same=nCr(n,i)%MOD;
        ll diff=(nCr(m-i,n-i)%MOD*f[n-i]%MOD)%MOD;
        add=(same*diff)%MOD;
        add=cur*add;
        ans=ans+add%MOD;
        ans=(ans%MOD+MOD)%MOD;
        cur=-cur;
    }
  // cout<<ans<<"\n";
    cout<<ans*nCr(m,n)%MOD*f[n]%MOD<<"\n";
    return 0;
}

Measured memory_bytes: 34240
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

int main() {
	int N;
	string S, T;
	cin >> N >> S >> T;
	deque<char>SQ;
	deque<char>TQ;
	rep(i, N) {
		SQ.push_back(S[i]);
		TQ.push_back(T[i]);
	}
	int cnt = 0;
	rep(i, N) {
		if (SQ == TQ) {
			cout << N + cnt << endl;
			return 0;
		}
		else {
			cnt++;
			SQ.pop_front();
			TQ.pop_back();
		}
	}
	cout << N + cnt << endl;
}


Measured memory_bytes: 256
n=int(input())
t,a=map(int,input().split())
hs=list(map(int,input().split()))

place=0
degree=10000000000
for i,h in enumerate(hs):
  if degree>abs(a-(t-h*0.006)):
    degree=abs(a-(t-h*0.006))
    place=i
print(place+1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
	ll n,m;
	ll ans=0;
	cin>>n>>m;
	if(m==1){
		cout<<"0";
		exit(0);
	}
	ll num= floor(double(log(m))/double(log(n)));
	ans=ans+(pow(n,num)-1)/(n-1);
	ll rem=m-pow(n,num);
	rem=ceil(double(rem)/double(n-1));
	ans=ans+rem;
	cout<<ans;
}


Measured memory_bytes: 256
#include <stdio.h>

int n, m;
int a, b, c;
int i;
int sum, max;

int main(){

  scanf( "%d %d" , &n , &m );

  for( i = 0; i < m; i++ ){
    scanf( "%d %d" , &a , &b );
    c = n - a;
    if( c > 0 ){
      sum += c;
    }
    if( c > max ){
      max = c;
    }
  }

  printf( "%d\n" , sum - max );

  return 0;
}


Measured memory_bytes: 1964
n = int(input())
L = ['M','A','R','C','H']

A = [0] * 5

for i in range(n):
    s = input()
    if s[0] not in L:
        continue
    A[L.index(s[0])] += 1
import itertools
total = 0
for i in list(itertools.combinations(A,3)):
    a, b, c = i
    total += a*b*c
print(total)

Measured memory_bytes: 43624
#include <iostream>
using namespace std;
int n;
int arr[101];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	int ans = 0;
	for (int i = 1; i < n; i++) {
		if (arr[i] == arr[i - 1]) {
			arr[i] = -1;
			ans++;
		}
	}
	cout << ans << '\n';
}

Measured memory_bytes: 256
N, W = map(int, input().split())
dp = [0]*(W+1)
max_weight = 0
for i in range(N):
    v, w, m = map(int, input().split())
    # log2(10000) = 13.2... ????????§ 1<<0 ??? 1<<12
    for j in range(13):
        n = 1 << j
        if m < n:
            break
        m -= n
        _v, _w = v*n, w*n
        max_weight = min(W, max_weight + _w)
        for k in range(max_weight, _w-1, -1):
            if dp[k] < dp[k-_w] + _v:
                dp[k] = dp[k-_w] + _v

    if m > 0:
        _v, _w = v*m, w*m
        max_weight = min(W, max_weight + _w)
        for j in range(max_weight, _w-1, -1):
            if dp[j] < dp[j-_w] + _v:
                dp[j] = dp[j-_w] + _v

print(max(dp))

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll a,b,c; cin>>a>>b>>c;
    if(a+b>c && a==b && b==c && c==a) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3612
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999

using namespace std;

typedef long long ll;

vector<int>primenumber;
int d[1050000];

int main()
{
	int n;
	
	primenumber.push_back(2);
	d[2] = 1;

	int maxn = 0;

	while (cin >> n) {
		if (maxn<n) {
			for (int i = max(maxn+1,3); i <= n; i++) {
				int ope = 1;
				for (int j = 0; j < primenumber.size(); j++) {
					if (primenumber[j] * primenumber[j] > i)break;
					if (i%primenumber[j] == 0) {
						ope = 0;
						break;
					}
				}
				if (ope == 1)primenumber.push_back(i);
				d[i] = primenumber.size();
			}
			maxn = n;
		}
		cout << d[n] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 7112
#include <iostream>
#include <stack>

long long quaternary(int n)
{
	std::stack<int> st;
	while (n>0) {
		st.push(n%4);
		n /= 4;
	}
	long long res = 0;
	while (!st.empty()) {
		res *= 10;
		res += st.top(); st.pop();
	}
	return res;
}

int main()
{
	int n;
	while (true) {
		std::cin >> n;
		if (n==-1) break;
		std::cout << quaternary(n) << std::endl;
	}
	return 0;
}



Measured memory_bytes: 3088
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
using ll = long long;
using ld = long double;
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define rng(i,s,n) for(int (i) = (s) ; (i) < (n) ; (i)++)
#define req(i,n) for(int (i) = (n) - 1 ; (i) >= 0 ; (i)--)
#define mkp make_pair
#define mem0(x) memset(x,0,sizeof(x))
#define vec vector
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define ctoi(c) (int)(c-'A')
#define itoc(c) (char)(c+'A')
#define pb push_back
#define cauto const auto&
#define itn int
#define pri_que priority_queue
#define pp(x,y) pb(H{x,y})
#define ppp(x,y,z) pb(Q(x,y,z))
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll inf = 3 * 1e18;
const int Inf = 15 * 1e8;
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T & a, const T & b) { if (b < a) { a = b; return 1; } return 0; }
ll read() { ll u, k = scanf(" %lld", &u); return u; }
string reads() { string s; cin >> s; return s; }
ll gcd(ll i, ll j) { return j ? gcd(j, i % j) : i; }
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0; for (int i = 0; i < 60; i++)if ((1ll << i) & x) sum++;
	return sum;}
const int fn_ = 600000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}
//---------------------------------------------------------------
int n, k;
int a[200000];
signed main() {
	cin >> n >> k;
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	int ans = 0;
	rng(i, k - 1, n) {
		ans += a[i] * comb(i, k - 1);
		ans %= mod;
	}
	rep(i, n - k + 1) {
		ans -= a[i] * comb(n - i - 1, k - 1);
		ans %= mod;
	}
	cout << (ans + mod) % mod << endl;
}

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

int main(){
  int num;
  int st[31] = {0};
  
  for(int i=0;i<28;i++){
    scanf(" %d",&num);
    st[num] = 1;
  }
  
  for(int i=1;i<=30;i++){
    if(st[i] == 0){
      printf("%d\n",i);
    }
  }
  
  return 0;
}

Measured memory_bytes: 3204
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String inputData;
        List<Integer> resultList = new ArrayList<Integer>();
        try {

	        while(true){
					inputData = reader.readLine();
	            if(inputData.indexOf(" ? ") > 0){
	            	break;
	            }else{
					String[] strNumber = inputData.split(" ");
					int a = Integer.parseInt(strNumber[0]);
					String op = strNumber[1];
					int b = Integer.parseInt(strNumber[2]);

					resultList.add(outputCalc(a , b, op));

	            }
	        }
	        for(Integer val: resultList){
	        	System.out.println(val);
	        }

		} catch (IOException e) {
			// TODO ????????????????????? catch ????????????
			e.printStackTrace();
		}

	}
	/**
	 * ?????????????????????
	 * @param a
	 * @param b
	 * @param op
	 * @return result
	 */
	private static Integer outputCalc(int a , int b , String op){

		int result = 0;
		if("+".equals(op)){
			result = a + b;
		}else if("-".equals(op)){
			result = a - b;
		}else if("*".equals(op)){
			result = a * b;
		}else if("/".equals(op)){
			result = a / b;
		}
		return result;
	}


}

Measured memory_bytes: 24204
#include <stdio.h>

int main(void){
  int a,b,c,d,M=0,S=0,Total=0;

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

  Total = a + b + c + d;

  while( Total >= 60 ){

    Total -= 60;
    M++;

  }

  S = Total;

  printf("%d\n%d\n" ,M ,S);

  return 0;

}

Measured memory_bytes: 592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int mod = 1e9 + 7;

int main(void)
{
    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    for (int i = 0; i < n;i++){
        cin >> a[i];
        b[i] = (a[i] - i - 1);
    }
    sort(b.begin(), b.end());
    int B;
    if(n%2==1)
        B = b[n / 2];
        else
            B = (b[n / 2 - 1] + b[n / 2]) / 2;
        ll ans = 0;
        for (ll i = 0; i < n;i++){
            ans += abs(b[i] - B);
        }
        cout << ans << endl;
        return 0;
}

Measured memory_bytes: 3328
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    for i in range (H):
        for j in range (W):
            if i==0 or i==(H-1) or j==0 or j==(W-1):
                print('#',end='')
            else:
                print('.',end='')
        print()
    print()


Measured memory_bytes: 7008
#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
void dice1();
class DICE{
	int face[6],a;
public:
	void set(int&f,int&f1,int&f2,int&f3,int&f4,int&f5){
		face[0]=f;face[1]=f1;face[2]=f2;face[3]=f3;face[4]=f4;face[5]=f5;
	}
	void N(){
		a=face[0];
		face[0]=face[1];
		face[1]=face[5];
		face[5]=face[4];
		face[4]=a;
	}
	void E(){
		a=face[0];
		face[0]=face[3];
		face[3]=face[5];
		face[5]=face[2];
		face[2]=a;
	}
	void S(){
		a=face[0];
		face[0]=face[4];
		face[4]=face[5];
		face[5]=face[1];
		face[1]=a;
	}
	void W(){
		a=face[0];
		face[0]=face[2];
		face[2]=face[5];
		face[5]=face[3];
		face[3]=a;
	}
	void output(){
		cout<<face[0]<<endl;
	}
};
int main(){
	DICE a;
	dice1();

	return 0;
}
void dice1(){
DICE a;
	int d[6];string str;
	for(int i=0;i<6;++i){
		cin>>d[i];
	}
	a.set(d[0],d[1],d[2],d[3],d[4],d[5]);
	getline(cin,str);
	getline(cin,str);
	for(int i=0;i<str.size();++i){
		if(str[i]=='E'){
			a.E();
		}
		else if(str[i]=='S'){
			a.S();
		}
		else if(str[i]=='W'){
			a.W();
		}
		else if(str[i]=='N'){
			a.N();
		}
	}
	a.output();
	return;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
#include <algorithm>
#include <stdio.h>
#include <math.h>
using namespace std;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)

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

struct edge {
	int to,cost;
	edge(int t,ll c):to(t),cost(c) {}
};

int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
int ddx[]={1,1,1,0,-1,-1,-1,0},ddy[]={1,0,-1,-1,-1,0,1,1};

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

//-----------------------------------------------------------------------------

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

	int a,b; cin>>a>>b;
	if(a+b<3) cout<<"Impossible"<<endl;
	else if(a%3==0||b%3==0||(a+b)%3==0) cout<<"Possible"<<endl;
	else cout<<"Impossible"<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cctype>
std::string s;

int main(){
  
  std::cin >> s;
  
  std::string ans = "AC";
  int len = s.size();
  std::string sub = s.substr(2, len-3);
  int low=0;
  
  int f = s.find('C');
  int b = s.rfind('C');
  if(f != b) ans = "WA";
  if(f <2 or len-2 < f) ans = "WA";
  if(s.front() != 'A') ans = "WA";
  for(int i=0; i<len ;i++){
    if(islower(s[i])) low++;
       }
  if(low != (len-2)) ans = "WA";
       
  std::cout << ans << '\n';

}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int n,ans; cin>>n;
    vector<pp> l(100001),r(100001);
    rep(i,100001){
        l[i]=mk(0,i); r[i]=mk(0,i);
    }
    rep(i,n){
        int v; cin>>v;
        if(i%2==0) l[v].first++;
        else r[v].first++;
    }
    sort(al(l)); sort(al(r));
    if(l[100000].second!=r[100000].second)
    cout<<((n+1)/2-l[100000].first)+(n/2-r[100000].first)<<endl;
    else{
        int e=((n+1)/2-l[99999].first)+(n/2-r[100000].first);
        int f=((n+1)/2-l[100000].first)+(n/2-r[99999].first);
        cout<<min(e,f)<<endl;
    }
}

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

using namespace std;

int main() {
#ifdef _DEBUG
	freopen("_in" , "r", stdin );
	freopen("_out", "w", stdout);
#endif
	int n; cin >> n;
	int s = 0;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n - 1; i++)
	for (int j = i + 1; j < n; j++) {
		s += a[i] * a[j];
	}
	cout << s << '\n';
}


Measured memory_bytes: 3604
# coding: utf-8

a, b, k = map(int, input().split())

cnt = 0

mini = min([a, b])
output = 1

for i in range(mini, 0, -1):
    if a % i == 0 and b % i == 0:
        cnt += 1
        output = i
    if cnt == k:
        break

print(output)

Measured memory_bytes: 3060
abc = list(map(int, input().split()))
is_even = [0] * 3
ans = 0
for i in range(3):
    is_even[i] = True if abc[i] % 2 == 0 else False
if is_even.count(True) == 1:
    for i in range(3):
        if not is_even[i]:
            abc[i] += 1
    ans += 1
if is_even.count(True) == 2:
    for i in range(3):
        if is_even[i]:
            abc[i] += 1
    ans += 1
abc.sort()
ans += (abc[2] - abc[1]) // 2
ans += (abc[2] - abc[0]) // 2
print(ans)


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

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

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

    cout << max( A+B, max(A*B, A-B)) << endl;
}


Measured memory_bytes: 256
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl

#define rep(i, n) REP(i, 0, n)                  // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++) // x, x + 1, ..., n-1
#define FOREACH(x, a) for(auto &(x) : (a))

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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

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

    int N, K;
    cin >> N >> K;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];

    ll ans = 1e18;
    for(int bit = 0; bit < (1 << N); bit++) {
        if(__builtin_popcount(bit) < K) continue;
        ll h = 0, res = 0;

        rep(i, N) {
            if(bit & (1 << i)) {
                if(h >= a[i]) {
                    res += h + 1 - a[i];
                    h++;
                }
            }
            h = max(h, a[i]);
        }
        ans = min(ans, res);
    }
    cout << ans << endl;
}


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

using ll = long long;
using ld = long double;

int main(void)
{
    ld a,b,h,m;
    ld x;
    cin >> a >> b >> h >> m;
    ld theta = abs(6*m - (30*h + m/60*30));
    if(theta > 180)
    {
        theta = 360 - theta;
    }
    //cout << theta << endl;
    theta = theta * M_PI / 180;
    ld abcos = a*b*cos(theta);
    x = sqrt( abs(b*b - 2*abcos + a*a));

    cout << fixed << setprecision(10) << x << endl;
    
    return 0;
}


Measured memory_bytes: 4120
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define sf1(a); scanf("%d",&a);
#define sf2(a,b); scanf("%d %d",&a, &b);
#define sf3(a,b,c); scanf("%d %d %d",&a, &b,&c);
#define sf4(a,b,c,d); scanf("%d %d %d %d",&a, &b,&c,&d);
#define pf1(a); printf("%d\n",a);
#define pf2(a,b); printf("%d %d\n",a,b);
#define pf3(a,b,c); printf("%d %d %d\n",a,b,c);
#define pf4(a,b,c,d); printf("%d %d %d %d\n",a,b,c,d);

using namespace std;

int main()
{
    int n;
    cin>>n;
    if(n<=111) cout<<"111"<<endl;
    else if(111<n && n<=222) cout<<"222"<<endl;
    else if(222<n && n<=333) cout<<"333"<<endl;
    else if(333<n && n<=444) cout<<"444"<<endl;
    else if(444<n && n<=555) cout<<"555"<<endl;
    else if(555<n && n<=666) cout<<"666"<<endl;
    else if(666<n && n<=777) cout<<"777"<<endl;
    else if(777<n && n<=888) cout<<"888"<<endl;
    else if(888<n && n<=999) cout<<"999"<<endl;
    return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  cout << (N + K - 3) / (K - 1) << endl;
}


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

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

    vector<int> A(M);
    for (int i = 0; i < M; i++) cin >> A[i];
    
    for (int j = 0; j < M; j++) {
        N = N - A[j];
    }

    if (N < 0) {
        cout << -1;
    }
    else {
        cout << N;
    }

    return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
#define INF 1000000007
#define llINF 1000000000000000007
#define v(i) vector<i>
#define vv(i) vector<vector<i>>
// cin.eof() 入力個数の問題
// int num = atoi(string.c_str()); 文字列の整数変換

int main() {
    string s;
    cin>>s;
    v(char) ans;
    rep(i,s.size()){
        if(s[i] == '0'){
            ans.push_back('0');
        }else if(s[i] == '1'){
            ans.push_back('1');
        }else if(s[i] == 'B' && !ans.empty()){
            ans.pop_back();
        }
        }
        rep(i,ans.size()){
            cout<<ans[i];
        }
            return 0;
}


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

int f(int a){
    switch(a){
        case 4:
        case 6: 
        case 9:
        case 11: 
            return 0;
        case 2: 
            return 1;
        default: 
            return 2;
    }
}
int main(){
    int x, y;
    cin >> x >> y;
    if(f(x)==f(y)) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <map>

using namespace std;

int main()
{
    long long int n, p;
    long long int cnt[1000010] = {0};
    long long int ans = 1;
    map<long long int, long long int> mp;

    cin >> n >> p;

    long long int tmp = p;

    for (int i = 2; i < sqrtl(tmp); i++) {
        if (p % i == 0) {
            while (p % i == 0) {
                p /= i;
                mp[i]++;
            }
        }
    }
    mp[p] = 1;

    for (auto x: mp) {
        if (n <= x.second) {
            while (n <= x.second) {
                ans *= x.first;
                x.second -= n;
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1000000000;
const int mod = 1e9+7;
const int maxn = 2e5+5;
int main() {
	int a,b,c;
	int cnt=0,k;
	cin>>a>>b>>c>>k;
	while(b<=a){
		b*=2;
		cnt++;
	} 
	while(c<=b){
		c*=2;
		cnt++;
	}
	if(cnt<=k){
		cout<<"Yes\n";
	}else {
		cout<<"No\n";
	}
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
// -9 = 1011
// (1)+(-2)+(-8)
//　はじめ-9                       //はじめ８ == 11000
//  -9%2 == 1 ans+=1 -9 = -10 = 5 //8%2 == 0 8 = -4
//  5%2 == 1 ans+=1 5 = 4 = -2    //-4%2 == 0 -4 = 2
// -2%2 == 0 ans+=0 -2 == 1;      //2%2 == 0 2 = -1
int main() {                      //-1%2 == 1 ans+=1 -1 = -2 = 1 
	int N;
	cin >> N;
    if(N == 0) {
        cout << 0 << endl;
        return 0;
    }
	string ans = "";
	while (N != 0) {
		if (N%2 != 0) {
            N--;
			ans = '1' + ans;
		}
		else {
            ans = '0' + ans;
        }
		N/=-2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    int ans = INT_MAX;
    for (int tmp = 0; tmp < (1 << n); tmp++) {
        bitset<12> comb(tmp);
        vector<int> app(m, 0);
        int price = 0;
        for (int i = 0; i < n; i++) {
            if (comb.test(i)) {
                price += c[i];
                for (int j = 0; j < m; j++) {
                    app[j] += a[i][j];
                }
            }
        }
        bool flag = true;
        for (int j = 0; j < m; j++) {
            if (app[j] < x) flag = false;
        }
        if (flag) ans = min(ans, price);
    }
    if (ans == INT_MAX) ans = -1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3504
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

int main(int argc, char const* argv[]) {
    int W, H, N;
    std::cin >> W >> H >> N;
    std::vector<std::vector<int>> v(N, std::vector<int>(3, 0));
    std::vector<std::vector<int>> position(2, std::vector<int>(2, 0));

    for (size_t i = 0; i < N; i++) {
        std::cin >> v.at(i).at(0) >> v.at(i).at(1) >> v.at(i).at(2);
    }

    position.at(0) = {0, 0};
    position.at(1) = {W, H};
    int s          = 1;

    for (size_t i = 0; i < N; i++) {

        if (s == 0) {
            std::cout << 0 << '\n';
            return 0;
        }
        switch (v.at(i).at(2)) {
        case 1:
            if (position.at(0).at(0) < v.at(i).at(0) && v.at(i).at(0) < position.at(1).at(0)) {
                position.at(0).at(0) = v.at(i).at(0);
            } else if (v.at(i).at(0) >= position.at(1).at(0)) {
                s = 0;
            }
            break;
        case 2:
            if (position.at(0).at(0) < v.at(i).at(0) && v.at(i).at(0) < position.at(1).at(0)) {
                position.at(1).at(0) = v.at(i).at(0);
            } else if (v.at(i).at(0) <= position.at(0).at(0)) {
                s = 0;
            }
            break;
        case 3:
            if (position.at(0).at(1) < v.at(i).at(1) && v.at(i).at(1) < position.at(1).at(1)) {
                position.at(0).at(1) = v.at(i).at(1);
            } else if (v.at(i).at(1) >= position.at(1).at(1)) {
                s = 0;
            }
            break;
        case 4:
            if (position.at(0).at(1) < v.at(i).at(1) && v.at(i).at(1) < position.at(1).at(1)) {
                position.at(1).at(1) = v.at(i).at(1);
            } else if (v.at(i).at(1) <= position.at(0).at(1)) {
                s = 0;
            }
            break;
        }
    }

    if (s == 0) {
        std::cout << s << '\n';
    } else {
        std::cout << (position.at(1).at(0) - position.at(0).at(0)) *
                         (position.at(1).at(1) - position.at(0).at(1))
                  << '\n';
    }

    return 0;
}


Measured memory_bytes: 256