akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include <map>
#include <set>

using namespace std;

#define REP(i,x) for(int i=0; i<(int)(x); i++)       // 0 <= i < x
#define REPS(i,x) for(int i=1; i<=(int)(x); i++)     // 0 < i <= x
#define RREP(i,x) for(int i=((int)(x)-1); i>=0; i--) // x > i >= 0
#define RREPS(i,x) for(int i=((int)(x)); i>0; i--)   // x >= i > 0
#define INF 100000000

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

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

int main(void){
    int N;
    cin >> N;
    int F[N][10], P[N][11];
    REP(i, N){
        REP(j, 10){
            cin >> F[i][j];
        }
    }
    REP(i, N){
        REP(j, 11){
            cin >> P[i][j];
        }
    }
    
	int res = -(1 << 30);
    int c;
    int profit = 0;
    for(int i = 1; i < (1 << 10); i++){
        profit = 0;
        REP(j, N){ //shop j
            c = 0;
            REP(k, 10){ //time k
                //c += F[j][k] & (i >> k);
                if(F[j][k] && ((i >> k) & 1)){
                    c++;
                }
            }
            profit += P[j][c];
        }

        res = max(res, profit);
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cin >> b[i];
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  int d = b[n / 2] + b[(n - 1) / 2] - a[n / 2] - a[(n - 1) / 2];
  if (n % 2) d /= 2;
  cout << d + 1 << endl;
  return 0;
}


Measured memory_bytes: 4720
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  dl R, G;
  ci(R, G);
  co(2 * G - R);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  
  vector<ll> s(n+1);
  rep(i,n) s[i+1] = s[i] + a[i];

  vector<int> il(n+1), ir(n+1);
  for(int i=2, idx=1; i<=n-2; ++i){
    auto d = [&](int j){ return abs((s[i]-s[j])-(s[j]-s[0])); };
    while(idx+1<i && d(idx+1)<d(idx)) ++idx;
    il[i] = idx;
  }
  for(int i=n-2, idx=n-1;i>=2; --i){
    auto d = [&](int j){ return abs((s[n]-s[j])-(s[j]-s[i])); };
    while(idx-1>i && d(idx-1)<d(idx)) --idx;
    ir[i] = idx;
  }
  ll ans = 1e18;
  for(int i=2; i<=n-2; ++i){
    ll mi = 1e18, ma = -1e18;
    mi = min(mi,s[n]-s[ir[i]]); ma = max(ma,s[n]-s[ir[i]]);
    mi = min(mi,s[ir[i]]-s[i]); ma = max(ma,s[ir[i]]-s[i]);
    mi = min(mi,s[i]-s[il[i]]); ma = max(ma,s[i]-s[il[i]]);
    mi = min(mi,s[il[i]]-s[0]); ma = max(ma,s[il[i]]-s[0]);
    ans = min(ans,ma-mi);
  }
  cout << ans << endl;
}

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

int main() {
    ll n,k;
    std::cin >> n>>k;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    priority_queue<ll,vector<ll>,greater<ll>> pq;

    for (int i = k; i < n; i++) {
        if(a[i]<=a[i-k]){
            std::cout << "No" << std::endl;
        }else{
            std::cout << "Yes" << std::endl;
        }
    }
}


Measured memory_bytes: 4788
#include<iostream>
using namespace std;
int main(){
	int n,s,max,total=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		if(!i||s>max)max=s;
		total+=s;
	}
	if(max<(total-max))cout<<"Yes\n";
	else cout<<"No\n";
}

Measured memory_bytes: 256
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
const ll MOD = 1000000000000000001;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b){
  ll r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


ll LCM(ll a,ll b){
  ll c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
    return p;
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
  return p;
}



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  ll ans=MOD;
  for(ll i=1;i<=sqrt(n);i++){
    if(n%i==0){
      ans=min(ans,max(Len(i),Len(n/i)));
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
class Node:
    def __init__(self, key):
        self.key = key
        self.parent = self.left = self.right = None
    
class Tree():
    def __init__(self, root=None):
        self.root = root
    
    def insert(self, node):
        y = None
        x = self.root
        while x is not None:
            y = x
            if node.key < x.key:
                x = x.left
            else:
                x = x.right
        
        node.parent = y
        if y is None:   # Tree が空だった場合
            self.root = node
        elif node.key < y.key:
            y.left = node
        else:
            y.right = node
    
    def print_inorder_tree_walk(self):
        def work(node):
            if node is None:
                return
            work(node.left)
            print('', node.key, end='')
            work(node.right)

        work(self.root)
        print()
    
    def print_preorder_tree_walk(self):
        def work(node):
            if node is None:
                return
            print('', node.key, end='')
            work(node.left)
            work(node.right)

        work(self.root)
        print()


import sys

n = int(input())
T = Tree()
for _ in range(n):
    command, *args = sys.stdin.readline().split()
    if command[0] == 'i':   # insert key
        T.insert(Node(int(args[0])))
    else:   # print
        T.print_inorder_tree_walk()
        T.print_preorder_tree_walk()


Measured memory_bytes: 105436
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<cmath>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<fstream>
#include<map>
#include<bitset>
#include<unordered_map>
#include<cstring>
#include<cctype>
using namespace std;
#define  ll long long
#define  ull unsigned long long
#define  ul unsigned long
#define all(v) v.begin(),v.end()
#define sz(n) (int)n.size()
#define pb(s) push_back(s);
#define format(n) fixed<<setprecision(n)
#define finl "\n"
#define Mohammed_Atef_Hassan fast();
#define mod 1000000007
#define INF LLONG_MAX
#define PI acos(-1)
#define clr(dp,n) memset(dp,n,sizeof dp)
#define ex(n) return cout<<n<<finl,0;
int dx[] = { 0, 1, 0, -1, 1, 1, -1, -1 };
int dy[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
ll fix_mod(ll x, ll y)
{
	return (y + x % y) % y;
}
void fast() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);

#ifdef ONLINE_JUDGE
	//freopen("crosses.in", "r", stdin);

	//freopen("crosses.out", "w", stdout);
#endif
#ifndef ONLINE_JUDGE
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#endif
}
ll mem1[401][401], mem2[401][401]; vector<ll>v;
ll solve(int sz, int i)
{
	if (sz == 1)return 0;
	ll& ret = mem2[sz][i];
	if (~ret)return ret;
	ret = LLONG_MAX;
	ll cost = 0;
	for (int j = i; j < i + sz; j++)cost += v[j];
	for (int j = i; j < i + sz - 1; j++)
	{
		if (mem1[sz][i] == mem1[j - i + 1][i] + mem1[i + sz - 1 - j - 1 + 1][j + 1])
		{
			ret = min(ret, cost + solve(j - i + 1, i) + solve(i + sz - 1 - j - 1 + 1, j + 1));
		}
	}
	return ret;
}
int main()
{
	Mohammed_Atef_Hassan
		clr(mem2, -1);
		int n;
	cin >> n;
	v=vector<ll>(n);
	for (int i = 0; i < n; i++)cin >> v[i];
	for (int i = 1; i <= n; i++)
		for (int j = 0; j < n; j++)
			mem1[i][j] = LLONG_MAX;
	for (int i = 0; i < n; i++)
		mem1[1][i] = v[i];
	for (int sz = 2; sz <= n; sz++)
	{
		for (int i = 0; i + sz - 1 < n; i++)
		{
			for (int j = i; j < i + sz - 1; j++)
			{
				mem1[sz][i] = min(mem1[sz][i], mem1[j - i + 1][i] + mem1[i + sz - 1 - j - 1 + 1][j + 1]);
			}
		}
	}
	cout << solve(n, 0) << finl;
}

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

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

for i in range(1000):
    
    k = str(i)
    
    if len(k) == n and all([k[s-1]==str(c) for s,c in sc]):
        print(k)
        exit(0)

print(-1)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication40
{
    class Program
    {
        static void Main()
        {
            int[] s = new int[7];
            int a = int.Parse(Console.ReadLine());
            for(int b =0; b < a; b++)
            {
                decimal c = decimal.Parse(Console.ReadLine());
                if (c < 165) s[0]++;
                else if (c < 170) s[1]++;
                else if (c < 175) s[2]++;
                else if (c < 180) s[3]++;
                else if (c < 185) s[4]++;
                else s[5]++;
            }
            for(int e = 0; e < 6; e++)
            {
                Console.Write(e+1 + ":");
                for(int g = 0; g < s[e]; g++)
                {
                    Console.Write("*");
                }
                Console.WriteLine();
            }
        }
    }
}

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

class Dice{
public:
	Dice(int label1, int label2, int label3, int label4, int label5, int label6)
	{
		m_label[0] = label1;
		m_label[1] = label2;
		m_label[2] = label3;
		m_label[3] = label4;
		m_label[4] = label5;
		m_label[5] = label6;
	}

	void rollDice(std::string command)
	{
		if (command == "E") {
			int tmpLabelV = m_label[0];
			m_label[0] = m_label[3];
			m_label[3] = m_label[5];
			m_label[5] = m_label[2];
			m_label[2] = tmpLabelV;
		}
		else if (command == "N") {
			int tmpLabelV = m_label[0];
			m_label[0] = m_label[1];
			m_label[1] = m_label[5];
			m_label[5] = m_label[4];
			m_label[4] = tmpLabelV;
		}
		else if (command == "S") {
			int tmpLabelV = m_label[0];
			m_label[0] = m_label[4];
			m_label[4] = m_label[5];
			m_label[5] = m_label[1];
			m_label[1] = tmpLabelV;
		}
		else if (command == "W") {
			int tmpLabelV = m_label[0];
			m_label[0] = m_label[2];
			m_label[2] = m_label[5];
			m_label[5] = m_label[3];
			m_label[3] = tmpLabelV;
		}

		return;
	}

	int getNumberOnTop(void)
	{
		return m_label[0];
	}

private:
	int m_label[6];
};

int main()
{
	int label1,label2,label3,label4,label5,label6;

	std::cin >> label1 >> label2 >> label3 >> label4 >> label5 >> label6;
	Dice dice1(label1, label2, label3, label4, label5, label6);

	std::string commands;
	std::cin >> commands;

	for (int i = 0; i < commands.length(); i++) {
		dice1.rollDice(commands.substr(i, 1));
	}

	std::cout << dice1.getNumberOnTop() << std::endl;
}

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

int main(){
	int a, b, n, t = 1, ans = 0;
	scanf("%d%d", &a, &b);
	while(t <= b)t *= 10;
	n = a*t+b;
	for(int i = 1;i < n;i++){
		if(i*i == n){
			ans = 1;
		}
		if(i*i > n)break;
	}
	if(ans)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
import itertools
import math

n = int(input())
town_xy=[]
for i in range(n):
    town_xy.append([int(x) for x in input().split()])

town_routes = len(list(itertools.permutations(town_xy)))

sum_distance = 0
for route in itertools.permutations(town_xy):
    for i in range(1, len(route)):
        x_diff = route[i-1][0] - route[i][0]
        y_diff = route[i-1][1] - route[i][1]
        sum_distance += math.sqrt(x_diff**2 + y_diff**2)

print(sum_distance/town_routes)

Measured memory_bytes: 8308
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long N,K;
    cin >> N >> K;
    long long R,S,P;
    cin >> R >> S >> P;
    string T;
    cin >> T;
    long long ans = 0;
    for(int i = 0; i < N; i++){
        if(i < K){
            if(T[i] == 'r') ans += P;
            else if(T[i] == 's') ans += R;
            else if(T[i] == 'p') ans += S;
        }
        else{
            if(T[i] == 'r'){
                if(T[i-K] == T[i]) T[i] = 'x';
                else ans += P;
            }
            else if(T[i] == 's'){
                if(T[i-K] == T[i]) T[i] = 'y';
                else ans += R;
            }
            else if(T[i] == 'p'){
                if(T[i-K] == T[i]) T[i] = 'z';
                else ans += S;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
from collections import deque
n, m = map(int, input().split())
graph = [[[] for _ in range(3)] for _ in range(n+1)]
for _ in range(m):
    u, v = map(int, input().split())
    graph[u][0].append([v, 1])
    graph[u][1].append([v, 2])
    graph[u][2].append([v, 0])


s, t = map(int, input().split())
q = deque([[s, 0]])
visited = [[False] * 3 for _ in range(n+1)]
visited[s][0] = True
dist = [[-3] * 3 for _ in range(n+1)]
dist[s][0] = 0
while q:
    num, cnt = q.popleft()
    for i, j in graph[num][cnt]:
        if visited[i][j]:
            continue
        q.append([i, j])
        visited[i][j] = True
        dist[i][j] = dist[num][cnt] + 1

print(dist[t][0]//3)


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

#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
typedef unsigned long long ull;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int INF = 1 << 27;
const int MAX_V = 101;
void visit(int V, int G[MAX_V][MAX_V], int v, int s, int r,
    vector<int> &no, vector< vector<int> > &comp,
    vector<int> &prev, vector< vector<int> > &next,
    vector<int> &mcost, vector<int> &mark,
    int &cost, bool &found) {
  if (mark[v]) {
    vector<int> temp = no;
    found = true;
    do {
      cost += mcost[v];
      v = prev[v];
      if (v != s) {
        while (comp[v].size() > 0) {
          no[comp[v].back()] = s;
          comp[s].push_back(comp[v].back());
          comp[v].pop_back();
        }
      }
    } while (v != s);
    REP(i, V){
      if(i != r && no[i] == s)
        REP(j, V){
          if (no[j] != s && G[j][i] < INF) G[j][i] -= mcost[temp[i]];
        }
    }
  }
  mark[v] = true;
  REP(i, next[v].size())
    if(no[next[v][i]] != no[v] && prev[no[next[v][i]]] == v)
      if (!mark[no[next[v][i]]] || next[v][i] == s)
        visit(V, G, next[v][i], s, r, no, comp, prev, next, mcost, mark, cost, found);
}
int minimumSpanningArborescence(int V, int E, int G[MAX_V][MAX_V], int r) {
  vector<int> no(V);
  vector< vector<int> > comp(V);
  REP(i, V) comp[i].push_back(no[i] = i);
 
  for(int cost = 0; ;) {
    vector<int> prev(V, -1);
    vector<int> mcost(V, INF);
    REP(i, V){
      REP(j, V){
        if(j == r || G[i][j] == INF || no[i] == no[j] || G[i][j] > mcost[no[j]]) continue;
        mcost[no[j]] = G[i][j];
        prev[no[j]] = no[i];
      }
    }
    vector< vector<int> > next(V);
    REP(i, V)
      if(prev[i] >= 0)
        next[prev[i]].push_back(i);
    bool stop = true;
    vector<int> mark(V, false);
    REP(i, V)
      if(i != r && !mark[i] && !comp[i].empty()) {
        bool found = false;
        visit(V, G, i, i, r, no, comp, prev, next, mcost, mark, cost, found);
        if (found) stop = false;
      }
    if (stop) {
      REP(i, V) if (prev[i] >= 0) cost += mcost[i];
      return cost;
    }
  }
}
int main() {
  int V, E, r;
  cin >>V >>E >>r;
  int G[MAX_V][MAX_V];
  REP(i, V) REP(j, V) G[i][j] = (i == j ? 0 : INF);
  REP(i, E){
    int f, t, c; cin >>f >>t >>c;
    G[f][t] = c;
  }
  cout <<minimumSpanningArborescence(V, E, G, r) <<endl;
  return 0;
}

Measured memory_bytes: 3212
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Thu Jan 16 12:15:24 2020
//
package main

import "fmt"

type pos struct {
	h int
	w int
}

var h, w int
var graph []string

func bfs(dists [][]int, i, j int) {
	q := make([]pos, 0)

	dists[i][j] = 0
	q = append(q, pos{i, j})

	for len(q) > 0 {
		t := q[0]
		q = q[1:]
		for _, p := range []pos{pos{-1, 0}, pos{1, 0}, pos{0, -1}, pos{0, 1}} {
			x := t.h + p.h
			y := t.w + p.w
			if 0 <= x && x < h && 0 <= y && y < w && dists[x][y] == -1 && graph[x][y] == '.' {
				dists[x][y] = dists[t.h][t.w] + 1
				q = append(q, pos{x, y})
			}
		}
	}
}

func main() {
	fmt.Scan(&h, &w)

	graph = make([]string, h)
	for i := range graph {
		fmt.Scan(&graph[i])
	}

	max := 0
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			dists := make([][]int, h)
			for d := range dists {
				dists[d] = make([]int, w)
				for e := range dists[d] {
					dists[d][e] = -1
				}
			}

			if graph[i][j] == '.' {
				bfs(dists, i, j)
			}

			for _, dist := range dists {
				for _, d := range dist {
					if max < d {
						max = d
					}
				}
			}
		}
	}
	fmt.Println(max)
}


Measured memory_bytes: 5504
S = input()
if S == 'RRR':
    print(3)
if S == 'RRS' or S == 'SRR' :
    print(2)
if S == 'RSR' or S == 'RSS' or S == 'SRS' or S == 'SSR':
    print(1)
if S == 'SSS':
    print(0)

Measured memory_bytes: 9032
#![allow(unused)]

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;


//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
//入力マクロここまで

fn main() {
    input! {
        n: usize,
        a: [u64;n],
    }

    for e in a {
        if e % 2 == 0 && (e % 3 != 0 && e % 5 != 0) {
            println!("DENIED");
            return;
        }
    }

    println!("APPROVED");
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
int main() {
int N , D , X ;
cin >> N >> D >> X;
vector<int> A(N) ;
rep(i,N) cin >> A.at(i) ;
int ans = X ;
rep(i,N) ans +=  (D+(A.at(i) - 1 ))/A.at(i) ;
cout << ans << endl;
} 

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int K = scan.nextInt();
		Set<Integer> nums = new TreeSet<>();

		for (int i = 0; i < K; i++) {
			if (A + i > B) break;
			nums.add(A + i);
		}
		for (int i = K - 1; i >= 0; i--) {
			if (B - i < A) break;
			nums.add(B - i);
		}

		nums.forEach(System.out::println);
 	}
}

Measured memory_bytes: 26964
def read():
    return [int(e) for e in input().split(" ")]

N = int(input())
Data = [read() for _ in range(3)]
m = 0
b = -2

for e_A in Data[0]:
    m += Data[1][e_A - 1]
    if(e_A == b + 1):
        m += Data[2][b - 1]
    b = e_A

print(m)

Measured memory_bytes: 3060
require 'pp'

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end

def min(a,b)
  a, b = a.to_i, b.to_i
  return a < b ? a : b
end

def max(a,b)
  a, b = a.to_i, b.to_i
  return a > b ? a : b
end

N, W = gets_i_list
wv_list = []
N.times do
  wv_list.push gets_i_list
end

# 最大容量以下で、容量ごとの価値の最大値を格納する
dp = Array.new(W + 1, 0)

wv_list.each do |w, v|
  # 許容できる容量(最大容量 - w)
  # uptoを使うと、ループで更新した値を参照してしまうため、downtoを使う
  W.downto(w) do |i|
    if dp[i] < dp[i - w] + v
      dp[i] = dp[i - w] + v 
    end
  end
end
puts dp.max

Measured memory_bytes: 2812
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main()
{
    string A,B,C;
    cin >> A >> B >> C ;

    // while(!A.empty())
    // {
    //     cout << A.substr(0,1) << endl;
    //     string tmp = A.substr(0,1);
    //     // if(A.substr(0,1)=="a") cout << 1 << endl;
    //     if(tmp=="a") cout << 1 << endl;
    //     A.erase(0,1);
        
    // }
    string tmp = A.substr(0,1);
    A.erase(0,1);
    // for (int i=0; i<A.size()+B.size()+C.size(); ++i)
    while(1)
    {
        // cout << tmp << endl;
        // cout << A << endl;
        // cout << B << endl;
        // cout << C << endl;
        if(tmp[0] == 'a')
        {
            if(A.empty())
            {
                cout << "A" << endl;
                return 0;
            }
            tmp = A.substr(0,1);
            A.erase(0,1);
        }
        else if(tmp[0] == 'b')
        {
            if(B.empty())
            {
                cout << "B" << endl;
                return 0;
            }
            tmp = B.substr(0,1);
            B.erase(0,1);
        }
        else
        {
            if(C.empty())
            {
                cout << "C" << endl;
                return 0;
            }
            tmp = C.substr(0,1);
            C.erase(0,1);
        }
    }
    return 0;
}

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

using namespace std;

int main()
{
	string a, b, c;
	cin >> a >> b >> c;

	if (a[a.length() - 1] == b[0] && b[b.length() - 1] == c[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

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

using namespace std;

// Segment tree. Modification (Add) on interval, single element access.

template<typename T>
class SegTree{
    size_t n;
    vector<T> data;
public:
    SegTree(size_t _n): n(_n), data(2 * n, 0){}
    SegTree(const vector<T> &src): n(src.size()), data(2 * n, 0){init(src);}
    void init(const vector<T> &src){
        for (size_t i = 0; i != n; ++i) data[n + i] = src[i];
    }
    void add(size_t L, size_t R, T v){ // add v to interval [L, R)
        for (L += n, R += n; L < R; L >>= 1, R >>= 1){
            if (L & 1) data[L++] += v;
            if (R & 1) data[--R] += v;
        }
    }
    T query(size_t i){
        T ret = 0;
        for (i += n; i > 0; i >>= 1) ret += data[i];
        return ret;
    }
    void push(){
        for (size_t i = 1; i < n; ++i){
            data[i<<1] += data[i];
            data[i<<1|1] += data[i];
            data[i] = 0;
        }
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    SegTree<int> seg(n);
    while (q--){
        int c;
        cin >> c;
        if (c == 0){
            int s, t, x;
            cin >> s >> t >> x;
            seg.add(s - 1, t, x);
        }else{
            int i;
            cin >> i;
            cout << seg.query(i - 1) << '\n';
        }
    }
    return 0;
}

Measured memory_bytes: 3580
MOD = 10 ** 9 + 7

# [1,2,3,4,5,6]の時、累積和は、
# [0,1,3,6,10,15,21]
cumsum=[0]
def my_cumsum(alst):
  for i in range(len(alst)):
    cumsum.append(cumsum[i]+alst[i])
  return cumsum

n=int(input()) #3
alst=list(map(int,input().split()))

# 原因はnp.cumsum関数にある事が判明
# s=np.cumsum(alst)

s=my_cumsum(alst)

sum=0

for i in range(len(alst)-1):
  sum+=alst[i]*(s[len(s)-1]-s[i+1])

print(sum%MOD)

Measured memory_bytes: 31664
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long long ll;

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 solve(){	
  int n;cin>>n;
  map<string,int> ms;
  string ent;
  while(n--){
    cin>>ent;
    ms[ent]++;
  }
  cout<<ms.size()<<endl;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  //int t; cin >> t;
  //while(t--) solve();
  //
  solve();
  return 0;
}


Measured memory_bytes: 19180
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    ll m = n*(n-1)/2 - n/2;
    out(m);

    ll k = n;
    if(n%2 == 0) {
        k++;
    }

    exrep(i, 1, n-1) {
        exrep(j, i+1, n) {
            if(i+j == k) {
                continue;
            }
            cout << i << " " << j << "\n";
        }
    }
    
    re0;
}

Measured memory_bytes: 256
S, N = map(int, input().split())
A = list(map(int, input().split()))
O = [a for a in A if a % 2 == 1]
E = [a for a in A if a % 2 == 0]

if len(O) > 2:
    print("Impossible")
else:
    A = O[:min(len(O), 1)] + E + O[1:]
    B = A[:] + ([0] if N == 1 else [])
    B[0] -= 1
    B[-1] += 1
    if B[0] == 0:
        B = B[1:]
    print(*A, sep=" ")
    print(len(B))
    print(*B, sep=" ")


Measured memory_bytes: 3064
N = gets.chomp.split("").map(&:to_i)
$sum = 0

def dfs(digit, tight, num)
  if digit == N.length
    if num.include?(7) && num.include?(5) && num.include?(3)
      $sum += 1
    end
    return
  end

  if num.empty? && digit + 2 <= N.length
    dfs(digit + 1, false, num)
  end

  if tight == false || N[digit] >= 7
    if N[digit] >= 8
      tight = false
    end
    dfs(digit + 1, tight, num + [7])
  end

  if tight == false || N[digit] >= 5
    if N[digit] >= 6
      tight = false
    end
    dfs(digit + 1, tight, num + [5])
  end

  if tight == false || N[digit] >= 3
    if N[digit] >= 4
      tight = false
    end
    dfs(digit + 1, tight, num + [3])
  end

end

dfs(0, true, [])

puts $sum

Measured memory_bytes: 2044
'use strict'
 
function main(s) {
  let n = s.split('');
  let options = 0;
  n.forEach(c=>{
    if(c === 'o'){
    	options += 1;
    }
  });
  let ans = Number(700 + options*100);
  console.log(ans);
}
 
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
N = input()

if len(N) == 1:
    print(int(N))
    exit()

a = str(int(N) - int(N[-1]) - 1)
b = '9' * (len(N) - 1)

A = 0
B = 0
C = 0

for aa in a:
    A += int(aa)
for bb in b:
    B += int(bb)
if int(N[0]) > 1:
    B += int(N[0]) - 1
for n in N:
    C += int(n)


print(max(A, B, C))


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;



public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException{
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String input = br.readLine();
		
		int[][][] house = new int[4][3][10];
		
		for(int i=0;i<4;i++){
			for(int j=0;j<3;j++){
				for(int k=0;k<10;k++){
					house[i][j][k]=0;
				}
			}
		}
		
		int n = Integer.parseInt(input);
		
		for(int i=0;i<n;i++){
			String[] date = br.readLine().split(" ");
			
			int mune = Integer.parseInt(date[0])-1;
			int kai = Integer.parseInt(date[1])-1;
			int heya = Integer.parseInt(date[2])-1;
			int hito = Integer.parseInt(date[3]);
			
			house[mune][kai][heya] += hito;
			
		}
		
		for(int i=0;i<4;i++){
			if(i != 0){
				System.out.println("####################");
			}
			for(int j=0;j<3;j++){
				
				for(int k=0;k<10;k++){
					System.out.print(" ");
					System.out.print(house[i][j][k]);
					
				}
				System.out.println();
			}
		}
		
		
		
	}
}

Measured memory_bytes: 24624
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int main(){
    int R,G,B,N;
    cin >> R >> G >> B >> N;
    int ans=0;
    for(int i=0; i<=N/R; i++){
        for(int j=0; j<=(N-i*R)/G; j++){
            if((N-i*R-j*G)%B==0){
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long A = GetLong();
		long B = GetLong();
		for(long C = 1; C <= 3; C++)
		{
			if((A * B * C) % 2 == 1)
			{
				WriteLine("Yes");
				return;
			}
		}
		WriteLine("No");
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 27476
N, M = map(int, input().split(' '))
drinks = sorted(tuple(tuple(map(int, input().split(' '))) for _ in range(N)))

cost = 0
for price, n in drinks:
    n = min(n, M)
    cost += n * price
    M -= n
    if M == 0:
        break

print(cost)


Measured memory_bytes: 17764
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef int_fast64_t ll;
typedef int_fast32_t intt;
typedef int_fast32_t tmp_m;
#define deb(x) cout << #x << ' ' << x << endl
#define rep(i, a, b) for (tmp_m i = a; i < b; ++i)
#define repp(i, a, b) for (tmp_m i = a; i >= b; --i)
#define pb push_back
#define st stack
#define pa pair
#define vc vector
#define qu queue
#define pq priority_queue
#define fr first
#define sc second
#define mp map
const intt mod = 1e9 + 7;

struct pr {
  intt x;
  intt y;
  intt dst;
  pr() {}
  pr(intt x, intt y, intt dst) : x(x), y(y), dst(dst) {}
  inline bool operator<(const pr& b) const {
    if (dst != b.dst) return dst > b.dst;
    if (x != b.x) return x > b.x;
    return y > b.y;
  }
};

struct point {
  intt x;
  intt y;
  point() {}
  point(intt x, intt y) : x(x), y(y) {}
  inline bool operator<(const point& b) const {
    if (x != b.x) return x > b.x;
    return y > b.y;
  }
};

inline bool spoint(point a, point b) {
  if (a.x != b.x) return a.x < b.x;
  return a.y < b.y;
}

inline bool spr(pr a, pr b) {
  if (a.dst != b.dst) return a.dst < b.dst;
  if (a.x != b.x) return a.x < b.x;
  return a.y < b.y;
}



void solve() {
  double r;
  cin >> r;
  printf("%.12lf\n", (double)2 * r * M_PI);
  // cout << 2 * r * M_PI << endl;
}

void init() {
  // remove if interactive
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(0));
  // memset(dp, -1, sizeof dp);
}

int main() {
  init();
  solve();
  return 0;
}


Measured memory_bytes: 3804
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
using namespace std;

int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    for (int i = 0; i < k; i++) {
        if (a >= b && a >= c) a *= 2;
        else if (b >= a && b >= c) b *= 2;
        else c *= 2;
    }
    cout << a + b + c << endl;
}
    






Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  int ans=0;
  for(int i=0;i<n;i++){
    ans++;
    while(i+1<n&&a[i]==a[i+1]) i++;
    if(i==n-1) break;
    if(a[i]<a[i+1]){
      while(i+1<n&&a[i]<=a[i+1]) i++;
    }else{
      while(i+1<n&&a[i]>=a[i+1]) i++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <limits>
using ll          = long long;
constexpr int INF = std::numeric_limits<int>::max() / 2;
constexpr ll LNF  = std::numeric_limits<ll>::max() / 2;

#ifndef DEBUG_HPP_OB5Y82L9
#define DEBUG_HPP_OB5Y82L9

#ifndef STREAM_HPP_L5EPV267
#define STREAM_HPP_L5EPV267
#include <iostream>

namespace pcl {
struct empty_stream_buf : public std::streambuf {
    char dummybuf[8];

  protected:
    virtual int overflow(int c) {
        setp(dummybuf, dummybuf + sizeof(dummybuf));
        return c == traits_type::eof() ? '\0' : c;
    }
};

struct empty_stream : private empty_stream_buf, public std::ostream {
  public:
    empty_stream()
        : std::ostream(this) {}
    empty_stream_buf const *rdbuf() const { return this; }
};
} // namespace pcl

#endif /* end of include guard: STREAM_HPP_L5EPV267 */

#include <iostream>

#ifndef PA_DEBUG
namespace pcl {
pcl::empty_stream _debg;
#define cerr pcl::_debg
} // namespace pcl
#endif

#endif /* end of include guard: DEBUG_HPP_OB5Y82L9 */


#include <bits/stdc++.h>
using namespace std;

template <typename T>
void print(vector<T> const &x, string s = "") {
    cerr << s;
    copy(x.begin(), x.end(), ostream_iterator<ll>(cerr, ", "));
    cerr << endl;
}

ll compute(vector<ll> v, int K, int Q, vector<int> &seps) {
    int N = v.size();
    sort(seps.begin(), seps.end());
    seps.push_back(N);
    print(seps, "seps: ");
    for (int i = 1; i < (int)seps.size(); i++) {
        sort(v.begin() + seps[i - 1] + 1, v.begin() + seps[i]);
    }
    print(v, "sorted v: ");

    vector<ll> ans;
    ans.reserve(N);
    for (int i = 1; i < (int)seps.size(); i++) {
        ans.insert(ans.end(), v.begin() + seps[i - 1] + 1,
                   v.begin() + seps[i - 1] + 1 +
                       max(0, seps[i] - seps[i - 1] - 1 - K + 1));
    }
    print(ans, "ans: ");
    auto a = *min_element(ans.begin(), ans.end());
    nth_element(ans.begin(), ans.begin() + Q - 1, ans.end());
    sort(ans.begin(), ans.end());
    seps.pop_back();
    return Q <= (int)ans.size() ? ans[Q - 1] - a : LNF;
}

int main() {
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<ll> orig(N);
    for (int i = 0; i < N; i++) { cin >> orig[i]; }

    vector<pair<ll, int>> cp(N);
    for (int i = 0; i < N; i++) {
        cp[i].first  = orig[i];
        cp[i].second = i;
    }
    sort(cp.begin(), cp.end());

    vector<int> seps = {-1};
    ll mi            = compute(orig, K, Q, seps);
    for (auto const &p : cp) {
        seps.push_back(p.second);
        ll res = compute(orig, K, Q, seps);
        if (res == LNF) break; // ??????
        mi = min(mi, res);
    }
    cout << mi << endl;
    return 0;
}


Measured memory_bytes: 384
//52行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

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

////////////////////////////////////////////////////////////////////////////
/*
 * Modint構造体
 * */
const int mod = 1e9+7;
struct mint {
  long long x; // typedef long long ll;
  mint(long long x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) { if((x+=a.x)>=mod)x-=mod;return *this;}
  mint& operator-=(const mint a) { if((x+=mod-a.x)>=mod)x-=mod; return *this;}
  mint& operator*=(const mint a) { (x *=a.x)%=mod; return *this;}
  mint operator+(const mint a) const { mint res(*this);return res+=a;}
  mint operator-(const mint a) const { mint res(*this);return res-=a;}
  mint operator*(const mint a) const { mint res(*this);return res*=a;}
  mint pow(ll t) const {
    if (!t) return 1;mint a = pow(t>>1);a*=a;
    if (t&1) a *= *this;return a;
  }
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return (*this) *= a.inv();}
  friend ostream& operator<<(ostream& os, const mint& m){os<<m.x;return os;}
};
namespace ModintUtil{
    mint mod_pow(long long p,long long q){mint res = p;return res.pow(q);}
    mint frac(long long p,long long q){ mint P = (mint)p; P /= (mint)q; return P; } // p/q
    mint frac(mint p,mint q){ p /= q; return p; }
    vector<mint> make_facl(long long N){ 
        vector<mint> ret(N+1);
        for(int i = 0;i <= N;i++){ if(i == 0)ret[i] = (mint)1; else ret[i] = ret[i-1] * (mint)i; }
        return ret;
    }
}
using namespace ModintUtil;
/////////////////////////////////////////////////////////////////////////////

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

    mint ans = 0;
    for(ll i = k;i <= n + 1;i++){
        mint mx = (n + (n - i + 1)) * i / 2;
        mint mn = (0 + i - 1) * i / 2;
        //cerr << mx << ' ' << mn << '\n';
        ans += (mx - mn + 1);
    }
    cout << ans << '\n';

}


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

int main() {
  vector<int> n(3);
  cin >> n[0] >> n[1] >> n[2];
  sort(n.begin(), n.end());
  int cnt = 0;
  while (n[0] != n[1] || n[1] != n[2]) {
    ++cnt;
    if (n[2] - n[0] > 1)
      n[0] += 2;
    else
      n[0] += 1, n[1] += 1;
    sort(n.begin(), n.end());
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

template<typename T,T MOD = 1000000007>
struct Mint{
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(int k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }
  
  Mint inv(){return pow(MOD-2);}
  
  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}
  
  Mint operator+(Mint a) const{return Mint(v)+=a;};
  Mint operator-(Mint a) const{return Mint(v)-=a;};
  Mint operator*(Mint a) const{return Mint(v)*=a;};
  Mint operator/(Mint a) const{return Mint(v)/=a;};

  Mint operator-(){return v?MOD-v:v;}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  
};
//INSERT ABOVE HERE
signed main(){
  int n,m;
  cin>>n>>m;
  
  using M = Mint<int>;
  vector<M> dp(n+2,0),sm(n+2,0);
  dp[0]=M(1);

  for(int i=1;i<=n+1;i++){
    sm[i]=sm[i-1]+dp[i-1];
    dp[i]=sm[i]-sm[i-m<0?0:i-m];
  }
  
  M ans=M(2).pow(n)-dp[n+1];
  cout<<ans.v<<endl;
  return 0;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h> 
#include <functional> 
using namespace std;
typedef pair<int,int> pii;
#define fast   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define ld              long double
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define in              insert
#define ff              first
#define ss              second
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define sz(c)           (ll)c.size()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define rev             reverse
#define Y               "YES"
#define N               "NO"
#define endl            "\n"
#define debug(x)        cout << #x << " : " << x << endl;
const ll inf = 1e18;  
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;

inline ll add(ll a,ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a,ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a,ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x,ll n){
    if(n == 0){
        return 1;
    }
    if(n&1){
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    } else {
        return pwr(mul(x, x), n / 2);
    }
}
ll modInv(ll n){ 
    return pwr(n, mod - 2); 
}
ll gcd(ll a,ll b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

/**

 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
void solve(){
    
}
int main(){
    int x;
    cin>>x;
    if(x==1) cout<<0<<endl;
    else cout<<1<<endl;

    return 0;
}

Measured memory_bytes: 3632
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    // a, k, i, h, b, r
    int[] a = new int[6];
    int[] b = new int[6];
    for(int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if(c == 'A') { 
        a[0] += 1;
        b[0] = i;
      }
      if(c == 'K') { 
        a[1] += 1;
        b[1] = i;
      }
      if(c == 'I') { 
        a[2] += 1;
        b[2] = i;
      }
      if(c == 'H') { 
        a[3] += 1;
        b[3] = i;
      }
      if(c == 'B') { 
        a[4] += 1;
        b[4] = i;
      }
      if(c == 'R') { 
        a[5] += 1;
        b[5] = i;
      }
    }
    String ans = "NO";
    int sum = 0;
    for(int i = 0; i < 6; i++) {
      sum += a[i];
    }
    if(sum == s.length()) {
      if((a[0] < 5) && (a[1] == 1) && (a[2] == 1) && (a[3] == 1) && (a[4] == 1) && (a[5] == 1) && ((b[1] < b[2]) && (b[2] < b[3]) && (b[3] < b[4]) && (b[4] < b[5]))) {
        
        if((b[1] <= 1) && (b[2] == b[1] + 1) && (b[3] == b[2] + 1) && (b[4] <= b[3] + 2) && (b[5] <= b[4] + 2) && (b[5] >= s.length() - 2)) ans = "YES";
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b,c;
    cin >> a >> b >> c;
    if(a == b) cout << c << endl;
    if(a == c) cout << b << endl;
    if(b == c) cout << a << endl;
}


Measured memory_bytes: 256