akhauriyash/Code-Regression huggingface dataset:
def main():
    h, w = map(int, input().split())
    print(min(solve(h, w), solve(w, h)))

def solve(h, w):
    m = float('inf')

    for i in range(1, h):
        a = i * w
        m = min(m, divide2(h - i, w, a))
    
    return m

def divide2(h, w, a):
    m = float('inf')
    
    if h >= 2:
        i = h // 2
        b = w * i
        c = w * (h - i)
        m = min(m, max(a, b, c) - min(a, b, c))
    
    if w >= 2:
        i = w // 2
        b = h * i
        c = h * (w - i)
        m = min(m, max(a, b, c) - min(a, b, c))
    
    return m

main()


Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

#define INF 100000000000L

int main() {

	std::string S;

	int N, count = 0;

	std::cin >> S;
	N = S.size();

	for (int i = 0; i < N; i++) {
		if (S[i] == '0') {
			count += 1;
		}
	
	}

	count = (N - count < count ? N - count : count) * 2;

	std::cout << count << std::endl;

	return 0;

}

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

int main() {
	int N, M;
	scanf("%d %d",&N, &M);
	int student_x[N];
	int student_y[N];
	for (int i=0; i<N; i++) {
		scanf("%d %d",&student_x[i],&student_y[i]);
	}
	int checkpoint_x[M];
	int checkpoint_y[M];
	for (int i=0; i<M; i++) {
		scanf("%d %d",&checkpoint_x[i], &checkpoint_y[i]);
	}

	for (int i=0; i<N; i++) {
		long max = 1000000000;
		int nearest = -1;
		for (int j=0; j<M; j++) {
			long manhattan_distance = abs(student_x[i]-checkpoint_x[j])+abs(student_y[i]-checkpoint_y[j]);
			if (manhattan_distance < max) {
				max = manhattan_distance;
				nearest = j;
			}
		}
		printf("%d\n",nearest+1);
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if((a%2==0&&b%2==0)||(a%2==1&&b%2==1)) {
        cout << (a+b)/2 << endl;
        return 0;
    } else {
        cout << (a+b)/2+1 << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>

typedef long long ll;

using namespace std;

int main(void) {
  int n; cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) { cin >> a[i]; }

  ll ans1 = 0, sum1 = 0;
  // even -> +: +1 -1 +1 -1
  for (int i = 0; i < n; i++) {
    sum1 += a[i];
    if (i % 2 == 0 && sum1 <= 0) {
      ans1 += 1 - sum1;
      sum1 = 1;
    } else if (i % 2 == 1 && sum1 >= 0) {
      ans1 += sum1 + 1;
      sum1 = -1;
    }
  }

  // odd -> +: -1 +1 -1 +1
  ll ans2 = 0, sum2 = 0;
  for (int i = 0; i < n; i++) {
    sum2 += a[i];
    if (i % 2 == 1 && sum2 <= 0) {
      ans2 += 1 - sum2;
      sum2 = 1;
    } else if (i % 2 == 0 && sum2 >= 0) {
      ans2 += sum2 + 1;
      sum2 = -1;
    }
  }

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


Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    int flag=1,i,j,N,cnt=0;
    
    //scanf N
    Scanner scan = new Scanner(System.in);
    N = scan.nextInt();
    
    //making array
    int[] A;
    A = new int[N];
    
    //complete array
    for(i=0;i<N;i++){
      A[i] = scan.nextInt();
    }
    
    //bubbling 
    while(flag==1){
      flag = 0;
      for(j=N-1;j>0;j--){
        if(A[j]<A[j-1]){
          int swap = A[j];
          A[j] = A[j-1];
          A[j-1] = swap;
          cnt++; //count
          flag = 1; //to be continue
        }
      }
    }
    
    for(i=0;i<N-1;i++){
      System.out.print(A[i] + " ");
    }
    System.out.println(A[i]);
    System.out.println(cnt);

  }
}

Measured memory_bytes: 26240
#include<bits/stdc++.h>
using namespace std;
struct point{
	int x,y;
}p[90010];
int h,w,m=300,cnt,a[610][610],r[610][610],c[610][610];
long long ans;
int main()
{
	scanf("%d%d",&h,&w);
	for (int i=1;i<=h;i++)
	{
		char str[310];
		scanf("%s",str+1);
		for (int j=1;j<=w;j++)
		{
			if (str[j]=='#')
			{
				int x=i+j-1,y=i-j+m;
				p[cnt++]=(point){x,y};
				a[x][y]=1;
			}
		}
	}
	m*=2;
	for (int i=1;i<=m;i++)
	{
		for (int j=1;j<=m;j++)
		{
			r[i][j]=r[i][j-1]+a[i][j];
			c[i][j]=c[i-1][j]+a[i][j];
		}
	}
	for (int i=0;i<cnt;i++)
	{
		int x=p[i].x;
		int y=p[i].y;
		for (int d=2;d<=m;d+=2)
		{
			if (y+d<=m && a[x][y+d])
			{
				if (x+d<=m)
				{
					ans+=r[x+d][y+d]-r[x+d][y-1];
				}
				if (x-d>0)
				{
					ans+=r[x-d][y+d]-r[x-d][y-1];
				}
			}
			if (x+d<=m && a[x+d][y])
			{
				if (y+d<=m)
				{
					ans+=c[x+d-1][y+d]-c[x][y+d];
				}
				if (y-d>0)
				{
					ans+=c[x+d-1][y-d]-c[x][y-d];
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 5248
#include <stdio.h>
#include <ctype.h>

int main()
{
	char s1[11] = { '\0' };
	char s2[11] = { '\0' };
	char s3[11] = { '\0' };

	scanf("%s %s %s", s1, s2, s3);

	printf("%c%c%c", toupper(s1[0]), toupper(s2[0]), toupper(s3[0]));

	return 0;
}

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

ll dp[100005];
const int MOD = 1e9+7;

int main(){
    int n,m;
    cin>>n>>m;
    dp[0]=1;
    rep(i,m){
        int a;
        cin>>a;
        dp[a]=-1;
    }
    
    rep(i,n){
        if(dp[i]==-1) continue;
        dp[i+1]+=(dp[i+1]==-1? 0:dp[i]);
        dp[i+2]+=(dp[i+2]==-1? 0:dp[i]);
        dp[i+1]%=MOD;
        dp[i+2]%=MOD;
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
int main(){
    char c;
    std::cin >> c;
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
        std::cout << "vowel" << std::endl;
    }
    else{
        std::cout << "consonant" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)



int main(){
    int n,res = 0; cin >> n;
    for(int i = 1; i <= n; i+=2){
        int divisors = 0;
        rep(j,i+1){
            if(j==0)continue;
            if(i%j == 0)divisors++;
        }
        if(divisors == 8)res++;
    }
    cout << res <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define INF 1000000000
ll i,j,k,p;

int main(){
    int n;cin>>n;
    vector<int> p(n);
    for(i=0;i<n;i++){cin>>p[i];}

    int small=p[0];
    int ans=1;
    for(i=1;i<n;i++){
        if(small>p[i]){
            small=p[i];
            ans++;
        }
    }

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

Measured memory_bytes: 1024
s = input().strip()
t = input().strip()

candidates = []
for i in range(len(s) - len(t) + 1):
    tfr = i
    tto = i + len(t)
    u = ''
    ok = True
    for p in range(len(s)):
        if tfr <= p < tto:
            if s[p] in ['?', t[p - i]]:
                u += t[p - i]
            else:
                ok = False
                break
        else:
            if s[p] == '?':
                u += 'a'
            else:
                u += s[p]
    if ok:
        candidates.append(u)

if candidates:
    print(min(candidates))
else:
    print("UNRESTORABLE")

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

const long long MOD = 1e9+7;

int main(){
  string S;
  cin >> S;
  int n = S.size();
  vector<vector<long long>> dp(n+1,vector<long long>(13,0));
  dp[0][0] = 1;
  for (int i=0; i<n; i++){
    int c;
    if (S[i] == '?') c = -1;
    else c = S[i] - '0';
    for (int j=0; j<=9; j++){
      if (c != -1 && c != j) continue;
      for (int k=0; k<13; k++){
        dp[i+1][(10*k+j)%13] += dp[i][k];
      }
    }
    for (int j=0; j<13; j++) dp[i+1][j] %= MOD;
  }
  cout << dp[n][5] << endl;
}


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


using namespace std;

int main() {

	int N;
	cin >> N;
	vector<int> P(N);
	int min = 2000000,count=0;
	for (int i = 0; i < N; i++) {
		cin >> P[i];
		if (min > P[i]) {
			min = P[i];
			count++;
		}

	}

	cout << count;
	return 0;



}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
#define ms(x,y) memset(x, y, sizeof(x))
#define lowbit(x) ((x)&(-x))
#define sqr(x) ((x)*(x))
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
#define endl "\n";


const int maxn = 2e5+5;
const int MOD = 998244353;
LL F[maxn], inv[maxn], Finv[maxn];

void init() {
    inv[1] = 1;
    for(int i = 2; i < maxn; ++i) {
        inv[i] = (MOD - MOD / i) * 1LL * inv[MOD % i] % MOD; 
    }
    F[0] = Finv[0] = 1;
    for(int i = 1; i < maxn; i ++){
        F[i] = F[i-1] * 1LL * i % MOD;
        Finv[i] = Finv[i-1] * 1LL * inv[i] % MOD;
    }
}

LL comb(int n, int m){   //comb(n, m) C(n, m) 
    if(m < 0 || m > n) return 0;
    return F[n] * 1LL * Finv[n - m] % MOD * Finv[m] % MOD;
}

LL poww(LL a, LL b) {
    LL ret = 1;
    while(b) {
        if(b&1) ret = 1LL*ret*a%MOD;
        a = 1LL*a*a%MOD;
        b >>= 1;
    }
    return ret;
}

void run_case() {
    int n, m, k;
    cin >> n >> m >> k;
    init();
    LL ans = 0;
    for(int i = 0; i <= k; ++i) {
        LL tmp = 1LL*m*comb(n-1,i)%MOD*poww(m-1, n-1-i)%MOD;
        ans = (ans + tmp) % MOD;
    }
    cout << ans;
}


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cout.flags(ios::fixed);cout.precision(9);
    //int t; cin >> t;
    //while(t--)
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 7868
/**
 *  Author : Parth Prajapati aka (PARTH_4399, hungry_chef)
 *  Institute : Pandit Deendayal Petroleum University
 **/
#include <bits/stdc++.h>

using namespace std;

void solve()
{
    long long x, k, d, ans;
    cin >> x >> k >> d;
    long long moves = (abs(x)) / d;
    if (k <= moves)
    {
        if (x < 0)
        {
            x += (k * d);
            ans = abs(x);
        }
        else
        {
            x -= (k * d);
            ans = x;
        }
    }
    else
    {
        if (x > 0)
            x *= -1;
        long long n1 = x + (moves * d);
        long long n2 = n1 + d;
        k -= moves;
        if (k & 1)
        {
            ans = abs(n2);
        }
        else
        {
            ans = abs(n1);
        }
    }
    cout << ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
    return 0;
}

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

int main() {
    string word;
    int a[3];
    int seven=1,five=2;
    for(int i=0; i<3;i++){
        cin >> a[i];
        if(a[i]==7){
            seven--;
        }else if(a[i]==5){
            five--;
        }
    }
        if(seven==0&&five==0){
            cout << "YES" << word << endl;
        }else
        {
            cout << "NO" << word << endl;
        }
    return 0;
}


Measured memory_bytes: 256
//
// Created by Mahmoud Rashad on 11/27/19.
//

#include <bits/stdc++.h>


using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<ii, ii>> vii;

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.out", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10), cout << fixed;


    int n, m;
    cin >> n >> m;
    long long lcm = 1;
    int two = -1;
    for (int i = 0; i < n; ++i) {
        long long x;
        cin >> x;
        x /= 2;
        lcm = lcm * x / __gcd(lcm, x);
        int cnt = 0;
        while (x % 2 == 0) {
            ++cnt;
            x /= 2;
        }
        if (lcm > m || (two != -1 && cnt != two)) {
            cout << 0 << '\n';
            return 0;
        }
        two = cnt;
    }
    cout << (m / lcm + 1) / 2  << '\n';
    return 0;
}

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

int main() {
	int num[100] = {};
	int n;
	while (cin >> n) {
		num[n - 1]++;
	}
	int max = 0;
	for (int i = 0; i < 100; i++) {
		if (num[i] > max) max = num[i];
	}
	for (int i = 0; i < 100; i++) {
		if (num[i] == max) cout << i + 1 << endl;
	}
}


Measured memory_bytes: 3080
#include <stdio.h>

#define NMAX 110

int A[NMAX]; // preorder seq
int B[NMAX]; // inorder seq
int k = 0;   // A[k] is the root of B[l:r), why?
int n;

void solve(int l, int r) {
    // range: [l, r)
    if (r - l <= 0) {
        return;
    }
    int m = 0, root = A[k++];
    while (B[m] != root)
        m++;
    solve(l, m);
    solve(m + 1, r);
    printf("%d", root);
    if (root == A[0]) {
        printf("\n");
    } else {
        printf(" ");
    }
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }
    for (int i = 0; i < n; i++) {
        scanf("%d", &B[i]);
    }
    solve(0, n);
    return 0;
}


Measured memory_bytes: 2756
h,w = map(int,input().split())
lis = [list(input()) for i in range(h)]

dx = [-1, 0, 1,-1, 1,-1, 0, 1]
dy = [-1,-1,-1, 0, 0, 1, 1, 1]

for i in range(h):
    for j in range(w):
        count = 0
        if lis[i][j] != "#":
            for k in range(8):
                nx = j + dx[k]
                ny = i + dy[k]
                if nx >= 0 and ny >= 0 and ny < h and nx < w:
                    if lis[ny][nx] == "#":
                        count += 1    
            lis[i][j] = str(count)
for ans in lis:
    print("".join(ans))

Measured memory_bytes: 3188
#include<iostream>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
  string s;
  cin>>s;
  int ans=0,sum=0;
  rep(i,s.size())sum+=(s[i]-'0');
  ans+=(s.size()-1)*9;
  ans+=(s[0]-'0'-1>0)?s[0]-'0'-1:0;
  cout<<max(ans,sum)<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
A,B = map(int, input().split())
akikuti =A
ans =1

if(B ==1):
    ans = 0
    print(ans)
elif (akikuti >= B ):
    print(ans)
    
else:
    
    for i in range(1000):
        akikuti += A-1
        ans +=1
        if(akikuti >=B):
            print(ans)
            sys.exit()
        else:
            continue
    

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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = (long long)1e9 + 7;

int main(){
    int n, m, ans = 0;
    cin >> n >> m;
    vector<vector<int>> e(n);
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        e[a].emplace_back(b);
        e[b].emplace_back(a);
    }
    vector<int> nx(n, -1);
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int t = q.front();
        q.pop();
        for(auto&& i : e[t]){
            if(nx[i] != -1){
                continue;
            }
            nx[i] = t;
            q.push(i);
        }
    }
    bool f = true;
    for(int i = 1; i < n; i++){
        if(nx[i] == -1){
            f = false;
            break;
        }
    }
    if(f){
        cout << "Yes" << endl;
        for(int i = 1; i < n; i++){
            cout << nx[i] + 1 << endl;
        }
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 10100
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

import math
import decimal

ctx = decimal.Context(prec=3, rounding=decimal.ROUND_CEILING)

for i in range(int(input())):
    a, b, c, d = map(int, input().split())

    if a < b:
        print('No')
        continue

    if b > d:
        print('No')
        continue

    if c >= b:
        print('Yes')
        continue

    g = gcd(b, d)
    r = a % g
    # FYI: https://stackoverflow.com/questions/2795946/getting-ceil-of-decimal-in-python
    _max = (int(((decimal.Decimal(b, context=ctx) - decimal.Decimal(r, context=ctx)) / decimal.Decimal(g, context=ctx)).to_integral_exact(context=ctx)) * g) + r - g

    # math.ceilは精度不足でエラーになる: https://cocoinit23.com/math-floor-ceil-error/
    #_max = ((math.ceil((b - r) / g)) * g) + r - g

    # OK: (a + b - 1) // b: https://nariagari-igakusei.com/cpp-division-round-up/
    #_max = ((b - r + g - 1)//g) * g + r - g
    if c < _max:
        print('No')
    else:
        print('Yes')


Measured memory_bytes: 79224
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <functional>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  int n;
  cin >> n;
  vector<ll> a(n+1);
  for(int i = 0;i < n;i++)cin >> a[i];

  for(int i = 0;i < n-1;i++)a[i+1] = a[i+1] + a[i];

  map<ll,ll> cnt;

  for(int i = 0;i < n;i++)cnt[a[i]]++;


  ll ans = 0;

  for(auto p:cnt){
    if(p.first == 0)ans += p.second + p.second * (p.second - 1)/2; 
    else ans += p.second * (p.second - 1)/2;
  }


  cout << ans << endl;

} 

Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define F first
#define S second
//cout<<fixed<<setprecision(11);
const string nl="\n";
const ll MOD=1e9+7;
const ll ARR_MAX = 1e5+1;
const ll VAL_MAX = 1e5+1;
const ll INF=1e14;

void solve(){
    int n;cin>>n;
    int a[n];
    int k=0;
    for(int i=0;i<n;i++){
    	cin>>a[i];
    	if(a[i]==k+1){
    		k++;
    	}
    }
    if(k==0){
    	cout<<-1<<nl;
    	return;
    }
    cout<<n-k<<nl;
}

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

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


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

    vector<string> s(3);
    rep(i, 3) cin >> s[i];
    rep(i, 3) reverse(all(s[i]));
    int i = 0, j;
    while (true) {
        int l = s[i].size();
        j = i;
        if (s[j].empty()) break;
        if (s[i].back() == 'a') i = 0;
        else if (s[i].back() == 'b') i = 1;
        else i = 2;
        s[j].erase(l-1);
    }
    cout << char('A' + j) << endl;
    return 0;

}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 28 21:05:47 2020

@author: H_Hoshigi
"""

K, N = map(int, input().split())
A_list = list(map(int, input().split()))

A_list.append(A_list[0]+K)
#A_listは入力の時点で昇順にソートされている。

dA_list = [A_list[i+1]-A_list[i] for i in range(N)]

print(K-max(dA_list))



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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
 
typedef long long ll;
using namespace std;
 
int main(){
  string s,t;
  cin >> s >> t;

  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());

  if(s < t) printf("Yes\n");
  else printf("No\n");
  return 0;
}

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

typedef long long ll;

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

    int n; cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    bool ok = false;
    int cnt,ans = 0;
    int uku = 0;
    for(int i=0;i<n;i++){
        if(a[i]%2==0) uku++;
    }
    if(uku==n) ok = true;
    while(ok){
        cnt = 0;
        for(int i=0;i<n;i++){
            if(a[i]%2==0) cnt++;
        }
        if(cnt==n){
            for(int i=0;i<n;i++) a[i] /= 2;
            ans++;
        }else{
            ok = false;
        }
    }
    cout << ans << endl;
    return 0;
}

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

Measured memory_bytes: 128
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int n, b, c;
vector<int> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> b>>c;
  	if(b%2==0){
      return no,0;
    }
  	if(c%2==0){
      return no,0;
    }
    yes;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    ll N,K; cin >> N >> K;
    if(K%2 != 0) cout << N/K*(N/K)*(N/K) << endl;
    else {
        ll cnt = 0;
        for(ll i = 1; i <= N; i++) {
            if(i%K == K/2) cnt++;
        }
        cout << (N/K)*(N/K)*(N/K) + cnt*cnt*cnt << endl;
    }
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	int n;cin >> n;
	int a = n / 100;
	int b = n % 100;

	bool yymm = (b > 0 && b <= 12);
	bool mmyy = (a > 0 && a <= 12);

	if(yymm && mmyy){
		cout << "AMBIGUOUS" << endl;
	}
	else if(yymm){
		cout << "YYMM" << endl;
	}
	else if(mmyy){
		cout << "MMYY" << endl;
	}
	else {
		cout << "NA" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A, B = [], []
    for ix in range(N):
        a, b = LI()
        A.append(a)
        B.append((ix, b))
    B = sorted(B, key=lambda x: x[1])
    cur_t = 0
    ans = "Yes"
    for b in B:
        ix, b_dead = b
        cur_t += A[ix]
        if cur_t > b_dead:
            ans = "No"
            break
    print(ans)

main()



Measured memory_bytes: 43748
#include<bits/stdc++.h>
 using namespace std;
 const long double PI = acos(-1);
 
 int main(){
 	int A,B,H,M;
 	//入力受け取り
 	cin >> A >> B >> H >> M;
 	long double theta_H=0,theta_M=0;
 	long double Hx=0,Hy=0;
 	long double Mx=0,My=0;
 	long double dx=0,dy=0;
 	//角度を求める
 	theta_M = (long double)(M/60.0)*2*PI;
 	theta_H = ((long double)(H/12.0)+(long double)(M/60.0)/12.0)*2*PI;
 	//座標を求める
 	Hx=(A*cos(theta_H)); Hy=(A*sin(theta_H));
 	Mx=(B*cos(theta_M)); My=(B*sin(theta_M));
 	//座標間の差を求める
 	dx=(Hx-Mx);dy=(Hy-My);
 	//ユークリッド距離を求める
 	long double ans=sqrt(dx*dx+dy*dy);
 	
 	cout << fixed << setprecision(20);
 	cout << ans << "\n";
 }

Measured memory_bytes: 4172
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

const int MAX_ROW = 210; // to be set appropriately
const int MAX_COL = 60;  // to be set appropriately
struct BitMatrix {
    int H, W;
    bitset<MAX_COL> val[MAX_ROW];
    BitMatrix(int m = 1, int n = 1) : H(m), W(n) {}
    inline bitset<MAX_COL> &operator[](int i) { return val[i]; }
};

int GaussJordan(BitMatrix &A) {
    int rank = 0;
    for(int col = A.W - 1; col >= 0; --col) {
        int pivot = -1;
        for(int row = rank; row < A.H; ++row) {
            if(A[row][col]) {
                pivot = row;
                break;
            }
        }
        if(pivot == -1) continue;
        swap(A[pivot], A[rank]);
        for(int row = 0; row < A.H; ++row) {
            if(row != rank && A[row][col]) A[row] ^= A[rank];
        }
        ++rank;
    }
    return rank;
}

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

    int t;
    cin >> t;
    while(t--) {
        int n;
        cin >> n;
        vector<ll> a(n);
        rep(i, n) cin >> a[i];
        string s;
        cin >> s;
        vector<ll> x;
        FORR(i, n) {
            if(s[i] == '0') x.push_back(a[i]);
            if(s[i] == '1') {
                ll y = a[i];
                BitMatrix M(x.size(), 60);
                rep(j, x.size()) M[j] = x[j];
                int r = GaussJordan(M);
                rep(j, r) {
                    ll z = ll(M[j].to_ullong());
                    if((y ^ z) < y) y ^= z;
                }
                if(y != 0) {
                    cout << 1 << "\n";
                    goto x;
                }
            }
        }
        cout << 0 << "\n";
    x:;
    }
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  ll k;
  cin >> k;
  ll m[1000001];
  m[0] = 7 % k;
  REP(i, 1000000) {
    if (i != 0) {
      m[i] = (m[i - 1] * 10 + 7) % k;
    }
    if (m[i] == 0) {
      cout << i+1 << "\n";
      return 0;
    }
  }
  cout << -1 << "\n";
  return 0;
}


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

int main(){
  int N,M;
  cin >>N>>M;
  
  map<int,int> mp;
  rep(i,N)mp[i+1]=0;
  
  int p,ac=0,wa=0;
  string s;

  rep(i,M){
    cin >> p >> s;
    if(!mp.count(p))continue;
    if(s=="WA")mp[p] ++;
    else {
      wa += mp[p];
      ac ++;
      mp.erase(p);
    }    
  }
   cout << ac <<" " << wa;
}

Measured memory_bytes: 4992
function main(input) {
  var inputs = input.split("\n");
  var N = Number(inputs[0].split(" ")[0]);
  var A = Number(inputs[0].split(" ")[1]);
  var B = Number(inputs[0].split(" ")[2]);
  var C = Number(inputs[0].split(" ")[3]);

  var sticks = inputs.filter((v,i)=>i>0).map(v=>Number(v));

  var ans = Number.MAX_VALUE;
  var patterns = rekkyo(N);
  for(var i=0;i<patterns.length;i++){
    var pattern = patterns[i];
    if(pattern.indexOf("1")>=0 && pattern.indexOf("2")>=0 && pattern.indexOf("0")>=0)
      ans = Math.min(ans, calc(sticks, pattern, [A,B,C], ans));
  }
  console.log(ans);
}

function rekkyo(n){
  var arr = [];
  var mask = "";
  for(var i=0;i<n;i++) mask += "0";
  for(var i=0;i<Math.pow(4, n);i++){
    arr.push((mask+i.toString(4)).slice(-n));
  }
  return arr;
}
function calc(sticks, pattern, ansSet, min){
  var ans = 0;
  var Lens = [0,0,0,0]; // A,B,C,使わない
  for(var i=0;i<pattern.length;i++){
    if(pattern[i]-0<3 && Lens[pattern[i]-0]>0) ans += 10;
    if(pattern[i]-0<3) Lens[pattern[i]-0] += sticks[i];
    if(min<ans) return ans;
  }
  if(min<ans) return ans;
  for(var i=0;i<ansSet.length;i++){
    ans += Math.abs(ansSet[i]-Lens[i]);
    if(min<ans) return ans;
  }
  return ans;
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 20260
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    private int getNextOrderTime(int time) {
        return time + ((10 - time % 10) % 10);
    }

    public int calc(List<Integer> A, List<Integer> C, int min) {
        if (C.size() == 5) {
            min = Math.min(min, simulate(C));
            return min;
        }

        for (int i = 0; i < A.size(); i++) {
            List<Integer> a = new LinkedList<>(A);
            List<Integer> l = new LinkedList<>(C);
            int v = a.get(i);
            a.remove(i);
            l.add(v);
            min = Math.min(min, calc(a, l, min));
        }
        return min;
    }

    public int simulate(List<Integer> A) {
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int time = A.get(i);
            if (i == 4) {
                sum += time;
            } else {
                sum += getNextOrderTime(time);
            }
        }
        return sum;
    }

    public void run() {
        Scanner sc = new Scanner(System.in);
        List<Integer> A = new LinkedList<Integer>();
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());

        int min = calc(A, new LinkedList<Integer>(), Integer.MAX_VALUE);
        System.out.println(min);

        return;
    }

}


Measured memory_bytes: 21844
#include <stdio.h>

int main()
{

    char s[6];
    scanf("%s", s);
    
    if(s[2]==s[3] && s[4]==s[5]){
    	puts("Yes");
	}
	else{
		puts("No");
	}
    
    
	
	
	
	return 0;
} 

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

int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    int k;
    int res=0;
    cin >> k;
 
    for (int l=1;l<=k;l++){
        for (int m=1;m<=k;m++){
            for (int n=1;n<=k;n++){
                res+=gcd(l,gcd(m,n));
            }
        }
    }
    cout << res << endl;
    
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#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++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;

int main()
{

  int a,b,k;
  cin >> a >> b >> k;
  int ans, t = 0;
  int n = min(a, b);
  for(n; n > 0; n--){
    if(a % (n) == 0 && b % (n) == 0) {
      t++;
      if (t == k){
        ans = n;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define DEBUG(x) cerr << #x << " = " << x << endl
signed main() {
  int N, M; cin >> N >> M;
  vector<bool> cand(N, false);
  vector<int> num(N, 1);
  cand[0] = true;
  REP(i,M) {
    int x, y; cin >> x >> y;
    x--; y--;
    if(num[x] == 1) {
      if(cand[x]) {
        num[x]--;
        cand[x] = false;
        num[y]++;
        cand[y] = true;
      }
      else {
        num[x]--;
        num[y]++;
      }
    }
    else {
      if(cand[x]) {
        num[x]--;
        num[y]++;
        cand[y] = true;
      }
      else {
        num[x]--;
        num[y]++;
      }
    }
  }
  int ans = 0;
  REP(i,N) {
    if(cand[i]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define repi(i, a, b) for(int i=(a); i>(b); i--)
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define ll long long
#define gcd __gcd
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll, ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvi vector<vi>
#define fi first
#define se second
#define umap unordered_map
#define uset unordered_set
#define pqueue priority_queue
#define si(a) scanf("%d", &a)
#define sll(a) scanf("%lld", &a)
#define bitcount(x) __builtin_popcount(x)
#define cps CLOCKS_PER_SEC
#define PI acos(-1.0)
#define EPS 1e-9
#define mod 1000000007
#define MOD 1000000007
#define N 300005
using namespace std;

template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

template<typename T>
using maxpq = priority_queue<T>;

//All indexing is 0-based
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
       tree_order_statistics_node_update> ordered_set;
//methods: find_by_order(k); & order_of_key(k);
//To make it an ordered_multiset, use pairs of (value, time_of_insertion)
//to distinguish values which are similar.

//a and b are assumed to be taken modulo p
inline int add(int a, int b, int p = mod){ int c = a + b; if(c >= p) c -= p; return c;}
inline int sub(int a, int b, int p = mod){ int c = a - b; if(c < 0) c += p; return c;}
inline int mul(int a, int b, int p = mod){ return (a * 1ll * b) % p;}

int n, m;
string s;
vi adj[N];
int ar[N][2];
bitset<N> exists;

int main()
{ 
  #ifdef CP
    freopen("/home/tarun/Desktop/input.txt", "r", stdin);
    //freopen("/home/tarun/Desktop/output.txt", "w", stdout);
  #endif
  sync;
  clock_t clk = clock();
  cerr << "I will return...\n";

  cin >> n >> m >> s;
  for(char &c : s) c = tolower(c);
  rep(i, 0, n) exists[i] = 1;
  rep(i, 0, m) {
    int u, v; cin >> u >> v;
    u--, v--;
    adj[u].pb(v);
    adj[v].pb(u);
    ar[u][s[v] - 'a']++;
    ar[v][s[u] - 'a']++;
  }

  queue<int> q;

  rep(i, 0, n) {
    if(ar[i][0] == 0 || ar[i][1] == 0) {
      q.push(i);
      exists[i] = 0;
    }
  }

  while(!q.empty()) {
    int i = q.front();
    q.pop();

    for(int j : adj[i]) {
      ar[j][s[i] - 'a']--;
      if(ar[j][s[i] - 'a'] == 0) {
        if(exists[j]) {
          exists[j] = 0;
          q.push(j);
        }
      }
    }
  }

  rep(i, 0, n) {
    if(exists[i]) {
      cout << "Yes\n";
      return 0;
    }
  }

  cout << "No\n";
 
  cerr << "...don't you ever hang your head.\n";
  cerr << "Time (in ms): " << double(clock() - clk) * 1000.0 / cps << '\n';
}

//Compile using:
//g++ -o filename.exe --std=c++11 filename.cpp
//Use -D CP for defining a macro CP in the local environment







Measured memory_bytes: 15056
n, c, k = gets.chomp.split(" ").map(&:to_i)

tt = []
n.times do
  tt << gets.chomp.to_i
end

tt.sort!

bus = 0
cap = c
lim = 0
n.times do |i|
  
  if cap == c
    bus += 1
    cap -= 1
    lim = tt[i] + k
  elsif cap > 0
    if tt[i] <= lim
      cap -= 1
    else
      bus += 1
      cap = c - 1
      lim = tt[i] + k
    end
  else
    bus += 1
    cap = c - 1
    lim = tt[i] + k
  end
  # p [tt[i], bus, cap, lim]
end

puts bus

Measured memory_bytes: 3704
package main

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

func main() {
	H, W := ReadInt(), ReadInt()
	ans := H * W

	for h := 1; h < H; h++ {
		a := H - h
		b := W
		v1 := h * W
		v2, v3 := s(a, b)
		x, y := MinMax(v1, v2, v3)

		ans = Min(ans, y-x)
		if ans == 0 {
			fmt.Println(0)
			return
		}
	}

	for w := 1; w < W; w++ {
		a := H
		b := W - w
		v1 := H * w
		v2, v3 := s(a, b)
		x, y := MinMax(v1, v2, v3)

		ans = Min(ans, y-x)
		if ans == 0 {
			fmt.Println(0)
			return
		}
	}

	fmt.Println(ans)
}

func Min(xs ...int) int {
	min := xs[0]
	for _, x := range xs[1:] {
		if min > x {
			min = x
		}
	}
	return min
}

func s(a, b int) (int, int) {
	if a%2 == 0 || b%2 == 0 {
		c := a * b
		return c / 2, c / 2
	}
	a, b = MinMax(a, b)
	x := b / 2
	y := b - x
	return a * x, a * y
}

func MinMax(slice ...int) (int, int) {
	min, max := slice[0], slice[0]
	for _, v := range slice[1:] {
		if min > v {
			min = v
		} else if max < v {
			max = v
		}
	}
	return min, max
}

var sc = bufio.NewScanner(os.Stdin)

func init()        { sc.Buffer(make([]byte, 256), 1e9); sc.Split(bufio.ScanWords) }
func Read() string { sc.Scan(); return sc.Text() }

func ReadInt() int {
	v, e := strconv.Atoi(Read())
	if e != nil {
		panic(e.Error())
	}
	return v
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
    int n;
    cin >> n;
    cout << 24*2-n << endl;
    return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	N := nextInt()
	K := nextInt()

	c := 0

	for i := 0; i < N; i++ {
		h := nextInt()

		if h >= K {
			c++
		}
	}
	fmt.Println(c)
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

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

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define MOD 1000000007

int main() {
	int N, K, i;
	double ans = 0;
	scanf("%d%d", &N, &K);
  int d[N];
	double n=N,k = K;
	for (i = 1; i <= N; i++) {
		d[i] = log2(k / i)+0.99999999999999;
    if(d[i]<0)d[i]=0;
		ans += pow(0.5, d[i]) /n ;
	}

	printf("%.12f\n", ans);
	return 0;
}


Measured memory_bytes: 512
S = str(input())

for k in range(len(S)-1):
    if S[k] == S[k+1]:
        print(k+1,k+2)
        exit()

for k in range(len(S)-2):
    if S[k] == S[k+2]:
        print(k+1,k+3)
        exit()

print(-1,-1)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,N;
  0<=A<=1000;
  1<=N<=10000;
  cin>>N>>A;
  if(A>=(N%500)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
    
  

     

  


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];

  int all = 1, all_odd = 1;
  for (int i = 0; i < N; i++) all *= 3;
  for (int i = 0; i < N; i++) if (A[i] % 2 == 0) all_odd *= 2;

  cout << all - all_odd << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    private static final Scanner scan = new Scanner(System.in);

    public static void main(String[] args){

        int N = scan.nextInt();
        int[] arr = new int[N];
        for(int i = 0; i < N; i++){
            int num = scan.nextInt();
            arr[i] = num;
        }

        for(int i = 0; i < N; i++){
            if(i != N - 1){
                System.out.printf("%d ", arr[i]);
            } else{
                System.out.printf("%d\n", arr[i]);
            }
        }

        for(int i = 1; i < N; i++){
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v){
                arr[j + 1] = arr[j];
                j--;
                arr[j + 1] = v;
            }
            for(int k = 0; k < N; k++){
                if(k != N - 1){
                    System.out.printf("%d ", arr[k]);
                } else{
                    System.out.printf("%d\n", arr[k]);
                }
            }
        }
    }
}

Measured memory_bytes: 44620
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

        String s = in.nextLine();
        long k = in.nextLong();

        int firstNonOne = 0;
        char firstNonOn = '1';
        for (int i=0; i<s.length(); i++) {
            if (s.charAt(i) != '1') {
                firstNonOne = i;
                firstNonOn = s.charAt(i);
                break;
            }
        }
        if (k - 1 >= firstNonOne) {
            out.println(firstNonOn);
        } else {
            out.println(1);
        }
        out.close();
        //INT OVERFLOW -> USE LONG
        //ARR OUT OF BOUNDS
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

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

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        public double[] nextDoubleArray(int n) {
            double[] arr = new double[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextDouble();
            }
            return arr;
        }

        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        public char[] nextCharArray(int n) {
            char[] arr = nextLine().trim().replaceAll("\\s", "").toCharArray();
            return arr;
        }

        public String[] nextStringArray(int n) {
            String[] arr = new String[n];
            for (int i = 0; i < n; i++) {
                arr[i] = next();
            }
            return arr;
        }
    }
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
  string S;
  cin >> S;

  bool bad = false;
  for(string::iterator it = S.begin(); it != S.end(); it++) {
    if (it == S.begin()) continue;

    if (*it == *(it - 1)) {
      bad = true;
      break;
    }
  }
  if (bad) {
    cout << "Bad";
  } else {
    cout << "Good";
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 256