akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define ll long long
#define MAX 300005
#define pp pair<int,int>
#define pb push_back
#define mod 10

using namespace std;
/*
 * author: Kruti_20
 */
ll power(ll x, ll y);

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll dp[MAX][105];
ll w[MAX], v[MAX];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, W;
    cin >> n >> W;
    for (int i = 1; i <= n; i++) cin >> w[i] >> v[i];
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= W; j++) {
            dp[j][i] = max(dp[j][i], dp[j][i - 1]);
            if (j + w[i] <= W) dp[j + w[i]][i] = max(dp[j + w[i]][i], dp[j][i-1] + v[i]);
        }
    }
    ll maxm = 0;
    for (int i = 0; i <= W; i++) maxm = max(maxm, dp[i][n]);
    cout << maxm;
    return 0;
}


ll power(ll x, ll y) {
    ll res = 1;
    x = x % mod;
    while (y > 0) {
        if (y & 1) res = (res * x) % mod;
        y = y >> 1;
        x = (x * x) % mod;
    }
    return res;
}

Measured memory_bytes: 86272
import java.awt.geom.Line2D;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			double[] x = new double[n];
			double[] y = new double[n];
			double[] r = new double[n];
			for (int i = 0; i < n; ++i) {
				x[i] = sc.nextDouble();
				y[i] = sc.nextDouble();
				r[i] = sc.nextDouble();
			}

			double[][] p = new double[2 * n][];
			p[0] = new double[] { x[0], y[0] };
			p[2 * n - 1] = new double[] { x[n - 1], y[n - 1] };

			for (int i = 0; i < n - 1; ++i) {
				double a = -2 * (x[i] - x[i + 1]);
				double b = -2 * (y[i] - y[i + 1]);
				double c = x[i] * x[i] - x[i + 1] * x[i + 1] + y[i] * y[i] - y[i + 1] * y[i + 1] - r[i] * r[i]
						+ r[i + 1] * r[i + 1];

				double w = -c * a / (a * a + b * b);
				double v = -c * b / (a * a + b * b);

				double f = 1 / (a * a + b * b) * (-b * (w - x[i]) + a * (v - y[i]));
				double g = 1 / (a * a + b * b) * ((w - x[i]) * (w - x[i]) + (v - y[i]) * (v - y[i]) - r[i] * r[i]);
				double t1 = -f + Math.sqrt(f * f - g);
				double t2 = -f - Math.sqrt(f * f - g);
				p[2 * i + 1] = new double[] { w - b * t1, v + a * t1 };
				p[2 * i + 2] = new double[] { w - b * t2, v + a * t2 };

			}

			Line2D.Double[] seg = new Line2D.Double[n - 1];
			for (int i = 0; i < n - 1; ++i) {
				seg[i] = new Line2D.Double(p[2 * i + 1][0], p[2 * i + 1][1], p[2 * i + 2][0], p[2 * i + 2][1]);
			}

			double[][] dis = new double[2 * n][2 * n];
			for (int i = 0; i < 2 * n; ++i) {
				for (int j = 0; j < 2 * n; ++j) {
					if (i != j)
						dis[i][j] = Double.MAX_VALUE / 100;
				}
			}
			for (int src = 0; src < 2 * n; ++src) {
				for (int dst = src + 1; dst < 2 * n; ++dst) {
					int s = (src == 0 ? -1 : (src - 1) / 2) + 1;
					int d = (dst - 1) / 2 - 1;
					boolean f = true;
					Line2D.Double path = new Line2D.Double(p[src][0], p[src][1], p[dst][0], p[dst][1]);
					for (int i = s; i <= d; ++i) {
						if (!path.intersectsLine(seg[i]))
							f = false;

					}
					if (f) {
						double distance = Math.sqrt((p[src][0] - p[dst][0]) * (p[src][0] - p[dst][0])
								+ (p[src][1] - p[dst][1]) * (p[src][1] - p[dst][1]));
						dis[src][dst] = distance;
						dis[dst][src] = distance;
					}
				}
			}
			for (int mid = 0; mid < 2 * n; ++mid) {
				for (int src = 0; src < 2 * n; ++src) {
					for (int dst = 0; dst < 2 * n; ++dst) {
						dis[src][dst] = Math.min(dis[src][dst], dis[src][mid] + dis[mid][dst]);
					}
				}
			}
			pw.println(dis[0][2 * n - 1]);

		}
		sc.close();
		pw.close();
	}
}

Measured memory_bytes: 65500
s = input()
alpha = 'abcdefghijklmnopqrstuvwxyz'
if len(s) < 26:
  for c in alpha:
    if c not in s:
      print(s + c)
      break
else:
  sr = {s[-1]}
  for i in range(1, len(s)):
    leng = len(s) - i - 1
    if max(sr) > s[leng]:
      print(s[:leng] + min(c for c in sr if c > s[leng]))
      break
    sr.add(s[leng])
  else:
       print(-1)

Measured memory_bytes: 9164
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    u32 N, K;
    cin >> N >> K;
    u32 i = 1;
    N /= K;
    while (N != 0){
        N /= K;
        i++;
    }
    cout << i << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem A

if __name__ == '__main__':
    dish_count = int(input())
    paid_money_yen = dish_count * 800
    cash_back_yen = (dish_count // 15) * 200

    print(paid_money_yen - cash_back_yen)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define r0 return 0;
#define f(k,i,n,j) for(ll k=i;k<=n;k=k+j)
#define cin(a) cin>>a;
#define loop while(t--)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
#define mod (1e9+7)
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
signed main()
{
    crap;
    int n,f=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
    {
        if(a[i]%2==0)
        {
            if(a[i]%3==0 || a[i]%5==0)
            continue;
            else
            {
                f=1;
                break;
            }
        }
    }
    if(f==1)
    cout<<"DENIED"<<endl;
    else
    cout<<"APPROVED"<<endl;
}

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

int main()
{
  int a;
  cin >> a;
  int ca = 0, ce = 0;

  for (int i = 1; i <= a; i++) {
    if (i % 2 == 1) ca++;
    else ce++;
  }

  cout << ca * ce << endl;
}


Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
   int a,b,c;cin>>a>>b>>c;
   if (a<b && b<c) {cout<<"Yes"<<endl;}
   else cout<<"No"<<endl;
   
}




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

int main(){
	int N;
	cin>>N;
	int i,j;
	int x,y;
	vector<int>X(N+1);
	vector<int>Y(N+1);
	vector<int>F(20);
	double dist;
	long double total_dist=0;
	F[0]=1;
	for(i=1;i<=10;i++){
		F[i]=F[i-1]*i;
	}
	for(i=1;i<=N;i++){
		cin>>x>>y;
		X[i]=x;
		Y[i]=y;
	}
	for(i=1;i<=N;i++){
		for(j=i+1;j<=N;j++){
			dist=sqrt((X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j]));
			//cout<<"Distance between "<<i<<" and "<<j<<" is "<<dist<<"\n";
			//dist*=2/N;
			//cout<<". Multiplied by C(N+1,3), it becomes <<"<<dist<<"\n";
			total_dist+=dist;
			//cout<<"total_dist="<<total_dist<<"\n";
		}
	}
	cout.precision(10);
	cout<<total_dist*2/N;
	return 0;
}


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

int main(){
  string N;
  cin >> N;
  int s = 0;
  vector<int>a(N.size());
  int maxi;
  for (int i = 0; i < (int)N.size(); i++){
    char n = N[i];
    if ((n == 'A')||(n == 'C')||(n == 'G')||(n == 'T')){
      s++;
      a.at(i) = s;
    }
    else {
      s=0;
    }
    a.at(i) = max(a.at(i),s);
  }
  maxi = *max_element(a.begin(),a.end());
  cout << maxi << endl;
}

Measured memory_bytes: 3560
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}
int GCD(int x, int y)
{
	return x ? GCD(y % x, x) : y;
}

int main()
{
	ll s;
	cin>>s;
	ll m=1e9;
	ll x1=0,x2=1e9,x3=0;
	ll y1=0,y2=1,y3=1;
    x3=(m-s%m)%m;
	 y3=(s+x3)/m;
	cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<" "<<x3<<" "<<y3<<endl;

}


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

using namespace std;

class Dice{
public:
    int f[6];

    Dice(){};

    void roll_z(){roll(1,2,4,3);}
    void roll_y(){roll(0,2,5,3);}
    void roll_x(){roll(0,1,5,4);}

    void roll(int a,int b,int c,int d){
        int t = f[a]; f[a] = f[b]; f[b] = f[c]; f[c] = f[d]; f[d] = t;
    }
    void rotate(int top,int face){
        for(int i=0;i < 3;i++){
            if(f[0] == top) break;
            roll_x();
        }
        for(int i=0;i < 3;i++){
            if(f[0] == top) break;
            roll_y();
        }
        for(int i=0;i < 3;i++){
            if(f[1] == face) break;
            roll_z();
        }
       
    }

};

int main(){
    Dice dice;
    for(int i=0;i<6;i++) cin >> dice.f[i];
    int q_num;
    cin >> q_num;
    int info[q_num][2];
    for(int i=0;i<q_num;i++){
        for(int j=0;j<2;j++) cin >> info[i][j];
    }
    for(int i=0;i<q_num;i++){
        dice.rotate(info[i][0],info[i][1]);
        cout << dice.f[2] << endl;
    }
    return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int X;
    cin >> X;
    if (400 <= X && X <= 599) cout << 8 << endl;
    if (600 <= X && X <= 799) cout << 7 << endl;
    if (800 <= X && X <= 999) cout << 6 << endl;
    if (1000 <= X && X <= 1199) cout << 5 << endl;
    if (1200 <= X && X <= 1399) cout << 4 << endl;
    if (1400 <= X && X <= 1599) cout << 3 << endl;
    if (1600 <= X && X <= 1799) cout << 2 << endl;
    if (1800 <= X && X <= 1999) cout << 1 << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+15
#define MOD 1000000007
using namespace std;

double dp[2999][3000];
int main(){
    int N;
    cin >> N;
    
    double p[N];
    for(int i=0; i<N; i++){
        cin >> p[i];
    }
    

    for(int i=0; i<N; i++){
        for(int j=0; j<=N; j++){
            dp[i][j]=0;
        }
    }
    
    dp[0][0]=1-p[0];
    dp[0][1]=p[0];
    for(int i=1; i<N; i++){
        dp[i][0]=dp[i-1][0]*(1-p[i]);
    }
    
    for(int i=1; i<N; i++){
        for(int j=1; j<=N; j++){
            if(j>i+1){
                dp[i][j]=0;
            }else{
                dp[i][j]=dp[i-1][j]*(1-p[i])+dp[i-1][j-1]*p[i];
            }
        }
    }
    
    double ans=0;
    for(int i=(N+1)/2; i<=N; i++){
        ans+=dp[N-1][i];
    }
    
    cout<<fixed << setprecision(9) << ans<<endl;
    return 0;
}


Measured memory_bytes: 70528
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var S = Read();
            var a = S[0];
            var ans = 0;
            for (int i = 1; i < S.Length; i++)
            {
                if (a != S[i])
                {
                    ans++;
                    a = S[i];
                }
            }
            Println(ans);
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}

Measured memory_bytes: 13280
ABCD = list(map(int, input()))

for bit in range(2 ** 3):
    value = ABCD[0]
    equation = str(ABCD[0])
    for i in range(3):
        if bit & (1 << i):
            value += ABCD[i + 1]
            equation = equation + '+' + str(ABCD[i + 1])
        else:
            value -= ABCD[i + 1]
            equation = equation + '-' + str(ABCD[i + 1])
    if value == 7:
        print(equation + '=7')
        break


Measured memory_bytes: 9048
import copy
n=int(input())
box=list(map(int,input().split()))
box.insert(0,0)
box.append(0)
count=0
for i in range(n+1):count +=abs(box[i]-box[i+1])
for j in range(1,n+1):
    print(count-(abs(box[j-1]-box[j])+abs(box[j]-box[j+1]))+abs(box[j-1]-box[j+1]))

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

using namespace std;

typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define all(vec) vec.begin(),vec.end()
#define ff first
#define ss second
#define pi 3.141592653589
#define inf 4e18
#define MOD 998244353
#define pb push_back
#define endl "\n"
#define for1(low,high,k) for(int i=low;i<high;i+=k)
#define for2(low,high,k) for(int j=low;j<high;j+=k)
#define rev(high,low,k) for(int i=high;i>=low;i-=k) 

int main(){
	fast;
	lli n,k;
	cin>>n>>k;
	vector <pii> uni(k);
	for (int i=0;i<k;i++) cin>>uni[i].ff>>uni[i].ss;
	vector <lli> dp(n+1,0);
	vector <lli> suff(n+2,0);
	dp[n]=1;
	suff[n]=1;
	sort(all(uni));
	for (int i=n-1;i>0;i--){
		for (int j=0;j<k;j++){
			lli l=i+uni[j].ff;
			lli r=i+uni[j].ss;
			if (l>n) break;
			r=min(r,n);
			dp[i]=(dp[i]%MOD+(suff[l]%MOD-suff[r+1]%MOD+MOD)%MOD)%MOD;
		}
		suff[i]=(suff[i+1]%MOD+dp[i]%MOD)%MOD;
	}
	cout<<dp[1]<<endl;
}

Measured memory_bytes: 6352
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

void bsort(vector< pair<int,int> > &v){
    REP(i,v.size()){
	FOR(j,i+1,v.size()){
	    if(v[i].first < v[j].first){
	       	swap(v[i],v[j]);
	    }else if(v[i].first == v[j].first){
		if(v[i].second > v[j].second) swap(v[i],v[j]);
	    }
	}
    }
}

int main(){
    while(true){
	int a,b;
	cin >> a >> b;
	if(a == 0 && b == 0) break;
	vector< pair<int,int> > v(b,pair<int,int>(0,0));
	REP(i,b){
	    v[i].second = i + 1;
	}
	REP(i,a){
	    REP(i,b){
		int t;
		cin >> t;
		if(t == 1) v[i].first++;
	    }
	}
	bsort(v);
	cout << v[0].second;
	FOR(i,1,b){
	    cout << " "<<v[i].second;
	}
	cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1196
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

///////////////////////////////////////////////////////////////////////////////////////

ll N, M;
ll p[MAX_10p5];
bool visited[MAX_10p5];
ll colors[MAX_10p5];
vector<ll> nodes[MAX_10p5];
stack<ll> ST;

int main() {
	cin >> N >> M;
	repi(i, 1, N + 1) {
		rd(p[i]);
	}
	repi(i, 0, M) {
		ll x, y;
		cin >> x >> y;
		nodes[x].push_back(y);
		nodes[y].push_back(x);
	}

	ll color = 0;

	repi(i, 1, N + 1) {
		if (visited[i]) continue;
		color++;
		ST.push(i);
		while (1) {
			if (ST.size() == 0) break;
			ll curNode = ST.top();
			ST.pop();
			if (visited[curNode]) continue;
			visited[curNode] = true;
			colors[curNode] = color;
			repi(j, 0, nodes[curNode].size()) {
				ST.push(nodes[curNode][j]);
			}
		}
	}

	ll ans = 0;

	repi(i, 1, N + 1) {
		if (colors[i] == colors[p[i]]) ans++;
	}

	wrln(ans);

	return 0;
}


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

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

    int cnt = 0;
    int n_size = to_string(N).size();
    string istr;
    for(int i = 1; i <= N; i++) {
        istr = to_string(i);
        if(istr.at(istr.size() - 1) == '0') {
            continue;
        }
        int i_size = istr.size();
        int fnum = stoi(istr.substr(istr.size() - 1, 1));
        int lnum = stoi(istr.substr(0, 1));
        if(i_size == 1 && fnum <= N) {
            cnt++;
        } else if(fnum == lnum && lnum <= N) {
            cnt++;
        }
        if(fnum * 10 + lnum <= N) {
            cnt++;
        }

        int p = 100;
        while(true) {
            int other = fnum * p + lnum;
            if(other > N) {
                break;
            }
            if(((fnum + 1) * p) < N) {
                cnt += p / 10;
            } else {
                for(int j = other; j < (fnum + 1) * p; j += 10) {
                    if(j > N) {
                        break;
                    }
                    cnt++;
                }
            }
            p *= 10;
        }
    }

    cout << cnt << endl;
}

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

#define mod 1000000007
#define pb push_back
#define bs binary_search
#define bp __builtin_popcountll

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll a,b,c,k,s;
    cin>>a>>b>>c>>k;
    
    if(a>k)
    {
        cout<<k<<endl;
        return 0;
    }
    else
    {
        s=s+a;
        k=k-a;
        k=k-b;
        if(k>0)
        s=s-k;
        cout<<s;
        return 0;
    }

return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        final Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        long sum = 0;
        for (int i = 0; i < N; ++i) {
            sum += scanner.nextInt();
        }
        sum -= N;
        System.out.println(sum);
    }
}


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

p = []
for i in range(m):
  x = str(i)+' '+input()
  p.append(list(map(int,x.split())))

p.sort(key=lambda x:x[2]) 
c = [1]*(n+1)
for i in range(m):
  p[i][2] = c[p[i][1]]
  c[p[i][1]] += 1
p.sort()
for i in range(m):
  print( str(p[i][1]).zfill(6) + str(p[i][2]).zfill(6))


Measured memory_bytes: 31820
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

map<ll,ll> dp;

ll fun(ll x)
{
	if(x==1) return dp[1]=1;
	if(dp[x]!=0) return dp[x];
	dp[x]=0;
	dp[x] =1+2*fun(x/2);
	return dp[x];
}

int solve()
{
	ll h;cin>>h;
	cout<<fun(h)<<"\n";
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

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

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int N;
vector<int> G[100100];
ll dp[100100][2];

void dfs(int u, int v) {
    dp[u][0] = 1LL;
    dp[u][1] = 1LL;
    for(auto to : G[u]) {
        if(to == v) continue;
        dfs(to, u);
        dp[u][0] = dp[u][0] * (dp[to][0] + dp[to][1]) % mod;
        dp[u][1] = dp[u][1] * dp[to][0] % mod;
    }
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    cin >> N;
    rep(i, N - 1) {
        int x, y; cin >> x >> y;
        x --; y --;
        G[x].pb(y);
        G[y].pb(x);
    }
    dfs(0, -1);
    ll ans = dp[0][0] + dp[0][1];
    cout << ans % mod << endl;
	return 0;
}

Measured memory_bytes: 14208
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <tuple>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; --i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
string s;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> s;
  if(s == "Sunny") cout << "Cloudy" << endl;
  if(s == "Cloudy") cout << "Rainy" << endl;
  if(s == "Rainy") cout << "Sunny" << endl;
}


Measured memory_bytes: 256
list=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(list[K-1])


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

uint_fast32_t scan(){
    uint_fast32_t a{};
    int c;
    while((c=getchar_unlocked()-'0')>=0) a<<=1u,a+=a<<2u,a+=c;
    return a;
}

uint_fast64_t scan64(){
    uint_fast64_t a{};
    int c;
    while((c=getchar_unlocked()-'0')>=0) a<<=1u,a+=a<<2u,a+=c;
    return a;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n;
    ll k;
    n=scan();k=scan64();
    vector<int> a(n),f(n);
    for(auto&i:a) i=scan();
    for(auto&i:f) i=scan();
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    sort(f.begin(),f.end());
    ll l=-1,r=1e18,m;
    while(r-l>1){
        m=(l+r)>>1;
        ll s=0;
        fr(i,n) if(a[i]>m/f[i]) s+=a[i]-m/f[i];
        if(s>k) l=m;
        else r=m;
    }
    cout<<r<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
#define precout(val) cout << std::fixed << std::setprecision(20) << val;

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

  int n; cin >> n;
  int total = 0;
  for(int i = 1; total < n; ++i) {
    total += i;
  }

  if(total == n) {
    int tmp = 0;
    for(int i = 1; tmp < n; ++i) {
      tmp += i;
      cout << i << endl;
    }
  } else {
    int ign = total - n;
    int tmp = 0;
    for(int i = 1; tmp < n; ++i) {
      if(ign != i) {
        tmp += i;
        cout << i << endl;
      }
    }
  }
}


Measured memory_bytes: 256
import java.util.*;

class Main{
    int T;
    int[] number;
    int[] R,G,B;

    void solve(){
	Scanner sc = new Scanner(System.in);
	T = sc.nextInt();
	while(T-->0){
	    number = new int[9];
	    for(int i=0; i<9; i++)number[i] = sc.nextInt();
	    R = new int[10];
	    G = new int[10];
	    B = new int[10];
	    for(int i=0; i<9; i++){
		char c = sc.next().charAt(0);
		if(c=='R')R[number[i]]++;
		if(c=='G')G[number[i]]++;
		if(c=='B')B[number[i]]++;
	    }

	    for(int i=0; i<=9; i++){
		if(R[i]>0){
		    if(R[i]==4 || R[i]==3) R[i]-=3;
		    if(R[i]<=2 && i+2<=9){R[i+1]-=R[i]; R[i+2]-=R[i]; R[i] = 0;}
		}
		if(G[i]>0){
		    if(G[i]==4 || G[i]==3) G[i]-=3;
		    if(G[i]<=2 && i+2<=9){G[i+1]-=G[i]; G[i+2]-=G[i]; G[i] = 0;}
		}
		if(B[i]>0){
		    if(B[i]==4 || B[i]==3) B[i]-=3;
		    if(B[i]<=2 && i+2<=9){B[i+1]-=B[i]; B[i+2]-=B[i]; B[i] = 0;}
		}
	    }

	    int ans = 1;
	    for(int i=0; i<=9; i++){
		if(R[i]!=0 || G[i]!=0 || B[i]!=0){ans = 0; break;}
	    }
	    System.out.println(ans);
	}
    }

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

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

int n, m;
ll d[109][109];

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

    cin >> n >> m;

    rep(i, n) {
        rep(j, n) d[i][j] = inf;
        d[i][i] = 0;
    }

    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        d[a][b] = c;
    }

    rep(k, n) rep(i, n) rep(j, n) if(d[i][k] < inf && d[k][j] < inf)
        chmin(d[i][j], d[i][k] + d[k][j]);

    rep(i, n) if(d[i][i] < 0) {
        cout << "NEGATIVE CYCLE\n";
        return 0;
    }

    rep(i, n) rep(j, n) {
        if(d[i][j] < inf)
            cout << d[i][j];
        else
            cout << "INF";
        cout << " \n"[j == n - 1];
    }

    return 0;
}


Measured memory_bytes: 3312
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int N,H;

void func(){

	bool xy[N][N],xz[N][N],yz[N][N];

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++){
			xy[i][k] = true;
			xz[i][k] = true;
			yz[i][k] = true;
		}
	}

	char buf[3];
	int a,b,ans = N*N*N;

	for(int loop = 0; loop < H; loop++){
		scanf("%s %d %d",buf,&a,&b);
		a--;
		b--;

		ans -= N;

		if(buf[0] == 'x'){
			if(buf[1] == 'y'){
				xy[a][b] = false;
				for(int i = 0; i < N; i++){

					if(yz[b][i] == false || xz[a][i] == false)ans++;
				}
			}else{
				xz[a][b] = false;
				for(int i = 0; i < N; i++){

					if(yz[i][b] == false || xy[a][i] == false)ans++;
				}
			}
		}else{
			yz[a][b] = false;
			for(int i = 0; i < N; i++){
				if(xy[i][a] == false || xz[i][b] == false)ans++;
			}
		}
	}

	printf("%d\n",ans);
}

int main(){

	while(true){
		scanf("%d %d",&N,&H);
		if(N == 0 && H == 0)break;

		func();
	}

	return 0;
}

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

string rotate(string s){
  return s.substr(1) + s.front();
}

int main() {
  string s,t;
  cin >> s >> t;
  for(int i=0;i<s.size();i++){
    if( s == t ){
      cout << "Yes" << endl;
      return 0;
    }
   	s = rotate(s);
   // cout << s << endl;
  }
  cout << "No" << endl;
  
  return 0;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    string s;
    cin >> s;
    ll n = len(s);
    ll pcnt = 0;
    rep(i, n) {
        if (s[i] == 'p') pcnt++;
    }
    cout << (n / 2 - pcnt) << endl;
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
using namespace std;
int main() {
	int m, n;
	while (cin >> m >> n, m, n) {
		queue<int>v;
		for (int i = 1; i <= m; i++)v.push(i);

		for (int i = 1; i <= n; i++) {
			string s;
			cin >> s;
			if (v.size() == 1)continue;
				if (i % 15 == 0) {
					int a = v.front();
					if (s == "FizzBuzz") {
						v.pop();
						v.push(a);
					}
					else v.pop();
				}

				else if (i % 3 == 0) {
					int a = v.front();
					if (s == "Fizz") {
						v.pop();
						v.push(a);
					}
					else v.pop();
				}

				else if (i % 5 == 0) {
					int a = v.front();
					if (s == "Buzz") {
						v.pop();
						v.push(a);
					}
					else v.pop();
				}

				else {
					int a = v.front();
					string sa = to_string(i);
					if (s == sa) {
						v.pop();
						v.push(a);
					}
					else v.pop();
			}
		}
		vector<int>va;
		while (v.size()) {
			va.push_back(v.front());
			v.pop();
		}
		sort(va.begin(), va.end());
		for (int i = 0; i < va.size(); i++) {
			if (i)cout << ' ';
			cout << va[i];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3208
# include <iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a+b>c+d)
	cout<<"Left";
	else if(a+b<c+d)
	cout<<"Right";
	else 
	cout<<"Balanced";
	return 0;
}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

#define mod 1e9+7

int main(){
  ll x;
  cin >> x;
  ll ans = x / 11;
  
  if(x - ans*11 > 6){
    ans++;
    ans *= 2;
  }
  else if(x - ans * 11 != 0){
    ans *= 2;
    ans++;
  }
  else{
    ans *= 2;
  }
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef pair<int,int> PII;
typedef long long int ll;
typedef pair< ll,ll> PLL;
typedef unsigned long long int ULL;
typedef pair<ULL,int> PUI;
#define S second
#define F first
typedef tree<
PLL,
null_type,
less<PLL>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;


PLL operator+(PLL a,PLL b){ return {a.first + b.first, a.second + b.second}; }
PLL operator-(PLL a,PLL b){ return {a.first - b.first, a.second - b.second}; }
PLL operator*(PLL a,PLL b){ return {a.first * b.first, a.second * b.second}; }
PLL operator/(PLL a,PLL b){ return {a.first / b.first, a.second / b.second}; }
PLL operator%(PLL a,PLL b){ return {( b.first + a.first) % b.first, (b.second + a.second) % b.second}; }
PLL operator%(PLL a,ll b){ return {a.first % b, a.second % b} ;}
PLL operator+(PLL a,ll b){ return {a.first + b, a.second + b} ;}
PLL operator-(PLL a,ll b){ return {a.first - b, a.second - b} ;}
PLL operator*(PLL a,ll b){ return {a.first * b, a.second * b} ;}

ostream& operator<<(ostream &out,PLL a)
{
    out << "( " << a.first << ", " << a.second << " )" ;
    return out;
}

ostream& operator<<(ostream &out,PUI a)
{
    out << "( " << a.first << ", " << a.second << " )" ;
    return out;
}
/*
	Order Statistics Tree ( OST )

	find_by_order()
		takes an integer k and returns an iterator to the k'th largest element counting from zero
	order_of_key()
		takes an element, here an integer and returns the number of elements strictly smaller than input
*/


int const MOD = 1e9 + 7;

int const N = 500 + 10;
bool isNotPrime[N] ;

void sieve()
{
    for(int i = 2; i < N; i++){
        if(!isNotPrime[i]){
            for(int j = 2 * i ; j < N; j += i) 
                isNotPrime[j] = 1;
        }
    }
}

double ncr[N][N] ;


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

    map < int, int > mp;
    vector < int > v;
    int n;
    cin >> n;
    v.resize(n);

    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        mp[x]++;
        v[i] = x;
    }
    sort(v.begin(),v.end());

    if(mp.size() > 2){
        cout << "No\n";
    }
    else if(mp.size() == 2){
        if(v.back() - v[0] > 1){
            cout << "No\n";
        }
        else if(mp[v[0]] + 1 <= v.back() and mp[v[0]] + (mp[v.back()]/ 2) >= v.back()){
            cout << "Yes\n";
        }
        else {
            cout << "No\n";
        }
    }
    else {
        if(mp[v[0]]  >= 2*v[0] or v[0] == n - 1) {
            cout << "Yes\n";
        }
        else 
            cout << "No\n";
    }
    return 0;

}


Measured memory_bytes: 5376
#include <iostream>
using namespace std;
int main(void){
   int E,Y;
   cin>>E;
   cin>>Y;
   if(E==0){
   if(Y>=1868 && Y<=1911) {cout << "M" << Y-1868+1 << endl ; }
   if(Y>=1912 && Y<=1925) {cout << "T" << Y-1912+1 << endl ; }
   if(Y>=1926 && Y<=1988) {cout << "S" << Y-1926+1 << endl ; }
   if(Y>=1989 && Y<=2016) {cout << "H" << Y-1989+1 << endl ; }         
   }else{
   if(E==1) {cout<<1868+Y-1<<endl;}
   if(E==2) {cout<<1912+Y-1<<endl;}
   if(E==3) {cout<<1926+Y-1<<endl;}
   if(E==4) {cout<<1989+Y-1<<endl;}
   }
   }


Measured memory_bytes: 3096
from sys import stdin

def main():
    N = int(input())
    H = tuple(map(int, input().split()))

    dp = [0] * N
    dp[0], dp[1] = 0, abs(H[0] - H[1])
    for i in range(2, N):
        dp[i] = min(abs(H[i-1] - H[i]) + dp[i-1],
                    abs(H[i-2] - H[i]) + dp[i-2])
    print(dp[-1])

input = lambda: stdin.readline()
main()


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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> s(m), c(m);
    rep(i, m){
        cin >> s.at(i) >> c.at(i);
    }
    
    int kuso;
    if(m == 0){
        if(n == 1) kuso = 0;
        if(n == 2) kuso = 10;
        if(n == 3) kuso = 100;
        
        cout << kuso << endl;
        return 0;
    }

    int tmp = c.at(0);
    if(n == 1){
        rep(i, m){
            if(tmp != c.at(i)){
                cout << -1 << endl;
                return 0;
            }
        }
        cout << tmp << endl;
        return 0;
    }

    int ans = 0;
    if(n == 2 || n == 3){
        int tmp_1 = 10;
        int tmp_2 = 10;
        int tmp_3 = 10;
        rep(i, m){
            if(s.at(i) == 1){
                if(tmp_1 == 10){
                    tmp_1 = c.at(i);
                }
                else{
                    if(tmp_1 != c.at(i)){
                        cout << -1 << endl;
                        return 0;
                    }
                }
            }

            if(s.at(i) == 2){
                if(tmp_2 == 10){
                    tmp_2 = c.at(i);
                }
                else{
                    if(tmp_2 != c.at(i)){
                        cout << -1 << endl;
                        return 0;
                    }
                }
            }
            if(n == 3){
                if(s.at(i) == 3){
                    if(tmp_3 == 10){
                        tmp_3 = c.at(i);
                    }
                    else{
                        if(tmp_3 != c.at(i)){
                            cout << -1 << endl;
                            return 0;
                        }
                    }
                }
            }
        }

        if(n == 2){
            if(tmp_1 == 10) ans += 10;
            else ans += tmp_1*10;

            if(tmp_2 == 10) ans += 0;
            else ans += tmp_2;
        }

        if(n == 3){
            if(tmp_1 == 10) ans += 100;
            else ans += tmp_1*100;

            if(tmp_2 == 10) ans += 0;
            else ans += tmp_2*10;

            if(tmp_3 == 10) ans += 0;
            else ans += tmp_3;
        }

        if(tmp_1 == 0) ans = -1;
    }

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

Measured memory_bytes: 256
N,x=map(int,input().split())
nums = list(map(int,input().split()))
nums.sort()
if sum(nums) == x:
  print(N)
  exit()
for i in range(N):
  if nums[i] <= x:
    x -= nums[i]
  else:
    print(i)
    exit()
print(N-1)

Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>
#include<queue>
#include<stack>
#include<string.h>
#include<algorithm>
#include<cctype>
#include<map>
#include<set>
typedef long long ll;
using namespace std;
int u[4];
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	u[a]=1;u[b]=1;
	for(int i=1;i<=3;i++){
		if(u[i]==0)printf("%d\n",i);
	}
}

Measured memory_bytes: 128
def kaibun(s):
    l=len(str(s))
    check=list(s)
    half=l//2
    a=check[:half]
    b=check[::-1][:half]
    if a==b:
        return True
    return False

a,b=[int(i) for i in input().split()]
ans=0
for i in range(a,b+1):
    if kaibun(str(i)):
        ans+=1
print(ans)

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define rep(i,N) for(int i=0;i<N;i++)

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

  int A,B,M;
  cin>>A>>B>>M;
  vector<int>a(A),b(B),x(M),y(M),c(M);
  for(int i=0;i<A;i++)cin>>a[i];
  for(int i=0;i<B;i++)cin>>b[i];
  for(int i=0;i<M;i++)cin>>x[i]>>y[i]>>c[i];
  for(int i=0;i<M;i++)x[i]--,y[i]--;
  int Min=*min_element(rng(a))+*min_element(rng(b));
  for(int i=0;i<M;i++){
    Min=min(Min,a[x[i]]+b[y[i]]-c[i]);
  }
  cout<<Min<<endl;
  return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1e9+7;
const ll N=998244353;
ll power(ll x,ll n){ll res=1;while(n>0){if(n&1) res=res*x%MOD;x=x*x%MOD;n>>=1;}return res;}
ll modinverse(ll a){return power(a, MOD-2);}
vl adj[200010];
void solve()
{
    map<ll, ll> mp1;
    forr(i, 3)
    {
        ll x;
        cin>>x;
        mp1[x]++;
    }
    if(mp1.size()==2)
    cout<<"Yes";
    else
    cout<<"No";
}
int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
    {
        solve();
    }
}

Measured memory_bytes: 8292
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    string s;cin>>s;
    ll k;cin>>k;
    int one=-1;
    rep(i,s.size()){
        if(s[i]=='1')one++;
        else break;
    }
    if(one+1>=k)cout<<1<<endl;
    else cout<<s[one+1]<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
char ab[200];
int sankai(int i){
  if(i<=0)return 1;
  return 3*sankai(i-1);
}
int sanjo(int a,int i){
  if(a==0&&i<0)return 1;
  else if(i<0)return 0;
  else{
    //printf("%d %d\n",a,i);
    if(sanjo(a+sankai(i),i-1)){
      ab[i]='-';
      return 1;
    }
    else if(sanjo(a,i-1)){
      ab[i]='0';
      return 1;
    }
    else if(sanjo(a-sankai(i),i-1)){
      ab[i]='+';
      return 1;
    }
  }
  return 0;
}
int main(){
  int a;
  //for(a=1;a<=100000;a++){
    int b,i,j,n,m=0;
  
    scanf("%d",&a);
    b=1;
    for(i=0;b<a;i++)b*=3;
    sanjo(a,i);
    for(j=i;j>=0;j--){
      if(ab[j]=='+')m+=sankai(j);
      else if(ab[j]=='-')m-=sankai(j);
      if(j==i&&ab[j]=='0');
      else printf("%c",ab[j]);
    }
    printf("\n");
    //printf("\na=%d m=%d\n",a,m);
    //if(a!=m)break;
    //}
  return 0;
}


Measured memory_bytes: 568
n = int(input())
A = list(map(int, input().split()))

S = [0] * n
S[0] = A[0]
for i in range(1, n):
    S[i] = S[i - 1] + A[i]

ans = float("inf")
for i in range(n - 1):
    ans = min(ans, abs(S[i] - (S[-1] - S[i])))
print(ans)


Measured memory_bytes: 24832
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
int main(void){
  int N,M;
  cin >> N >> M;
  vector<double> A(N);
  double total = 0.0;
  for(int i=0;i<N;i++){
    cin >> A[i];
    total += A[i];
  }
  double thre = total / (4.0*M);
  sort(A.begin(),A.end(),greater<int>());
  int m=0;
  for(int i=0;i<M;i++){
    if(A[i] < thre){
    } else {
      m++; 
    }
  }
  
  if(M==m){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
arr=Array.new
while str=STDIN.gets
        lines=str.chomp.split.map{|v|v.to_i}
        break if lines[0]==0 && lines[1]==0
        arr.insert(arr.length,lines)
end
arr.each do | lines |
    row=0
    while(row<lines[0])
    col=0
    while(col<lines[1])
        printf "#"
        col=col+1
    end
    printf "\n"
    row=row+1
    end
    printf "\n"
end

Measured memory_bytes: 6104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

int x[4], y[4];
signed main() {
    cin >> x[0] >> y[0] >> x[1] >> y[1];
    int a = x[1]-x[0];
    int b = y[1]-y[0];
    y[2] = y[1] + a;
    x[2] = x[1] - b;
    y[3] = y[0] + a;
    x[3] = x[0] - b;
    cout << x[2] << endl;
    cout << y[2] << endl;
    cout << x[3] << endl;
    cout << y[3] << endl;

}

Measured memory_bytes: 256
x = int(input())
y = int(input())

if (x==1)&(y==2):
    print('3')
elif (x==2)&(y==3):
    print('1')
elif (x==3) & (y==1):
    print('2')
elif (x==1) & (y==3):
    print('2')
elif (x==2) & (y==1):
    print('3')
elif (x==3) & (y==2):
    print('1')

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

const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	double w, h, x, y; cin >> w >> h >> x >> y;
	cout << (double)w*h/2 <<" ";
	if(x == w/2 && y == h/2) cout << 1;
	else cout << 0 << endl;
} 

Measured memory_bytes: 256