akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
using ll = long long;
using pll = pair<ll,ll>;
const ll INF64 = 1LL << 60;
const int INF = (1 << 29);

const int m = 2019;

int main(){
    string s; cin >> s;
    reverse(s.begin(), s.end());
    int n = s.size();
    vector<ll> t(200020, 0);
    ll x = 1;
    //mod2019の累積和をとる
    rep(i,n){
        t[i+1] = (t[i]+(ll)(s[i]-'0')*x) % m;
        (x*=10)%=m;
    }
    map<ll, ll> mp;

    //mod2019の累積和の配列の同じ値をカウント
    rep(i,n+1) mp[t[i]]++;
    ll ans = 0;

    //値が同じ物の個数の組み合わせをansに加算
    for(auto p: mp){
        ll x = p.second;
        ans += x*(x-1)/2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 5084
#include<bits/stdc++.h>
using namespace std;
const int N=3e4+9;
bitset<N>dp[89][89];
int n,m,a[89][89],b[89][89];
int main(){
  cin>>n>>m;
  for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)cin>>a[i][j]; 
  for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)cin>>b[i][j];
  dp[1][1][a[1][1]-b[1][1]+80]=1;
  for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++){
      if(i==1&&j==1)continue;
      for(int k=0;k<N;k++){
        int x=a[i][j]-b[i][j]+80;
        if(k>=x)dp[i][j][k]=dp[i-1][j][k-x]|dp[i][j-1][k-x];
        x=b[i][j]-a[i][j]+80;
        if(k>=x&&!dp[i][j][k])dp[i][j][k]=dp[i-1][j][k-x]|dp[i][j-1][k-x];
     }
  }
  int base=(n+m-1)*80;
  int ans=N;
  for(int i=0;i<N;i++)if(dp[n][m][i])ans=min(ans,abs(i-base));
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 26368
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 10000000000000000
#define int long long

int dp[200010][3];
int A[200010];
int N;
int calc(int x, int remain_skip) {
    //cout << x << " " << remain_skip << endl;
    if(dp[x][remain_skip] != -INF2) return dp[x][remain_skip];
    if(x >= N) {
        if(remain_skip == 2) return -INF2;
        return 0;
    }
    int ret = -INF2;
    if(remain_skip > 0) ret = calc(x + 1, remain_skip - 1);
    ret = max(ret, calc(x + 2, remain_skip) + A[x]);
    return dp[x][remain_skip] = ret;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    rep(i, N) cin >> A[i];
    rep(i, 200010) rep(j, 3) dp[i][j] = -INF2;
    cout << calc(0, 1 + (N % 2 == 1)) << endl;

    return 0;
}
// 1 2 3 4

Measured memory_bytes: 14580
s = input()
n = len(s)
s1 = s[0:(n-1)//2]
s2 = s[(n+1)//2:n]

def check(s):
    sr = s[::-1]
    if s == sr:
        return True
    else:
        return False
    
if check(s) and check(s1) and check(s2):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
left = []
right = gets.chomp.split("")
count = 0
(right.size + 1).times {
	if !right.empty? && right[0] == ?0
		left << right.shift
		next
	end
	l = left.join.to_i
	r = right.join.to_i
	if (l + r).odd?
		left << right.shift
		next
	end
	x = (l + r) / 2
	count += 1 if r >= x

	left << right.shift
}
p count

Measured memory_bytes: 6112
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
///////////////////////////

#define N 100005
vector<ll>v[N];
ll dis[N];
ll dfs(ll id ,ll par){
    for(auto x:v[id]){
        if(x==par)continue;
        Max(dis[id],dfs(x,id)+1);
    }
    return dis[id];
}
ll dis2[N];
void dfs2(ll id,ll d_par,ll par){
    for(auto x:v[id]){
        if(x==par)Max(dis2[id],d_par);
        else Max(dis2[id],dis[x]+1);
    }
    vector<l_l>come;
    for(auto x:v[id]){
        if(x==par){
            come.pb({d_par,-1});
        }else{
            come.pb({dis[x]+1,x});
        }
    }
    come.pb({0,-1});
    sort(come.rbegin(),come.rend());
    for(auto x:v[id]){
        if(x==par)continue;
        if(come[0].se==x){
            dfs2(x,come[1].fi+1,id);
        }else{
            dfs2(x,come[0].fi+1,id);
        }
    }
}
int main(){fastio
    ll n;cin>>n;
    rep(i,1,n-1){
        ll a,b;cin>>a>>b;
        v[a].pb(b);v[b].pb(a);
    }
    dfs(1,-1);
    //rep(i,1,n)cout<<dis[i]<<" ";cout<<endl;
    dfs2(1,0,-1);
    rep(i,1,n)cout<<2*(n-1)-dis2[i]<<endl;
    return 0;
}



Measured memory_bytes: 33604
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int h,w;
vs a;

int main(){
	cin>>h>>w;
	a=vs(h);
	int n=h*w;
	vvi g(n,vi(n,inf));
	for(int i=0;i<h;i++) cin>>a[i];
	for(int i=0;i<h;i++) for(int j=0;j<w;j++) if(a[i][j]=='.'){
		for(int k=0;k<4;k++){
			int x=i+dx[k],y=j+dy[k];
			if(x>=0&&x<h&&y>=0&&y<w&&a[x][y]=='.'){
				g[i*w+j][x*w+y]=1;
			}
		}
		g[i*w+j][i*w+j]=0;
	}
	for(int k=0;k<n;k++) for(int i=0;i<n;i++) for(int j=0;j<n;j++) g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
	int res=0;
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(g[i][j]<inf) res=max(res,g[i][j]);
	cout<<res<<endl;
}

Measured memory_bytes: 896
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            var NL = Sarray();
            var N = NL[0];
            var L = NL[1];
            var Ai = Sarray();
            var knot = -1;
            for (var i = 0; i < N - 1; ++i)
                if (L <= Ai[i] + Ai[i + 1]) knot = i;
            if (knot < 0)
            {
                WriteLine("Impossible");
                return;
            }
            WriteLine("Possible");
            for (var i = 0; i < knot; ++i)
                WriteLine(i + 1);
            for (var i = N - 2; knot <= i; --i)
                WriteLine(i + 1);
        }
    }
}

Measured memory_bytes: 32092
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int ans[100005];
char S[100005];

int main(void) {
    scanf("%s", S);

    int i = 0; 
    while (i < strlen(S)) {
    	if (S[i] == 'R') {
    		int s = i;
    		while (S[i] == 'R') i++;
    		int n = (i-s);
    		ans[i-1] += n/2;
    		ans[i] += n/2;
    		if (n % 2 == 1) {
    			 ans[i-1]++;
    		}
    	} else {
    		// R L L L X
    		//   s     i
    		int s = i;
    		while (S[i] == 'L' && i < strlen(S)) i++;
    		int n = (i-s);
    		ans[s-1] += n/2;
    		ans[s] += n/2;
    		if (n % 2 == 1) {
    			 ans[s]++;
    		}
    	}
    }
    REP(i, 0, strlen(S)) {
    	if (i > 0) printf(" ");
    	printf("%d", ans[i]);
    }
    printf("\n");
    

	return 0;
}


Measured memory_bytes: 896
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
)

func main() {
	L := float64(getInt())
	fmt.Println(L/3.0 * L/3.0 * L/3.)
}

type Graph struct {
	n     int
	edges [][]int
}

func NewGraph(n int) *Graph {
	g := &Graph{
		n:     n,
		edges: make([][]int, n),
	}
	return g
}

func (g *Graph) AddEdge(u, v int) {
	g.edges[v] = append(g.edges[v], u)
	g.edges[u] = append(g.edges[u], v)
}

func dfs(c int, edges [][]int, visited map[int]struct{}) {
	visited[c] = struct{}{}

	for _, v := range edges[c] {
		_, flag := visited[v]
		if flag {
			continue
		}
		dfs(v, edges, visited)
	}
}

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func powMod(n, p int) int {
	if p == 0 {
		return 1
	} else if p%2 == 0 {
		t := powMod(n, p/2)
		return calcMod(t * t)
	} else {
		return n * powMod(n, p-1)
	}
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray)-1])
}

func calcMod(x int) int {
	return x % mod
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}


Measured memory_bytes: 640
D, G = map(int, input().split())

question_list = []

for i in range(D):
    p, c = map(int, input().split())
    question_list.append([p, c])

ans = 10 ** 5

for i in range(2 ** D):
    bit = format(i, "0" + str(D) + "b") # 完全に解く問題にビットを立てる

    total = 0
    num_q = 0
    for j in range(D):
        if bit[j] == "1":
            total += question_list[j][0] * 100 * (j + 1) + question_list[j][1]
            num_q += question_list[j][0]
    
    res = max(0, G - total)

    if res > 0:
        ind = bit.rfind("0") ##完全に解かないものの数
        res_q = res // (100 * (ind + 1)) + (1 if (res % (100 * (ind + 1)) != 0) else 0)
        if res_q > question_list[ind][0]:
            continue
        num_q += res_q
    
    ans = min(ans, num_q)

print(ans)



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

using namespace std;

typedef pair<string, int> P;

bool cp(const P &p1, const P &p2) {
	return p1.second > p2.second;
}

int main() {
	int n; bool f = false;
	while (cin >> n, n) {
		if (f) cout << endl;

		vector<P> v;
		for (int i = 0; i < n; ++i) {
			string str; cin >> str;
			int w, l, d; cin >> w >> l >> d;
			int p = w * 3 + d;

			v.push_back( P(str, p) );
		}
		sort( v.begin(), v.end(), cp );

		for (int i = 0; i < v.size(); ++i)
			cout << v[i].first << "," << v[i].second << endl;

		f = true;
	}
}

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


//wierd debugging stuff
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << "\n" ; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
//end of weird debugging stuff
using ll = long long;
using vi = vector<int>;
using ii = pair<int,int>;
using vii = vector<ii>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define invec(v) for(auto& x : v)cin>>x;
#define Time()	cerr <<'\n' << clock() * 1000 / CLOCKS_PER_SEC << "ms\n"
#define SZ(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define fo(i,k,n) for(ll (i)=(k);(i)<(n);(i)++) 
#define ar array
// no change 

const ll MOD = 1e9+7;   // it is an prime...

template<typename T,typename L>
T power(T a, L b);				// to find reverse modulo its power(a,MOD-2);
template < typename T ,typename L> 
L coefficient(T n, T k);  // computing nCk

//const int MxN = 1e9+5;



void solve(){
	int n;
	cin >> n;
	map<int,int> mp;
	ll sum = 0;
	for(int i = 0;i< n;i++){
		int x ;
		cin >> x;
		mp[x]++;
		sum+=x;
		
	}
	int q;
	cin >> q;
	while(q--){
		int b,c;
		cin >> b >>c;
		int d = c-b;
		
		d *= mp[b] ;
		
		sum +=d;
		cout << sum<<endl;
		mp[c] +=mp[b];
		mp.erase(b);
	}
	
		







}
int main() {	
	FASTER;
	int T = 1;
	//cin >> T;	jk	//cmt if one test case
	while(T--)solve();
}


template<typename T,typename L>
T power(T a, L b){
	
	T result = 1;
	while(b){
		if(b&1) result = (result% MOD * a%MOD) % MOD;
	   	a = (a%MOD * a%MOD) % MOD;
   		b/=2;	   
	}
	return result;
}

template < typename T ,typename L> 
L coefficient(T n, T k){  // computing nCk
	k = min(k,(n-k));
	L res = 1;
	for(T i = 0; i< k;i++){
		res *= (n-i);
		res /= (i+1);

	}
	return res;
}


Measured memory_bytes: 6620
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
using namespace std;

long long int s[500001]={0}; 
void my_binary_heap(int i,int H){
	int l=2*i;
	int r=2*i+1;
	int max;
	if(l<=H&&s[l]>s[i])
		max=l;
	else
		max=i;
	if(r<=H&&s[r]>s[max])
		max=r;
	if(max!=i){
		swap(s[i],s[max]);
	my_binary_heap(max,H);
	}
	
}
int main(){
	
	int H;
	cin>>H;
	
	
	for(int i=1;i<=H;i++){
		cin>>s[i];
	}
	
	for(int i=H/2;i>=1;i--){
		my_binary_heap(i,H);
	}
	
	for(int i=1;i<=H;i++)
		cout<<" "<<s[i];
	cout<<endl;
}

Measured memory_bytes: 5068
#include <cassert>
#include <cstdio>
#include <vector>
#include <set>

#include <map>
#include <unordered_map>
#include <deque>
#include <string>
#include <utility>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <climits>

using namespace std;

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; }

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
	int H, A;
	cin >> H >> A;

	int n = H / A;
	if (H % A != 0) {
        n++;
    }
    cout << n << endl;

    return 0;
}


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

using namespace std;

int main(void){

    string str;
    int ans1 = 0, ans2 = 0;

    cin >> str;

    for(int i = 0;str[i] != '\0';i++){
        if(str[i]-'0' == (i+1)%2) ans1++;
        if(str[i]-'0' == i%2) ans2++;
    }

    cout << (ans1 < ans2 ? ans1 : ans2) << endl;

    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;
const double pi = 3.1415926535;

int main(){
  ll A , B , H , M; cin >> A >> B >> H >> M;
  double zi = 0.0 ,  byo = 0.0;

  byo = 2 * pi * M / 60 * 1.0;
  zi = (2 * pi * H / 12 * 1.0) + byo / 12 * 1.0;

  double ans = A * A + B * B - 2 * A * B * cos(byo - zi);
  ans = sqrt(ans);
  cout << fixed << setprecision(15) <<  ans << endl;
}


Measured memory_bytes: 4156
import os
import sys

import numpy as np
from scipy.misc import comb

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
# MOD = 10 ** 9 + 7
MOD = 998244353


def get_factorials(max, mod=None):
    """
    階乗 0!, 1!, 2!, ..., max!
    :param int max:
    :param int mod:
    :return:
    """
    ret = [1]
    n = 1
    if mod:
        for i in range(1, max + 1):
            n *= i
            n %= mod
            ret.append(n)
    else:
        for i in range(1, max + 1):
            n *= i
            ret.append(n)
    return ret


def mod_invs(max, mod):
    """
    逆元のリスト 0 から max まで
    :param int max:
    :param int mod:
    """
    invs = [1] * (max + 1)
    for x in range(2, max + 1):
        invs[x] = (-(mod // x) * invs[mod % x]) % mod
    return invs


def factorial_invs(max, mod):
    """
    階乗 0!, 1!, 2!, ..., max! の逆元
    :param int max:
    :param int mod:
    """
    ret = []
    r = 1
    for inv in mod_invs(max, mod):
        r = r * inv % mod
        ret.append(r)
    return ret


class Combination:
    def __init__(self, max, mod):
        """
        :param int max:
        :param int mod: 3 以上の素数であること
        """
        self._factorials = get_factorials(max, mod)
        self._finvs = factorial_invs(max, mod)
        self._mod = mod

    def ncr(self, n, r):
        """
        :param int n:
        :param int r:
        :rtype: int
        """
        if n < r:
            return 0
        return self._factorials[n] * self._finvs[r] % self._mod * self._finvs[n - r] % self._mod


S = list(map(int, list(sys.stdin.readline().rstrip())))
N = len(S)

# dp[i][c]: i まで決めた、使えるけど使ってない青が j 個余ってるパターン数
dp = np.zeros((N + 1, N + 10), dtype=int)
dp[0][0] = 1

for i in range(N):
    if S[i] == 2:
        # 青を使う
        dp[i + 1][1:] += dp[i][:-1]
        # 赤を使う
        dp[i + 1][2:i + 2] += dp[i][:i]
    if S[i] == 1:
        # 青を使う
        dp[i + 1] += dp[i]
        # 赤を使う
        dp[i + 1][1:] += dp[i][:-1]
    if S[i] == 0:
        # 青を使う
        dp[i + 1][:-1] += dp[i][1:]
        # 赤を使う
        dp[i + 1] += dp[i]
    dp[i + 1] %= MOD

comb = Combination(max=N, mod=MOD)
ans = 0
for c, cnt in enumerate(dp[-1]):
    # N から c 個選ぶ
    ans += comb.ncr(N, c) * cnt
    ans %= MOD
    # print(N, c, cnt)

print(ans)


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

int main() {
  string S;
  cin >> S;
  int N = S.size();
  int n = N / 2;
  int i = 1;
  bool b = false;
  while (b == false) {
    for (int j = 0; j < n - i; j++) {
      if (S.at(j) != S.at(n - i + j)){
        i++;
        break;
      }
      if ( j == n - i - 1) {
        cout << N - 2*i << endl;
        b = true;
        break;
      }
    }
  }
}
      

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
 
//priority_queue<long long, vector<long long>, greater<long long>> pq;

const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long

const int inf = 1e9;
 
int n, m;
char s[105][105];
int dp[105][105];

int main() {
  //auto start_clock = clock();
#ifdef LOCAL
  freopen("in", "r", stdin);
#endif
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", s[i]);
  }
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < m; j++) {
      dp[i][j] = inf;
    }
  }
  if(s[0][0] == '.') dp[0][0] = 0;
  else dp[0][0] = 1;

  for(int i = 0; i < n; i++) {
    for(int j = 0; j < m; j++) {
      if(i > 0) {
        if(s[i - 1][j] == s[i][j] || s[i][j] == '.') dp[i][j] = min(dp[i][j], dp[i - 1][j]);
        else dp[i][j] = min(dp[i][j], dp[i - 1][j] + 1);
      }
      if(j > 0) {
        if(s[i][j - 1] == s[i][j] || s[i][j] == '.') dp[i][j] = min(dp[i][j], dp[i][j- 1]);
        else dp[i][j] = min(dp[i][j], dp[i][j - 1] + 1);
      }
    }
  }
  printf("%d\n", dp[n - 1][m - 1]);

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
typedef long long ll;
using namespace std;
inline int read(){
	int n=0,f=1;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if (c=='-') c=getchar(),f=-1;
	for(;c>='0'&&c<='9';c=getchar()) n=n*10+c-48;
	return n*f;
}
const int maxn=2e5+5;
int n,m,i,j,ans;
struct ar{
	int l,r;
}a[maxn];
bool cmp(ar a,ar b){
	return (a.l==b.l)?a.r<b.r:a.l<b.l;
}
priority_queue<int>p;
bool bz[maxn];
int q[maxn],cnt;
int main(){
	n=read(),m=read();
	fo(i,1,n) a[i].l=read(),a[i].r=read();
	sort(a+1,a+1+n,cmp);
	j=1,ans=n;
	fo(i,1,n){
		if (j<=a[i].l&&j<=m) bz[j++]=1,ans--,p.push(-a[i].r);
		else{
			if (!p.empty()){
				int t=-p.top();
				if (t<a[i].r) p.pop(),p.push(-a[i].r),q[++cnt]=t;else
				q[++cnt]=a[i].r;
			}else q[++cnt]=a[i].r;
		}
	}
	sort(q+1,q+1+cnt);
	fd(i,m,1) if (bz[i]) break;else{
		for(;cnt&&i<q[cnt];cnt--);
		if (cnt) cnt--,ans--;else break;
	}
	printf("%d\n",ans); 
}

Measured memory_bytes: 3320
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 100005
 
#define PI   3.14159265358979323846264338327950

#define PB push_back 
#define F first
#define S second
 
#define ll 	 long long int

#define mod  1000000007




int main()
{
	FAST;
	ll a, b, x;
	cin >> a >> b >> x;
	if(a <= x && x - a <= b){
		cout << "YES";
	}
	else{
		cout << "NO";
	}
	return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;

class Main {
	public static void main(String[] args){

		Scanner cin = new Scanner(System.in);
		int a;
		int b;
		int g;
		
		while (cin.hasNext()){
			a = cin.nextInt();
			b = cin.nextInt();
			g = GCD(a, b);
			System.out.println(g + " " + a * (b / g));
		}
	}
	
	private static int GCD (int a, int b){
		if (a % b != 0){
			return (GCD(b, a % b));
		}
		else {
			return (b);
		}
	}
}

Measured memory_bytes: 26208
#include<bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pi M_PI
#define inf 1<<30
#define eps (1e-11)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
 
class Point{
public:
  double x,y;
  Point(double x=0,double y=0):x(x),y(y){}
 
  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ return (x!=p.x ? x<p.x : y<p.y);}
  bool operator==(Point p)const{ return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}
 
  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;
 
class Segment{
public:
  Point p1,p2;
  Segment(Point p1=Point(),Point p2=Point()):p1(p1),p2(p2){}
};
typedef Segment Line;
 
 
double norm(Vector a){ return (a.x*a.x+a.y*a.y);}
double abs(Vector a){ return sqrt(norm(a));}
double dot(Vector a,Vector b){ return (a.x*b.x+a.y*b.y);}
double cross(Vector a,Vector b){ return (a.x*b.y-a.y*b.x);}
 
static const int COUNTER_CLOCKWISE=1;
static const int CLOCKWISE=-1;
static const int ONLINE_BACK=2;
static const int ONLINE_FRONT=-2;
static const int ON_SEGMENT=0;
 
int ccw(Point p0,Point p1,Point p2){
  Vector a=p1-p0;
  Vector b=p2-p0;
  if(cross(a,b)>eps)return COUNTER_CLOCKWISE;
  if(cross(a,b)<-eps)return CLOCKWISE;
  if(dot(a,b)<-eps)return ONLINE_BACK;
  if(a.norm()<b.norm())return ONLINE_FRONT;
  return ON_SEGMENT;
}
 
Point getCrossPointLL(Line a,Line b){
  double A=cross(a.p2-a.p1,b.p2-b.p1);
  double B=cross(a.p2-a.p1,a.p2-b.p1);
  if(abs(A)<eps && abs(B)<eps)return b.p1;
  return b.p1+(b.p2-b.p1)*(B/A);
}
 
Polygon convex_cut(Polygon p,Line l){
  Polygon ans;
  for(int i=0;i<p.size();i++){
    Point A=p[i],B=p[(i+1)%p.size()];
    if(ccw(l.p1,l.p2,A)!=-1)ans.push_back(A);
    if(ccw(l.p1,l.p2,A)*ccw(l.p1,l.p2,B)<0)
      ans.push_back(getCrossPointLL(l,Segment(A,B)));
  }
  return ans;
}
 
double getPolygonArea(Polygon p){
  double area=0.0;
  int n=p.size();
  for(int i=0;i<n;i++)area+=cross(p[i%n],p[(i+1)%n]);
  return area/2;
}
 
Point rotationPoint(Point base,Point a,double r){
  Point b=a-base;
  a.x=b.x*cos((r/180)*M_PI)-b.y*sin((r/180)*M_PI);
  a.y=b.x*sin((r/180)*M_PI)+b.y*cos((r/180)*M_PI);
  a=a+base;
  return a;
}
 
Line Parallelmove(Line L,double dis){
  Vector v1,v2;
  v1=(rotationPoint(L.p1,L.p2,90)-L.p1);
  v2=(rotationPoint(L.p2,L.p1,270)-L.p2);
  v1=(v1/abs(v1))*dis;
  v2=(v2/abs(v2))*dis;
  return Line(L.p1+v1,L.p2+v2);
}
 
int n;
Polygon p;
 
bool ok(double mid){
  Polygon cp=p;
  for(int i=0;i<n;i++){
    Line L(p[i],p[(i+1)%n]);
    L=Parallelmove(L,mid);
    cp=convex_cut(cp,L);
  }
  if(cp.size()>=3)return true;
  return false;
}
int main()
{
  int x,y;
 
  while(1){
    cin>>n;
    if(n==0)break;
    p.clear();
    for(int i=0;i<n;i++){
      cin>>x>>y;
      p.push_back(Point(x,y));
    }
 
    double r=1<<30,l=0,mid;
    for(int i=0;i<100;i++){
      mid=(r+l)/2;
      if(ok(mid))l=mid;
      else r=mid;
    }
    printf("%.10f\n",mid);
  }
 
  return 0;
}


Measured memory_bytes: 3548
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let H: usize = sc.get();
    let W: usize = sc.get();
    let mut c: Vec<Vec<usize>> = sc.mat(10, 10);
    let A: Vec<Vec<i64>> = sc.mat(H, W);
    for k in 0..10 {
        for i in 0..10 {
            for j in 0..10 {
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }
    let mut cnt = vec![0; 10];
    for i in 0..H {
        for j in 0..W {
            if A[i][j] != -1 {
                cnt[A[i][j] as usize] += 1;
            }
        }
    }
    let mut ans = 0;
    for i in 0..10 {
        ans += c[i][1] * cnt[i];
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> a(m);
    in_arr(int, a, m);
    int i, j;
    for(i = 0; i < m; i++){
        if(a[i] > x)
            break;
    }
    cout << min(m - i, i) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define ll long long int
#define ld long double
#define el '\n'
#define PI (ld)3.14159265358979323846
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < int(n); i++)
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

/*vector<int> parent, rak;

int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}

void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (rak[a] < rak[b])
            swap(a, b);
        parent[b] = a;
        rank[a]+=rank[b];
    }
}*/

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}
ll extend_gcd(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1,y1;
    ll ans =extend_gcd(b,a%b,x1,y1);
    x=y1;
    y=x1-(a/b)*y1;

    return ans;
}
ll inverse(ll a,ll m){
    ll x,y;
    extend_gcd(m,a,x,y);
    y%=m;
    y+=m;
    y%=m;
    return y;
}

/*const int N = 1000001;
int lp[N+1];
vector<int> pr;
void s(){
for (int i=2; i<=N; ++i) {
        if (lp[i] == 0) {
            lp[i] = i;
            pr.push_back (i);
        }
        for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
            lp[i * pr[j]] = pr[j];
    }
}*/


ll kv;
ll t,n,x,y,h,k,z,p,q,w;

vector<vector<pll>>v,v1,v2;
//vector<ll>vis,d;
  

int main() {
    IOS;
    cin>>x>>y>>z;
    cout<<(z/x)*y;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

int main(void){
    
    double r = 0;
    
    cin >> r;

    double menseki = r * r * M_PI;
    double ensyu = r * 2 * M_PI;
    
    cout << fixed << setprecision(6) << menseki << ' ' << ensyu << endl;
    
    return 0;   
}

Measured memory_bytes: 1284
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long; using ll = long long; using ld = long double;
using pi = pair<int, int>; using pll = pair<ll, ll>;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
template<typename T> using minQ = priority_queue<T, vector<T>, greater<T>>;

#define endl '\n'
#define ALL(a)       (a).begin(),(a).end()
#define FOR(i,a,b)   for(ll i = (ll)(a); i < (ll)(b); ++i)
#define FORO(i,a,b)  for(ll i = (ll)(a); i <= (ll)(b); ++i)
#define RFOR(i,a,b)  for(ll i = (ll)(b) - 1; i >= (ll)(a); --i)
#define RFORO(i,a,b) for(ll i = (ll)(b); i >= (ll)(a); --i)
#define REP(i,n)     for(ll i = 0; i < (ll)(n); ++i)
#define REPO(i,n)    for(ll i = 1; i <= (ll)(n); ++i)
#define RREP(i,n)    for(ll i = (ll)(n) - 1; i >= 0; --i)
#define RREPO(i,n)   for(ll i = (ll)(n); i >= 1; --i)
#define SORT(a)      sort(ALL(a))
#define UNIQ(a)      a.erase(unique(ALL(a)), a.end())
#define SUNIQ(a)     SORT(a), UNIQ(a)
#define MINI(a,b)    a=min(a,(b))
#define MAXI(a,b)    a=max(a,(b))

const ll mod = 1e9 + 7;
const int INF = 1e9 + 10;
const ll LINF = 1000000000000000000ll;
const ld eps = 1e-8;
const ld PI = acosl(-1);

ll Nll() { ll a; cin >> a; return a; }
ld Nld() { ld a; cin >> a; return a; }
int Ni() { int a; cin >> a; return a; }
char Nc() { char a; cin >> a; return a; }
string Ns() { string a; cin >> a; return a; }

template <typename T>
void O(const T &a) { cout << a << endl; }
template <typename T>
void O(T &&a) { cout << a << endl; }
template <typename T>
void Os(const vector<T> &v) { REP(i, v.size() - 1) cout << v[i] << " \n"[i + 1 == (ll)v.size()]; }
template <typename T>
void Os(vector<T> &&v) { REP(i, v.size() - 1) cout << v[i] << " \n"[i + 1 == (ll)v.size()]; }
template <typename T>
void Is(vector<T> &v) { for (auto& t : v) cin >> t; }

void yes(bool f) { cout << (f ? "yes" : "no") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }

struct Edge {
	int from, to;
	int cost;
	Edge() {}
	Edge(int f, int t, int c) : from(f), to(t), cost(c) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void solve();

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

//-----------------------------------------------template-------------------------------------------------------------

//-----------------------------------------------library-------------------------------------------------------------

void solve()
{
	int N = Ni();
	Graph G(N);
	REP(i, N - 1) {
		int a = Ni() - 1, b = Ni() - 1, c = Ni();
		G[a].emplace_back(a, b, c);
		G[b].emplace_back(b, a, c);
	}
	vl d(N, INF);
	int Q = Ni(), K = Ni() - 1;
	queue<pll> q;
	q.emplace(K, 0);
	while (!q.empty()) {
		auto p = q.front(); q.pop();
		d[p.first] = p.second;
		for (auto e : G[p.first]) if (d[e.to] == INF) {
			q.emplace(e.to, p.second + e.cost);
		}
	}
	REP(i, Q) {
		int x = Ni() - 1, y = Ni() - 1;
		O(d[x] + d[y]);
	}
}


Measured memory_bytes: 10420
#include<iostream>
using namespace std;
 
int main(void) {
	int N, ans=0;
	cin >> N;
  	for(int i=1; i<=N; ++i){
      	int count = 0;
      for(int j=1; j<=N; ++j)
    	if( i%2==1 && i%j==0)++count;
      	if( count==8)++ans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


LL gcd(LL x, LL y){
	while(y){
		LL r = x % y;
		x = y;
		y = r;
	}
	return x;
}

void mainmain(){
	int n;
	scanf("%d", &n);
	LL a = 1;
	for(int i = 0; i < n; ++i){
		LL t;
		scanf("%lld", &t);
		a *= t / gcd(a, t);
	}
	printf("%lld\n", a);
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
//#define ll long long
//#define int  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 300000;
int mod = 1e9 + 7;
int x[N], y[N], a[N], b[N];
map < pair < int, int >, int > m;
int calc1(int n, int x, int y){
    return n % x + n / x * y;
}
int calc2(int n, int l1, int l2, int h1, int h2){
    int res = 0;
    for (int i = 0; i * l1 <= n; i++){
        int x = calc1(n - i * l1, l2, h2) + h1 * i;
        res = max(x, res);
    }
    return res;
}
int calc3(int n, int l1, int l2, int l3, int h1, int h2, int h3){
    int res = 0;
    for (int i = 0; i * l1 <= n; i++){
        int x = calc2(n - i * l1, l2, l3, h2, h3) + i * h1;
        res = max(x, res);
    }
    return res;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n, ga, sa, ba, gb, sb, bb;
    cin >> n >> ga >> sa >> ba >> gb >> sb >> bb;
    int ans = 0;
    if (ga <= gb && sa <= sb && ba <= bb){
        ans = calc3(n, ga, sa, ba, gb, sb, bb);
        cout << ans;
        return 0;
    }
    if (ga <= gb && sa <= sb && ba > bb){
        ans = calc2(n, ga, sa, gb, sb);
        ans = calc1(ans, bb, ba);
        cout << ans;
        return 0;
    }
        if (ga <= gb && sa > sb && ba <= bb){
        ans = calc2(n, ga, ba, gb, bb);
        ans = calc1(ans, sb, sa);
        cout << ans;
        return 0;
    }
        if (ga > gb && sa <= sb && ba <= bb){
        ans = calc2(n, ba, sa, bb, sb);
        ans = calc1(ans, gb, ga);
        cout << ans;
        return 0;
    }
        if (ga > gb && sa > sb && ba > bb){
        ans = calc3(n, gb, sb, bb, ga, sa, ba);
        cout << ans;
        return 0;
    }
    if (ga > gb && sa > sb && ba <= bb){
        ans = calc1(n, ba, bb);
        ans = calc2(ans, gb, sb, ga, sa);
        cout << ans;
        return 0;
    }
        if (ga > gb && sa <= sb && ba > bb){
        ans = calc1(n, sa, sb);
        ans = calc2(ans, gb, bb, ga, ba);
        cout << ans;
        return 0;
    }
        if (ga <= gb && sa > sb && ba > bb){
        ans = calc1(n, ga, gb);
        ans = calc2(ans, bb, sb, ba, sa);
        cout << ans;
        return 0;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x) for(int i = 0; i < (sizeof(x)/sizeof(x[0])); i++){ cout << (x[i]) << " ";} cout << endl;
#define printaa(x) for(int i = 0; i < (sizeof(x)/sizeof(x[0])); i++){ for(int j = 0; j < (sizeof(x[0])/sizeof(x[0][0])); j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    cin >> N >> K;
    int A[100001];
    rep(i,0,N){
        cin >> A[i];
    }
    int ans = 1;
    int tmp = N - K;
    while(tmp > 0){
        tmp -= K -1;
        ans ++;
    }
    print(ans);
    


}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<set>
#include<sstream>
using namespace std;
typedef long long ll;
const ll maxn=1e6+10;
const ll inf=0x3f3f3f3f3f3f3f3f;
void io(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
int main()
{
	io();
	ll x,y,z;
	cin>>x>>y>>z;
	cout<<z<<" "<<x<<" "<<y<<endl; 
	return 0;
}

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

#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define ll long long
#define pb push_back
#define zoom                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define pl pair<ll, ll>
#define MOD 1000000007
#define endl "\n"
#define ff first
#define ss second
#define trace1(x) cerr << #x << ": " << x << endl
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define trace3(x, y, z) cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl
#define trace4(a, b, c, d) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl
#define trace5(a, b, c, d, e) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl
#define trace(v)                                   \
    for (auto it = v.begin(); it != v.end(); it++) \
        cerr << *it << " ";                        \
    cerr << endl;
#define tr(container, it) \
    for (typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<vi> vvi;

void solve()
{
    ll a;
    cin>>a;


    ll ans=a+a*a+a*a*a;

    cout<<ans<<endl;
}

int main()
{
    zoom;
    ll t=1;
    //cin >> t;

    while (t--)
    {
        solve();
    }
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(ll i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(ll i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;

struct edge{
    int from,to;
    ll cost;
};
int V,E;
vector<edge> G;
vl bellman_ford(int s,int x){
    vl dist(V,LINF);
    dist[s]=0;
    REP(i,(V-1)*x){
        REP(i,E){
            edge e=G[i];
            if(dist[e.from]==LINF){
                continue;
            }
            dist[e.to]=min(dist[e.to],dist[e.from]+e.cost);
        }
    }
    return dist;
}
int main(){
    cin>>V>>E;
    G.resize(E);
    REP(i,E){
        cin>>G[i].from>>G[i].to>>G[i].cost;
        G[i].from--;
        G[i].to--;
        G[i].cost*=-1;
    }
    auto a=bellman_ford(0,1);
    auto b=bellman_ford(0,2);
    if(a[V-1]!=b[V-1]){
        cout<<"inf"<<endl;
    }else{
        cout<<-a[V-1]<<endl;
    }
    return 0;
}

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

using ll = long long;

float calc_d(double x1,double x2,double y1,double y2){
  double d2 = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
  return sqrt(d2);
}

int factorial(int n){
  if(n==0)return 1;
  return n*factorial(n-1);
}

int main(){
  int N;
  cin >> N;
  vector<double> x(N),y(N); 
  rep(i,N)cin >> x[i] >> y[i];

  double edge_sum=0;
  for(int a=0;a<N-1;a++)for(int b=a+1;b<N;b++){
    edge_sum += calc_d(x[a],x[b],y[a],y[b]);
    }
  
  int tsukau_kaisuu = 2 * factorial(N-1);

  double ans = edge_sum * double(tsukau_kaisuu) / double(factorial(N));

  //cout<<edge_sum<<","<<tsukau_kaisuu<<endl;
  //cout << ans << endl;
  printf("%.10lf\n",ans);
}

/*
解説放送がわかりやすかった
各辺が出てくる回数は全て同じで(対称性)、それをxとおくと
辺の長さの総和S
 = ありえる辺(2点の組)(NC2) * 各辺が何回使われるかx
 = 1回のルートで通る辺の数(N-1) * 通る順番(N!)
x = (N-1)N! / NC2
NC2 = N(N-1)/2より x = 2(N-1)!
xがわかれば各辺組の総和をx倍してSを求めればいいので
S = 各辺の長さの総和 * x
このSをルートの組数N!で割ると答え

*/

Measured memory_bytes: 256
#pragma region Header
#include <iostream>
#include <iomanip>
#include <cstdint>
#include <cmath>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <string>
#include <functional>
#include <algorithm>
#include <numeric>
#include <stdexcept>
using namespace std;
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
#define repd(i, n) for (int i = static_cast<int>(n) - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define FORD(i, a, b) for (int i = static_cast<int>(b) - 1; i >= static_cast<int>(a); --i)
template <typename T>
int SZ(T const &x)
{
    return static_cast<int>(x.size());
}
#pragma endregion

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

    string s; cin>>s;
    rep(i, s.size())
    {
        cout << 'x';
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3656