akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<map>
#include<math.h>

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

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*(b/gcd(a,b)); }

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

    ll b_mod_c = b / c;
    ll b_mod_d = b / d;
    ll a_mod_c = (a-1) / c;
    ll a_mod_d = (a-1) / d;
    ll b_mod_cd = b / lcm(c,d);
    ll a_mod_cd = (a-1) / lcm(c,d);

    ll ans = b-a+1;
    ans -= (b_mod_d - a_mod_d) + (b_mod_c - a_mod_c) - (b_mod_cd - a_mod_cd);
    cout << ans << endl;
    return 0;
} /*atcoder*/



Measured memory_bytes: 3600
n = int(input())
cnt = 1
if n>=3:
    cnt = cnt + 1
elif n==2:
    cnt = cnt + 2
else:
    cnt = cnt + 3
while n != 1:
    if n % 2 == 0:
        n /= 2
    else:
        n = 3*n+1
    cnt += 1
print(cnt)

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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int x = a + b;
	int y = c + d;
	if(x < y) cout << "Right" << endl;
	if(x > y) cout << "Left" << endl;
	if(x == y) cout << "Balanced" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1005;
int a[N],n,k;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	int s=0;
	for(int i=1;i<=k;i++)
		s+=a[i];
	printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 3764
def count_divisor(n):
    arr = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            arr.append(i)
            arr.append(n//i)
    res = len(set(arr))
    return res

n = int(input())
ans = 0
for i in range(1, n+1, 2):
    c = count_divisor(i)
    if c == 8: ans += 1
print(ans)

Measured memory_bytes: 9308
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;


int main(void){

  int A,B;

  cin >> A >> B;

  if( A <= 2*B ){
    cout << 0 << endl;
  }else{
    cout << A - 2*B << endl;
  }

  return 0;
}




Measured memory_bytes: 256
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

S = gets.chomp
K = get_int


s_index = S.split('').find_index { |s| s != '1' }

if s_index.nil? || s_index >= K
  puts 1
else
  puts S[s_index]
end


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

int main()
{
    map<string, int> m;
    int maxNum = 0;
    string ret1;
    int maxLength = 0;
    string ret2;

    for(;;){
        string s;
        if(!(cin >> s))
            break;

        int num = ++ m[s];
        if(num > maxNum){
            maxNum = num;
            ret1 = s;
        }

        if(s.size() > maxLength){
            maxLength = s.size();
            ret2 = s;
        }
    }

    cout << ret1 << ' ' << ret2 << endl;
    return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main() {
	int n, m;
	char data[100][2], str[100000];
	while (cin >> n && n) {
		for (int i = 0; i < n; ++i) cin >> data[i][0] >> data[i][1];
		cin >> m;
		for (int i = 0; i < m; ++i) {
			cin >> str[i];
			for (int j = 0; j < n; ++j) {
				if (str[i] == data[j][0]) {
					str[i] = data[j][1];
					break;
				}
			}
		}
		for (int i = 0; i < m; ++i) cout << str[i];
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<pair<int,int> >v;
	int a[n];
	for(int i=0;i<n;i++)
	{
		
		cin>>a[i];
		v.push_back({a[i],i});
	}
	sort(v.begin(),v.end());
	int ans[n];
	ans[v[v.size()-1].second]=v[v.size()-2].first;
	for(int i=v.size()-2;i>=0;i--)
	{
		ans[v[i].second]=v[v.size()-1].first;
	}
	for(int i=0;i<n;i++)
	{
		cout<<ans[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 4848
#include<cstdio>
int main(){
	int N=0,K=0,X=0,Y=0,a=0,b=0;
	scanf("%d %d %d %d",&N,&K,&X,&Y);
	for(int i=1;i<=N;i++){
		if(i<=K) a=a+X;
		else b=b+Y;
	}
	printf("%d",a+b);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end() 

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

int main(){
    int N;
    cin>>N;
    vi A(N);
    int flag=0;
    F0R(i,N){
        cin>>A[i];
        if(A[i]%2==0){
            if(A[i]%5==0||A[i]%3==0){

            }else{
                flag=1;
            }
        }
    }
    if(flag){
        cout<<"DENIED"<<endl;
    }else{
        cout<<"APPROVED"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
N = int(input())
X = [0] * N
U = [0] * N
for i in range(N):
  X[i], U[i] = input().split()
  X[i] = float(X[i])
  if U[i] == 'BTC':
    X[i] = X[i] * 380000.0
print(sum(X))

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

using ll=int64_t;
const int temp=1e5;
ll check[temp+1];

int main() {
  int N; ll K; cin >>N >>K;
  rep(i,0,N) {
    int a,b; cin >>a >>b;
    check[a]+=b;
  }
  rep_eq(ans,1,temp) {
    if (K<=check[ans]) {
      cout <<ans <<endl;
      break;
    }
    K-=check[ans];
  }
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
 

int ascSort(const void* v1, const void* v2) {
    const int _v1 = *((const int*)v1);
    const int _v2 = *((const int*)v2);
 
    if ( _v1 < _v2 ) {
        return 1;
    } else if ( _v1 > _v2 ) {
        return -1;
    } else {
        return 0;
    }
}
int main(){
  int n,h,i,j,s,ans=0,ruiseki=0,tmp,max=0;
  scanf("%d %d",&n,&h);
  int a[n],b[n];
  for(i=0;i<=n-1;i++){
    scanf("%d %d",&a[i],&b[i]);
  }
  for(i=0;i<=n-1;i++){
    if(max <= a[i]){
      max = a[i];
    }
  }
  qsort(b, n, sizeof(b[0]), ascSort);
  for(i=0;i<n;i++){
    if(max < b[i]){
      ruiseki += b[i];
      ans += 1;
      if(ruiseki >= h){
        break;
      }
    }else{
      break;
    }
  }
  if(ruiseki < h){
    s = h-ruiseki;
    if(s%max == 0){
      ans += s/max;
    }else{
      ans += s/max + 1;
    }
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 1276
//
//  main.cpp
//  AT
//
//  Created by 黄道煜 on 2018/8/11.
//  Copyright © 2018年 黄道煜. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#define LL long long
using namespace std;

LL n, m, a[100005], b[100005], ans;

map<LL, int> mp;

int main()
{
    scanf("%lld%lld", &n, &m);
    for(int i=1; i<=n; i++)
    {
        scanf("%lld", &a[i]);
        a[i]+=a[i-1];
        mp[a[i]%m]++;
        b[i]=a[i]%m;
    }
    sort(b+1, b+n+1);
    n=unique(b+1, b+n+1)-b-1;
    for(int i=1; i<=n; i++)
    {
        LL temp=mp[b[i]];
        if(b[i]==0) ans+=temp*(temp+1)/2;
        else ans+=temp*(temp-1)/2;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  
  for (int i = 0; i < N; i++){
    cin >> vec.at(i) ;
  }
  
   int a = 1;
   int x = 0;
    
  for (int j = 0; j < N; j++){
    
    a = vec.at(a - 1);
    
    x += 1;
    
    if (a == 2){
      cout << x << endl;
      break;
    }
    
    else if (a != 2 && j == N - 1){
      cout << -1 << endl;
    }
  }
}
 

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

int64_t gcd(int64_t a, int64_t b){
    return b==0 ? a : gcd(b, a%b);
}
int64_t lcm(int64_t a, int64_t b){
    return a*b / gcd(a, b);
}

int main(){
    int64_t i, j, k;
    int64_t N, M;
    string S, T;
    cin >> N >> M >> S >> T;
    int64_t L = lcm(N, M);
    int64_t l = lcm(L/N, L/M);
    for(i=0; i<L; i+=l){
        if(S[i / (L/N)] != T[i / (L/M)]){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << L << endl;
    return 0;
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	int n,m;
	cin>>n>>m;
	int c[100] = {};
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		c[a]++;
		c[b]++;
	}
	rep(i,n){
		cout << c[i]<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<ctime>

using namespace std;

const int MAXN=3010;
const int Mod=1e9+7;
int f[MAXN][MAXN][2];

int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for (int i=0;i<=n;i++)
	{
		f[0][i][0]=1;
	}
	for (int i=1;i<=m;i++)
	{
		for (int j=0;j<=n;j++)
		{
			int k=n-j;
			if (j)
			{
				f[i][j][1]+=f[i-1][j][1];
				f[i][j][1]%=Mod;
				f[i][j][1]+=f[i-1][j-1][1];
				f[i][j][1]%=Mod;
				if (j==1)
				{
					f[i][j][1]+=f[i-1][j][0];
					f[i][j][1]%=Mod;
					f[i][j][1]+=f[i-1][j-1][0];
					f[i][j][1]%=Mod;
				}	
				else
				{
					f[i][j][0]+=f[i-1][j][0];
					f[i][j][0]%=Mod;
					f[i][j][0]+=f[i-1][j-1][0];
					f[i][j][0]%=Mod;
				}
			}
			if (k)
			{
				f[i][j][1]+=f[i-1][j][1];
				f[i][j][1]%=Mod;
				f[i][j][1]+=f[i-1][j+1][1];
				f[i][j][1]%=Mod;
				if (j==0)
				{
					f[i][j][1]+=f[i-1][j][0];
					f[i][j][1]%=Mod;
					f[i][j][1]+=f[i-1][j+1][0];
					f[i][j][1]%=Mod;
				}
				else
				{
					f[i][j][0]+=f[i-1][j][0];
					f[i][j][0]%=Mod;
					f[i][j][0]+=f[i-1][j+1][0];
					f[i][j][0]%=Mod;
				}
			}
		}
	}
	int ans=0;
	for (int i=0;i<=n;i++)
	{
		ans+=f[m][i][1];
		if (ans>Mod)
		{
			ans-=Mod;
		}
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 70784
import java.util.Scanner;

public class Main {
	
	static int digit(int n) {
		if(1<=n && n<=9) return n;
		else {
			int a = n%10;
			n /= 10;
			return a + digit(n);
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in);
		int sum =0;
		int n = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		for(int i=1 ; i<=n ; i++) {
			if(A<=digit(i) && digit(i)<=B) sum+=i;
		}
		
		System.out.printf("%d\n",sum);
	}
}


Measured memory_bytes: 20820
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
//cout << fixed << setprecision(0)

int main() { 
  int n,a,x;cin>>n>>a>>x;
  if(x>=n&&n+a>=x){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ok cout << "ok" << endl;
#define sp << " " <<
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class BTaxRate {
public:
	void solve(std::istream& in, std::ostream& out) {
        double n;
        in >> n;
        double x = ceil(n / 1.08);

        if(floor(x * 1.08) == n) out << x << endl;
        else out << ":(" << endl;
	}
};


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


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn trace(s: &Vec<u16>) {
    for (k, x) in s.iter().enumerate() {
        if k > 0 {
            print!(" ");
        }
        print!("{}", x);
    }
    println!("");
}
fn main() {
    let n: usize = read();
    let mut sequence: Vec<u16> = (0..n).map(|_| read()).collect();

    trace(&sequence);

    for i in 1..n {
        let v = sequence[i];
        let mut j = i;
        while j >= 1 && sequence[j - 1] > v {
            sequence[j] = sequence[j - 1];
            j -= 1;
        }
        sequence[j] = v;
        trace(&sequence);
    }

    //Flattens a slice of T into a single value Self::Output, placing a given separator between each.
    //println!("{}", sequence.iter().map(|v| v.to_string()).collect::<Vec<_>>().join(" "));
}



Measured memory_bytes: 5036
#include <bits/stdc++.h>
#define MAX 3010
using namespace std;

int arr[MAX];

int main(void)
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> arr[i];
	int ans = 0;
	sort(arr, arr + N);
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N - 1; j++)
		{
			if (arr[N - 1] < arr[i] + arr[j])
			{
				ans += N - 1 - j;
				continue;
			}
			if (arr[j + 1] >= arr[i] + arr[j]) continue;
			int lo = j + 1;
			int hi = N;
			while (lo + 1 < hi)
			{
				int mid = (lo + hi) / 2;
				if (arr[mid] < arr[i] + arr[j]) lo = mid;
				else hi = mid;
			}
			ans += lo - j;
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int ans = 3;
	if(a==b)ans--;
	if(c==b)ans--;
	if(a==c)ans--;
	if(ans==0)ans=1;
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
S = input()
i = 0
while len(S) > 0:
  if S[-5:] in ['dream', 'erase']:
    S = S[:-5]
  elif S[-6:] == 'eraser':
    S = S[:-6]
  elif S[-7:] == 'dreamer':
    S = S[:-7]
  else:
    print('NO')
    exit()
print('YES')

Measured memory_bytes: 3276
#include<iostream>
using namespace std;
int N,K;
int A[2<<17];
main()
{
	cin>>N>>K;
	for(int i=0;i<K;i++)cin>>A[i];
	for(int i=K;i<N;i++)
	{
		cin>>A[i];
		cout<<(A[i-K]<A[i]?"Yes":"No")<<endl;
	}
}


Measured memory_bytes: 4412
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

int main(){
	string s;
	cin>>s;
	int len=s.length();
	if(s[len-1]=='s') s+="es";
	else s+="s";
	cout<<s<<'\n';
	
	
	return 0;
}

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

int main() {
  // Input
  int N;
  cin >> N;
  
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
  // Compute
  int cnt = 0;
  int min_j;
  for (int i = 0; i < N; i++) {
    min_j = i;
    for (int j = i; j < N; j++) {
      if (A.at(min_j) > A.at(j)) {
        min_j = j;
      }
    }
    int temp = A.at(i);
    A.at(i) = A.at(min_j);
    A.at(min_j) = temp;
    if (min_j != i) {
      cnt++;
    }
  }
  
  // Output
  for (int i = 0; i < N; i++) {
    if (i != 0) {
      cout << " ";
    }
    cout << A.at(i);
  }
  cout << endl;
  cout << cnt << endl;
}


Measured memory_bytes: 3120
import sys
input = sys.stdin.readline

n,money=map(int,input().split())
for x in range(n+1):
    for y in range(n+1):
        z=n-x-y
        if z<0:
            continue
        value=x*10000+y*5000+z*1000
        if value==money:
            print(x,y,z)
            sys.exit()
print(-1,-1,-1)

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

int main() {
  double n, m, d;
  cin >> n >> m >> d;
  cout << fixed << setprecision(6) << (m - 1) * (d ? 2.0 * (n - d) / (n * n) : 1.0 / n) << endl;
}


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

typedef long long ll;
typedef long double ld;

int niz[200005];

const int INF = 1000000000;

struct segment{
    int mn, mx;
} seg[1000005];

void init(int node, int l, int r){
    if(l == r){
        seg[node].mn = seg[node].mx = niz[l];
        return;
    }
    int mid = (l+r)/2;
    init(node*2, l, mid);
    init(node*2+1, mid+1, r);
    seg[node].mn = min(seg[node*2].mn, seg[node*2+1].mn);
    seg[node].mx = max(seg[node*2].mx, seg[node*2+1].mx);
}

int querymin(int node, int l, int r, int tl, int tr){
    if(l > tr || tl > r) return INF;
    if(tl <= l && r <= tr) return seg[node].mn;
    int mid = (l+r)/2;
    return min(querymin(node*2, l, mid, tl, tr), querymin(node*2+1, mid+1, r, tl, tr));
}

int querymax(int node, int l, int r, int tl, int tr){
    if(l > tr || tl > r) return -INF;
    if(tl <= l && r <= tr) return seg[node].mx;
    int mid = (l+r)/2;
    return max(querymax(node*2, l, mid, tl, tr), querymax(node*2+1, mid+1, r, tl, tr));
}

bool sorted[200005];

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n, k;
    cin >> n >> k;
    for(int i=1; i<=n; i++){
        cin >> niz[i];
    }
    init(1, 1, n);
    int res = n-k+1;
    deque <int> q;
    for(int r=1; r<=k; r++){
        while(!q.empty() && niz[q.back()] > niz[r]) q.pop_back();
        q.push_back(r);
    }
    int ima = 0;
    if(q.size() == k){
        //cout << 1 << endl;
        sorted[1] = 1;
        ima = 1;
        res--;
    }
    for(int l=2; l+k-1<=n; l++){
        while(!q.empty() && niz[q.back()] > niz[l+k-1]) q.pop_back();
        q.push_back(l+k-1);
        while(!q.empty() && q.front() < l) q.pop_front();
        if(q.size() == k){
            //cout << l << " " << q.back() << " " << q.front() << endl;
            sorted[l] = 1;
            ima = 1;
            res--;
        }
    }
    for(int l=1; l+k<=n; l++){
        int r = l+k-1;
        //cout << querymin(1, 1, n, l+1, r) << endl;
        if(!sorted[l+1] && niz[l] < querymin(1, 1, n, l+1, r) && querymax(1, 1, n, l+1, r) < niz[r+1]) res--;
    }
    cout << res+ima;
    return 0;
}


Measured memory_bytes: 9728
#include<stdio.h>
int main(){
	int a, b;
	scanf("%d", &a);
	scanf("%d", &b);
	if(a<b){
		printf("a < b");
	} else if (a>b){
		printf("a > b");
	} else if (a==b){
		printf("a == b");
	}printf("\n");
	return 0;
}

Measured memory_bytes: 584
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		char[] cc = S.toCharArray();
		
		for(int i=0;i<S.length();i++) {
			int n = (cc[i]-65+N)%26;
			cc[i] = (char) (n+65);
		}
		String SS = new String(cc);
		System.out.println(SS);
	}
}

Measured memory_bytes: 22868
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <climits>
#include <ctime>

using namespace std;

const int len = 1000010;
long long n,k;
char s[len];

int main() {
	//freopen("test.in","r",stdin);
	//freopen("test.out","w",stdout);
	cin >> n >> k;
	long long sum = 0;
	for (int i=0;i<=n;i++) {
		if (i>k) break;
		 else {
		 	for (int j=0;j<=n;j++) {
		 		if (i+j>k) break;
		 		if (k-i-j>n) continue;
		 		 else sum++;
		 	}
		 }
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
use std::io;
use std::collections::HashMap;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();
    let vals: Vec<i32> = s.trim().split_whitespace()
                        .map(|e| e.parse().ok().unwrap()).collect();
    let mut hm: HashMap<i32, usize> = HashMap::new();
    for val in vals {
        let count = hm.entry(val).or_insert(0);
        *count += 1;
    }

    let is_ok = *hm.get(&5).unwrap() == 2 && *hm.get(&7).unwrap() == 1;
    println!("{}", if is_ok {"YES"} else {"NO"});
}


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

using namespace std;

long long int h;

long long int atk(long long int x) {
  if(x == 1) return 1;
  else return 2*atk(x/2) + 1;
}

int main() {
  cin >> h;
  cout << atk(h) << "\n";
}

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

int main() {
    int x, y;
    while(true){
        cin >> x >> y;
        if (x == 0 && y == 0) break;
        if (x <= y) cout << x << " " << y << endl;
        else cout << y << " " << x << endl;
    }
    return 0;
    
}

Measured memory_bytes: 3016
import java.io.IOException;
import java.math.BigInteger;

public class Main {
    private static StringBuilder builder = new StringBuilder();
    public static void main(String[] args) {
        for (int i = 0; i < 5; i++) {
            int x = readInt();
            if (x == 0) {
                System.out.print(i + 1);
                break;
            }
        }
    }

    private static void read() {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static int readInt() {
        read();
        return Integer.parseInt(builder.toString());
    }

    private static int readInt(int radix) {
        read();
        return Integer.parseInt(builder.toString(), radix);
    }

    private static long readLong() {
        read();
        return Long.parseLong(builder.toString());
    }

    private static long readLong(int radix) {
        read();
        return Long.parseLong(builder.toString(), radix);
    }

    private static BigInteger readBigInteger() {
        read();
        return new BigInteger(builder.toString());
    }

    private static BigInteger readBigInteger(int radix) {
        read();
        return new BigInteger(builder.toString(), radix);
    }

    private static void skipLine() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static void skip() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    }

}


Measured memory_bytes: 32364
import sys


N, K = map(int, input().split())
cnt_B = 0
cnt_W = 0
black = [[0] * (2 * K) for _ in range(2 * K)]
white = [[0] * (2 * K) for _ in range(2 * K)]
for s in sys.stdin.readlines():
    x, y, c = s.split()
    x = int(x); y = int(y)
    if c == 'B':
        black[x % (2 * K)][y % (2 * K)] += 1
        cnt_B += 1
    else:
        white[x % (2 * K)][y % (2 * K)] += 1
        cnt_W += 1

S_black = [[0] * (2 * K + 1) for _ in range(2 * K)]
S_white = [[0] * (2 * K + 1) for _ in range(2 * K)]
for i in range(2 * K):
    for j in range(2 * K):
        S_black[i][j + 1] = S_black[i][j] + black[i][j]
        S_white[i][j + 1] = S_white[i][j] + white[i][j]

ans = 0
for j in range(K):
    var_B, var_W = 0, 0
    for i in range(K):
        var_B += S_black[i][j + K] - S_black[i][j]
        var_W += S_white[i][j + K] - S_white[i][j]
        
        var_B += S_black[i + K][2 * K] - (S_black[i + K][j + K] - S_black[i + K][j])
        var_W += S_white[i + K][2 * K] - (S_white[i + K][j + K] - S_white[i + K][j])

    ans = max(ans, max(var_B + (cnt_W - var_W), var_W + (cnt_B - var_B)))
    for i in range(K):
        var_B += (S_black[i + K][j + K] - S_black[i + K][j]) - (S_black[i][j + K] - S_black[i][j])
        var_W += (S_white[i + K][j + K] - S_white[i + K][j]) - (S_white[i][j + K] - S_white[i][j])

        var_B -= S_black[i + K][2 * K] - (S_black[i + K][j + K] - S_black[i + K][j])
        var_B += S_black[i][2 * K] - (S_black[i][j + K] - S_black[i][j])
        var_W -= S_white[i + K][2 * K] - (S_white[i + K][j + K] - S_white[i + K][j])
        var_W += S_white[i][2 * K] - (S_white[i][j + K] - S_white[i][j])

        ans = max(ans, max(var_B + (cnt_W - var_W), var_W + (cnt_B - var_B)))

print(ans)


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

int main() {
  int n,m,s;
  char c;
  cin >> n >> m;
  string ans="";
  for(int i=0;i<n;i++) ans.push_back('x');
  for(int i=0;i<m;i++){
    cin >> s >> c;
    if(ans[s-1]=='x' || ans[s-1]==c) ans[s-1]=c;
    else{cout << -1 << endl; return 0;}
  }
  if(ans[0]=='x') ans[0]=(n==1?'0':'1');
  if(n>1 && ans[0]=='0'){cout << -1 << endl; return 0;}
  for(int i=0;i<n;i++){
    cout << (ans[i]=='x'?'0':ans[i]);
  }
  cout << endl;
}


Measured memory_bytes: 256
S = input()

L = []
cnt = 0
for i in S:
  if i == "A" or i == "C" or i == "G" or i == "T":
    cnt += 1
  else:
    L.append(cnt)
    cnt = 0

L.append(cnt)

if len(L) == 0:
	print(0)
else:
	print(max(L))

Measured memory_bytes: 3060
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int A = in.nextInt();
        int B = in.nextInt();
        if (1<=A && A<=9 && 1<=B && B<=9) {
            out.println(A*B);
        } else {
            out.println(-1);
        }

        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


Measured memory_bytes: 23252
matrixA = []
matrixB = []
n, m, l = map(int, input().split())

#matrixCの初期化(n行l列)
matrixC = [[0 for i in range (l)]for k in range (n)]

#matrixAの入力
for i in range (n): 
    matrixA.append(list(map(int, input().split())))
#matrixBの入力
for j in range (m): 
    matrixB.append(list(map(int, input().split())))

#matrixCの導出
for i in range (n):
    for j in range (m):
        for k in range (l):
            matrixC[i][k] += matrixA[i][j] * matrixB[j][k]

#matrixCの出力
for i in range (n):
    print(" ".join(map(str, matrixC[i])))



Measured memory_bytes: 6888
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] a = sc.next().toCharArray();
		char[] b = sc.next().toCharArray();
		char[] c = sc.next().toCharArray();
		int a_count = 0;
		int b_count = 0;
		int c_count = 0;
		char tern = 'a';
		while(true) {
			if(tern == 'a') {
				if(checkWin(a, a_count)){
					System.out.println('A');
					break;
				}
				tern = a[a_count];
				a_count++;
			}
			if(tern == 'b') {
				if(checkWin(b, b_count)){
					System.out.println('B');
					break;
				}
				tern = b[b_count];
				b_count++;
			}
			if(tern == 'c') {
				if(checkWin(c, c_count)){
					System.out.println('C');
					break;
				}
				tern = c[c_count];
				c_count++;
			}
		}

	}

	public static boolean checkWin(char[] ary,int count) {
		if(ary.length == count) return true;
		return false;
	}
}

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

int main() {
  int n;
  cin >> n;
  vector<ll>D(n);
  for(int i = 0;i < n;i++) cin >> D[i];
  sort(D.begin(),D.end());
  queue<ll> que;
  for(int i = 0;i < n;i++) que.push(D[i]);
  int m;
  cin >> m;
  vector<ll>T(m);
  for(int i = 0;i < n;i++) cin >> T[i];
  sort(T.begin(),T.end());
  int c = 0;
  while(!que.empty()){
    if(T[c] == que.front()) c++;
    que.pop();
    if(c == m){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}


Measured memory_bytes: 4992
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int n; cin >> n;
	int S[100001];
	for (int i = 0; i < n; i++)cin >> S[i];
	int q; cin >> q;

	int cnt = 0, T;
	for (int i = 0; i < q; i++) {
		cin >> T;
		if (*lower_bound(S, S + n, T) == T)cnt++;
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 1548
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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

	
	string A, B, C;
	cin >> A >> B >> C;

	char next = 'a';
	string kati;
	rep(i, 400) {
		if (next == 'a') {
			if (A.size() == 0) {
				kati = "A";
				break;
			}
			next = A[0];
			A.erase(0, 1);

		}
		if (next == 'b') {
			if (B.size() == 0) {
				kati = "B";
				break;
			}
			next = B[0];
			B.erase(0, 1);

		}
		if (next == 'c') {
			if (C.size() == 0) {
				kati = "C";
				break;
			}
			next = C[0];
			C.erase(0, 1);
		}
	}
	co(kati);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    double a, b, x;
    cin >> a >> b >> x;
    if (x <= a * a * b / 2) {
        cout << setprecision(10) << 90 - atan(2*x / (b * b * a)) / pi * 180 << '\n';
    }
    else {
        cout << setprecision(10) << 90 - atan(pow(a, 3) / (2 * a * a * b - 2 * x)) / pi * 180 << '\n';
    }
}


Measured memory_bytes: 384
index = {}
while True:
  try:
    word,page = input().split()
    page = int(page)
    index[word].append(page)
  except KeyError:
    index[word] = [page]
  except EOFError:
    break

for (key,value) in sorted(index.items()):
  print(key)
  value = list(map(str,sorted(value)))
  print(" ".join(value))

Measured memory_bytes: 7604
class Dice:
    def __init__(self, n1, n2, n3, n4, n5, n6):
        self.elements = [n1, n2, n3, n4, n5, n6]

    def rotateW(self):
        n5 = self.elements[0]
        n1 = self.elements[2]
        n3 = self.elements[5]
        n6 = self.elements[4]
        self.elements[4] = n5
        self.elements[0] = n1
        self.elements[2] = n3
        self.elements[5] = n6

    def rotateN(self):
        n2 = self.elements[0]
        n1 = self.elements[3]
        n4 = self.elements[5]
        n6 = self.elements[1]
        self.elements[1] = n2
        self.elements[0] = n1
        self.elements[3] = n4
        self.elements[5] = n6


    def rotateS(self):
        n4 = self.elements[0]
        n1 = self.elements[1]
        n2 = self.elements[5]
        n6 = self.elements[3]
        self.elements[3] = n4
        self.elements[0] = n1
        self.elements[1] = n2
        self.elements[5] = n6

    def rotateE(self):
        n3 = self.elements[0]
        n1 = self.elements[4]
        n5 = self.elements[5]
        n6 = self.elements[2]
        self.elements[2] = n3
        self.elements[0] = n1
        self.elements[4] = n5
        self.elements[5] = n6

elements = map(int, raw_input().split(" "))
dice = Dice(elements[0], elements[4], elements[2], elements[1], elements[3], elements[5])
rule = raw_input()

for i in rule:
    if i == "S": dice.rotateS()
    elif i == "W": dice.rotateW()
    elif i == "N": dice.rotateN()
    elif i == "E": dice.rotateE()

print(str(dice.elements[0]))

Measured memory_bytes: 6496
# frozen_string_literal: true

x = gets.to_i

x500 = x / 500
x-=x500*500
#x100 = x / 100
#x-=x100*100
#x50 = x / 50
#x-= x50*50
#x10 = x / 10
#x-= x10*10
x5 = x / 5
x-= x5*5
x1 = x

puts x500 * 1000 + x5 * 5


Measured memory_bytes: 1788
#include<iostream>
#include<deque>
#include<algorithm>

using namespace std;

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

    deque<long long> vec(N);
    for(auto &x:vec){
        cin>>x;
    }
    long long min=vec[0];

    for(long i=1;i<N;++i){
        min=__gcd(min,vec[i]);
    }


    cout<<min<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define ld long double
#define vi vector<vector<ll> >
using namespace std;
const int MOD=1000000007;
const int MOD2=15000007;
const ll MAX=9187201950435737471;
const int N=100005;
const ll INF=1e17;
const long double PI=acos(-1);



void solve(int T){
    string s;
    cin>>s;
    int n=s.size();
    if(s[n-1]=='s')cout<<s+"es"<<"\n";
    else cout<<s+'s'<<"\n";
}

int main() {
    fastio
    int T=1;
    //cin>>T;
    for(int i=1;i<=T;i++){
        solve(i);
        //if(i<T)cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3632
N=int(input())
S=str(input())
a=[]
Slist=list(S)
for i in range(0,N):
    slice=S[0:i]
    slice=S[i:N]
    S1list=list(S[0:i])
    S2list=list(S[i:N])
    set1=set(S1list)
    set2=set(S2list)
    match=list(set1 & set2)
    a.append(len(match))
print(max(a))


Measured memory_bytes: 3064
from math import gcd
from collections import Counter

n=int(input())
if n==1:
    print(0)
    exit()

def factorize(n):
    factor=[]
    for i in range(2,int(n**0.5)+1):
        while n%i==0:
            n=n//i
            factor.append(i)
    if n!=1:
        factor.append(n)
    return factor

count = Counter(factorize(n))
ans=0
for key in count:
    sum=0
    for i in range(1,100000):
        sum+=i
        if count[key] >= sum and count[key] < sum+i+1:
            ans+=i
            break
        else:
            continue
print(ans)


Measured memory_bytes: 9712
#include <stdio.h>
#include <iostream>

using namespace std;

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

struct data_t {
    int a;
    int b;
    int c;
};

enum enum_t {
    I, A, B, C,
};

data_t d[100005];

int max(int X, int Y) {
    return X > Y ? X : Y;
}

long memo[100005][4];

long dp(int cur, int n, enum_t e) {
    if (cur == n) return 0;

    if (memo[cur][e] != 0) {
        return memo[cur][e];
    }

    if (e == A) {
        long b = dp(cur + 1, n, B) + d[cur].b;
        long c = dp(cur + 1, n, C) + d[cur].c;
        memo[cur][e] = max(b, c);
    } else if (e == B) {
        long a = dp(cur + 1, n, A) + d[cur].a;
        long c = dp(cur + 1, n, C) + d[cur].c;
        memo[cur][e] = max(a, c);
    } else if (e == C) {
        long a = dp(cur + 1, n, A) + d[cur].a;
        long b = dp(cur + 1, n, B) + d[cur].b;
        memo[cur][e] = max(a, b);
    } else {
        long a = dp(cur + 1, n, A) + d[cur].a;
        long b = dp(cur + 1, n, B) + d[cur].b;
        long c = dp(cur + 1, n, C) + d[cur].c;
        memo[cur][e] = max(a, max(b, c));
    }

    return memo[cur][e];
}

int main() {
    int n; cin >> n;
    REP(0, i, n) {
        cin >> d[i].a;
        cin >> d[i].b;
        cin >> d[i].c;
    }

    REP(0, i, n) REP(0, j, 4) memo[i][j] = 0;

    cout << dp(0, n, I) << endl;

    return 0;
}


Measured memory_bytes: 10752
s=input()
t=input()
for i in range(len(s)-len(t),-1,-1):
    for j in range(len(t)):
        if s[i+j]!='?'and s[i+j]!=t[j]:
            break
    else:
        print((s[:i]+t+s[i+len(t):]).replace('?','a'))
        break
else:
    print('UNRESTORABLE')


Measured memory_bytes: 3064
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 1000000007 //10^9+7
//#define MOD 1
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
const int MAX = 1000;
 
ll table[MAX][MAX];
 
// テーブルを作る前処理
void COMinit() {
    table[0][0] = table[0][1] = 1;
    FOR(i, 1, MAX-1){
      FOR(j, 0, i+1){
        if(j==0) table[i][j] = 1;
        else if(j == i+1) table[i][j] = 1;
        else table[i][j] = table[i-1][j-1]+table[i-1][j];
      }
    }
}
 
// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return table[n-1][k];
}

void sosuu(ll n, vector<ll> &v){

  vector<ll> num(n, 0);

  FOR(i, 1, sqrt(n)){
    if(num[i]==0){
      FOR(j, 0, n/i){
        num[i+(j*i)] = 1;
      }
    }
  }
  REP(i, n){
    if(num[i]==0) v.push_back(i+1);
  }
}

ll SORT(int n, vector<pair<ll, ll>> &v, int start){
  sort(v.begin()+start, v.end());
  return v[n-1].first;
}

int ans = 0;

int main(void){
  
  string s, t;
  cin>>s>>t;

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

  cout<<"Yes"<<endl;
  return 0;

}

Measured memory_bytes: 3612
n = STDIN.gets.chomp.to_i

points = [[0.0, 0.0], [100.0, 0.0]]

n.times do |i|
  tmp_points = [points[0]]
  (1..(points.size-1)).each do |j|
    p1, p5 = points[j-1], points[j]
    p2 = [(2.0 * p1[0] + p5[0]) / 3.0, (2.0 * p1[1] + p5[1]) / 3.0]
    p4 = [(p1[0] + 2.0 * p5[0]) / 3.0, (p1[1] + 2.0 * p5[1]) / 3.0]
    base_r = Math.atan2(p5[1] - p1[1], p5[0] - p1[0]) * 180.0 / Math::PI
    p3_rad = (base_r + 60) * Math::PI / 180
    p3_distance = ((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2) ** 0.5
    p3 = [
      p2[0] + Math.cos(p3_rad) * p3_distance,
      p2[1] + Math.sin(p3_rad) * p3_distance,
    ]
    tmp_points.push(p2, p3, p4, p5)
  end
  points = tmp_points
end

points.each do |p|
  puts "%.8f %.8f" % p
end

Measured memory_bytes: 9404
#include <iostream>
#include<cstdio>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<cstring>

using namespace std;

int main()
{
	int n,m,x,y;
	int a[105],b[105];
	scanf("%d%d%d%d",&n,&m,&x,&y);
	int mx=-105,my=105;
	for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        mx=max(a[i],mx);
    }
    for(int i=0;i<m;i++)
    {
        scanf("%d",&b[i]);
        my=min(b[i],my);
    }
	if(my>mx && my<=y && my>x)
        printf("No War\n");
    else
        printf("War\n");





    return 0;
}


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

int main(){
    // あとで消す
    //std::ifstream in("cin3.txt");
    //std::cin.rdbuf(in.rdbuf());

    long N,K;
    cin >> N >> K ;
    std::vector<long> H(N);
    long hi;

    if(N<=K){
        cout << 0 << endl;
        return 0;
    }

    for(size_t i=0;i<N;i++){
        cin >> hi;
        H.at(i) = hi;
    }

    sort(H.begin(), H.end());

    long sum=0;

    for(size_t i=0;i<N-K;i++){
        sum+=H.at(i);
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 1792
def main():
	n = int(input())
	colors = input()
	r = 0
	for i in range(n):
		if colors[i] == "R":
			r += 1
		else:
			r -= 1

	if r > 0:
		print("Yes")
	else:
		print("No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#include<iostream>
#include <iomanip>
#include<cmath>

using namespace std;

#define deg_to_rad(deg) (((deg)/360)*2*M_PI)

int main(){
    int a,b,h,m;

    std::cout << std::setprecision(12); 

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

    double hd = 30*h+30*(m/60.0);
    double md = 360*(m/60.0);

    //cout << hd << "," << md << endl;

    double d = fabs(hd-md);

    cout << sqrt(a*a+b*b-2*a*b*cos(deg_to_rad(d))) << endl;

    return 0;
}

Measured memory_bytes: 3688
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
A,B,C,D=MI()
ans1=A*C
ans2=A*D
ans3=B*C
ans4=B*D
Max=max(ans1,ans2,ans3,ans4)
if A<=0<=B or C<=0<=D:
  Max=max(0,Max)
print(Max)

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

#include <vector>
#include <iostream>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define linf 9223372036854770000

using namespace std;

typedef long long ll;

/*
vector.push_back()
vector<int> hoge(3,-1); {-1,-1,-1}
vector<vector<int>> hogehoge(2,vector<int>(2,-1)); {{-1,-1},{-1,-1}} 
cin >>temp;
scanf("%d %d %d",&A,&B,&Q);
sort(a.begin(),a.end());
a.push_back(4000000000000);
a.insert(a.begin(),-1000000000000);
upper_bound(a.begin(),a.end(),x); // list[i] > x のイテレータ取得. *itrで数値化 
    std::priority_queue<
      int,
      std::vector<int>,
      decltype(compare) // 比較関数オブジェクトを指定
    > que(comp);
*/
template <typename T> void debug(T arr);
template <typename T> void debug (T arr, int dim);



int main(void){
    ll n,x;
    cin >> n >> x;
    long long small = linf;
    long long ans = 0;
    rep(i,n){
        long long m;
        cin >> m;
        if (small > m){
            small = m;
        }
        x-=m;
        ans += 1;
    }

    cout << ans + x/small << endl;
};


template <typename T> void debug(T arr){
    for (auto col:arr){
        cout << col << " ";
    }
    cout <<endl;
};

template <typename T> void debug (T arr, int dim){
    for (auto raw:arr){
        for(auto col:raw){
            cout << col << " ";
        }
        cout << endl;
    }
};


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

#define rep(i, n) for (int i=0; i<(n); ++i)
using ll = long long;
using P = pair<int, int>;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int ans = c - (a-b);
  if (ans < 0) {
    cout << 0 << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
    os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const int INF = INT32_MAX;

int main()
{
    int n, alph[26];
    fill(alph, alph+26, INF);
    vector<string> vstr;
    cin >> n;
    rep(i, n) {
        string str;
        cin >> str;
        vstr.push_back(str);
    }
    
    int num = 0;
    rep(i, n) {
        string str = vstr[i];
        rep(j, 26) {
            for (int k = 0, size = (int)str.size(); k < size; ++k) {
                if (str[k] == 'a'+j) ++num;
            }
            alph[j] = min(alph[j], num);
            num = 0;
        }
    }
    
    rep(i, 26) {
        if (alph[i] != 0) {
            cout << string(alph[i], 'a'+i);
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
  int i,j;
  int a,b,k;
  scanf("%d %d %d",&a,&b,&k);
  if(ceil(((float)b-a+1)/2)<=k)
    for(i=a;i<=b;i++)
      printf("%d\n",i);
  else{
    for(i=a;i<a+k;i++)
      printf("%d\n",i);
    for(i=k;i>0;i--){
      printf("%d\n",b-i+1);
    }
  }
  return 0;
}


Measured memory_bytes: 128