akhauriyash/Code-Regression huggingface dataset:
from __future__ import print_function

from functools import reduce
from operator import mul
from collections import Counter
from collections import deque
from itertools import accumulate
from queue import Queue
from queue import PriorityQueue as pq
from heapq import heapreplace
from heapq import heapify
from heapq import heappushpop
from heapq import heappop
from heapq import heappush
import heapq
import time
import random
import bisect
import itertools
import collections
from fractions import Fraction
import fractions
import string
import math
import operator
import functools
import copy
import array
import re
import sys
sys.setrecursionlimit(500000)


input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    #
    n = int(input().strip())
    a1 = list(map(int, input().strip().split()))
    a2 = list(map(int, input().strip().split()))
    g = [a1,a2]
    memo = [[0 for _ in range(n)], [0 for _ in range(n)]]

    #
    memo[0][0] = g[0][0]
    memo[1][0] = g[1][0] + g[0][0]
    for i in range(1,n):
        memo[0][i] = memo[0][i-1] + g[0][i]
    for i in range(1,n):
        memo[1][i] = max(  (memo[0][i] + g[1][i])  ,  (memo[1][i-1] + g[1][i])  )
    
    #
    print(memo[1][n-1])
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 62316
#include<bits/stdc++.h>
#include<cmath>
#define SZ(x) ((int)x.size())
#include<vector>
#include<set>
#include<map>
#define ll long long
#define lli long long int
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#include<string>
#include<cctype>
#include<queue>
#define ii pair<int,int>
#include <sstream>
#define lli long long int
#define pairs pair<int,int>
#define mod 1000000007
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
using namespace std;
ll pows(ll a,ll n,ll m)
{
	ll res=1;
	while(n)
	{
	if(n%2!=0)
	{
		res=(res*a)%m;
		n--;
		}
		else
		{
			a=(a*a)%m;
			n=n/2;
			}	
	}
	return res%m;
}
ll  gcd(ll a,ll b)
{
	if(b==0)
	return a;
	else 
	return gcd(b,a%b);
}
bool isprime(ll n)
{
	if(n==1)
	{
		return false;
	}
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}
bool istrue(string s)
{
	int i=0;
	int j=s.size()-1;
	while(i<j)
	{
	if(s[i]==s[j])
	{
		i++;
		j--;
		}
		else
		{
			return false;
			}	
	}
	return true;
}
int main()
{
ios::sync_with_stdio(false);
	 cin.tie(0);
    cout.tie(0);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    if(b<=0&&d<=0)
    {
    cout<<a*c<<endl;	
	}
	else if(b>=0&&d>=0)
	{
		cout<<max(b*d,a*c);
	}
	else if(b<=0)
	{
		cout<<max(b*c,a*c)<<endl;
	}
	else if(d<=0)
	{
	cout<<max(d*a,a*c)<<endl;	
	}
}




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

#define mod 1000000007

#define rep(i, n) for(int i=1; i<=n; ++i)

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	int M, D, count = 0;
	
	cin >> M >> D;
	
	rep(m, M){
		rep(d, D){
			int d1 = d % 10;
			int d2 = d / 10;
			if(d1 >= 2 && d2 >= 2 && d1 * d2 == m)
				count++;
		}
	}
	
	cout << count;
	
	return 0;
}

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

int n;
vector<int> a, b, c;

int main()
{
	cin >> n;
	vector<int> a(n), b(n), c(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++)
		cin >> b[i];
	for (int i = 0; i < n; i++)
		c[i] = a[i] - b[i];
	sort(c.begin(), c.end());
	int ans = 0, i = 0, j = n - 1;
	if (c[i] < 0)
		ans++;
	while (i < j && c[i] < 0)
	{
		if (c[j] < 0 && c[i] < 0)
		{
			cout << -1 << endl;
			return 0;
		}
		if (abs(c[i]) < abs(c[j]))
		{
			c[j] -= abs(c[i]);
			c[i] = 0;
			ans++;
			i++;
		}
		else if (abs(c[i]) > abs(c[j]))
		{
			c[i] += c[j];
			c[j] = 0;
			ans++;
			j--;
		}
		else
		{
			c[i] = 0, c[j] = 0;
			i++, j--, ans += 2;
		}
	}
	sort(c.begin(), c.end());
	if (c[0] < 0)
	{
		cout << -1 << endl;
	}
	else
		cout << ans << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

double dist(pair<double, double> a1, pair<double, double> a2) {
	return pow((a1.fi - a2.fi), 2) + pow((a1.se - a2.se), 2);
}

pair<double,double> p[110];

signed main(){
	int n;
	while (1) {
		//vector<pair<double, double> > p(n);
		scanf("%d", &n);
		if (n == 0) break;
		rep(i, 0, n) {
			//cout << 0 << endl;
			double x, y;
			scanf("%lf,%lf", &x, &y);
			p[i].fi = x;
			p[i].se = y;
		}
		int MAX = 0;
		for (double y = 0.00; y <= 10.01; y += 0.01) {
			for (double x = 0.00; x <= 10.01; x += 0.01) {
				int cnt = 0;
				rep(k, 0, n) {
					if (dist(p[k], (make_pair(x, y))) < 1.0001) cnt++;
				}
				MAX = max(MAX, cnt);
			}
		}
		printf("%d\n", MAX);
	}
}

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

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
#define BIG(c) (c)-0x20
#define SMALL(c) (c)+0x20
const long long mod = 1000000007;

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      string S;
      cin >> S;
      int A = stoi(S.substr(0,2));
      int B = stoi(S.substr(2,2));
      if(A > 0 && A < 13){
          if(B > 0 && B < 13){
              cout << "AMBIGUOUS" << endl;
          }
          else{
              cout << "MMYY" << endl;
          }
      }
      else{
          if(B > 0 && B < 13){
              cout << "YYMM" << endl;
          }
          else{
              cout << "NA" << endl;
          }
      }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i < n; i++)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e18;

int main(){
    int N;
    cin >> N;
    ll A[N];
    rep(i, N) cin >> A[i];
    ll e[61], sum[60];
    vector<int> vec;
    e[0] = 1;
    rep(i, 60) e[i+1] = 2*e[i];
    rep(i, 60){
        sum[i] = 0;
        rep(j, N){
            if(A[j]%e[i+1] >= e[i]) sum[i]++;
        }
        if(sum[i]%2 == 1) vec.push_back(i);
    }
    rep(i, vec.size()){
        int k = vec[i];
        rep(j, N){
            if(A[j]%e[k+1] >= e[k]) A[j] ^= e[k]; 
        }
    }
    for(int i = 59; i >= 0; i--){
        int k = N;
        rep(j, N){
            if(A[j]<e[i+1] && A[j]>=e[i]){
                k = j;
                break;
            }
        }
        if(k == N) continue;
        rep(j, N){
            if(A[j]%e[i+1] >= e[i] && j!=k){
                A[j] ^= A[k];
            }
        }
    }
    ll ans1 = 0, ans2 = 0;
    rep(i, vec.size()) ans1 += e[vec[i]];
    rep(i, N) ans2 ^= 2*A[i];
    cout << ans1 + ans2 << endl;
}

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

int main() {
  int n,x,y;
  cin >> n >> x >> y;
  x=x-1;
  y=y-1;
  vector<int> ans(n);
  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      if(i>=j) continue;
      int a=j-i;
      int b=max(x-i,i-x)+max(y-j,j-y)+1;
      int c=max(y-i,i-y)+max(x-j,j-x)+1;
      int d=min(a,min(b,c));
      ans.at(d-1) = ans.at(d-1)+1;
    }
  }
  for(int i=0; i<n-1; i++){
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  string N;
  cin >> N;
  if(N[0]==N[2]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n;
    scanf("%d", &n);
    int c = 0;
    for (int i = 1; i < 10; i++){
        for (int j = 1; j < 10; j++){
            if (n == i * j){
                c = 1;
                break;
            }
        }
    }
    char* s[2];
    s[0] = "No";
    s[1] = "Yes";
    printf("%s", s[c]);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

int main (void) {

  int n;
  std::cin >> n;

  std::vector<long long> a(n);
  for(int i=0; i<n; i++) std::cin >> a[i];

  long long amax = *std::max_element(a.begin(), a.end());

  long long ans_t = 0, ans = 0;
  for(int i=0; i<n; i++) {
    long long tmp = a[i];
    if ( tmp > amax-a[i] ) tmp = amax-a[i];
    if ( ans_t < tmp ) {
      ans_t = tmp;
      ans = a[i];
      }
  }

  std::cout << amax << " " << ans << std::endl;

  return 0;
}

Measured memory_bytes: 1024
/******************************************
* AUTHOR : ARPIT *
* NICK : arpitfalcon *
* INSTITUTION : BIT MESRA *
* Ab m game m hu. *
******************************************/

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007 -
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define vin                    \
    ll n;                      \
    cin >> n;                  \
    vector<ll> x(n);           \
    for (ll i = 0; i < n; i++) \
    cin >> x[i]
#define vout                   \
    for (ll i = 0; i < n; i++) \
    cout << x[i] << " "
#define T     \
    ll t = 1; \
    cin >> t; \
    while (t--)
#define ain                    \
    ll n, k;                   \
    cin >> n >> k;             \
    ll a[n];                   \
    for (ll z = 0; z < n; z++) \
    cin >> a[z]
#define aout                   \
    for (ll i = 0; i < n; i++) \
    cout << a[i] << " "
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl "\n"
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define max4(a, b, c, d) max(a, max3(b, c, d))
#define min4(a, b, c, d) min(a, min3(b, c, d))
#define blink                \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const double PI = 3.141592653589793238463;

#define forn(i, n) for (ll(i) = 0; (i) < (n); ++(i))
#define for1(i, n) for (ll(i) = 1; (i) <= (n); ++(i))
#define forr(i, n) for (ll(i) = (n)-1; (i) >= 0; --(i))
#define forab(i, a, b, c) for (ll(i) = a; (i) <= (b); (i) += (c))

/*
__builtin_ffs(x)
  Number of set bits: __builtin_popcount(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
*/

int main()
{
    blink
#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    // your code goes here
    int k, n;
    cin >> n >> k;
    vector<int> data(n);

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

    int res = 0;
    n -= k;
    res++;

    res += n / (k - 1);

    if (n % (k - 1) != 0)
        res++;
    cout << res;

    return 0;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main(){
	IOS;
	int x, y;
	cin >> x >> y;

	bool pos = false;
	for(int i = 0; i <= x; i++){
		int cur = i*2 + (x-i)*4;
		if( cur == y )
			pos = true;
	}

	if( pos )
		cout << "Yes\n";
	else
		cout << "No\n";
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    ll ma=0;
    int ma_idx;
    REP(i,n){
        int a;
        cin>>a;
        if(abs(ma)<abs(a)) ma = a,ma_idx=i;
    }
    ma_idx++;
    cout<<2*n-1<<endl;
    for(int i=1;i<=n;i++){
        cout<<ma_idx<<" "<<i<<endl;
    }
    if(ma>=0){
        for(int i=1;i<n;i++) cout<<i<<" "<<i+1<<endl;
    }
    else{
        for(int i=n;i>1;i--) cout<<i<<" "<<i-1<<endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#include<stack>
#include<queue>
#include<functional>
#include<cassert>
#include<set>
#include<time.h>
#include<cmath>
#include<functional>
#include<cassert>
#define rep(a,b) for(ll a=0;a<b;++a)
#define REP(a,b,c,d) for(ll a=b;a<c;a+=d)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
using p_i = pair<int, int>;
int main() {
    string S;cin>>S;
    string year=S.substr(0,4),month=S.substr(5,2);

    if(atoi(year.c_str())<2019){
        cout<<"Heisei"<<endl;
        return 0;
    }
    if(atoi(month.c_str())<5){
        cout<<"Heisei"<<endl;
        return 0;
    }
    cout<<"TBD"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int x;
    cin >> x;
    cout << 8-(x-400)/200 << "\n";
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define reprr(i, m, n) for (ll i = m; i < n; i++)
#define inf 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

ll gcd(ll a, ll b) {
    while (b) {
        ll x = a, y = b;
        a = y, b = x % y;
    }
    return a;
}

bool is_prime(ll n) {
    if (n <= 2) return true;
    if (n % 2 == 0) return false;
    for (ll i = 3; i <= sqrt(n); i+=2) if (n % i == 0) return false;
    return true;
}

int main()
{

    ll A, B; cin >> A >> B;
    ll g = gcd(A, B);
    set<ll> st;
    for (ll i = 1; i <= sqrt(g); i++) {
        if (g % i != 0) continue;
        if (is_prime(i)) {
            //cout << i << " is prime" << endl;
            st.insert(i);
        }
        if (is_prime(g / i)) {
            // cout << g / i << " is prime" << endl;
            st.insert(g / i);
        }
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 256
def resolve():
	S = input()
	mark = ""
	count = 0
	max_count = 0
	for s in list(S):
		if s == "R":
			count += 1
		else:
			max_count = max(max_count, count)
			count = 0
			mark = s
	max_count = max(max_count, count)
	print(max_count)
resolve()

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

int main(){
	int n,k;
	char c;
	bool card[4][13]; //0=SHCD 13=num
	cin>>n;
	for(int i=0;i<4;i++){
		for(int j=0;j<13;j++){
			card[i][j]=true;
		}
	}
	while(n--){
		cin >> c >> k;
		switch(c){
			case 'S':
				card[0][k-1] = false;	//exist
				break;
			case 'H':
				card[1][k-1] = false;
				break;
			case 'C':
				card[2][k-1] = false;
				break;
			case 'D':
				card[3][k-1] =false;
				break;
		}
	}

		for(int i=0;i<4;i++){
			for(int j=0;j<13;j++){
				if(card[i][j]){
					switch(i){
						case 0:
							cout << 'S';
							break;
						case 1:
							cout << 'H';
							break;
						case 2:
							cout << 'C';
							break;
						case 3:
							cout << 'D';
							break;
					}
					cout << ' ' << j+1 << endl;
				}
			}
		}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main(){
string S,T;
  cin>>S>>T;
  int N=S.size();
  int M=T.size();
  if(N<M)
    cout<<"UNRESTORABLE"<<endl;
  else{
    bool a=false;
  for(int i=N-M;0<=i;i--){
     bool x=true;
    for(int j=0;j<M;j++)
  if(S.at(i+j)!=T.at(j) && S.at(i+j)!='?'){x=false;break;}
    
    if(x){a=true;
         for(int j=i;j<i+M;j++)
           S.at(j)=T.at(j-i);
         } if(a)break;
  
  }if(!a)
    cout<<"UNRESTORABLE"<<endl;
    else{
    for(int i=0;i<N;i++)
      if(S.at(i)=='?')
        S.at(i)='a';
      cout<<S<<endl;
    
    }
  
  }
   return 0;
}

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

using namespace std;
bool isprime(int x){
    if(x==2) return true;
    else if(x<2 || x%2==0) return false;
    else if(x>3){
        int i = 3;
        while(i <= sqrt(x)){
            if(x%i==0) return false;
            i++;
        }
        return true;
    }
}

int main(){
    int n;
    cin >> n;
    int counter = 0;
    for(int i = 0;i < n;i++){
        int a;
        cin >> a;
        if(isprime(a)) counter++; 
    }
    cout << counter << "\n";
    return 0;   
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vc)
{
  for (auto it = vc.begin(); it != vc.end(); ++it)
  {
    if (std::next(it) == vc.end())
      os << *it;
    else
      os << *it << ' ';
  }
  return os;
}

template<class T1, class T2>
inline
std::ostream & operator<<(std::ostream & os, const std::pair<T1, T2> & p)
{
  return os << p.first << ' ' << p.second;
}

void solve(void)
{
  using std::string;
  using std::vector;
  using std::map;
  using std::pair;
  using std::cin;
  using std::cout;
  string S{}; std::cin >> S;
  const string str{"2019/04/30"};
  bool ans = S <= str;
  cout << (ans ? "Heisei" : "TBD" ) << '\n';
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T iabs(const T& x) { return max(x, -x); }
// #define abs gabs

int main() {
    int a, b;
    cin >> a >> b;
    if (a == 1) a += 13;
    if (b == 1) b += 13;
    string s = "Draw";
    if (a > b) s = "Alice";
    if (a < b) s = "Bob";
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 888
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    N = input()
    n0 = 2
    n1 = 1
    if N == 1:
        print(1)
    else:    
        now = 1
        while now != N:
            n = n0 + n1
            n0 = n1
            n1 = n
            now += 1
        print(n)


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

int main() {
    ll X, K, D;
    cin >> X >> K >> D;
    X = abs(X);
    ll N = X/D; // count
    ll d = X%D; // distance
    ll ans;
    if (N >= K) {
        ans = X-K*D;
    }
    else if (K%2 == 0) {
        if (N%2 == 0) {
            ans = d;
        }
        else {
            ans = D-d;
        }
    }
    else {
        if (N%2 != 0) {
            ans = d;
        }
        else {
            ans = D-d;
        }
    }
    cout << ans << endl;
}

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

int main(){
    int n, a[26] = {}, b[26] = {};
    cin >> n;
    char c;
    for(int i = 0; i < n; i++)  cin >> c, a[c-'a']++;
    for(int i = 0; i < n; i++)  cin >> c, b[c-'a']++;
    sort(a, a+26);
    sort(b, b+26);
    int ret = 0;
    for(int i = 0; i < 26; i++) ret += abs(a[i]-b[i]);
    cout << ret/2 << endl;
    return 0;
}


Measured memory_bytes: 3176
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll h,w; cin >> h >> w;
  
  rep(i,h){
    string s = "";
    rep(j,w){
      char x; cin >> x;
      s += x;
    }
    
    rep(k,2) cout << s << endl;
  }
  
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int maxx=-1,flag=1;
	for(int i=1;i<=n;i++){
		int kount=0;
		int temp=i;
		while(temp%2==0){
			temp/=2;
			kount++;
		}
		if(kount>maxx){
			maxx=kount;
			flag=i;
		}
	}
	cout<<flag<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main()
{
    int n;
    cin >> n;
    int cur_h, pre_h;
    int cnt = 0, max_cnt = 0;
    cin >> pre_h;
    rep(i,n-1) {
        cin >> cur_h;
        if (cur_h <= pre_h) cnt++;
        else cnt = 0;
        max_cnt = max(cnt, max_cnt);
        pre_h = cur_h;
    }
    cout << max_cnt << endl;
    return 0;
}

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

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    int N;
    cin>>N;
    set<pair<ll,ll>> st;
    

    if(N%2==0){
        REP2(i,1,N+1){
            REP2(j,1,N+1){
                if(i==j||i+j==N+1) continue;
                ll a=min(i,j);
                ll b=max(i,j);
                st.insert(make_pair(a,b));
            }
        }
    }else{
        REP2(i,1,N){
            ll a=i;
            ll b=N;
            st.insert(make_pair(a,b));
        }
        REP2(i,1,N){
            REP2(j,1,N){
                if(i==j||i+j==N) continue;
                ll a=min(i,j);
                ll b=max(i,j);
                st.insert(make_pair(a,b));
            }
        }
    }
    

    cout<<st.size()<<endl;
    for(auto itr=st.begin();itr!=st.end();itr++){
        cout<<itr->first<<" "<<itr->second<<endl;
    }
}

Measured memory_bytes: 3940
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<fstream>
#include <stdio.h>
#include<string.h>
using namespace std;
void winter_is_coming()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
}

int main()
{
  //freopen(".in", "r", stdin);
	winter_is_coming();
	

	int len,a,b;
	cin>>len>>a>>b;
	
    if((abs(a-b)%2==1 || len==2))
		cout<<"Borys\n";
	else
		cout<<"Alice\n";

	//system("pause");
    return 0;
}



Measured memory_bytes: 888
#include  <stdio.h>

int main()
{
	int h,w;
	int i,j;

	while(1)
	{
		scanf("%d %d",&h,&w);
		if(h==0&&w==0)
		{
			break;
		}
		for(i=0;i<h;i++)
		{                    
			for(j=0;j<w;j++)         
			{            
				if(( i==0 )||( i==h-1 )||( j==0 )||( j==w-1 ))
				{
					printf("#");
				}
				else
				{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}     
		return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
#define int            int64_t
#define double         long double
#define nitro          ios_base::sync_with_stdio(false);cin.tie(0);
#define vi             vector<int64_t>
#define pub            push_back
#define puf            push_front
#define pob            pop_back
#define pof            pop_front
#define PI             3.1415926535897932384626433832795
#define read(a)        for(auto& x : a) cin>> x
#define endl           '\n'
#define gap            ' '
#define min3(a,b,c)    min(a, min(b, c))
#define max3(a,b,c)    max(a, max(b, c))
#define MOD            1000000007
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int32_t main()
{
    nitro
    int n,ans=0;cin>>n;
    while(n--){
    	int a,b;cin>>a>>b;
    	ans+=b-a+1;
    }
    cout<<ans;
}
    

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;


int main(void){
    string s;
    cin >> s;

    int a = 0, b = 0, c = 0;
    for (int i = 0; i < s.size(); i++){
        if (s[i] == 'a') a++;
        else if (s[i] == 'b') b++;
        else c++;
    }

    if (max(a - b, b - a) <= 1 && max(b - c, c - b) <= 1 && max(c - a, a - c) <= 1) cout << "YES" << endl;
    else cout << "NO" << endl;

}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include <random>
#define ll long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const int INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const int MOD = 1000000007;
const int MAX = 510000;
const double pi = acos(-1);
const double eps = 1e-9;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll h,w,n;
    cin>>h>>w>>n;
    ll x,y;
    cin>>x>>y;
    x--;y--;
    string s,t;
    cin>>s>>t;
    ll left=0,right=w;
    reverse(all(s));
    reverse(all(t));
    if(s[0]=='R') right--;
    if(s[0]=='L') left++;
    rep2(i,1,n){
        if(t[i]=='L') right=min(right+1,w);
        else if(t[i]=='R') left=max(left-1,0LL);
        if(s[i]=='L') left++;
        else if(s[i]=='R') right--;
        if(left>=right){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    if(y<left||right<=y){
        cout<<"NO"<<endl;
        return 0;
    }
    left=0,right=h;
    if(s[0]=='U') left++;
    if(s[0]=='D') right--;
    rep2(i,1,n){
        if(t[i]=='U') right=min(right+1,h);
        else if(t[i]=='D') left=max(left-1,0LL);
        if(s[i]=='D') right--;
        else if(s[i]=='U') left++;
        if(left>=right){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    if(x<left||right<=x){
        cout<<"NO"<<endl;
        return 0;
    }
    cout<<"YES"<<endl;
    return 0;
}


Measured memory_bytes: 920
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
#define fbo find_by_order
#define ook order_of_key

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 122)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 122)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 122)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll quickpow (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = quickpow (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return quickpow (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/__gcd(num1,num2))*num2;}
// end of Template
int a,b;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin>>a>>b;
    a-=2*b;
    a=max(a,0);
    cout<<a<<newl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <iomanip>
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdbl vector<double>
#define vstr vector<string>
#define push_back pb
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

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

	string s;
	cin >> s;

	int ans = s.size();
	int cnt = 0;

	rep(i,s.size()){
		if(s[i] == 'S'){
			cnt++;
		}else{
			if(cnt > 0){
				cnt--;
				ans -= 2;
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 2019;
const ll  maxn = 1e6 + 5;
const int N = 2e5 + 5;

char s[N];
int a[N],suf[N],n,M[2020];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>s+1;
	int n=strlen(s+1);
	int cnt=0;int base=1;
	M[0]++;
	for(int i=n;i>=1;i--){
		a[i]=s[i]-'0';
		suf[i]=(suf[i+1]+a[i]*base)%mod;
		cnt+=M[suf[i]];
		M[suf[i]]++;
		base=base*10%mod;
	}
	cout<<cnt<<'\n';
	return 0;
}

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

int main()
{
    string str;
    cin >> str;
    string L = "L";
    string R = "R";
    for(int i=0;i<str.length();i++){
        if(i%2==1){
            if(str.compare(i,1,R)==0){
                cout << "No" << endl;
                return 0;
            }
        }else{
            if(str.compare(i,1,L)==0){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);




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

	int N, A, B;
	cin >> N >> A >> B;

	if (N == 1) {
		if (A == B)cout << 1 << endl;
		else cout << 0 << endl;
		return 0;
	}
	if (A > B) {
		cout << 0 << endl;
		return 0;
	}

	int minsum = A*(N - 1) + B;
	int maxsum = A + B*(N - 1);
	cout << (maxsum-minsum+1) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
    while (true) {
        int n, a, b;
        cin >> n >> a >> b;
        if ((n | a | b) == 0) {
            break;
        }
        int representableNum = 0;
        bool* isRepresentable = new bool [n + 1];
        fill_n(isRepresentable, n + 1, false);
        isRepresentable[0] = true;
        for (int j = 0; j < a; j++) {
            int x = b * j;
            if (n < x) {
                break;
            }
            while (x <= n) {
                if (isRepresentable[x] == false) {
                    isRepresentable[x] = true;
                    representableNum++;
                }
                x += a;
            }
        }
        cout <<  n - representableNum << endl;
        delete[] isRepresentable;
    }
}


 
 

Measured memory_bytes: 4020
#include<bits/stdc++.h>
using namespace std;
//<<setprecision(30)
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
  int X,Y,Z; cin>>X>>Y>>Z;
  cout<<Z<<" "<<X<<" "<<Y<<endl;
}


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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

template<typename V,typename T>
T find_num(V v, T num) {
    if ( find(ALL(v), num) == v.end() ) {
        return false;
    } else {
        return true;
    }
}

// π M_PI
// deg = rad*180/M_PI
const ll MOD = 1e9 + 7;

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

    if ( n+1 == k ) {
        ans++;
    } else {
        for (ll i = k; i <= n+1; ++i) {
            ll min = i*(i-1)/2;
            ll max = i*(2*n-i+1)/2;
            ans += max-min+1;
        }
    }

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


Measured memory_bytes: 3628
#include<stdio.h>
int main(){
  int a,b,sum,c;
  while(scanf("%d %d",&a,&b)!=EOF){
    sum=a+b;
    c=0;
    while(sum!=0){
      sum=sum/10;
      c++;
    }
    printf("%d\n",c);
  }
  return(0);
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int N,M;
  cin >> N >> M;
  int K,A;
  vector<int> ans(M+1);
  for(int i=0; i<N; i++){
    cin >> K;
    for(int j=1; j<=K; j++){
      cin >> A;
      ans.at(A)++;
    }
  }
  int cnt=0;
  for(int i=1; i<=M; i++){
    if(ans.at(i)==N) {
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0164

"""
import sys
from sys import stdin
from itertools import cycle
input = stdin.readline


def taro(n):
    return (n - 1) % 5


def main(args):
    while True:
        n = int(input())
        if n == 0:
            break

        jiro = cycle([int(x) for x in input().split(' ')])

        ohajiki = 32
        while ohajiki > 0:
            ohajiki -= taro(ohajiki)
            print(ohajiki)
            ohajiki -= jiro.__next__()
            print(max(0, ohajiki))


if __name__ == '__main__':
    main(sys.argv[1:])
    

Measured memory_bytes: 7740
N = int(input())
S = [i for i in input()]
alpha=['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
ans=''
for c in S:
    cnt = alpha.index(c)+N
    if cnt > 25:
        cnt=cnt-26
    c = alpha[cnt]
    ans+=c
print(ans)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
  int score[200] = { 0 };
  int number[200][3];

  int N;

  cin >> N;

  for (int i = 0; i < N; i++) {
    cin >> number[i][0] >> number[i][1] >> number[i][2];
  }

  bool getScore = true;
  
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < N; j++) {
      getScore = true;
      for (int k = 0; k < N; k++) {
        if (number[j][i] == number[k][i] && j != k) {
          getScore = false;
          break;
        }
      }
      if (getScore) {
        score[j] += number[j][i];
      }
    }
  }

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



Measured memory_bytes: 3072
N = int(input())
ans = [0] * 4

for s in range(N):
    s = input()
    if s == 'AC':
        ans[0] += 1
    elif s == 'WA':
        ans[1] += 1
    elif s == 'TLE':
        ans[2] += 1
    else:
        ans[3] += 1

print('AC x ' + str(ans[0]))
print('WA x ' + str(ans[1]))
print('TLE x '+ str(ans[2]))
print('RE x ' + str(ans[3]))

Measured memory_bytes: 9212
#define _CRT_SECURE_NO_WARNINGS

#define N (1<<17)
#define MODULO (1000000007)

#include <cstdio>
#include <iostream>
#include <fstream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <vector>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;

string s;
int dp[N];

int main()
{
	ios::sync_with_stdio(false);
	cin >> s;
	for (int i = 0;i < s.length();i++)
	{
		if (i - 4 >= 0)
		{
			string st = s.substr(i - 4, 5);
			if (st == "dream" || st == "erase")
			{
				if (i - 4)
				{
					dp[i] |= dp[i - 5];
				}
				else
				{
					dp[i] = 1;
				}
			}
		}
		if (i - 5 >= 0)
		{
			string st = s.substr(i - 5, 6);
			if (st == "eraser")
			{
				if (i - 5)
				{
					dp[i] |= dp[i - 6];
				}
				else
				{
					dp[i] = 1;
				}
			}
		}
		if (i - 6 >= 0)
		{
			string st = s.substr(i - 6, 7);
			if (st == "dreamer")
			{
				if (i - 6)
				{
					dp[i] |= dp[i - 7];
				}
				else
				{
					dp[i] = 1;
				}
			}
		}
	}
	cout << ((dp[s.length() - 1]) ? ("YES") : ("NO")) << endl;
	//system("pause");
	return 0;
}



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

using namespace std;

typedef long long ll;

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

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

int main() {
	ll a, b;
	cin >> a >> b;
	cout << lcm(a, b) << endl;
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    long long A[N];
    map<long long,long long> u;
    map<long long,long long> v;
    for(long long i =0; i < N; i++){
        cin >> A[i];
        u[A[i] + i] ++;
        v[i-A[i]] ++;
    }
    map<long long,long long> Used;
    long long ans = 0;
    for(int i =0; i < N; i++){
        int l = A[i] + i;
        if(Used[l] == 0){
            ans += u[l]*v[l];
            Used[l] = 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 50880
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <vector>
using namespace std;
typedef long long li;
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (n); i++)
#define df 0
template <class T>
void print(const T& t) {
    cout << t << "\n";
}
template <class T, class... Ts>
void print(const T& t, const Ts&... ts) {
    cout << t;
    if (sizeof...(ts)) cout << " ";
    print(ts...);
}

void dfs(vector<vector<int>>& adj, vector<int>& ans, const vector<li>& a, int parent = -1,
         int v = 0) {
    static vector<li> lis(a.size(), INT_MAX);

    auto itr = lower_bound(lis.begin(), lis.end(), a[v]);
    int flag = (itr != lis.end());
    li memo;
    if (flag) {
        memo = *itr;
        *itr = a[v];
    } else
        lis.push_back(a[v]);

    ans[v] = lower_bound(lis.begin(), lis.end(), INT_MAX) - lis.begin();
    for (int x : adj[v]) {
        if (x == parent) continue;
        dfs(adj, ans, a, v, x);
    }

    if (flag)
        *itr = memo;
    else
        lis.pop_back();
}

int main() {
    int n;
    cin >> n;
    vector<li> a(n);
    rep(i, n) cin >> a[i];
    vector<vector<int>> adj(n);
    rep(i, n - 1) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    vector<int> ans(n, -1);
    dfs(adj, ans, a);

    rep(i, n) print(ans[i]);
}

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

map<string, int> mmap;
string s;

int main() {
    mmap["SUN"] = 0;
    mmap["MON"] = 1;
    mmap["TUE"] = 2;
    mmap["WED"] = 3;
    mmap["THU"] = 4;
    mmap["FRI"] = 5;
    mmap["SAT"] = 6;
    cin >> s;
    cout << 7 - mmap[s] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int N;
	int d[60];
	int ans = 0;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> d[i];
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
/*
  A - One out of Three
  http://abc075.contest.atcoder.jp/tasks/abc075_a
*/

int main(int argc, char const *argv[]) {

  int A,B,C;
  scanf("%d %d %d\n", &A, &B, &C);
  if(A==B){
    printf("%d\n", C);
  }else if(B==C){
    printf("%d\n", A);
  }else if(C==A){
    printf("%d\n", B);
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int S[100005];
int main() {
  ios::sync_with_stdio(false);
  int N, K, Q;
  cin >> N >> K >> Q;
  for (int i=0; i<Q; i++) {
    int a;
    cin >> a;
    S[a]++;
  }
  for (int i=1; i<=N; i++) {
    long long d = K;
    d = d - Q + S[i];
    if (d > 0) cout << "Yes" << '\n';
    else cout << "No" << '\n';
  }
}

Measured memory_bytes: 1024