akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>

#include <boost/algorithm/string/predicate.hpp>

using namespace std;

#if 0
// memo
abs()

start_with(str, "hoge");
ends_with(str, "hoge");

std::sort(d.begin(), d.end());
d.erase(std::unique(d.begin(), d.end()), d.end());
#endif

using namespace boost;
using namespace boost::algorithm;

static inline bool isOdd(int v)
{
    return v & 0x01;
}

int main()
{
    std::string s;

    cin >> s;
    printf("%c", s[0]);
    cin >> s;
    printf("%c", s[1]);
    cin >> s;
    printf("%c\n", s[2]);

    return 0;
}


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

int main(){
    int seat, person, gap;
    cin >> seat >> person >> gap;
    int filled = 0, ans = 0;
    seat -= gap;
    for(int i=0; filled<=seat; i++){
        filled += person + gap; 
        if(filled<=seat) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        int x = num.nextInt();
        int y = num.nextInt();
        int result = 0;

        if(x < y) {
            int t = x;
            x = y;
            y = t;
        }

        while(true) {
            int z = x % y;
            x = y;
            y = z;
            if(y == 0) {
                System.out.println(x);
                break;
            }
        }
        
    }
}


Measured memory_bytes: 26372
N = int(input())
if N == 1:
    print(1)
    exit()
# calculate primes by sieve
primes = list(range(2, N + 1))
prime_index = 0
n = primes[prime_index]
while n**2 <= N:
    primes = list(filter(lambda x: x == n or x % n != 0, primes))
    prime_index += 1
    n = primes[prime_index]
# calculate exponents
exponents = [0 for _ in range(len(primes))]
for n in range(2, N + 1):
    for prime_index, prime in enumerate(primes):
        exponent = 0
        tmp = n
        while tmp % prime == 0:
            tmp //= prime
            exponent += 1
        exponents[prime_index] += exponent
# calculate answer
const = 10**9 + 7
answer = 1
for e in exponents:
    answer = answer * (e + 1)
    answer %= const
print(answer)

Measured memory_bytes: 3064
/*
██╗  ██╗ █████╗ ██████╗ ███████╗███████╗███╗   ███╗        ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗ ████║        ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝ ███████║██████╔╝█████╗  █████╗  ██╔████╔██║        █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗ ██╔══██║██╔══██╗██╔══╝  ██╔══╝  ██║╚██╔╝██║        ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██║  ██║██║  ██║███████╗███████╗██║ ╚═╝ ██║███████╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
Believe in yourself ,( try and try and then try ), You can do it 
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define clr(arr, x) memset(arr, x, sizeof arr)
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define OO 0x3f3f3f3f3f3f3f3fLL
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
void K_K(){
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
int n;
vector<int>a, b, c;
int dp[100005][5];
int sol(int idx, int pre){
	if (idx == n)
		return 0;
	int& ret = dp[idx][pre];
	if (~ret)
		return ret;
	int ch1 = 0, ch2 = 0, ch3 = 0;
	if (pre != 1)
		ch1 = sol(idx + 1, 1) + a[idx];
	if (pre != 2)
		ch2 = sol(idx + 1, 2) + b[idx];
	if (pre != 3)
		ch3 = sol(idx + 1, 3) + c[idx];
	return ret = max({ ch1, ch2, ch3 });
}
int main(){
	K_K();
	cin >> n;
	a.resize(n);
	b.resize(n);
	c.resize(n);
	clr(dp, -1);
	for (int i = 0; i < n; i++)
		cin >> a[i] >> b[i] >> c[i];
	cout << sol(0, 0);
}

Measured memory_bytes: 9600
#include <cstdio>
#include <algorithm>
#define mod ((ll)1e9+7)
#define maxn 100010
using namespace std;
typedef long long ll;
int abs(int a) {
	if (a<0)
		return -a;
	return a;
}
int n,m;
ll d[maxn],ans;
int main() {
	scanf("%d %d",&n,&m);
	if (abs(n-m)>1)
		ans=0;
	else {
		d[1]=1;
		for (int i=2;i<=max(n,m);i++)
			d[i]=(d[i-1]*i)%mod;
		if (n==m)
			ans=((2*d[n])%mod*d[n])%mod;
		else ans=(d[n]*d[m])%mod;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 896
#include"bits/stdc++.h"
using namespace std;
struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0);cout<<fixed<<setprecision(10); } } ___;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}

#define     uniq(x)         sort(x.begin(),x.end());x.erase(unique(x.begin(),x.end()),x.end())

#define pii pair<int,int>
#define ff first
#define ss second
#define endll '\n'

using ll = long long int;

const int M = 1e9+7;

int main()
{
    ll n;
    cin>>n;
    map<ll,ll> mm;
    for(int i=0;i++<n-1;)
    {
        int a;cin>>a;
        mm[a]++;
    }

    for(int i=1;i<=n;i++)
    {
        cout<<mm[i]<<endll;
    }


}



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

#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, c;
	cin >> a >> b >> c;
	REP(i, b){
		if (a*i%b==c){ cout << "YES" << endl; return 0; }
	}
	cout << "NO" << endl;
}


Measured memory_bytes: 256
import numpy as np

N = int(input())
h = np.array(list(map(int, input().split())))


def recurse(arr):
    if len(arr) == 0:
        return 0
    if all([e == 0 for e in arr]):
        return 0

    cnt = 0
    while all([e > 0 for e in arr]):
        arr = arr - 1
        cnt += 1

    next = []
    for e in arr:
        if e != 0:
            next.append(e)
        else:
            cnt += recurse(np.array(next))
            next.clear()
    if len(next) > 0:
        cnt += recurse(np.array(next))

    return cnt


print(recurse(h))


Measured memory_bytes: 12668
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const int N=55;
const ll INF=~0u>>2;
ll dp[N][N*N*2],n,a[N],A;
int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
int main(){
//	freopen("ex.in","r",stdin);
	n=read();A=read();
	for(int i=1;i<=n;++i) a[i]=read(),a[i]-=A;
	dp[0][2500]=1;
	for(int i=1;i<=n;++i){
		for(int j=0;j<=5000;++j){
			if(j+a[i]>=0) dp[i][j]+=dp[i-1][j+a[i]];
			dp[i][j]+=dp[i-1][j];
		}
	}
	printf("%lld",dp[n][2500]-1);
	return 0; 
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using ll=long long;
const ll MOD=1e9+7;
const int INF=1<<30;

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

int dp[3010][6010];

int main(){
  int N,T;
  cin >> N >> T;
  vector<pair<int,int> > wv(N);
  rep(i,N){
    cin >> wv[i].first >> wv[i].second;
  }
  sort(wv.begin(),wv.end());
  rep(i,N){
    rep(j,6010){
      if(j<T) chmax(dp[i+1][j+wv[i].first],dp[i][j]+wv[i].second);
      chmax(dp[i+1][j],dp[i][j]);
    }
  }
  int ans=0;
  rep(j,6010){
    if(ans<dp[N][j]){
      ans=dp[N][j];
    }
  }
  cout << ans << endl;
  
  
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

constexpr int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
constexpr int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<string> v(n);
	REP(i, n)cin >> v[i];
	vector <vector<pii>> pos(26);
	REP(i, n)REP(j, m) {
		if (isalpha(v[i][j])) {
			pos[v[i][j] - 'A'].push_back({ i,j });
		}
	}

	vi b(26, 0);
	auto f = [&](int x, int y) {
		return v[x][y] != '.' && b[v[x][y] - 'A'] == 0;
	};
	int cnt = 0;
	while (1) {
		bool updated = false;
		REP(i, 26) {
			if (b[i] || pos[i].empty())continue;
			int x1 = pos[i][0].first, y1 = pos[i][0].second,
				x2 = pos[i][1].first, y2 = pos[i][1].second;
			bool ok = true;
			if (x1 == x2) {
				if (abs(y1 - y2) == 1)continue;

				FOR(i, min(y1, y2) + 1, max(y1, y2)) {
					if (f(x1, i))ok = false;
				}
			}
			else if (y1 == y2) {
				if (abs(x1 - x2) == 1)continue;
				FOR(i, min(x1, x2) + 1, max(x1, x2)) {
					if (f(i, y1))ok = false;
				}
			}
			else {
				if (x1 > x2) {
					swap(x1, x2);
					swap(y1, y2);
				}
				ok = false;
				bool flag = true;
				FOR(i, x1 + 1, x2) {
					if (f(i, y1))flag = false;
				}
				FOR(i, min(y1, y2) + 1, max(y1, y2)) {
					if (f(x2, i))flag = false;
				}
				if (f(x2, y1))flag = false;
				if (flag)ok = true;
				flag = true;
				FOR(i, x1 + 1, x2) {
					if (f(i, y2))flag = false;
				}
				FOR(i, min(y1, y2) + 1, max(y1, y2)) {
					if (f(x1, i))flag = false;
				}
				if (f(x1, y2))flag = false;
				if (flag)ok = true;

			}
			if (ok) {
				updated = true;
				b[i] = 1;
				cnt++;
			}
		}
		if (!updated)break;

	}
	cout << 2 * cnt << endl;
}


Measured memory_bytes: 3352
-- Your code here!
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
 
readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [a,b,c] <- getIntList
    print $ max (c-(a-b)) 0
    

Measured memory_bytes: 380
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    usize n, m;
    std::cin >> n >> m;
    vec<u32> a(n);
    while (m--) {
        usize u, v;
        std::cin >> u >> v;
        u--, v--;
        a.at(u)++;
        a.at(v)++;
    }
    for (u32 x: a) {
        std::cout << x << '\n';
    }
}


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

int main(){
  int N, dum;
  cin >> N;
  int ans[N]={};

  for(int i=0;i<N-1;i++){
    cin >> dum;
    ans[dum-1]++;
  }

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

  return 0;
}

Measured memory_bytes: 4400
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
    static class Dicm
    {
        public static void Sum(this Dictionary<int, int> d1, Dictionary<int, int> d2)
        {

            foreach (int i in d2.Keys)
            {
                if (d1.ContainsKey(i))
                    d1[i] += d2[i];
                else
                    d1[i] = d2[i];
            }
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            int i;
            var dic = new Dictionary<int, int>();
            while (true)
            {
                i = Int32.Parse(Console.ReadLine());
                if (i == 0)
                    break;
                for (int j = 2; j <= i; j++)
                    dic.Sum(GetPrime(j));
                if (dic.ContainsKey(2) & dic.ContainsKey(5))
                {
                    if (dic[2] > dic[5])
                        dic[2] = dic[5];
                }
                else
                    dic[2] = 0;
                Console.WriteLine(dic[2]);
                dic.Clear();
            }
        }

        static Dictionary<int, int> GetPrime(int num)
        {
            var dic = new Dictionary<int, int>();

            for (int i = 2; i <= num; i++)
            {
                if (num % i == 0)
                {
                    if (dic.ContainsKey(i))
                        dic[i]++;
                    else
                        dic[i] = 1;
                    num = num / i;
                    i--;
                }
            }
            return dic;
        }
    }
}

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

int main() {
  
  string S; cin >> S;
  
  if (S == "Sunny") cout << "Cloudy" << endl;
  else if (S == "Cloudy") cout << "Rainy" << endl;
  else cout << "Sunny" << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h> 
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<climits>
using namespace std;
typedef long long int lli;
lli mod=1000000007;
vector < lli> primes;

void Sieve(lli n) 
{ 
    bool prime[n+1];
	for(lli i=0;i<n+1;++i)
		prime[i]=true;
    for (lli p=2;p*p<=n;++p) 
    {
        if (prime[p] == true) 
        {  
            for (lli i=2*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    }  
    for(lli p=2; p<=n; p++) 
       if (prime[p]) 
		primes.push_back(p);  
}
lli gcd(lli a,lli b)  
 {
    if(b>a)
        swap(a,b);
    if (a%b==0)  
        return b;  
    else 
        return gcd(a%b,b);  
 }
lli power(lli x,lli y,lli m)   
{ 
    lli res = 1; 
    x=x%m;   
    while (y > 0) 
    {  
        if (y%2==1) 
            res =(res*x)%m;  
        y=y/2; 
        x=(x*x)%m; 
    } 
    return res; 
}

int main()
{
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	lli n;
	cin>>n;
	cout<<n*n*n<<endl;
}

Measured memory_bytes: 256
#define f(I)(p[I]+h[I]*(h[I]-2*h[i]))
long C,h[2<<17],p[2<<17],X,a;P[2<<17];s,t,x,y;main(i){for(scanf("%*d%ld%d",&C,h);~scanf("%d",&a);P[++t]=i-1){for(h[i]=a;X=f(P[s]),s<t&&X>f(P[s+1]);s++);for(p[i++]=X+=a*a+C;s<t&&(h[y=P[t]]-h[x=P[t-1]])*(f(y)-f(i-1))>(a-h[y])*(f(x)-f(y));t--);}printf("%ld",X);}

Measured memory_bytes: 4608
using System;


namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            //??´??°a,b???????????§?????????
            string AB = Console.ReadLine();
            string[] ab = (AB.Split(' '));
            int a = int.Parse(ab[0]);
            int b = int.Parse(ab[1]);

            //??§?°???¢???
            if(a < b)
            {
                Console.WriteLine("a < b");
            }
            else if(a > b)
            {
                Console.WriteLine("a > b");
            }
            else
            {
                Console.WriteLine("a == b");
            }
        }
    }
}

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

int T, N, K, X[100010], d[100010];

int main(){
	cin >> T;
	for (int t = 0; t < T; t++){
		cin >> N >> K;
		for (int i = 0; i < N; i++)cin >> X[i];
		for (int i = 0; i + 1 < N; i++)d[i] = X[i + 1] - X[i];
		sort(d, d + N - 1);
		int l = max(0, N - K);
		long long sum = 0;
		for (int i = 0; i < l; i++)sum += d[i];
		cout << sum<<endl;
	}

}

Measured memory_bytes: 1952
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
 
//1-indexであることに注意
struct BIT {
    int n;
    vector<int> data;
 
    BIT(int n) : n(n), data(n + 1, 0) {}
 
    int sum(int i) {
        int s = 0;
        while (i > 0) {
            s += data[i];
            i -= i & -i;
        }
        return s;
    }
 
    void add(int i, int x) {
        while (i <= n) {
            data[i] += x;
            i += i & -i;
        }
    }
};
 
ll solve(string& L, string& R) {
    vector< deque<int> > hoge(26);
    for (int i = 0; i < R.size(); i++) {
        hoge[R[i] - 'a'].push_back(i + 1);
    }
    vector<int> foo;
    for (char c : L) {
        foo.push_back(hoge[c - 'a'].front());
        hoge[c - 'a'].pop_front();
    }
    BIT b(foo.size());
    ll res = 0;
    for (int i = 0; i < foo.size(); i++) {
        res += i - b.sum(foo[i]);
        b.add(foo[i], 1);
    }
    return res;
}
 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    vector<int> cnt(26, 0);
    for (char c : s) cnt[c - 'a']++;
    int n = s.length();
    int hoge = 0;
    int idx = -1;
    for (int i = 0; i < 26; i++) {
        hoge += cnt[i] % 2;
        if (cnt[i] % 2) idx = i;
    }
    if (hoge > n % 2) {
        cout << -1 << endl;
        return 0;
    }
 
    for (int i = 0; i < 26; i++) {
        cnt[i] = (cnt[i] + 1) / 2;
    }
 
    ll ans = 0;
    string L = "", R = "";
    for (int i = 0, cur = 0; i < n; i++) {
        if (s[i] - 'a' == idx && cnt[idx] == 1) {
            ans += i - cur;
            cnt[idx]--;
        } else if (cnt[s[i] - 'a']) {
            cnt[s[i] - 'a']--;
            ans += i - cur;
            L += s[i];
            cur++;
        } else {
            R += s[i];
        }
    }
    
    reverse(R.begin(), R.end());
    ans += solve(L, R);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2192
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#define rep(i,a,b) for(int i=a;i<=b;i++)
typedef long long ll;
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=1e5+10;
void io(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
ll a[N];
int main()
{
	io();
	ll n,k,q,b;cin>>n>>k>>q;
	for(int i=0;i<q;i++){
		cin>>b;
		a[b]++;
	}
	for(int i=1;i<=n;i++){
		if(a[i]+k-q<=0)puts("No");
		else puts("Yes");
	}
	return 0;
}

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

v = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0

for i in range(1 << n):
	tmp = 0
	for j in range(n):
		if(i >> j & 1):
			tmp += v[j] - c[j]
	ans = max(ans, tmp)

print(ans)


Measured memory_bytes: 42220
#include<stdio.h>
int main(void){
  int a,b,days;
  char tmp[7][10]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  while(1){
    days=0;
  scanf("%d %d",&a,&b);
  if(a==0&&b==0)break;

  days+=b;
  for(--a;a>0;a--){
    switch(a){
    case 4:
    case 6:
    case 9:
    case 11:
      days+=30;
      break;
    case 2:
      days+=29;
      break;
    default:
      days+=31;
      break;
    }
  }
  printf("%s\n",tmp[days%7]);
  }
  return 0;
}

Measured memory_bytes: 584
#include <cstdio>
#include <cstring>
#include<iostream>
using namespace std;
typedef long long LL;
string s;
int n;
LL SUM(string s)
{
    LL sum=0,tmp=0;
    for (int i=0;i<s.size();i++) {
        if(s[i]=='+')
        {
           sum+=tmp;
           tmp=0;
        }
        else
            tmp=tmp*10+s[i]-'0';
 
    }
    return sum+tmp;
}
int main ()
{
	LL sum=0;	
	cin>>s;
	int n=s.size()-1,a[11]={0};
    while(1)
    {
        string ss;
        for (int i=0;i<n;i++) {
            a[i+1]+=a[i]/2;
            a[i]%=2;
        }
        if(a[n])
            break;
        for (int i=0;i<n;i++) {
            ss+=s[i];
            if(a[i])
                ss+="+";
        }
        ss+=s[n];
        sum+=SUM(ss);
        a[0]++;
    }
	printf("%lld",sum);
    return 0;
}


Measured memory_bytes: 256
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>
#include <assert.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF		INT32_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

vector<bool> eratosthenes(ll N)
{
	vector<bool> is_prime(N + 1, 1);
	is_prime[0] = false;
	is_prime[1] = false;

	for (ll i = 2; i <= N; i++) {
		if (is_prime[i]) {
			for (ll j = 2 * i; j <= N; j += i) {
				is_prime[j] = false;  // 素数の倍数は素数ではない
			}
		}
	}

	return is_prime;
}

int main()
{
	ll Q = 0;
	ll ans = 0;
	ll max_val = 0;

	cin >> Q;
	vector<ll> L(Q);
	vector<ll> R(Q);

	Rep(i, Q) {
		cin >> L[i] >> R[i];
		max_val = max(max_val, max(L[i], R[i]));
	}

	// create
	vector<bool> is_prime = eratosthenes(max_val);

	// imos
	vector<ll> sum_table(max_val + 1, 0);
	for (ll i = 1; i <= max_val; ++i ) {
		ll tmp = ((is_prime[i] && is_prime[(i + 1) / 2])) ? 1 : 0;
		sum_table[i] = sum_table[i - 1] + tmp;
	}

	Rep(i, Q) {
		ans = sum_table[R[i]] - sum_table[L[i] - 1];
		cout << ans << endl;
	}

	return 0;
}


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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	int X, A, B;
	cin >>X >>A >>B;
	cout <<(X-A)%B <<endl;
	return 0;
}



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

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  string s;
  cin >> s;
  int a = stoi(s.substr(0, 2)), b = stoi(s.substr(2));

  if((a > 12 || a == 0) && 0 < b && b <= 12) cout << "YYMM\n";
  else if(0 < a && a <= 12 && (b > 12 || b == 0)) cout << "MMYY\n";
  else if(0 < a && a <= 12 && 0 < b && b <= 12) cout << "AMBIGUOUS\n";
  else cout << "NA\n";
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<double, long long> pdl;

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 1000000007

int n;
ll A[1<<20];

ll posFirst() {
    ll noper = 0;
    ll sum = 0;
    rep(i, n) {
        sum += A[i];
        if(i%2 == 0) {
            if(sum <= 0) {
                noper += -sum+1;
                sum = 1;
            }
        } else {
            if(sum >= 0) {
                noper += sum+1;
                sum = -1;
            }
        }
    }

    return noper;
}

ll negFirst() {
    ll noper = 0;
    ll sum = 0;
    rep(i, n) {
        sum += A[i];
        if(i%2 == 0) {
            if(sum >= 0) {
                noper += sum+1;
                sum = -1;
            }
        } else {
            if(sum <= 0) {
                noper += -sum+1;
                sum = 1;
            }
        }
    }

    return noper;
}

int main() {
  //freopen("input.in","r",stdin);
  //freopen("output.out","w",stdout);

  cin>>n;
  rep(i, n) cin>>A[i];

  ll ansp = posFirst();
  ll ansn = negFirst();

  cout<<min(ansn, ansp)<<endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v){stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modpow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isprime(ll n){if(n<2)return 0;if(!(n%2))return !(n-2);lll d=n-1,t,y;while(!(d%2))d>>=1;vl al={2,325,9375,28178,450775,9780504,1795265022};for(ll a:al){if(n<=a)break;t=d,y=modpow(a,t,n);while(t!=n-1&&y!=1&&y!=n-1)y=y*y%n,t<<=1;if(y!=n-1&&!(t%2))return 0;}return 1;}
void dout(double d){printf("%.12f\n",d);}
void YN(bool z){cout<<(z?"YES\n":"NO\n");}
void Yn(bool z){cout<<(z?"Yes\n":"No\n");}
void yn(bool z){cout<<(z?"yes\n":"no\n");}
const int iinf = 1e9+6;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;

const int N = 500;
int h, w;
bool r[N][N], b[N][N];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> h >> w;
  FOR(i, 0, h){
    string s;
    cin >> s;
    if(i==0){
      FOR(j, 0, w) r[i][j] = true;
    }else if(i==h-1){
      FOR(j, 0, w) b[i][j] = true;
    }else{
      FOR(j, 0, w){
        if(s[j] == '#') r[i][j] = b[i][j] = true;
        if(j%2){
          r[i][j] = true;
        }else{
          b[i][j] = true;
        }
      }
    }
  }
  FOR(i, 0, h){
    FOR(j, 0, w) cout << (r[i][j] ? '#' : '.');
    cout << endl;
  }
  cout << endl;
  FOR(i, 0, h){
    FOR(j, 0, w) cout << (b[i][j] ? '#' : '.');
    cout << endl;
  }
  return 0;
}

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

int main() {
	int N;
	char S[101];
	char T[101];
	cin >>N;
	for (int i = 0; i < N; i++) {
		cin >> S[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> T[i];
	}
	for (int i = 0; i < N; i++) {
		cout << S[i] << T[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,i,a[100100];
long long mn[100100],mx[100100],r;
int main() {
  scanf("%d",&n);
  for (i=0; i<=n; i++) scanf("%d",&a[i]);
  for (i=n; i>=0; i--) {
    mn[i]=(mn[i+1]+1)/2+a[i];
    if (i<30 && mn[i]>(1<<i)) break;
    mx[i]=mx[i+1]+a[i];
    if (i<30 && mx[i]>(1<<i)) mx[i]=(1<<i);
  }
  if (i>=0) { puts("-1"); return 0; }
  for (i=0; i<=n; i++) {
    mx[i+1]=min(mx[i+1],(mx[i]-a[i])*2);
    if (mx[i]<mn[i]) break;
    r+=mx[i];
  }
  if (i<=n) puts("-1"); else printf("%lld\n",r);
  return 0;
}


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

#if debug
#include "printer.hpp"
#define dump(a) cerr << #a << "(" << __LINE__ << ") = " << a << endl;
#else
#define dump(...)
#endif

#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define repr(i, a, b) for (int i = (b)-1; i >= a; i--)
#define all(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
const ll mod = 1000000007;
const ll INF = 1ll << 60;

ll pow(ll x, ll y) {
  ll ret = 1, tmp = x;
  while (y) {
    if (y % 2) ret = ret * tmp % mod;
    tmp = tmp * tmp % mod;
    y /= 2;
  }
  return ret;
}

ll inverse(ll x) { return pow(x, mod - 2); }

int main() {
  ll H, W;
  cin >> H >> W;
  vvi m(H, vi(W));
  rep(i, 0, H) {
    string s;
    cin >> s;
    rep(j, 0, W) {
      if (s[j] == '.') {
        m[i][j] = 1;
      }
    }
  }
  auto f = [&](ll x, ll y) {
    vvi dist(H, vi(W, INF));
    queue<pii> q;
    q.emplace(x, y);
    dist[x][y] = 0;
    while (q.size()) {
      pii fr = q.front();
      q.pop();
      vi dx {-1, 0, 1, 0};
      vi dy {0, 1, 0, -1};
      rep(i, 0, 4) {
        ll x = fr.first+dx[i];
        ll y = fr.second+dy[i];
        if (x < 0 || x >= H || y < 0 || y >= W) continue;
        if (m[x][y] && dist[x][y] == INF) {
          dist[x][y] = dist[fr.first][fr.second] + 1;
          q.emplace(x, y);
        }
      }
    }

    ll ans = 0;
    rep(i, 0, H) {
      rep(j, 0, W) {
        if (dist[i][j] != INF)
          ans = max(ans, dist[i][j]);
      }
    }
    return ans;
  };

  ll ans = 0;
  rep(i, 0, H) {
    rep(j, 0, W) {
      if (m[i][j])
        ans = max(ans, f(i, j));
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int isSameString(char *a, char *b)
{
    int k = 0;
    while (a[k] != '\0' && b[k] != '\0')
    {
        if (a[k] != b[k])
        {
            return 0;
        }
        k++;
    }

    if (a[k] != '\0' || b[k] != '\0')
    {
        return 0;
    }
    else
    {
        return 1;
    }
}

int main(void)
{
    int n, i = 0, j = 0, k = 0;
    scanf("%d\n", &n);
    char tmp, a[114][15];
    gets(a[0]);
    while (a[0][j] > 96)
    {
        tmp = a[0][j];
        j++;
    }
    for (i = 1; i < n; i++)
    {
        j = 0;
        gets(a[i]);
        if (a[i][0] != tmp)
        {
            puts("No");
            return 0;
        }
        while (a[i][j] > 96)
        {
            tmp = a[i][j];
            j++;
        }
    }
    for (i = 0; i < n - 1; i++)
    {
        for (j = i + 1; j < n; j++)
        {
            if (isSameString(a[i], a[j]))
            {
                puts("No");
                return 0;
            }
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 128
/************************************************
*Author        :  xzj213
*Created Time  :  2019.10.27.20:01
*Mail          :  xzj213@qq.com
*Problem       :  A
************************************************/
#include <bits/stdc++.h>
using namespace std;
int x,y;
int read() {
    int x=0,f=1;
    char ch=getchar();
    while(ch>57 || ch<48){if(ch==45)f=-1;ch=getchar();}
    while(ch<=57 && ch>=48){x=x*10+ch-48;ch=getchar();}
    return x*f;
}
int main() {
    x=read();y=read();
	if(x>9 || y>9){
		puts("-1");
		return 0;
	}
	cout<<x*y<<endl;
    return 0;
}


Measured memory_bytes: 256
def f(h,w,a):
    da = [[0]*(w+1)for _ in range(h+1)]
    da[0][0] = a[0][0]
    for i in range(1, w+1):
        da[0][i] = da[0][i-1] + a[0][i]
    for i in range(1, h+1):
        cnt_w = 0
        for j in range(w+1):
            cnt_w += a[i][j]
            da[i][j] = da[i-1][j] + cnt_w
    return da

def Calc(p,q,x,y, da):
    if p>x  or q>y:
        return 0
    if p==0 or q==0:
        return da[x][y]
    if p==0:
        return da[x][y] - da[x][q-1]
    if q==0:
        return da[x][y] - da[p-1][y]
    return da[x][y] - da[x][q-1] - da[p-1][y] + da[p-1][q-1]

N,M,Q = map(int,input().split())
t = [[0]*(N+1) for _ in range(N+1)]
for _ in range(M):
    l,r = map(int,input().split())
    t[l][r] += 1

d = f(N,N,t)
for _ in range(Q):
    p,q = map(int,input().split())
    print(Calc(p,p,q,q,d))

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

int main() {
  string S, T;
  cin >> S >> T;
  int ans = 0;
  for (int i = 0; i < 3; i++) {
    if (S[i] == T[i]) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
    int A, B;
    std::string res;
    std::cin >> A >> B;
    if (A == B) res = "Draw";
    else if ( A == 1 || B == 1 ) res = (A == 1) ? "Alice" : "Bob";
    else res = (A > B) ? "Alice" : "Bob";
    std::cout << res << std::endl;
    return 0;
}

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

using namespace std;

int main(){
    int n, tmp=1, dp[100009];
    vector<int> v;
    v.push_back(1);
    cin >> n;
    tmp = 9;
    while(tmp<=100000){
        v.push_back(tmp);
        tmp*=9;
    }
    tmp = 6;
    while(tmp<=100000){
        v.push_back(tmp);
        tmp*=6;
    }
    sort(v.begin(), v.end(), greater<int>());
    for(int i=0;i<=n;i++){
        dp[i] = 100000;
    }
    for(int i=0;i<v.size();i++){
        dp[v[i]] = 1;
    }
    for(int i=1;i<=n;i++){
        for(int j=0;j<v.size();j++){
            if(i+v[j]<=n){
                dp[i+v[j]] = min(dp[i]+1, dp[i+v[j]]);
            }
        }
    }
    cout << dp[n] << endl;
}

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

using ll = unsigned long long;

ll C[55][55];

int main(void) {
    int n, p;
    cin >> n >> p;

    int o = 0, e = 0;
    for (int i = 0; i < n; ++ i) {
        int x;
        cin >> x;
        if (x % 2 == 0) ++ e;
        else ++ o;
    }

    C[0][0] = 1;
    for (int i = 1; i <= 50; ++ i) {
        C[i][0] = C[i][i] = 1;
        for (int j = 1; j < i; ++ j) {
            C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
        }
    }

    ll ans = 1LL<<e;
    if (p == 0) {
        ll tmp = 0;
        for (int i = 0; i <= o; i += 2) tmp += C[o][i];
        ans *= tmp;
    } else {
        ll tmp = 0;
        for (int i = 1; i <= o; i += 2) tmp += C[o][i];
        ans *= tmp;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
a = [list(input()) for _ in [0] * h]

x = []
y = []
for i in range(h):
    if "#" in a[i]:
        y += [i]
for i in range(w):
    t = []
    for j in range(h):
        t.append(a[j][i])
    if "#" in t:
        x += [i]

for i in y:
    for j in x:
        print(a[i][j], end="")
    print()


Measured memory_bytes: 4596
#include<cstdio>
#include<cstring>
using namespace std;
const int N=1e5+5;
char s[N];
int len,pos[N],cnt[N];
int main()
{
	scanf("%s",s+1),len=strlen(s+1);
	int p=1,q=len;
	for(int i=2;i<=len;++i)
	{
		if(s[i]=='L') pos[i]=p;
		if(s[i]=='R') p=i;
	}
	for(int i=len-1;i>=1;--i)
	{
		if(s[i]=='R') pos[i]=q;
		if(s[i]=='L') q=i;
	}
//	for(int i=1;i<=len;++i) printf("%d ",pos[i]);
//	putchar('\n');
	for(int i=1;i<=len;++i)
	{
		int x=pos[i];
//		printf("pos:%d i:%d bushu:%d\n",x,i,abs(x-i));
		if((x-i)&1)
		{
			if(s[i]=='L') ++cnt[x+1];
			else ++cnt[x-1];
		}
		else ++cnt[x];
	}
	for(int i=1;i<=len;++i)
		printf("%d ",cnt[i]);
	return 0;
}
/*R R L L L L R L R R L L
  0 3 3 0 0 0 1 1 0 2 2 0
*/

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

#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ll long long int
 
using namespace std;

 
int main()
{
     int x,y;
     cin>>x>>y;
     if(y%2==0&&y>=x*2&&y<=x*4)
     cout<<"Yes";
     else
     cout<<"No";
	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int h[n];
  int max = 0;
  int cnt = 0;
  for(int i = 0;i < n;i++){
    cin >> h[i];
    if(max <= h[i]){
      max = h[i];
      cnt++;
    }    
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 

using namespace std;

int main(){

    int n,a;
    cin >> n >> a;

    vector<int> x;

    rep(i,n){
        int tmp;
        cin >> tmp;
        x.pback(tmp);
    }

    ll dp[51][51][2501] = {};

    dp[0][0][0] = 1;

    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= i; j++){
            for(int k = 0; k <= n * 50; k++){
                //xiを使わなかった場合
                assert(dp[i][j][k] == 0);
                dp[i][j][k] = dp[i][j][k] + dp[i - 1][j][k];

                //xiを使う場合
                if(k - x[i - 1] >= 0 && j - 1 >= 0) dp[i][j][k] = dp[i][j][k] + dp[i - 1][j - 1][k - x[i - 1]];
            }
        }
    }

    ll ans = 0;

    for(int i = 1; i <= n; i++){
        ans = ans + dp[n][i][i * a];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 51072
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass : Scanner
{
    static void Main()
    {
        var (n, k) = ReadTuple<int,int>();
        WriteLine(n-k+1);
    }
}



class Scanner
{
    public static string RString() => Console.ReadLine();
    public static int RInt() => ReadTuple<int>();
    public static long RLong() => ReadTuple<long>();
    public static double RDouble() => ReadTuple<double>();

    public static string[] RStrings() => Console.ReadLine().Split();
    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();

    public static T1 ReadTuple<T1>()
    {
        var r = RString();
        var r1 = (T1)Convert.ChangeType(r, typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadTuple<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadTuple<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadTuple<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[3], typeof(T4));
        return (r1, r2, r3, r4);
    }
}


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

int main() {
	int n;
	string input;
	int T = 1, N = 2, W = 3;
	int tmp;

	while(cin >> n, n != 0) {
		T = 1, N = 2, W = 3;
		for(int i = 0; i < n; i++) {
			cin >> input;

			if(input == "north") {
				tmp = N;
				N = T;
				T = 7 - tmp;
			}
			else if(input == "west") {
				tmp = W;
				W = T;
				T = 7 - tmp;
			}
			else if(input == "south") {
				tmp = T;
				T = N;
				N = 7 - tmp;
			}
			else if(input == "east") {
				tmp = T;
				T = W;
				W = 7 - tmp;
			}
		}

		cout << T << endl;
	}
}

Measured memory_bytes: 1208
#include<iostream>
#include<cstdio>
using namespace std;
int x,h,m,s;
int main(){
cin>>x;
h=x/3600;
m=(x%3600)/60;
s=(x%3600)%60;
printf("%d:%d:%d\n",h,m,s);
return 0;
}

Measured memory_bytes: 1144
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

#define int long long

signed main() {
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    vector<int> odd;
    vector<int> even;
    rep(i, n) {
        if (i % 2)
            odd.push_back(v[i]);
        else
            even.push_back(v[i]);
    }
    map<int, int> o;
    map<int, int> e;
    rep(i, n / 2) o[odd[i]]++;
    rep(i, n / 2) e[even[i]]++;
    int ofreq = 0, osfreq = 0;
    int efreq = 0, esfreq = 0;
    int o1, e1, o2, e2;
    for (auto c : o) {
        if (c.second > ofreq) {
            o2 = o1;
            o1 = c.first;
            osfreq = ofreq;
            ofreq = c.second;
        }
        else if (c.second > osfreq) {
            osfreq = c.second;
            o2 = c.first;
        }
    }
    for (auto c : e) {
        if (c.second > efreq) {
            e2 = e1;
            e1 = c.first;
            esfreq = efreq;
            efreq = c.second;
        }
        else if (c.second > esfreq) {
            esfreq = c.second;
            e2 = c.first;
        }
    }
    if (o1 != e1)
        cout << n - ofreq - efreq;
    else
        cout << n - max(ofreq + esfreq, osfreq + efreq);

    cout << endl;
}

Measured memory_bytes: 8052
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;


int main(){
    string s;
    cin >> s;
    int ans = 0;
    int tmp = 0;
    rep(i,s.size()){
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
            tmp++;
            chmax(ans,tmp);
        }
        else{
            tmp = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
func gcd(x: Int, _ y: Int) -> Int {
    if y == 0 {
        return x
    } else {
        return gcd(y, x%y)
    }
}
let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (A, B, C, D) = (input[0]-1, input[1], input[2], input[3])
let tmp = C*D / gcd(C, D)
let tmp1 = B/C - A/C            // (A...B)でCで割り切れる数の個数
let tmp2 = B/D - A/D            // (A...B)でDで割り切れる数の個数
let tmp3 = B/tmp - A/tmp        // (A...B)で(C AND D)で割り切れる数の個数
let tmp4 = tmp1 + tmp2 - tmp3   // (A...B)で(C XOR D)で割り切れる数の個数
print(B - A - tmp4)             // (A...B)で(C AND D)で割り切れない数

Measured memory_bytes: 4208
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int main(){

	int POW[16];
	for(int i = 0; i < 16; i++)POW[i] = pow(2,i);

	int M,N;
	scanf("%d %d",&M,&N);

	int* W_ruisekiwa = new int[M+1];
	int* T_ruisekiwa = new int[M+1];

	W_ruisekiwa[0] = 0;
	T_ruisekiwa[0] = 0;

	for(int i = 1; i <= M; i++){
		scanf("%d %d",&W_ruisekiwa[i],&T_ruisekiwa[i]);
		W_ruisekiwa[i] += W_ruisekiwa[i-1];
		T_ruisekiwa[i] += T_ruisekiwa[i-1];
	}

	int w_limit[N],t_limit[N];

	for(int i = 0; i < N; i++){
		scanf("%d %d",&w_limit[i],&t_limit[i]);
	}

	int* dp = new int[POW[N]];

	for(int i = 0; i < POW[N]; i++)dp[i] = 0;

	int left,right,m,end_book,next_state;

	for(int state = 0; state < POW[N]; state++){

		int start_book = dp[state]+1;

		if(start_book == M+1){
			printf("%d\n",M);
			return 0;
		}

		for(int loop = 0; loop < N; loop++){
			if(state & (1 << loop)){
				//Do nothing
			}else{

				left = start_book,right = M,m = (left+right)/2;
				end_book = BIG_NUM;

				while(left <= right){
					if(W_ruisekiwa[m]-W_ruisekiwa[start_book-1] <= w_limit[loop] && T_ruisekiwa[m]-T_ruisekiwa[start_book-1] <= t_limit[loop]){
						end_book = m;
						left = m+1;
					}else{
						right = m-1;
					}
					m = (left+right)/2;
				}

				if(end_book == BIG_NUM){
					end_book = dp[state];
				}

				next_state = state + POW[loop];

				dp[next_state] = max(dp[next_state],end_book);
			}
		}
	}

	printf("%d\n",dp[POW[N]-1]);

	return 0;
}

Measured memory_bytes: 4952
/* ex 3-2
    kas056 */
#include <stdio.h>
int main(void){
    int N , R;

    // Nの読み込み
    scanf("%d", &N);
    //余り(remain)で考える
    R = N % 10;
	//以下条件によって場合分け（「または」を使うとき）
    //remainが2,4,5,7,9の場合
    if (R==2 || R==4 || R==5 || R==7 || R==9){
        printf("hon\n");
    }
    //remainが0,1,6,8の場合
    else if (R==0 || R==1 || R==6 || R==8){
        printf("pon\n");
    }
    //remainが3の場合
    else{
        printf("bon\n");
    }
    return 0;
}

Measured memory_bytes: 1608
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
)

func main() {
	log.SetFlags(log.Lshortfile)
	var n int
	fmt.Scan(&n)
	reader := bufio.NewReader(os.Stdin)
	var line []byte
	for {
		l, isP, err := reader.ReadLine()
		if err != nil {
			log.Fatal(err)
		}
		line = append(line, l...)
		if isP == false {
			break
		}
	}
	var cnt int = 1
	var color byte = line[0]
	for i := 1; i < n; i++ {
		if color != line[i] {
			cnt++
			color = line[i]
		}
	}
	fmt.Println(cnt)
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var inf = int(1e9)

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


Measured memory_bytes: 1152