akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s[n];
    for(int i=0;i<n;i++) cin >> s[i];
    bool ok = false;
    for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(s[i][j] == '#') ok = true;
    if(!ok){
    	cout << -1 << endl;
    	return 0;
    }
    int ans = mod;
    bool g[n];
    memset(g, 0, sizeof(g));
    for(int i=0;i<n;i++){
    	for(int j=0;j<n;j++){
    		if(s[i][j] == '#') g[j] = true;
    	}
    }
    for(int i=0;i<n;i++){
    	bool maki = 0, niko = 0;
    	int cnt = 0;
    	for(int j=0;j<n;j++){
    		if(s[i][j] == '.'){
    			if(g[i]) maki = true;
    			cnt++;
    			niko = true;
    		}
    	}
    	if(!maki) cnt++;
    	if(!niko) cnt = 0;
    	ans = min(ans, cnt);
    }
    for(int i=0;i<n;i++){
    	ok = false;
    	for(int j=0;j<n;j++){
    		if(s[j][i] == '.') ok = true;
    	}
    	if(ok) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}

/*
人1は安いところで売って高いところで買って代金を最大化する
人2は1の利益を下げる、合計コストはできるだけ減らす

1が依存する売り場、買い場の中で被る数の最小値だけ変化?

最大化の方法は、単調増加する2組で最も差の大きいところで売買
この組の数だけ変化させれば

単調増加する二組で差が最大のものは何通り?
あってN/2通り


最大値を記録しておき、それまでの最小値に出会う度に

S[i] をi以降の最大値とする
*/

int main() {
    ll N, T; cin >> N >> T;
    map<ll,ll> mp;
    vector<ll> A(N),U(N,0),L(N,0);
    for (int i = 0; i < N; i++) cin >> A[i];
    if (N == 1) {
        cout << 1 << endl; return 0;
    }
    U[N-1] = A[N-1]; L[0] = A[0];
    for (int i = N-2; i >= 0; i--) {
        U[i] = max(U[i+1],A[i]);
    }
    for (int i = 1; i < N; i++) {
        L[i] = min(L[i-1],A[i]);
    }
    for (int i = 0; i < N-1; i++) {
        if (i > 0 && (U[i] == U[i+1] && L[i] == L[i-1])) continue;
        mp[U[i+1]-L[i]]++;
    }
    cout << mp.rbegin()->second << endl;


}


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

int main (){
    string s;
    cin >> s;
    int start = 0 , end =0 ;
    for (int i=0 ; i < s.size() ; i++){
        if (s[i] == 'A'){
            start=i;
            for ( int j = s.size() - 1 ; j >= 0 ; j--){
                if (s[j] == 'Z'){
                    end =j;
                    //cout << start << " " << end << endl;
                    goto result;
                }
            }
        }
    }
result:
    cout << end - start+1 << endl;
    return 0;
}



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

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N+1), acc(N+1);
    rep(i, 1, N+1) cin >> A[i];
    sort(A.begin(), A.end());
    rep(i, 1, N+1) acc[i] = acc[i-1] + A[i];
    ll ans = 1;
    for(ll i = N-1; i > 0; i--){
        if(A[i+1] <= 2 * acc[i]){
            ans++;
        }else{
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<vector<pair<int, int>>> Tree(N);
	for (int i = 0; i < N - 1; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		Tree[a - 1].push_back({ b - 1,c });
		Tree[b - 1].push_back({ a - 1,c });
	}
	int Q, K;
	cin >> Q >> K;
	vector<long long> D(N, -1);
	queue<pair<int, long long>> Queue;
	Queue.push({ K - 1,0 });
	int nowdist = 0;
	while (!Queue.empty()) {
		auto p = Queue.front();
		Queue.pop();
		D[p.first] = p.second;
		for (const auto& e : Tree[p.first]) if (D[e.first] < 0) Queue.push({ e.first, p.second + e.second });
	}
	vector<long long> ans(Q);
	for (int i = 0; i < Q; i++) {
		int x, y;
		cin >> x >> y;
		ans[i] = D[x - 1] + D[y - 1];
	}
	for (long long a : ans) cout << a << endl;
}


Measured memory_bytes: 9972
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int x, a, b;
    scanf("%d%d%d", &x, &a, &b);
    if (a >= b)
    {
        printf("delicious\n");
    }
    else if (a + x >= b)
    {
        printf("safe\n");
    }
    else
    {
        printf("dangerous\n");
    }

    return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.util.stream.Collectors;

/**
 * ABC043 B
 *
 * @date 2020.08.22
 * @author 焼き鮭 <yaki-shake@up-tri.me>
 */

public class Main {
  Scanner sc;

  public static void main(String[] args) {
    new Main().execute();
  }

  public void execute() {
    this.sc = new Scanner(System.in);
    String commands = this.sc.next();
    String[] keys = commands.split("");
    ArrayList<String> output = new ArrayList<String>();
    for (String key : keys) {
      if (key.equals("B")) {
        if (0 < output.size()) {
          output.remove(output.size() - 1);
        }
      } else {
        output.add(key);
      }
    }

    System.out.println(output.stream().collect(Collectors.joining("")));
  }
}


Measured memory_bytes: 32552
K = int(input())

from collections import deque

nlist = deque([1,2,3,4,5,6,7,8,9])

for i in range(K):
    sample = nlist.popleft()
        
    if sample%10 != 0:
        nlist.append(sample*10 - 1 + sample%10)
            
    nlist.append(sample*10 + sample%10)
        
    if sample%10 != 9:
        nlist.append(sample*10 + 1 + sample%10)
    
print(sample)

Measured memory_bytes: 12372
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main() {
	/*
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif */
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);  
    int n;
    cin>>n;
    //ll a[n],b[n];
    ll ans=0;
    pair<ll,int> s[n];
    for(int i=0;i<n;i++){
    	int a,b;
    	cin>>a>>b;
    	//a--;b--;
    	s[i]={a+b,i};
    	ans-=b;
    }
    sort(s,s+n);
    reverse(s,s+n);
    for(int i=0;i<n;i+=2){
    	ans+=s[i].first;
    }
    cout<<ans;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)

using ll = long long;
using namespace std;

int main() {
    std::string S;
    cin >> S;
    int N = S.length();
    vector<int> c(N + 1);
    c[0] = 0;
    REP(i, N) {
        c[i + 1] = c[i];
        if (S[i] == 'W') {
            c[i + 1]++;
        }
    }

    ll ans = 0;
    REP(i, N) {
        if (S[i] == 'B') {
            ans += c[N] - c[i + 1];
        }
    }

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


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

#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
const double pi = 3.14159265358979;



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

    ll n,m;
    cin >> n >> m;
    vector<vector<ll>> to(100005, vector<ll>());
    for (ll i = 0;i < m;i++){
        ll a,b;
        cin >> a >> b;
        a--; b--;

        to[a].push_back(b);
        to[b].push_back(a);
    }

    /*for (ll i = 0; i < n; i++){
        for (auto j : to[i]){
            cout << j+1 << " ";
        }
        cout << endl;
    }*/

    queue<ll> q;
    vector<ll> dist(n,INF);
    vector<ll> pre(n,-1);

    dist[0] = 0;
    q.push(0);

    while (!q.empty()){
        ll v = q.front();
        q.pop();

        for (auto u : to[v]){
            if (dist[u] != INF) continue;

            dist[u] = dist[v] +1;
            pre[u] = v;
            q.push(u);

        }
    }

    cout << "Yes" << endl;
    for (ll i = 1; i < n; i++){
        cout << pre[i] +1 << "\n";
    }
}

Measured memory_bytes: 13560
N,M = map(int,input().split())
S = input()

ans = []
i = N
while i>0:
    if i <= M:
        ans.append(i)
        break
    for j in range(M,0,-1):
        if S[i-j]=='1': continue
        ans.append(j)
        i -= j
        break
    else:
        print(-1)
        exit()
print(*ans[::-1])

Measured memory_bytes: 6372
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class D {
public:

    vector<P> graph[200005];
    vector<bool> used;
    vector<int> potential;
    bool ret;

    void dfs(int p, vector<int>& v) {
      used[p] = true;
      v.push_back(p);
      for(auto e: graph[p]) {
        if (!used[e.first]) {
          potential[e.first] = e.second - potential[p];
          dfs(e.first, v);
        } else {
          // sanity check
          if (e.second - potential[p] != potential[e.first]) {
            ret = false;
          }
        }
      }
    }


    void solve(istream& cin, ostream& cout) {
      SPEED;
      int r, c; cin >> r >> c;
      used.resize(r+c);
      potential.resize(r+c);
      ret = true;
      int n; cin >> n;
      rep(i, n) {
        int x, y, a; cin >> x >> y >> a;
        x--; y--;
        graph[x].emplace_back(y+r, a);
        graph[y+r].emplace_back(x, a);
      }

      for(int i=0; i<r+c; i++) {
        vector<int> v;
        dfs(i, v);
        int mix = INT_MAX/2;
        int miy = INT_MAX/2;
        for(auto e: v) {
          if (e < r) {
            chmin(mix, potential[e]);
          } else {
            chmin(miy, potential[e]);
          }
        }
        if (mix + miy < 0) {
          ret = false;
        }
      }
      cout << (ret ? "Yes" : "No") << endl;

    }
};

signed main() {
  D solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

int main() {
    int x[3];
    for(int i=0; i<3; i++){
        cin>>x[i];
    }
    sort(x, x+3);
    int num;
    if(x[1]!=x[2]){
        if(((x[2]-x[0])+(x[2]-x[1]))%2==0){
            num=((x[2]-x[0])+(x[2]-x[1]))/2;
        }else{
            num=1+((x[2]-x[0])+(x[2]-x[1])+1)/2;
        }
    }else{
        if((x[2]-x[0])%2==0){
            num=(x[2]-x[0])/2;
        }else{
            num=1+(x[2]-x[0]+1)/2;
        }
    }
    cout<<num<<endl;
    return 0;
}


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

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

typedef pair<int, int> pint;

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front

#define MOD (1000 * 1000 * 1000 + 7)

signed main() {
    int N, K;
    string S;

    cin >> N >> K >> S;

    vector<int> cont;


    if (S[0] == '0') {
        cont.pb(0);
        cont.pb(1);
    } else {
        cont.pb(1);
    }

    REPS(i, N-1) {
        if (S[i-1] == S[i]) {
            cont.back()++;
        } else {
            cont.pb(1);
        }
    }
    if (SZ(cont) % 2 == 0) {
        cont.pb(0);
    }


    // REP(i, SZ(cont)) {
    //     cout << cont[i] << " ";
    // }
    // cout << endl;

    int ans = 0;
    if (SZ(cont) / 2 <= K) {
        ans = N;
    } else {
        int sum = 0;
        REP(i, K*2+1) {
            sum += cont[i];
        }
        ans = max(ans, sum);

        for (int i=0;i*2+1+K*2+1<SZ(cont);i++) {
            sum -= cont[i*2] + cont[i*2+1];
            sum += cont[i*2 + K*2+1] + cont[i*2+1+K*2+1];

            ans = max(ans, sum);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1020
using System;
using System.IO;
using System.Linq;

class Program
{
    static void Solve()
    {
        var N = ReadInt();
        var H = ReadInts();

        var max = H[0];
        var ans = 0;

        for (var i = 0; i < N; i++)
        {
            if (H[i] >= max)
            {
                ans++;
                max = H[i];
            }
        }

        Console.WriteLine(ans);
    }

    static void Main(string[] args)
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }

    public static string Read() { return Console.ReadLine(); }
    public static int ReadInt() { return int.Parse(Read()); }
    public static long ReadLong() { return long.Parse(Read()); }
    public static double ReadDouble() { return double.Parse(Read()); }

    public static string[] Reads() { return Console.ReadLine().Split(' '); }
    public static int[] ReadInts() { return Reads().Select(_ => int.Parse(_)).ToArray(); }
    public static long[] ReadLongs() { return Reads().Select(_ => long.Parse(_)).ToArray(); }
    public static double[] ReadDoubles() { return Reads().Select(_ => double.Parse(_)).ToArray(); }
}


Measured memory_bytes: 13396
N, Y = map(int, input().split())

for x in range(N+1):
    for y in range(N-x+1):
        if 10000*x + 5000*y + 1000*(N-x-y) == Y:
            print(x, y, N-x-y)
            exit() # 処理を終わらせる
print(-1, -1, -1)

Measured memory_bytes: 3060
from collections import deque

n,m=map(int,input().split())
turo=[[] for _ in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  turo[a].append(b)
  turo[b].append(a)
  
q=deque([1])
heya=[0]*(n+1)
heya[1]=1
mejirushi=[0]*(n+1)
while len(q)!=0:
  v=q.popleft()
  for i in turo[v]:
    if heya[i]==0:
      heya[i]=1
      mejirushi[i]=v
      q.append(i)
print("Yes")
for i in range(2,n+1):
  print(mejirushi[i])

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

int main()
{
	int iRow, iCol, iTemp, iCalc;
	std::vector<std::vector<int>> vvi_matrix;
	std::vector<int> vi_mult;
	std::vector<int> vi_calc;

	//行列の行数と列数を入力
	std::cin >> iRow >> iCol;

	//行列の要素を格納する
	for (int i = 0; i < iRow; i++) {
		std::vector<int> vi_matrix;
		for (int j = 0; j < iCol; j++){
			std::cin >> iTemp;
 			vi_matrix.push_back(iTemp);
		}
		vvi_matrix.push_back(vi_matrix);
	}
	//かけるやつを格納する
	for (int i = 0; i < iCol; i++) {
		std::cin >> iTemp;
		vi_mult.push_back(iTemp);
	}
	//行列の掛け算をする
	for (int i = 0; i < iRow; i++) {
		iCalc = 0;
		for (int j = 0; j < iCol; j++) {
			iCalc += vvi_matrix[i][j] * vi_mult[j];
		}
		vi_calc.push_back(iCalc);
	}
	//掛け算をした結果を出力する
	for (unsigned int i = 0; i < vi_calc.size(); i++) {
		std::cout << vi_calc[i] << std::endl;
	}
    return 0;
}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

const int N=188,M=19;
short f[N][N][N][M];
short g[N][N][N][M];
int s[N][N],n,m;
char a[N][N];

int empty(int u,int d,int l,int r){
	int sum=s[d][r]-s[d][l-1]-s[u-1][r]+s[u-1][l-1];
	return sum==0||sum==(r-l+1)*(d-u+1);
}

short F(int L,int U,int D,int k);
short G(int U,int L,int R,int k);

short F(int L,int U,int D,int k){
	if(L>m)return m;
	short &res=f[L][U][D][k];
	if(res!=-1)return res;
	if(k==0){
		int l=L-1,r=m,mid;
		while(l<r){
			mid=(l+r+1)>>1;
			if(empty(U,D,L,mid))l=mid;
			else r=mid-1;
		}
		//printf("%d %d %d %d  %d\n",L,U,D,k,l);
		return res=l;
	}
	int A=F(F(L,U,D,k-1)+1,U,D,k-1);
	int l=L-1,r=m,mid;
	while(l<r){
		mid=(l+r+1)>>1;
		if(G(G(U,L,mid,k-1)+1,L,mid,k-1)>=D)l=mid;
		else r=mid-1;
	}
	//printf("%d %d %d %d  %d\n",L,U,D,k,max(A,l));
	return res=max(A,l);
}
short G(int U,int L,int R,int k){
	if(U>n)return n;
	short &res=g[U][L][R][k];
	if(res!=-1)return res;
	if(k==0){
		int l=U-1,r=n,mid;
		while(l<r){
			mid=(l+r+1)>>1;
			if(empty(U,mid,L,R))l=mid;
			else r=mid-1;
		}
		return res=l;
	}
	int A=G(G(U,L,R,k-1)+1,L,R,k-1);
	int l=U-1,r=n,mid;
	while(l<r){
		mid=(l+r+1)>>1;
		if(F(F(L,U,mid,k-1)+1,U,mid,k-1)>=R)l=mid;
		else r=mid-1;
	}
	return res=max(A,l);
}

int main(){
	scanf("%d%d",&n,&m);
	rep(i,1,n){
		scanf("%s",a[i]+1);
		rep(j,1,m)
			s[i][j]=s[i-1][j]+s[i][j-1]
				-s[i-1][j-1]+(a[i][j]=='#');
	}
	int ans=0;
	memset(f,-1,sizeof f);
	memset(g,-1,sizeof g);
	while(F(1,1,n,ans)<m)ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 493696
#include"iostream"

using namespace std;

int main()
{
	int a[10];
	int i,j,temp;
	for(i=0;i<10;i++)
		cin>>a[i];
	for(i=0;i<10;i++)
	{
		for(j=i+1;j<10;j++)
		{
			if(a[i]<a[j])
			{
				temp = a[i];
				a[i] = a[j];
				a[j] = temp;
			}
		}
	}
	for(i=0;i<3;i++)
		cout<<a[i]<<endl;
	return 0;
}

Measured memory_bytes: 3072
#include<iostream>
#include<vector>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
using namespace std;
int a_1(int a) {//素数判定
	int x = 0;
	for (int i = 2; i < a; i++) {
		if (a % i == 0)x++;
	}
	if (x == 0) {
		return 0;//素数であるとき
	}
	if (x != 0) {
		return 1;//素数でないとき
	}
}
int yakusuu(int n) {
	int ans = 1;
	for (int i = 2; i <= sqrt(n); i++) {
		int cnt = 0;
		while (n % i == 0) {
			cnt++;
			n /= i;
		}
		ans *= (cnt + 1);
		if (n == 1) break;
	}
	if (n != 1) ans *= 2;
	return ans;
}
int gcd(int a, int b) {
	if (a < b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}
	return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
	return a * b / gcd(a, b);
}
int main() {
	int a, b, c, ans = 0;
	cin >> a >> b >> c;
	for (int i = a; i <= b; i++) {
		if (c % i == 0)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  int n;
  cin >> n;
  if(n/10 == 9 || n%10 == 9) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    int n,a,b;
    cin>>n>>a>>b;
    int ans=0;
    rep(i,1,n+1){
        int x=i;
        int sum=0;
        while(x>0){
            sum+=x%10;
            x/=10;
        }
        if(a<=sum&&sum<=b)ans+=i;
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
def dfs(num, lst, d, f, cnt):
    if d[num] != 0:
        return cnt - 1
    d[num] = cnt
    for n in lst[num]:
        cnt += 1
        cnt = dfs(n - 1, lst, d, f ,cnt)
    cnt += 1
    f[num] = cnt
    return cnt


n = int(input())
d = [0 for i in range(n)]
f = [0 for i in range(n)]
lst = []
for _ in range(n):
    n = list(map(int, input().split()))
    lst.append(n[2:])

cnt = 1
while 0 in d:
    num = d.index(0)
    cnt = dfs(num, lst, d, f, cnt) + 1

for i, j in enumerate(zip(d, f)):
    print(i + 1, j[0], j[1])


Measured memory_bytes: 5712
#include<iostream>
using namespace std;
int main() {
    char ch;
    cin >> ch;
    string s = "aiueo";
    for (int i = 0; i < s.size(); i++) {
        if (ch == s[i]) {
            cout << "vowel" << endl;
            return 0;
        }
    }
    cout << "consonant" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)

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

int main(){
  int h,w,n;
  cin >> h >> w >> n;
  int black_cnt=0;
  int ans = 0;
  while(n>black_cnt){
    black_cnt += max(h,w);
    ans ++;
  }
  cout<< ans <<endl;
}


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

long long solve(std::vector<int> d)
{
    const int n = d.size();
    std::vector<int> count;

    if (d[0] != 0) {return 0;}

    std::sort(d.begin(), d.end(), std::less<int>());

    // 各距離のカウント
    count.resize(d[n - 1] + 1);

    int num = 0;
    int ptr = 0;
    for (int i = 1; i < n; i++) {
        if (d[i] != num) {
            count[num] = i - ptr;
            num = d[i];
            ptr = i;
        }
    }
    count[num] = n - ptr;

    if (count[0] != 1) {return 0;}

#ifdef _DEBUG
    for (int i = 0; i < count.size(); i++) {
        std::cout << i << ": " << count[i] << std::endl;
    }
#endif

    long long ans = 1;

    for (int i = 1; i < count.size(); i++) {
        for (int j = 0; j < count[i]; j++) {
            ans *= count[i - 1];
            ans %= 998244353;
        }
    }

    return ans;
}

int main(int argc, char *argv[])
{
    int n;
    std::vector<int> d;
    long long ans;

    std::cin >> n;

    d.resize(n);

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

    ans = solve(d);

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) {
 if (a < b) { a = b; return true; } return false; 
 }
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
 }
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  
  vvll t(n,vll(0));
  rep(i,n-1){
    ll a,b;
    cin>>a>>b;
    a--;
    b--;
    t[a].pb(b);
    t[b].pb(a);
  }
  vll f(n);
  vll ss(n);
  queue<ll> p;
  vb ch(n,false);
  p.pu(0);
  ch[0]=true;
  while(sz(p)){
    ll s=p.front();
    p.pop();
    for(auto pp:t[s]){
      if(ch[pp]) continue;
      ch[pp]=true;
      f[pp]=f[s]+1;
      p.pu(pp);
    }
  }
  vb cch(n,false);
  p.pu(n-1);
  cch[n-1]=true;
  while(sz(p)){
    ll s=p.front();
    p.pop();
    for(auto pp:t[s]){
      if(cch[pp]) continue;
      cch[pp]=true;
      ss[pp]=ss[s]+1;
      p.pu(pp);
    }
  }
  ll ff=0;
  ll sss=0;
  rep(i,n){
    if(f[i]<=ss[i]){
      ff++;
    }
    else sss++;
  }
  if(ff>sss)COUT("Fennec");
  else COUT("Snuke");
}


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

//関数
bool tasai(string s){
    bool result=true;
    if(s.size()==0){
        result=false;
    }
    for(int i=0;i<s.size();i++){
        for(int j=0;j<s.size();j++){
            if(s.at(i)==s.at(j) && i!=j){
                result =false;
            }
        }
    }
    
    return result;
}
    
    
    
//main関数
int main() {
    
    
    
    //入力
    string S;
    cin>>S;
    
    
    
    
    
    
    
    
    
    //計算
    string ans;
    if(S.size()<26){
        for(int i='a';i<='z';i++){
            char some=i;
            if(tasai(S+some)){
                ans=S+some;
                break;
            }
        }
    }else if(S=="zyxwvutsrqponmlkjihgfedcba"){
        ans="-1";
    }else{
        bool done=false;
        vector<int> alpha(200);
        for(int i=0;i<26;i++){
            int cha=S.at(25-i);
            S=S.substr(0,25-i);
            
            
            alpha.at(cha)++;
            int alter=0;
            for(int j=cha+1;j<200;j++){
                if(alpha.at(j)>0){
                    alter=j;
                    done=true;
                    char alt=alter;
                    ans=S+alt;
                    break;
                }
            }
            if(done) break;
        }
    }
    
    
    
    
    
    //出力
    cout <<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n, t;
    cin >> n >> t;
    VP ab(n);
    rep(i,n) cin >> ab[i].first >> ab[i].second;
    sort(all(ab));
    VVL dp(n+1, VL(t+1));
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= t; j++){
            dp[i+1][j] = max(dp[i][j], dp[i+1][j]);
            if (j != t){
                int col = min(j+ab[i].first, t);
                dp[i+1][col] = max(dp[i+1][col], dp[i][j] + ab[i].second);
            }
        }
    }
    cout << dp[n][t] << endl;
    return 0;
}

Measured memory_bytes: 73748
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
using ll = long long;
using namespace std;

int main(){
	int N;
	cin >> N;
	int ans = 0;
	for( int i = 0; i < N; ++i ){
		int cnt = 0;
		int a;
		cin >> a;
		while( a % 2 == 0 ){
			a = a/2;
			cnt++;
		}
		ans += cnt;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	int H, W;
	cin >> H >> W;
	vector<vector<char>> P(H, vector<char>(W));
	vector<bool> Y(H, false);
	vector<bool> X(W, false);
	
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> P[i][j];
			if(P[i][j] == '#')Y[i] = true;
		}
	}
	
	for(int j = 0; j < W; j++){
		for(int i = 0; i < H; i++){
			if(P[i][j] == '#')X[j] = true;
		}
	}
	
	for(int i = 0; i < H; i++){
		if(Y[i]){
			for(int j = 0; j < W; j++){
				if(X[j]){
					cout << P[i][j];
				}
			}
			cout << '\n';
		}
	}
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        int M = scanner.nextInt();

        int x = 1900 * M + 100 * (N-M);

        int pow = (int)Math.pow(2, M);

        System.out.println(x * pow);

    }
}


Measured memory_bytes: 21844
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
     
using namespace std;
     
typedef long long ll;
typedef pair<ll, int> pii;
     
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
     
mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count());

int main(){
    fastIO;
    int n;
    cin >> n;
    int a, b;
    cin >> a >> b;
    if((b-a) % 2 == 0)
        cout << "Alice";
    else
        cout << "Borys\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

int max(int a, int b){
  return a >= b ? a : b;
}
int min(int a, int b){
  return b >= a ? a : b;
}
int sei(int a){
  return a>0 ? a : 0;
}
int factorial(int n) {
    if (n > 0) return n*factorial(n - 1);
		else return 1;
}
int compare_up_int(const void *a, const void *b){
   return *(int*)a - *(int*)b;
}
int compare_down_int(const void *a, const void *b){
   return *(int*)b - *(int*)a;
}
int euclid(int a, int b){
  if(a < b){int tmp = a;a = b;b = tmp;}
  int r = a % b;
  if(r < 0) r += b;
  while(r != 0){
    a = b;b = r;r = a % b;
    if(r < 0) r += b;
  }
  return b;
}

int main(){
  long long int N,count=0,c[5]={0,0,0,0,0};
  scanf("%lld",&N);
  char s[N];
  for(int i=0;i<N;i++) scanf("%s\n",&s[i]);
  for(int i=0;i<N;i++){
    //printf("%c",s[i]);
    if(s[i]=='M')c[0]+=1;
    else if(s[i]=='A')c[1]++;
    else if(s[i]=='R')c[2]++;
    else if(s[i]=='C')c[3]++;
    else if(s[i]=='H')c[4]++;
  }
  for (int i = 0; i < 5; i++) {
		for (int j = i + 1; j < 5; j++) {
			for (int k = j + 1; k < 5; k++) {
				count += c[i] * c[j] * c[k];
			}
		}
	}
    printf("%lld",count);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <random>
#include <chrono>
#include <iomanip>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define endl '\n'
#define debug(name) DEBUG(#name, (name))
template<typename T>
void DEBUG(string label, T value) {
    cerr << "[" << label << " = " << value << "]\n";
}

void solve(){
    int x, y;
    cin >> x >> y;
    if((y - 2 * x) % 2 != 0){
        cout << "No\n";
        return;
    }
    int b = (y - 2 * x)/2;
    if(b >= 0 && b <= x){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
}
int main(int argv, char **argc){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t;
    t  = 1;
    while(t--)
        solve();

}


Measured memory_bytes: 3664
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	string in;
	cin>>in;
	for(long long a=0;a<=in.length()-1;a++)
	{
		if(in[a]!=',')
		{
			cout<<in[a];
		}
		else
		{
			cout<<" ";
		}
	}
	cout<<endl;
} 

Measured memory_bytes: 256
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	string S, T;
	cin >> S >> T;

	int ans = 0;
	for (int i=0; i<S.size(); i++) {
		if (S[i] != T[i]) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
#define optimizar_io ios_base::sync_with_stdio(false);cin.tie(0);

int main() {
	optimizar_io

	int N, d[110];

	cin >> N;
	for (int i = 0; i < N; i++) cin >> d[i];
	int sum = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++)
			sum += d[i] * d[j];
	}
	cout << sum << "\n";
	return 0;
}

Measured memory_bytes: 256
from itertools import *

def yuc(a,b):
  c=a%b
  while c!=0:
    a=b
    b=c
    c=a%b
  return b

n=int(input())
ar=list(range(1,n+1))
ans=0

for tup in combinations_with_replacement(ar,3):
  if tup[0]==tup[1]==tup[2]:
    ans+=tup[0]
  elif tup[0]==tup[1]:
    ans+=3*yuc(tup[0],tup[2])
  elif tup[1]==tup[2]:
    ans+=3*yuc(tup[0],tup[1])
  elif tup[0]==tup[2]:
    ans+=3*yuc(tup[0],tup[1])
  else:
    ans+=6*yuc(tup[0],yuc(tup[1],tup[2]))
print(ans)



Measured memory_bytes: 9240
#include<bits/stdc++.h>
using namespace std;
int a[100000+10];
long long p=1e9+7;
long long ksm(int n){
	long long sum=1;
	long long d=2;
	while(n){
		if(n%2) sum=sum*d;
		sum=sum-(sum/p)*p;
		n/=2;
		d=(d*d);
		d=d-(d/p)*p;
	}
	return sum;
}
int main()
{
	int n;
	while(~scanf("%d",&n)){
		memset(a,0,sizeof(a));
		for(int i=1;i<=n;i++){
			int t;
			scanf("%d",&t);
			a[t]++;
		}
		int flag=0;

		if(n%2){
			for(int i=n%2-1;i<n;i+=2){
				if(i==0){
					if(a[i]!=1){
						printf("0\n");
						flag=1;
						break;
					}
				}else if(a[i]!=2){
					printf("0\n");
					flag=1;
					break;
				}else if(a[i+1]){
					printf("0\n");
					flag=1;
					break;
				}
			}
			if(!flag){
				long long sum=ksm(n/2);
				printf("%lld\n",sum);
			}
		}else{
			for(int i=(n-1)%2;i<n;i+=2){
				if(a[i]!=2){
					printf("0\n");
					flag=1;
					break;
				}else if(a[i+1]){
					printf("0\n");
					flag=1;
					break;
				}
			}
			if(!flag){
				long long sum=ksm(n/2);
				printf("%lld\n",sum);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <time.h>
#include <stack>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <set>

using namespace std;

const int N = 2005;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;

int n , a , b;
int mas[N];

int main(){
    cin>>n>>a>>b;
    for(int i=1;i<=n;i++) scanf("%d",&mas[i]);
    int answ = abs(mas[n] - b);
    if(n != 1) answ = max(answ , abs(mas[n - 1] - mas[n]));
    cout<<answ<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        String c=scan.next();
        int w=0;
        for(int i=0;i<N;i++){
            String h=c.substring(i,i+1);
            if (h.equals("W")){w++;}
            }
        int p=0;
        c=c+"B";
        for(int i=1;i<=w;i++){String j=c.substring(N-i,N+1-i);
            if(j.equals("R")){p++;}
        }
        System.out.println(p);
    }
}


Measured memory_bytes: 45960
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner s=new Scanner(System.in);
		int r=s.nextInt();
		int c=s.nextInt();
		int n=s.nextInt();
		int k=Math.max(r,c);
		int d=n/k;
		int g=n%k;
		if(g==0)
		System.out.println(d);
		else
		System.out.println(d+1);}}

Measured memory_bytes: 21712
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
from functools import reduce
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
def lcm_base(a, b):
    return (a * b) // gcd(a, b)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def main():
  N, K = map(int, readline().split())
  R, S, P = map(int, readline().split())
  T = read().rstrip().decode('utf-8')
  k_to_word = [[] for _ in range(K)]
  for i, x in enumerate(T):
    k = i% K
    k_to_word[k].append(x)
  
  def solve(A):
    r, s, p = 0, 0, 0
    for x in A:
      if x == 'r':
        #筐体がグーを出したときに、グーチョキパーそれぞれを出すと、どう点数が増加するか
        r, s, p = max(s,p), max(r,p), max(r,s)+P
      elif x == 's':
        r, s, p = max(s,p)+R, max(r,p), max(r,s)
      elif x == 'p':
        r, s, p = max(s,p), max(r,p)+S, max(r,s)
    return max(r,s,p)
  
  ans = sum(solve(A) for A in k_to_word)
  print(ans)
  
  
  
if __name__ == '__main__':
  main()

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

using namespace std;
using ll = long long int;
#define long ll

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

    ll a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    c *= 2;

    ll r = 1e9;
    for(ll t=0; t <= max(x, y); t++)
        r = min(r, t*c + max(0ll, x-t)*a + max(0ll, y-t)*b);
    cout << r << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007


ll cal(ll a){
	ll sum;
	if(a%2==0){
		sum=(a-2)/2;
	}
	else{
		sum=(a-1)/2;
	}
	sum++;
	sum%=2;
	if(a%2==0){
		a=sum^a;
	}
	else{
		a=sum;
	}
	return a;
}

int main() {
	ll a,b;
	cin>>a>>b;
	a=max(a-1,ll(0));
	//cout <<cal(a)<<endl;
	//cout << cal(b)<<endl;
	cout << ll(cal(b)^cal(a));
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;

int GCD(int x, int y) {
	return x ? GCD(y % x, x) : y;
//xが0以外なら、GCD(y % x, x) の結果を返し
//xが0ならyを返す
}
int main() {
	int n;
	cin >> n;
	double  sum=0.0000000000;
	rep(i, n) {
		double x;
		string u;
		cin >> x >> u;
		//cout << x <<endl<< u << endl;
		if (u == "JPY") {
			sum += x;
		}
		else {
			x= x * 380000.0;
			
			sum += x;
		}
		
	}
	cout <<std::setprecision(8)<< sum << endl;
	
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
int INF = 1000000007;
int dp[30][200000]; // i???????????§????????????????????£???j???????????????????°??????????????????°

int main(){
  int n,m;
  int c[30];

  cin >> n >> m; //??\???
  rep(i,m){
    cin >> c[i] ;
  }
  
  rep(j,30){    // ?????????
    rep(i,200000){  
      dp[j][i] = INF;
    }
  }
  rep(j,30){
    dp[j][0] = 0;
  }

  for(int i = 1;i<m+1;i++){
    for(int j = 0;j<n+1;j++){
      if(j-c[i-1] >= 0 )
	dp[i][j] = min( dp[i][j-c[i-1]]+1, dp[i-1][j] );
      else
 	dp[i][j] =  dp[i-1][j] ;
    }
  }
  cout << dp[m][n] << endl;
  return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main() {
    int h1, m1, h2, m2, k; 
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int t1 = h1*60 + m1;
    int t2 = h2*60 + m2;
	cout << max(t2-t1-k, 0) << endl;
	return;
}

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

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

#define EQ(a,b) (abs((a)-(b)) < EPS)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define sz size()
#define all(a) (a).begin(),(a).end()

using namespace std;
typedef long double D;
typedef complex<D> P;
typedef pair<P,P> L;
typedef vector<P> Poly;
typedef pair<P,D> C;

const D EPS = 1e-8;
const D PI = acos(-1);

const int MAX_X = 1000, MAX_Y = 1000;

//for vector
inline P unit(P p){return p/abs(p);}

inline pair<P,P> norm(P p){return make_pair(p*P(0,1),p*P(0,-1));}

inline D dot(P x, P y){return real(conj(x)*y);}

inline D cross(P x, P y){return imag(conj(x)*y);}

inline bool para(L a,L b){return abs(cross(a.fs-a.sc,b.fs-b.sc))<EPS;}

inline int ccw(P a,P b,P c){
  b -= a;c -= a;
  if (cross(b,c)>EPS) return 1;   //counter clockwise
  if (cross(b,c)<-EPS) return -1; //clockwise
  if (dot(b, c)<-EPS) return 2;   //c--a--b on line
  if (abs(b)+EPS<abs(c)) return -2;   //a--b--c on line
  return 0;                       //on segment
}

inline bool is_cp(L a,L b){
  if(ccw(a.fs,a.sc,b.fs)*ccw(a.fs,a.sc,b.sc)<=0)
    if(ccw(b.fs,b.sc,a.fs)*ccw(b.fs,b.sc,a.sc)<=0)return true;
  return false;
}

inline P line_cp(L a,L b){
  return a.fs+(a.sc-a.fs)*cross(b.sc-b.fs,b.fs-a.fs)/cross(b.sc-b.fs,a.sc-a.fs);
}

inline D area(Poly p){
  if(p.sz<3)return 0;
  D res = cross(p[p.sz-1],p[0]);
  rep(i,p.sz-1)res += cross(p[i],p[i+1]);
  return res/2;
}

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

  Poly p(n);
  rep(i,n){
    int x,y;
    cin >> x >> y; x*=2; y*=2;
    p[i] = P(x,y);
  }

  D S = area(p);

  vector< vector<D> > v(4*MAX_X+1);
  for(int i=-2*MAX_X;i<=2*MAX_X;i++){
    L l = L( P(i,-2*MAX_Y-1), P(i,2*MAX_Y+1) );
    for(int j=0;j<n;j++){
      L seg = L( p[j], p[(j+1)%n] );
      if(!para(seg,l) && is_cp(seg,l)){
	P cp = line_cp(seg,l);
	if( abs(cp - (seg.fs.real()<seg.sc.real()?seg.sc:seg.fs)) > EPS){
	  v[i+2*MAX_X].push_back(cp.imag());
	}
      }
    }
    sort(v[i+2*MAX_X].begin(), v[i+2*MAX_X].end());
  }

  D sum = 0;
  for(int i=0;i<2*MAX_X;i++){
    assert(v[2*i].size()%2 == 0 && v[2*i+1].size()%2 == 0);
    assert(v[2*i].size() == v[2*i+1].size());

    for(int j=0;j<v[2*i].size();j+=2){
      sum += (abs(v[2*i][j]-v[2*i][j+1])+abs(v[2*i+1][j]-v[2*i+1][j+1]))/2;
    }
  }

  cout << fixed << setprecision(9) << max(sum,S-sum)/4 << endl;
}

Measured memory_bytes: 9444
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <set>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>
#include <queue>
#include <map>

#define fir first
#define sec second
#define sz(s) (s).size();
#define pb push_back
#define get(n) scanf("%d",&n);
#define gets(s) string s;cin >> (s);
#define prfi(n) printf("%d", &n);
#define prfd(n) printf("%lf", &n);
#define All(s) (s).begin(), (s).end()
#define rep(i,j,k) for(int (i)=(j);(i)<=(k);(i)++)
#define repdown(i, j, k) for(int (i)=(j);(i)>=(k);(i)--)
#define dump(x)  std::cout << #x << " = " << (x) << std::endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using ll = long long;
using vi = std::vector<int> ;
using vvi = std::vector<vi> ;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double> ;
using vvd = std::vector<vd> ;
using qi = std::queue<int> ;
using vpii = std::vector<std::pair<int, int> >;
using namespace std;

const int Mod = (1e9) + 7;
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = 10241024;
const ll LINF = 1001002003004005006ll;

//_____________________________________Templates_________________________________________//

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

//mainly use for dynamic prog
template<class T1, class T2>
void update(T1 &a, T2 b){
  a += b;
  if(a > Mod) a %= Mod;
}

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

//_____________________array calc____________________________________//
/*
vvi mul(vvi &A, vvi &B){
  vvi C(A.size(), vi(B.size()))
  rep(i,A.size()){
    rep(j,B.size()){
      rep(k,B[0].size()){
        C[i][j] = (C[i][j] A[i][k] + B[k][j]) % Mod;
      }
    }
  }

  return C;
}

vvi pow(vvi A, ll n){
  vvi B(A.size(), vi(A.size()));
  rep(i=0;i<A.size();i++){
    B[i][i] = 1;
  }

  while (n >0){
    if (n & 1) B = mul(B, A);
    A = mul(A, A);
    n = n >> 1;
  }
  return B;
}
*/
//_____________________Bynary Indexed Tree __________________________//
/*
const max_st = (1 << 15) - 1;
int bit[max_st];
int sum (int i){
  int s = 0;
  while(i > 0){
    s += bit[i];
    i -= i & -i;
  }
  return s;
}

void add(int i, int x){
  while(i <= n){
    bit[i] += x;
    i += i & -i;
  }
}
*/
//_____________________　following sorce code_________________________//
const int MX = (1e5)+5;
vll dp(MX+1,LINF);
int main () {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n,w;IN(n,w);
  dp[0] = 0;
  rep(i,0,n-1){
    int a,b;IN(a,b);
    repdown(j,MX,b){
      chmin(dp[j],dp[j-b]+a);
    }
  }
  ll ans = 0;
  rep(i,0,MX){
    if(dp[i]<=w)chmax(ans, i);
  }
  OUT(ans);
  return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int maxn = 1e6 + 7;
const int INF = 0x3f3f3f3f;

int a[maxn];

int main() {
    int n;
    while(~scanf("%d",&n)) {
        for(int i = 1 ; i <= n ; i++) {
            scanf("%d",&a[i]);
        }
        sort(a+1,a+n+1);
        int ans = INF;
        for(int i = a[1] ; i <= a[n] ; i++) {
            int res = 0;
            for(int j = 1 ; j <= n ; j++) {
                res += (i - a[j]) * (i - a[j]);
            }
            ans = min(ans,res);
        }
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <math.h>
//#include <vector>
//#include <string>
//typedef long long LL;
using namespace std;

int main(){
    int a;
    int b;
    int ans;
    cin >> a >> b;
    if(a<2*b){
        ans = 0;
    }else{
        ans = a - 2*b;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{ 
	int n,k,ans=1;
	cin>>n>>k;
	while(n>0)
	{
		if(ans>k)
		{
			ans+=k;
			n--;
		}
		else
		{
			ans+=ans;
			n--;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip> 
typedef long long ll;

using namespace std;

int main()
{
	int n, k;
	int h[100001];

	cin>>n>>k;
	for(int i = 1; i <= n; i++) cin >> h[i];
	vector<int> v(n);
  for (size_t i = 0; i < n; i++) {
    v[i] = h[i + 1];
  }
	sort(v.begin(), v.end());
	auto itr = lower_bound(v.begin(), v.end(), k);
	int ans = distance(itr, v.end());
	cout << ans;

	return 0;
}


Measured memory_bytes: 1024