akhauriyash/Code-Regression huggingface dataset:
/**
* Author: Luis Alberto Herrera Gomez
* Tags: 
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> ii;

int main()
{
    int X, A;

    cin >> X >> A;

    if (X < A)
        cout << "0\n";
    else
        cout << "10\n";

    return 0;
}


Measured memory_bytes: 256
h, w = [int(i) for i in input().split()]

a = []

for i in range(h):
    str_list = input()
    a_list = [0 if j == "." else 1 for j in str_list]
    a.append(a_list)

i = 0
while i < h:
    if i > len(a)-1:
        break
    if sum(a[i]) == 0:
        a.pop(i)
        i-=1
    i+=1


i = 0
while i < w:
    if i > len(a[0])-1:
        break
    if sum([a[j][i] for j in range(len(a))]) == 0:
        for j in range(len(a)):
            a[j].pop(i)
        i-=1
    i+=1


for i in range(len(a)):
    outlist = ["." if a[i][j] == 0 else "#" for j in range(len(a[0]))]
    str_list = ""
    for j in outlist:
        str_list+=j
    print(str_list)


Measured memory_bytes: 3188
from collections import deque


def main():
    word = input()
    stack = deque()
    for w in word:
        if w == "S":
            stack.appendleft(w)
        elif w == "T" and (len(stack) == 0 or stack[0] == "T"):
            stack.appendleft(w)
        else:
            stack.popleft()
    print(len(stack))


if __name__ == '__main__':
    main()



Measured memory_bytes: 5088
#include <bits/stdc++.h>
#define endl '\n'
#define LL long long
#define LD long double
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define debug(x) cerr << #x << " is " << x << endl;
using namespace std;
int const MAXN = 2e6 + 9;
int a[MAXN];
int main(){
    ios_base::sync_with_stdio (0),cin.tie(0);
    LL x, k, d;
    cin >> x >> k >> d;
    LL nbr = abs(x / d);
    LL ans = 0;
    if(nbr >= k){
        if(x > 0) x -= d * k;
        else x += d * k;
        ans = x;
    }else {
        if(x > 0) x -= d * nbr;
        else x += d * nbr;
        k -= nbr;
        if(k & 1){
            ans = min(abs(x + d), abs(x - d));
        }else ans = x;
    }
    ans = abs(ans);
    cout << ans << endl;
}

Measured memory_bytes: 3636
import math
import sys
input = sys.stdin.readline


def main():
    N = int(input())   
    L = [0]*(N+1)
    L[0] = 2
    L[1] = 1

    for i in range(2, N+1):
        L[i] = L[i-1] + L[i-2]
    
    print(L[N])


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;

int main() {
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  double alpha = h * M_PI / 6.0 + m * M_PI / 360.0 - m * M_PI / 30.0;
  cout << fixed;
  cout << setprecision(15);
  cout << sqrt((b * b + a * a) - (2 * b * a * cos(alpha))) << endl;
  return 0;
}


Measured memory_bytes: 4200
a = int(input())
b = int(input())
c = int(input())
x = int(input())

answer = 0

for i in range(a + 1):
    y = x - 500 * i
    for j in range(b + 1):
        z = y - 100 * j
        if z >= 0 and z / 50 <= c:
            answer += 1
        
print(answer)

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

int main()
{
    long long int a, b, c, d, mul;

    scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

    mul = a*c;

    if (mul < a*d)
    {
        mul = a*d;
    }

    if (mul < b*c)
    {
        mul = b*c;
    }

    if (mul < b*d)
    {
        mul = b*d;
    }

    printf("%lld", mul);

    return 0;
}

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

using namespace std;

#define X first
#define Y second
#define eps  1e-5
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;

const int maxn = 1e5+7;
const int INF  = 1<<30;
const int mod  = 1e9+7;

void solve(){
    int a,b;
    cin>>a>>b;
    cout<<max(0,a-2*b)<<'\n';
    
    return;
}

int main()
{
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin);
#endif
//    freopen("out.txt","w",stdout);
//    ios::sync_with_stdio(false);
    int t = 1;
    //scanf("%d",&t);
    while(t--){
    //    printf("Case %d: ",cas++);
        solve();
    }
#ifndef ONLINE_JUDGE
   // printf("%.10f\n",1.0*clock()/CLOCKS_PER_SEC);
#endif
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  int n;
  double p[3000], dp[3000][3000], ans = 0; // i, k
  cin >> n;
  for(int i = 0; i != n; i++) cin >> p[i];
  dp[0][0] = 1;
  for(int i = 1; i <= n; i++){
    dp[i][0] = dp[i - 1][0] * (1 - p[i - 1]);
    for(int k = 1; k <= n; k++){
      dp[i][k] = dp[i - 1][k - 1] * p[i - 1] + dp[i - 1][k] * (1 - p[i - 1]);
    }
  }
//  for(int i = 0; i <= n; i++) cout << dp[n][i] << " "; cout << endl;
  for(int i = (n + 1) / 2; i <= n; i++)ans += dp[n][i];
  printf("%.16f\n", ans);
  return 0;
}

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


class Program {

	const long mod = 1000000007;
	//public static int[] max;


	static void Main(string[] args) {

		char[] cs = new char[] { ' ', ',' };
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res="";
		//int res = 0; ;
		//int t = int.Parse(Console.ReadLine());
		//string str = Console.ReadLine();
		///int[] vals = parseAry(Console.ReadLine().Split(cs));
		//int n = int.Parse(Console.ReadLine());

		//int num = vals[0];

		long res = 0;
		string str = Console.ReadLine();
		int leftb = -1;
		int leftw = -1;
		for ( int i = 0; i < str.Length; i++ ) {
			if ( str[i] == 'B' ) { leftb = i; break; }
		}
		if ( leftb == -1 ) { Console.WriteLine(0); return; }

		for ( int i = leftb+1; i < str.Length; i++ ) {
			if ( str[i] == 'W' ) {
				res += i - leftb;
				leftb++;			
			}
		}


			Console.WriteLine(res);

		return;
	}


}

Measured memory_bytes: 11616
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<string.h>
#include <iomanip>
#include <sstream>
using namespace std;

int main() {
  int N, K;
  int ans = 0;
  string s;

  cin >> N >> K;

  if(N%K == 0){
    ans = 0;
  }else{
    ans ++ ;
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
s = input()
mae = s[:2]
ato = s[2:]
val = ""
if mae == "00":
	if ato == "00":
		val = "NA"
	elif int(ato) >= 13:
		val = "NA"
	else:
		val = "YYMM"
elif int(mae) >= 13:
	if ato == "00":
		val = "NA"
	elif int(ato) >= 13:
		val = "NA"
	else:
		val = "YYMM"
else:
	if ato == "00":
		val = "MMYY"
	elif int(ato) >= 13:
		val = "MMYY"
	else:
		val = "AMBIGUOUS"
print (val)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>

#define ll long long

using namespace std;

int used[500][500];
ll ans=0;
string s[500];
int h,w;
ll mini=0;
ll momo=0;

void dfs(int i,int j){
    used[i][j]=1;
    int pu=0,yo=0;
    if(s[i][j]=='.'){
        pu=1;
        mini++;
    }else{
        momo++;
    }
    if(i>0){
      if(!used[i-1][j]){
          if(s[i-1][j]=='.') yo=1;
          if(pu+yo==1) dfs(i-1,j);
      }
    }
    yo=0;
    if(j>0){
      if(!used[i][j-1]){
          if(s[i][j-1]=='.') yo=1;
          if(pu+yo==1) dfs(i,j-1);
      }
    }
    yo=0;
    if(i<h-1){
      if(!used[i+1][j]){
          if(s[i+1][j]=='.') yo=1;
          if(pu+yo==1) dfs(i+1,j);
      }
    }
    yo=0;
    if(j<w-1){
      if(!used[i][j+1]){
          if(s[i][j+1]=='.') yo=1;
          if(pu+yo==1) dfs(i,j+1);
      }
    }
    return;
}

int main(){

 cin>>h>>w;
 for(int i=0;i<h;++i) cin>>s[i];
 
 for(int i=0;i<h;++i){
     for(int j=0;j<w;++j){
         if(!used[i][j]){
             mini=0;
             momo=0;
             dfs(i,j);
             ans+=mini*momo;
         }
     }
 }
 
 cout<<ans<<endl;

 return 0;
}


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

int main()
{
	static int m[101][101];
	int r, c;
	cin >> r >> c;
	for(int i=0;i<r;++i)
		for (int j = 0; j < c; ++j) {
			cin >> m[i][j];
		}
	for (int i = 0; i < r; ++i) {
		int sum = 0;
		for (int j = 0; j < c; ++j) {
			sum += m[i][j];
		}
		m[i][c] = sum;
	}
	for (int j = 0; j < c+1; ++j) {
		int sum = 0;
		for (int i = 0; i < r; ++i) {
			sum += m[i][j];
		}
		m[r][j] = sum;
	}
	for (int i = 0; i < r+1; ++i) {
		for (int j = 0; j < c+1; ++j) {
			if (j != 0) cout << " ";
			cout << m[i][j];
		}
		cout << endl;
	}

	return 0;
}



Measured memory_bytes: 3112
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';

ll gcd(ll a,ll b) {
    while(1) {
        if(a < b) swap(a, b);
        if(!b) break;
        a %= b;
    }
    return a;
}
int main() {
    ll n;
    cin>>n;
    vector<string>s(n);
    rep(i,n)cin>>s[i];
    rep(i,26) {
        int m = 100;
        rep(j, n)m = min(m, (int) count(begin(s[j]), end(s[j]),(char)i+97));
        rep(j, m) cout <<(char)(i+97);
    }
    cout << endl;
}



Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"

int main()
{
	ll t,a,k;
	cin>>t>>a>>k;
	if(k>=t){
		k -= t;
		t=0;
		}
	else{
		t = (t-k);
		k=0;
	}
	if(k>0) a -= min(a,k);
	cout<<t<<" "<<a<<nw;
	
	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            //

            var cin = GetIntArray();
            var ans = YesNo(cin[0] <= cin[2] && cin[2] <= cin[1]);

            Console.WriteLine(ans);

            //
            Console.Out.Flush();
            Console.ReadKey();
        }

        static void Solve()
        {

        }

        static long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }


        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public char[] GetCharArray() { return Console.ReadLine().Split(' ').Select(char.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c, out V d)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<V>(ar[3]);
        }
    }
}

Measured memory_bytes: 13396
r,c = gets.split(" ").map(&:to_i)
array = []
r.times{
	linec_r = gets.split(" ").map(&:to_i)
	component_r = linec_r.inject(:+)
	array.push(linec_r.push(component_r))
}

sum_col = []
for i in 0..c
	sum = 0
	for j in 0..r-1
		sum += array[j][i] 
	end
	sum_col.push(sum)
end
array.each{|line|
    puts line.join(" ")
}
puts sum_col.join(" ")

Measured memory_bytes: 8956
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(x) (x).begin(), (x).end()
// ** Solution Number 1
// int main()
// {
//    int x,y,z,k;
//    cin >> x >> y >> z >> k;
//    ll a[x],b[y],c[z];
//     for(int i=0;i<x;i++)cin >> a[i];
//     for(int i=0;i<y;i++)cin >> b[i];
//     for(int i=0;i<z;i++)cin >> c[i];

//     sort(a,a+x,greater<ll>());
//     sort(b,b+y,greater<ll>());
//     sort(c,c+z,greater<ll>());

//     vector<ll> ans;
    
//     for(int i=0;i<x;i++)
//     {
//         for(int j=0;j<y;j++)
//         {
//             for(int t=0;t<z;t++)
//             {
//                 if((i+1)*(j+1)*(t+1)<=k)ans.push_back(a[i]+b[j]+c[t]);
//                 else break;
//             }
//         }
//     }

//     sort(ans.begin(),ans.end(),greater<ll>());
//     //for(int i=0;i<k;i++)cout << ans[i] << endl;
//     //cout << k << "  " << ans.size();
    
// }

// Solution Number 2 

int main()
{
    int x,y,z,k;
   cin >> x >> y >> z >> k;
   ll a[x],b[y],c[z];
    for(int i=0;i<x;i++)cin >> a[i];
    for(int i=0;i<y;i++)cin >> b[i];
    for(int i=0;i<z;i++)cin >> c[i];
    vector<ll> xy,xyz;
    for(int i=0;i<x;i++)
    {
        for(int j=0;j<y;j++)
        {
            xy.push_back(a[i]+b[j]);
        }
    }

    sort(all(xy),greater<ll>());
    sort(c,c+z,greater<ll>());
    ll cnt = 0;
    bool ok = true;
    for(int i=0;i<min(k,(int)xy.size());i++){
        for(int j=0;j<z;j++)
        {
            xyz.push_back(xy[i]+c[j]);
        }
        
    }

    sort(all(xyz),greater<ll>());
    for(int i=0;i<k;i++)
    cout << xyz[i] << endl;
}


Measured memory_bytes: 43236
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll a,b,c,i,j,k,l,m,n,ans,tmp,hoge,fuga,piyo,f;
ll x[10010],y[10010];
string s,str;
int main(){
  cin>>n;
  n%=10;
  if(n==3)cout<<"bon";
  else if(n==0||n==1||n==6||n==8)cout<<"pon";
  else cout<<"hon";
  
  
  
  
  f=-1;
  if(f==0)cout<<"No";
  else if(f==1) cout<<"Yes";
  return 0;
}

Measured memory_bytes: 3640
while(True):
    a=list(map(int,input().split()))
    if(a[0]==0 and a[1]==0):
        break
    for x in range(a[0]):
        if x%2==0:
            for y in range(a[1]):
                if y%2==0:
                    print("#", end="")
                else:
                    print(".", end="")
            print()
        else:
            for y in range(a[1]):
                if y%2==1:
                    print("#", end="")
                else:
                    print(".", end="")
            print()
    print()

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

using namespace std;

int x[5];
int ta;

int main() {
	for (int i = 0; i < 6; i++) {
		scanf("%d", &ta);
		x[ta]++;
	}
	for (int i = 1; i <= 4; i++)
		if (x[i] > 2) {
			puts("NO");
			return 0;
		}
	puts("YES");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq  priority_queue<double, std::vector<double>, std::greater<double>>

int lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

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




int main(){
    int X,A;
    cin >> X >> A;
    if(X < A){
        cout << 0 << endl;
    }
    else{
        cout << 10 << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int month, day, t, i;
  int monthday[11] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30};

  while (1) {
    t = 3;
    scanf("%d %d", &month, &day);
    if (month == 0) break;

    for (i = 0; i < month - 1; i++)
      t += monthday[i];
    t += day;

    switch (t % 7) {
    case 1:printf("Monday\n"); break;
    case 2:printf("Tuesday\n"); break;
    case 3:printf("Wednesday\n"); break;
    case 4:printf("Thursday\n"); break;
    case 5:printf("Friday\n"); break;
    case 6:printf("Saturday\n"); break;
    case 0:printf("Sunday\n"); break;
    }
  }
  return 0;
}

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


void solve(long long A, long long B){
    if (A == 1) {
        A += 13;
    }
    if (B == 1) {
        B += 13;
    }
    if (A > B) {
        cout << "Alice" << endl;
    }
    else if (B > A) {
        cout << "Bob" << endl;
    }
    else {
        cout << "Draw" << endl;
    }
}

// Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

typedef pair<int, int> P;

const int INF = 1e+9;
const int DEPTH = 18;

struct SegTree {
	P val[1 << (DEPTH + 1)];	//(min, pos)
	
	SegTree() {
		int i;
		rep(i, (1 << (DEPTH + 1))) val[i] = P(INF, -1);
	}
	
	void update(int pos, int x) {
		pos += (1 << DEPTH) - 1;
		val[pos] = P(x, pos - ((1 << DEPTH) - 1));
		while (pos > 0) {
			pos = (pos - 1) / 2;
			val[pos] = min(val[pos * 2 + 1], val[pos * 2 + 2]);
		}
	}
	
	//[l, r)
	P getMin(int l, int r, int a = 0, int b = (1 << DEPTH), int id = 0) {
		if (a >= r || b <= l) return P(INF, -1);
		if (l <= a && b <= r) return val[id];
		
		P res1 = getMin(l, r, a, (a + b) / 2, id * 2 + 1);
		P res2 = getMin(l, r, (a + b) / 2, b, id * 2 + 2);
		return min(res1, res2);
	}
};

int n, m;
string s;
SegTree dp;

signed main() {
	int i;
	cin >> n >> m >> s;
	
	rep(i, n + m + 1) dp.update(i, INF);
	dp.update(n, 0);
	
	for (i = n - 1; i >= 0; i--) {
		if (s[i] == '1') continue;
		P res = dp.getMin(i + 1, i + m + 1);
		//cout << "dp[" << i << "] = " << res.first + 1 << endl;
		dp.update(i, res.first + 1);
	}
	
	if (dp.getMin(0, 1).first >= INF) { cout << -1 << endl; return 0; }
	
	int pos = 0;
	vector<int> ans;
	while (pos < n) {
		P res = dp.getMin(pos + 1, pos + m + 1);
		//cout << "pos = " << pos << ", res = (" << res.first << ", " << res.second << ")" << endl;
		ans.push_back(res.second - pos);
		pos = res.second;
	}
	
	rep(i, ans.size()) {
		cout << ans[i];
		if (i + 1 < ans.size()) cout << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 5240
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define max3(a,b,c) max(a,max(b,c))
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define mo 998244353
#define inf 1000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define ms 16
#define endl '\n'

 
using namespace std ;
 
#define N 100005

typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

int main()
{  
/////////////////////////////////////
    
    fastio;

    lli h,w;
    cin>>h>>w;

    char c[h+1][w+1];

    loopl(i,1,h+1)
    {
        loopl(j,1,w+1)
        cin>>c[i][j];
    }

    vll row[h+1] , col[w+1] ;

    loopl(i,1,h+1)
    {
        row[i].pb(0);

        loopl(j,1,w+1)
        {
            if(c[i][j] == '#')
                row[i].pb(j);
        }

        row[i].pb(w+1);
    }

    loopl(i,1,w+1)
    {
        col[i].pb(0);

        loopl(j,1,h+1)
        {
            if(c[j][i] == '#')
                col[i].pb(j);
        }

        col[i].pb(h+1);
    }

    lli ans=0;
    loopl(i,1,h+1)
    {
        loopl(j,1,w+1)
        {
            lli cnt=0;
            if(c[i][j] == '#') continue;

            auto x = ub(col[j].begin(),col[j].end(),i);
            auto y = ub(col[j].begin(),col[j].end(),i);
            y--;

            cnt = cnt+(*x - *y - 1);

            x = ub(row[i].begin(),row[i].end(),j);
            y = ub(row[i].begin(),row[i].end(),j);
            y--;

            cnt = cnt + (*x - *y - 1);
            
            ans = max(ans,cnt-1);
        }
    }

    cout<<ans;






}

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

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

    int sum = 0;
    int temp = n;
    while (temp > 0) {
        sum += temp % 10;
        temp /= 10;
    }
    if (n % sum == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
int s[105],t[105];
char a[105][105];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;++i)
	for(int j=1;j<=m;++j)
	cin>>a[i][j];
	for(int i=1;i<=n;++i)
	{
		int tag=0;
		for(int j=1;j<=m;++j)
		{
			if(a[i][j]=='.') continue;
			else{tag=1;break;}
		}
		if(!tag) s[i]=1;
	}
	for(int i=1;i<=m;++i)
	{
		int tag=0;
		for(int j=1;j<=n;++j)
		{
			if(a[j][i]=='.') continue;
			else{tag=1;break;}
		}
		if(!tag) t[i]=1;
	}
	for(int i=1;i<=n;++i)
	{
		if(s[i]) continue;
		for(int j=1;j<=m;++j)
		{
			if(t[j]) continue;
			putchar(a[i][j]);
		}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a, b, c;
    int tmp;
 
    scanf("%d%d%d", &a, &b, &c);
    if (a > b) tmp = a, a = b, b = tmp;
    if (b > c) {
        tmp = b, b = c, c = tmp;
        if (a > b) tmp = a, a = b, b = tmp;
    }
    printf("%d %d %d\n", a, b, c);
    return 0;
}


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

int main()
{
	long long int N;
	cin >> N;
	long int ans = 1e10;

	for (long int i = 1; i*i <= N; i++) {
		if (N % i == 0) {
			long int j = N/i;
			ans = i + j - 2;
		}
	}

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] arg){
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        String op = in.next();
        int b = in.nextInt();
        
        if(op.equals("+")){
            System.out.print(a + b);
        }else if(op.equals("-")){
            System.out.print(a - b);
        }
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    vi t(n);
    int sum = 0;
    REP(i, n) {
        cin >> t[i];
        sum += t[i];
    }
    int m;
    cin >> m;
    int p, x;
    REP(i, m) {
        cin >> p >> x;
        p--;
        cout << sum - t[p] + x << endl;
    }

}


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

using namespace std;

int main() {
	int n, d[110];
	cin >> n;
	for (int i = 0; i < n; ++i) cin >> d[i];
	int r = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			r += d[i] * d[j];
		}
	}
	cout << r;
}

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

int main() 
{
  string S;
  getline(cin, S);
  
  for(int i = 0; i < S.size(); i++)
  {
    if(S.at(i) >= 'A' && S.at(i) <= 'Z' && i != 2)
    {
      cout << S.at(i);
    }
    else
    {
      continue;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
/*
#include<algorithm>
#include<array>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<typeinfo>
#include<utility>
#include<vector>
*/
#define int long long int
#define double long double
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define rep(i, n) for (int(i) = 0, i##_len = (n); (i) < i##_len; (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)--)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define bit(n) ((int)(1) << (n))
#define all(x) (x).begin(), (x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl
#define nint int
using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
typedef pair<int, int> pii;
typedef pair<double, double> dop;
template <class T>
bool chmax(T& a, const T& b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b)
{
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
struct aaa {
    aaa()
    {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} aaaaaaa;


signed main()
{
    int n;
    cin >> n;
    cout << n * n * n << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;
const int MOD=1000000007;

int H,W,K;
int dp[105][15];

signed main(){
	cin>>H>>W>>K;
	if(W==1){
		cout<<1<<endl;
	}
	else{
		dp[0][0]=1;
		for(int i=1;i<=H;i++){
			for(int j=0;j<W;j++){
				for(int k=0;k<(1<<(W-1));k++){
					bool flag=true;
					for(int l=0;l<W-2;l++){
						if((k>>l)&1 && (k>>(l+1)&1)){
							flag=false;
						}
					}
					if(flag==true){
						if(j>0 && (k>>(j-1)&1)){
							dp[i][j-1]+=dp[i-1][j];
							dp[i][j-1]%=MOD;
						}
						else if(j<W-1 && (k>>j)&1){
							dp[i][j+1]+=dp[i-1][j];
							dp[i][j+1]%=MOD;
						}
						else{
							dp[i][j]+=dp[i-1][j];
							dp[i][j]%=MOD;
						}
					}
				}
			}
		}
		cout<<dp[H][K-1]<<endl;
	}
	
	return 0;
}


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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(ll i=0; i<(n); i++)
#define REPj(n) for(ll j=0; j<(n); j++)
#define REPinit(i,a,n) for(int i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(int j=(a); j<(n); j++)

//algorithm
#define SORT(c) sort((c).begin(),(c).end())
#define CONTAINER_ALL(a) a.begin(),a.end()

//constant

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

//std out
template<typename T>
void print_container(const vector<T> vals) {
    REPinit(i, 0, vals.size() - 1) cout << vals.at(i) << " ";
    cout << vals.back();
}


bool judge(int a, int b, int c) {
    if ((a > b && b > c) || (a < b && b < c)) return true;
    return false;
}

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

    int N;
    cin >> N;

    vector<int> A(N, 0);
    REPinit(i, 0, N) cin >> A[i];
    vector<int> B(N, 0);
    REPinit(i, 0, N) cin >> B[i];
    vector<int> C(N - 1, 0);
    REPinit(i, 0, N - 1) cin >> C[i];

    int ans = 0;
    REPinit(i, 0, N) {
        ans += B[A[i] - 1];
        if (i == 0) continue;
        if (A[i] - A[i - 1] == 1) ans += C[A[i] - 2];
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
using namespace std;
int main() {
  int n;
  string ans;
  std::cin >> n;
  switch (n % 10) {
    case 0:
    case 1:
    case 6:
    case 8:
      ans = "pon";
      break;
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      ans = "hon";
      break;
    case 3:
      ans = "bon";
      break;
  }
  std::cout << ans;
}


Measured memory_bytes: 3580
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
ll conv(vector<ll>v, ll t)
{
	for (int i = 0; i < v.size(); i++)
	{
		if ((v[i] ^ t) < t && (v[i] ^ t) < v[i])t ^= v[i];
	}
	return t;
}
ll d[222];
int main()
{
	int data;
	scanf("%d", &data);
	for (int p = 0; p < data; p++)
	{
		int num;
		scanf("%d", &num);
		for (int i = 0; i < num; i++)scanf("%lld", &d[i]);
		string s;
		cin >> s;
		vector<ll>v;
		bool f = true;
		for (int i = s.size() - 1; i >= 0; i--)
		{
			//printf("----%lld\n", conv(v, d[i]));
			if (s[i] == '0')
			{
				ll z = conv(v, d[i]);
				if (z != 0)v.push_back(z);
			}
			else
			{
				ll z = conv(v, d[i]);
				if (z != 0)f = false;
			}
			sort(v.begin(), v.end());
			reverse(v.begin(), v.end());
			//for (int j = 0; j < v.size(); j++)printf("%lld ", v[j]); printf("---%d\n",f);
		}
		if (f)printf("0\n");
		else printf("1\n");
	}
}

Measured memory_bytes: 3176
#include<stdio.h>
int main(void){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a==1){
		a=14;
	}
	if(b==1){
		b=14;
	}
	if(a>b){
		printf("Alice\n");
	}
	else if(a<b){
		printf("Bob\n");
	}
	else{
		printf("Draw\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
constexpr ll INF = LLONG_MAX;
constexpr double DINF = DBL_MAX;
constexpr ll mod = 1e9+7;
constexpr double PI = M_PI;

template<typename T>
vector<T> make_v(size_t a){
  return vector<T>(a);
}
 
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

int main(){
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
 
  long long n, k, ans = 0;
  cin >> n >> k;
  long long ma, mi;
  for(ll i = k; i <= n+1; i++){
    ma = i*(2*n+1-i)/2;
    mi = i*(i-1)/2;
    ans += ma-mi+1;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
char s[MAXN];
int N;
void Solve() {
    scanf("%s",s + 1);
    N = strlen(s + 1);
    for(int i = 1 ; i < N ; ++i) {
	if(s[i] == s[i + 1]) {out(i);space;out(i + 1);enter;return;}
	if(i != N - 1) {
	    if(s[i] == s[i + 2]) {out(i);space;out(i + 2);enter;return;}
	}
    }
    out(-1);space;out(-1);enter;
}

int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define LINF 1e18
#define INF 1e9
using namespace std;

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

int main(){
    ll k,sum = 0;
    cin >> k;

    rep(a,1,k+1) rep(b,1,k+1) rep(c,1,k+1) sum += gcd(gcd(a,b),c);
    
    cout << sum << endl;
    return 0;
}

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

int main() {

    int M, D;
    cin >> M >> D;

    int counter = 0;

    if ((M<4) || (D<22)) {
        cout << counter << endl;
        exit(0);
    }

    for (int m=4; m<M+1; m++) {
        
        string day;

        for (int d=22; d<D+1; d++) {

            day = to_string(d);
            int day10 = day.at(0) - '0';
            int day1  = day.at(1) - '0';

            if (day1 == 0 || day1 == 1) continue;

            if (m == day10*day1) counter += 1;
            else continue;

        }

    }

    cout << counter << endl;



}

Measured memory_bytes: 256
# まず、複数枚ある場合を考えると、3->最終的に1枚 4->最終的に2枚 5->最終的に1枚 6->最終的に2枚... となる。遇奇で変わりそう
# 最終的に1枚になる場合はいいとして、2枚になる場合は自分以外のどれかを1枚犠牲にするしかない
# できるだけ種類を多く残すには、ほかの2枚以上あるやつから選んだほうが得（2 2 3 3 が 2 3 になってくれる
# ということで、「最終的に2枚になるのが偶数種類なら相殺してくれる、そうじゃないなら全体から1枚犠牲にする」でよさそう
n = int(input())
a = list(map(int, input().split()))
d = {}
for av in a:
    if av in d:
        d[av] += 1
    else:
        d[av] = 1
c = 0
for v in d.values():
    if v > 0 and v % 2 == 0:
        c += 1
if c % 2 == 0:
    print(len(set(a)))
else:
    print(len(set(a)) - 1)


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int main()
{
    int n,a,b;
    string s;
    cin >>n >>a >>b >>s;

    int x=0,y=0;
    rep(i,n)
    {
        if(s[i]=='a')
        {
            if(x+y<a+b)
            {
                printf("Yes\n");
                ++x;
            }
            else printf("No\n");
        }
        else if(s[i]=='b')
        {
            if(x+y<a+b && y<b)
            {
                printf("Yes\n");
                ++y;
            }
            else printf("No\n");
        }
        else printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 896
import math
def main(X):
    if X <= 3:
        return X
    SosuuFlg = False
    while SosuuFlg == False:
        max_search = int(math.sqrt(X)+1) if math.sqrt(X) % 1 == 0 else math.ceil(math.sqrt(X))
        for i in range(2, max_search):
            if X % i == 0:
                break
        else:
            SosuuFlg = True
            return X
        X += 1
        
X = int(input())
print(main(X))

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

#define fi first
#define se second
#define FOR(a, b, c) for(int a = b; a <= c; ++a)
#define pb push_back

const int N = 1e2 + 10;

int n, limd, limu;
int p[N], cnt[3];

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

    cin >> n >> limd >> limu;
    FOR(i, 1, n)    {
        int x; cin >> x;
        if(x <= limd) cnt[0] ++;
        else if(x > limd && x <= limu) cnt[1] ++;
        else cnt[2] ++;
    }
    cout << min(cnt[0], min(cnt[1], cnt[2]));
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int simulate(vector<int> &line, int *a)
{
  int ans = 100000;
  for (int i = 0; i < line.size(); i++)
  {
    for (int j = i + 1; j < line.size(); j++)
    {
      for (int k = j + 1; k < line.size(); k++)
      {
        for (int l = 0; l < 3; l++)
        {
          int temp_1 = abs(line[i] - a[l]) + abs(line[j] - a[(l + 1) % 3]) + abs(line[k] - a[(l + 2) % 3]);
          int temp_2 = abs(line[i] - a[l]) + abs(line[j] - a[(l + 2) % 3]) + abs(line[k] - a[(l + 1) % 3]);
          if (temp_2 < temp_1)
            temp_1 = temp_2;
          if (ans > temp_1)
            ans = temp_1;
        }
      }
    }
  }
  return ans;
}
void check(vector<int> lines, int &cost, int *a, int count)
{
  int temp = simulate(lines, a);
  if (temp + count * 10 < cost)
    cost = temp + count * 10;
  if (lines.size() == 3)
    return;
  for (int i = 0; i < lines.size(); i++)
  {
    for (int j = i + 1; j < lines.size(); j++)
    {
      vector<int> nea = lines;
      nea[i] += nea[j];
      nea.erase(nea.begin() + j);
      check(nea, cost, a, count + 1);
    }
  }
}
int main(void)
{
  vector<int> lines;
  int num;
  int a[3];
  cin >> num >> a[0] >> a[1] >> a[2];
  int m_max = num - 2;
  lines.resize(num, 0);
  for (int i = 0; i < num; i++)
  {
    int temp = 0;
    cin >> temp;
    lines[i] = temp;
  }
  int min_temp;
  min_temp = 100000;
  check(lines, min_temp, a, 0);
  cout << min_temp;
}


Measured memory_bytes: 256
#include <stdio.h>
int main (void)
{
    int n;
    
    scanf("%d", &n);
    if (n % 10 == 3){
        printf("bon");
    }else if(n%10==0||n%10==1||n%10==6||n%10==8){
       printf("pon");    
    }else{
        printf("hon");
    }
    
    return 0;
}

Measured memory_bytes: 1732
import java.util.Scanner;
public class Main {
private static Scanner s = new Scanner(System.in);
public static void main(String[] args) {
	int n = s.nextInt();
	int u,k,v = 0;
	int min;
	int[] d = new int[n];
	int[][] T = new int[n][n];
	int[] times = new int[n];

	for(int i = 0;i < n;i++) {
		for(int j = 0;j < n;j++) {
			T[i][j] = -1;
		}
		d[i] = Integer.MAX_VALUE;
	}

	for(int i = 0;i < n;i++) {
		u = s.nextInt();
		k = s.nextInt();
		for(int j = 0;j < k;j++) {
			v = s.nextInt();
			T[u][v] = s.nextInt();
		}
	}
	d[0] = 0;
	times[0] = 1;
	while(true) {
		min = Integer.MAX_VALUE;
		int hantei = -1;
		for(int i = 0;i < n;i++) {
			if(min > d[i] && times[i] != 2) {
				hantei = i;
				min = d[i];
			}
		}
		if(hantei == -1) break;
		times[hantei] = 2;
		for(int i = 0;i < n;i++) {
			if(times[i] != 2 && T[hantei][i] != -1) {
				if(d[i] > d[hantei] + T[hantei][i]) {
					d[i] = d[hantei] + T[hantei][i];
					times[i] = 1;
				}
			}
		}
	}
	for(int i = 0;i < n;i++) {
		if(d[i] == Integer.MAX_VALUE) {
			System.out.println(i + " " + -1);
		}else {
			System.out.println(i + " " + d[i]);
		}
	}
}
}


Measured memory_bytes: 40696
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define MAX 15

int jin[MAX][MAX];
int main()
{

    int n;
    while(cin>>n)
    {
        if(n==0)break;
        memset(jin,0,sizeof(jin));
        int x = n/2, y = n/2 +1;
        int nextx,nexty;
        jin[x][y] = 1;
        for(int i=2;i<=n*n;++i)
        {
            nextx = (x==(n-1) )? 0:x+1;
            nexty =(y==n-1)? 0 : y+1;
            if(jin[nextx][nexty] == 0)
            {
                jin[nextx][nexty] = i;
                x = nextx; y = nexty;
            }
            else
            {
                nextx = (nextx==(0))? n-1:nextx-1;
                nexty = (nexty==n-1)? 0:nexty+1;
                jin[x][nexty] = i;
                x = nextx;
                y = nexty;
            }
        }
        for(int j=0;j<n;j++)
        {
            for(int i=0;i<n;i++)
            {
                printf("%4d",jin[i][j]);
            }
            cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>

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

using namespace std;

int main(void){
	for(int n, count = 0; cin >> n; cout << count << endl, count = 0)
		rep(a, 9) rep(b, 9) rep(c, 9) rep(d, 9)
			if(a + b + c + d == n) count ++;
					
	return 0;
}

Measured memory_bytes: 1160
let readIntArray _ =
    stdin.ReadLine().Split(" ") |> Array.map int

readIntArray ()
|> fun [| k; s |] ->
    seq {
        for x in 0 .. k do
            if x <= s then
                for y in 0 .. k do
                    if (x + y) <= s && (k >= s - x - y) then yield 1
    }
    |> Seq.length
    |> printfn "%d"


Measured memory_bytes: 30260
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back


int MOD=1000000007;
int N,M;

signed main(){
    scanf("%lld",&N);
    int ans=0;
    ans=N*N;
    printf("%lld\n",ans);
}


Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  ll a; long double b; cin >> a >> b;
  ll ans=a*b;
  cout << ans << endl;
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    long n,cnta=0,cntb=0;
    cin >> n;
    long a[n],b[n];
    rep(i,n){
        cin >> a[i];
        cnta += a[i];
    } 
    rep(i,n){
        cin >> b[i];
        cntb += b[i];
    } 
    if(cnta<cntb) cout << -1 << endl;
    else{
        long cur = 0,ans=0;
        vector<long> d;
        rep(i,n){
            if(a[i]<b[i]){
              cur += b[i]-a[i];
              ans++;
            } 
            else  d.push_back(a[i]-b[i]);
        }
        sort(d.begin(),d.end());
        reverse(d.begin(),d.end());
        for(auto i:d){
            if(cur>0){
                cur -= i;
                ans++;
            }
        }
        cout << ans << endl;
    }
}


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

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	lld k;
	cin >> k;

	if (k==0)
	{
		cout << 2 << endl;
		cout << 1 << " " << 1 << endl;;
	}else if (k==1)
	{
		cout << 2 << endl;
		cout << 2 << " " << 0 << endl;
	}else if (k <= 50)
	{
		cout << k << endl;
		for(int i = k; i > 1; i--)
		{
			cout << i << " ";
		}cout << 1 << endl;
	}else
	{
		cout << 50 << endl;
		lld x = k / 50, r = k % 50;
		lld ans[51] = {0};
		for(int i = 50; i >= 1; i--)
		{
			ans[i] = x-1 + i;
		}
		int i = 50;
		while(r > 0)
		{
			ans[i]++;
			i--;
			r--;
		}

		for(int i = 50; i > 1; i--)
		{
			cout << ans[i] << " ";
		}cout << ans[1] << endl;

	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int n,a;
  cin>>n;

  if(400<=n && n<600) a=8;
  if(600<=n && n<800) a=7;
  if(800<=n && n<1000) a=6;
  if(1000<=n && n<1200) a=5;
  if(1200<=n && n<1400) a=4;
  if(1400<=n && n<1600) a=3;
  if(1600<=n && n<1800) a=2;
  if(1800<=n && n<2000) a=1;


  cout << a << endl;

}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define reg register
using namespace std;
int n, a[1000001], sum;
int main()
{ 
    cin >> n;
    for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + n + 1);
    if(a[n] - a[1] > 1) cout << "No\n";
    else if(a[n] - a[1] == 0){
        if(a[1] * 2 > n&&a[1]!=n-1) cout << "No\n";
        else cout << "Yes\n"; 
    }
    else if(a[n] - a[1] == 1){
        for(int i = 1; i <= n; i++)  if(a[i] == a[1]) sum++;
        if(sum >= a[n]) cout << "No\n";
        else if((a[n]-sum) * 2 > n - sum) cout <<"No\n";
        else cout << "Yes\n";
    }
}

Measured memory_bytes: 640