akhauriyash/Code-Regression huggingface dataset:
fun toDigit(a:Char) :Int{
    return a.toInt() - '0'.toInt()
}
fun dig2(a:Char,b:Char):Int{
    return toDigit(a)*10+toDigit(b)
}

fun isMonth(x:Int):Boolean{
    return (x in 1..12);
}

fun main(args:Array<String>){
    val s = readLine()!!
    val a = dig2(s[0],s[1]);
    val b = dig2(s[2],s[3]);
    
    val isYYMM = isMonth(b);
    val isMMYY = isMonth(a);

    if(isYYMM && isMMYY) println("AMBIGUOUS")
    else if(isYYMM) println("YYMM")
    else if(isMMYY) println("MMYY")
    else println("NA")
}


Measured memory_bytes: 34444
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 文字列の入力
		String b = sc.next();
        String ans = "";
        switch (b) {
          case "A":
            ans = "T";
            break;
          case "T":
            ans = "A";
            break;
          case "C":
            ans = "G";
            break;
          case "G":
            ans = "C";
            break;
        }
    
		// 出力
		System.out.println(ans);
	}
}

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

using namespace std;

const int INF = 1e9+7;
int n, a, b, c, d;
long long cache[1001][1001];
long long fac[1001];

long long inv(long long val)
{
	long long ret = 1, temp = INF-2;
	while(temp)
	{
		if(temp%2)
			ret = (ret * val) % INF;
		temp /= 2;
		val = (val*val) % INF;
	}
	return ret;
}

long long f(int idx, int remain)
{
	if(idx == b+1)
	{
		if(remain == 0)	return 1;
		else	return 0;
	}

	long long& result = cache[idx][remain];
	if(result != -1)	return result;

	result = f(idx+1, remain);
	if(remain < (long long)c * idx)
		return result;

	long long bunja = 1, bunmo = 1;

	for(int i = 0; i < c; i++)
		bunmo = (bunmo * fac[idx]) % INF;

	for(int i = c; i <= d; i++)
	{
		if(remain < (long long)i*idx)	break;
		bunja = (fac[remain] * inv(fac[remain-i*idx])) % INF;

		long long cur = f(idx+1, remain-i*idx);
		cur = (cur*bunja) % INF;
		cur = (cur*inv(bunmo)) % INF;
		cur = (cur*inv(fac[i])) % INF;
		result = (result + cur)%INF;
		
		bunmo = (bunmo * fac[idx]) % INF;
	}
	return result;
}

int main(void)
{
	fac[0] = 1;
	for(int i = 1; i <= 1000; i++)
		fac[i] = (fac[i-1]*i) % INF;

	memset(cache, -1, sizeof(cache));
	scanf("%d %d %d %d %d", &n, &a, &b, &c, &d);
	printf("%lld\n", f(a, n));
	return 0;
}

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

int cnt[200010];

int main() {
  ll N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    A[i]--;
  }

  int now = 0;
  if (K <= N) {
    for (int i = 0; i < K; i++) {
      now = A[now];
    }
    cout << now + 1 << endl;
    return 0;
  }

  int looplen = 0, tmp = 0;
  while (cnt[now] < 2) {
    tmp++;
    cnt[now]++;
    now = A[now];
    if (cnt[now] == 1) looplen++;
  }

  now = 0;
  for (int i = 0; i < (K - (tmp - 2 * looplen)) % looplen + (tmp - 2 * looplen);
       i++) {
    now = A[now];
  }
  cout << now + 1 << endl;
}

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

using namespace std;

#define ll long long 
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
    {
        ll a,b,c;

        cin>>a>>b>>c;

        swap(a,b);
        swap(a,c);

        cout<<a<<' '<<b<<' '<<c;
    }
}

Measured memory_bytes: 256
from sys import stdin
import math
input = int(stdin.readline().rstrip())

orig = input/1.08

ceil = math.ceil(orig)
floor = math.floor(orig)

if orig == ceil and orig == floor:
    print(int(orig))
elif int(math.floor(ceil) * 1.08) == input:
    print(int(ceil))
elif int(math.floor(floor * 1.08)) == input:
    print(int(floor))
else:
    print(':(')

Measured memory_bytes: 3064
#include <stdio.h>

int main() {

char ch[2000] = {0};
char W[15] = {0};
int i,j,k,l,m,n,o,p; 

m=0; /* ??????W?????\??? */
while(1) {

scanf("%c" , &W[m]);
/* printf("W[%d]???%c ",m,W[m]); /*W[m]????¢????*/
if(W[m] == '\n') {
break;
}
m = m+1;
}

n=0; /* ?????????T?????\??? */
while(1) {

scanf("%c",&ch[n]);

 /*printf("ch[%d]???%c ",n ,ch[n]); /*  ch[n]????¢???? */
 

if(ch[n] =='T' && ch[n-1] == 'X' && ch[n-2] == 'E' && ch[n-3] == 'T' && ch[n-4] == '_' && ch [n-5] == 'F' && ch[n-6] == 'O' && ch[n-7] == '_' && ch[n-8] == 'D' && ch[n-9] == 'N' && ch[n-10] == 'E') {
/* printf("break??????\n"); */
break;
}
n +=1;
} /*while??\????????????*/


/*??????????????¨?????????????¢????*/
p=0;
for(i=0; i<n; i++){
if(W[0] == ch[i] || W[0] == ch[i]+32 || W[0] == ch[i]-32) {
/* printf("????????????????¢????ch[%d]\n",i); /**/
if(ch[i+m] == ' ' || ch[i+m] == '\n' || W[0] == ch[0]  ) { 
if(ch[i-1] == ' ' || ch[i-1] == '\n' ||  W[0] == ch[0]+32 || W[0] == ch[0]-32){
o=o+1;
/*printf("ch[%d]???%c?????????\n",i,ch[i]); /*??????????¢????*/

for(j=0;j<m; j++) {
if(W[j] == ch[i+j] || W[j] == ch[i+j]+32 || W[j] == ch[i+j]-32){
/*printf("W[%d]???%c ch[%d]???%c\n",j,W[j],i+j,ch[i+j]); /*???= ????¢???????*/
o=o+1;
}
}
}
}

if(o==m+1){
p=p+1;
}
o=0;
}
}

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

return 0;

}


Measured memory_bytes: 2076
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int left = A + B;
  int right = C + D;
  if(left > right){
    cout << "Left" << endl;
  }
  else if(left < right){
    cout << "Right" << endl;
  }else{
   cout << "Balanced" << endl; 
  }
}

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

int main() {
	int N;
	cin >> N;
	vector<string> S(N);
	rep(i, N) cin >> S[i];

	int C0 = 0;
	int C1 = 0;
	int C2 = 0;
	int C3 = 0;
	rep(i, N) {
		if(S[i] == "AC") C0++;
		else if(S[i] == "WA") C1++;
		else if(S[i] == "TLE") C2++;
		else if(S[i] == "RE") C3++;
	}

	cout << "AC x " << C0 << endl;
	cout << "WA x " << C1 << endl;
	cout << "TLE x " << C2 << endl;
	cout << "RE x " << C3 << endl;

	return 0;
}

Measured memory_bytes: 6360
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100005;
int a[N], sum[N];
map<int, int>mp;
int n, m;
ll ans = 0;
int main(){
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; ++i){
        scanf("%d", a+i);
        sum[i] = (sum[i-1] + a[i] % m) % m;
    }
    mp[0] = 1;
    for(int i = 1; i <= n; ++i){
        if(mp.count(sum[i])){
            ans += mp[sum[i]];
            mp[sum[i]]++;
        }else{
            mp[sum[i]] = 1;
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3968
using System;
using System.Collections.Generic;
using System.Linq;

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

        var personNum = int.Parse(input[0]);
        var types = int.Parse(input[1]);

        var result = new int[personNum];


        for(var i = 0; i < types; i++)
        {
            var n = int.Parse(Console.ReadLine());
            var pArray = Console.ReadLine().Split(' ');

            foreach(var p in pArray)
            {
                result[int.Parse(p) - 1] += 1;
            }
        }


        var ans = 0;
        foreach(var n in result)
        {
            if(n == 0)
            {
                ans += 1;
            }
        }

        Console.WriteLine(ans);
        Console.ReadLine();


    }

}



Measured memory_bytes: 18264
/** Seek God..Trust God..Praise God..**/

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


#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////



/*
long long  Prime[3000000],nPrime;
long long  mark[10000002];

void seive(long long int n)
{
	long long int i,j,limit=sqrt(n*1.0)+2;
	mark[1]=1;
	for(i=4; i<=n ;i+=2)
	mark[i]=1;
	Prime[nPrime++]=2;
	for(i=3; i<=n; i+=2)
	{
		if(!mark[i])
		{
			Prime[nPrime++]=i;
			if(i<=limit)
			{
				for(j=i*i; j<=n ;j+=i*2)
				{
					mark[j]=1;
				}
			}
		}
	}
}
*/


int main()
{
    FASTIO;

    string s;

    cin >> s;




    ll len = s.size();

    ll sum = 0;



    for(ll i=0; i<len; i++)
    {

        //cout << s[i]-48 << endl;

        sum += (s[i]-48);
    }



    if(sum%9==0)
    {
        cout << "Yes" << endl;

    }
    else
    {
        cout << "No" << endl;

    }





    return 0;
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, a) for (int i = 0; i < (int)(a); i++)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
typedef long long ll;
template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v){stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v){if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.first>>v.second;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.first<<","<<v.second;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const vector<T>&a){ll res(0);for(auto&&x:a)res+=x;return res;}

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template <typename Head> void dump(Head &&head) {
  cerr << head;
  dump();
}
template <typename Head, typename... Tail>
void dump(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  dump(forward<Tail>(tail)...);
}
#define debug(...)                                                               \
  do {                                                                         \
    cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = ";                        \
    dump(__VA_ARGS__);                                                         \
  } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template <typename T> struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;
template <typename T> using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template <typename T> using Matrix = vector<vector<T>>;

const ll LINF = 1LL << 60;
const int INF = 1001001001;

/////////////////////////////////////////////////////////////////////


int main()
{
  ll n; cin >> n;
  ll q; cin >> q;

  dsu d(n);
  for (int i=0; i<q; i++){
    int t,u,v; cin>>t>>u>>v;
    if (t==0) d.merge(u, v);
    else {
      if (d.same(u, v)) cout << 1 << endl;
      else cout << 0 << endl;
    }
  }

  return 0;
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		var d = rla();
		Console.WriteLine(Math.Max(d[0] * d[1] , d[2] * d[3]));
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 10e-10;

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    int imos[501][501];
    fill(imos[0], imos[500]+501, 0);
    int n,m,q,l,r;
    cin >> n >> m >> q;
    rep(m){
        cin >> l >> r;
        imos[l][r]++;
    }

    reppp(i, 1, n+1){
        reppp(j, 1, n+1){
            imos[i][j] += (imos[i-1][j] + imos[i][j-1] - imos[i-1][j-1]);
        }
    }

    rep(q){
        cin >> l >> r;
        cout << imos[r][r] - imos[l-1][r] - imos[r][l-1] + imos[l-1][l-1] << endl;
    }

}

Measured memory_bytes: 1920
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let K: i64 = sc.get();
    let Q: usize = sc.get();
    let A: Vec<i64> = sc.vec(Q);
    let mut scores = vec![0 as i64; N];
    for i in 0..Q {
        let a = (A[i] - 1) as usize;
        scores[0] -= 1;
        scores[a] += 1;
        if a+1 < N {
            scores[a+1] -= 1;
        }
    }
    for i in 1..N {
        scores[i] += scores[i-1];
    }
    for i in 0..N {
        if K + scores[i] <= 0 {
            println!("No");
        } else {
            println!("Yes");
        }
    }
}


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

int main() {
  string s; cin>>s;
  vector<int>vec(4);
  for(int i=0;i<s.size();i++){
    if(s[i]=='N') vec[0]++;
    if(s[i]=='W') vec[1]++;
    if(s[i]=='S') vec[2]++;
    if(s[i]=='E') vec[3]++;
  }
  int num=0;
  for(int i=0;i<4;i++){
    if(vec[i]>0) num++;
  }
  if(num<=1 || num==3) cout<<"No"<<endl;
  else if(num==2){
    if(vec[0]>0 && vec[2]>0) cout<<"Yes"<<endl;
    else if(vec[1]>0 && vec[3]>0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  else cout<<"Yes"<<endl;
}
   

    
  


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 1e-10;
const int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    std::ios::sync_with_stdio(0); cin.tie(0);
    string s;
    cin >> s;
    int n = s.length(), cnt = 0;
    for(int i=0;i<n;++i){
        if(s[i] == 'o') {
            ++cnt;
        }
    }
    if(cnt + 15-n >= 8) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }
}


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

#define int long long

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    double n;
    cin >> n;
    cout << fixed << setprecision(6) << (n*n*n)/27 << endl;
}

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

using graph=vector<vector<int>>;
vector<int> dist_ao,dist_tak;
graph G;
int N;

void dfs(int v,vector<int> &dist){
	for(auto nv : G[v]){
		if(dist[nv]>=0)continue;
		dist[nv]=dist[v]+1;
		dfs(nv,dist);
	}
}

signed main(){
	int u,v;
	cin>>N>>u>>v; u--; v--;
	G.assign(N,vector<int>(0));
	for(int i=0;i<N-1;i++){
		int a,b; cin>>a>>b; a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	dist_ao.assign(N,-1);
	dist_tak.assign(N,-1);
	dist_ao[v]=0;
	dist_tak[u]=0;
	dfs(u,dist_tak);
	dfs(v,dist_ao);
	int ans=0;

	if(G[u].size()==1 && G[u][0]==v){
		ans=0;
		//cout<<"a"<<endl;
		goto end;
	}
	for(int i=0;i<N;i++){
		if(G[i].size()==1){
			if(dist_tak[i]<dist_ao[i]){
				//ans=max(ans,(dist_ao[i]%2==0 ? dist_ao[i]-1 : dist_ao[i]));
				ans=max(ans,dist_ao[i]-1);
			}
		}
	}
	end:
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const long double EPS = 1e-10;

int main() {
  long double a, b, x;
  cin >> a >> b >> x;

  long double h, ans;
  if (a * a * b / 2 <= x) {
    h = 2 * b - 2 * x / (a * a);
    ans = atan2(h, a) * 180 / M_PI;
  }
  else {
    h = 2 * x / (a * b);
    ans = 90 - (atan2(h, b) * 180 / M_PI);
  }

  cout << setprecision(10) << ans << endl;

  

  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n, a[3];
	int i, j, flag;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	
	for (i = 1; i < a[0]; i++){
		
		flag = 1;
		
		for (j = 0; j < n; j++){
			if (a[j] % i != 0) flag = 0;
		}
		
		if (flag == 1) printf("%d\n", i);
	}
	
	return (0);
}

Measured memory_bytes: 596
#include <cstdio>

char map[20][21];
int w, h;
int ans;
int x, y;
int xx, yy;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};

void Move(int X, int Y) {
	ans++;
	map[Y][X] = '#';
	for(int i = 0; i < 4; i++) {
		xx = X + dx[i];
		yy = Y + dy[i];
		if(0 <= xx && xx < w && 0 <= yy && yy < h && map[yy][xx] == '.') {
			Move(xx, yy);
		}
	}
}

int main(void) {
	while(1) {
		ans = 0;
		scanf("%d %d", &w, &h);
		if(!w && !h) break;
		for(int i = 0; i < h; i++) {
			scanf("%s", map[i]);
			for(int j = 0; j < w; j++) {
				if(map[i][j] == '@') {
					x = j;
					y = i;
				}
			}
		}
		Move(x, y);
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1040
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

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

template<class T>bool umax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool umin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

// gcd
int gcd(int a, int b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

int main() {
    long long N;
    long long ans=0;
    cin >> N;

    for(long long i=0; i<=N; i++){
        if(i*i<=N){
            ans = i*i;
        }else{
            break;
        }
    }

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



Measured memory_bytes: 256
N=int(input())
H=list(map(int,input().split()))
kotae_kari=0
kotae_max=0
for n in range(N-1):
    if H[n+1]<=H[n]:
        kotae_kari+=1
    else:
        if kotae_kari>=kotae_max:
            kotae_max=kotae_kari
        kotae_kari=0
    if n==N-2:
        if kotae_kari>=kotae_max:
            kotae_max=kotae_kari
print(kotae_max)


Measured memory_bytes: 15020
unittest
{
//	assert( [ "5 3" ].solve == "5\n4 3\n1 2\n3 1\n4 5\n2 3" );
	assert( [ "5 3" ].solve == "7\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5" );
	assert( [ "5 8" ].solve == "-1" );
}



import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = 0L;
	auto k = 0L;
	input.front.formattedRead!"%s %s"( n, k );
	
	// スター型グラフを作ると頂点ペア数が最大になる
	// そこから外側の頂点間に辺を張るごとに1ペアずつ減らせる
	auto t = ( n - 1 ) * ( n - 2 ) / 2;
	if( t < k ) return "-1";
	
	string[] anss;
	foreach( i; 2 .. n + 1 )
	{
		anss ~= format( "1 %s", i );
	}
	LOOP: foreach( i; 2 .. n + 1 )
	{
		foreach( j; i + 1 .. n + 1 )
		{
			if( t == k ) break LOOP;
			anss ~= format( "%s %s", i, j );
			t--;
		}
	}
	return format( "%s\n%s", anss.length, anss.join( "\n" ) );
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
#define ll long long
#define maxn (1000+10)
#define mod 10000003
#define lnode node*2,start,mid
#define rnode node*2+1,mid+1,end
using namespace std;
int main()
{   ios::sync_with_stdio(false);
	#define int ll
	int n,a[101],ans=0;
	cin>>n;
	for(int i=1;i<=n-1;i++)
	  cin>>a[i];
	ans+=a[1]+a[n-1]; 
	//cout<<a[1]<<" "; 
	for(int i=1;i<=n-2;i++)
	{  int x=a[i]>a[i+1]?a[i+1]:a[i];
	   //cout<<x<<" ";
	   ans+=a[i]>a[i+1]?a[i+1]:a[i];
	}
	//cout<<a[n-1];
	//cout<<endl;
	cout<<ans; 
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());
    int left = 0;
    int right = n+1;
    int tmpLeft , tmpRight;
    for(int i=0;i<m;i++){
      
      tmpLeft = Integer.parseInt(sc.next());
      tmpRight = Integer.parseInt(sc.next());
      if(tmpLeft>left)left = tmpLeft;
      if(tmpRight<right)right = tmpRight;
    }
    if(right>=left){
      System.out.print(right-left+1);
    }else{
      System.out.print(0);
    }
   
    System.out.flush();
    
  }
}

Measured memory_bytes: 46520
import sys
import math

a, b, c=input().strip().split()
a, b, c=[int(a), int(b), int(c)]

if c-a-b<=0:
  print("No")
elif (a+b-c)*(a+b-c)>4*a*b:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3060
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <stdio.h>
#include <math.h>
#include <utility>
#include <algorithm>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<string> s(n);
	int cnt = 0;
	int fBlist = 0;
	int bAlist = 0;
	int vlist = 0;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		for (int j = 0; j < s[i].size() - 1; j++) {
			if (s[i][j] == 'A') {
				if (s[i][j + 1] == 'B') {
					cnt++;
				}
			}
		}
		if (s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A') vlist++;
		else if (s[i][0] == 'B')fBlist++;
		else if (s[i][s[i].size() - 1] == 'A')bAlist++;
	}

	if (vlist != 0 && fBlist + bAlist == 0) {
		cnt--;	
	}
	cnt += vlist;
	cnt += fBlist < bAlist ? fBlist : bAlist;
	cout << cnt;
	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define fr first
#define sc second

const int mod = 1e9 + 7;
using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
double dp[3001][3001];
int n;
double arr[3003];
double solve(int i,int j){
    if(i == n)return j <= n/2;
    if(dp[i][j] == dp[i][j])return dp[i][j];
    return dp[i][j] = solve(i+1,j) * (arr[i]) + solve(i+1,j+1) * (1.0 - arr[i]);
}
int main(){
    scanf("%d",&n);
    for(int i = 0;i< n;i++){
        scanf("%lf",&arr[i]);
    }
    memset(dp,-1,sizeof dp);
    cout << fixed << setprecision(9) <<  solve(0,0);
    return 0;
}


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class DRGBTriplets {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        string s;
        cin >> s;
        vector<int> LR(N), LG(N), LB(N), RR(N), RG(N), RB(N);
        for (int i = 1; i < N; i++) {
            LR[i] = LR[i - 1] + (s[i - 1] == 'R');
            LG[i] = LG[i - 1] + (s[i - 1] == 'G');
            LB[i] = LB[i - 1] + (s[i - 1] == 'B');
        }
        for (int i = N - 2; i >= 0; i--) {
            RR[i] = RR[i + 1] + (s[i + 1] == 'R');
            RG[i] = RG[i + 1] + (s[i + 1] == 'G');
            RB[i] = RB[i + 1] + (s[i + 1] == 'B');
        }
        int res = 0;
        for (int i = 1; i < N - 1; i++) {
            if (s[i] == 'R') {
                res += LG[i] * RB[i] + LB[i] * RG[i];
                for (int j = 1; i - j >= 0 && i + j < N; j++) {
                    if ((s[i - j] == 'G' && s[i + j] == 'B')) res--;
                    if ((s[i - j] == 'B' && s[i + j] == 'G')) res--;
                }
            }
            if (s[i] == 'G') {
                res += LR[i] * RB[i] + LB[i] * RR[i];
                for (int j = 1; i - j >= 0 && i + j < N; j++) {
                    if ((s[i - j] == 'R' && s[i + j] == 'B')) res--;
                    if ((s[i - j] == 'B' && s[i + j] == 'R')) res--;
                }
            }
            if (s[i] == 'B') {
                res += LR[i] * RG[i] + LG[i] * RR[i];
                for (int j = 1; i - j >= 0 && i + j < N; j++) {
                    if ((s[i - j] == 'R' && s[i + j] == 'G')) res--;
                    if ((s[i - j] == 'G' && s[i + j] == 'R')) res--;
                }
            }
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    DRGBTriplets solver;
    solver.solve(in, out);
    return 0;
}


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

struct Benri {
    Benri() {
        std::cin.tie(0); ios::sync_with_stdio(false);
        cout << fixed << setprecision(12);
    }
} benri;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define MOD 1000000007
#define MOD2 998244353




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

    if (K > ((N - 1) * (N - 2)) / 2 ) {
        cout << -1 << endl;
        return 0;
    }

    int a = ((N - 1) * (N - 2)) / 2 - K;
    int M = (N - 1) + a;
    cout << M << endl;

    rep(i,N-1) cout << i+1 << " " << N << endl;

    bool f = false;

        for(int i = 1; i < N; i++){
            for(int j=i+1; j < N; j++){
                if(a == 0) {
                    f = true;
                    break;
                }
                cout << i << " " << j << endl;
                a--;
            }
            if(f) break;
        }

}




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

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    
    a = 1*a;
    c = (-1)*c;
    
	if( k <= a ){
   		cout<<k<<endl;
	}
	else{
		int ans = 0;
		
		k -= a;
		ans += a;
		
		if(k<=b){
			
			cout<<ans<<endl;
			
		}
		else{
			k -= b;
			
			if(k>0){
				
				ans -= k;
				cout<<ans<<endl;
			}
			
		}
		
		
	}
    
}


Measured memory_bytes: 3636
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int[] moti = new int[num];
        int ans = 1;
        for(int i = 0;i < num;i++){
            moti[i] = sc.nextInt();
        }
        Arrays.sort(moti);
        for(int i = 0;i < num-1;i++){
            if(moti[i] == moti[i+1])
            continue;
            ans++;
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 20692
#include <bits/stdc++.h>
#include <math.h>
#include <algorithm>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define FOR(i, n, x) for(int i = x; i < n; i++)
#define OUT(a, s, e) FOR(i, e, s) cout << a[i] << ' '
#define OUTV(a) for(auto i : a) cout << i << ' ';


using namespace std;


int main()
{
    ll n, w; cin >> n >> w;
    ll weight[n];
    ll value[n];
    FOR(i, n, 0)
    {
        cin >> weight[i] >> value[i];
    }
    ll dp[n + 1][w + 1] = {};
    FOR(i, w + 1, 1)
    {
        if(i >= weight[0])dp[0][i] = value[0];
    }
    FOR(i, n, 1)
    {
        FOR(j, w + 1, 1)
        {
            if(j < weight[i])dp[i][j] = dp[i - 1][j];
            else dp[i][j] = max(dp[i - 1][j], value[i] + dp[i - 1][j - weight[i]]);
        }
    }
    cout << dp[n - 1][w];
    return 0;
}
/*
64
60
120
336

aoueib
aouibe
aouieb
aubeio
aubeoi
aubieo
*/


Measured memory_bytes: 79104
N = int(input())
P = list(map(float, input().split()))
dp = [[0] * 3010 for _ in range(3010)]
dp[0][0] = 1
# dp[i][j] iまでのコインを使って、j枚の表が出る確率
for i in range(N):
    for j in range(i+1):
        dp[i+1][j+1] += dp[i][j] * P[i]
        dp[i+1][j] += dp[i][j] * (1-P[i])

print(sum(dp[N][N//2+1:]))


Measured memory_bytes: 255368
program test
implicit none
integer::N,d(100),i,k,ans
read(*,*)N
d=0
ans=0
do i=1,N
	read(*,*)k
    d(k)=d(k)+1
end do
do i=1,100
	if(d(i)>0)then
    ans=ans+1
    end if
end do
print*,ans
end program test

Measured memory_bytes: 256
n, a, b, c, d = map(int, input().split())
s = list(input())

if c < b:
    pre = '.'
    for i in range(a, c):
        if pre == '#' and s[i] == '#':
            print('No')
            exit()
        pre = s[i]
    pre = '.'
    for i in range(b, d):
        if pre == '#' and s[i] == '#':
            print('No')
            exit()
        pre = s[i]
elif c < d:
    pre = '.'
    for i in range(a, d):
        if pre == '#' and s[i] == '#':
            print('No')
            exit()
        pre = s[i]
else:
    pre = '.'
    prepre = '#'
    three = False
    for i in range(a, c):
        if pre == '#' and s[i] == '#':
            print('No')
            exit()
        if b <= i <= d and prepre == '.' and pre == '.' and s[i] == '.':
            three = True
        prepre = pre
        pre = s[i]
    if three == False:
        print('No')
        exit()
print('Yes')


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

int main() {
  int a, b;
  cin >> a >> b;
  
  bool flag = false;
  int pr = 0;
  while (true) {
    int i, j;
    i = (int) pr * 0.08;
    j = (int) pr * 0.10;
    
    if ((i == a) && (j == b)) {
      flag = true;
      break;
    }
    if ((i > a) || (j > b)) {
      break;
    }
    pr++;
  }
  
  if (flag) cout << pr << endl;
  else cout << -1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1_000_000_007
#define INF 10*10
#define EPS 1e-9

//----***パーツ***----
#define fr first
#define se second

//----***入出力***---
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}initial_;

int N,M,K,a;
string S;

signed main(){
  cin>>N>>M;
  K=0;
  vector<int> A(M);
  REP(i,0,M){
    cin>>a;
    K+=a;
  }
  if(K>N) print(-1)
  else print(N-K)


}


Measured memory_bytes: 3700
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Frog 2
            var line = ReadLine();
            int N = line[0];
            int K = line[1];

            var h = ReadLine();

            //トータルコストがゼロのケースと、メモに何の値も入っていないケースを区別する
            var dp = Enumerable.Repeat(-1, N).ToArray();
            dp[0] = 0;

            for (int i = 0; i < N; i++)
            {
                for (int j = 1; j <= K; j++)
                {
                    if (i + j < N)
                    {
                        int cost = Math.Abs(h[i] - h[i + j]);

                        if (dp[i + j] == -1 | dp[i + j] > cost + dp[i])
                        {
                            dp[i + j] = cost + dp[i];
                        }
                    }
                }
            }

            Console.WriteLine(dp[N - 1]);
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToList();
        }
    }
}


Measured memory_bytes: 19168
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--) 
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();

int main(){
string s; cin>>s; 
bool flaga=0,flagb=0;

REP(i,3){
  if(s[i]=='A')flaga=1;
  else flagb=1;
}

    if(flaga==1&&flagb==1)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;


}

Measured memory_bytes: 256
#include "iostream"
 
using namespace std;
int main(){
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d;
	e = a*b;
	f = c*d;
	if(e >= f){
		cout << e << endl;
	}
	else{
		cout << f << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
typedef long long ll;
using namespace std;
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
inline int rd(){
	int res=0,sign=1;char ch;
	while((ch=getchar())<'0'||ch>'9')if(ch=='-')sign=-1;res=res*10+ch-48;
	while((ch=getchar())>='0'&&ch<='9')res=res*10+ch-48;
	return res*sign;
}
int n,a,sum;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a;
		sum+=a;
	}
	if(sum%2==0)puts("YES");
	else puts("NO");
	return 0;
}


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

ans = ""

al = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
      'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

while n > 0:
    tmp = n % 26
    if tmp > 0:
        ans += al[tmp-1]
    else:
        ans += 'z'
        n = n - 1
    n = n // 26

print(ans[::-1])


Measured memory_bytes: 9184
alternateJoin :: [a] -> [a] -> [a]
alternateJoin [] _      = []
alternateJoin (x:xs) ys = x : alternateJoin ys xs

main :: IO ()
main = do
    _ <- getLine
    [s,t] <- words <$> getLine :: IO [String]
    putStrLn $ alternateJoin s t

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

using namespace std;

const int INFTY = 1000000000;

int main() {
    int N, M;
    cin >> N >> M;
    while(N!= 0){
        vector<int> cvect(M),xvect(N);
        for(int i=0; i< M ;i++){
            cin >> cvect[i];
        }
        for(int i=0; i< N ; i++){
            cin >> xvect[i];
        }
        vector<int> dp(256, INFTY), dp_old(256, INFTY);
        dp_old[128]=0;
        int tmp;
        for(int i=0; i<N; i++){
            vector<bool> check(256, false);
            for(int j=0; j<256 ; j++){
                dp[j] = INFTY;
            }
            for(int j=0; j<256 ; j++){
                for(int k=0; k< M; k++){
                    tmp = min(max(0, j+cvect[k]),255);
                    if(check[tmp]){
                        dp[tmp] = min(dp[tmp], dp_old[j] + (tmp-xvect[i])*(tmp-xvect[i]));
                    }else{
                        dp[tmp] = dp_old[j] + (tmp-xvect[i])*(tmp-xvect[i]);
                        check[tmp] = true;
                    }
                }
            }
            swap(dp,dp_old);
        }
        int ans=INFTY;
        for(int i=0; i<256 ; i++){
            ans= min(ans, dp_old[i]);
        }
        cout << ans << endl;
        cin >> N >> M;
    }
    return 0;
}



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

using namespace std;

typedef long long ll;

const int MOD = 1e9+7;

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

	int N;
	cin >> N;

	string S;
	cin >> S;

	vector<int> alp(26, 0);
	rep(i, N) alp[S[i] - 'a']++;

	ll ans = 1;
	rep(i, 26){
		ans *= (alp[i] + 1);
		ans %= MOD;
	}

	cout << ans - 1 << endl;

}


Measured memory_bytes: 512
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

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

    y /= 1000;

    int rhs = y - n;
    for (int a = 0; a <= n; a++) {
        int b = (rhs - 9 * a);
        if (b % 4 || b < 0) {
            continue;
        }
        b /= 4;

        int c = n - a - b;
        if (c >= 0) {
            printf("%d %d %d\n", a, b, c);
            return 0;
        }
    }
    cout << "-1 -1 -1" << endl;

    return 0;
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var ab = Console.ReadLine().Split(' ');
        var a = int.Parse(ab[0]);
        var b = int.Parse(ab[1]);
        if (b == 100)
        {
            var ans = Math.Pow(100, a) * 101;
            Console.WriteLine(ans);
        }
        else
        {
            var ans = Math.Pow(100, a) * b;
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int l;
    cin >> l;
    printf("%.10f\n", l * l * l / 27.0);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin),p1==p2)?-1:*p1++)
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
char buf[1<<23],*p1=buf,*p2=buf;
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int aoi=3058;
int a[aoi][aoi];ll dp[aoi][aoi][4];
int main() {
  int n,m,k,i,j,v;
  cin>>n>>m>>k;
  for (;k--;) cin>>i>>j>>v,a[i][j]=v;
  for (i=1;i<=n;++i) {
    for (j=1;j<=m;++j) {
      for (k=1;k<4;++k) {
        dp[i][j][k]=max(dp[i-1][j][3]+a[i][j],max(dp[i][j-1][k-1]+a[i][j],dp[i][j-1][k]));
        ***dp=max(***dp,dp[i][j][k]);
      }   
    }
  }
  cout<<***dp<<"\n";
}

Measured memory_bytes: 326012
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

N, A, B = mi()
X = li()

ans = 0
for i in range(1, N):
    if (X[i]- X[i-1]) * A <= B:
        ans += (X[i]- X[i-1]) * A
    else:
        ans += B
print(ans)

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);

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

	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];

	sort(all(a));

	int ans = a[sz(a) / 2] - a[sz(a) / 2 - 1];

	out(ans);

	return 0;
}

Measured memory_bytes: 640