akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int a, b, c, d, e, f;
    std::cin >> a >> b >> c >> d >> e >> f;
    a *= 100; b *= 100;
    auto ret = std::make_pair(a, 0);
    for (int i = 0; i <= f / a; i++) for (int j = 0; j <= f / b; j++) {
        for (int k = 0; k <= f / c; k++) for (int l = 0; l <= f / d; l++) {
            int w = a * i + b * j;
            int s = c * k + d * l;
            if (w + s > f || w / 100 * e < s) continue;
            if (s * (ret.first + ret.second) > ret.second * (w + s)) {
                ret.first = w;
                ret.second = s;
            }
        }
    }
    std::cout << ret.first + ret.second << " " << ret.second << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-13;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
char wolf[10]="MARCH";
long long c[10];
char in[110];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		scanf("%s",in);
		for(int j=0;j<5;j++){
			if(in[0]==wolf[j])c[j]++;
		}
	}
	long long ret=0;
	ret+=c[0]*c[1]*c[2];
	ret+=c[0]*c[1]*c[3];
	ret+=c[0]*c[1]*c[4];
	ret+=c[0]*c[2]*c[3];
	ret+=c[0]*c[2]*c[4];
	ret+=c[0]*c[3]*c[4];
	ret+=c[1]*c[2]*c[3];
	ret+=c[1]*c[2]*c[4];
	ret+=c[1]*c[3]*c[4];
	ret+=c[4]*c[2]*c[3];
	printf("%lld\n",ret);
}

Measured memory_bytes: 128
import java.util.Scanner;

// B - Great Ocean View
public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	String[] s = S.split("");
	int count = 0;
	if (s.length == 1) {
		System.out.println("0");
		return;
	}
	for (int i = 0; i < s.length - 1; i++) {
		if (s[i].equals(s[i+1])) {
			if (s[i+1].equals("0")) {
				s[i+1] = "1";
				count++;
			} else if (s[i+1].equals("1")) {
				s[i+1] = "0";
				count++;
			}
		}
	}
	if (s[s.length-1].equals(s[s.length-2])) { // 最後の要素
		if (s[s.length-1].equals("0")) {
			s[s.length-1] = "1";
			count++;
		} else if (s[s.length-1].equals("1")) {
			s[s.length-1] = "0";
			count++;
		}
	}
//	for (int i = 0; i < s.length; i++) {
//		System.out.print(s[i]);
//	}
	System.out.println(count);
	}
}

Measured memory_bytes: 32840
import fractions
a,b,c,d = map(int,input().split())
dev = b- a +1

def count_q(a,b,m):
    if a%m==0:
        q = b//m -a//m +1
    else:
        q = b//m - a//m
    return q


def lcm(c,d):
    return (c*d)//(fractions.gcd(c,d))

da = lcm(c,d)

qc = count_q(a,b,c)
qd = count_q(a,b,d)
qe = count_q(a,b,da)
ans = (b-a+1)-(qc+qd-qe)
print(ans)

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

const int INF = 1e9 + 5;

int main(int argc, char const *argv[])
{
	// ios_base::sync_with_stdio(false);
 //    cin.tie(NULL);
    ll int n,w;
    cin>>n>>w;
    ll int wt[n][2];
    for(ll int i=0;i<n;i++){
    	cin>>wt[i][0]>>wt[i][1];
    }
    ll int dp[n+1][w+1] = {0};
    for(ll int i=0;i<=n;i++){
    	for(ll int j=0;j<=w;j++){
    		if(i== 0 || j==0){
    			// cout<<"kk"<<" ";
    			dp[i][j] = 0;
    			// cout<<dp[i][j]<<endl;
    		}
    		else if(wt[i-1][0]>j)
    			dp[i][j] = dp[i-1][j];
    		else
    			dp[i][j] = max(dp[i-1][j],dp[i-1][j-wt[i-1][0]]+wt[i-1][1]);
    		// cout<<dp[i][j]<<" "<<i<<" "<<j<<endl;
    	}
    	// cout<<endl;
    }
    cout<<dp[n][w];
	return 0;
}

Measured memory_bytes: 79104
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int N, M;
        cin >> N >> M;
        vector<ll> A(N);
        rep(i, 0, N) cin >> A[i];

        vector<pair<ll, ll>> cb(M);
        rep(i, 0, M) {
            cin >> cb[i].second >> cb[i].first;
        }

        sort(all(cb));
        reverse(all(cb));

        vector<ll> D;
        int idx = 0;
        while (D.size() < A.size() && idx < cb.size()) {
            ll val = cb[idx].first;
            ll cnt = cb[idx].second;
            for (ll i = 0; i < cnt && D.size() < A.size(); ++i) {
                D.push_back(val);
            }
            idx++;
        }


        while (D.size() < A.size()) {
            D.push_back(0);
        }


        sort(all(A));
        ll ans = 0ll;
        for (int i = 0; i < N; ++i) {
            ans += max(A[i], D[i]);
        }
        cout << ans << endl;


    }
};


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

    Solve().solve();


    return 0;
}


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

int main()
{
    ll n,i;
    cin>>n;
    ll a,b,c;
    ll sum=0;
    for(a=1;a<=n;a++)
    {
        for(b=1;b<=n;b++)
        {
            for(c=1;c<=n;c++)
            {
                ll d=__gcd(c,b);
                d=__gcd(a,d);
                sum+=d;
            }
        }
    }
    cout<<sum;
}

Measured memory_bytes: 3640
#include<cstdio>
#include<algorithm>
#include<cstring>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
using namespace std;
const int N=1e5+11,mod=1e9+7;
int n,m,len,ans;
char s[N];
int sum[N];
int main(){
	scanf("%s",s);
	if(s[0]=='A')puts("T");
	if(s[0]=='T')puts("A");
	if(s[0]=='C')puts("G");
	if(s[0]=='G')puts("C");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#define rep(i,a,n) for(int (i) = (a);(i) < (n);(i)++)
using namespace std;

int main(){
  	int n;
  	cin >> n;
  	string s;
  
  	rep(i,0,n){
      cin >> s;
      if(s == "Y"){
        cout << "Four" << endl;
        return 0;
      }
    }
  	cout << "Three" << endl;
 	return 0; 
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    unsigned int n;  // The number of meals ordered by customer.
    std::cin >> n;

    unsigned int PricePerMeal  { 800 };
    unsigned int CustomerPaid  { n * PricePerMeal };
    unsigned int PaidBackPer15 { 200 };
    unsigned int PaidBack      { n / 15 * PaidBackPer15 };
    unsigned int RealCost      { CustomerPaid - PaidBack };     

    std::cout << RealCost << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

  int l[4];
  int i;
  int min;

  for(i=0;i<3;i++){
    scanf("%d",&l[i]); 
  }

  l[3] = l[0];

  min = 300;

  for(i=0;i<3;i++){
    if(l[i]+l[i+1] < min){
      min = l[i] + l[i+1];
    }
  }

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

  return 0;
  

}
  

Measured memory_bytes: 128
package main

import (
    "bufio"
    "fmt"
    "os"
)

var sc = bufio.NewScanner(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func nextString() string {
    sc.Scan()
    s := sc.Text()
    return s
}

func main() {
    sc.Split(bufio.ScanWords)
    defer w.Flush()

    s := nextString()
    t := nextString()
    l := len(s)

    if s == t[:l] {
        fmt.Fprintln(w, "Yes")
    } else {
        fmt.Fprintln(w, "No")
    }
}

Measured memory_bytes: 1760
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#define ll long long
#define INF 10000000000000000
#define MOD 998244353
using namespace std;


int main(){
    ll n;
    cin >>n;
    if(n%2){
        cout<<n*2<<endl;
    }else{
        cout<<n<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
tateN, YokoN = map(int,input().split())
arr = [input() for i in range(tateN)]

#縦を検索
tateline = list()
for i in range(0, tateN):
    if arr[i].find('#') != -1:
        tateline.append(i)

yokoline = list()
for j in range(0, YokoN):
    found = False
    for tate in range(0, tateN):
        if arr[tate][j] == '#': found = True
    if found : yokoline.append(j)

for t in tateline:
    prstr = ''
    for y in yokoline:
        prstr += arr[t][y]
    print(prstr)

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

int main() {
  string N;
  cin >> N;
  
  // コピーコンストラクタ
  string reverseN(N);
  reverse(reverseN.begin(), reverseN.end());

  cout << (N == reverseN ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
vector<int>v[1000],tmp,ans;
int n,m,a,b,c,pre[1000],dist[1000],MIN,cur;
int main(void){
    cin>>n>>m;
    MIN=n+1;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        a--,b--;
        v[a].push_back(b);
    }
    for(int i=0;i<n;i++){
        queue<int> que;
        for(int i=0;i<n;i++)pre[i]=-1;
        for(int i=0;i<n;i++)dist[i]=-1;
        que.push(i);
        dist[i]=1;
        while(que.size()){
            int q=que.front();
            que.pop();
            for(int x:v[q]){
                if(dist[x]==-1){
                    dist[x]=dist[q]+1;
                    pre[x]=q;
                    que.push(x);
                }
                else if(x==i){
                    while(!que.empty())que.pop();
                    tmp={i};
                    int cur=q;
                    while(cur!=i){tmp.push_back(cur),cur=pre[cur];}
                    if(MIN>tmp.size())MIN=tmp.size(),ans=tmp;
                    //for(int y:tmp)cout<<y<<" ";
                    //cout<<endl;
                }
            }
        }
    }
    if(MIN==n+1)cout<<-1<<endl;
    else{
        cout<<MIN<<endl;
        for(int x:ans){
            cout<<x+1<<endl;
        }
    }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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

	int n, m;
	cin >> n >> m;

	string s;
	cin >> s;

	vector<int> v;
	rep(i, n+1){
		if(s[i] == '0') v.push_back(i);
	}

	int pos = n;
	vector<int> ans;
	while(pos > 0){
		auto itr = lower_bound(v.begin(), v.end(), pos - m);
		int d = pos - *itr;
		if(d == 0){
			cout << -1 << endl;
			return 0;
		}
		ans.push_back(d);
		pos = *itr;
	}

	reverse(ans.begin(), ans.end());

	int l = ans.size();
	rep(i, l) cout << ans[i] << (i == l - 1 ? "\n" : " ");
}


Measured memory_bytes: 1480
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(int argc, char **argv)
{
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        int n, l;
        cin >> n >> l;
        int s = 0, m = 1000;
        for (int i = 0; i < n; i++) {
                int d = l + i;
                if (abs(d) < abs(m))
                        m = d;
                s += d;
        }
        cout << s - m << endl;
        return 0;
}


Measured memory_bytes: 256
import sys
n = int(input())
a = list(map(int,input().split()))
flag = 0
for i in range(n):
    if(a[i]%2 == 0):
        if(a[i]%3 == 0 or a[i]%5 == 0):
            print(end="")
        else:
            print("DENIED")
            sys.exit()
print("APPROVED")

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

#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);

int main() {
    fast_io;
    int pos=1;

    int num;
    while(cin>>num) {
        if(num==0) {
            cout<<pos<<endl;
            return 0;
        }
        pos++;
    }
}




Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;

int a[110],ok=1,ans1,ans2;

int main()
{
  int n; cin>>n;
  for(int i=0;i<n;i++){
  	cin>>a[i];
  }
  for(int i=0;i<n-1;i++)
  	for(int j=i+1;j<n;j++)
  		if(a[i]<a[j])
  			swap(a[i],a[j]);
  for(int i=0;i<n;i++)
  	if(ok==1){
  		ans1+=a[i];
  		ok=2;
	  }
  	else {
  		ans2+=a[i];
  		ok=1;
	}
  cout<<ans1-ans2<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

#define SOLO 0
#define PAIR 1
typedef long long lint;

using namespace std;

int main(){
  string S;
  cin>>S;
  int N=S.size();
  int dp[N][2];
  REP(i,N){
    dp[i][SOLO]=0;
    dp[i][PAIR]=0;
  }
  dp[0][SOLO]=1;
  dp[0][PAIR]=0;
  dp[1][SOLO]=(S[0]!=S[1]?2:0);
  dp[1][PAIR]=1;
  FOR(i,2,N){
    if(dp[i-1][PAIR]){
      dp[i][SOLO]=dp[i-1][PAIR]+1;
    }
    if(dp[i-1][SOLO]){
      if(S[i]!=S[i-1]){
        dp[i][SOLO]=max(dp[i][SOLO],dp[i-1][SOLO]+1);
      }
    }

    if(dp[i-2][SOLO]){
      dp[i][PAIR]=dp[i-2][SOLO]+1;
    }
    if(dp[i-2][PAIR]){
      if(S[i]!=S[i-2] or S[i-1]!=S[i-3]){
        dp[i][PAIR]=max(dp[i][PAIR],dp[i-2][PAIR]+1);
      }
    }
  }
  cout<<max(dp[N-1][SOLO],dp[N-1][PAIR])<<endl;
  return 0;
}


Measured memory_bytes: 2180
#include <iostream>
#include <vector>
#include <cmath>

int c()
{
    int a, b = 0;
    std::cin >> a >> b;

    int price = -1;
    for(int i = 0; i <= 1000; i++)
    {
        int low = i * 0.08;
        int high = i * 0.1;
        if(low == a && high == b)
        {
            price = i;
            break;
        }
    }
    
    std::cout << price;
    return 0;
}

int main(int argc, const char * argv[])
{
    c();
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

var (
	S string
)

func main() {
	fmt.Scan(&S)

	if S == "Sunny" {
		fmt.Println("Cloudy")
	} else if S == "Cloudy" {
		fmt.Println("Rainy")
	} else if S == "Rainy" {
		fmt.Println("Sunny")
	}
}


Measured memory_bytes: 512
<?php
  list($h, $w, $a, $b) = explode(" ", trim(fgets(STDIN)));

  $m = 1000000007;
  $middle = [];
  $ans = 0;

  $factorial = [];

  $factorial[0] = 1;
  for ($i=1; $i<=$w+$h; $i++) {
    $factorial[$i] = $i * $factorial[$i-1] % $m;
  }

  for ($i=$b+1; $i<=$w; $i++) {
    $ptn = combination2($i-1+$h-$a-1, $i-1, $m, $factorial);
    $ptn *= combination2($w-$i+$a-1, $w-$i, $m, $factorial)%$m;
    $ans += $ptn%$m;
  }
  echo $ans%$m;


/**
 * mod Pの世界での繰り返し二乗法
 * @param $b 基数
 * @param $p 指数
 * @param $m 素数
 */
function repeatSqrt($b, $p, $m){
  if($p==1)
  {
    return $b;
  }
  else if($p%2 == 0)
  {
    $t = repeatSqrt($b, floor($p/2), $m);
    return ($t * $t) % $m;
  }
  else
  {
    return ($b * repeatSqrt($b, $p-1, $m)) % $m;
  }
}

/**
 * mod Pの世界での組み合わせ(nCa)
 * @param $n 全体の数
 * @param $a 選択する数
 * @param $m 素数
 */
function combination($n, $a, $m)
{
    $x=1; // bunbo
    $y=1; // bunshi
    for($i=0;$i<$a;$i++)
    {
        $x=$x*($n-$i)%$m;
        $y=$y*($i+1)%$m;
    }
    // フェルマーの小定理 
    // Y^(P-1)≡1 (mod P) より
    // Y^(P-2)≡1/Y (mod P)
    // つまり
    // $x / $y = $x * $y^($m-2) (mod P)
    $y=repeatSqrt($y, $m-2, $m);
    return ($x*$y)%$m;
}


/**
 * mod Pの世界での組み合わせ(nCa)
 * @param $n 全体の数
 * @param $a 選択する数
 * @param $m 素数
 * @param $factorial 処理済みの階乗
 */
function combination2($n, $a, $m, $factorial)
{
    $x=$factorial[$n]; // bunbo
    $y=$factorial[$a]*$factorial[$n-$a]%$m; // bunshi

    // フェルマーの小定理 
    // Y^(P-1)≡1 (mod P) より
    // Y^(P-2)≡1/Y (mod P)
    // つまり
    // $x / $y = $x * $y^($m-2) (mod P)
    $y=repeatSqrt($y, $m-2, $m);
    return ($x*$y)%$m;
}

Measured memory_bytes: 23008
#include <stdio.h>
main(){
  int n;
  int rt[200000];
  int prof,x,minp;
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&rt[i]);
  }
  prof = rt[1]-rt[0];
  minp = rt[0];
  for(i=1;i<n;i++){    
    x = rt[i]-minp;
    if(prof<x){
        prof=x;
    }
    if(minp>rt[i]){
      minp = rt[i];
    }
  }
  printf("%d\n",prof);
}

Measured memory_bytes: 1804
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var wtr = bufio.NewWriter(os.Stdout)
	var N, M, X int
	fmt.Scan(&N, &M, &X)
	m := map[int]bool{}
	for i := 0; i < M; i++ {
		var p int
		fmt.Scan(&p)
		m[p] = true
	}
	var costP, costM int
	for i := X; i < N; i++ {
		_, ok := m[i]
		if ok {
			costP++
		}
	}
	for i := X; i > 0; i-- {
		_, ok := m[i]
		if ok {
			costM++
		}
	}
	var ans int
	if costP < costM {
		ans = costP
	} else {
		ans = costM
	}

	fmt.Fprintln(wtr, ans)
	_ = wtr.Flush()
}


Measured memory_bytes: 1860
package main

import (
	"fmt"
	"strconv"
	"strings"
	"time"
)

func main() {

	var S string
	fmt.Scan(&S)
	arr := strings.Split(S, "/")
	year, _ := strconv.Atoi(arr[0])
	month, _ := strconv.Atoi(arr[1])
	day, _ := strconv.Atoi(arr[2])
	t := time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.Local)
	lastHeiseiDate := time.Date(2019, time.Month(4), 30, 0, 0, 0, 0, time.Local)
	if int(lastHeiseiDate.Sub(t)) >= 0 {
		fmt.Println("Heisei")
	} else {
		fmt.Println("TBD")
	}
}


Measured memory_bytes: 1936
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N = inputInt()
	xy = []
	seq = []

	for i in range(N):
		x,y = inputMap()
		xy.append((x,y))
		seq.append(i)

	ptns = list(itertools.permutations(seq))

	anss = []
	for ptn in ptns:
		ptn_list = list(ptn)

		strt = 0
		for i,val in enumerate(ptn_list):
			if i == 0:
				strt = val
				continue

			stx, sty = xy[strt]
			sdx, sdy = xy[val]
			tmptmp = ((stx-sdx)**2) + ((sty-sdy)**2)
			tmp = math.sqrt(tmptmp)
			anss.append(tmp)

	ans = 0
	for i in anss:
		ans += i

	print(ans/len(ptns))




if __name__ == "__main__":
	main()


Measured memory_bytes: 58612
def examA():
    C = SI()
    ans = chr(ord(C)+1)
    print(ans)
    return

def examB():
    N = I()
    ans = 0
    print(ans)
    return

def examC():
    return

def examE():
    return

def examF():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examA()


Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; //intじゃ扱えないことに注意！
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意！

int main() {
  int N;
  cin >> N;
  vector<int> X(N);
  for(int i = 0; i < N; i++){
    cin >> X[i];
  }

  int sum = 0;
  int ans = 1000000;
  for(int i = 0; i <= 100; i++){
    sum = 0;
    for(int j = 0; j < N; j++){
      sum += (X[j]-i)*(X[j]-i);
    }
    ans = min(ans,sum);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

const int bits = 50;

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N;
  while (cin >> N) {
    vector<ll> A(N);
    for (auto& x : A) cin >> x;
    ll X = A[0], Y = A[1], Z = 0;
    for (int i = 2; i < N; i++) Z ^= A[i];
    ll W = X + Y;
    // bit, carry, keep
    auto dp = make_v(bits, 2, 2, -1ll);
    dp[0][0][1] = 0;
    for (int b = 0; b < bits - 1; b++) {
      int a = (X >> b) & 1, w = (W >> b) & 1, z = (Z >> b) & 1;
      for (int carry = 0; carry < 2; carry++) {
        for (int keep = 0; keep < 2; keep++) {
          ll value = dp[b][carry][keep];
          if (value < 0) continue;
          for (int x = 0; x < 2; x++) {
            int ncarry = 0;
            int y = w - carry;
            if (y < 0) {
              ++ncarry;
              y += 2;
            }
            y -= x;
            if (y < 0) {
              ++ncarry;
              y += 2;
            }
            if (x ^ y ^ z) continue;
            int nkeep = 0;
            if (x < a) {
              nkeep = 1;
            } else if (x == a) {
              nkeep = keep;
            }
            chmax(dp[b + 1][ncarry][nkeep], (ll(x) << b) + value);
          }
        }
      }
    }
    ll sub = dp[bits - 1][0][1];
    if (sub <= 0) {
      cout << -1 << endl;
    } else {
      cout << X - sub << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3584
# -*- coding: utf-8 -*-
# B

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

T = input()
ans = []
prev = False

for i in range(len(T)):
    if T[i]=='?':
        # T[i]='D'
        ans.append('D')

    if T[i]=='D':
        # ans += 1
        # if prev:
        #     ans += 1
        prev = False
        ans.append('D')

    if T[i]=='P':
        prev = True
        ans.append('P')

print(''.join(ans))

Measured memory_bytes: 82168
#include <bits/stdc++.h> 
using namespace std; 
typedef long long ll;
ll mod = 1e9+7;

int main() 
{ 
	int n;
	cin>>n;
	int a[n];
	ll dig = 0;
	int b[n];
	memset(b,0,sizeof(b));
	for(int i=0; i<n; i++) {
	 cin>>a[i];
	 b[i] = a[i];
	 ll ln=log2(a[i]);
	 dig = max(dig,ln);
	}

	for(int i=0;i<=dig; i++) {
		int num = 0;
		for(int j=0; j<n; j++) {
			int c = a[j]%2;
			if(c==1) num++;
			
		}

		if(num%2!=0) {
			for(int j=0; j<n; j++) {
				if(a[j]%2==1) b[j] -= pow(2,i);
				if(a[j]%2==0) b[j] += pow(2,i);
				
			}
		}

		for(int j=0; j<n; j++)
			a[j] /=2;
	}

	for(int i=0; i<n; i++)
		cout<<b[i]<<"\n";

    return 0; 
} 
/*
20 10100
11  1011
9   1001
24 11000

26 11010
5    101
7    111
22 10110 
*/

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <ll,ll> pii;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rept(i,x,y) for(int i=x;i<=y;i++)
#define per(i,x,y) for(int i=x;i>=y;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define fi first
#define se second
#define mes(a,b) memset(a,b,sizeof a)
#define mp make_pair
#define dd(x) cout<<#x<<"="<<x<<" "
#define de(x) cout<<#x<<"="<<x<<"\n"
#define debug() cout<<"I love Miyamizu Mitsuha forever.\n"
const int inf=0x3f3f3f3f;
set<string> s;
string str;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	while(n--)
	{
		str.clear();
		cin>>str;
		s.insert(str);
	}
	cout<<s.size()<<"\n";
	return 0;
}

Measured memory_bytes: 19272
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    ll N,A,B;
    cin >> N >> A >> B;
    cout << max((ll)0,((B*(N-1))+A)-((A*(N-1))+B)+1) << endl;

    return 0;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    a = tuple([int(t)for t in input().split()])

    base = 0
    for i in range(0,n,2):
        base ^= (a[i]^a[i+1])

    ans = []
    for a_i in a:
        ans.append(base^a_i)

    print(*ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 31444
#include<stdio.h>
#include<string.h>

int main(){
  char s[50 + 1];
  int count = 0;
  int i,n;
  scanf("%d",&n);
  scanf("%s",s);
  while(n > 0) {
    if (strncmp(s,"ABC",3) == 0)
      count++;
    for (i = 0; i < n; i++) {
      s[i] = s[i + 1];
    }
    n--;
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int N, K;

int main(void) {
  cin >> N >> K;
  long double ans = 0;
  for (int i = 1; i <= N; i++) {
    if (i < K) {
      int log2n = ceil(log2((double)K / i));
      ans += 1.0 / N * pow(0.5, log2n);
    } else {
      ans += 1.0 / N;
    }
  }
  cout << setprecision(15) << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair

using namespace std;

int main() {
    
    int h,w,k; cin >> h >> w >> k;
    string s[h];
    for(int i = 0;i < h;i++) cin>>s[i];
    
    int b = 0;
    
    int ah[h] = {0};
    int aw[w] = {0};
    ll cnt = 0;
    
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            if(s[i][j] == '#'){
                ah[i]++;
                aw[j]++;
                b++;
            }
        }
    }
    
    ll subh = 1<<h;
    ll subw = 1<<w;
    for(int i = 0;i < subh;i++){
        int t = 0;
        vector<ll> vec;
        for(int j = 0;j < h;j++){
            if((i&(1<<j))){
                t += ah[j];
                vec.pb(j);
            }
        }
        
        for(int n = 0;n < subw;n++){
            int st = 0;
            
            for(int j = 0;j < w;j++){
                if((n&(1<<j))){
                    for(int m = 0;m < vec.size();m++){if(s[vec[m]][j] == '#') st--;}
                    st += aw[j];
                }
            }
            
            if((b-t-st) == k) cnt++;
        }
    }
    
    cout<<cnt;
    
}

Measured memory_bytes: 3620
S = input()

if S == "SUN":
    print(7)
if S == "MON":
    print(6)
if S == "TUE":
    print(5)
if S == "WED":
    print(4)
if S == "THU":
    print(3)
if S == "FRI":
    print(2)
if S == "SAT":
    print(1)

Measured memory_bytes: 3060
//omajinai c++ atcoder
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define itn int
typedef long long ll;
constexpr auto mod = 1000000007;
using namespace std;




int gcd(int p, int q){
if(p % q == 0)return q;
 return gcd(q, p % q);
 }
int main() {
  long int k;
  cin>>k;
  long int sum=0;
  for(int i=1;i<=k;i++){
    for(int j=1;j<=k;j++){
      long int gcd1=gcd(i,j);
      for(int l=1;l<=k;l++){
        sum+=gcd(gcd1,l);
      }
    }
  }
  cout<<sum;
}
  


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

int main(){
    string s; cin >> s;
    vector<int> alp(26, 0);
    int cnt = 0;
    string ans = "";

    for(int i=0; i<s.length(); i++){
        alp[s[i]-'a']++;
        if(alp[s[i]-'a']==1) cnt++;
    }

    if(cnt < 26){
        char tmp;
        for(int i=0; i<26; i++){
            if(alp[i]==0){
                tmp = 'a' + i;
                break;
            }
        }
        ans = s + tmp;
    }else{
        bool flg = false;
        int ids = 0;
        for(int i=1; i<s.length(); i++){
            if(s[i] > s[i-1]){
                flg = true;
                ids = i;
            }
        }
        if(!flg){
            ans = "-1";
        }else{
            string t = s;
            next_permutation(s.begin(), s.end());
            for(int i=0; i<t.size(); i++){
                cout << s[i];
                if(s[i] != t[i]){
                    break;
                }
            }
            cout << "\n" << endl;
            return 0;
        }
        
    }

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

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

using namespace std;

const int N = 1e5 + 7;
const int oo = 1e9 + 7;

int a[N], f[N], n, k;

int main()
{
    //freopen("B.inp","r",stdin);
    //freopen("B.out","w",stdout);

    cin >> n >> k;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
        f[i] = oo;
    }
    f[1] = 0;

    for(int i = 2; i <= n; i++)
    {
        //cout << a[i] << " ";
        for(int step = 1; (step <= k && (i - step) > 0); step++) f[i] = min(f[i - step] + abs(a[i] - a[i - step]), f[i]);
    }

    cout << f[n];
}


Measured memory_bytes: 1024
n, k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]

c = [0] * n
for i in range(1, n):
    h_to = h[i]
    c[i] = min(
        [
            c_from + abs(h_to - h_from)
            for c_from, h_from in zip(
                c[max(0, i - k) : i], h[max(0, i - k) : i]
            )
        ]
    )

print(c[n - 1])


Measured memory_bytes: 13928
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef map<ll,ll> mll;
typedef set<ll> sll;

#define se second
#define fi first
#define pb push_back

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

  ll n,m;
  cin>>n>>m;
  string s,t;
  for(ll i=0;i<n;i++)
    s+=to_string(m);
  for(ll i=0;i<m;i++)
    t+=to_string(n);
  cout<<min(s,t);

}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let N: usize = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let (X, L): (Vec<i64>, Vec<i64>) = {
        let (mut X, mut L) = (vec![], vec![]);
        for _ in 0..N {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            X.push(iter.next().unwrap().parse().unwrap());
            L.push(iter.next().unwrap().parse().unwrap());
        }
        (X, L)
    };

    const INF: i64 = 1e15 as i64;
    let mut I = (0..N).collect::<Vec<_>>();
    I.sort_by_key(|&i| X[i] + L[i]);
    let mut res = 0;
    let mut x = -INF;
    // println!("{:?}", I);
    for &i in &I {
        if x <= X[i] - L[i] {
            x = X[i] + L[i];
            res += 1;
        }
    }
    let ans = res;

    println!("{}", ans);
}


Measured memory_bytes: 8444
#include"bits/stdc++.h"

#define rep(i, N) for(int i = 0;i < N;i++)

typedef long long ll;

const int mod = 1e9 + 7;

using namespace std;



int main(void) {
	int N; cin >> N;
	vector<int> L(N); rep(i, N)cin >> L[i];
	sort(L.begin(), L.end());

	int ans = 0;
	rep(i, N)rep(j, i) {
		int k = lower_bound(L.begin(), L.end(), L[i] + L[j]) - L.begin();
		int l = i + 1;
		ans += max(0, k - l);
	}

	cout << ans << endl;

	return 0;
}

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


// i番目までみて, 時間をjまで使うときの、満足のMAX
ll dp[3010][6010];

int main(int argc, char const *argv[])
{
	int n; ll t; cin >> n >> t;
	vector<pair<ll, ll>> v;
	rep(i, n) {
		int t1, t2; cin >> t1 >> t2;
		v.push_back(make_pair(t1, t2));
	}
	sort(v.begin(), v.end());

	vector<ll> a(n), b(n);
	rep(i, n) {
		a[i] = v[i].first;
		b[i] = v[i].second;
	}

	rep(i, 3010)rep(j, 6010) dp[i][j] = -1;
	dp[0][0] = 0;

	rep(i, n) {
		rep(j, t) {
			if (dp[i][j] == -1)
				continue;
			// select
			dp[i + 1][j + a[i]] = max(dp[i + 1][j + a[i]], dp[i][j] + b[i]);

			// not selcet
			dp[i + 1][j] = max(dp[i][j], dp[i + 1][j]);
		}
	}

	ll ans = 0;
	rep(i, 3010)rep(j, 6010)
		ans = max(ans, dp[i][j]);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 141696
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z));
    return res;
}

void debug_out(vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}

#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
#else
#define debug(...) 42
#endif

const double PI = acos(-1);
typedef long long ll;
#define int ll
#define fori(n) for(int i=0; i<int(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;

void solve() {
    cini(a);
    cini(b);
    cini(c);
    cini(k);

    int ans=0;
    ans+=min(k,a);
    k-=a;
    k-=b;
    if(k>0)
        ans-=k;
    cout<<ans<<endl;
}

signed main() {
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    solve();
}



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

const int MAX_N = 110000;

int dp[MAX_N];

int main() {
    int N; cin >> N;

    for (int i = 0; i < MAX_N; i++) dp[i] = N;
    dp[0] = 0;
    for (int n = 1; n <= N; n++) {
        for (int pow6 = 1; pow6 <= n; pow6 *= 6) {
            dp[n] = min(dp[n], dp[n - pow6] + 1);
        }
        for (int pow9 = 1; pow9 <= n; pow9 *= 9) {
            dp[n] = min(dp[n], dp[n - pow9] + 1);
        }
    }
    cout << dp[N] << endl;
}

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

static const int INF = 1e9+5;

int n, m, l, q;
int d[300][300];
int e[300][300];

void floyd(int f[300][300]) {
    for (int k =0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            if (f[i][k] > l) continue;
            for (int j = 0; j < n; j++) {
                if (f[k][j] > l) continue;
                f[i][j] = min(f[i][j], f[i][k] + f[k][j]);
            }
        }
    }
}

int main() {
    int a, b, c, s, t;
    cin >> n >> m >> l;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++)  d[i][j] = ((i == j) ? 0: INF);
    }
    for (int i = 0; i < m; i++) {
        cin >> a >> b >> c;
        a--; b--;
        d[a][b] = c;
        d[b][a] = c;
    }
    floyd(d);

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (d[i][j] <= l) e[i][j] = 1;
            else e[i][j] = INF;
        }
    }

    floyd(e);

    cin >> q;

    for (int i = 0; i < q; i++) {
        cin >> s >> t;
        s--; t--;
        if (e[s][t] == INF) cout << -1 << endl;
        else cout << e[s][t] - 1<< endl;
    }
    return 0;
}

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

int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	
	int cnt=0;
	char a='0';
	for(int i=0; i<n; i++){
		char b=s[i];
		if(a!=b){
			cnt++;
			a=b;
		}
	}
	cout << cnt << endl;

}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int[][] card = new int[3][3];
    for(int i=0; i<3; i++){
    	for(int j=0; j<3; j++){
        	card[i][j] = sc.nextInt();
        }
    }
    int N = sc.nextInt();
    int[] number = new int[N];
    for(int i=0; i<N; i++){
    	number[i] = sc.nextInt();
    }
    
    for(int i=0; i<3; i++){
		for(int j=0; j<3; j++){
        	for(int k=0; k<N; k++){
            	if(card[i][j] == number[k]){
                	card[i][j] =0;
                    break;
                }
            }
        }    
    }
    boolean judge = false;
    	for(int i=0; i<3; i++){
    		if(card[i][0] ==0 && card[i][1] == 0 && card[i][2] == 0){
    			judge = true;
        		break;
           }
    }
    if(judge == false){
    	for(int i=0; i<3; i++){
            if(card[0][i] == 0 && card[1][i] == 0 && card[2][i] == 0){
              	judge = true;
                break;
            }
    	}   
    }
    if(judge == false){
    	if(card[0][0] == 0 && card[1][1] ==0 && card[2][2] == 0){
        	judge = true;
        }
    }
    if(judge == false){
      if(card[0][2] == 0 && card[1][1] == 0 && card[2][0] == 0){
        judge = true;
      }
    }
    String ans = "";
     if(judge == true) ans ="Yes";  else ans = "No";
     
    System.out.println(ans);
    
    
  }
}


Measured memory_bytes: 23892
#include <cstdio>
#include <set>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

#define ll long long
const ll N = 1000000000000000;

int main(){
    int n, m, s;
    cin >> n >> m >> s;
    vector<ll> ans(n, N);

    vector<vector< vector<int> > > gr(n);
    for (int i = 0; i < m; ++i) {
        int u, v, a, b;
        cin >> u >> v >> a >> b; --u;--v;
        vector<int> state = {v, a, b};
        gr[u].emplace_back(state);
        state[0] = u;
        gr[v].emplace_back(state);
    }

    int CC = 2600;
    ll dp[n][CC];
    for(int i = 0; i < n; ++i) {
        fill(dp[i], dp[i] + CC, N);
        int a, b;
        cin >> a >> b;
        vector<int> state = {i, -a, b};
        gr[i].emplace_back(state);
    }

    s = min(2500, s);
    vector<ll> state = {0, s, 0};
    queue<vector<ll> > q;
    q.push(state);
    while(!q.empty()) {
        int old = q.size();
        while (old--) {
            state = q.front();
            q.pop();
            for (auto i : gr[state[0]]) {
                auto nst = state;
                nst[0] = i[0];
                nst[1] -= i[1];
                nst[2] += i[2];
                if (nst[1] < 0 || nst[1] > CC - 1 || dp[nst[0]][nst[1]] <= nst[2]) continue;
                dp[nst[0]][nst[1]] = nst[2];
                q.push(nst);
            }
        }
    }

    for (int i = 1; i < n; ++i) {
        ll mn = N;
        for (ll j : dp[i]) mn = min(j, mn);
        cout << mn << endl;
    }
    return 0;
}

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

class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        this.Pic = new char[inpt[0], inpt[0]];
        this.Template = new char[inpt[1], inpt[1]];

        for (int i = 0; i < this.Pic.GetLength(0); i++)
        {
            string txt = Reader.ReadLine();
            for (int j = 0; j < txt.Length; j++)
            {
                this.Pic[i, j] = txt[j];
            }
        }
        for (int i = 0; i < this.Template.GetLength(0); i++)
        {
            string txt = Reader.ReadLine();
            for (int j = 0; j < txt.Length; j++)
            {
                this.Template[i, j] = txt[j];
            }
        }

        string ans = "No";
        if (GetAns())
        {
            ans = "Yes";
        }
        Console.WriteLine(ans);


    }

    private bool GetAns()
    {
        int range = this.Pic.GetLength(0) - this.Template.GetLength(0);
        for (int i = 0; i <= range; i++)
        {
            for (int j = 0; j <= range; j++)
            {
                if (IsMatch(i, j))
                {
                    return true;
                }
            }
        }
        return false;
    }
    private char[,] Pic;
    private char[,] Template;
    private bool IsMatch(int x, int y)
    {
        int range = Template.GetLength(0);
        for (int i = 0; i < range; i++)
        {
            for (int j = 0; j < range; j++)
            {
                if (Pic[i + x, j + y] != Template[i, j])
                {
                    return false;
                }
            }
        }
        return true;

    }


    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"



4 1
....
....
....
....
#



";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
int n;
int a[9] = {0, 1, 2, 4, 8, 16, 32, 64, 128};

int main() {
	cin >> n;
	for(int i = 1; i <= 8; i++) {
		if(a[i] > n) {
			printf("%d\n", a[i - 1]);
			break;
		}
	}
}

Measured memory_bytes: 256
#
import sys
import math
import numpy as np
import itertools

MOD = 1000000007
# いくつか入力
n,m = (int(i) for i in input().split())  

# n行の数をリストに
a = [int(input()) for i in range(m)] 
a.append(9999999) # sentinel
dame=0

b=[1]
if a[dame]==1:
    dame += 1
    b.append(0)
else:
    b.append(1)

for i in range(2,n+1):
    if i==a[dame]:
        dame += 1
        b.append(0)
    else:
        c=(b[i-1]+b[i-2]) % MOD
        b.append(c)

#print(a,b)
print(b[n])


Measured memory_bytes: 18412
#include <iostream>

using namespace std;

bool is(const string s) {
  for (int i = 0; i < s.size() / 2; ++i) {
    if (s[i] != s[s.size() - i - 1]) return false;
  }
  return true;
}

int main() {
  string s;
  cin >> s;
  puts(is(s) && is(s.substr(0, s.size() / 2)) && is(s.substr((s.size() + 1) / 2)) ? "Yes" : "No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ft first
#define sd second
#define pb push_back
using namespace std;
const ll mod = 1e9+7;
const ll inf = 1e9+9;
 
ll power(ll a, ll b, ll m = mod) {
    ll x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
 
inline void mini(int &a, int b) {
    if(a > b) a = b;
}
const int N = 2e5+9;
// ll a[N], b[N];
pair<int, int> a[N];
int f[(1 << 18) + 9][55];
pair<int, int> from[(1 << 18)+9][55];
signed main() {  
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);        
    int n; cin >> n;  
    for(int i = 0; i < n; i++) {
        cin >> a[i].first;
    }
    for(int i = 0; i < n; i++) {
        cin >> a[i].second;
    }
    for(int i = 0; i <= (1 << n); i++) {
        for(int j = 0; j <= 50; j++) {
            f[i][j] = inf;
        }
    }
    f[0][0] = 0;
    for(int msk = 0; msk < (1 << n); msk++) {
        int pc = 0;
        vector<int> cands;
        vector<int> invs(n);
        for(int bit = n-1; bit >= 0; bit--) {
            if(~(msk >> bit) & 1) {
                cands.push_back(bit);
                invs[bit] = pc;
            } else {
                pc++;
            }
        }
        for(int last = 0; last <= 50; last++) {
            for(int k: cands) {
                if((k & 1) == (pc & 1)) {
                    // red
                    if(a[k].first >= last) {
                        int &x = f[msk ^ (1 << k)][a[k].first];
                        int y = f[msk][last] + invs[k];
                        if(x > y) {
                            x = y;
                            from[msk ^ (1 << k)][a[k].first] = {k, last};
                        }
                    }
                } else {
                    // blue
                    if(a[k].second >= last) {
                        int &x = f[msk ^ (1 << k)][a[k].second];
                        int y = f[msk][last] + invs[k];
                        if(x > y) {
                            x = y;
                            from[msk ^ (1 << k)][a[k].second] = {k, last};
                        }
                    }
                }
            }
        }
    }
    int ans = inf;
    int val = 0;
    for(int last = 1; last <= 50; last++) {
        if(ans > f[(1<<n)-1][last]) {
            ans = f[(1<<n)-1][last];
            val = last;
        }
    }
    if(ans == inf) ans = -1;
    cout << ans << "\n";
    /*int msk = (1<<n)-1, last = val;
    vector<int> print;
    while(msk > 0) {
        auto it = from[msk][val];
        val = it.second;
        msk ^= (1 << it.first);
        // cout << it.first << " ";
        print.push_back(it.first);
    }
    reverse(print.begin(), print.end());
    for(int i: print) cout << i << " ";
    cout << endl;
    for(int i = 0; i < n; i++) {
        if((i-print[i]) & 1) {
            cout << a[print[i]].second << " ";
        } else {
            cout << a[print[i]].first << " ";
        }
    }
    cout << endl;*/



 
    return 0;
    
}

Measured memory_bytes: 170240
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

int32_t less_i32(const void* a, const void* b) {
  return *(int32_t*)a - *(int32_t*)b;
}

int main() {
  while (1) {
    int32_t len, nstore, ndist;
    scanf("%d", &len);
    if (len == 0) break;
    scanf("%d%d", &nstore, &ndist);
    int32_t stores[nstore + 1];
    for (size_t i = 1; i < nstore; i++)
      scanf("%d", &stores[i]);
    stores[0] = 0;
    stores[nstore] = len;
    qsort(stores, nstore + 1, sizeof(int32_t), less_i32);
    int32_t sum = 0;
    for (int32_t i = 0; i < ndist; i++) {
      int32_t dist;
      scanf("%d", &dist);
      int32_t left = 0, right = nstore;
      while (right - left > 1) {
        int32_t middle = (left + right) / 2;
        if (stores[middle] <= dist)
          left = middle;
        else
          right = middle;
      }
      int32_t l_cost = dist - stores[left],
              r_cost = stores[right] - dist;
      sum += l_cost < r_cost ? l_cost : r_cost;
    }
    printf("%d\n", sum);
  }
  return 0;
}

Measured memory_bytes: 3344