akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1)*a%MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1)*a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b,a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size()>n) return kaijo_memo[n];
  if(kaijo_memo.size()==0) kaijo_memo.push_back(1);
  while(kaijo_memo.size()<=n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1]*kaijo_memo.size()%MOD);
  return kaijo_memo[n];
}

int check(int x){
	if(x==4||x==6||x==9||x==11) return 1;
	if(x==2) return 2;
	return 0;
}


signed main(){
	int x,y; cin>>x>>y;
	if(check(x)==check(y)) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
def main():
    N, M = list(map(int, input().split()))
    H = list(map(int, input().split()))
    G = [True] * N
    for _ in range(M):
        a, b = map(int, input().split())
        if H[a - 1] <= H[b - 1]:
            G[a - 1] = False
        if H[b - 1] <= H[a - 1]:
            G[b - 1] = False
    return G.count(True)

print(main())


Measured memory_bytes: 20112
#include <stdio.h>

int main() {
	int n,t_max,c,t, c_min=10000;
	scanf("%d %d",&n,&t_max);
	for(int i=n-1;i>=0;i--) {
		scanf("%d %d",&c,&t);
		if (t<=t_max && c<=c_min) c_min=c;
	}
	if(c_min!=10000)printf("%d\n",c_min);
	else printf("TLE\n");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll i,j,k,l,m,n,w,x,y,z,p,q,tmp=0,sum=0;
    string str;
    cin>>n;
    for(i=1;i<=n;i++){
    if(i%2==0) continue;

        for(j=1;j<=n;j++){
            if(i%j==0) tmp++;
        }
        if(tmp==8) sum++;
        tmp=0;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
	"strconv"
)

var a, b string

func main() {
	fmt.Scanf("%s %s", &a, &b)

	ab, _ := strconv.Atoi(a + b)
	c := int(math.Sqrt(float64(ab)))

	if c*c == ab {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

using namespace std;
using ll = long long int;
constexpr ll M = 1e9 + 7;
inline ll sum_1(const ll n) { return ((n * (n + 1)) / 2) % M; }
inline ll sum_2(const ll n) { return ((n * (n + 1) * (2 * n + 1)) / 6) % M; }
inline ll sum_3(const ll n) { return (((n * (n + 1)) / 2) % M * ((n * (n + 1)) / 2) % M) % M; }
inline ll sum_1(const ll i, const ll j) { return (sum_1(j) - sum_1(i - 1) + M) % M; }
inline ll sum_2(const ll i, const ll j) { return (sum_2(j) - sum_2(i - 1) + M) % M; }
inline ll sum_3(const ll i, const ll j) { return (sum_3(j) - sum_3(i - 1) + M) % M; }

struct MyHash {
    size_t operator()(const pair<int,int> &x) const {
        return x.first + x.second;
    }
};

void solve() {
    int n, x, y;
    cin >> n >> x >> y;
    vector<int> ans(2*n+5,0);

    for (int i = 1; i <= n; ++i) {
        for (int j = i+1; j <= n; ++j) {
            int temp = min({
                abs(i-j),
                abs(x-i) + 1 + abs(j-y),
                abs(x-j) + 1 + abs(i-y),
            });
            ans[temp]++;
        }
    }

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

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef D_LOCAL
        freopen("in.in", "r", stdin);
        freopen("out.out", "w", stdout);
    #endif

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <map>
#include <string.h>

using namespace std;

int main(){
  
  int n; cin>>n; int taro=0,hanako=0;
   
  for(int i=0; i<n; i++){
    string s,t; cin>>s>>t;
    if(s>t) taro+=3;
    else if(s<t) hanako+=3;
    else {
      taro++; hanako++;
      }
    }

   cout<<taro<<' '<<hanako<<endl;

}

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

int main(void) {
    int N;
    cin >> N;
    vector<string> S;

    for (int i = 0; i < N; i++) {
        string tmp;
        cin >> tmp;
        S.push_back(tmp);
    }
    sort(S.begin(), S.end());
    S.erase(unique(S.begin(), S.end()), S.end());
    printf("%d\n", S.size());
    return 0;
}

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<int, pii> para;
const int inf = 1e9 + 7;
const int maxN = 1e6 + 5;

int n, a, b, parent[maxN], ranka[maxN];
vector<pii> wek1, wek2;
vector<para> edges;


int find(int x) {
	if (parent[x] == 0)
		return x;
	parent[x] = find(parent[x]);
	return parent[x];
}

void unionX(int x, int y) {
	int xroot = find(x);
	int yroot = find(y);
	if (ranka[xroot] > ranka[yroot]) {
		parent[yroot] = xroot;
	} else {
		parent[xroot] = yroot;
		if (ranka[xroot] == ranka[yroot])
			ranka[yroot]++;
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin>>n;
	REP(i, n) {
		cin>>a>>b;
		wek1.pb(pii(a, i + 1));
		wek2.pb(pii(b, i + 1));
		parent[i + 1] = 0;
		ranka[i + 1] = 0;
	}
	sort(wek1.begin(), wek1.end());
	sort(wek2.begin(), wek2.end());

	RI(i, n - 1) {
		int cost = wek1[i].st - wek1[i - 1].st;
		edges.pb(para(cost, pii(wek1[i].nd, wek1[i - 1].nd)));
		cost = wek2[i].st - wek2[i - 1].st;
		edges.pb(para(cost, pii(wek2[i].nd, wek2[i - 1].nd)));
	}
	sort(edges.begin(), edges.end());
	ll total = 0;
	for (auto p : edges) {
		a = p.nd.st;
		b = p.nd.nd;
		if (find(a) != find(b)) {
			total += p.st;
			unionX(a, b);
		}
	}
	cout<<total;
	return 0;
}


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

#include <iostream>


#define MOD 1000000007

typedef unsigned long long ull;
typedef long long ll;

using namespace std;
auto f=[]()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
};


const int maxn=100005;
struct DS
{

	void MakeSet(int v)
	{
		p[v]=v;
		s[v]=1;
	}
	
	int Find(int v)
	{
		if(p[v]==v)return v;
		return p[v]=Find(p[v]);
	}
	
	void Union(int v1, int v2)
	{
		int x=Find(v1);
		int y=Find(v2);
		
		if(x==y)return;
	
		if(s[x]<s[y])swap(x,y);
		
		p[y]=x;
		s[x]+=s[y];
	}

	int Size(int v)
	{
		return s[Find(v)];
	}

private:
	int p[maxn];
	int s[maxn];
};

vector<int> block[maxn];
int cnt[maxn];
int main()
{
	f();
	int n,m,k;cin>>n>>m>>k;
	DS d;
	for(auto i=0;i<n;++i)
	{
		d.MakeSet(i+1);	
	}
	
	for(auto i=0;i<m;++i)
	{
		int a,b;cin>>a>>b;
		d.Union(a,b);
		cnt[a]++;
		cnt[b]++;
	}

	for(auto i=0;i<k;++i)
	{
		int a,b;cin>>a>>b;
		block[a].push_back(b);
		block[b].push_back(a);	
	}
	
	for(auto i=0;i<maxn;++i)
	{
		sort(block[i].begin(),block[i].end());
	}	
	
	int ans[n+1]={};
	
	for(auto i=0;i<n;++i)
	{
		ans[i+1]=d.Size(i+1)-1-cnt[i+1];
		for(auto j:block[i+1])
		{
			if(d.Find(j)==d.Find(i+1))--ans[i+1];	
		}
	}


	for(auto i=0;i<n;++i)
		cout<<ans[i+1]<<" ";

	cout<<"\n";

	return 0;
}


Measured memory_bytes: 7552
N,S=map(int,input().split())
A=[0]+list(map(int,input().split()))

H=[[0]*(S+1) for i in range(N+1)]

#H[x][y]:1,...xに制限したときに,和がyになるのは何個?
M=998244353

for x in range(N+1):
    H[x][0]=1

for x in range(1,N+1):
    for s in range(S+1):
        if s>=A[x]:
            H[x][s]=(2*H[x-1][s]+H[x-1][s-A[x]])%M
        else:
            H[x][s]=(2*H[x-1][s])%M

print(H[-1][-1])


Measured memory_bytes: 132648
x1, y1, x2, y2 = (int(i) for i in input().split())
x3 = y1 -y2 +x2
y3 = x2 -x1 +y2
x4 = y1 -y2 +x1
y4 = x2 -x1 +y1
print(x3,y3,x4,y4)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

ll a, b, c, d;

ll gcd(ll x, ll y) {
    if (y == 0) return x;
    return gcd(y, x%y);
}

int main() {
    cin >> a >> b >> c >> d;
    ll lcm = c * d / gcd(c, d);
    ll atob = b - a + 1;
    ll nc = b / c - (a-1) / c;
    ll nd = b / d - (a-1) / d;
    ll nlcm = b / lcm - (a-1) / lcm;
    ll ans = atob - (nc + nd) + nlcm;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
long long a[N],b[N],x,y;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x>>y;
		a[i]=x-y;
		b[i]=x+y;
	}
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	cout<<max(a[n]-a[1],b[n]-b[1]);
}

Measured memory_bytes: 6768
def main():
    mincost = float('inf')
    N, T = map(int, input().split())
    for i in range(N):
        c, t =map(int, input().split())
        if t <= T:
            if c < mincost:
                mincost = c
        else:
            pass
    print(mincost) if mincost < float('inf') else print("TLE")

main()


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main(){
    int N,K;
    cin >> N >> K;
    int h[100000],count[100000];
    rep(i,N){
        cin >> h[i];
    }
    count[0]=0;
    count[1]=abs(h[1]-h[0]);
    for(int i=2;i<N;i++){
        count[i]=count[i-1]+abs(h[i]-h[i-1]);
        for(int j=2;j<=K && i-j>=0;j++){
            if(count[i]>count[i-j]+abs(h[i]-h[i-j])){
                count[i]=count[i-j]+abs(h[i]-h[i-j]);
            }
        }
    }
    cout << count[N-1] << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;

const int MAX = 510000;
const ll mod = 1e9+7;

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

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

ll COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

int main(){
  ll n, k;
  cin >> n >> k;
  COMinit();
  cout << COM(n-1,k-1) << endl;
  return 0;
}



Measured memory_bytes: 15040
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

const mod = 998244353
const facNum = 300001

func main() {
	sc := newScanner(os.Stdin)
	N := sc.i()
	a := make([]int, N)
	for i := 0; i < N-1; i++ {
		r := sc.i()
		a[r-1] += 1
	}
	for i := range a {
		fmt.Println(a[i])
	}
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}

//const factorial = new
func Pow(a, n int) int {
	ans := 1
	for n > 0 {
		if (n & 1) == 1 {
			ans = ans * a % mod
		}
		a = a * a % mod
		n = n >> 1
	}
	return ans
}

func Gcd(a, b int) int {
	if a < b {
		return Gcd(b, a)
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func combination(n, k int, fac, ifac []int) int {
	if n < k || n < 0 {
		return 0
	}
	if k == 0 {
		return 1
	}
	//while n != 0
	ans := ifac[k] * ifac[n-k] % mod
	return ans * fac[n] % mod
}

// 階乗: factorial
// コンビネーションを計算する際に前もって計算しておく
// fac[k] => k! (mod M)
// ifac[k] => k!^(M-2) (mod M)
// n: ex. 2 * 10^5 => 200001
// fac, ifac := factorial()
func factorial() (fac []int, ifac []int) {
	fac = make([]int, facNum)
	fac[0] = 1
	ifac = make([]int, facNum)
	ifac[0] = 1
	for i := 1; i < facNum; i++ {
		fac[i] = fac[i-1] * i % mod
		ifac[i] = ifac[i-1] * Pow(i, mod-2) % mod
	}
	return
}

// vs: sorted slice int value
func lowerBound(vs []int, v int) (index int) {
	n := len(vs) / 2
	m := len(vs)
	for m != n {
		if vs[n] < v {
			n = (m-n+1)/2 + n
			//m = m
		} else {
			m = n
			n = n / 2
		}
	}
	return n
}

func IntSlice(n, init int) []int {
	r := make([]int, n)
	for i := range r {
		r[i] = init
	}
	return r
}


Measured memory_bytes: 6188
n,m=map(int,input().split())
a=[0]*(m+1)
mod=1000000007
for i in range(m):
    a[i]=int(input())
s=[1,1]
j=0
for i in range(2,n+1):
    if i-1==a[j]:
        s[i-1]=0
        j+=1
    s.append(s[i-1]+s[i-2])

print(s[n]%mod)




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

using namespace std ;
typedef long long ll;
typedef string str;
typedef vector<int> vint;
typedef vector<double> vdou ;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<str> vstr;
typedef pair<int, int> pii;
typedef vector<pii> vpii ;

#define REP(i, n) for (ll (i) = 0; (i) < (ll)(n); i++) 
#define FOR(i, a, b) for(ll (i) = a; (i) < (ll)b; i++)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (ll)x.size()
#define SP(x)  setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, m ;
  cin >> n >> m ;
  str s, t ;
  cin >> s >> t ;
  ll l = lcm(n,m) ;
  ll k = gcd(n,m) ;
  ll x = l/k ;
  n /= k ;
  m /= k ;
  bool f = true ;
  REP(i,k){
    if(s[i*n]!=t[i*m]){
      f = false ;
    }
  }
  if(f){
    cout << l <<endl; 
  }
  else{
    cout << -1 <<endl ;
  }
  return 0 ;
}

Measured memory_bytes: 640
#include<iostream>
#include<stack>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;
int main()
{
  stack<int> s;
  int a,b,x;
  string n;

  while(cin>>n)
  {
    if(n[0]=='+')
    {
      a=s.top(); s.pop();
      b=s.top(); s.pop();
      s.push(a+b);
    }
    else if(n[0]=='-')
    {
      a=s.top(); s.pop();
      b=s.top(); s.pop();
      s.push(b-a);
    }
    else if(n[0]=='*')
    {
      a=s.top(); s.pop();
      b=s.top(); s.pop();
      s.push(a*b);
    }
    else
    {
      s.push(atoi(n.c_str()));
    }
  }

  cout<<s.top()<<endl;
  return 0;
}



Measured memory_bytes: 3212
#include<bits/stdc++.h>
            using namespace std;
             
            #define int long long
            #define ll long long
            #define pb emplace_back
            #define mp make_pair
            #define f(i,a,n) for(int i=a ; i<n ; i++)
            #define F first
            #define S second
            #define E "\n"
            #define fast ios:: sync_with_stdio(false),cin.tie(0);
            
           int32_t main()
              {
                    int n,k,ans=0;
                    cin >> n >> k;
                    f(i,0,n)
                    {
                          int temp;
                          cin >> temp;
                          if(temp>=k) ans++;
                    }
                    cout<<ans;
            }

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


int main(void){
    // Your code here!
    int n,x,t;
    int ans=0;
    
    scanf("%d %d %d",&n,&x,&t);
    
    while( 1 ){
        
        if( n<=0 ) break;
        n-=x;
        ans+=t;//t++;
        
    }
    
    printf("%d\n",ans);
    
}


Measured memory_bytes: 3812
#include<iostream>
int main(void)
{
    using namespace std;
    int K ,A, B;
    cin >> K >> A >> B;

    unsigned long long biscuit=1;

    if(A >= B-1){
        biscuit += K;
        cout << biscuit <<endl;
        return 0;
    }
    while(K!=0){
        if(biscuit < A)biscuit++;
        else if(K > 1){
            biscuit += (B-A);
            K--;
        }
        else biscuit++;

        K--;
    }

    cout << biscuit << endl;

    return 0;
}

Measured memory_bytes: 256
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>
#include <random>

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

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

/*
 * f(U) = \sum_{U\in T}f(T)
 * for f(U) = \sum_{T\in U}f(T), use f[j | i] += f[j];
 */
template <typename T>
void fast_zeta(vector<T> &f){
  int n = f.size();
  for(int i = 1; i < n; i<<=1){
    for(int j = 0; j < n; j++){
      if((j & i) == 0){
        f[j | i] += f[j];
      }
    }
  }
}

struct pa{
  ll f, s;
  pa(ll f, ll s): f(f), s(s){}
  pa(){}
  pa & operator+=(const pa &r){
    ll tmp = f;
    f = max(f, r.f);
    s = max(tmp + r.f - f, max(s, r.s));
    return *this;
  }
};
int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pa> vec(1 << n);
  rep(i, (1 << n)){
    ll a;
    cin >> a;
    vec[i] = pa(a, 0);
  }
  fast_zeta(vec);
  ll curr = 0;
  for(int i = 1; i < (1 << n); i++){
    curr = max(curr, vec[i].f + vec[i].s);
    cout << curr << endl;
  }
	return 0;
}


Measured memory_bytes: 7168
N=int(input())
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))

ANS=0
for i in range(N):
    if sum(A1[:i+1])+sum(A2[i:])>ANS:
        ANS=sum(A1[:i+1])+sum(A2[i:])

print(ANS)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N, K;
    cin >> N >> K;
    // aをbで割ったあまりがK以上
    // bを固定するとaの数は(N/b) * (b-k)
    long long cnt = 0;
    for(int b = 1; b <= N; b++) {
        if(K < b) {
            cnt += (N / b) * (b - K);
            cnt += max(N - (N / b) * b - K + 1, 0);
        }
        if(K == 0) {
            cnt--;
        }
    }
    cout << cnt << endl;
}

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    string sr = s;
    reverse(sr.begin(), sr.end());
    if(sr == s)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


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

using namespace std;

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

	int n; cin >> n;
	int ans = INT_MAX;

	for (int i = 1;i < n;i++){
		int a = i,b = n-i;
		int sum = 0;
		while(a){
			sum += a%10;
			a /= 10;
		}
		while(b){
			sum += b%10;
			b /= 10;
		}
		ans = min(ans,sum);
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
fun main(args : Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    val B = readLine()!!.split(" ").map { it.toInt() }.toIntArray()


    var total = 0L

    (0 until N).forEach {
        var diff = 0
        if (A[it] > 0 && B[it] > 0) {
            if (A[it] - B[it] < 0) {
                diff = A[it]
            } else {
                diff = B[it]
            }

            A[it] -= diff
            B[it] -= diff
            total += diff
        }
        if (A[it+1] > 0 && B[it] > 0) {
            if (A[it+1] - B[it] < 0) {
                diff = A[it+1]
            } else {
                diff = B[it]
            }

            A[it+1] -= diff
            B[it] -= diff
            total += diff
        }
    }
    println(total)
}

Measured memory_bytes: 83300
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define mp make_pair
#define inf 1000000007
using namespace std;
set<long long> pl[214514];
set<ll> fp[214514];
ll dp[214514][62];
long long n;
ll gbis_special(ll cur, ll lim){
	if( cur + dp[ (cur%n) ][0] > lim) return cur;
	ll cnt = 0;
	while( cur + dp[ (cur%n) ][cnt+1] <= lim){
		cnt++;
	}
	cur += dp[ (cur%n) ][cnt];
	return gbis_special(cur,lim);
}
signed main(){
	ll k;
	cin>>n>>k;
	vector<long long> a;
	for(long long i=0;i<n;i++){
		long long x;
		cin>>x;
		a.pb(x);
		pl[x].insert(i);
	}
	for(long long i=0;i<n;i++){
		long long cur = a[i];
		set<long long>::iterator it = pl[cur].upper_bound(i);
		if( it == pl[cur].end() ){
			it = pl[cur].upper_bound(-1);
			dp[i][0] = *it + n - i + 1;
		}
		else{
			dp[i][0] = *it - i + 1;
		}
	}
	for(long long j=1;j<=58;j++){
		for(long long i=0;i<n;i++){
			if((i+dp[i][j-1])<0)goto end;
			dp[i][j] = dp[i][j-1] + dp[ (ll)(i+dp[i][j-1])%n ][j-1];
		}
	}
	end:n=n+0;
	ll stt = gbis_special(0,n*k-1);
	vector<ll> final;
	for(ll i=stt;i<=n*k-1;i++){
		final.pb(a[(ll)i%n]);
		fp[a[(ll)i%n]].insert(i);
	}
	ll idx = stt;
	vector<ll> ans;
	while(idx <= n*k-1){
		ll cur = final[idx-stt];
		set<ll>::iterator it = fp[cur].upper_bound(idx);
		if( it == fp[cur].end() ){
			ans.pb(cur);
			idx++;
		}
		else{
			idx = *it;
			idx++;
		}
	}
	for(long long i=0;i<ans.size();i++){
		cout<<ans[i]<<" ";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 145136
constexpr auto Inf = 0X3F3F3F3F;
#ifndef LOCAL
	#include <bits/stdc++.h>
#endif
typedef long long LL;
using namespace std;

namespace IO {
	inline LL read() {
		LL o = 0, f = 1; char c = getchar();
		while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); }
		while (c > '/' && c < ':') { o = o * 10 + c - '0'; c = getchar(); }
		return o * f;
	}
	inline char recd() {
		char o; while ((o = getchar()) != 'a' && o != 'd' &&  o != 's'); return o;
	}
}
using namespace IO;

const int SIZE = 1E5 + 7, Mod = 1E9 + 7;

LL w[SIZE] = { LLONG_MAX }; vector<int> vec[SIZE]; vector<LL> o;
int use[SIZE], m[SIZE], To;

int DFS(int now) {
	use[now] = 1; int p = now;
	for (int pos = 0, v; pos < vec[now].size(); pos++) {
		v = vec[now][pos];
		if (use[v]) continue;
		int u = DFS(v);
		if (w[p] > w[u]) p = u;
	} return p;
}

int main() {
	int N = read(), M = read();
	for (int pos = 1; pos <= N; pos++) w[pos] = read();
	for (int pos = 1, u, v; pos <= M; pos++)
		u = read() + 1, v = read() + 1,
		vec[u].push_back(v),
		vec[v].push_back(u);
	LL ans = 0;
	for (int pos = 1, u; pos <= N; pos++)
		if (!use[pos])
			u = DFS(pos), To += 1, ans += w[u], m[u] = 1;

	for (int pos = 1; pos <= N; pos++)
		if (!m[pos]) o.push_back(w[pos]);
	if (To == 1) puts("0"), exit(EXIT_SUCCESS);
	if (o.size() < To - 2) puts("Impossible"), exit(EXIT_SUCCESS);
	sort(o.begin(), o.end());

	for (int pos = 0; pos < To - 2; pos++)
		ans += o[pos];
	printf("%lld\n", ans);
}

Measured memory_bytes: 8312
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> P;

void printVec(std::vector<int> &vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  vector <int> data;
  int ans = 0;

  for (int i = 1; i <= n; ++i) {
    // cout << "i = " << i << endl;
    int div = i;
    data.clear();
    while (div != 0) {
      data.push_back(div % 10);
      div = div / 10;
    }
    int sum = 0;
    for(int j = 0; j < data.size(); ++j) {
      sum = sum + data[j];
    }
    // cout << "i = " << i << ", sum = " << sum << endl;
    // printVec(data);
    if (a <= sum && sum <= b) {
      ans = ans + i;
    }
  }
  cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

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

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

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

// n 個の玉を区別する
// k 個の箱を区別しない
// 入れ方は 1 個以上
// スターリング数
// S(n, k) = S(n - 1, k - 1) + k * S(n - 1, k)
// Σ(-1)^(k - i) * kCi * i^n / (k!) より O(klogn) に減らせる
vector<vector<ll>> S(1010, vector<ll>(1010, 0));
void stir_init(){
    S[0][0] = 1;
    for(int n=1; n<1010; n++){
        for(int k=1; k<1010; k++){
            S[n][k] = S[n - 1][k - 1] + k * S[n - 1][k];
            S[n][k] %= MOD;
        }
    }
}

// n 個の玉を区別する
// k 個の箱を区別しない
// 入れ方は制限なし
// ベル数
// B(n, k) = S(n, 0) + S(n, 1) + ... + S(n, k)
int bell(int n, int k){
    ll B = 0;
    for(int i=0; i<=k; i++){
        B += S[n][i];
        B %= MOD;
    }

    return B;
}

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

    int n, k; cin>>n>>k;

    stir_init();

    cout << bell(n, k) << endl;

    return 0;
}


Measured memory_bytes: 11236
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


#define BUF_SIZE 20
int main(void) {
  char line[BUF_SIZE];
  FILE *fp = stdin;
  int a, b;
  if(!fgets(line, BUF_SIZE, fp)) return 0;
  sscanf(line, "%d %d", &a, &b);

  int res = a-b*2;
  res = res < 0 ? 0 : res;
  printf("%d\n", res);

  return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
price, count = list(map(int, input().split()))
hate_numbers = list(map(int, input().split()))

def is_ok(hates, price):
  for h in hates:
    if str(h) in list(str(price)):
      return False
  return True

for p in range(1, 100000):
  if is_ok(hate_numbers, p) is False:
    continue
  if p >= price:
    print(p)
    exit(0)
  

Measured memory_bytes: 2940
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout<<fixed<<setprecision(n)
#define NOW         chrono::system_clock::now()
#define ELP(s,e)    chrono::duration_cast<chrono::milliseconds>(e-s).count()
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	string s = in<string>();
	ll ans = 10000;
	REP(i, s.length() - 2) {
		ll foo = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
		ans = min(ans, abs(753 - foo));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>//復習必須
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
const int mod=1e9+7;
int main (){ 
    ll h1 , m1 , h2 , m2 , k ;
    cin >> h1 >> m1 >> h2 >> m2 >> k ;

    ll time ;
    time = h2 * 60 + m2 - h1 * 60 - m1 ;
    cout << time - k << endl;
    return 0 ;
}

 


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
#define loop(n) for(ll i = 0; i<n; i++)
#define sort(a) sort(a.begin(), a.end())
using namespace std;

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

    ll n, k; cin>>n>>k;
    vector<int> h(n);
    loop(n) cin>>h[i];
    vector<ll> dp(n+1, 1e12);
    dp[0] = 0;
    loop(n){
        for(ll j = 1; j<=k && i+j<n; j++){
            dp[i+j] = min(dp[i+j], dp[i]+abs(h[i+j]-h[i]));
        }
    }
    cout<<dp[n-1]<<"\n";
    return 0;
}

Measured memory_bytes: 1408
a = Array.new(3).map{Array.new(3)}
for i in 0..2
  a[i] = gets.split.map(&:to_i)
end
n = gets.to_i
b = Array.new(n)
for i in 0..(n-1)
  b[i] = gets.to_i
end
bg = Array.new(3).map{Array.new(3,0)}
for i in 0..(n-1)
  for x in 0..2
    for y in 0..2
      bg[x][y] = 1 if a[x][y] == b[i]
    end
  end
end

ln = Array.new(3,0)
cl = Array.new(3,0)
cr = Array.new(2,0)
for i in 0..2
  for j in 0..2
    ln[i] += bg[i][j]
    cl[i] += bg[j][i]
    cr[0] += bg[i][j] if i == j
    cr[1] += bg[i][j] if i + j == 2
  end
end

flag = 0
for i in 0..2
  if ln[i] == 3 || cl[i] == 3 || (i < 2 && cr[i] == 3)
    flag = 1
    break
  end
end
(flag == 1) ? (puts "Yes"):(puts "No")

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;

int main() {
    int N, i;
    cin >> N >> i;
    cout << N - i + 1 << endl;
}


Measured memory_bytes: 256
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";var n=1000000007;function i(){for(var t=arguments,e=t[0],r=t.length;--r;)e=((e>>16)*t[r]%n*65536+(65535&e)*t[r])%n;return e}var o=[],s=[],u=[];function c(t){o.length=t+1,o[0]=o[1]=1;for(var e=2;e<=t;)o[e]=i(o[e-1],e++);for(s.length=t+1,s[0]=s[1]=1,s[t]=function(t){for(var e,r=n,i=0,o=1;t;o=e)i-=(e=r/t|0)*o,e=r-=e*t,r=t,t=e,e=i,i=o;return(i%=n)<0?i+n:i}(o[t]),e=t;2<e;)s[e-1]=i(s[e],e--);for(u.length=t+1,u[0]=u[1]=1,e=2;e<=t;)u[e]=i(o[e-1],s[e++])}function f(t,e){return i(o[t],s[e],s[t-e])}t.exports=function(t){var e=t.in(),r=t.in();c(e);for(var o=1;o<=r;o++){var s=i(f(e-r+1,o),f(r-1,o-1));console.log(s%n)}}}]);


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

#ifdef LOCAL

template<class T, class U>
ostream& operator<<(ostream& os, pair<T, U> p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}

template<template<class, class...> class C, class... A>
typename enable_if<!is_same<C<A...>, string>::value, ostream&>::type
operator<<(ostream& os, class C<A...> c) {
	auto i = c.begin();
	while (i != c.end()) {
		os << " {"[i == c.begin()] << *i;
		os << ",}"[++i == c.end()];
	}
	return os;
}

#define debug(x) cerr << #x << " = " << x << endl;
#else
#define debug(...) {}
#endif

const int N = 1e6;
long long infLL = 1e18;
int inf = 1e9;

int main() {
	ios_base::sync_with_stdio(false);
	bitset<2000010> dp;
	dp[0] = 1;
	int n;
	cin >> n;
	long long sum = 0;
	for (int i = 0; i < n; i ++) {
		int a;
		cin >> a;
		sum += a;
		dp = dp | (dp << a);
	}
// 	debug(sum);
// 	debug(dp);
	for (int i = sum / 2; i >= 0; i --) {
		if (dp[i]) {
			cout << sum - i << "\n";
			return 0;
		}
	}
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll k,a,b; cin >> k >> a >> b;
    rep(i,1010){
        if(a<=k*i && k*i <= b){
            out("OK");
            return 0;
        }
    }
    out("NG");
}


Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(int i=1;i<n;i++)
#define all(V) V.begin(),V.end()
#define ll long long
#define ld long double
#define MOD 1000000007
#define mod 998244353
#define sec setprecision
#define Pair pair<ll,ll>
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
constexpr double eps = 1e-9;
constexpr double pi = 3.141592653589793238462643383279;
using namespace std;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll x, ll n) {
	x %= mod;
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return (pow((x * x)%mod , n / 2)%mod);
	else
		return (x * pow(x, n - 1))%mod;
}
int main() {
	int a; cin >> a;
	cout << a * a * a + a * a + a << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


// import here

int main(){
    LL n, r;
    cin >> n >> r;
    LL ans = r + 100 * max<LL>(0, 10-n);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int numS = Integer.parseInt(sc.next());
        int numT = Integer.parseInt(sc.next());
        String U = sc.next();
        if(U.equals(S)){
            numS--;
        }else{
            numT--;
        }
        System.out.println(numS + " " + numT);
        }
}


Measured memory_bytes: 21460
N, K = map(int,input().split())
p = list(map(int,input().split()))
 
exp = [(x+1)/2 for x in p]
 
sums = 0
ls =[0]

for n in range(N):
  sums += exp[n]
  ls.append(sums)

ans = 0
for n in range(N-K+1):

  ans_candidate = ls[n+K]-ls[n]

  if ans < ans_candidate:
    ans = ans_candidate 
print(ans)
  

Measured memory_bytes: 33568
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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


int N,mini,ans=0,temp;

int main(){
    cin>>N;
    int A[N];
    rep(i,N)cin>>A[i];
    rep(i,N){
        mini=i;
        repi(j,i+1,N){
            if(A[j]<A[mini])mini=j;
        }
        if(i!=mini){
            temp=A[i];
            A[i]=A[mini];
            A[mini]=temp;
            ans++;
        }
    }
    rep(i,N){
        if(i)cout<<" ";
        cout<<A[i];
    }
    cout<<endl;
    out(ans);
}



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

const int MAX=400005;
const int MOD=998244353;

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

void f() {
    fac[0]=1;
    fac[1]=1;
    finv[0]=1;
    finv[1]=1;
    inv[1]=1;
    for (int 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;
    }
}
 
long long C(long long n, long long k){
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

long long MP(long long a, long long n) {
    long long X=1;
    while (n>0) {
        if (n&1) X=X*a%MOD;
        a = a*a%MOD;
        n >>= 1;
    }
    return X%MOD;
}

int main(void) {
    long long N, M, K, X, x, i;
    scanf("%lld%lld%lld", &N, &M, &K);
    f();
    X=0;
    for (i=0; i<=K; i++) {
        x=C(N-1, i);
        x%=MOD;
        x*=M;
        x%=MOD;
        x*=MP(M-1, N-i-1);
        x%=MOD;
        X+=x;
        if (X>=MOD) X%=MOD;
        // printf("%lld %lld\n", i, X);
    }
    printf("%lld", X);
    return 0;
}


Measured memory_bytes: 13200
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>
#include <fstream>
#include <ctime>

using namespace std;
using ll = long long;

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) { return toupper(c); }
};

struct ToLower {
    char operator()(char c) { return tolower(c); }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string S;
    cin >> S;

    std::unordered_map<string, int> M =
    {
        {"SUN",7 },
        { "MON",6 },
        { "TUE",5 },
        { "WED",4 },
        { "THU",3 },
        { "FRI",2 },
        { "SAT",1 },
    };
    cout << M[S] << endl;
    return 0;
}

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

#define st              first
#define nd              second
#define pb              push_back
#define lwb             lower_bound
#define upb             upper_bound
#define Size(a)         int((a).size())
#define reset(s, n)     memset(s, n, sizeof(s))
#define bit(n, i)       (((n) >> (i)) & 1)
#define cntbit(n)       __builtin_popcountll(n)
#define all(a)          (a).begin(), (a).end()
#define unique(a)       (a).resize(unique(all(a)) - (a).begin())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))

typedef long double ld;
typedef long long ll;

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-7;
inline ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline int inv(int a, ll p = MOD) {return fpow(a, p - 2, p);}
inline ll lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
inline void onbit(ll &a, int i){a |= 1LL << i;}
inline void offbit(ll &a, int i){onbit(a, i), a -= (1LL << i);}

const int N = 3e5 + 5;

ll n, m, k;
ll a[N];

void solve(){
  int r = 0;
  string s;
  cin >> s;
  int res = 0;
  for(char c: s){
    if(c == 'R') r++;
    else{
      res = max(res, r);
      r = 0;
    }
  }
  cout<< max(res, r);
}

main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0); 
  cout.tie(0);
  cout << fixed << setprecision(10);
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  int query = 1;
  // cin >> query;
  int start = 1000 * clock() / CLOCKS_PER_SEC;
  while(query--) solve();
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC  - start << "ms\n";
}


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

int main()
{
  int64_t N;
  cin >> N;
  bool f;
  vector<int64_t> Open(N);
  vector<vector<int64_t>> Profit(N, vector<int64_t>(11));
  for (int i = 0; i < N; i++)
  {
    int64_t fbit = 0b0000000000;
    for (int j = 0; j < 10; j++)
    {
      cin >> f;
      if (f)
        fbit |= (1 << j);
    }
    Open.at(i) = fbit;
  }
  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j <= 10; j++)
    {
      cin >> Profit.at(i).at(j);
    }
  }
  int64_t bit = 0b0000000001, maxProfit = -10000000000;
  ;
  while (bit <= 0b1111111111)
  {
    int64_t profit = 0;
    for (int i = 0; i < N; i++)
    {
      int64_t fbit = Open.at(i);
      int64_t cnt = __builtin_popcount(bit & fbit);
      profit += Profit.at(i).at(cnt);
    }
    maxProfit = max(profit, maxProfit);
    bit++;
  }
  cout << maxProfit << endl;
}

Measured memory_bytes: 256