akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define Fast_IO ios_base::sync_with_stdio(false);cin.tie(NULL);

int32_t main()
{    
    Fast_IO
    #ifdef _WIN32 
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w",stdout);
    #endif
    int n;cin>>n;
    int k;cin>>k;
    vector<int> a(n);
    for(int &x : a){
        cin>>x;
    }
    vector<int> dp(n,INT_MAX);
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<=i+k;j++){
            if(j<n){
                dp[j] = min(dp[j],dp[i]+abs(a[i] - a[j]));
            }
        }
    }
    cout<<dp[n-1];


}

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

int main()
{
    int n, ans = 0;
    cin >> n;
    int cnt[10][10] = {0};
    for (int k = 1; k <= n; k++)
    {
        int i = to_string(k)[0] - '0';
        int j = k % 10;
        if (j)
        {
            cnt[i][j]++;
        }
    }
    for (int i = 1; i <= 9; i++)
    {
        for (int j = 1; j <= 9; j++)
        {
            ans += cnt[i][j] * cnt[j][i];
        }
    }
    cout << ans << "\n";
    return 0;
}


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

using namespace std;
int main() {
	vector<int> v;
	for(int i = 0; i < 10; ++i) {
		int n;
		cin >> n;
		v.push_back(n);
	}

	partial_sort(v.begin(), v.begin() + 3, v.end()
		, [](const int& x, const int& y) { return x > y;});
	
	for_each(v.begin(), v.begin() + 3, [](int x) {
		cout << x << endl;
	});
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
int main(){
  ll N,W;
  cin>>N>>W;
  vector<ll> weight(N),value(N);
  rep(i,N) cin>>weight[i]>>value[i];
  ll dp[110][100010];
  rep(i,N+1) dp[0][i]=0;
  rep(i,N){
    rep(j,W+1){
    if(j>=weight[i]) dp[i+1][j]=max(dp[i][j-weight[i]]+value[i],dp[i][j]);
    else dp[i+1][j]=dp[i][j];
    }
  }
  cout<<dp[N][W]<<endl;
}

Measured memory_bytes: 80128
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define Q int tt,qq; cin>>tt ;for(qq=1;qq<=tt;qq++)
#define I ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int main()
{
    double a,b,x,y;
    cin>>a>>b>>x>>y;
    cout<<(a*b)/2<<" ";
    if(x==a/2&&y==b/2)cout<<1;
    else cout<<0;
}


Measured memory_bytes: 3752
N,K = map(int, input().split())
A = [0]*N
for i in range(K):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        A[a[j]-1] = 1
res = 0
for i in range(N):
    if A[i] == 0:
        res += 1
print(res)

Measured memory_bytes: 67688
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>

// type alias
using lint = long long;
using ldouble = long double;
template <class T>
using greater_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T>>;


/* ----- class ----- */

template <class Cost = int>
struct Edge {
    int src, dst;
    Cost cost;
    Edge(int src = -1, int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = int>
using Edges = std::vector<Edge<Cost>>;

template <class Cost = int>
using Graph = std::vector<std::vector<Edge<Cost>>>;


/* ----- debug ----- */

#if __has_include("../setting/source/debug.hpp")
#include "../setting/source/debug.hpp"
#endif


/* ----- short functions ----- */

template <class T>
inline T sq(T a) { return a * a; }

template <class T>
inline T iceil(T n, T d) { return (n + d - 1) / d; }

template <class T>
T gcd(T a, T b) {
    while (b > 0) {
        a %= b;
        std::swap(a, b);
    }
    return a;
}

template <class T, class U>
T ipow(T b, U n) {
    T ret = 1;
    while (n > 0) {
        if (n & 1) ret *= b;
        n >>= 1;
        b *= b;
    }
    return ret;
}

// 0-indexed
template <class T, class U>
inline T kthbit(T a, U k) { return (a >> k) & 1; }

template <class T, class U>
inline T mask(T a, U k) { return a & ((1 << k) - 1); }

template <class T>
std::map<T, int> compress(std::vector<T>& v) {
    std::sort(v.begin(), v.end());
    v.erase(std::unique(v.begin(), v.end()), v.end());

    std::map<T, int> rev;
    for (int i = 0; i < v.size(); ++i) rev[v[i]] = i;
    return rev;
}

template <class T>
T Vec(T v) { return v; }

template <class T, class... Ts>
auto Vec(size_t l, Ts... ts) {
    return std::vector<decltype(Vec<T>(ts...))>(l, Vec<T>(ts...));
}


/* ----- constants ----- */

// const int INF = std::numeric_limits<int>::max() / 3;
// const lint INF = std::numeric_limits<lint>::max() / 3;
// const ldouble PI = acos(-1);
// const ldouble EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));


using namespace std;

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

    for (int i = 0; i + 1 < S.length(); ++i) {
        if (S[i] == S[i + 1]) {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
// #pragma GCC optimize("O2")
typedef long long int ll;
typedef long double ld;
typedef map <ll,ll> mm;
typedef vector <ll> mv;
typedef pair <ll,ll> mp;
typedef set <ll> ms;
typedef multiset <ll> mms;
typedef queue <ll> mq;
typedef deque <ll> mdq;
typedef stack <ll> mst;
typedef priority_queue <ll> mpq;
typedef priority_queue <ll, vector<ll>, greater<ll> > mmh;
typedef complex<double> cd;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define flush cout.flush();
#define all(v) v.begin(),v.end()
#define deb(x) cout << #x << " " << x << endl;
#define ff first
#define ss second
#define pb(v) push_back(v)
#define lb(v) lower_bound(v)
#define ub(v) upper_bound(v)
#define cn continue
#define forl(i,n) for(ll i=0;i<n;i++)
#define forlr(i,n) for(ll i=n-1;i>=0;i--)
#define rev(s) reverse(s.begin(),s.end())
void swap(ll &a,ll &b) {
	ll tmp=a;
	a=b;
	b=tmp;
}
ll atoistring(string s) {
	stringstream lol(s);
	ll x;
	lol>>x;
	return x;
}
void pv(mv v) {
	forl(i,v.size()) cout<<v[i]<<" ";
	cout<<"\n";
}
void pa(ll *v, ll size) {
	forl(i,size) cout<<v[i]<<" ";
	cout<<"\n";
}
void removeDups(mv &v) {
	sort(all(v));
	mv::iterator it = unique(v.begin(), v.end());
	v.resize(distance(v.begin(), it));
}
inline ld kthRoot(ld n, ll k) {
	return pow(k, (1.0 / k) * (log(n) / log(k)));
}
ll power(ll x, ll y, ll p) {
	ll res=1;
	x=x%p;
	while(y>0) {
		if(y&1) res = (res*x)%p;
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}
void checkmod(ll &x, ll mod) {
	if(x>=mod) x%=mod;
}

ll mod = 1e9 + 7;

void thisIsMain() {
	ll n, x, t;
	cin>>n>>x>>t;
	cout<<t * ((n + x - 1) / x)<<"\n";
}

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

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

const string YES = "Yes";
const string NO = "No";

void solve(long long X){
    if (X >= 30) {
        cout << YES << endl;
    } else {
        cout << NO << endl;
    }

}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


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

long double PI = 3.141592653589793238462643383279502884197;

int main() {
	long double X1, Y1, X2, Y2;
	long long N;
	cin >> X1 >> Y1 >> X2 >> Y2 >> N;
	vector<pair<long double, long double> > V;
	for (int i = 0; i < N; i++) {
		long double X, Y;
		cin >> X >> Y;
		if (((X1 <= X && X <= X2) || (X2 <= X && X <= X1)) && ((Y1 <= Y && Y <= Y2) || (Y2 <= Y && Y <= Y1))) {
			V.push_back({ X, Y });
		}
	}
	if (X1 <= X2) {
		for (int i = 0; i < V.size(); i++) V[i].first -= X1;
		X2 -= X1, X1 = 0;
	}
	else {
		for (int i = 0; i < V.size(); i++) V[i].first = X2 - V[i].first;
		X1 -= X2, X2 = 0;
		swap(X1, X2);
	}
	if (Y1 <= Y2) {
		for (int i = 0; i < V.size(); i++) V[i].second -= Y1;
		Y2 -= Y1, Y1 = 0;
	}
	else {
		for (int i = 0; i < V.size(); i++) V[i].second = Y2 - V[i].second;
		Y1 -= Y2, Y2 = 0;
		swap(Y1, Y2);
	}
	long double INF = 10000000000.0;
	vector<long double> DP(N + 2, INF);
	sort(V.begin(), V.end());
	for (int i = 0; i < V.size(); i++) {
		long long it = lower_bound(DP.begin(), DP.end(), V[i].second) - DP.begin();
		DP[it] = V[i].second;
	}
	long double COUNT = 0;
	while (DP[COUNT] < INF) COUNT++;
	if (COUNT < min(X2, Y2) + 1) {
		long double ANS = (X2 + Y2) * 100.0 - COUNT * (20.0 - 5.0 * PI);
		printf("%.15llf\n", ANS);
	}
	else {
		long double ANS = (X2 + Y2) * 100.0 - (COUNT - 1.0) * (20.0 - 5.0 * PI) + 10.0 * PI - 20.0;
		printf("%.15llf\n", ANS);
	}
}

Measured memory_bytes: 11496
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

    int N, D, X;
    cin >> N >> D >> X;
    int A[N];
    REP(i,N){
        cin >> A[i];
    }
    int c = X;
    REP(i,N){
        int day = 1;
        while(day <= D){
            c++;
            day += A[i];
        }
    }
    cout << c << "\n";
    return 0;
}

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

const int MAX = 500000;
const int MAXV = 1000000001;

int L[MAX / 2 + 2], R[MAX / 2 + 2];
int cnt;

void merge(int A[], int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; i++) {
        L[i] = A[left + i];
    }
    for (int i = 0; i < n2; i++) {
        R[i] = A[mid + i];
    }
    
    L[n1] = MAXV;
    R[n2] = MAXV;

    int i{ 0 }, j{ 0 };
    for (int k = left; k < right; k++) {
        cnt++;
        if (L[i] <= R[j]) {
            A[k] = L[i];
            i++;
        }
        else {
            A[k] = R[j];
            j++;
        }

    }
}

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

int main()
{
    int n, i;
    int A[MAX];
    //A = (int*)malloc(MAX);

    cnt = 0;

    cin >> n;
    for (i = 0; i < n;i++) {
        cin >> A[i];
    }
    
    mergeSort(A, 0, n);

    for (i = 0; i < n; i++) {
        if (i != 0) cout << " ";
        cout << A[i];
    }

    std::cout << "\n" << cnt << "\n";
}


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

int main() {
	int n,l;
    cin>>n>>l;
    int a,b;
    cin>>a;
    for(int i=1;i<n;i++){
        cin>>b;
        if(a+b>=l){
            cout<<"Possible"<<endl;
            for(int j=1;j<i;j++){
                cout<<j<<endl;
            }
            for(int j=n-1;j>=i;j--){
                cout<<j<<endl;
            }
            return 0;
        }
        a=b;
    }
    cout<<"Impossible"<<endl;

    return 0;
}

Measured memory_bytes: 768
N, K = map(int, input().split())
d = []
A = []

for k in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))

Alist = [e for row in A for e in row]
        
L = len(list(set(Alist)))
print(N-L)



Measured memory_bytes: 9240
import numpy as np
from copy import copy

def binaryList(n,HW):
    l=np.zeros(HW)
    for i in range(HW):
        if n%2==0:
            l[i]=0
        else:
            l[i]=1
        n=n//2
    return l

if __name__ == "__main__":
    HWK=input().split(" ")
    H,W,K=int(HWK[0]),int(HWK[1]),int(HWK[2])
    l=[]
    for i in range(H):
        buf=[]
        s=input()
        for i in s:
            buf.append(1 if i=="#" else 0)
        l.append(buf)
    l=np.array(l,np.uint8)
    cnt=0
    for i in range(2**H):
        for j in range(2**W):
            buf=copy(l)
            h=binaryList(i,H).reshape(1,-1).repeat(W,0).transpose().astype(np.uint8)
            w=binaryList(j,W).reshape(1,-1).repeat(H,0).astype(np.uint8)
            buf[h==1]=0
            buf[w==1]=0
            if buf.sum()==K:
                cnt+=1
    print(cnt)

Measured memory_bytes: 27260
#include<iostream>

int main(){
    int A, B, C, D;
    std::cin >> A >> B >> C >> D;
    if(A + B < C + D){
        std::cout << "Right" << std::endl;
    }else if(A + B > C + D){
        std::cout << "Left" << std::endl;
    }else{
        std::cout << "Balanced" << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
def main():
    W = input()
    T = list(linein())

    w = W.lower()
    ans = 0
    for t in T:
        for word in t.split():
            if w == word.lower():
                ans += 1

    print(ans)

def linein():
    while True:
        try:
            s = input()
            if s == 'END_OF_TEXT':
                break
            yield ''.join(s)
        except EOFError:
            break

main()

Measured memory_bytes: 7512
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  cout <<  c - (min(a, b+c) - b) << endl;
}

Measured memory_bytes: 256
using namespace std;
#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
#define w(x) int x;cin>>x;while(x--)

#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define ll long long

void abc()
{
	FIO;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int mod = 1000000007;
vector<vector<int>> dp;
vector<vector<int>> v;


int go( int i, int flag) {



	if (i == v.size() ) return 0;
	if (dp[i][flag] != -1) return dp[i][flag];



	int a = v[i][0] + go(i + 1, 1);
	int b = v[i][1] + go(i + 1, 2);
	int c = v[i][2] + go(i + 1, 3);



	if (flag == 0) {
		return dp[i][flag] = max({a, b, c});
	}
	else if (flag == 1) {
		return dp[i][flag] = max(b, c);
	}
	else if (flag == 2) {
		return dp[i][flag] = max(a, c);
	}
	else {
		return dp[i][flag] = max(a, b);
	}



}



int main()
{
	abc();


	int n;
	cin >> n ;
	v.resize(n, vector<int>(3));
	dp.resize(n, vector<int>(4, -1));

	for (int i = 0; i < n; i++) cin >> v[i][0] >> v[i][1] >> v[i][2];

	cout << go(0, 0) << endl;


}

Measured memory_bytes: 21924
# an = list(map(int, input().split()))
# n, m = map(int, input().split())
# n = int(input())

n, k = map(int, input().split())
an = list(map(int, input().split()))

sa = sum(an)
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)

  divisors.sort()
  return divisors
div = make_divisors(sa)

for d in div[::-1]:
  if d == 1:
    print(1)
    break
  bn = [a % d for a in an if a % d != 0]
  bn.sort()
  sb = sum(bn)
  sb_l = sum(bn[:-1*(sb//d)])
  if sb_l <= k:
    print(d)
    break
    

Measured memory_bytes: 3188
#include <stdio.h>

int main(void)
{
    int n;
    int m;
    static int a[100][100] = {0};
    int b[100] = {0};
    int c[100] = {0};
    
    scanf("%d %d", &n, &m);
    
    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < m; j++ ) {
            scanf("%d", &a[i][j]);
        }
    }
    
    for ( int i = 0; i < m; i++ ) {
        scanf("%d", &b[i]);
    }
    
    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < m; j++ ) {
            c[i] += a[i][j] * b[j];
        }
        printf("%d\n", c[i]);
    }
    
    return 0;
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<pi> LR(M);//, pq(Q);
  vector<V> x(N);
  pi tmp;
  REP(i, M) {
    cin >> tmp.first >> tmp.second;
    x[tmp.first-1].push_back(tmp.second);
  }
  REP(i, N) {
    sort(x[i].begin(), x[i].end());
  }
  ll ret;
  REP(i, Q) {
    cin >> tmp.first >> tmp.second;
    ret = 0;
    for (int j = tmp.first-1; j < tmp.second; j++) {
      if (x[j].empty()) continue;
      if (x[j][x[j].size()-1] <= tmp.second) {
	ret += x[j].size();
	continue;
      }
      int cnt = 0, k = 0;
      while (x[j][k] <= tmp.second) {
	k++;
	if ((int)x[j].size() < k) break;
	cnt++;
      }
      ret += cnt;
    }
    dump(ret);
  }
  return 0;
}


Measured memory_bytes: 3712
import numpy as np

a,b = map(int,(input().split()))
b+=1


flag = True
div = 2
bxor = []
while flag:
    q = b//div
    r = b-q*div
    if q == 0:
        flag = False
        if r > div//2:
            temp = r-(div//2)
            temp = temp%2
            bxor.append(temp)
        else:
            bxor.append(0)
    else:
        sup = q*div//2
        sup = sup%2
        temp = r - (div // 2)
        if temp > 0:
            temp = temp%2
            sup += temp
            bxor.append(sup)
        else:
            bxor.append(sup)
    div *= 2

axor = [0 for i in range(len(bxor))]
ind = 0

flag = True
div = 2
while flag:
    q = a//div
    r = a-q*div
    if q == 0:
        flag = False
        if r > div//2:
            temp = r-(div//2)
            temp = temp%2
            axor[ind]=(temp)
        else:
            axor[ind]=(0)
    else:
        sup = q*div//2
        sup = sup%2
        temp = r - (div // 2)
        if temp > 0:
            temp = temp%2
            sup += temp
            axor[ind]=(sup)
        else:
            axor[ind]=(sup)
    div*=2
    ind += 1

ans = 0
for i in range(len(axor)):
    temp = axor[i]+bxor[i]
    if temp%2 == 0:
        continue
    else:
        ans += 2**i


# print(axor,bxor)
print(ans)





Measured memory_bytes: 12496
package main

import (
	"fmt"
	"math"
	"math/big"
	"os"
)

func main() {
	var x int
	fmt.Scanf("%d", &x)

	lim := int(math.Sqrt(math.Sqrt(float64(x))))
	for a := 0; a <= lim; a++ {
		for b := 0; b >= -lim; b-- {
			if a*a*a*a*a-b*b*b*b*b == x {
				fmt.Printf("%d %d\n", a, b)
				os.Exit(0)
			}
		}
	}

	a, b := big.NewInt(0), big.NewInt(0)
	bigX := big.NewInt(int64(x))
	for true {
		a5 := fifth(a)
		b5 := fifth(b)
		testee := big.NewInt(0)
		testee.Sub(a5, b5)
		if testee.Cmp(bigX) == 1 {
			b.Add(b, big.NewInt(1))
		} else if testee.Cmp(bigX) == -1 {
			a.Add(a, big.NewInt(1))
		} else {
			fmt.Printf("%s %s\n", a.String(), b.String())
			os.Exit(0)
		}
	}

}

func fifth(x *big.Int) *big.Int {
	ans := big.NewInt(1)
	ans.Mul(ans, x)
	ans.Mul(ans, x)
	ans.Mul(ans, x)
	ans.Mul(ans, x)
	ans.Mul(ans, x)
	return ans
}


Measured memory_bytes: 1976
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>
using namespace std;

int main() {
	for(int n; scanf("%d", &n), n;) {
		vector<bool> login(1000, false);
		vector<int> time(1000, 0), cnt(1000, 0);
		
		while(n--) {
			int M, D, h, m, p;
			char e;

			scanf("%d/%d %d:%d %c %d", &M, &D, &h, &m, &e, &p);
			m += h * 60;

			if(e == 'I') {
				login[p] = true;
				time[p] = m;
			}
			else {
				if(p) {
					login[p] = false;
					if(login[0])
						cnt[p] += m - max(time[0], time[p]);
				}
				else {
					login[0] = false;
					for(int i = 1; i < 1000; ++i) {
						if(login[i]) {
							cnt[i] += m - max(time[0], time[i]);
							time[i] = m;
						}
					}
				}
			}
		}

		printf("%d\n", *max_element(cnt.begin(), cnt.end()));
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1040
N, L = map(int,input().split())
A = []
for i in range(N):
    x = L + i
    A.append(x)

y = sum(A)
B = sorted(A)

if L <= 0 and L + N - 1 >= 0:
    print(y)
elif L >= 0:
    y -= B[0]
    print(y)
elif L + N - 1 < 0:
    y -= B[N - 1]
    print(y) 



Measured memory_bytes: 9140
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <bitset>
#include <limits.h>
#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(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF (LL)1e15
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

//#define int long long

/*************** using variables ***************/
int n;
vector<int> a;
LL ans = 0;
/*********************************************/

signed main(){
    cin >> n;
    a.resize(n+1);
    REP(i, n){
        cin >> a[i];
    }
    
    REP(i, n){
        ans += a[i] / 2;
        if(a[i] % 2 == 1 && a[i+1] > 0){
            a[i+1]--;
            ans++;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(){
    int n,m,t,p;
    while(true){
        cin>>n>>m>>t>>p;
        int hnum=0,wnum=0;
        long long int origami[500][500];
        for(int i=0;i<500;i++){
            for(int j=0;j<500;j++){
                origami[i][j]=0;
            }
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                origami[i][j]=1;
            }
        }
        if(n==0)break;
        for(int i=0;i<t;i++){
            int d,c;
            cin>>d>>c;
            if(d==1){
                for(int j=wnum+c;j<wnum+c*2;j++){
                    for(int k=0;k<m*2;k++){
                        origami[j][k]+=origami[c+wnum-(j-wnum-c)-1][k];
                    }
                }
                wnum+=c;
            }else{
                for(int j=0;j<n*2;j++){
                    for(int k=hnum+c;k<hnum+c*2;k++){
                        origami[j][k]+=origami[j][c+hnum-(k-hnum-c)-1];
                    }
                }
                hnum+=c;
            }
            /*
            for(int j=0;j<m;j++){
                for(int k =0;k<n+1;k++){
                    cerr<<origami[k][j];
                }
                cerr<<endl;
            }*/
            
        }
        for(int i=0;i<p;i++){
            int x,y;
            cin>>x>>y;
            cout<<origami[x+wnum][y+hnum]<<endl;
        }
    }
    return 0;
}


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

string ds[3010];
string dn[3010];

int main(){
  string S,T; cin>>S>>T;
  int ss=S.size(),ts=T.size();
  for(int i=0;i<ss;i++){
    for(int j=0;j<ts;j++){
      if(i==0){
        if(S[i]==T[j])
          dn[j]=S[i];
        else if(j==0)
          dn[j]="";
        else
          dn[j]=dn[j-1];
        ds[j]=dn[j];
      }else if(j==0){
        if(S[i]==T[j])
          dn[j]=T[j];
        else
          dn[j]=ds[j];
      }else{
        if(dn[j-1].size()<ds[j].size())
          dn[j]=ds[j];
        else
          dn[j]=dn[j-1];
        if(S[i]==T[j] && dn[j].size()<ds[j-1].size()+1)
          dn[j]=ds[j-1]+T[j];
        
        ds[j-1]=dn[j-1];
        if(j==ts-1)
          ds[j]=dn[j];
      }
    }
  }
  cout<<ds[ts-1];
}

Measured memory_bytes: 7808
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;

ll mod_pow(ll x,ll n,ll m){
    if(n==0) return 1;
    ll res=mod_pow(x*x%m,n/2,m);
    if(n&1) res=res*x%m;
    return res;
}

map<ll,ll> p_f(ll n){
    map<ll,ll> res;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            while(n%i==0){
                res[i]++;
                n/=i;
            }
        }
    }
    if(n!=1) res[n]=1;
    return res;
}

int main(){
    ll n;
    cin>>n;
    ll ans=n;
    map<ll,ll> mp=p_f(n);
    for(auto p:mp){
        ans/=p.ft;
        ans*=(p.ft-1);
    }
    cout<<ans<<endl;
}


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

int main(){
    ll N,Y;
    cin>>N>>Y;
    ll x,y,z;
    int flg=0;
    for(x=0;x<=N;x++){
        for(y=0;y<=N-x;y++){
            z=N-x-y;
            if(10000*x+5000*y+1000*z==Y&&flg==0){
                cout<<x<<" "<<y<<" "<<z<<endl;
                flg=1;
            }
        }
    }
    if(flg==0) cout<<"-1 -1 -1"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
     long long a;
     long long b;
      long long c;
      cin >> a >> b >> c;
      if(c <= b || c <= a){
        cout << "No" << endl;}
      else if(4*a*b < (c-a-b)*(c-a-b))
      {cout << "Yes" << endl;}
      else {
        cout << "No" << endl;}
    }

Measured memory_bytes: 256
n = gets.to_i

now = [0,0,0]
n.times do |i|
    t,x,y = gets.split.map(&:to_i)
    s = (t -(now[0] + (now[1] - x).abs + (now[2] - y).abs))

    if s >= 0 && s % 2 == 0
        now = [t,x,y]
    else
        puts "No"
        exit
    end
end

puts "Yes"

Measured memory_bytes: 1788
#include "bits/stdc++.h"

using namespace std;
//vector<long long> factors;
#define ll long long

#define pii pair<int,int>
#define pll pair<ll,ll>
#define _ <<'\n'
#define __ << ' '
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
int IT_MAX = 1 << 17;
ll MOD = 1000'000'007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x0f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
#define szz(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(false); cout.tie(0);cin.tie(0);
#define flush fflush(stdout)

ll mod(ll a, ll m) { return (a + (abs(a) / m) * m + m) % m; }

//****************************don't use int!!!!!!!****************************//
//***************************code starts here!!!!!****************************//


int main() {
    IOS

    ll n;
    cin >> n;
    string st;
    cin >> st;
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        ll ind = i;
        while (ind < n && st[i] == st[ind]) {
            ++ind;
        }
        i = ind - 1;
        ++ans;
    }
    cout << ans;
    return 0;
}


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

int main(){
	int h,w;
	cin >> h >> w;
	vector<string> a(h);
	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}

	vector<bool> row(h, false);
	vector<bool> col(w, false);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
  
  
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define rever(vec) reverse(all(vec));
#define cend cout << endl;
#define prique(T) priority_queue<T,vector<T>,greater<T>>
struct edge { int to, cost; };
using P = pair<int, int>;
using PP=pair<P, int>;
const int mod = 1e9 + 7, inf = 1e16;

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			if (mod <= ans * x) ans = ans * x % mod;
			else ans *= x;
		}
		if (mod <= x * x) x = x * x % mod;
		else x *= x;
		n >>= 1;
	}
	return ans;
}

int fact_memo[114514];
int fact(int n) {
	int ans = 1;
	if (fact_memo[n]) return fact_memo[n];
	rep(i, n) {
		ans *= (i + 1);
		if (mod <= ans) ans %= mod;
		fact_memo[i + 1] = ans;
	}
	return (ans + mod) % mod;
}

int comb(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod * modpow(fact(r), mod - 2) + mod) % mod;
}

int perm(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod + mod) % mod;
}

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

int lcm(int a, int b) {
	return a * b / gcd(a, b);
}

bool pri(int p) {
	for (int i = 2; i * i <= p; i++) if (p % i == 0) return false;
	return p > 1;
}

P operator+(const P& a, const P& b) {
	return P(a.first + b.first, a.second + b.second);
}
P operator-(const P& a, const P& b) {
	return P(a.first - b.first, a.second - b.second);
}

int n;
signed main() {
	scanf("%lld", &n);
	rep(i, n) {
		int a;
		scanf("%lld", &a);
		if (a & 1) {
			printf("first\n");
			return 0;
		}
	}
	printf("second\n");
}

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

a, b, c, d = map(int, input().split())

if c > d:
	tmp = c
	c = d
	d = tmp
lcm = (c * d) // gcd(c, d)

Cstart = a - (a % c) + c if a % c != 0 else a
Cend = b - (b % c)
Dstart = a - (a % d) + d if a % d != 0 else a
Dend = b - (b % d)
LCMstart = a - (a % lcm) + lcm if a % lcm != 0 else a
LCMend = b - (b % lcm)

# print(Cstart, Cend)
# print(Dstart, Dend)
# print(LCMstart, LCMend)
# print()

Ccnt, Dcnt, LCMcnt = 0, 0, 0
if Cstart <= Cend:
	Ccnt = (Cend - Cstart) // c + 1
if Dstart <= Dend:
	Dcnt = (Dend - Dstart) // d + 1
if LCMstart <= LCMend:
	LCMcnt = (LCMend - LCMstart) // lcm + 1

# print(Ccnt, Dcnt, LCMcnt)
# print((Cend - Cstart)//4, Ccnt)

print((b-a+1) - Ccnt - Dcnt + LCMcnt)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

#define int long long

#if defined(__GNUC__)
#define __int32 __int32_t
#endif // __GNUC__

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); (i)++)
#define REP2(i, x, n) for(itn (i) = x; (i) < (n); (i)++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) sort(ALL(x))
#define RSORT(x, T) sort(ALL(x), greater<(T)>())
#define REVERCE(x) reverce(ALL(x))

#define INT_POW(x, y) [](int a, int b) -> int {int c = a; REP(i, b - 1){c *= a;} return c;}(x, y)
#define INT_POWM(x, y, m) [](int a, int b, int m) -> int {int c = a; REP(i, b - 1){c *= a; c %= m;} return c;}(x, y, m)

itn main() {
	ios::sync_with_stdio(false);

	int x, y;

	cin >> x >> y;

	if (x == 1 && y == 1) {
		cout << 1000000;
		return 0;
	}

	int re = 0;

	switch (x)
	{
	case 1:
		re += 300000;
		break;
	case 2:
		re += 200000;
		break;
	case 3:
		re += 100000;
		break;
	}

	switch (y)
	{
	case 1:
		re += 300000;
		break;
	case 2:
		re += 200000;
		break;
	case 3:
		re += 100000;
		break;
	}

	cout << re;

	return 0;
}


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

int main(){
    int N;
    cin >> N;
    string stones;
    cin >> stones;
    int i = 0;
    int j = N-1;
    int count = 0;
    while (i < j) {
        while (stones[i] == 'R') {
            i++;
        }
        if (i >= j) break;
        while (stones[j] == 'W') {
            if (j == 0) break;
            j--;
        }
        if (i >= j) break;
        count++;
        i++;
        j--;
    }
    cout << count << endl;
}




Measured memory_bytes: 3712
n, m = map(int,input().split())

la = []
for i in range(n):
    a, b = map(int, input().split())
    la.append((a,b))

ca = []
for i in range(m):
    a, b = map(int, input().split())
    ca.append((a,b))

for i in range(len(la)):
    mi = 1000000001
    ans = 0
    for j in range(len(ca)):
        p = abs(la[i][0]-ca[j][0]) + abs(la[i][1]-ca[j][1])
        if  p < mi:
            mi = p
            ans = j+1
    print(ans)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<S<<endl
using namespace std;


int main(){
	int N,M;
	while(cin>>N>>M&&N){
		int h[1501],w[1501];
		map<int,int> allh,allw;
		int ans=0,mx=0,k;
		REP(i,0,N){
			cin>>h[i];
			k=0;
			for(int j=i;j>=0;j--){
				k+=h[j];
				allh[k]++;
			}
		}
		mx=max(mx,k);
		REP(i,0,M){
			cin>>w[i];
			k=0;
			for(int j=i;j>=0;j--){
				k+=w[j];
				allw[k]++;
			}
		}
		mx=max(mx,k);
		REP(i,1,mx+1){
			ans+=allh[i]*allw[i];
		}
		p(ans);
	}

	return 0;
}

Measured memory_bytes: 50656
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cotu cout
#define itn int
const int INF = 1e9 + 7;

int main(){
    int n, k; cin>>n>>k;
    vi v(n);
    for(int i = 0; i < n; i++) cin>>v[i];
    vi dp(n+1,INF);
    dp[0]=0;
    for(int i = 0; i < n-1; i++){
        for(int j = 1; j <= min(k,n-i); j++){
            dp[i+j] = min(dp[i+j], dp[i]+ abs(v[i+j]-v[i]));
        }
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
using namespace std;
using ll=long long;
#define MOD  1000000007

ll n,ans=0;

void dfs(ll x,int a, int b, int c){
  if(x>n) return;
  if(a&b&c) ans++;

  dfs(x*10+3,1,b,c);
  dfs(x*10+5,a,1,c);
  dfs(x*10+7,a,b,1);
}

int main(int argc, char const *argv[]) {
  std::cin >> n;
  dfs(0,0,0,0);
  std::cout << ans << '\n';

  return 0;
}


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

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

string s="";

int main(){
    ll n;
    cin>>n;
    ll nega=0;
    ll pos=0;
    ll now=1;
    if(n==0){cout<<0;return 0;}
    while(1){
        if(nega+now<=n&&n<=pos+now){
            break;
        }
        if(now>0){
            pos+=now;
        }else{
            nega+=now;
        }
        now*=-2;
    }
    while(now){
        if(nega+now<=n&&n<=pos+now){
            s+="1";
            n-=now;
        }else{
            s+="0";
        }
        now=-now/2;
        if(now>0){
            pos-=now;
        }else{
            nega-=now;
        }
    }
    cout<<s<<endl;

    return 0;
}

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

ll n,k,x,y,ans;
ll w[101];

int main() {
    cin>>n>>k;
    for(ll i=1;i<=k;i++)
    {
        cin>>x;
        for(ll j=1;j<=x;j++)
            cin>>y,w[y]=1;
    }
    for(ll i=1;i<=n;i++)
        if(!w[i])
            ans++;
    cout<<ans;
}


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

char ask(int v[], int n) {
    cout << '?';
    for (int i = 0; i < n; i ++) {
        cout << ' ' << v[i];
    }
    cout << '\n' << flush;
    string s;
    cin >> s;
    return s[0];
}

void generate(int v[], int n, int x) {
    for (int i = 0; i < n; i ++) {
        v[i] = x + i + 1;
    }
}

int binary_search(char first_color, int n) {
    int left = 0, right = n;
    int v[n];
    while (left <= right) {
        int mid = (left + right) / 2;
        generate(v, n, mid);
        char color = ask(v, n);
        if (color == '-')   return -1;
        if (first_color != color) {
            right = mid - 1;
        } else {
            left = mid + 1;
        }
    }
    return right;
}

int main() {
    int n;
    cin >> n;
    char sol[2 * n];
    int v[n];
    generate(v, n, 0);
    char first_color = ask(v, n);
    int poz = binary_search(first_color, n);
    sol[poz] = first_color;
    sol[poz + n] = 'R';
    if (first_color == 'R') sol[poz + n] = 'B';
    generate(v, n, poz);
    for (int i = 0; i < poz; i ++) {
        v[0] = i + 1;
        sol[i] = ask(v, n);
    }
    for (int i = poz + n + 1; i < 2 * n; i ++) {
        v[0] = i + 1;
        sol[i] = ask(v, n);
    }
    int j = 0;
    for (int i = 0; i < poz; i ++, j ++) {
        v[j] = i + 1;
    }
    for (int i = poz + n + 1; i < 2 * n; i ++, j ++) {
        v[j] = i + 1;
    }
    for (int i = poz + 1; i < poz + n; i ++) {
        v[j] = i + 1;
        sol[i] = ask(v, n);
    }
    sol[2 * n] = '\0';
    cout << "! " << sol;
    return 0;
}


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

int main() {
	string s;
	cin >> s;
	int sum = 0;
	for(int i = 0; i < s.size(); i++) {
		sum += (s[i] - '0');
		sum %= 9;
	}
	if(sum == 0)
		printf("Yes");
	else 
		printf("No");
	return 0;
} 

Measured memory_bytes: 3488
import java.util.Scanner;
  
public class Main {
	
  public static void main(String[] args) {
	  Scanner sc=new Scanner(System.in);
	  int W=Integer.parseInt(sc.next());
	  int H=Integer.parseInt(sc.next());
	  int x=Integer.parseInt(sc.next());
	  int y=Integer.parseInt(sc.next());
	  int r=Integer.parseInt(sc.next());
	  
	  
	  if(y+r<=H&&y-r>=0){
		  if(x+r<=W&&x-r>=0){
			  System.out.println("Yes");
		  }
		  else{
			  System.out.println("No");
		  }
	  }
	  else{
		  System.out.println("No");
	  }
	  
    
  }
}

Measured memory_bytes: 17292
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main(){
  ll H,W;cin >> H >> W;
  char S[107][107];
  rep(i,H){
    cin >> S[i];
  }
  rep(i,H){
    cout << S[i] << endl << S[i] << endl;
  }
}

Measured memory_bytes: 888
while True:
    try:
        m = int(raw_input())
        a = sorted([list(map(int, raw_input().split())) for i in range(m)])
        dax = [a[i][0]-a[0][0] for i in range(m)]
        
        n = int(raw_input())
        b = sorted([list(map(int, raw_input().split())) for i in range(n)])
        bx = [b[i][0] for i in range(n)]
        
        for i in range(n-m):
            for da in dax:
                if bx[i]+da not in bx:
                    break
            else:
                print b[i][0]-a[0][0],b[i][1]-a[0][1]
                break
    except:
        break

Measured memory_bytes: 4484
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)

//変数
int A, B;

//解法
void solve() {

	if (A > 8 || B>8) {
		cout << ":(";
		return;
	}
	else {
		cout << "Yay!";
	}

	return;
}

int main() {
	//入力
	cin >> A>>B;
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i, j) for (long long i = j; i > 0; i--)
using namespace std;


int main() {
	double n, k;
	cin >> n >> k;
	double ans = 0;

	for (int i = 1; i <= n; i++) {
		int num = i;
		double j;
		for (j = 0; num < k; j++) {
			num *= 2;
		}
		ans += (1 / n) * (1 / pow(2.0, j));
	}

	printf("%.15f", ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		byte a = sc.nextByte();
		byte b = sc.nextByte();
		byte c = sc.nextByte();
		sc.close();
		System.out.println(c + " "+ a + " " + b);
	}
}

Measured memory_bytes: 20820
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] ACcounter = new int[N];
        int[] WAcounter = new int[N];
        int AC = 0;
        int WA = 0;
        
        for(int i = 0; i < M; i++){
            int p = sc.nextInt();
            String S = sc.next();
            if(S.equals("WA") && ACcounter[p-1] == 0){
                WAcounter[p-1]++;
            }
            if(S.equals("AC")){
                ACcounter[p-1] = 1;
            }
        }
        
        for(int i = 0; i < N; i++){
            AC += ACcounter[i];
            if(ACcounter[i] == 1){
                WA += WAcounter[i];
            }
        }
        
        System.out.println(AC + " " + WA);
        
    }
}

Measured memory_bytes: 65544
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main() {
    int n; cin >> n;
    vector<ll> a(n);
    map<ll,ll> mp;
    rep(i, n) {
        cin >> a[i];
        mp[a[i]]++;
    }
    ll total = 0;
    for( auto i = mp.begin(); i != mp.end() ; ++i ) {
        //std::cout << i->first << " " << i->second << "\n";
        total += i->second * (i->second-1) / 2;
    }
    ll ans = 0;
    rep(i, n) {
        if(mp[a[i]] == 1) ans = total;
        else {
            ll sa = mp[a[i]] - 1;
            ans = total - sa;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 11008
function solve(arr, len) {
    let ans = 0;
    const V = [];
    const sorted = [];
    const mapTable = [];
    const min = Math.min(...arr);

    for (let i = 0; i < len; i++) {
        sorted[i] = arr[i];
        V[i] = false;
    }

    sorted.sort((a, b) => a - b);

    for (let i = 0; i < len; i++) {
        mapTable[sorted[i]] = i;
    }
    for (let i = 0; i < len; i++) {
        if (V[i]) continue;
        let cur = i;
        let s = 0;
        let m = 10000;
        let an = 0;
        while (1) {
            V[cur] = true;
            an++;
            let v = arr[cur];
            m = Math.min(m, v);
            s += v;
            cur = mapTable[v];
            if (V[cur]) break;
        }
        ans += Math.min(s + (an - 2) * m, m + s + (an + 1) * min);
    }

    return ans;
}


function main(_stdin) {
    const stdin = _stdin.split('\n');
    const len = parseInt(stdin.shift(), 10);
    const seq = stdin.shift().split(' ').map(e => parseInt(e, 10));

    const ans = solve(seq, len);
    console.log(ans);
}


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



Measured memory_bytes: 18460
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ll n;
	cin>>n;
	ll a[n][3];
	ll ma = INT_MIN;
	ll dp[n][3];
	for(ll i=0;i<n;i++)
    {
    	for(ll j=0;j<3;j++)
    	{
    		cin>>a[i][j];
		}
	}
	dp[0][0] = a[0][0];
	dp[0][1] = a[0][1];
	dp[0][2] = a[0][2];
	for(ll i=1;i<n;i++)
	{
		dp[i][0] = max(dp[i-1][1]+a[i][0], dp[i-1][2]+a[i][0]);
		dp[i][1] = max(dp[i-1][0]+a[i][1], dp[i-1][2]+a[i][1]);
		dp[i][2] = max(dp[i-1][0]+a[i][2], dp[i-1][1]+a[i][2]);
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define pb push_back
#define fi first
#define se second
 
const ll MOD = 1000000007;
const string RGB = "RGB"; 

int main() {
   int n; scanf("%d", &n);
   vector<int> h(n);
   for (int& i : h)
      scanf("%d", &i);
   int i = 0;
   int ans = 0;
   while (i < n) {
      int cur = i;
      while (cur < n - 1 && h[cur] >= h[cur + 1])
         ++cur;
      ans = max(cur - i, ans);
      i = cur + 1;
   }
   printf("%d", ans);
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define FORR(i, m, n) for(int i=m; i>=n; i--)
#define INF 999999999
#define llong long long
#define VSORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
10
2 5 100 2 2 2 2 2 2 2
)");
#define cin input
#endif

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

	vector<int> vec(n);
	REP(i,n)
		cin >> vec[i];

	sort(vec.begin(), vec.end(), greater<int>());

	int a=0;
	int b=0;

	REP(i,n)
	{
		if(i%2==0)
			a += vec[i];
		else
			b += vec[i];		
	}
	cout << a-b << endl;
}

Measured memory_bytes: 256
s= input()

a = 0
count = 0
for i in range(len(s)):
    if s[i]=='A':
        count+=1
    elif s[i]=='C':
        count+=1
    elif s[i]=='G':
        count+=1
    elif s[i]=='T':
        count+=1
    else:
        count=0
    a = max(a,count)
print(a)


Measured memory_bytes: 3060
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <typeinfo>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;

int data[30][30]={};
int n;


void wf(){
    rep(k,n){
        rep(i,n){
            rep(j,n){
                data[i][j]=min(data[i][j] , data[i][k]+data[k][j]);
            }
        }
    }
}

int main(){
    rep(i,20){
        rep(j,20){
            if(i==j)data[i][j]=0;
            else data[i][j]=INF;
        }
    }
    char ch;

    cin>>n;
    int m;
    cin>>m;
    rep(i,m){
        int a,b,c,d;
        cin>>a>>ch>>b>>ch>>c>>ch>>d;
        a--;b--;
        data[a][b]=c;
        data[b][a]=d;
    }
    int x1,x2,y1,y2;
    cin>>x1>>ch>>x2>>ch>>y1>>ch>>y2;
/*
 x1：大工の出発する町の番号
 x2：柱のある山里の番号
 y1：殿様から大工が受け取ったお金
 y2：柱の代金
 */
    wf();
    cout<<y1-y2-data[x1-1][x2-1]-data[x2-1][x1-1]<<endl;
    
    
    return 0;
 }

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

int N;
int a[1000];
int j = 0;

int main(){
  cin >> N;
  int M = N;
  double n = sqrt(N);
  for(int i = 2; i <= n; i++){
    while (N % i == 0){
	  N = N / i;
	  a[j] = i;
	  j++;
	  }
    }
 std::cout << M << ":" << std::flush;
 if (j > 0){
 for (int l = 0; l <= j - 2; l++){
  std::cout << " " << a[l] << std::flush;
   }
  if (N == 1){
  cout << " " << a[j-1] << endl;
  }
  else{
  cout << " " << a[j-1] << " " << N << endl;
  }
  }
  else {
    cout << " " << M << endl;
  }
 }

Measured memory_bytes: 1168
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd>> Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod


int main(){
    string S,T; cin>>S>>T;
    ll ans=0;
    rep(i,S.size()) if(S[i]!=T[i]) ans++;
    cout<<ans<<endl;
    
}




Measured memory_bytes: 3924