akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
bool isincluded(char x, string str) {
	bool f = 0;
	for (size_t i = 0; i < str.size(); i++) {
		if (str.at(i) == x)f = 1;
	}
	return f;
}
int ctoi(char c) {
	if ('0' <= c && c <= '9') {
		return c - '0';
	}
	return 0;
}



int main(void) {
	int n; cin >> n;
	vector<int> v(n);
	rep(i, n)cin >> v[i];
	int cnt = 0, ans = 0;
	for (int i = 1; i < n; i++) {
		if (v[i - 1] >= v[i]) {
			cnt++;
		}
		else {
			cnt = 0;
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///最大公約数を返す
func gcd(_ array: [Int]) -> Int {
    var value = array[0]
    if array.count > 1 {
        for i in 1..<array.count {
            value = gcd(value, array[i])
        }
    }
    return value
}

///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    var abc = readInts().sorted()
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    let diffCB = abc[2] - abc[1]
    let diffBA = abc[1] - abc[0]
    
    print(diffBA % 2 == 0 ? diffCB + diffBA / 2: diffCB + diffBA / 2 + 2)
}
main()


Measured memory_bytes: 13724
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
vector<mint>c(100000);
void s()
{
  c[0]=1;
  for(int i=1;i<100001;i++)c[i]=(mint)i*c[i-1];
}
  
int main()
{
  int n,m;
  s();
  cin>>n>>m;
  if(n==m)
  {
    mint ans=c[n]*c[n]*2;
    cout<<ans.x<<endl;
  }
  else if(abs(n-m)==1)
  {
    mint ans=c[n]*c[m];
    cout<<ans.x<<endl;
  }
  else cout<<0<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include<math.h>
using namespace std;



int main(void){
	

	unsigned long int n, sum = 100000;
	long double Ceil;
	cin >> n;

	for (int i = 0; i < n; i++){

		sum /= 1000;
		Ceil = ceil(sum*1.05);
		sum=Ceil*1000;
	}		
	cout << sum << endl;


	
	return 0;
}

Measured memory_bytes: 1160
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#define int128 __int128
#else
#define int128 long long
#endif

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

ll const mod = 1e9 + 7;

namespace {
	ll mul(ll a, ll b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) val += mod;
		if (val >= mod) val -= mod;
		return val;
	}

	ll poww(ll a, ll b) {
		ll val = 1;
		a %= mod;
		while (b > 0) {
			if (b % 2) val = mul(a, val);
			a = mul(a, a);
			b >>= 1;
		}
		return val % mod;
	}

	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

int const maxn = 3e5 + 5;

ll dp[1005][30005];

ll w[1005], s[1005], v[1005];

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	for (ll i = 0; i < n; i++) {
		cin >> w[i] >> s[i] >> v[i];
	}

	vector<ll>id(n); for (ll i = 0; i < n; i++) id[i] = i;
	sort(all(id), [&](ll i, ll j) {return w[i] + s[i] < w[j] + s[j]; });
	

	for (ll i = 0; i < n; i++) {
		ll j = id[i];
		for (ll sw = 0; sw <= 20005; sw++) {
			if (s[j] >= sw) {
				dp[i + 1][sw + w[j]] = max(dp[i + 1][sw + w[j]], dp[i][sw] + v[j]);
			} 
			dp[i + 1][sw] = max(dp[i + 1][sw], dp[i][sw]);
		}
	}
	ll mx = 0;
	for (ll i = 0; i <= 20005; i++) {
		mx = max(dp[n][i], mx);
	}
	cout << mx << endl;
		
	return 0;
}

/*
8 6

4 5 1 2 3 5 3 3

*/

Measured memory_bytes: 235008
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a, b) for(int i=a;i<b;++i)
#define pb push_back
/////////////////////////////////////

int const N = 1e5 + 41;

string ans[2] = {"First", "Second"};

int n;
vector<int> a;

int gcd(int a, int b){
	if(!a){
		return b;
	}
	return gcd(b%a, a);
}

int gcdV(vector<int> &v){
	int ret = v[0];
	fi(1, sz(v)){
		ret = gcd(ret, v[i]);
	}
	return ret;
}

void divideV(vector<int> &v, int d){
	fi(0, sz(v)){
		v[i] /= d;
	}
}

int cntOdd(vector<int> &v){
	int ret = 0;
	fi(0, sz(v)){
		if(v[i] % 2 == 1){
			++ret;
		}
	}
	return ret;
}

int cntEven(vector<int> &v){
	return sz(v) - cntOdd(v);
}

int getOddPos(vector<int> &v){
	fi(0, sz(v)){
		if(v[i] % 2 == 1){
			return i;
		}
	}
}

int cntOne(vector<int> &v){
	int ret = 0;
	fi(0, sz(v)){
		if(v[i] == 1){
			++ret;
		}
	}
	return ret;
}

long long getSum(vector<int> &v){
	long long ret = 0;
	fi(0, sz(v)){
		ret += v[i];
	}
	return ret;
}

void ok(int move){
	printf("%s\n",ans[move].c_str());
	exit(0);
}

void solve(){
	if(n == 1){
		if(a[0] == 1){
			ok(1);
		}else{
			ok(0);
		}
	}
	int move = 0;
	while(true){
		if(cntEven(a) == 0){
			ok(move ^ 1);
		}
		if(cntOne(a) > 0){
			if((getSum(a) - n) % 2 == 1){
				ok(move);
			}else{
				ok(move ^ 1);
			}
		}
		if(cntOdd(a) > 1){
			if(cntEven(a) % 2 == 1){
				ok(move);
			}else{
				ok(move ^ 1);
			}
		}else{
			--a[getOddPos(a)];
			divideV(a, gcdV(a));
		}
		move ^= 1;
	}
}

void read(){
	scanf("%d",&n);
	fi(0, n){
		int v;
		scanf("%d",&v);
		a.pb(v);
	}
}

void prepare(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
}

int main(){
	prepare();
	read();
	solve();


	return 0;
}

Measured memory_bytes: 1020
N = int(input())
robots = []
for _ in range(N):
    x, l = map(int, input().split())
    robots.append([x-l, x+l])

robots = sorted(robots, key=lambda x: x[1])
now = -float("inf")
ans = 0
# 選べるやつを貪欲に選ぶ
for left, right in robots:
    if left >= now:
        ans += 1
        now = right
print(ans)


Measured memory_bytes: 22104
#include <stdio.h>

int main(void)
{
	int d;
	int i;
	long long sum;
	
	while (scanf("%d", &d) != EOF){
		sum = 0;
		
		for (i = 1; i * d <= 600 - d; i++){
			sum += ((i * d) * (i * d)) * d;
		}
		
		printf("%lld\n", sum);
	}
	
	return (0);
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

#define double long double

const int INF=1001001001;
const int INFLL=1001001001001001001ll;
const int mod=1000000007;
inline void add(int &a,int b){
    a+=b;
    if(a>=mod)a-=mod;
}
const double PI=acos(-1);
const double EPS=1e-7;

signed main(){
    int N;cin>>N;
    vint R(N);rep(i,N)cin>>R[i];

    sort(all(R));
    reverse(all(R));
    double ans=0;

    for(int k=3;k<=N;k++){
        vint r(R.begin(),R.begin()+k);
        sort(all(r));
        do{
            vector<double>L(k);
            rep(i,k)L[i]=r[i]*r[(i+1)%k]/2.0;
            double mi=*min_element(all(L));
            double lb=-mi;
            double ub=mi;
            rep(i,30){
                double mid=(ub+lb)/2;
                double sum=0;
                rep(j,k)sum+=acos(mid/L[j]);
                if(sum>=2*PI)lb=mid;
                else ub=mid;
            }

            double sum=0;
            rep(j,k)sum+=acos(lb/L[j]);
            if(abs(sum-2*PI)>EPS)continue;
            double val=0;
            rep(j,k)val+=sin(acos(lb/L[j]))*L[j];
            chmax(ans,val);
        }while(next_permutation(all(r)));
    }
    printf("%.20Lf\n",ans);
    return 0;
}

Measured memory_bytes: 3536
#include <iostream>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define vec vector

int min(int i, int j)
{
	if (i > j) return j;
	else return i;
}

int main(void)
{
	while(1) {
		string s;
		cin >> s;
		if (s == "#") break;
		vec<int> step((int)s.length());
		rep(i, (int)s.length()) {
			if (s[i] == '1' || s[i] == '4' || s[i] == '7') step[i] = 1;
			else if (s[i] == '2' || s[i] == '8') step[i] = 2;
			else step[i] = 3;
		}
		int ans1 = 0;

		int current = 1;
		//-1 -> left
		// 1 -> right

		rep(i, (int)step.size() - 1) {
			int prev = current;
			if (step[i] < step[i + 1]) current = - 1;
			else if (step[i] > step[i + 1]) current = 1;
			else current = - current;
			if (prev == current) ans1++;
		}

		int ans2 = 0;
		current = - 1;
		//-1 -> left
		// 1 -> right

		rep(i, (int)step.size() - 1) {
			int prev = current;
			if (step[i] < step[i + 1]) current = - 1;
			else if (step[i] > step[i + 1]) current = 1;
			else current = - current;
			if (prev == current) ans2++;
		}

		cout << min(ans1, ans2) << endl;
	}
	return 0;
}

Measured memory_bytes: 3720
import sys
input = sys.stdin.buffer.readline

n,m = map(int,input().split())

#Union Find

#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]



#初期化
#根なら-size,子なら親の頂点
par = [-1]*n


for _ in range(m):
    a,b = map(int,input().split())
    unite(a-1,b-1)

res = 0
for e in par:
    if e < 0:
        res = max(res,-e)
print(res)

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

const int N = 1e5+5;
int n, m;
int u[N], v[N], visited[N], visited_ans[N];
vector<int> adj[N];
vector<pair<int,int> > ans;
bool deg[N];
map<pair<int,int>,int> mp;

void dfs(int u, int p)
{
    visited[u] = 1;
    for (auto v: adj[u])
    {
        if (v == p || visited[v]) continue;
        mp[{u,v}] = mp[{v,u}] = 1;
        dfs(v,u);
    }
}

void dfs_ans(int u, int p)
{
    visited_ans[u] = 1;
    if (adj[u].size() == 1 && u != 1)
    {
        if (deg[u]&1)
        {
            ans.push_back({u,p});
            deg[u]^=1;
        }
        else
        {
            ans.push_back({p,u});
            deg[p]^=1;
        }
        return;
    }
    for (auto v: adj[u])
    {
        if (v == p || visited_ans[v]) continue;
        dfs_ans(v,u);
    }
    if (u != 1)
    {
        if (deg[u]&1)
        {
            ans.push_back({u,p});
            deg[u]^=1;
        }
        else
        {
            ans.push_back({p,u});
            deg[p]^=1;
        }
    }
}

int main()
{
    cin >> n >> m;
    if (m&1) return cout << -1,0;
    for (int i = 0; i < m; i++)
    {
        cin >> u[i] >> v[i];
        adj[u[i]].push_back(v[i]);
        adj[v[i]].push_back(u[i]);
    }
    dfs(1,1);
    for (int i = 0; i < m; i++)
    {
        if (!mp[{u[i],v[i]}])
        {
            ans.push_back({u[i],v[i]});
            deg[u[i]] ^= 1;
        }
    }
    dfs_ans(1,1);
    for (auto p: ans)
        cout << p.first << ' ' << p.second << endl;
}


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


int main()
{
    string s;
    cin>>s;
    int r =0 , b = 0;
    for(int i=0;i<s.length();i++)
    {
        if( s[i] == '0')
            r++;
        else b++;
    }
    ll ans = min( r,b)*2;
    cout<<ans;
}

Measured memory_bytes: 3756
#include<iostream>
using namespace std;
main(){
  int x,y,w,h,n,te,tx,ty,cnt;
  cin>>te;
  while(te--){
    cnt=0;
    cin>>x>>y>>w>>h>>n;
    for(int i=0;i<n;i++){
      cin>>tx>>ty;
      if ( x<=tx && tx<=x+w && y <=ty && ty <=y+h)cnt++;
    }
    cout << cnt << endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(),c.end()
#define init(c) memset(c,0,sizeof c)
#define S second
#define F first
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N=20000005;
int n,k,x,t,a,b,m;
string s;
vi v;
int main(){

	cin >> s;
	if(s=="ABC"){
		cout << "ARC";
	}else{
		cout << "ABC";
	}

	
	return 0;
}

Measured memory_bytes: 3616
#include <cstdio>
#include <set>
#define M(x,y)std::make_pair(x,y)
typedef std::set<std::pair<int,int> >S;
int n,x,y,x1,y1,x2,y2,dx,dy;main(){for(;scanf("%d",&n),n;printf("%d\n",n)){
	S s;S::iterator it1,it2;
	for(;n;n--)scanf("%d%d",&x,&y),s.insert(M(x,y));
	for(it1=s.begin();it1!=s.end();it1++)
		for(x1=it1->first,y1=it1->second,it2=it1,it2++;it2!=s.end();it2++)
			if(x2=it2->first,y2=it2->second,dx=x2-x1,dy=y2-y1,dx*dx+dy*dy>n&&s.find(M(x1-dy,y1+dx))!=s.end()&&s.find(M(x2-dy,y2+dx))!=s.end())n=dx*dx+dy*dy;
}}

Measured memory_bytes: 1156
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
int p[110000];
int t[110000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)p[i]=i;
	int at=0;
	t[0]=1;
	t[1]=1;
	for(int i=0;i<b;i++){
		int x,y;scanf("%d%d",&x,&y);x--;y--;
		if(at==x){
			at=y;
		}else if(at==y){
			at=x;
		}
		swap(p[x],p[y]);
		if(at)t[p[at-1]]=1;
		if(at+1<a)t[p[at+1]]=1;
	}
	int ret=0;
	for(int i=0;i<a;i++)ret+=t[i];
	printf("%d\n",ret);
}


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

using namespace std;

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

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

	int N; cin >> N;

	int res = 0;
	for (int j = 7; j >= 0; --j){
		if (N & (1<<j)){
			res = 1<<j;
			break;
		} // end if
	} // end for					

	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
using namespace std;
using s64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int main()
{
    int n;
    cin >> n;
    double sum_jpy = 0.0;
    double sum_btc = 0.0;
    rep(i,n)
    {
        double x;
        string u;
        cin >> x >> u;
        if(u == "JPY")
            sum_jpy += x;
        else
            sum_btc += 380000 * x;
    }

    cout << sum_jpy + sum_btc << endl;
    return 0;
}

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

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
using ll = long long;
using pi = pair<int, int>;
const int INF = 0x3f3f3f3f;
const ll LINF = 1ll * INF * INF;

int main() {
	int N, K; cin >> N >> K;
	int ans = 0;
	for(int i=0; i<=min(K, N); i++) for(int j=0; j<=min(K-i, N); j++) {
		int k = K-i-j;
		if(k >= 0 && k <= N) ans++;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
n, k = map(int, input().split())
sunuke = [0] * n
for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for i in range(d):
        sunuke[a[i]-1] += 1

cnt = 0
for i in sunuke:
    if i == 0:
        cnt += 1
print(cnt)

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    cout << max(0, a - 2*b) << endl;
    return 0;
}



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<int> x(n), y(n);
	REP(i, n) cin >> x[i] >> y[i];

	int maxi = 0;
	REP(i, n) REP(j, n) {
		if (i == j) continue ;
		int dx = x[i] - x[j];
		int dy = y[i] - y[j];
		int cnt = 0;
		REP(k, n) REP(l, n) {
			if (k == l) continue ;
			int dx2 = x[k] - x[l];
			int dy2 = y[k] - y[l];
			if (dx == dx2 && dy == dy2)
				cnt++;
		}
		maxi = max(maxi, cnt);
	}
	cout << n - maxi << '\n';
	return 0;
}

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


#define MAX 100002

int ex[MAX];

int t[MAX];
int a[MAX];

int MINI[MAX];

int main(){
	for (int i = 0; i < MAX; i++){
		MINI[i] = INT_MAX;
	}
	memset(ex, -1, sizeof(ex));
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		scanf("%d", &t[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	int pr = -1;
	for (int i = 0; i < n; i++){
		if (pr < t[i]){
			ex[i] = t[i];
			pr = t[i];
		}
		MINI[i] = pr;
	}
	pr = -1;
	for (int i = n - 1; i >= 0; i--){
		if (pr < a[i]){
			if (ex[i] != -1 && ex[i] != a[i]){
				puts("0");
				return 0;
			}
			ex[i] = a[i];
			pr = a[i];
		}
		MINI[i] = min(MINI[i], pr);
		if (pr < ex[i]){
			puts("0");
			return 0;
		}
	}
	pr = -1;
	for (int i = 0; i < n; i++){
		if (pr < t[i]){
			pr = t[i];
		}
		if (pr < ex[i]){
			puts("0");
			return 0;
		}
	}
	long long int ans = 1LL;
	for (int i = 0; i < n; i++){
		if(ex[i]==-1)ans *= (long long int)(MINI[i]);
		ans %= 1000000007LL;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define vec vector
typedef long long ll;
typedef pair<ll,ll> P;
//const ll big=998244353;
const ll big=1000000007LL;
const ll INF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}
ll inv(ll x){
    return expm(x,big-2);
}


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

    string s;cin >> s;
    if(s=="RRR")cout << 3;
    else if(s[0]=='R'&&s[1]=='R')cout << 2;
    else if(s[1]=='R'&&s[2]=='R')cout << 2;
    else if(s[0]=='R'||s[1]=='R'||s[2]=='R')cout << 1;
    else cout << 0;
    cout << endl;
}

Measured memory_bytes: 3612
/*------------Ajeet -------------------*/

#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
    int n,m;
    cin>>n>>m;
    int arr[n];
    int ans=0;
    for(int i=0;i<n;i++)cin>>arr[i],ans+=arr[i];
   //float b=(float)1/(float)(4*m);
    int sum=0;
    for(int i=0;i<n;i++){
        if(4*m*arr[i]>=ans)sum++;
    }
    if(sum>=m) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pi 3.14159265358979323846
#define mod 1000000007
using namespace std;
int main()
{
    ll a,b;
    cin>>a>>b;
    if((a+b)%2!=0)
    cout<<"IMPOSSIBLE"<<endl;
    else
    cout<<(a+b)/2<<endl;
}

Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g

def main():
    n = inp()
    a = inpl()
    for i in range(n):
        if a[i]%2 == 0:
            if a[i]%3==0 or a[i]%5==0:
                continue
            print('DENIED')
            return
    print('APPROVED')
    
if __name__ == "__main__":
    main()




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

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

	vector<int> ns(s.size(), 0);
	vector<int> rs(30, -1);
	int num = 1;
	for (int i = 0; i < s.size(); i++) {
		if (rs[s[i] - 'a'] == -1) {
			rs[s[i] - 'a'] = num;
			ns[i] = num;
			num++;
		} else {
			ns[i] = rs[s[i] - 'a'];
		}
	}
	vector<int> nt(t.size(), 0);
	vector<int> rt(30, -1);
	num = 1;
	for (int i = 0; i < t.size(); i++) {
		if (rt[t[i] - 'a'] == -1) {
			rt[t[i] - 'a'] = num;
			nt[i] = num;
			num++;
		} else {
			nt[i] = rt[t[i] - 'a'];
		}
	}

	bool ok = true;
	for (int i = 0; i < s.size(); i++) {
		if (ns[i] != nt[i]) ok = false;
	}

	if (ok) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	} 

	return 0;
}


Measured memory_bytes: 2312
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	vb isB(10);
	REP(i, 4) {
		int N;
		cin >> N;
		isB[N] = true;
	}
	bool ans = true;
	REP(i, 10) {
		if (i == 1 || i == 9 || i == 4 || i == 7) {
			if (!isB[i])ans = false;
		}
		else {
			if (isB[i])ans = false;
		}
	}
	if (ans)cout << "YES" << endl;
	else cout << "NO" << endl;
	PAU;
	return 0;
}


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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
    int n, k;
    cin >> n >> k;
    vll sum(n+1);
    rep1(i, n) sum[i] = sum[i-1] + i;
    mint ans = 0;
    for (int i=k; i<=n; ++i) {
        ans += sum[n] - sum[n-i] - sum[i-1] + 1;
    }
    ans += 1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4840
import math

N = int(input())
for i in range(N):
    x1,y1,r1,x2,y2,r2 = map(float,input().split())
    d = math.sqrt(pow(x1 - x2,2.0) + pow(y1 - y2,2.0))
    if d < abs(r2 - r1):
        if r1 > r2:
            print(2)
        else:
            print(-2)
    elif d <= r1 + r2:
        print(1)
    else:
        print(0)

Measured memory_bytes: 7668
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int arr[300005];
int t[4*300005];
void build(int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = 0;
        return;
    } else {
        int tm = (tl + tr) / 2;
        build(v*2, tl, tm);
        build(v*2+1, tm+1, tr);
        t[v] = max(t[v*2], t[v*2+1]);
    }
}
void update(int v, int tl, int tr, int pos, int new_val) {
    if (tl == tr && tl==pos) {
        t[v] = new_val;
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = max(t[v*2], t[v*2+1]);
    }
}
int getMax(int v, int tl, int tr, int l, int r) {
    if (l > r)
        return INT_MIN;
    if (l == tl && r == tr)
        return t[v];
    int tm = (tl + tr) / 2;
    return max(getMax(v*2, tl, tm, l, min(r, tm)),
                   getMax(v*2+1, tm+1, tr, max(l, tm+1), r));
}
int main()
{
	int n,k;
	cin>>n>>k;
	int mxValue = 0;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		mxValue = max(mxValue,arr[i]);
	}
	vector<int>dp(n,0);
	mxValue+=1;
	build(1,0,mxValue);
	int ans = 0;
	for(int i=0; i<n; i++)
    {
        int l = max(0,arr[i]-k);
        int r = min(mxValue,arr[i]+k);
        //cout << l << " " << r << " ";
        int mx = getMax(1,0,mxValue,l,r);
        //cout << mx << endl;
        dp[i] = mx + 1;
        update(1,0,mxValue,arr[i],dp[i]);
    }
    for(int x: dp)ans = max(ans,x);
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 9544
import sys

n = int(input())
r0 = int(input())
r1 = int(input())
mx = r1 - r0
mn = min(r1, r0)

for i in map(int, sys.stdin.readlines()):
    if mx < i - mn:
        mx = i - mn
    if mn > i:
        mn = i

print(mx)

Measured memory_bytes: 23556
#include <stdio.h>
int main(void){
    // Your code here!
    int a[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            scanf("%d",&a[i][j]);
        }
    }
    int n;
    scanf("%d",&n);
    int b;
    for(int i=0;i<n;i++){
        scanf("%d",&b);
        
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
               if(a[i][j]==b){
                   a[i][j]=0;
               }
            }
        }
    }
    /*for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            printf("%d ",a[i][j]);
        }
        printf("\n");
    }*/
    
    int y=0;
    for(int i=0;i<3;i++){
        if(a[i][0]+a[i][1]+a[i][2]==0){
            y++;
        }
    }
    for(int i=0;i<3;i++){
        if(a[0][i]+a[1][i]+a[2][i]==0){
            y++;
        }
    }
    
    if(a[0][0]+a[1][1]+a[2][2]==0){
        y++;
    }
    if(a[0][2]+a[1][1]+a[2][0]==0){
        y++;
    }
    
    if(y){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}
template<typename T,typename U>
ll FindErase(T &v,U tar){
  ll cnt = 0;
  for(auto it = v.begin(); it != v.end();){
    if(*it == tar){
      it = v.erase(it);
      ++cnt;
    }
    else{
      ++it;
    }
  }
  return cnt;
}

template<typename T>
bool SuffixErase(T &v,size_t suf){
  if(suf > v.size()) return false;
  for(auto it = v.begin(); it != v.end();){
    if(distance(v.begin(),it) == suf){
      v.erase(it);
      return true;
    }
    else{
      ++it;
    }
  }
  return false;
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  bool r = 0,u = 0,d = 0,l = 0;
  cin >> s;
  rep(i,s.size()){
    if(s[i] == 'W'){
      l = true;
    }
    if(s[i] == 'E'){
      r = true;
    }
    if(s[i] == 'N'){
      u = true;
    }
    if(s[i] == 'S'){
      d = true;
    }
  }
  if(l == r && u == d) cout << "Yes" << endl;
  else cout << "No"<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
int main () {
    int n ;
    double m ;
    cin >> n >> m ;
    vector<double> vec (n);
    int tounter = 0;
    rep(i, n){
        cin >> vec[i];
    }
    int total = 0;
    rep(i,n){
        total += vec[i];
    }
    double num = total /(4*m);
    rep(i, n){
        if (vec[i] >= num){
            tounter++ ;
        }
    }
    if (tounter >= m){
    cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll X,Y;
string A="Alice";
string B="Brown";

ll memo[100][100];

int win(int x,int y) {
	if(x<=1 && y<=1) return 0;
	if(memo[x][y]==-1) {
		memo[x][y]=0;
		int i;
		for(i=2;i<=x;i+=2) if(win(x-i,y+i/2)==0) memo[x][y]=1;
		for(i=2;i<=y;i+=2) if(win(y-i,x+i/2)==0) memo[x][y]=1;
	}
	return memo[x][y];
	
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	MINUS(memo);
	
	for(i=1;i<=10;i++) {
		for(j=1;j<=10;j++) {
			//_P("%d %d %d\n",i,j,win(i,j));
		}
	}
	
	cin>>X>>Y;
	if(abs(X-Y)<=1) cout<<B<<endl;
	else cout<<A<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;
import java.util.Arrays;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String text = sc.nextLine();
    String[] words = text.split(" ");
    Arrays.sort(words);    
    String tmp="";
    String frequent_word="";
    String longest_word="";
    int count=0;
    int max_count=0;
    int len=0;
    int max_len=0;
    for(int i=0; i<words.length; i++) {
      if(tmp.equals(words[i])) {
        count++;
      }
      else {
        tmp = words[i];
	count=1;
      }

      if(max_count < count) {
        max_count = count;
	frequent_word = words[i];
      }
      if(max_len < words[i].length()) {
        longest_word=words[i];
	max_len = words[i].length();
      }
    }
    System.out.println(frequent_word+" "+longest_word);
  }
}

Measured memory_bytes: 25760
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (t1, t2) = get!(usize, usize);
    let (a1, a2) = get!(usize, usize);
    let (b1, b2) = get!(usize, usize);

    if a1*t1+a2*t2 == b1*t1+b2*t2 {
        println!("infinity");
        return;
    }

    let (s1,s2,l1,l2) = if a1*t1+a2*t2 > b1*t1+b2*t2 {
        (b1,b2,a1,a2)
    } else {
        (a1,a2,b1,b2)
    };

    if s1 < l1 {
        println!("0");
        return;
    } else if s1 == l1 {
        println!("infinity");
        return;
    }

    let margin = s1*t1 - l1*t1;
    let incr = l1*t1+l2*t2-(s1*t1+s2*t2);
    if margin % incr == 0 {
        println!("{}", 2*margin/incr);
    } else {
        println!("{}", margin/incr*2 + 1);
    }
}


Measured memory_bytes: 8572
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == '1') {
            ans++;
        }
    }
    cout << ans << endl;
}

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

#define int long long
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/

#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif


template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

#endif

#define mod 1000000007
typedef pair<int, int> P;
#define INF (1LL<<60)

void solve(){
    int H, W;
    cin >> H >> W;
    
    int h1 = (H+1)/2;
    int h2 = H - h1;
    int w1 = (W+1)/2;
    int w2 = W - w1;
    
    if(H==1) cout << 1 << endl;
    else if(W==1) cout << 1 << endl;
    else cout << h1 * w1 + h2 * w2 << endl;
    
}

signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<vector<int>>())

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
typedef std::pair<int, int> pii;
typedef std::pair<int, double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

#define PI 3.14159265358979323846264338327950L
const int mod = 1e9+7;


void solve(){
    string s;
    cin >> s;
    if (s.back()=='s'){
        cout << s + "es";
    }
    else cout << s + "s";
    
    
}




int main() {
    int T;
    
    T = 1;
    //cin >> T;
    
    while (T--) {
        solve();
        cout << endl;
    }
}




Measured memory_bytes: 3632
import scala.io.StdIn.readInt

object Main {
  def main(args: Array[String]) {
    dataSetOutput()
  }

  def dataSetOutput(n: Int = 1, i: Int = readInt()) {
    if(i != 0) {
      println(s"Case $n: $i")
      dataSetOutput(n + 1)
    }
  }
}

Measured memory_bytes: 54912
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
			   
		int cntNums[] = new int[3];		 
		 
		for(int i = 0; i <= 2; i++){
		    
			int inputNums = sc.nextInt();
		    cntNums[i] = inputNums;    
		 
		}
		
		System.out.println(cntNums[0]*cntNums[1]<cntNums[2]? cntNums[0]*cntNums[1] : cntNums[2]);
	}

}

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  bool acc = true;
  int k;
  for(int i=0;i < n;i++){
    cin>>k;
    if(k%2==0){
      if(k%3!=0 && k%5!=0){
        acc = false;
        break;
      }
    }
  }
  if(acc)
    cout<<"APPROVED\n";
  else
    cout << "DENIED\n";

  return 0;
}


Measured memory_bytes: 888