akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    PriorityQueue<Integer> pq = new PriorityQueue<>();
    PriorityQueue<Integer> pqn = new PriorityQueue<>();
    for (int i = 0; i < n; i++) pq.add(sc.nextInt());
    while (true) {
      pqn.clear();
      int min = pq.poll();
      for (int val : pq) {
        int mod = val % min;
        if (mod > 0) pqn.add(mod);
      }
      if (pqn.isEmpty()) {
        System.out.println(min);
        return;
      }
      pq.clear();
      pq.add(min);
      pq.addAll(pqn);
    }
  }
}

Measured memory_bytes: 44448
#include<bits/stdc++.h>
using namespace std;
int main(){
unsigned long long int n,i,k;
  cin>>n>>k;
  if(k>=n)
  {
  cout<<0;
  return 0;
  }
  
 unsigned long long int a[n];
  for(i=0;i<n;i++){
 unsigned long long int t;
    cin>>t;
    a[i] = t;
  }
  
  sort(a,a+n);
  
  unsigned long long int sum=0;
  for(i=0;i<n-k;i++){
  sum+=a[i];
  }
cout<<sum;
  return 0;
}


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

using namespace std;

unsigned int a[1000001];

int main()
{
	unsigned int s;

	cin >> s;

	a[0] = s;
	for (unsigned int i = 1; i < 1000000; ++i) {
		if (a[i - 1] % 2 == 0)
			a[i] =  a[i-1]/2;
		else
			a[i] =  a[i-1]*3+1;

		for (unsigned int j = 0; j < i; ++j) {
			if (a[i] == a[j]) {
				cout << i+1 << endl;
				return 0;
			}
		}
	}

	return 0;
}
    

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

long read_long() {
	long ret=0;char c=getchar();
	while(c<'0' || c>'9') c=getchar();
	while(c>='0' && c<='9') {
		ret=ret*10+c-'0';
		c=getchar();
	}		return ret;
}

const long MAXN=100010;
long n;

long to[2*MAXN],next_edge[2*MAXN],head[MAXN],
	colour[2*MAXN],num_of_edge=0;
long num_edge_connected[MAXN],max_num_edge_connected;
void insert_edge(long u,long v) {
	to[++num_of_edge]=v;
	next_edge[num_of_edge]=head[u];
	head[u]=num_of_edge;
	++num_edge_connected[u];
	to[++num_of_edge]=u;
	next_edge[num_of_edge]=head[v];
	head[v]=num_of_edge;
	++num_edge_connected[v];
}

struct node{
	long num;
	long used_colour;
};
queue<node> q;

int main() {
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n=read_long();
	long a,b;
	register long i;
	for(i=1;i<n;++i) {
		a=read_long();
		b=read_long();
		insert_edge(a,b);
	}
	for(i=1;i<=n;++i)
		max_num_edge_connected=max(max_num_edge_connected,num_edge_connected[i]);
	printf("%ld\n",max_num_edge_connected);
	q.push((node){1,0});
	
	register long now_edge,now_using_colour;
	node top;
	
	while(!q.empty()) {
		top=q.front();
		q.pop();
		
		now_using_colour=1;
		for(now_edge=head[top.num];to[now_edge];now_edge=next_edge[now_edge])
			if(colour[now_edge]==0) {
				if(now_using_colour==top.used_colour)
					++now_using_colour;
				colour[now_edge]=now_using_colour;
				if(now_edge%2==0)
					colour[now_edge-1]=now_using_colour;
				else
					colour[now_edge+1]=now_using_colour;
				q.push((node){to[now_edge],now_using_colour});
				++now_using_colour;
			}
	}
	for(i=1;i<=2*(n-1);i+=2)
		printf("%ld\n",colour[i]);
	return 0;
}

Measured memory_bytes: 6912
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <set>
#include <map>
using namespace std;

int main() {
  string s;
  map<int,pair<int,int> > m;
  int k = (1<<0);
  while(getline(cin, s)) {
    if(s == "") {
      k = (k<<1);
    } else {
      stringstream ss(s);
      int id;
      ss >> id;
      ++m[id].first;
      m[id].second |= k;
    }
  }

  for(map<int,pair<int,int> >::iterator it = m.begin();
      it != m.end(); ++it) {
    if(it->second.second == 3) {
      cout << it->first << " " << it->second.first << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1224
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
  int n,p;
  cin>>n>>p;
  string s;
  cin>>s;
  int out=0;
  map<int,int>ma;
  ma[0]++;
  int a=0,c=1;
  rep(i,n){
    a+=(s[n-1-i]-'0')*c;
    a%=p;
    (c*=10)%=p;
    if(p==2||p==5){
      if((s[n-1-i]-'0')%p==0)out+=n-i;
  	}else out+=ma[a];
    ma[a]++;
  }
  
  cout<<out<<endl;
}







Measured memory_bytes: 1044
package main

import (
	"fmt"
)

func pow(args ...int) int {
	x, y := args[0], args[1]
	res := 1
	if len(args) == 3 {
		mod := args[2]
		for y != 0 {
			if y&1 == 1 {
				res = res * x % mod
			}
			y >>= 1
			x = x * x % mod
		}
	} else {
		for y != 0 {
			if y&1 == 1 {
				res *= x
			}
			y >>= 1
			x *= x
		}
	}
	return res
}

const mod = 1e9 + 7

func makeTables(n, r, p int) ([]int, []int, []int) {
	fac, ifac, nChoose := make([]int, r+1), make([]int, r+1), make([]int, r+1)
	fac[0] = 1
	for i := 0; i < r; i++ {
		fac[i+1] = fac[i] * (i + 1) % p
	}
	ifac[r] = pow(fac[r], p-2, p)
	for i := r; i > 0; i-- {
		ifac[i-1] = ifac[i] * i % p
	}
	nChoose[0] = 1
	for i := 0; i < r; i++ {
		nChoose[i+1] = nChoose[i] * (n - i) % p
	}
	for i := 0; i < r+1; i++ {
		nChoose[i] = nChoose[i] * ifac[i] % p
	}
	return fac, ifac, nChoose
}

var fac, ifac, nChoose = makeTables(1e9, 1e7, mod)

func choose(n, r int) int {
	if r > n || r < 0 {
		return 0
	}
	var p int = mod
	return fac[n] * ifac[n-r] % p * ifac[r] % p
}

func main() {
	var n int
	fmt.Scan(&n)
	fmt.Println(fac[n])
}


Measured memory_bytes: 242432
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

def main():
  n, m = map(int, input().split())
  xs   = list(map(int, input().split()))
  xs.sort()
  dxs = [abs(xs[i]-xs[i+1]) for i in range(len(xs)-1)]

  if n >= m:
    print(0)

  else:
    dxs.sort(reverse=True)
    del dxs[:(n-1)]
    print(sum(dxs))


if __name__=='__main__':
  main()

Measured memory_bytes: 13968
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define gcd __gcd
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
#define pr(n) printf("%d ",n)
#define out(n) printf("%d\n",n)
#define inl(a) cin >> a
#define prl(a) cout << a << " "
#define outl(a) cout << a << endl
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define ck printf("continue\n")
#define all(vec) vec.begin(),vec.end()
#define asc(vec) sort(vec.begin(),vec.end())
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
#define tddd tuple<double,double,double>
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<int,pair<int,int> > >
#define vvii vector<vector<pair<int,int> > >
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define N 100005
typedef long long int ll;
vector<vector<ll> > ad(N),pre(N),suf(N);
int vis[N];
ll sub[N],upar[N];
int par[N];
int m;
ll pro(ll a,ll b)
{
    return (a*b)%m;
}
void dfs(int s)
{
    int i,x,a;
    sub[s]=1,vis[s]=1;
    x=ad[s].size();
    rep(i,x)
    {
        a=ad[s][i];
        if(!vis[a])
            par[a]=s,dfs(a),sub[s]=pro(sub[s],sub[a]+1);
        pre[s][i]=sub[s];
    }
    sub[s]=1;
    for(i=x-1;i>=0;i--)
    {
        a=ad[s][i];
        if(par[s]!=a)
            sub[s]=pro(sub[s],sub[a]+1);
        suf[s][i]=sub[s];
    }
    return ;
}
void dfs1(int s)
{
    int i,a,x;
    x=ad[s].size();
    rep(i,x)
    {
        a=ad[s][i];
        if(par[s]!=a)
        {
            upar[a]=upar[s]+1;
            if(i>0)
                upar[a]=pro(upar[a],pre[s][i-1]);
            if(i+1<x)
                upar[a]=pro(upar[a],suf[s][i+1]);
            dfs1(a);
        }
    }
    return ;
}
int main()
{
    int n,i,x,y;
    in2(n,m);
    rep(i,n-1)
    {
        in2(x,y);
        ad[x].pb(y);
        ad[y].pb(x);
    }
    lp(i,1,n+1)
        pre[i].resize(ad[i].size()),suf[i].resize(ad[i].size());
    dfs(1);
    dfs1(1);
    lp(i,1,n+1)
        outl(pro(sub[i],upar[i]+1));
}



Measured memory_bytes: 25600
#include<string>
#include<vector>
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

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

int main(){

	double h;
	vector<double>v;

	while(cin >> h){

    v.push_back(h);

	}

	sort(v.begin(),v.end());

	cout << v[v.size()-1]-v[0] << endl;

	return 0;
}

Measured memory_bytes: 1304
#include <iostream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <iterator>
#include <map>
#include <set>
using namespace std;


typedef long long ll;

#define repr(itr, bgn, end) for (ll itr = (ll)bgn; itr < (ll)end; itr++)
#define rep(itr, end) repr(itr, 0, end)

#define all(container) container.begin(), container.end()
#define yn(cond) cond ? cout << "Yes" << endl : cout << "No" << endl
#define YN(cond) cond ? cout << "YES" << endl : cout << "NO" << endl


int main(void) {

    int A, B, K;
    cin >> A >> B >> K;

    set<int> s;
    repr(i, A, min(A + K, B + 1)) s.insert(i);
    repr(i, max(A, B - K + 1), B + 1) s.insert(i);

    for (auto i: s){
        cout << i << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
    long long i,n,buffer;
    cin>>n>>buffer;
    long long max=buffer, min=buffer, tot=0;
    
    for(i=0;i<n;i++){
        tot+=buffer;
        if (buffer>max) max=buffer;
        if (buffer<min) min=buffer;
        cin>>buffer;
    }
    
    cout<<min<<' '<<max<<' '<<tot<<endl;
}


Measured memory_bytes: 3108
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace ABC140
{
    public class Program
    {

        #region templete

        private static void WL(string s) { WriteLine(s); }

        /// <summary>
        /// 最小公倍数
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        static long Gcd(long a, long b)
        {
            var v = new[] { a, b };
            while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
            return v[0];
        }
        /// <summary>
        /// 最小公約数
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }

        public static void Main(string[] args)
        {
            new Program().Solve();
            ReadLine();
        }

        #endregion

        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();


            WL($"{n*n*n}");
        }

    }
}


#region console in

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

#endregion

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

int main(){
  int i,j,k,tmp;
  cin >> i >> j >> k;
  if (i > j) {
    tmp = i;
    i = j;
    j = tmp;
  }
  if (j > k) {
    tmp = j;
    j = k;
    k = tmp;
  }
  if (i > j) {
    tmp = i;
    i = j;
    j = tmp;
  }
  cout << i << " " << j << " " << k << endl;
  return 0;
}

Measured memory_bytes: 3112
#include <stdio.h>
#include <string.h>
#include <ctype.h>

struct card{
    char suit;
    int value;
};
typedef struct card card;

void print_array(card a[], int length)
{
    for(int i=0; i<length; i++){
        if(i==length-1)
            printf("%c%d\n", a[i].suit, a[i].value);
        else
            printf("%c%d ", a[i].suit, a[i].value);
    }
}

void swap(card *a, card *b)
{
    card temp = *a;
    *a = *b;
    *b = temp;
}

void bubble_sort(card a[], int length)
{
    //int swap_num = 0;
    for(int i=0; i<length; i++){
        //for(int j=0; j<length-i; j++){
        for(int j=length-1; j>=i+1; j--){
            if(a[j].value < a[j-1].value){
                swap(&a[j],&a[j-1]);
                //swap_num++;
            }
        }
    }
    //return swap_num;
}

void selection_sort(card a[], int length)
{
    //int swap_num = 0;
    for(int i=0; i<length; i++){
        int min_i = i;
        //int swap_flag = 0;
        for(int j=i; j<length; j++){
            if(a[j].value < a[min_i].value){
                min_i = j;
                //swap_flag = 1;
            }
        }
        swap(&a[i], &a[min_i]);
        //if(swap_flag == 1) swap_num++;
    }
    //return swap_num;
}

int main(){
    int data_length;
    card given_card[40];
    card given_card_copied[40];
    
    scanf("%d", &data_length);
    getchar();
    char get_input[200];
    fgets(get_input, sizeof(get_input), stdin);
    get_input[strlen(get_input) - 1] = '\0';
    
    int card_num = 0;
    for(int i=0; i<strlen(get_input); i++){
        if(isalpha(get_input[i])){
            given_card[card_num].suit = get_input[i];
            given_card[card_num].value = get_input[i+1] - '0';
            card_num++;
        }
        else;
    }

    for(int i=0; i<data_length; i++){
        given_card_copied[i].suit = given_card[i].suit; 
        given_card_copied[i].value = given_card[i].value;
    }

    bubble_sort(given_card_copied, data_length);
    print_array(given_card_copied, data_length);
    //printf("%d\n", swap);
    printf("Stable\n");
    
    for(int i=0; i<data_length; i++){
        given_card_copied[i].suit = given_card[i].suit; 
        given_card_copied[i].value = given_card[i].value;
    }

    bubble_sort(given_card, data_length);
    selection_sort(given_card_copied, data_length);
    print_array(given_card_copied, data_length);
    int is_stable = 1;
    for(int i=0; i<data_length; i++){
        if(given_card_copied[i].suit != given_card[i].suit){
            is_stable = 0;
        }
    }
    if(is_stable == 1) printf("Stable\n");
    else printf("Not stable\n");
}



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

namespace AtCoder.Abc
{
    class QuestionD
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

			int num = int.Parse(Console.ReadLine());

			var names = new List<char>();

			for(int i = 0; i < num; ++i) {
				var str = Console.ReadLine();
				names.Add(str[0]);
			}

			var nameCounts = new long[5];

			foreach (var str in names) {
				if (str == 'M') {
					++nameCounts[0];
				} else if (str == 'A') {
					++nameCounts[1];
				} else if (str == 'R') {
					++nameCounts[2];
				} else if (str == 'C') {
					++nameCounts[3];
				} else if (str == 'H') {
					++nameCounts[4];
				}
			}

			long answer = 0;

			for (int i = 0; i < 5;++i) {
				for (int j = 0; j < 5; ++j) {
					for (int k = 0; k < 5; ++k) {
						if (i < j && j < k) {
							answer += nameCounts[i] * nameCounts[j] * nameCounts[k];
						}
					}
				}
			}

            Console.WriteLine(answer);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 15328
# -*- coding: utf-8 -*-
from math import sqrt
from heapq import heapify, heappop, heappush
from string import ascii_lowercase as abc
from bisect import bisect
import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10**9)
from fractions import gcd
def inpl(): return list(map(int, input().split()))

S = input()
T = input()

D = {k:[] for k in abc}
for i in range(len(S)):
    D[S[i]].append(i)

rap = 0
ix = -1

for j in range(len(T)):
    t = T[j]
    if len(D[t]) == 0:
        print(-1)
        break
    k = bisect(D[t], ix)
    if k == len(D[t]):
        rap += 1
        ix = D[t][0]
    else:
        ix = D[t][k]
else:
    print(len(S)*rap + ix+1)

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

int main(void)
{
	int N;
	std::cin >> N;

	std::vector<int> a;
	for (int i = 0; i < N; i++) {
		int num;
		std::cin >> num;

		if (num % 2 == 0)
			a.push_back(num);
	}

	int cnt = 0;

	for (int i : a) {
		if ((i%3 == 0) || (i%5 == 0) )
			cnt++;
	}

	if (cnt == a.size())
		std::cout << "APPROVED" << std::endl;
	else
		std::cout << "DENIED" << std::endl;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
		String s2 = sc.next();
		String s3 = sc.next();
		sc.close();
		StringBuilder sb = new StringBuilder();
		char c1 = (char)(s1.charAt(0) - 'a' + 'A');
		char c2 = (char)(s2.charAt(0) - 'a' + 'A');
		char c3 = (char)(s3.charAt(0) - 'a' + 'A');
		sb.append(c1).append(c2).append(c3);
		System.out.println(sb.toString());
	}
}

Measured memory_bytes: 22868
# -*- coding: utf-8 -*-
# ITP1_11_B

class Dice:
    def __init__(self, num):
        self.num = num
        
    def show_r(self):
        """ 出目を表示する """
        print(self.num[2])
        
    def roll(self, direction):
        """ 転がす処理 """
        data = []
        new_num = []
        if direction == "N":
            data = [1, 5, 2, 3, 0, 4]
        elif direction == "S":
            data = [4, 0, 2, 3, 5, 1]
        elif direction == "E":
            data = [3, 1, 0, 5, 4, 2]
        elif direction == "W":
            data = [2, 1, 5, 0, 4, 3]
        elif direction == "L":
            data = [0, 2, 4, 1, 3, 5]
        elif direction == "R":
            data = [0, 3, 1, 4, 2, 5]

        for i in data:
            new_num.append(self.num[i])
        self.num = new_num
        
def dice_roll1(dice, dice_tf):
    dice_roll = ""
    top = dice_tf[0]
    
    if dice.num.index(top) == 1:
        dice_roll = "N"
    elif dice.num.index(top) == 2:
        dice_roll = "W"
    elif dice.num.index(top) == 3:
        dice_roll = "E"
    elif dice.num.index(top) == 4:
        dice_roll = "S"
    elif dice.num.index(top) == 5:
        dice_roll = "NN"
        
    return dice_roll

def dice_roll2(dice, dice_tf):
    dice_roll = ""
    front = dice_tf[1]
    
    if dice.num.index(front) == 2:
        dice_roll = "L"
    elif dice.num.index(front) == 3:
        dice_roll = "R"
    elif dice.num.index(front) == 4:
        dice_roll = "LL"
        
    return dice_roll

dice1 = Dice(list(map(int, input().split())))

dice_tf = []
for i in range(int(input())):
    dice_tf.append(list(map(int, input().split())))

for i in dice_tf:
    direction = dice_roll1(dice1, i)
    for j in direction:
        dice1.roll(j)
    
    direction = dice_roll2(dice1, i)
    for j in direction:
        dice1.roll(j)
        
    dice1.show_r()


Measured memory_bytes: 5608
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M); vector<vector<ll> > v(4);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()), sort(v.rbegin(), v.rend()); //sort
// char '' str ""
int main(void)
{
    int N;cin>>N; std::vector<double> v;
    double sum = 0;
    for(int i=0; i<N;i++){
      double vv; cin>>vv; v.push_back(vv);
    }
    sort(v.begin(), v.end());
    sum = (v[0] + v[1])/2;
    for(int i=2; i<N;i++){
      sum = (v[i] + sum)/2;
    }

    cout<<sum<<endl;
    return 0;
}


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

string S, T;

int main(void) {
	cin >> S >> T;

	int dif = S.length() - T.length();
	int min_cnt = 9999;
	for (int i = 0; i <= dif; ++i) {
		int cnt = 0;
		for (int j = 0; j < (int)T.length(); ++j) {
			if (S[i + j] != T[j])
				++cnt;
		}
		min_cnt = min(cnt, min_cnt);
	}

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


Measured memory_bytes: 3612
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  cin >> N;
  set<ll> s;
  ll a;
  for (int i = 0; i < N; i++) {
    cin >> a;
    if (s.find(a) == s.end()) {
      s.insert(a);
    } else {
      s.erase(a);
    }
  }
  cout << s.size() << endl;
  return 0;
}

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

typedef long long ll;

struct Fig{
  string key;
  int value;
};

void print(int n,vector<Fig> a){
  cout << a[0].key;
  for(int i=1;i<n;i++) cout << " " << a[i].key;
  cout << endl;
}

int main(){
  int n;
  cin >> n;
  vector<Fig> bubble(n),selection(n);
  
  for(int i=0;i<n;i++){
    cin >> bubble[i].key;
    bubble[i].value = (bubble[i].key[1]-'0');
    selection[i].key = bubble[i].key;
    selection[i].value = bubble[i].value;
  }

  for(int i=0;i<n;i++){
    for(int j=n-1;j>i;j--){
      if(bubble[j].value < bubble[j-1].value){
	Fig tmp = bubble[j];
	bubble[j] = bubble[j-1];
	bubble[j-1] = tmp;
      }
    }
  }
  print(n,bubble);
  cout << "Stable" << endl;
  
  for(int i=0;i<n;i++){
    int minj = i;
    for(int j=i;j<n;j++){
      if(selection[j].value < selection[minj].value) minj = j;
    }
    if(minj != i){
      Fig tmp = selection[i];
      selection[i] = selection[minj];
      selection[minj]= tmp;
    }
  }
  print(n,selection);
  
  for(int i=0;i<n;i++){
    if(bubble[i].key != selection[i].key){
      cout << "Not stable" << endl;
      return 0;
    }
  }
  cout << "Stable" << endl;
  return 0;
}



Measured memory_bytes: 3232
N, K = map(int, input().split())

x = 2
count = 1
while(True):
    if x < K:
        x = x * 2
        count += 1
    else:
        break

ans = 0

for i in range(1, N+1):

    if 2 ** (count - 1) * i >= K:
        count -= 1
        if count == 0:
            ans += N-i+1
            break

    ans += (1/2) ** count
print(ans / N)

Measured memory_bytes: 3064
#include <stdio.h>
int main(){
  int i;
    for( i = 0; i < 7 ; i++){
      int x , y; /*xテ」ツ?ッテヲツ慊?ゥツォツ佚ヲツーツ療ヲツクツゥ yテ」ツ?ッテヲツ慊?、ツスツ偲ヲツーツ療ヲツクツゥ*/
	
       scanf("%d %d",&x,&y);
      printf("%d\n", x - y);
    }

  return 0;
}

Measured memory_bytes: 600
#include<iostream>
using namespace std;
int n, a, sum;
int main() {
	while (true) {
		sum = 0;
		cin >> n;
		if (!n) { break; }
		n /= 4;
		for (int i = 0; i < n; i++) {
			cin >> a;
			sum += a;
		}
		cout << sum << endl;
	}
	return 0;
}

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

int main() {
  char C;
  cin>>C;
  if(C=='a') cout<<"vowel"<<endl;
  else if(C=='i') cout<<"vowel"<<endl;
  else if(C=='u') cout<<"vowel"<<endl;
  else if(C=='e') cout<<"vowel"<<endl;
  else if(C=='o') cout<<"vowel"<<endl;
  else cout<<"consonant"<<endl;
}

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

using namespace std;

typedef long long LL;
const int MAXN=2e5+100;
LL dp[MAXN],h[MAXN];
LL n,c;
deque<int> que;

double slope(int x,int y){
	return (double)(dp[x]-dp[y])/(double)(2ll*(h[x]-h[y]))+(double)(h[x]+h[y])/2ll;
}

int main(){
	cin>>n>>c;
	for(int i=1;i<=n;i++){
		cin>>h[i];
	}
	
	que.push_front(1);
	for(int i=2;i<=n;i++){
		while(que.size()>1&&slope(que[0],que[1])<=h[i]){
			que.pop_front();
		}
		int v=que[0];
		dp[i]=dp[v]+(h[i]-h[v])*1ll*(h[i]-h[v])+c;
		int sz=que.size();
		while(sz>1&&slope(que[sz-1],que[sz-2])>=slope(que[sz-1],i)){
			que.pop_back();
			sz=que.size(); 
		}
		que.push_back(i);
	}
	cout<<dp[n]<<endl;
	return 0;
}


Measured memory_bytes: 3968
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 233;
int a[maxn];
int main()
{
	int n;cin>>n;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	for(int i=2;i<=n;i++){
		if(a[i]==a[i-1]){
			puts("NO");
			return 0;
		}
	}
	puts("YES");
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

bool f(string s){
    int n = s.size();
    rep(i, n/2)if(s[i] != s[n-1-i]) return false;
    return true;
}

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

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

#define A 200000
int main(){
	// int N;
	// if(scanf("%d",&N)==1);
	char s[A];
	
	// for(int i=0;i<A;i++){
	// 	s[i]='a';
	// }
	// while ( gets(s) != NULL ) {
 //        // puts(s);
 //    }
	
	scanf("%[^\n]",s);
	// s=getchar();



	int sum=0;
	// int I[N];
	for(int i=0;i<A;i++){
		if(s[i]==NULL)break;
		// printf("%c\n",s[i] );
		 
		sum+=s[i]-'0';
		// printf("sum%d\n",sum );
	}

	if(sum%9==0){
		printf("Yes\n");
	}else{
		printf("No\n");

	}

}
	


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

long long MOD = 1e9+7;
int MAX_INT = 1e9;

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

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

  int X;
  cin >> X;

  cout << (X < 30 ? "No" : "Yes") << endl;

  return 0;
}


Measured memory_bytes: 3648
n=int(input())
s=[list(input()) for i in range(n)]
count=0
countA=0
countB=0
countBA=0
for i in range(n):
    for j in range(len(s[i])-1):
        if s[i][j]=='A' and s[i][j+1]=='B':
            count+=1

for i in range(n):
    if s[i][0]=='B' and s[i][-1]=='A':
        countBA+=1
        
    elif s[i][0]=='B':
        countB+=1
    
    elif s[i][-1]=='A':
        countA+=1

if  (countA>0 or countB>0) and countBA>0:
    count+=countBA-1+min(countB+1,countA+1)

else:
    count+=min(countB,countA)+max(countBA-1,0)
    
print(count)
 
        
    
    
            
        
        


     

    


Measured memory_bytes: 4596
def main():
    N, M = map(int, input().split())

    friends = [set() for _ in range(N)]
    for _ in range(M):
        a, b = map(lambda x: int(x)-1, input().split())
        friends[a].add(b)
        friends[b].add(a)
    # print(friends)

    visited = [0]*N #グループを作って合ったら
    ans = 0
    for i in range(N):
        if visited[i]:
            continue
        tmp = list(friends[i])
        ans_tmp = 1
        visited[i] = 1
        while tmp:
            t = tmp.pop()
            if not visited[t]:
                visited[t] = 1
                ans_tmp += 1
                for j in friends[t]:
                    tmp.append(j)

        ans = max(ans, ans_tmp)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 72708
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial,hypot
#import sys
#from fractions import gcd
setrecursionlimit(10**6+1)
input=stdin.readline

def s(l,t):
    for i in range(3):
        for j in range(3):
            if l[i][j]==t:
                return True
    return False

a=[list(map(int,input().split())) for _ in range(3)]
n=int(input().rstrip())
ans="No"
res=[[False]*3 for _ in range(3)]
for _ in range(n):
    b=int(input().rstrip())
    for i in range(3):
        for j in range(3):
            if a[i][j]==b:
                res[i][j]=True
                break

for i in range(3):
    if False not in res[i]:
        print("Yes")
        exit()

for i in range(3):
    cnt=0
    for j in range(3):
        if res[j][i]:
            cnt+=1
    if cnt==3:
        print("Yes")
        exit()
cnt=0
for i in range(3):
    cnt+=int(res[i][i])
if cnt==3:
    print("Yes")
    exit()

cnt=0
cnt+=int(res[0][2])+int(res[1][1])+res[2][0]
if cnt==3:
    print("Yes")
else:
    print("No")

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

int main() {
    string strS;
    cin >> strS;
    
    int count;
   
    if (strS == "RRR") {
        count = 3;
    }
    else if (strS == "SRR" or strS == "RRS") {
        count = 2;
    }
    else if (strS == "SSS") {
        count = 0;
    }
    else {
        count = 1;
    }
    cout << count << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main(){
    string s;
    cin >> s;
    for (int i = 0; i < 3;i++){
        if(s[i] == '7'){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

Measured memory_bytes: 3624
INPUT = list(map(int, input().split()))

N = INPUT[0]
A = INPUT[1]
B = INPUT[2]

total_all = 0
for i in range(N+1):
    total_epoch = sum([int(j) for j in str(i)])
    if total_epoch >= A and total_epoch <= B:
        total_all += i
print(total_all)

Measured memory_bytes: 9176
import scala.io.StdIn

/**
  * AOJ
  */
object Main {

  def main(args: Array[String]): Unit = {

    val w = StdIn.readLine()

    var count = 0
    while(true){
      val line = StdIn.readLine()
      if(line == "END_OF_TEXT"){
        println(count)
        return
      }
      for(word <- line.toLowerCase.split(" ")){
        if(w == word){count += 1}
      }
    }
  }
}

Measured memory_bytes: 43736
official_house = [
                    [
                        [0,0,0,0,0,0,0,0,0,0,],
                        [0,0,0,0,0,0,0,0,0,0,],
                        [0,0,0,0,0,0,0,0,0,0,]
                    ],
                    [
                        [0,0,0,0,0,0,0,0,0,0,],
                        [0,0,0,0,0,0,0,0,0,0,],
                        [0,0,0,0,0,0,0,0,0,0,]
                    ],
                    [
                        [0,0,0,0,0,0,0,0,0,0,],
                        [0,0,0,0,0,0,0,0,0,0,],
                        [0,0,0,0,0,0,0,0,0,0,]
                    ],
                    [
                        [0,0,0,0,0,0,0,0,0,0,],
                        [0,0,0,0,0,0,0,0,0,0,],
                        [0,0,0,0,0,0,0,0,0,0,]
                    ]
                ]

n = gets.to_i
n.times do
    b, f, r, v = gets.split().map(&:to_i)
    official_house[b-1][f-1][r-1] += v
end

4.times do |b|
    puts "#"*20 unless b == 0
    3.times do |f|
        puts " " + official_house[b][f].join(" ")
    end
end

Measured memory_bytes: 6112
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod =  1e9 + 7;
const int MAX = 300005;
using namespace std;
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}
ll Pow(ll a , ll b){
	if(b == 0) return 1 ;
	ll c = Pow(a , b / 2) ;
	if(b % 2) return (a * ((c * c)% mod )) % mod ;
	return (c * c) % mod ;
}
int N, M , Q ;
ll parent[MAX] , component_size[MAX] , result[MAX] ;

int findRoot(int node){
	return parent[node] == node ? node : parent[node] = findRoot(parent[node]) ;
}
void UnionNodes(int x , int y){
	int rootX = findRoot(x) ;
	int rootY = findRoot(y) ;
	if(rootX == rootY) return ; 
	if(rand() & 1) swap(rootX , rootY) ;
	parent[rootY] = rootX ;
	component_size[rootX] += component_size[rootY];
    component_size[rootY] = 0;
}
//check modulo
int main(){
	IOS;
	cout.precision(50) ;
	int x  , y , z , k ; cin >> x >> y >> z >> k ;
	vll a(x) ;for(int i = 0 ;  i< x  ; i++) cin >> a[i] ;
	vll b(y) ; for(int i = 0 ; i < y ; i++) cin >> b[i] ;
	vll c(z);for(int i = 0 ; i < z ; i++) cin >> c[i] ;
	vll d;
	for(int i = 0 ; i < x  ; i++) for(int j = 0 ; j < y ; j++) d.pb(a[i] + b[j]) ;
	sort(d.rbegin() , d.rend()) ;
	sort(c.rbegin()  ,c.rend()) ;
	priority_queue<ll> ans ;
	for(int i = 0 ; i < min(k , (int)x * y) ; i++){
		for(int j = 0 ; j < z ; j++) ans.push(d[i] + c[j]) ;
	}
	
	while(k--){
		cout << ans.top() <<"\n" ;
		ans.pop(); 
	}
	
	return 0;
}


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

int32_t main(){
	int n, m;
	cin >> n >> m;
	int a = min(n, m);
	int b = max(n, m);
	int S = 0;
	for(int i = 0; i < b; i++){
		S *= 10;
		S += a;
	}
	cout << S;
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

static const int MAX = 500;
static const int INFTY=(1<<21);

int main( ){
  int i,j,n,u,as,k,c;
  int G[MAX][MAX];
  int d[MAX],p[MAX],v[MAX];
  int min,sum;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      G[i][j] = INFTY;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&as,&c);
      G[u][as] = c;
    }
  }
  for(i=0;i<n;i++){
    d[i] = INFTY;
    p[i] = -1;
    v[i] = 0;
  }
  d[0] = 0;

  while(1){
    min = INFTY;
    u = -1;
    for(i=0;i<n;i++){
      if(min>d[i]&&!v[i]){
	u=i;
	min=d[i];
      }
    }
    if(u==-1)break;
    v[u]=1;
    for(as=0;as < n;as++){
      if(!v[as] && G[u][as]!=INFTY){
	if(d[as]>d[u]+G[u][as]){
	  d[as]=d[u]+G[u][as];
	}
      }
    }
  }
  sum=0;
  for(i=0;i<n;i++){
   
    printf("%d %d\n",i,(d[i]==INFTY?-1:d[i]));
  }
  return 0;
}



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

int main(){

    int K,X;
    cin >> K >> X;
    if(500*K<X)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int N, a, i, sum = 0;
	scanf("%d", &N);
	int A[N];
	for(i = 0; i < N; i++){
		scanf("%d", &a);
		A[i] = a;
		sum += a;
	}
	int average;
	if(sum % N <= N / 2){
		average = sum / N;
	}
	else{
		average = sum / N + 1;
	}
	sum = 0;
	for(i = 0; i < N; i++){
		sum += (A[i] - average) * (A[i] - average);
	}
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;


int main(){
    
    ll K,S; cin>>K>>S;
    ll ans=0;
    for(ll X=0;X<=K;X++){
        for(ll Y=0;Y<=K;Y++){
            ll St = S-X-Y;
            if(St>=0&&St<=K)ans++;
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}


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

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  int res = inf;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    int m = 0;
    while(a % 2 == 0){
      m++;
      a /= 2;
    }
    res = min(res, m);
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int n;
    cin>>n;
    
    vector<int> v(n);
    rep(i,n)cin>>v[i];
    
    vector<int> c(9,0);
    rep(i,n){
        if(v[i]<=399)c[0]++;
        else if(v[i]<=799)c[1]++;
        else if(v[i]<=1199)c[2]++;
        else if(v[i]<=1599)c[3]++;
        else if(v[i]<=1999)c[4]++;
        else if(v[i]<=2399)c[5]++;
        else if(v[i]<=2799)c[6]++;
        else if(v[i]<=3199)c[7]++;
        else c[8]++;
    }
    
    int mini=0, maxi=0;
    
    rep(i,8)if(c[i]!=0)mini++;
    
    maxi = mini;
    cout<<max(mini,1)<<" "<<maxi+c[8]<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 1050
#define M 500050
using namespace std;
int n,m;
struct node{
	int x,y;
}ed[M];
bitset<N>pd1[N],pd2[N],vis;
vector<int>v[N];
inline void dfs(int g,int fa){
	vis[g]=1;pd1[fa][g]=1;
	for(int to:v[g])if(!vis[to])dfs(to,fa);
}
int tag[N];
inline void dfs2(int g,int t){
	if(vis[g])return;
	vis[g]=1;tag[g]=t;
	for(int to:v[g])if(!vis[to])dfs2(to,t);
}
inline void dfs3(int g,int t,int rt){
	if(vis[g])return;
	vis[g]=1;if(tag[g]!=t)pd2[rt][g]=1;
	for(int to:v[g])if(!vis[to])dfs3(to,t,rt);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;++i)scanf("%d%d",&ed[i].x,&ed[i].y),v[ed[i].x].push_back(ed[i].y);
	for(int i=1;i<=n;++i)vis.reset(),dfs(i,i);
	for(int i=1;i<=n;++i){
		vis.reset();vis[i]=1;
		for(int to:v[i])dfs2(to,to);
		vis.reset();vis[i]=1;
		reverse(v[i].begin(),v[i].end());
		for(int to:v[i])dfs3(to,to,i);
	}
	for(int i=1;i<=m;++i){
		puts((pd1[ed[i].y][ed[i].x]^pd2[ed[i].x][ed[i].y])?"diff":"same");
	}
	return 0;
}

Measured memory_bytes: 7124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	int A,B; cin>>A>>B;
	if(A==1 && B==2) ote(3);
	if(A==2 && B==1) ote(3);
	if(A==1 && B==3) ote(2);
	if(A==3 && B==1) ote(2);
	if(A==2 && B==3) ote(1);
	if(A==3 && B==2) ote(1);
}


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

ll gcd(ll a, ll b){
    if(a < b){
        swap(a, b);
    }

    ll r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

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

    for (auto i = 0; i < N; i++)
    {
        x[i] = abs(x[i] - X);
    }

    ll d = x[0];

    for (auto i = 0; i < N; i++)
    {
        d = gcd(d, x[i]);
    }

    cout << d << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,R,B;string s;R=0;B=0;
  cin>>n;
  cin>>s;
  for(int i=0;i<n;i++){
    if(s[i]=='R'){
      R+=1;
    }else{
      B+=1;
    }
  }
  if(R>B){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
}

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

int main() {
	int n;
	cin >> n;
	vector<double> p(n);
	for(int i=0; i<n; i++) {
		cin >> p[i];
	}
	vector< vector<double> > dp(n+1, vector<double>(n+1, 0));
	dp[0][0]=1;
	for (int i=1; i<=n; i++) {
		dp[i][0] = dp[i-1][0]*(1-p[i-1]);
		dp[i][i] = dp[i-1][i-1]*p[i-1];
	}
	for (int i=2; i<=n; i++) {
		for (int j=1; j<i; j++) {
			dp[i][j] = dp[i-1][j-1]*p[i-1] + dp[i-1][j]*(1-p[i-1]);
		}
	}
	double ans=0;
	for (int i=(n+1)/2; i<=n; i++)
		ans+=dp[n][i];
	cout << setprecision(15)<< ans << endl;
  	return 0;
}


Measured memory_bytes: 73812
#include<bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define umap unordered_map<ll, ll>
using namespace std;

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

ll lcm(ll x, ll y){
    return (x*y)/gcd(x, y);
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll n, a, ans = 0;
    cin >> n;
    
    for(ll i=0; i<n; i++){
        cin >> a;
        ans += a;
    }
    
    cout << ans-n << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<stdio.h>
#include<iostream>
#include<math.h>

using namespace std;

const double PI = 3.1415926535;
const double th = 60 * PI / 180;

class p
{
public:
	double x;
	double y;
	void print();
};

void p::print()
{
	printf("%.8f %.8f\n", x, y);
}

void koch(int d, p p1, p p2)
{
	if (d == 0)return;
	p s, u, t;
	s.x = (2 * p1.x + p2.x) / 3;
	s.y = (2 * p1.y + p2.y) / 3;
	t.x = (p1.x + 2 * p2.x) / 3;
	t.y = (p1.y + 2 * p2.y) / 3;
	u.x = (t.x - s.x)*cos(th) - (t.y - s.y)*sin(th) + s.x;
	u.y = (t.x - s.x)*sin(th) + (t.y - s.y)*cos(th) + s.y;
	koch(d - 1, p1, s);
	s.print();
	koch(d - 1, s, u);
	u.print();
	koch(d - 1, u, t);
	t.print();
	koch(d - 1, t, p2);
}

int main()
{
	int d;
	p f, l;
	cin >> d;
	f.x = f.y = l.y = 0;
	l.x = 100;
	f.print();
	koch(d, f, l);
	l.print();
    return 0;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<string> a(n);
    vector<string> b(m);
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int j = 0; j < m; ++j) cin >> b[j];
    
    auto check = [&](int x, int y) {
        vector<string> s(m);
        for (int i = 0; i < m; ++i) {
            s[i] = a[x + i].substr(y, m);
        }
        return s == b;
    };
    
    for (int i = 0; i <= n - m; ++i) {
        for (int j = 0; j <= n - m; ++j) {
            if (check(i, j)) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256