akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};


int main(){
  int A,B,C,D,E,F;
  cin>>A>>B>>C>>D>>E>>F;
  double maxi=-1.0;
  int maxw,maxs;
  for(int i=0;i*A*100<=F;i++){
    for(int j=0;j*B*100<=F-i*A*100;j++){
      if(i==0&&j==0) continue;
      int rest=F-(A*i+B*j)*100;
      for(int x=0;C*x<=rest&&(A*i+B*j)*E-C*x>=0;x++){
        int y=min(rest-C*x,(A*i+B*j)*E-C*x)/D;
        //cout<<(double)(C*x+D*y)/(A*i+B*j)<<endl;
        if(maxi<(double)(C*x+D*y)/(A*i+B*j)){
          maxi=(double)(C*x+D*y)/(A*i+B*j);
          maxw=(A*i+B*j)*100;
          maxs=C*x+D*y;
          //printf("%d %d %d %d => %d %d\n",i,j,x,y,maxw+maxs,maxs);
        }
      }
    }
  }

  printf("%d %d\n",maxw+maxs,maxs);

  return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

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

using namespace std;
using ll = long long;

int main() {
    ll A; cin >> A;
    ll B; cin >> B;
    ll C; cin >> C;
    ll K; cin >> K;

    ll ans = 0;

    if (K <= A) {
        ans = K;
    } else if ((A < K) && (K <= B)) {
        ans = A;
    } else {
        ans = A - (K - A - B);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define tc() ll T;cin>>T;while(T--)
#define pb push_back

struct cmp {
    bool operator() (const pair<ll,ll> &a,const pair<ll,ll> &b){
        return a.first>b.first;
    }
};

int main() {
    
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    /*-----------------Code Begins Here------------------*/
    
    ll n,d; cin>>n>>d;
    ll cnt = 0;
    for(ll i=0;i<n;i++){
        ll x,y; cin>>x>>y;
        if(x*x+y*y<=d*d) cnt++;
    }
    cout<<cnt;
    
    /*------------------Code Ends Here-------------------*/
    
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<cmath>
using namespace std;
 
int main(){
  int n,y;
  double b,r,t;
  int ans;
  double val,tmp;
 
  while(cin >> n, n){
    cin >> y;
    val = 0.0;
    for(int i=0;i<n;i++){
      cin >> b >> r >> t;
      if(t==1)tmp = 1+y*r/100;
      else tmp = pow(1+r/100,y);
      if(val<tmp){
    val = tmp;
    ans = b;
      }
    }
    cout << ans << endl;
  }
}

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

int check(int x, int y) {
  return (x == 0 && 0 < y) || (0 < x && y == 0);
}

int main() {
  string S;
  cin >> S;
  map<char, int> M;
  for (int i = 0; i < S.size(); i++) {
    M[S[i]]++;
  }
  if (check(M['N'], M['S']) || check(M['E'], M['W'])) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

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

using namespace std;

int main(void){
    int n;
    cin >> n;
    long long sum = 0;
    for(int i = 0; i <= n; i++){
        if(i % 3 == 0 || i % 5 == 0){

        }else{
            sum += i;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3636
import java.util.*;
import java.io.*;

public class Main {

    static StreamTokenizer in;

    static int nextInt() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }

    public static void main(String[] args) throws Exception {
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        int n = nextInt();
        int k = nextInt();

        int[] candies = new int[n];

        for (int i = 0; i < n; i++) {
            candies[i] = nextInt();
        }

        int[] dp = new int[k + 1];
        dp[0] = 1;

        for (int i = 0; i < n; i++) {
            int up_to = candies[i];
            int[] prefixArray = new int[k+1];
            for (int used = k; used >= 0; used--) {
                int temp = dp[used];
                int L = used + 1;
                int R = used + Math.min(up_to, k - used);

                if (L <= R) {
                    prefixArray[L] = add_self(prefixArray[L], temp);

                    if (R + 1 <= k) {
                        prefixArray[R + 1] = remove_self(prefixArray[R + 1], temp);
                    }
                }
            }

            int prefix = 0;
            for (int j = 0; j <= k; j++) {
                prefix = add_self(prefix, prefixArray[j]);
                dp[j] = add_self(dp[j], prefix);
            }
        }

        out.println(dp[k]);

        out.close();
    }

    static int mod = 1000000007;

    static int add_self(int a, int b) {
        a += b;
        if (a >= mod) a -= mod;

        return a;
    }
    static int remove_self(int a, int b) {
        a -= b;
        if (a < 0) a += mod;

        return a;
    }
}

Measured memory_bytes: 51088
N,M,L = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
B = [list(map(int,input().split())) for _ in range(M)]
C = [[0]*L for _ in range(N)]
for i in range(N):
    for j in range(L):
        num = 0
        for k in range(M):
            num += A[i][k] * B[k][j]
        C[i][j] = num
for l in range(N):
    print(*C[l])


Measured memory_bytes: 7052
N = int(input())

words = []
ans = "Yes"
for count in range(N):
    word = input()
    if count == 0:
        words.append(word)
        next = word[-1]
        continue
    if next != word[0]:
        ans = "No"
    if words.count(word) == 1:
        ans = "No"
    words.append(word)
    next = word[-1]


print(ans)

Measured memory_bytes: 9116
#include <iostream>
int main(){
    int n, x, t;
    std::cin >>n >>x >>t;
    int t_sum;

    if (n%x==0){
        t_sum= int(n/x)*t;
    }else{
        t_sum=int(n/x)*t+t;
    }
    std::cout <<t_sum<<std::endl;

    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int dp[30000];
int h,n;
int a[2000],b[2000];
int main(){
    scanf("%d%d",&h,&n);
    int maxa=0;
    for(int i=0;i<n;i++){
        scanf("%d%d",a+i,b+i);
        maxa=max(maxa,a[i]);
    }
    maxa=h+max(h,maxa);
    //cout<<maxa<<endl;
    memset(dp,0x3f,sizeof(dp));
    dp[maxa]=0;
    for(int i=0;i<n;i++){
        for(int j=maxa-a[i];j>=0;j--){
            dp[j]=min(dp[j+a[i]]+b[i],dp[j]);
        }
        //for(int j=maxa;j>=0;j--)cout<<dp[j]<<" ";
        //cout<<endl;
    }
    int ans=0x3f3f3f3f;
    for(int i=maxa-h;i>=0;i--){
        ans=min(ans,dp[i]);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  string s,t;
  cin>>s>>t;
  int c=0;
  if(s.at(0)==t.at(0))c++;
  if(s.at(1)==t.at(1))c++;
  if(s.at(2)==t.at(2))c++;
  cout<<c;
}
      



Measured memory_bytes: 256
import sys

N, Y = map(int, input().split())

for a in range(N+1):
    for b in range(N+1-a):
        c = N-a-b
        num = a*10000 + b*5000 + c*1000
        if num == Y:
            print("{} {} {}".format(a, b, c))
            find_ans = True
            sys.exit()

print('-1 -1 -1')

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

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

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

template<class T> std::ostream& operator <<(std::ostream& os, std::vector< std::vector<T> > vv)
{
  for (auto& vec : vv){ os << vec; }
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

int main()
{
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
  std::ios::sync_with_stdio(false);

  ll N;
  std::cin >> N;
  std::vector< ll > vp(N, 0LL);
  std::vector< ll > vq(N, 0LL);

  std::string P, Q, S;
  char ch;
  for (ll i = 0; i < N; i++) std::cin >> ch, P += ch;
  for (ll i = 0; i < N; i++) std::cin >> ch, Q += ch;

  S = P;
  std::sort(S.begin(), S.end(), std::less<>());

  ll cnt = 0LL;
  ll a = 0LL;
  ll b = 0LL;
  do {
    cnt++;
    if (S == P) a = cnt;
    if (S == Q) b = cnt;
  } while (std::next_permutation(S.begin(), S.end()));

  print(std::abs(a-b));
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int R, G, B, N;
    cin >> R >> G >> B >> N;

    int ans = 0;
    for (int delim1 = 0; delim1 <= N; delim1++)
    {
        for (int delim2 = delim1; delim2 <= N; delim2++)
        {
            if (delim1 % R == 0 && (delim2 - delim1) % G == 0 && (N - delim2) % B == 0)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        BigInteger n = sc.nextBigInteger();
        String s = String.valueOf(n);
        int sum =0;
        for(char c:s.toCharArray())
            sum += Integer.parseInt(String.valueOf(c));
        if(sum%9==0)
         	System.out.println("Yes");
         else
         	System.out.println("No");
  	}
}



Measured memory_bytes: 64260
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;


int main(){
  for(;;){
  int n;
  cin >> n;
  if(n==0) break;
  vector<int> k(n);
  for(int i=0;i<n;++i) cin >> k[i];
  
  sort(k.begin(),k.end(),greater<int>());

  int flag=0,flag2=0;
  int cnt=0;
  for(int i=0;i<n;++i){
    if(k[i]>=2) cnt++;
    else if(k[i]<=1){
      cnt += k[i];
      flag2++;
      if(k[i]==0) flag++;
    }
  }
  if(flag2==n) cout << "NA" << endl;
  else if(flag == n-1) cout << "2" << endl;
  else cout << cnt+1 << endl;
 }

  
  return 0;
}



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

int main()
{
    int n;
    std::string s;
    std::cin >> n;
    std::cin >> s;
    int max = 0;
    for(int i = 0; i < n; i++){
        int cnt = 0;
        std::map<char,int> a,b;
        for(int j = 0; j < i; j++ )a[s[j]]++;
        for(int j = i; j < n; j++ )b[s[j]]++;
        for(auto i : a){
            if(b[i.first])cnt++;
        }
        max = std::max(cnt,max);
    }
    std::cout << max << std::endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc139/tasks/abc139_f
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        n: usize,
        engines: [(i64, i64); n]
    };

    let mut engines = engines.into_iter().map(|e| {
        let x = e.0 as f64;
        let y = e.1 as f64;
        (e.0, e.1, (y.atan2(x) * 1e9) as i64)
    }).collect::<Vec<_>>();

    engines.sort_by_key(|e| e.2);

    let mut best = (0, 0, 0);
    for i in 0..n {
        let mut now = (0, 0, 0);
        for j in 0..n {
            let id = (i+j)%n;
            now.1 += engines[id].0;
            now.2 += engines[id].1;
            now.0 = now.1*now.1+now.2*now.2;
            best = max(best, now);
        }
    }

    println!("{:.12}", (best.0 as f64).sqrt());
}


Measured memory_bytes: 4476
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
using namespace std;

long long gcd(long long m, long long n){
    if(m < n){
        return gcd(n, m);
    } else if(n == 0){
        return m;
    } 
    return gcd(n, m % n);
}

long long A[100000];

int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    long long ans = gcd(A[0], A[1]);
    for(int i = 2; i < N; i++){
        ans = gcd(ans, A[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <string>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i, a, b, d) for (int i = a; i <= b; i += d)
#define brep(i, a, b, d) for (int i = a; i >= b; i -= d)
#define pb push_back
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define endl '\n'
const int MAX = 1e5 + 5;
const int MOD = 1e9 + 7;
////////////////////////////////

int dp[MAX];
int h[MAX];

int32_t main(){
    fastio
    int n; cin >> n;
    rep(i,1,n,1) cin >> h[i];
    
    dp[2] = abs(h[1] - h[2]);
    rep(i,3,n,1){
        dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i] - h[i-2]));
    }
    cout << dp[n];
    return 0;
}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s; 
    if(s == "SUN") cout << 7 << endl;
    if(s == "SAT") cout << 1 << endl;
    if(s == "MON") cout << 6 << endl;
    if(s == "TUE") cout << 5 << endl;
    if(s == "WED") cout << 4 << endl;
    if(s == "THU") cout << 3 << endl;
    if(s == "FRI") cout << 2 << endl;
    
}

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

int main(){
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  string ans = "";
  for(int i = 0;i < n;i++) {
	ans.push_back(s[i]);
    ans.push_back(t[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stack>
#include<map>
#include<set>
#include<cstdio>
#include<vector>
#include<iostream>
#include<string>
#include<algorithm> 
using namespace std;
int main(){
	string s;
	cin>>s;
	int a=0,b=0,c=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='a'){
			a++;
		}
		if(s[i]=='b'){
			b++;
		}
		if(s[i]=='c'){
			c++;
		}
	}
	if(a==1
	&& b==1
	&& c==1){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

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

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a*b, c*d) << endl;
} 






Measured memory_bytes: 256
n, a, b = map(int, input().split(" "))
ans = 0
if (b - a)%2 == 1:
    if a == 1:
        ans = 1 + (b-1-a)//2
    elif b == n:
        ans = 1 + (b-a-1)//2
    else:
        if a <= n-b:
            ans = a + (b-a-1)//2
        else:
            ans = n-b + 1 + (b-1-a)//2

else:
    ans = (b-a)//2

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";}
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 1e9+7;

vector<ll> fact,ifact,inv,pow2;
ll add(ll a,ll b)
{
	a%=MOD; b%=MOD;
	a+=b;a%=MOD;
	if(a<0) a+=MOD;
	return a;
}
ll mult(ll a, ll b)
{
	a%=MOD; b%=MOD;
	ll ans=(a*b)%MOD;
	if(ans<0) ans+=MOD;
	return ans;
}
ll pw(ll a, ll b)
{
	ll r=1;
	while(b){
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}
ll inverse(ll a)
{
	return pw(a,MOD-2);
}
ll choose(ll a, ll b)
{
	if(a<b) return 0;
	if(b==0) return 1;
	if(a==b) return 1;
	return mult(fact[a],mult(ifact[b],ifact[a-b]));
}
ll perm(ll a, ll b){
	if(a<b) return 0;
	if(b==0) return 1;
	return mult(fact[a],ifact[a-b]);
}
void init(ll _n)
{
	fact.clear(); ifact.clear(); inv.clear(); pow2.clear();
	fact.resize(_n+1); ifact.resize(_n+1); inv.resize(_n+1); pow2.resize(_n+1);
	pow2[0]=1; ifact[0]=1; fact[0]=1;
	for(int i=1;i<=_n;i++){
		pow2[i]=add(pow2[i-1],pow2[i-1]);
		fact[i]=mult(fact[i-1],i);
	}
	ifact[_n] = inverse(fact[_n]);
	for(int i=_n-1;i>=1;i--){
	    ifact[i] = mult(ifact[i+1], i+1);
	}
	for(int i=1;i<=_n;i++){
	    inv[i] = mult(fact[i-1], ifact[i]);
	}
}

bool DEBUG=0;
const int MAXN = 500005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	ll n,m; cin>>n>>m;
	init(MAXN);
	
	ll a=perm(m,n);
	ll b=a; //watch(b);
	for(ll i=1;i<=n;i++){
		b=add(b, mult((i&1?-1:1)*choose(n,i), perm(m-i,n-i)));
		//watch(b);
	}
	
	cout<<mult(a,b)<<'\n';
	
	return 0;
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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 GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n;
  cin>>n;
  vi s(n);
  rep(i,n) cin>>s[i];
  int d=101;
  int ans=0;
  rep(i,n){
    ans+=s[i];
    if(s[i]%10!=0)chmin(d,s[i]);
  }
  if(ans%10==0) if(d!=101){
    ans-=d;
  }
  if(ans%10!=0)cout<<ans<<endl;
  else cout<<0<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
bool get(int t)
{
	printf("%d\n", t);
	fflush(stdout);
	string s;
	cin >> s;
	if (s[0] == 'V')exit(0);
	return s[0] == 'F';
}
int main()
{
	int num;
	scanf("%d", &num);
	bool a = get(0);
	bool b = a;
	int beg = 1, end = num - 1;
	for (;;)
	{
		if (beg >= end)get(beg), get(end);
		int med = (beg + end) / 2;
		bool t = get(med);
		if (((med - beg) % 2 == 0) != (a != t))end = med - 1, b = t;
		else beg = med + 1, a = t;
	}
}

Measured memory_bytes: 852
from sys import stdin
from collections import deque
def main():
  _map, _readline, _int = map, stdin.readline, int
  n, q = _map(_int, _readline()[:-1].split())
  values = [0] * n
  links = [[] for _ in range(n)]
  for _ in range(n - 1):
    a, b = _map(_int, _readline()[:-1].split())
    links[a - 1].append(b - 1)
    links[b - 1].append(a - 1)
  for _ in range(q):
    p, x = _map(_int, _readline()[:-1].split())
    values[p - 1] += x
  d = deque()
  d.append((0, -1))
  while len(d) != 0:
    i, p = d.popleft()
    for j in links[i]:
      if j == p:
        continue
      values[j] += values[i]
      d.append((j, i))
  print(*values)
main()

Measured memory_bytes: 62132
/**
 * Title: D - Binomial Coefficients
 * Url: https://atcoder.jp/contests/abc094/tasks/arc095_b
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
    int n; cin >> n;
    vector<ll> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    sort(a.begin(), a.end(), std::greater<ll>());
    ll k = ceil(a[0]/2.0);
    ll target = 0;
    ll sa = 1000000000;
    for(int i=1; i<n; i++) {
        if(sa>abs(a[i]-k)) {
            sa = abs(a[i]-k);
            target = i;
        }
    }
    cout << a[0] << " " << a[target] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define dunk(a) cout << (a) << endl
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;

int main() {
	int n; cin >> n;
	vector<pair<double, double>> xy(n);
	rep(i, n) cin >> xy[i].first >> xy[i].second;

	double div = 1.0;
	rep(i, n) div *= (i + 1);

	double num = 0;

	vector<int> vec(n);
	rep(i, n) vec[i] = i;
	do {
		rep(i, n - 1) num += sqrt(pow(xy[vec[i]].first - xy[vec[i + 1]].first, 2.0)
			+ pow(xy[vec[i]].second - xy[vec[i + 1]].second, 2.0));
	} while (next_permutation(all(vec)));

	double ans = num / div;
	cout << fixed << setprecision(10) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
struct data {
	int x, y;
};
data a[5];
bool cmp(const data &m, const data &n) {
	
	return m.y < n.y;
}
int main() {
	int t = 0;
	for (int i = 0; i < 5; i++) {
		scanf("%d", &a[i].x);
		t += a[i].x;
		a[i].y = a[i].x % 10;
		if (a[i].y != 0) {
			t += 10 - a[i].y;
		}
	}
	sort(a, a + 5, cmp);
	int j;
	for (j = 0; j < 5 && a[j].y == 0; j++) {
	}
	if (j < 5) {
		t -= 10 - a[j].y;
	}
	printf("%d\n", t);
	return 0;
}

Measured memory_bytes: 128
n = int(input())
a = list(map(int,input().strip().split()))[:n]
flag = True
for i in range(0,n):
    if a[i]% 2 == 0:
        if a[i]% 3 != 0 and a[i]% 5 != 0:
            flag = False
if  flag==True:
    print("APPROVED")
else :
    print("DENIED")

Measured memory_bytes: 9180
package main

import "fmt"

func main() {
	var (
		N, K int
		ans  float64
	)
	fmt.Scan(&N, &K)

	for i := 1; i <= N; i++ {
		rate := 1 / float64(N)
		point := i
		for point < K {
			point *= 2
			rate /= 2
		}
		ans += rate
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;
struct edge { ll from; ll to; ll cost; };


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

	if (a*c <= b)cout << c << endl;
	else cout << b / a << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {    
    int n;
    cin >> n;
    vector<ll>a(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i);
    }
    ll ans =0;
    for(int i=0;i<n;i++){
        if(i%2==0&&a.at(i)%2==1)ans++;
    }
    cout<<ans<<endl;
}
    



Measured memory_bytes: 3532
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a > 9 ){
			System.out.print(-1);
		}
		else if(b > 9){
			System.out.print(-1);
		}else
		    System.out.print(a*b);
		

	}

}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 100001
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define REP(i, n) for(int i=0; i<n; i++)
#define RER(i, n) for(int i=n-1; i>=0; i--)
#define ALL(v) v.begin() v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int n;
stack<char> st;

signed main(){
    string s; cin >> s;
    int ret = 0;
    FOR(i, 0, s.size()){
        if(st.empty()) st.push(s[i]);
        else if(st.top() != s[i]){
            // 見ている要素とマッチングした場合
            ret += 2;
            st.pop();
        }else{
            // マッチングしなかった場合
            st.push(s[i]);
        }
    }
    // REP(i, s.size()) cout << c[i] << " ";
    // cout << endl;
    cout << ret << endl;
    // while(!st.empty()){
    //     cout << st.top() << " ";
    //     st.pop();
    // }
    // cout << endl;
    return 0;
}

Measured memory_bytes: 512
# include <iostream>
using namespace std ;
int main () {
int A , B ; cin >> A >> B ;
int ans ;
if ( A > B ) {
ans = A + (A -1);
}
else if (B > A ) {
ans = B + (B -1);
}
else {
ans = A + B ;
}
cout << ans << endl ;
}


Measured memory_bytes: 256
N =int(input())
list = input().rstrip().split()


flg = True
for i in range(N):
    if int(list[i])%2 == 1:
        flg = False
count = 0
while flg:
    x = 0
    for x in range(N):
        if int(list[x])%2 == 1:
            flg = False
            break
        else:
            list[x] = str(int(list[x])//2)
    if flg:
        count +=1
print(count)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
 
typedef long long ll;
 
int main() {
    ll N, ans = 1e18;
    cin >> N;
    for (ll i = 1; i * i <= N; i++) {
        ll r = N % i;
        if (r == 0) {
            ll s = N / i + i - 2;
            if (s < ans) {
                ans = s;
                //cout << i << " " << ans << endl;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import Counter
N, K = list(map(int,input().split()))
listA = Counter(input().split())
# print(listA)
listA = list(listA.values())
listA.sort()
times = len(listA) - K

num = 0

if times <= 0:
    num = 0
else:
    for i in range(times):
        num += listA[i]

print(num)




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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N; cin >> N;
    vi a(N); REP(i, N) cin >> a[i], a[i]--;
    vb pushed(N, false);
    int x = 0;
    int ans = 0;
    while(true)
    {
        if(pushed[x] == true)
        {
            cout << -1 << endl;
            return 0;
        }
        pushed[x] = true;
        ans++;
        x = a[x];
        if(x == 1)
        {
            cout << ans << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3712
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

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

int w;
char S[1234];

int main() {

	scanf("%s%d", S, &w);

	int l = strlen(S);

	rep(i, l) {
		if (!(i % w)) printf("%c", S[i]);
	}

	printf("\n");

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
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 dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int a,b,c;
    cin >> a >> b >> c;
    int ans = 0;
    for(int i=a;i<=b;i++){
        if(i%c==0)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3540
#include <iostream>

using namespace std;

int main()
{
    long long n,m,x,s=0,dif;
    cin>>m>>n;
    for(int i=1;i<=n;i++){
        cin>>x;
        s=s+x;
    }
    dif=m-s;
    if(dif>=0){
        cout<<dif;
    }
    else{
        cout<<"-1";
    }

    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int a, s;
	cin >> a >> s;

	string line(s + 2, '#');
	cout << line << endl;
	for (int i = 0; i < a; ++i)
	{
		cout << "#";

		string str;
		cin >> str;
		cout << str;

		cout << "#\n";
	}
	cout << line << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int M;
cin >> M;
cout << 48-M << endl;
return 0;
}


Measured memory_bytes: 256
fun main(args : Array<String>) {
    var n = readLine()!!.toLong()
    var ans = ""

    while (n > 0) {
        val pos = if (n % 26 == 0L) 25 else (n % 26)-1
        val dis = if (n % 26 == 0L) 1L else 0L
        ans = "${(97+pos).toChar()}$ans"
        n /= 26L
        n -= dis
    }

    println(ans)
}

Measured memory_bytes: 34460
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String readValue;
    while ((readValue = reader.readLine()) != null) {
      int h = Integer.parseInt(readValue.split(" ")[0]);
      int w = Integer.parseInt(readValue.split(" ")[1]);
      if (h == 0 && w == 0)
        break;
      for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
          System.out.print("#");
        }
        System.out.println();
      }
      System.out.println();
    }
  }

}

Measured memory_bytes: 25924
#include <stdio.h>

int main()
{
  int nn, aa[15], xx[15][14], yy[15][14], flag, count, ans = 0;
  scanf("%d", &nn);
  for(int ii = 0;ii < nn;ii++)
  {
    scanf("%d", &aa[ii]);
    {
      for(int jj = 0;jj < aa[ii];jj++)
      {
        scanf("%d %d", &xx[ii][jj], &yy[ii][jj]);
      }
    }
  }
  
  for(int bit = 1;bit < (1 << nn);bit++)	//正直者の組み合わせ	2進数各桁について1で正直、0で不親切
  {
    flag = 1;
    count = 0;
    for(int ii = 0;ii < nn && flag;ii++)
    {
      if(bit & (1 << ii))
      {
        count++;
        for(int jj = 0;jj < aa[ii] && flag;jj++)
        {
          if((bit & (1 << (xx[ii][jj] - 1))) != (yy[ii][jj] << (xx[ii][jj] - 1)))
          {
            flag = 0;
          }
        }
      }
    }
    
    if(flag && ans < count)
    {
      ans = count;
    }
  }
  
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    bool ans=true;
    for(int i=0;i<3;i++){
        if(s[i]==s[i+1])ans=false;
    }
    cout << ((ans==true)?"Good":"Bad")<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int isprime(int);
int main()
{
  int g,n,count=0,i;
  int array[10000];

  scanf("%d",&g);
  for(i=0;i<g;i++){
    scanf("%d",&array[i]);
  }
  for(i=0;i<g;i++){
  count+=isprime(array[i]);
  }
  printf("%d\n",count);
  return 0;
}

int isprime(int x)
{
  int i;
  if(x==2)
    return 1;
  if(x<2||x%2==0)
    return 0;
  i=3;
  while(i<=sqrt(x)){
    if(x%i==0) return 0;
    i=i+2;
  }

  return 1;
}

Measured memory_bytes: 632
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
INF=10**9
dp=[INF]*(2**n)
dp[0]=0
cost=[INF]*(2**n)
for i in range(m):
    a,b=map(int,input().split())
    c_list=list(map(int,input().split()))
    c=0
    for j in c_list:
        c+=2**(j-1)
    cost[c]=min(cost[c],a)
import itertools
ns=list(range(n))
for i in range(n):
    com=list(itertools.combinations(ns,i))
    for j in com:
        c=0
        for k in j:
            c+=2**k
        if not dp[c]==INF:
            for k in range(2**n):
                if not cost[k]==INF:
                    dp[c|k]=min(dp[c|k],dp[c]+cost[k])
if dp[2**n-1]==INF:
    print(-1)
else:
    print(dp[2**n-1])
    




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

using namespace std;


int main(){

    int a , b;
    cin >> a >> b;

    if (a == b) cout << "Draw\n";

    else if(a == 1 ) cout << "Alice\n";

    else if(b == 1 ) cout << "Bob\n";
    else if(a > b) cout << "Alice\n";
    else cout << "Bob\n";

    return 0;
}

Measured memory_bytes: 256
package main

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

var nextString func() string

func init() {
	nextString = newReadString(os.Stdin)
}

func main() {
	s := nextString()

	cnt := len(s)
	cnt = calc(cnt, s, 'A')

	s = reversed(s)
	cnt = calc(cnt, s, 'Z')
	fmt.Println(cnt)
}

func reversed(s string) string {
	r := make([]rune, len(s))
	j := 0
	for i := len(s) - 1; i >= 0; i-- {
		r[j] = rune(s[i])
		j++
	}
	return string(r)
}

func calc(cnt int, s string, c rune) int {
	for i := 0; rune(s[i]) != c && cnt >= 0; i++ {
		cnt--
	}
	return cnt
}

func nextInt() (result int) {
	result, _ = strconv.Atoi(nextString())
	return
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
		}
		return r.Text()
	}
}


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

int main() {
  int n;
  long int sum = 0;
  
  cin >> n;
  for(int i = 1; i <= n; i++){
    if(i % 15 == 0){
      ;
    }else if(i % 3 == 0){
      ;
    }else if(i % 5 == 0){
      ;
    }else{
      sum += i;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pi;
 
 
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
 
const int MOD = 1000000007;
const ll INF = 1e18;
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,m;
	cin >> n >> m;
	if (n==m)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
}	

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <limits>
using namespace std;
typedef long long ll;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define FOREACH(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))

template <class T> struct RangeAddFenwickTree {

   vector<T> node1, node2;
   RangeAddFenwickTree (int n) : node1(n,0), node2(n,0) {}

    void add(int l, int r, T val) {
      for (int i = l; i <= node1.size(); i += i & -i) {
         node1[i] += -l * val;
         node2[i] += val;
      }
      for (int i = r; i <= node1.size(); i += i & -i) {
         node1[i] += r * val;
         node2[i] += -val;
      }
   }

   T sum(int idx) {
      T sum1 = 0, sum2 = 0;
      for (int i = idx; i > 0; i &= (i - 1)) {
         sum1 += node1[i];
         sum2 += node2[i] * idx;
      }
      return sum1 + sum2;
   }

};

int main() {

  int n,q; cin >> n >> q;

  RangeAddFenwickTree<ll> inst(100010);
  REP(i,q) {
    ll com,s,t,x;
    cin >> com;
    if(com == 0) {
      cin >> s >> t >> x;
      inst.add(s,t+1,x);
    } else {
      cin >> s >> t;
      cout << inst.sum(t+1) - inst.sum(s) << endl;
    }
  }
 
  return 0;
}

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

int N, A, ans = 1;
int a, b, c, d, e, k;
vector<int> v;
int main(){
    v.resize(10);
    for(int i=0; i<5; i++)
	cin >> v[i];
    cin >> k;
    
    // for(int i=0; i<4; i++){
    if(v[4] - v[0] > k)
	ans = 0;
    // }
    
    if(ans == 1)
    	cout << "Yay!" << "\n";
    else
    	cout << ":(" << "\n";
}


Measured memory_bytes: 256
package main

import (
	"math"
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()

	p := make([]point, n)
	for i := 0; i < n; i++ {
		p[i] = point{scanFloat64(), scanFloat64()}
	}
	
	ans := float64(0)
	permutationSearch(n, func(a []int) {
		for i := 0; i < n-1; i++ {
			ans += dist(p[a[i]],p[a[i+1]])
		}
	})

	for i := 0; i < n; i++ {
		ans /= float64(n-i)
	}

	fmt.Fprintln(wr, ans)
}

func permutationSearch(n int, fn func(a []int)) {
	a := make([]int, n)
	for i := 0; i < n; i++ { a[i] = i }
	swap := func(i,j int) { a[i],a[j] = a[j],a[i] }

	fn(a)
	for i := n-2; i >= 0; i-- {
		if a[i] < a[i+1] {
			for j := n-1; j > i; j-- {
				if a[i] < a[j] {
					swap(i,j)
					for k := i+1; k < (n+i+1)/2; k++ { swap(k,n-(k-i)) }
					fn(a)
					i = n-1
					break
				}
			}
		}
	}
}

type point struct {
	x float64
	y float64
}

func dist(p1,p2 point) float64 {
	return math.Sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y))
}


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

namespace Practice
{
    class Program
    {
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        private const long MOD = 1000000007;
        static void SolveA(string[] args)
        {
            string sz0 = Console.ReadLine();
            string sz1 = Console.ReadLine();
            string sz2 = Console.ReadLine();

            string ans = sz0[0].ToString();
            ans += sz1[1];
            ans += sz2[2];
            Console.WriteLine(ans);
        }
    }
}

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

int main (void)
{
    int n, *p;
    int i, j = 0;

    scanf("%d", &n);
    p = (int *)malloc(sizeof(int) * n);
    
    for(i = 0 ; i < n ; i++){
        scanf("%d", &p[i]);
    }

    for(i = 1 ; i < n - 1 ; i++){
        if((p[i-1] < p[i] && p[i] < p[i+1]) || (p[i-1] > p[i] && p[i] > p[i+1])){j++;}
        //printf("%d %d %d\n", p[i-1], p[i], p[i+1]);
    }

    printf("%d\n", j);

    free(p);
}

Measured memory_bytes: 128
A, B = map(int, input().split())

def v():
    if A == 1:
        if B != 1:
            return 'Alice'
        else:
            return 'Draw'
    if B == 1:
        if A != 1:
            return 'Bob'
        else:
            return 'Draw'
    if A > B:
        return 'Alice'
    if B > A:
        return 'Bob'
    return 'Draw'

print(v())


Measured memory_bytes: 2940