akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

template <typename T> T inf;
template <> constexpr int inf<int> = 1e9;
template <> constexpr ll inf<ll> = 1e18;

int main() {
    string s;
    cin >> s;
    int stock = 0;
    int res = s.size();
    for(int i = 0; i < s.size(); ++i) {
        if(s[i] == 'S') {
            stock++;
        } else {
            if(stock > 0) {
                stock--;
                res -= 2;
            }
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 640
N,K = map(int,input().split())

i = 0
anslist = []
while True:
  if N>=K:
    i+=1
    anslist.append(N%K)
    N = N//K
    #print (N)
  if N<K:
    anslist.append(N)
    i+=1
    break
    
anslist.reverse()
#print (anslist)
#print (''.join(map(str, anslist)))
print (i)

Measured memory_bytes: 9016
//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")


using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 200000 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000010;
const ll LOG = 25;

int fen[N], n, cnt[N], Mt[N];
vi koj[N];
string s;

void add(int id, int x){
	for (; id < N; id += id & (-id)) fen[id] += x;
}

int get(int id){
	int res = 0;
	for (; id > 0; id -= id & (-id)) res += fen[id];
	return res;
}

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> s;
	n = s.size();
	for (int i = 1; i <= n; i++){
		koj[s[i - 1] - 'a'].pb(i);
//		cout << (s[i - 1] - 'a') << '\n';
	}
	int TT = 0;
	for (int i = 0; i < 26; i++){
		if (koj[i].size() % 2 == 1) TT++;		
		for (int j = 0; j < koj[i].size() / 2; j++){
			Mt[koj[i][j]] = koj[i][koj[i].size() - j - 1];
			Mt[koj[i][koj[i].size() - j - 1]] = koj[i][j];
		}
		
	}
//	cout << "YES" << endl;
	if ((TT > 1) || (n % 2 == 0 && TT == 1)) return cout << -1, 0;
	ll ans = 0;
	set<int> st;
	for (int i = 1; i <= n; i++){
//		cout << i << ' ' << Mt[i] << endl;		
		st.insert(i);
		add(i, 1);
	}
	int Now = 0;
	while (st.size() >= 2){
		int l = *st.begin();
		if (Mt[l] == 0){
			l = *st.rbegin();
		}
		int x = Mt[l];
		if (x == 0) assert(0);
		if (x < l) swap(l, x);
		int ll = get(l - 1);
		int rr = get(n) - get(x);
		ans += (ll + rr);
		st.erase(l);
		st.erase(x);
		add(x, -1);
		add(l, -1);
	}
	cout << ans;








	return 0;
}


Measured memory_bytes: 17588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}
const string YES = "Yes";
const string NO = "No";

void solve(ll a, ll b, ll c){
    set<ll> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    cout<<(s.size()==2?YES:NO)<<endl;
}

int main(){
    ll a;
    scanf("%lld",&a);
    ll b;
    scanf("%lld",&b);
    ll c;
    scanf("%lld",&c);
    solve(a, b, c);
}


Measured memory_bytes: 256
<?php
// B
fscanf(STDIN, '%s', $s);
$n = strlen($s);
$ans = 'Yes';
if (!isKaibun($s)) $ans = 'No';

$st = substr($s, 0, ($n - 1) / 2);
if (!isKaibun($st)) $ans = 'No';

$st = substr($s, ($n + 3) / 2 - 1, $n - ($n + 3) / 2 + 1);
if (!isKaibun($st)) $ans = 'No';

echo $ans . PHP_EOL;

function isKaibun($s)
{
    $n = strlen($s);
    for ($i = 0; $i < intdiv($n, 2); $i++) {
        if ($s[$i] !== $s[$n - $i - 1]) return false;
    }
    return true;
}

Measured memory_bytes: 4728
N = int(input())
a = list(map(int, input().split()))

counter = 0
idx = 1
# ans = []
for i in range(N):
    if idx != a[i]:
        counter+=1
    else:
        idx += 1
if idx != 1:

    print(counter)

elif N == 0:
    if a[0] == 1:
        print(0)
else:
    print(-1)


Measured memory_bytes: 26268
#!/usr/bin/env python3
#M-SOLUTIONS プロコンオープン A

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
print(180*(n-2))


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


int main(void){
    string S;
    cin >> S;
    int n=S.size(); // 以降nはSのサイズを表し続ける
    reverse(S.begin(), S.end());

    string a="maerd", b="remaerd", c="esare", d="resare";

    while(true){
        if(S==""){
            cout << "YES" << endl;
            return 0;
        }
        else if(S.substr(0,5)==a){
            S=S.substr(5,n-5);
            n-=5;
        }
        else if(S.substr(0,7)==b){
            S=S.substr(7,n-7);
            n-=7;
        }
        else if(S.substr(0,5)==c){
            S=S.substr(5,n-5);
            n-=5;
        }
        else if(S.substr(0,6)==d){
            S=S.substr(6,n-6);
            n-=6;
        }
        else{
            cout << "NO" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int P[9], Pr[9];
int Q[9], Qr[9];
long fac(int a)
{
	long sum = 1;
	if (a <= 1)
		return 1;
	for (int i = 2;i <= a;i++)
		sum = sum * i;
	return sum;
}
int rank(int* a,int pos)
{
	int t=0;
	for (int i = 1;i < pos;i++)
	{
		if (a[i] < a[pos])
			t++;
	}
	return (a[pos] - t);
}

void input(int* a,int N,int* ar)
{
	scanf("%d", &a[1]);
	ar[1] = a[1];
	int min = a[1];
	for (int i = 2;i <= N;i++)
	{
		scanf("%d", &a[i]);
		ar[i] = rank(a, i);
	}
}
int main()
{
	int N;
	int Pdig = 1, Qdig = 1;
	scanf("%d", &N);
	input(P, N, Pr);
	input(Q, N, Qr);
	for (int i = 1;i < N;i++)
	{
		int dig = N - i;
		Pdig = Pdig + (Pr[i]-1) * fac(dig);
		Qdig = Qdig + (Qr[i]-1) * fac(dig);
	}
	printf("%d", abs(Pdig - Qdig));
        return 0;
}

Measured memory_bytes: 128
main(){
  system("python3 -c\"I=input;n,q=map(int,I().split());s=' %s '%I();l,r=0,n+1\nfor t,_,d in eval('I(),'*q)[::-1]:L=d<'R';R=1-L;l+=(t==s[l+1])*L-(t==s[l])*R;r+=(t==s[r])*L-(t==s[r-1])*R\nprint(r-l-1)\"");
}

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

int main()
{
    int n, m, c;
    cin >> n;
    cin >> m;
    vector<int> x(m);
    vector<int> e(m - 1);
    for (int i = 0; i < m; i++)
        cin >> x[i];
    sort(x.begin(), x.end());
    for (int i = 0; i < m - 1; i++)
        e[i] = x[i + 1] - x[i];
    sort(e.begin(), e.end());
    c = 0;
    if (n < m)
    {
        for (int i = 0; i < m - n; i++)
        {
            c += e[i];
        }
    }
    cout << c << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define read(type) readInt<type>() // Fast read
#define ll long long
#define nL "\n"
#define pb push_back
#define mk make_pair
#define pii pair<int, int>
// #define a first
// #define b second
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define umap unordered_map
#define uset unordered_set
#define MOD 1000000007
#define imax INT_MAX
#define imin INT_MIN
#define exp 1e9
#define sz(x) (int((x).size()))

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin >> n;
    int a = n % 1000;
    if(a == 0) {
        cout << 0 ;
    } else {
        cout << 1000 - a;
    }
    return 0;
}


Measured memory_bytes: 3648
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
const int INF=2147483647;
struct Edge
{
	int to;
	int nxt;
	int flow;
}e[1000005];
int n,m,s,t,edgenum=1,head[200005],cur[200005],dep[200005],a[200005],b[200005],in1[200005],in2[200005],tot;
queue<int>q;
void add(int u,int v,int f)
{
	e[++edgenum].flow=f;
	e[edgenum].to=v;
	e[edgenum].nxt=head[u];
	head[u]=edgenum;
}
int dfs(int node,int nowf)
{
	if(node==t)return nowf;
	for(int&hd=cur[node];hd;hd=e[hd].nxt)
	{
		int to=e[hd].to;
		if(e[hd].flow==0)continue;
		if(dep[to]==dep[node]+1)
		{
			int d=dfs(to,min(nowf,e[hd].flow));
			if(d)
			{
				e[hd].flow-=d;
				e[hd^1].flow+=d;
				return d;
			}
		}
	}
	return 0;
}
bool bfs()
{
	while(!q.empty()) q.pop();
	for(int i=1;i<=t;i++)dep[i]=0;
	dep[s]=1;
	q.push(s);
	while(!q.empty())
	{
		int node=q.front();
		q.pop();
		for(int hd=head[node];hd;hd=e[hd].nxt)
		{
			if(e[hd].flow==0)continue;
			int to=e[hd].to;
			if(!dep[to])
			{
				dep[to]=dep[node]+1;
				q.push(to);
			}
		}
		if(dep[t])return 1;
	}
	return dep[t];
}
int Dinic()
{
	int ans=0,d;
	while(bfs())
	{
		for(int i=1;i<=t;i++)cur[i]=head[i];
		while((d=dfs(s,INF)))
		  ans+=d;
	}
	return ans;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),a[i]++;
	for(int i=1;i<=n;i++)scanf("%d",&b[i]),b[i]++;
	for(int i=1;i<=n;i++)
	{
		if(!in1[i])
		{
			int j=i;
			++tot;
			while(!in1[j])in1[j]=tot,j=a[j];
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(!in2[i])
		{
			int j=i;
			++tot;
			while(!in2[j])in2[j]=tot,j=b[j];
		}
	}
	s=tot+1,t=tot+2;
	int num=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]==i&&b[i]==i)num++;
		else if(a[i]==i)
		{
			add(s,in2[i],1);
			add(in2[i],s,0);
		}
		else if(b[i]==i)
		{
			add(in1[i],t,1);
			add(t,in1[i],0);
		}
		else if(a[i]==b[i])
		{
			add(in1[i],in2[i],1);
			add(in2[i],in1[i],1);
		}
		else
		{
			add(in1[i],in2[i],1);
			add(in2[i],in1[i],0);
		}
	}
	printf("%d\n",n-Dinic()-num);
	return 0;
}

Measured memory_bytes: 9600
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int>> vvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef vector<P> vp;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}
bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
    
int main(){
    ll N; cin >> N;
    string s;
    vl c(5, 0); // MARCH
    while(cin >> s){
        if(s[0] == 'M') c[0]++;
        else if(s[0] == 'A') c[1]++;
        else if(s[0] == 'R') c[2]++;
        else if(s[0] == 'C') c[3]++;
        else if(s[0] == 'H') c[4]++;
    }
    
    ll ret = 0;
    for(int i = 0; i < 5; i++){
        for(int j = i + 1; j < 5; j++){
            for(int k = j + 1; k < 5; k++){
                ret += c[i] * c[j] * c[k];
            }
        }
    }
    cout << ret << endstr;
    return 0;
}


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

using namespace std;

const int MAXN = 1E5;
int nextOcc[26][MAXN];

int main()
{
    string s, t;
    cin >> s >> t;
    int n = (int) s.length();
    for (int i = 0; i < 26; i++)
    {
        if (s[n - 1] == 'a' + i)
        {
            nextOcc[i][n - 1] = n - 1;
        }
        else
        {
            nextOcc[i][n - 1] = -1;
        }
    }
    for (int i = 0; i < 26; i++)
    {
        for (int j = n - 2; j >= 0; j--)
        {
            if (s[j] == 'a' + i)
            {
                nextOcc[i][j] = j;
            }
            else
            {
                nextOcc[i][j] = nextOcc[i][j + 1];
            }
        }
    }
    int index = 0;
    long long ans = 0;
    for (int i = 0; i < (int) t.length(); i++)
    {
        int key = t[i] - 'a';
        if (nextOcc[key][index] != -1)
        {
            ans += nextOcc[key][index] - index + 1;
            index = (nextOcc[key][index] + 1) % n;
        }
        else if (nextOcc[key][0] != -1)
        {
            ans += n - index;
            index = (nextOcc[key][0] + 1) % n;
            ans += nextOcc[key][0] + 1;
        }
        else
        {
            ans = -1;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 10752
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=n-1;i>=a;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
template<typename T>
void max_self(T &a,T b){
    a=max(a,b);
}
template<typename T>
void min_self(T &a,T b){
    a=min(a,b);
}
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=2e4+10,oo=0x3f3f3f3f,MOD=998244353;
const double PI = acos(-1);

void solve(){
    int n;
    cin>>n;
    int arr[n];
    loop(n,i,0)
        cin>>arr[i];
    int pre[n+1]={},suf[n+1]={};
    loop(n,i,0)
        pre[i+1]=__gcd(pre[i],arr[i]);
    loopR(n,i,0)
        suf[i]=__gcd(suf[i+1],arr[i]);
    int res=0;
    loop(n,i,0)
        max_self(res,__gcd(pre[i],suf[i+1]));
    cout<<res<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();
}

Measured memory_bytes: 4776
#!usr/bim/python
#! -*- coding: utf-8 -*-

import re

alphabet = 'abcdefghijklmnopqrstuvwxyz'

s = raw_input()

status = len(alphabet)

for i in range(len(alphabet)):
    if not re.search(alphabet[i],s):
        status = i
        break

if status == len(alphabet):
    print 'None'
else:
    print alphabet[status]


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

using namespace std;

int main(){
  string p,s;

  cin >> p >> s;

  p = p+p;

  bool flag = false;

  for(int i=0;i < (int)p.size()-(int)s.size();i++)
    { 
      string t = p.substr(i,s.size());
      
      if(t == s)
	{
	  flag = true;
	  break;
	}
    }
  if(flag) cout << "Yes" << endl;
  else  cout << "No" << endl;

  return 0;
}



Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
const ll MOD = 1e9+7;
const ll MAX = 200001;
ll fac[MAX], finv[MAX], inv[MAX];

// source by drken start
// テーブルを作る前処理
void COMinit() {
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
  }
}

// a^n (mod m) を計算する
ll modpow(ll a, ll n, ll m) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % m;
    a = a * a % m;
     n >>= 1;
  }
  return res;
}
// source by drken end

int main() {
  ll n,a,b,pw;
  cin >> n >> a >> b;
  ll com[b+1];
  com[0] = 1;
  COMinit();
  for(int i=0;i<b;i++){
    com[i+1] = ((((n-i)*com[i])%MOD)*inv[i+1])%MOD;
  }
  pw = modpow(2,n,MOD);
  pw -= com[a];pw %= MOD;
  pw -= com[b];pw %= MOD;
  pw -= 1;pw %= MOD;
  cout << (pw < 0 ? pw + MOD : pw) << endl;
}


Measured memory_bytes: 3328
/*  -*- coding: utf-8 -*-
 *
 * b.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_L = 10000;

/* typedef */

/* global variables */

char s[MAX_L + 4];

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d%s", &n, s);

  for (char *cpt = s; *cpt; cpt++)
    putchar(((*cpt - 'A') + n) % 26 + 'A');
  putchar('\n');
  return 0;
}


Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll a, b, c;
  cin >> a >> b >> c;
  ll s = a + b + c;
  bool odd = a % 2 == 1 || b % 2 == 1 || c % 2 == 1;
  bool cond = (s % 3 == 0) && a == s / 3 && b == s / 3 && c == s / 3 && !odd;
  if(cond)  {
    puts("-1");
    return 0;
  }

  ll ans = 0;
  while (true) {
    bool cond2 = a % 2 == 1 || b % 2 == 1 || c % 2 == 1;
    if (cond2) break;
    a = (s - a) / 2;
    b = (s - b) / 2;
    c = (s - c) / 2;
    ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define llong long long int
#define ullong unsigned long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
const static long long int MOD = 1000000000 + 7;

template<typename T> T my_gcd(T a, T b) {
    return (a ? my_gcd(b % a, a) : b);
}

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k, a[100001], M = 0;
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        M = max(M, a[i]);
    }

    if (k > M) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    } else {
        int g = a[0];
        for (int i = 1; i <= n; ++i) {
            g = my_gcd(g, a[i]);
        }
        if (k % g == 0) {
            cout << "POSSIBLE" << endl;
        } else {
            cout << "IMPOSSIBLE" << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace AtCoder
{
    class Program
    {
        
        static void Main()
        {
            //ここから
            int N = ReadLineToInt();
            int ans = 0;
            for(int i = 1; i < 10; i++)
            {
                if (111 * i - N >= 0)
                {
                    ans = i * 111;
                    break;
                }
            }

            //ここまで
            Console.WriteLine(ans);
            Console.ReadKey();
        }

        long mod = 1000000007;
        static public void Swap<T>(ref T a,ref T b) { T temp = a;a = b;b = temp; }
        static public long GCD(int a, int b){ return b != 0 ? GCD(b, a % b) : a;}
        static public long LCM(int a, int b){ return (long)a * b / GCD(a, b); }
        static public int Factorial(int a) { return a == 1 ? a : a * Factorial(a - 1); }
        static public int Conbin(int n,int m) { return Factorial(n) / (Factorial(n - m) * Factorial(m)); }


        
        static public string ReadLineToString(){return Console.ReadLine();}
        static public int ReadLineToInt(){return int.Parse(Console.ReadLine());}
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray(){return Console.ReadLine().Split(' ').ToArray();}
        static public int[] ReadLineToIntArray(){return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();}
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList(){return Console.ReadLine().Split(' ').ToList();}
        static public List<int> ReadLineToIntList(){return Console.ReadLine().Split(' ').Select(int.Parse).ToList();}
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    }
    
}


Measured memory_bytes: 11092
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using System.Text;

namespace Atcoder
{
    class Program
    {
        private const long COMDIV = 1000000007;
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            Console.WriteLine(Cal(n));
        }
        static Dictionary<int,long> memo = new Dictionary<int, long>();
        static long Cal(int val)
        {
            if (val == 0) return 2;
            if (val == 1) return 1;
            long left;
            long right;
            if (memo.ContainsKey(val - 1))
            {
                left = memo[val - 1];
            }
            else
            {
                left = Cal(val - 1);
                memo.Add(val - 1,left);
            }
            if (memo.ContainsKey(val - 2))
            {
                right = memo[val - 2];
            }
            else
            {
                right = Cal(val - 2);
                memo.Add(val - 2, right);
            }
            return left + right;
        }
        
    }
}

Measured memory_bytes: 13152
#include <bits/stdc++.h>
#define rep(i, n, s) for (int i = s; i < n; i++)
#define graph map<int, vector<int>>
#define field vector<vector<int>>
#define ll long long
using namespace std;
int main()
{
    ll n, d;
    cin >> n >> d;
    ll ans = 0;
    rep(i, n, 0)
    {
        ll x, y;
        cin >> x >> y;
        if (x * x + y * y <= d * d)
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<numeric>
#include<vector>
#include<cstdio>
#include<climits>
#include<cfloat>
#include<cstring>
#define rforeach(t,p) for(t::reverse_iterator it=p.rbegin();it!=p.rend();++it)
#define all(p) p.begin(),p.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define foreach(t,p,tit) for(t::iterator tit=p.begin();tit!=p.end();++tit)
using namespace std;

int main()
{
    int n=0,maxn=0,maxlen=0;
    string ss,maxs="",maxns;
    map<string,int > tango;
    map<string,int>::iterator it;
    while(cin>>ss)
    {
        if(maxlen <ss.size())
        {
            maxlen = ss.size();
            maxs = ss;
        }

        it = tango.find(ss);
        if(it==tango.end())
        {
            tango.insert(map<string,int>::value_type(ss,1));
        }
        else
        {
            n = (*it).second+ 1;
            tango.erase(it);
            tango.insert(map<string,int>::value_type(ss,n));
            maxn = max(n,maxn);
        }
    }
    for(map<string,int>::iterator it2=tango.begin();it2!=tango.end(); ++it2)
        if( (*it2).second == maxn){cout << (*it2).first; break;}

    cout << " " << maxs << endl;
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
// #define int         long long
#define mp          make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
// #define vb          vector<bool>
// #define vc          vector<char>
#define vii         vector<pii>
//#define mi          map<int,int>
//#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
// #define ub(x)       upper_bound(x)
// #define lb(x)       lower_bound(x)
#define endl        '\n'
#define file        freopen("b1.in","r",stdin);freopen("output.txt","w",stdout)
#define fastio      ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
// #define N            1e5+5
#define M           1000000007
#define MAX         50000
#define mem0(a)     memset(a,0,sizeof(a))
#define prec        cout<<std::setprecision(9)<<std::fixed
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define pi          3.14159265358979323

struct cmp { 
    bool operator() (pii a,pii b){
        return ((a.F-a.F/2)*a.S)<((b.F-b.F/2)*b.S);
    }
};
// priority_queue<pii,vector<pii>,cmp> q;

const int N=1e5+1;
int n,m,k;


void Anon_mouS(){
    int d,t,s;
    cin>>d>>t>>s;
    if(1.0*d/t<=1.0*s)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
int32_t main(){
    fastio;
    int q=1;
    // sieve();
    // cin>>q;
    for(int it=1;it<=q;it++){
        // cout<<"Case #"<<it<<": ";
        Anon_mouS();
    }
    return 0;   
}

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

public class Main {

	public static void main(String[] args) {
		int max = 999999;
		int calcMax, count, n;
		int[] primeCount = new int[max+1];	//めんどいので、index=対象の数とする
		boolean[] isPrime = new boolean[max+1];
		Scanner sin = new Scanner(System.in);

		Arrays.fill(isPrime, true);
		isPrime[0] = isPrime[1] = false;
		primeCount[0] = primeCount[1] = 0;

		calcMax = (int) Math.sqrt(max);
		for(int i=2; i<=calcMax; i++) {
			if(isPrime[i] ==true) {
				for(int j=i*i; j<=max; j+=i) {
					isPrime[j] = false;
				}
			}
		}

		count = 0;
		for(int i=0; i<=max; i++) {
			if(isPrime[i]) {
				count++;
			}
			primeCount[i] = count;
		}

		while(sin.hasNext()) {
			n = sin.nextInt();
			System.out.println(primeCount[n]);
		}
		sin.close();
	}

}



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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  int n; cin >> n;
  int a[1000] = {0};
  ll ret = 0;
  ll ans = 1;
  for(int i = 2; i <= n; i++) {
    ret = i;
    for(int j = 2; ret > 1; j++) {
      while(ret % j == 0) {
        a[j]++;
        ret /= j;
      }
    }
  }
  for(int i = 0; i < 1000; i++) {
    ans = ans * (a[i] + 1) % 1000000007;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <cctype>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#define fprintf(...) void(0)

std::string memo[51][51];

std::string better(const std::string &s, const std::string &t) {
  fprintf(stderr, "%s <=> %s\n", s.c_str(), t.c_str());
  if (s == "invalid") return t;
  if (t == "invalid") return s;
  if (s.length() < t.length()) return t;
  if (s.length() > t.length()) return s;
  return std::max(s, t);
}

bool can_be(char ch, char crit) {
  return (ch == crit || ch == '?');
}

std::string best(const std::string &s, size_t first, size_t last) {
  fprintf(stderr, "s[%zu, %zu)\n", first, last);
  if (first == last) return "";

  std::string &res=memo[first][last];
  if (!res.empty()) return res;

  char cl=s[first], cr=s[last-1];
  for (char ch: {cl, cr})
    if (ch == ',' || ch == '(')
      return (res = "invalid");

  if (cl == ')' || cr == 'L' || cr == 'R')
    return (res = "invalid");

  res = "invalid";
  if (can_be(cl, 'L') && can_be(cr, ')')) {
    if (last-first > 4 && can_be(s[first+1], '(')) {
      // "L(" <exprL> "," <exprR> ")"
      // if <exprR> is valid then res = better(res, <exprL>);
      for (size_t i=first+3; i+2<last; ++i) {
        if (!can_be(s[i], ',')) continue;
        if (best(s, i+1, last-1) != "invalid")
          res = better(res, best(s, first+2, i));
      }
    }
  }
  if (can_be(cl, 'R') && can_be(cr, ')')) {
    if (last-first > 4 && can_be(s[first+1], '(')) {
      // "R(" <exprL> "," <exprR> ")"
      // if <exprL> is valid then res = better(res, <exprR>);
      for (size_t i=first+3; i+2<last; ++i) {
        if (!can_be(s[i], ',')) continue;
        if (best(s, first+2, i) != "invalid")
          res = better(res, best(s, i+1, last-1));
      }
    }
  }
  if (isdigit(cl) || cl == '?') {
    // if s[first] == '0' and last-first > 1 then "invalid"
    // if non-digit (excluding '?') in s[first..last-1] then "invalid"
    // otherwise fill with '9'
    std::string cur(s.begin()+first, s.begin()+last);
    if (cur[0] == '0' && cur.length() > 1) {
      cur = "invalid";
    } else {
      for (size_t i=0; i<cur.length(); ++i) {
        if (cur[i] == '?') {
          cur[i] = '9';
        } else if (!isdigit(cur[i])) {
          cur = "invalid";
          break;
        }
      }
    }
    fprintf(stderr, "cur: %s\n", cur.c_str());
    res = better(res, cur);
  }
  fprintf(stderr, "... %s\n", res.c_str());
  return res;
}

int main() {
  char buf[64];
  scanf("%s", buf);
  std::string s=buf;

  printf("%s\n", best(s, 0, s.length()).c_str());
}



Measured memory_bytes: 2892
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
#define TEMP(type,x,y) do {temp temp=x,x=y,y=temp}while(0)
const ll INF = (1LL << 50);

int main() {

	int N;
	cin >> N;

	vector<int>a(N + 1);
	REP(i, N) cin >> a[i + 1];
	vector<int> b(N + 1);

	for (int i = N; i >= 1; i--) {
		int sum = 0;
		for (int j = i + i; j <= N; j += i) {
			sum ^= b[j];
		}
		b[i] = sum ^ a[i];
	}

	vector<int>ans;
	for (int i = 1; i <= N; i++) {
		if (b[i]) ans.push_back(i);
	}

	cout << ans.size() << endl;

	REP(i, ans.size()) {
		if (i < ans.size() - 1) cout << ans[i] << " ";
		else cout << ans[i] << endl;
	}



	return 0;

}

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

	ll N;
	cin >> N;
	ll ans = 0;
	for(ll i = 1; i <= N; i++){
		if(i%3 != 0 && i%5 != 0)ans += i;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3588
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<min(a+b,min(b+c,c+a))<<endl;
}









Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

typedef unsigned long long parallel_type;
const int bit_width=8*sizeof(parallel_type);

int main(){
	int H,W;
	for(;~scanf("%d%d",&H,&W)&&H&&W;){
		vector<string>m(H);
		for(int h=0;h<H;h++)cin>>m[h];
		if(H<=22){
			vector<vector<parallel_type> >l(H);
			int parallel_width=(W+bit_width-1)/bit_width;
			for(int h=0;h<H;h++){
				l[h].resize(parallel_width);
				for(int w=0;w<W;w++)l[h][w/bit_width]|=parallel_type(m[h][w]=='1')<<(w%bit_width);
			}
			int R=0;
			for(int i=0;i<1<<H;i++){
				vector<parallel_type> v(parallel_width);
				int r=0;
				for(int j=0;j<H;j++)if(i>>j&1){
					r++;
					for(int k=0;k<parallel_width;k++)v[k]^=l[j][k];
				}
				if(none_of(v.begin(),v.end(),[](parallel_type e){return e;}))R=max(R,r);
			}
			cout<<R<<endl;
		}else{
			vector<int>b(H);
			for(int h=0;h<H;h++){
				for(int w=0;w<W;w++)b[h]=(b[h]<<1)|(m[h][w]=='1');
			}
			vector<short>s(1<<W),t(1<<W);
			for(int w=1;w<1<<W;w++)s[w]=-1;
			for(int h=0;h<H;h++){
				for(int w=0;w<1<<W;w++){
					t[w]=max(s[w],short(s[w^b[h]]>=0 ? 1+s[w^b[h]] : -1));
				}
				swap(s,t);
			}
			cout<<s[0]<<endl;
		}
	}
}

Measured memory_bytes: 11280
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		
		int from = 0;
		int end = 0;
		
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'A') {
				from = i;
				break;
			}
		}
		
		for(int i = s.length() - 1; i > -1; i--) {
			if(s.charAt(i) == 'Z') {
				end = i;
				break;
			}
		}
		
		System.out.println(end + 1 - from);
	}
}


Measured memory_bytes: 26052
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	int a[100005];
	int b[100005];
	for(int i=0;i<n;i++){
		cin >> a[i] >> b[i];
	}
	int ans = 0;
	int point = 0;
	for(int i=0;i<n;i++){
		if(ans<a[i]){
			ans = a[i];
			point = b[i];
		}
	}
	cout << ans+point << endl;
	return 0;
}

Measured memory_bytes: 1024
A, B, C, X = map(int, open(0))
ans = 0
for i in range(A + 1):
    for j in range(B + 1):
        if 500 * i + 100 * j > X:
            break
        rem = X - 500 * i - 100 * j
        if rem // 50 <= C:
            ans += 1
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 1e5 + 10;
int n;
int a[N] , dp[N];
int check(int ind)
{
    int sum ;
    if(ind > n) return 1e6 + 10;
    if(ind == n)  return 0;
    if(dp[ind] != -1)   return dp[ind];
    sum = min(abs(a[ind + 1] - a[ind]) + check(ind + 1) , abs(a[ind + 2] - a[ind]) + check(ind + 2));
    dp[ind] = sum;
    return sum;
}
int main()
{
    cin >> n;
    for(int i = 1 ; i <= n ; i ++)  cin >> a[i];
    memset(dp , -1 , sizeof dp);
    cout <<  check(1);
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define FILL(c, v) fill((c).begin(),(c).end(), v)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

void solve() {
  int N; cin >> N;
  cout << N*N*N << endl;
}

int main(int argc, char const *argv[])
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout<<std::fixed<<std::setprecision(10);
  solve();
  return 0;
}

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

int main() {
    double n;
    cin >> n;
    if(fmod(n, 2)==0){
      cout << 0.5 << endl;
    }
    else{
      cout << (n+1)/(2*n) << endl;
    }

}


Measured memory_bytes: 384
#include <stdio.h>

#define MAX 5

int main()
{
	char s[MAX];
	int count;
	int m = MAX;

	scanf("%s", s);

	count = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'R')
			count++;
		else {
			if(count!=0)
				m = count;
			count = 0;
		}
	}

	if (count > m || m==MAX)
		m = count;

	printf("%d\n", m);

	return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <random>
#include <ctime>
#include <bitset>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define ld long double
#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast_io cout.tie(0), cin.tie(0), ios_base::sync_with_stdio(0)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ld eps = (ld)1 / 1e6;
ll inf = LLONG_MAX, mod1 = 1e9 + 7, mod2 = 998244353;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
ll binmult(ll a, ll b, ll mod) { return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod : (2 * binmult(a, b / 2, mod)) % mod) : 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main()
{
    fast_io;
    ll l, r, d, t, s = 0;
    cin >> l >> r >> d;
    for (t = l; t <= r; t++)
        if (t % d == 0) s++;
    cout << s;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll h,w,H,W,t[20][20],vx[4]={0,0,1,-1},vy[4]={1,-1,0,0},cnt,X,Y;
string s[20];
queue<P> que;
int main(void){
    while(1){
        cin>>w>>h;
        if(h==0&&w==0){
            return 0;
        }
        cnt=0;
        for(int i=0;i<h;i++){
            cin>>s[i];
        }
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                t[i][j]=0;
                if(s[i][j]=='@'){
                    H=i,W=j;
                    //cout<<H<<W<<s[H][W]<<endl;
                }
            }
        }
        
        que.push({H,W});
        t[H][W]=1;
        while(que.size()){
            P p=que.front();
            que.pop();
            for(int i=0;i<4;i++){
                X=p.first+vx[i];Y=p.second+vy[i];
                if(0<=X&&X<=h-1&&0<=Y<=Y<=w-1&&t[X][Y]==0&&s[X][Y]=='.'){
                    que.push({X,Y});
                    t[X][Y]=1;
                    cnt++;
                }
            }
        }
        cout<<cnt+1<<endl;
    }
    
}



Measured memory_bytes: 3064
from collections import Counter


class PickingUp:
    def __init__(self):
        self.N = int(input())
        self.points = []
        for n in range(self.N):
            self.points.append([int(n) for n in input().split()])

    def main(self):
        dif_list = []

        if self.N == 1:
            print(1)
            return

        for s in range(self.N):
            for e in range(self.N):
                if s == e:
                    continue
                dif = self.__cal_dif(self.points[s], self.points[e])
                dif_list.append("{},{}".format(dif[0], dif[1]))

        c = Counter(dif_list)
        most = c.most_common()[0][1]

        print(self.N - most)

    def __cal_dif(self, s, e):
        dif_x = s[0] - e[0]
        dif_y = s[1] - e[1]
        return [dif_x, dif_y]


pickingUp = PickingUp()
pickingUp.main()


Measured memory_bytes: 3820
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>

long long mod = 1e9+7;

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
  return modpow(a, mod - 2, mod);
}


long long nCk(int n, int k){
  //printf("calcualte nCk(%d, %d)\n",n,k);
  if (2*k>n){
    return nCk(n, n-k);
  }
  long long retval = 1;
  for (int i=0; i<k; i++){
    retval *= (n-i);
    retval %= mod;
    //printf("retval=%lld\n",retval);
  }
  for (int i=1; i<=k; i++){
    retval *= modinv(i, mod);
    retval %= mod;
    //printf("retval=%lld\n",retval);
  }
  return retval;
}

bool isprime(long long a){
  bool retval = true;
  for (int i=2; i*i<=a; i++){
    if (a%i==0){
      retval = false;
      break;
    }
  }
  return retval;
}

std::map<int, int> mp;

int main(){
  int N, M;
  scanf("%d",&N);
  scanf("%d",&M);
  for (long long i=2; i*i<=M; i++){
    //printf("i=%d\n",i);
    if (isprime(i)){
      while(M%i==0){
        mp[i]++;
        M = M/i;
      }
    }
  }
  if (M!=1){
    mp[M]++;
  }
  long long ans = 1;
  for (auto entry: mp){
    ans *= nCk(entry.second+N-1, entry.second);
    //printf("nCk(%d, %d)=%lld\n",entry.second+N, entry.second, nCk(entry.second+N, entry.second));
    ans %= mod;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
// timus.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

vector<int> f, g;
int main()
{
	string s;
	cin >> s;
	int n = (int)s.length();

	f.assign(n + 1, 0);
	g.assign(n + 1, 0);

	f[1] = 1;
	f[2] = 2 * (s[1] != s[0]);
	g[1] = 0;
	g[2] = 1;

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

		if (s[i - 1] != s[i - 2])
		{
			f[i] = max(f[i - 1], g[i - 1]) + 1;
		}
		else
		{
			f[i] = g[i - 1] + 1;
		}

		if (i >= 4 && !(s[i - 1] == s[i - 3] && s[i - 2] == s[i - 4]))
		{
			g[i] = max(g[i - 2], f[i - 2]) + 1;
		}
		else
		{
			g[i] = f[i - 2] + 1;
		}
	}

	cout << max(f[n], g[n]);

	return 0;
}
//

Measured memory_bytes: 2180
(defun create-data ()
  (let* ((n (read)) 
         (m (read)) 
         (p (make-array (1+ n) :initial-element 0))
         (s (make-array (1+ n) :initial-element 0))
         (buff1) 
         (buff2)) 
    (dotimes (i m) 
      (setf buff1 (read))
      (setf buff2 (read))
      (if (and (string-equal buff2 "AC")(= 0 (aref p buff1)))
          (incf (aref p buff1))
          (if (and (string-equal buff2 "WA") (= 0 (aref p buff1)))
              (incf (aref s buff1)))))
    (dotimes (i (1+ n)) 
      (if (and (= 0 (aref p i)) (/= 0 (aref s i)))
          (setf (aref s i) 0)))
    (values n p s))) 


(defun welcome-to-atcoder (n p s)
  (let ((ans1 0) 
        (ans2 0)) 
    (dotimes (i (1+ n))
      (setf ans1 (+ ans1 (aref p i)))
      (setf ans2 (+ ans2 (aref s i))))
    (values ans1 ans2)))

(multiple-value-bind (ans1 ans2)(multiple-value-bind (n p s) (create-data)
  (welcome-to-atcoder n p s))
  (format t "~D ~D~%" ans1 ans2))


Measured memory_bytes: 59752
n=gets.to_i
taro = 0
hanako = 0

n.times do
  s1,s2 = gets.chomp.split
  if s1 < s2
    hanako += 3
  elsif s2 < s1
    taro+=3
  else
    taro += 1
    hanako += 1
  end
end
puts "#{taro} #{hanako}"

Measured memory_bytes: 6100