akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  int n,k;
  cin >> n >> k;
  ll a[n],b[n];
  rep(i,n) cin >> a[i] >> b[i];

  int c=0;
  ll ans=0;
  for(int i=30;i>=0;i--){
    if((1<<i) & k){
      ll tans=0;
      int nc = c |(1<<i);
      rep(j,n){
	if((a[j]|c) < nc){
	  tans+=b[j];
	}
      }
      ans=max(tans,ans);
      c=nc;
      //      cout << bitset<30>(c) << endl;
    }
    if(i==0){
      ll tans=0;
      rep(j,n){
	if((a[j]|c) <= c){
          tans+=b[j];
	}
      } 
      ans=max(tans,ans);      
    }
  }
  cout << ans << endl;


  
  return 0;
    

}


Measured memory_bytes: 1792
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (size_t i = 0; i < size_t(n); i++)
#define forn1(i,n) for (size_t i = 1; i <= size_t(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

struct UnionFind {
    typedef vector<int> vi;
    int n;
    vi par, rank, cnt;

    UnionFind(int n)
        : n(n), par(n), rank(n, 0), cnt(n, 1) {
        for (int i = 0; i < n; i++) par[i] = i;
    }

    int find(int a) {
        if (par[a] == a) return a;
        return par[a] = find(par[a]);
    }

    void unite(int a, int b) {
        a = find(a);
        b = find(b);

        if (a == b) return;
        if (rank[a] < rank[b]) {
            par[a] = b;
            cnt[b] += cnt[a];
        } else {
            par[b] = a;
            cnt[a] += cnt[b];
            if (rank[a] == rank[b]) rank[a]++;
        }
    }

    int count(int a) { return cnt[find(a)]; }

    bool same(int a, int b) { return find(a) == find(b); }
};

const int MAX_N = 100000;
int n, m;
vi l[MAX_N];
vi g[2 * MAX_N];
bool vis[2 * MAX_N];

int main() {
    fastio();

    cin >> n >> m;
    UnionFind uf(n + m);
    forn(i, n) {
        int k;
        cin >> k;
        forn(j, k) {
            int la;
            cin >> la;
            la = la + n - 1;
            uf.unite(i, la);
        }
    }

    bool ok = true;
    forn(i, n - 1) {
        ok &= uf.find(i) == uf.find(i + 1);
    }

    if (ok) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }

    return 0;
}

Measured memory_bytes: 9600
N = int(input())
S = str(input())

r = S.count("R")
g = S.count("G")
b = S.count("B")

ct = r*g*b

for i in range(N-2):
    for j in range(i+1,N-1):
        k = 2*j-i
        if k<=N-1:
            if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
                ct-=1
print(ct)


Measured memory_bytes: 73656
from itertools import product,permutations

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

D = [tuple(map(int,input().split())) for _ in range(C)]

grid = [tuple(map(lambda x: int(x)-1,input().split())) for _ in range(N)]

# grid survey
cnt = [[0]*C for _ in range(3)]

for x,y in product(range(N),range(N)):
  cnt[(x+y)%3][grid[x][y]] += 1

def it():
  for p in permutations(range(C),r=3):
    yield sum(n*D[i][j] for s,j in zip(range(3),p) for i,n in enumerate(cnt[s]))

print(min(it()))

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

using namespace std;

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

    long double probability = 0;
    int side = 1;
    int flips = ceil(log2(K));
    while (flips > 0 && side <= N)
    {
        probability += (1 / N) * pow((long double)1 / 2, (long double)flips);
        side++;
        if (side * pow(2, flips - 1) >= K)
        {
            flips--;
        }
    }

    probability += (1 / N) * (long double)((N - side) + 1);
    cout.precision(12);
    cout << probability;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 500000
#define S 2000000000
int l[N/2+2],r[N/2+2];
int cnt;
void merge(int [],int,int,int,int);
void mergesort(int [],int,int,int);
int main(){
  int a[N],n,i;
  cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  mergesort(a,n,0,n);
  for(i=0;i<n;i++){
    if(i>=1) printf(" ");
    printf("%d",a[i]);
  }
  printf("\n%d\n",cnt);
  return 0;
}
void merge(int a[],int n,int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  int i;
  for(i=0;i<n1;i++){
    l[i]=a[left+i];
  }
  for(i=0;i<n2;i++){
    r[i]=a[mid+i];
  }
  l[n1]=r[n2]=S;
  i=0;
  int j=0,k;
  for(k=left;k<right;k++){
    cnt++;
    if(l[i]<=r[j]){
      a[k]=l[i++];
    }else{
      a[k]=r[j++];
    }
  }
}

void mergesort(int a[],int n,int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergesort(a,n,left,mid);
    mergesort(a,n,mid,right);
    merge(a,n,left,mid,right);
  }
}



Measured memory_bytes: 5760
#include <iostream>
#include <string>

using namespace std;

void func148b()
{
    int n;
    string s,t;
    cin >> n >> s >> t;
    for (int i = 0; i < n; ++i) cout << s[i] << t[i];
    cout << endl;
    
}
 
int main()
{
  func148b();
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::vector<i64> h;
  tools::read(h, N);

  std::vector<i64> dp(N, std::numeric_limits<i64>::max());
  dp[0] = 0;
  for (i64 i = 0; i < N; ++i) {
    if (i + 1 < N) dp[i + 1] = std::min(dp[i + 1], dp[i] + std::abs(h[i] - h[i + 1]));
    if (i + 2 < N) dp[i + 2] = std::min(dp[i + 2], dp[i] + std::abs(h[i] - h[i + 2]));
  }

  std::cout << dp.back() << std::endl;
  return 0;
}

Measured memory_bytes: 1792
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	set := make(map[int]int, n)
	for i := 0; i < n; i++ {
		set[nextInt(sc)]++
	}
	m := nextInt(sc)
	for i := 0; i < m; i++ {
		set[nextInt(sc)]++
	}
	ans := make([]int, len(set))
	var i int
	for k := range set {
		ans[i] = k
		i++
	}
	sort.Ints(ans)
	wtr := bufio.NewWriter(os.Stdout)
	for _, v := range ans {
		fmt.Fprintln(wtr, v)
	}
	wtr.Flush()
}



Measured memory_bytes: 22788
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
int isKaibun(char *s, int n){
    int a = 0;

    for (int i = 0; i < n/2; i++)
    {
        if (s[i] != s[n - 1 - i])
        {
            a = 1;
        }
    }
    return a == 0;
    
}

int main(){
  char s[100];
  int n;
  scanf("%s",s);
  n = strlen(s);
  
  if (isKaibun(s, n) && isKaibun(s, (n-1)/2) && isKaibun(s + (n+1)/2, (n-1)/2)){
      printf("Yes\n");
  }
  else{
      printf("No\n");
  }
  return 0;
}

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

int main(){
    ll n;
    cin>>n;
    
    if(n==1e18){
        cout<<"0 0 0 1000000000 1000000000 0";return 0;
    }
    
    ll q = n/1000000000;
    ll w = n%1000000000;

    cout<<"0 0 "<<q+1<<" "<<1000000000-w<<" "<<1<<" "<<1000000000;
    return 0;
}


Measured memory_bytes: 256
def f(x, y):
    i = 0
    while x < y: i += 1; x *= 2
    return i

n, k = map(int, input().split())
p = (max(0, n - k + 1) +
     sum(1/(2**f(i, k)) for i in range(1, min(k, n + 1)))) / n
print(p)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;

using namespace std;

ll mod(ll a, ll b) { return (a % b + b) % b; }
ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}

int main()
{
    fast;
    ll n; cin>>n;
    ll arr[n];
    for(ll i = 0; i < n; i++) cin>>arr[i];
    ll ans = 0;
   	ll arr1[n],arr2[n];
   	unordered_map<ll,ll>mp1,mp2;
   	for(ll i = 0; i < n; i++)
   	{
   		arr1[i] = i + arr[i];
		mp1[arr1[i]]++;	
	}
	for(ll i = 0; i < n; i++)
   	{
   		arr2[i] = arr[i] - i;
		mp2[arr2[i]]++;	
	}
	for(ll i = 0; i < n; i++)
	{
		ll t = i - arr[i];
		ll tt = -(i+arr[i]);
		ans += mp1[t];
		ans += mp2[tt];
	}
	cout << ans/2 << endl;
    return 0;    
} 

Measured memory_bytes: 38512
#include <iostream>

using namespace std;

class Dice{
private:
  int D1;
  int D2;
  int D3;
  int D4;
  int D5;
  int D6;

public:
  Dice(int d1,int d2,int d3,int d4,int d5,int d6){
  D1=d1;
  D2=d2;
  D2=d2;
  D3=d3;
  D4=d4;
  D5=d5;
  D6=d6;
  }

  void roll(char dire){
  int dd1=D1;
  int dd2=D2;
  int dd3=D3;
  int dd4=D4;
  int dd5=D5;
  int dd6=D6;
  
  if(dire=='E')
    {
    D1=dd4;
    D3=dd1;
    D4=dd6;
    D6=dd3;
    }
  if(dire=='N')
  {
    D1=dd2;
    D2=dd6;
    D5=dd1;
    D6=dd5;
  }
  if(dire=='S')
  {
    D1=dd5;
    D5=dd6;
    D6=dd2;
    D2=dd1;
  }
  if(dire=='W')
  {
    D1=dd3;
    D3=dd6;
    D6=dd4;
    D4=dd1;
  }
  
  }
  
  int ue(){
  return D1;
  }
};

int main()
{
  int di[6]={};
  int i;
  string direc;
  
  for(i=0;i<6;i++)
    cin >> di[i];
    
  Dice dice1(di[0],di[1],di[2],di[3],di[4],di[5]);
  
  cin >> direc;
  
  for(i=0;direc[i]!='\0';i++)
  {
    dice1.roll(direc[i]);
  }
  
  cout << dice1.ue() <<"\n";
}

Measured memory_bytes: 1208
import java.util.ArrayList;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner s = new Scanner(System.in);
		int length = s.nextInt();
		String  word = s.next();
		int num = s.nextInt();
		ArrayList <Character> array = new ArrayList<>();

 		for(int i = 0;i < length;i++) {
			if(word.charAt(i) == word.charAt(num-1)){
				array.add(word.charAt(num-1));
			}else array.add('*');
		}
 		for(Character c:array)
 			System.out.printf("%c",c);
 		s.close();

	}

}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
vector<int> vec;
int ans(0);
bool ok[111111];
void clear() {
	for(int j : vec) {
		ok[j] = true;
	}
	vec.clear();
	ans++;
}
int main() {
	int n, c, k;
	scanf("%d%d%d", &n, &c, &k);
	vector<vector<int> > evts;
	for(int i(1); i <= n; i++) {
		int x;
		scanf("%d", &x);
		evts.push_back({x, -1, i});
		evts.push_back({x + k, 1, i});
	}
	sort(evts.begin(), evts.end());
	for(int i(0), j; i < (int)evts.size(); i = j) {
		if(evts[i][1] == -1) {
			vec.push_back(evts[i][2]);
			if((int)vec.size() == c) {
				clear();
			}
			j = i + 1;
		}else {
			for(j = i; j < (int)evts.size() && evts[i][0] == evts[j][0] && evts[j][1] == 1; j++);
			bool flag(false);
			for(int k(i); k < j; k++) {
				if(!ok[evts[k][2]]) {
					flag = true;
					vec.push_back(evts[k][2]);
					if((int)vec.size() == c) {
						clear();
						flag = false;
					}
				}
			}
			if(flag) { 
				clear();
			}
		}
	}
	if(vec.size())
		clear();
	cout << ans << endl;
}


Measured memory_bytes: 12588
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int su[100001];

int main(){
   int n;
    cin>>n;
    
    rep(i,n){
        int x;cin>>x;
        su[x]++;
    }
    if(n%2&&su[0]!=1){
        cout<<0<<endl;return 0;
    }
    ll ans=1;
    for(int i=n-1;i>0;i-=2){
        if(su[i]!=2){
            cout<<0<<endl;return 0;
        }else{
            ans*=2;
            ans=ans%1000000007;
        }
    }
    cout<<ans<<endl;
    
  
return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <cmath>
#include <iterator>
#include <utility>
#include <set>
#include <random>
#include <map>
#include <stack>
#include <queue>
#include <list>
 
using namespace std;
 
int main() {
    int a, b;
    cin >> a >> b;
    if (a == b)
    {
        cout << "Draw" << endl;
    }
    else if (a != 1 && b != 1 && a > b)
    {
        cout << "Alice" << endl;
    }
    else if (a != 1 && b != 1 && a < b)
    {
        cout << "Bob" << endl;
    }
    else if (a == 1)
    {
        cout << "Alice" << endl;
    }
    else
    {
        cout << "Bob" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
function main(input) {
	const args = input.split('\n');
	const A=parseInt(args[0],10),
	 B=parseInt(args[1],10),
	 C=parseInt(args[2],10),
	 X=parseInt(args[3],10);

	var count = 0;

    for (var a = 0; a <= A; ++a) {
        for (var b = 0; b <= B; ++b) {
            for (var c = 0; c <= C; ++c) {
                var sum = (a * 500) + (b * 100) + (c * 50);
                if (sum === X) ++count;
            }
        }
    }
    console.log(count);
}
   
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 33300
#include <stdio.h>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
using namespace std;
const int maxn = 1e5+100;
long long res[maxn], p;
queue<long long> que[2];
int main(){
    while(!que[0].empty()) que[0].pop();
    while(!que[1].empty()) que[1].pop();
    p = 0;
    bool which = false;
    for(int i=1; i<=9; i++){
        que[which].push(i);
    }
    while(p<=100005){
        while(!que[which].empty()){
            long long q = que[which].front();
            res[p++] = q;
            que[which].pop();
            int low = q%10;
            for(int i=0; i<=9; i++){
                if(abs(i-low)<=1){
                    que[!which].push(q*10 + i);
                }
            }
            if(p>100005) break;
        }
        which = !which;
    }
    int k;
    scanf("%d", &k);
    printf("%lld\n", res[k-1]);
    return 0;
}




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

int main() {
    vector<int> a(5);
    for (int i = 0; i < 5; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < 5; ++i) {
        if (a[i] == 0) {
            cout << i + 1 << endl;
            break;
        }
    }
}


Measured memory_bytes: 3624
import itertools
import decimal
import math
import collections
import sys
#input = sys.stdin.readline
import copy

# S=(input())
# N=int(input())
# N,K=map(int,input().split())
# ListA=list(map(int,input().split()))
# ListA.sort()#reverse=True)

def resolve():
    
    L,R,d=map(int,input().split())

    cnt=0
    for i in range(L,R+1):
        if(i%d==0):
            cnt+=1

    print(cnt)



resolve()


Measured memory_bytes: 9976
s=input()
f1=f2=0
if(len(s)%2==0):
    f1=1
if(s[0]==s[len(s)-1]):
    f2=1
    
if((f1==1 and f2==0) or (f1==0 and f2==1)):
    print('Second')
else:
    print('First')


Measured memory_bytes: 3316
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
  int A, B; cin >> A >> B;
  cout << A * B << endl;

  return 0;
}


Measured memory_bytes: 3596
#!/usr/bin/python
import sys

def f(a,n):
	a=[list(e) for e in a]
	for j in range(len(a)):
		for i in range(n):
			if n+i>=len(a[j]):
				a[j].append(a[j][n-1-i])
			else:
				a[j][n+i]+=a[j][n-1-i]
		a[j]=a[j][n:]
	return a
def g(a,n):
	return list(zip(*f(list(zip(*a)),n)))

while True:
	n,m,t,p=map(int,sys.stdin.readline().split())
	a=[[1]*n for _ in range(m)]
	if n==0: break
	for _ in range(t):
		d,c=map(int,sys.stdin.readline().split())
		a=(f if d==1 else g)(a,c)
	for _ in range(p):
		x,y=map(int,sys.stdin.readline().split())
		print(a[y][x])



Measured memory_bytes: 4716
//created by krishna
#include <bits/stdc++.h>
using namespace std;
#define endl "\n" 
typedef long long ll;
typedef unsigned long long ull;
#define debug(x) cout<<"the value of "<<#x<<" is "<<x<<endl;
int main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int x,y;
    cin>>x>>y;
    if(y%2==1){
        cout<<"No"<<endl;
        return 0;
    }
    else{
        int a=(y/2)-x;
        if(a<0 || a>x)
            cout<<"No"<<endl;
        else 
            cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 3616
import java.text.*;
import java.math.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int kazu = scan.nextInt();
		int num[][][] = new int[4][3][10];
		int b,f,r,v;
		
		for(int i = 0; i < kazu; i++) {
			b = scan.nextInt() - 1;
			f = scan.nextInt() - 1;
			r = scan.nextInt() - 1;
			v = scan.nextInt();
			num[b][f][r] += v;
		}
		for(int i0 = 0; i0 < 4; i0++ ) {
			for(int i1 = 0; i1 < 3; i1++) {
				for(int i2 = 0; i2 < 10; i2++) {
					System.out.print(" " + num[i0][i1][i2]);
				}
				System.out.println();
			}
			if(i0 < 3) System.out.println("####################");
		}
	}
}

Measured memory_bytes: 21200
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int a, b, c;
    cin >> a >> b >> c;
    if (a % 2 + b % 2 + c % 2 != 0)
    {
        cout << 0 << endl;
        return 0;
    }
    if (a == b && b == c)
    {
        cout << -1 << endl;
        return 0;
    }
    int ans = 0;
    while (1)
    {
        if (a % 2 + b % 2 + c % 2 != 0)
            break;
        ans++;
        int na = (b + c) / 2, nb = (a + c) / 2, nc = (a + b) / 2;
        a = na, b = nb, c = nc;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%s", $s);
fscanf(STDIN, "%s", $t);
$s = str_split($s);
$t = str_split($t);
sort($s);
rsort($t);
$m = max(count($s), count($t));
for ($i = 0; $i < $m; $i++) {
	if (!isset($t[$i])) break;
	if (!isset($s[$i]) || $s[$i] < $t[$i]) exit('Yes');
	if ($s[$i] > $t[$i]) break;
}
echo 'No';

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

int main() {
    int n, x;
    while (cin >> n >> x && (n != 0 || x != 0)) {
        int num_counter = 0;
        for (int a = 1; a <= n - 2; ++a) {
            for (int b = a + 1; b <= n - 1; ++b) {
                int c = x - a - b;
                if (c > b && c <= n) {
                    ++num_counter;
                }
            }
        }

        cout << num_counter << endl;
    }

    return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main(){
    const int t=26;
    int d;
    cin>>d;
    int c[t],s[d][t];
    int sad=0;
    for(int i=0;i<t;i++){
        cin>>c[i];
        sad+=c[i];
    }
    for(int i=0;i<d;i++)for(int j=0;j<t;j++)cin>>s[i][j];
    int happy=0;
    for(int i=0;i<d;i++){
        int m=0,x;
        for(int j=0;j<t;j++){
            if(s[i][j]+c[j]>m){
                m=s[i][j]+c[j];
                x=j;
            }
        }
        /*happy+=m-sad;
        cout<<happy<<endl;*/
        cout<<x+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 3680
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
typedef long long ll;

int main(){
    string s;
    cin >> s;
    cout << s.front() << s.length()-2 << s.back() << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007;
#define INF 1000000000000000001;
#define ll long long
vector<vector<int>>g;
vector<pair<int,int>>wg[12345];

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  int arr[n+10];
  for(int i=0;i<n;i++)
  {
      cin>>arr[i];
  }
  sort(arr,arr+n);
  double  s=arr[0];
  for(int i=0;i<n-1;i++)
  {
      s+=arr[i+1];
      s/=2.0;
  }
  cout<<s<<endl;


  return 0;
}


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

using namespace std;

int main() {
    int n, d;
    cin >> n >> d;
    int ans = n / (2*d+1);
    int am = n % (2*d+1);
    if (am == 0) {
        cout << ans << endl;
    } else {
        cout << ans + 1 << endl;
    }
	return 0;
}

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

using namespace std;

const int maxn = 85;
int n, a[maxn];
LL m;

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	m = 1000;
	for(int i = 1; i < n; ++i)
	{
		if(a[i] < a[i + 1]) m += (LL)(a[i + 1] - a[i]) * (m / a[i]);
	}
	printf("%lld", m);
	return 0;
}

Measured memory_bytes: 3820
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    int N;
    cin >> N;
    VI A(N);
    REP(i, N) {
        cin >> A[i];
    }

    set<int> se;
    REP(i, N) se.emplace(A[i]);
    cout << (se.size() == N ? "YES" : "NO") << endl;
}


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

int a[1002][1002];
queue<pair<int,int>> q;

void bfs(){
    while(!q.empty()){
        pair<int,int> p;
        p = q.front();
        q.pop();

        int v[4][2] = {{-1,0},{1,0},{0,-1},{0,1}};

        for(int i = 0;i < 4;i ++){
            int x,y;
            y = p.first+v[i][0];
            x = p.second+v[i][1];
            if(a[y][x]-1>a[p.first][p.second]){
                a[y][x] = a[p.first][p.second]+1;
                q.push(make_pair(y,x));
            }
        }
    }
}

int main(){
    int h,w,ans=-1;
    fill(a[0],a[1002],-1);
    cin >> h >> w;
    for(int i = 0;i < h;i ++){
        for(int j = 0;j < w;j ++){
            char c;
            cin >> c;
            a[i+1][j+1] = c=='#'?0:1e6+2;
            if(!a[i+1][j+1]) q.push(make_pair(i+1,j+1));
        }
    }
    bfs();
    for(int i = 0;i < h;i ++){
        for(int j = 0;j < w;j ++){
            ans = max(ans,a[i+1][j+1]);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12304
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		solveB(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solveA(String[] args) throws Exception{
		int[] x = nextInts();
		boolean[] flg = new boolean[6];
		Arrays.fill(flg,true);
		for(int i=0;i<5;i++) {
			flg[x[i]]=false;
		}
		for(int i=1;i<6;i++) {
			if(flg[i]) {
				pw.println(i);
				return;
			}
		}
	}
	public static void solveB(String[] args) throws Exception{
		int X = nextInt();
		int Y = nextInt();

		for(int turu=0;turu<100;turu++) {
			for(int kame=0;kame<100;kame++) {
				if(turu+kame==X&&turu*2+kame*4==Y) {
					pw.println("Yes");
					return;
				}
			}
		}
		pw.println("No");
	}
	public static void solveC(String[] args) throws Exception{

	}
	public static void solveD(String[] args) throws Exception{

	}
	public static void solveE(String[] args) throws Exception{

	}

	public static TreeMap<Long, Long> primeFactorize(long N) {
		TreeMap<Long, Long> map = new TreeMap<>();
		for (long i = 2; i * i <= N; i++) {
			long k = 0;
			while (N % i == 0) {
				k++;
				N /= i;
			}
			map.put(i, k);
		}
		map.put(N, 1L);
		return map;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 25500
#include<iostream>

using namespace std;

int main(){
    int K, S;
    cin >> K >> S;
    int ans = 0;

    for (int i = 0; i <= K; i++)
    {
        for (int j = 0; j <= K; j++)
        {
            int k = S - i - j;
            if(0 <= k && k <= K){
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn=10000;
ll n,m;
ll cost[10]={0,2,5,5,4,5,6,3,7,6};
ll dp[maxn+1];
bool key=false;
vector<int> cu;


int main(){
    
    cin >> n>>m;
    
    rep(i,m){
        int a;cin >> a;
        cu.push_back(a);
    }
    
    rep(i,n+1){
        dp[i]=-1;
    }
    
    dp[0]=0;
    
    rep(i,m){
        rep(j,m){
            if(cost[cu[i]]<cost[cu[j]])swap(cu[i],cu[j]);
        }
    }
    
    for(int i=1;i<=n;i++){
        rep(j,m){
        if(i-cost[cu[j]]>=0)dp[i]=max(dp[i],dp[i-cost[cu[j]]]+1);
        }
    }
    
    sort(all(cu));
    reverse(all(cu));
    ll match=n;
    
    while(match>0){
        for(int j=0;j<m;j++){
            if(match-cost[cu[j]]>=0&&dp[match]==dp[match-cost[cu[j]]]+1){
                cout << cu[j];
                match-=cost[cu[j]];
                break;
            }
        }
    }
    
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back
#define pf push_front
#define FOR(i, m, n) for(int i=n;i<(n);i++)
#define rep(i,n) FOR(i, 0, n)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl;

int main(){
    int H,W,h,w;
    cin >> H >> W;
    cin >> h >> w;

    cout << H * W -((H * w) + (W * h) - (w * h)) << endl;
    return 0;
}

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

int main(int argc, char* argv[]) {
  int n;
  cin >> n;

  string* s = new string[n];
  int* p    = new int[n];
  int* o    = new int[n];

  for (int i = 0; i < n; i++) {
    cin >> s[i] >> p[i];
    o[i] = i + 1;
  }
  string tmp_s;
  int tmp_i;

  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      if (s[i] > s[j]) {
        tmp_s = s[i];
        s[i]  = s[j];
        s[j]  = tmp_s;

        tmp_i = p[i];
        p[i]  = p[j];
        p[j]  = tmp_i;

        tmp_i = o[i];
        o[i]  = o[j];
        o[j]  = tmp_i;
      }
    }
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      if (s[i] == s[j]) {
        if(p[i]<p[j]){

          tmp_i = p[i];
          p[i]  = p[j];
          p[j]  = tmp_i;

          tmp_i = o[i];
          o[i]  = o[j];
          o[j]  = tmp_i;

        }
      }
    }
  }

  for (int i = 0; i < n; i++) {
    cout << o[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 256
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
int main(){
    string s;
    std::cin >> s;
    bool used[26];
    Fill(used,false);
    if(s.length()<=25){
        for (int i = 0; i < s.length(); i++) {
            used[s[i]-'a'] = true;
        }
        for (char moji = 'a'; moji <= 'z'; ++moji) {
            if(!used[moji-'a']){
                std::cout << s+moji<< std::endl;
                return 0;
            }
        }
    }
    
    for (int i = s.length()-1; i >= 0; i--) {
        vector<char> now = {s[i]};
        for (int j = i-1; j >= 0; j--) {
            char mi = 'z'+1;
            for (auto e : now) {
                if( e > s[j] ){
                    mi = min(e,mi);
                }
            }
            if(mi == 'z'+1){
                now.push_back(s[j]);
                continue;
            }else{
                s[j] = mi;
                std::cout << s.substr(0,j+1) << std::endl;
                return 0;
            }
        }
    }
    std::cout << -1 << std::endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int a[100][100]={0},b[101][101]={0},i,j,r,c;
  scanf("%d %d",&r,&c);
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      scanf("%d",&a[i][j]);
      b[i][j]=a[i][j];
    }
  }
  for(i=0;i<r;i++){
    for(j=0;j<c;j++)
      b[i][c]+=a[i][j];
  }
  for(i=0;i<=c;i++){
    for(j=0;j<r;j++)
      b[r][i]+=b[j][i];
  }
  for(i=0;i<=r;i++){
    for(j=0;j<c;j++)
      printf("%d ",b[i][j]);
    printf("%d\n",b[i][j]);
  }
  return 0;
}

Measured memory_bytes: 688
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int[][][] list = new int[4][3][10];
        for (int i = 0; i < a; i++) {
            int b = scanner.nextInt() - 1;
            int c = scanner.nextInt() - 1;
            int d = scanner.nextInt() - 1;
            int e = scanner.nextInt();
            list[b][c][d] += e;
        }
 
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < 10; k++) {
                    System.out.print(" " + list[i][j][k]);
                }
                System.out.println();
            }
            if (i != 3)
                System.out.println("####################");
        }
 
    }
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<pair<int, int>> points(n);
    for (auto& point : points) {
        cin >> point.first >> point.second;
    }
    double sum = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            auto pi = points[i], pj = points[j];
            sum += sqrt((pi.first - pj.first) * (pi.first - pj.first) + (pi.second - pj.second) * (pi.second - pj.second));
        }
    }
    // (n-1)/(n(n-1)/2) = 2/n
    cout << setprecision(20) << (sum * 2 / n) << endl;
    return 0;
}


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

using namespace std;

int dp[25][50010];

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> c(m+1);
	for (int i = 1; i <= m; i++)cin >> c[i];
	for (int j = 1; j <= n; j++)dp[0][j] = 100000000;
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= n; j++) {
			if (j - c[i] < 0)dp[i][j] = dp[i - 1][j];
			else dp[i][j] = min(dp[i - 1][j], dp[i][j - c[i]] + 1);
		}
	}

	cout << dp[m][n] << endl;
}

Measured memory_bytes: 7192
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Solve
{
    public Solve() { }
    public static int Main()
    {
        new Solve().calc();
        return 0;
    }


    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int Y = cin.nextInt();

        for (int x = 0; x <= N; x++){
            for (int y = 0; y <= N - x; y++){
                int z = N - (x + y);
                if(x * 10000 + y * 5000 + z * 1000 == Y){
                    Console.WriteLine(x + " " + y + " " + z);
                    return;
                }
            }
        }

        Console.WriteLine("-1 -1 -1");
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

ll n, ans = 1;
int main() {
	cin >> n;
	while (ans * 2 <= n) {
		ans *= 2;
	}
	cout << ans << endl;
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define MAXN 10010
#define MAXY 2010
#define INF 0x3f3f3f
const int MOD=1e9+7;
const double eps=1e-8;
typedef long long ll;
//orz yht
using namespace std;
long long n,ans; 
int main(){
//	freopen("1.out","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n;
	if(n%2==1){
		cout<<0<<endl;
		return 0;
	}
	n/=2;
	while(n>0)
	ans+=n/=5;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
#include <map> // pair
#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;
#define START 0
#define FORWARD 1
#define BACK 2
using namespace std;
using ll = long long;
typedef pair <ll, ll > pll;
//*********************************************************
// 最大公約数（Greatest Common Divisor）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************
ll gcd(ll a, ll b)
{
	ll tmp, r;
	if (a<b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	/* ユークリッドの互除法 */
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
	//// 引数に０がある場合は０を返す
	//if ((0 == m) || (0 == n))
	//	return 0;

	//// ユークリッドの方法
	//while (m != n)
	//{
	//	if (m > n) m = m - n;
	//	else         n = n - m;
	//}
	//return m;
}//gcd
int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll x[100004] = {};
	ll y[100004] = {};
	ll z[100004] = {};
	string s;
	string s1, s2;
	//IntStack yStack;
	//charStack Stack;
	//vector<pair<int, int> > pairs(a);

	cin >> a;
	cin >> b;
	cin >> c;
	if (a<b)
	{
		e = a;
		a = b;
		b = e;
	}
	if (b<c)
	{
		e = c;
		c = b;
		b = e;
	}

	cin >> d;
	for (int i = 0; i*a <= d; i++)
	{
		for (int k = 0; i*a+k*b <= d; k++)
		{
			if ((d-i*a - k*b)%c==0)
			{
				ans++;
			}
		}
	}

	cout << ans << endl;



	//cout << ans << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//sort(x, x + a, std::greater<ll>());

//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得
//
//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}
//
//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

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;

int main() {
    int n;
    cin >>n;
    string s;
    cin >> s;
    ll r=0;
    ll g=0;
    ll b=0;
    vector<string> color(n);
    for (int i=0;i<n;i++){
        color.at(i) = s.at(i);
        if(s.at(i)=='R') r++;
        if(s.at(i)=='G') g++;
        if(s.at(i)=='B') b++;
     }
    ll all = r*g*b;
    ll count_b=0;
    for (int i=0;i<n;i++){
        for (int j=i+1;j<n;j++){
            if(color.at(i)==color.at(j)) continue;
            int k=2*j-i;
            if (k>=n) continue;
            if(color.at(i)==color.at(k) || color.at(j)==color.at(k)){
                continue;
            }
            count_b++;
        }
    } 
    cout << all-count_b << endl;
    return 0;
}



Measured memory_bytes: 3728
S=str(input())
month=["01","02","03","04","05","06","07","08","09","10","11","12"]
A=S[0:2]
B=S[2:]

if(A in month and B in month):
    print("AMBIGUOUS")
elif(A in month and B not in month):
    print("MMYY")
elif(A not in month and B in month):
    print("YYMM")
elif(A not in month and B not in month):
    print("NA")

Measured memory_bytes: 3064
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>
using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;
const int INF = 1e9;

long long gcd(long long x, long long y){
			if(x<y){
				long long temp = x;
			x = y;
				y = temp;
			}
			long long r = x % y;
				while(r!=0){
					x = y;
					y = r;
				r = x % y;
	    		}
			return y;
	    }

int main(){
int N;
string S;
int K;
cin >> N;
cin >> S;
cin >> K;
char ans = S[K-1];
for(int i = 0; i< N;i++){
    if(ans!=S[i]){
        S[i] = '*';
    }
}
cout << S << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<P>>
#define fi first
#define se second
constexpr ll mod=1000000007;
constexpr ll INF=(1ll<<60);
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<typename T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}


int main(){
    ll n;cin>>n;
    ll ans=-1;
    rep(x,50000){
        if(100*n<=108*x && 108*x<100*(n+1)) ans=x;
    }
    if(ans!=-1) cout<<ans<<endl;
    else cout<<":("<<endl;
    return 0;
}

Measured memory_bytes: 3540
N = int(input())
l = []
for i in range(3):
    l.append(input())
res = 0
for i in range(len(l[0])):
    s = set()
    for j in range(3):
        s.add(l[j][i])
    if len(s) == 3:
        res += 2
    elif len(s) == 2:
        res += 1
print(res)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;

ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}
ll mod(ll a, ll b) {return (a % b + b) % b;}
using namespace std;

int main() 
{
	fast;
	char a,b; cin>>a>>b;
	if( (a == 'H' && b == 'H') || (a == 'D' && b == 'D') )
		cout << "H";
	else
		cout << "D";
	
}

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

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel" << endl;
  }
  else cout << "consonant" << endl;
}

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

int n;
int h[1000000];
int l[1000000]={0};
int main()
{

cin>>n;
for (int i=0;i<n;i++ )
cin>>h[i];
int i=0;
int t=0;
while(t<n-1)
{for (int j=i;j<n-1;j++ )
{if (h[j]>=h[j+1])
{l[i]++;
t++;}
else 
{
i=j+1;
t=t+1;
    break;
}

}}
int max=0;
for (int k=0;k<n;k++)
{if (l[k]>max)
max=l[k];}


cout <<max;
}


Measured memory_bytes: 4736
#include <queue>
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <iomanip>
#include <cstdio>
#define rep(i, n) for(long long i = 0;(i) < (n);(i)++)
using namespace std;
using ll = long long;
const ll mod = 1000000007;

int main()
{
	ll N;
	cin >> N;
	cout << N * 800 - (floor((double)N / 15) * 200) << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, Z, W) = Slice3<long>();
            var ai = Sarray();
            var cdt = Abs(W - ai.Last());
            if (N == 1)
            {
                WriteLine(cdt);
                return;
            }
            WriteLine(Max(cdt, Abs(ai.Last() - ai[ai.Length - 2])));
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

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

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

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  vector<ll> dp(n);
  const ll INF = 1LL << 60;
  rep(i, n) dp[i] = INF;
  dp[0] = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= min(i, k); j++) {
      chmin(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
    }
  }
  cout << dp[n - 1] << endl;
  return 0;
}


Measured memory_bytes: 4548