akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cctype>
#include <iomanip>
#include <limits>
#include <bitset>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef unsigned long long int ull;
const ll mod = 1000000007;
const ll linf = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = (m); i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greater<>()
#define SUM(a) accumulate((a).begin(), (a).end(), 0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define vec vector<int>
#define vecb vector<bool>
#define vecd vector<double>
using str = string;
const double PI = 3.14159265359;
template <typename T>
int len(T tmp)
{
	int res = 0;
	while (tmp > 0)
	{
		res++;
		tmp /= 10;
	}
	return res;
}
template <typename T>
T gcd(T a, T b)
{
	T t;
	while (b != 0)
	{
		t = a % b;
		a = b;
		b = t;
	}
	return a;
}
template <typename T>
T recfact(T start, T n)
{
	T i;
	if (n <= 16)
	{
		T r = start;
		for (i = start + 1; i < start + n; i++)
			r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
template <typename T>
T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}
template <typename T>
T fct(T n)
{
	return recfact<T>(1, n);
}
template <typename T>
T ncm(T n, T m)
{
	if (n < m)
		return 0;
	T x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr)
{
	if (firstItr < 0 || secondItr > int(str.size() - 1))
		return str;
	while (firstItr < secondItr)
	{
		swap(str[firstItr], str[secondItr]);
		firstItr++;
		secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str)
{
	int itr = 0;
	std::string res;
	while (itr < int(str.size()))
	{
		char tmp = str[itr++];
		int length = 1;
		while (itr < int(str.size()) && str[itr] == tmp)
		{
			++itr;
			++length;
		}
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
str split(str str, size_t first_itr, size_t second_itr)
{
	string tmp;
	for (size_t i = first_itr; i < second_itr + 1; i++)
	{
		tmp.push_back(str.at(i));
	}
	return tmp;
}

int main(void)
{
	int age, yen;
	cin >> age >> yen;
	if(age<6){
		cout << 0 << endl;
	}
	else if(age<13){
		cout << yen / 2 << endl;
	}
	else{
		cout << yen << endl;
	}
	return 0;
}


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

int main() {
    char c;
    cin >> c;
    cout << (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ? "vowel" : "consonant") << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main{
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        int[] a = in.ii();
        int ans = a[0] - a[1]*2;
        out.println(Math.max(ans, 0));
        out.flush();
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
using namespace std;

#define rep(i,n) for(i=0;i<n;i++)
int main(){
    int i;
    int N;
    int ans1=0,ans2=0;
    cin>>N;
    vector<int> v;
    rep(i,N){
        int a;
        cin>>a;
        v.push_back(a);
    }
    sort(v.begin(),v.end(),greater<int>());
    rep(i,N){
        if(i%2==0){
            ans1+=v[i];
        }else{
            ans2+=v[i];
        }
    }
    cout<<ans1-ans2<<endl;
}


Measured memory_bytes: 3540
import numpy as np
N = int(input())

xyh = []
for _ in range(N):
    xyh.append(list(map(int, input().split())))
xyh = np.array(xyh)
xyh = xyh[np.argsort(xyh[:, 2])[::-1]]

cxylist = [[i, j] for i in range(101) for j in range(101)]

Hdict = [[] for i in range(101)]
for i in range(len(cxylist)):
    x, y, h =xyh[0]
    H = h + abs(x-cxylist[i][0]) + abs(y-cxylist[i][1])
    Hdict[cxylist[i][0]].append(H)

def calh(cxylist, x, y, h):
    newcxylist = []
    for i in range(len(cxylist)):
        cx, cy = cxylist[i]
        H = h + abs(x-cx) + abs(y-cy)
        if Hdict[cx][cy] == H:
            newcxylist.append([cx, cy])
    return newcxylist

def checkh(cxylist, x, y):
    newcxylist = []
    for i in range(len(cxylist)):
        cx, cy = cxylist[i]
        if Hdict[cx][cy] - abs(x-cx) - abs(y-cy) <= 0:
            newcxylist.append([cx, cy])
    return newcxylist

for n in range(N-1):
    if xyh[n+1][2] != 0:
        cxylist = calh(cxylist, xyh[n+1][0], xyh[n+1][1], xyh[n+1][2])
    else:
        cxylist = checkh(cxylist, xyh[n+1][0], xyh[n+1][1])

print(cxylist[0][0], cxylist[0][1], Hdict[cxylist[0][0]][cxylist[0][1]])


Measured memory_bytes: 14412
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int AB, BC, CA;
		AB = scan.nextInt();
		BC = scan.nextInt();
		CA = scan.nextInt();

		System.out.println(AB * BC / 2);
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


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

int main() {
  // 一年の秒数
  int a,b;
  cin >> a;
  cin >> b;

  int sum,half,ans;
  sum=a+b;
  half=sum/2;
  ans=sum-half;
  // 以下のコメント/* */を消して追記する
  cout << ans << endl;

}


Measured memory_bytes: 256
def evaluate(digit):
    _digit = str(format(digit, "b"))
    print(_digit)
    for i in range(len(_digit)):
        if int(_digit[i]) > 1:
            return False
    return True

def func(n, a):
    digit = 0
    count = 0
    i = 0
    j = 0
    while j < n:
        while j < n:
            if digit ^ a[j] == digit + a[j]:
                digit += a[j]
                count += j - i + 1
                # print("j i:{} j:{} count:{} digit:{}".format(i, j, count, format(digit, "b")))
                j += 1
            else:
                break
        while i < j < n:
            digit ^= a[i]
            i += 1
            break
        # print("_ i:{} j:{} count:{} digit:{}".format(i, j, count, format(digit, "b")))
    return count
"""
print(func(4, [2, 5, 4, 6]))
print(func(9, [0, 0, 0, 0, 0, 0, 0, 0, 0]))
print(func(19,[885, 8, 1, 128, 83, 32, 256, 206, 639, 16, 4, 128, 689, 32, 8, 64, 885, 969, 1]))
"""
digit = 0
n = int(input())
a = [int(i) for i in input().split()]
print(func(n, a))


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

int ara[2003],tra[2003];
vector<int>vh[2003],vv[2003];
vector<string>vst;

int main()
{

    int n,m,i,j,k,ans=0,cur=0,sz,p,q,r,s,t,fr,sc;
    vector<int>::iterator it;
    string str;

    scanf("%d %d",&n,&m);

    for(i=0;i<n;i++)
    {
        cin>>str;

        for(j=0;j<m;j++)
        {
            if(str[j]=='#')
            {
                vh[i].push_back(j);  vv[j].push_back(i);
            }

        }

        vst.push_back(str);
    }

    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            cur=0;

            if(vst[i][j]=='.')
            {
                fr=vh[i].size();

                if(fr==0)cur=cur+(m-1);
                else
                {
                    it=upper_bound(vh[i].begin(),vh[i].end(),j); p=it-vh[i].begin();
                    if(p!=fr)q=vh[i][p];
                    else{  q=m;  }
                    r=(q-j)-1; cur=cur+r;
                    p--;
                    if(p>=0)q=vh[i][p];
                    else{  q=-1; }
                    r=(j-q)-1; cur=cur+r;

                }

                fr=vv[j].size();

                if(fr==0)cur=cur+(n-1);
                else
                {
                    it=upper_bound(vv[j].begin(),vv[j].end(),i); p=it-vv[j].begin();
                    if(p!=fr){ q=vv[j][p]; }
                    else{  q=n; }
                    r=(q-j)-1; cur=cur+r;
                    p--;
                    if(p>=0)q=vv[j][p];
                    else{ q=-1;  }
                    r=(j-q)-1; cur=cur+r;

                }

                cur++;

                //cout<<i<<" "<<j<<"        "<<cur<<endl;

                if(cur>ans)ans=cur;

            }

        }
    }

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



    return 0;
}


Measured memory_bytes: 41156
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int gyou, retsu; cin >> gyou >> retsu;
    vector<string> A(gyou);
    REP(i, gyou) cin >> A[i];
    vector<bool> row(gyou, false);
    vector<bool> col(retsu, false);
    REP(i, gyou){
        REP(j, retsu){
            if(A[i][j] == '#'){
                row[i] = true;
                col[j] = true;
            }
        }
    }

    REP(i, gyou){
        if(row[i]){
            REP(j, retsu){
                if(col[j]) cout << A[i][j];
            }
            cout << endl;
        }
    }

}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
typedef long long lint;
typedef std::pair<lint, lint> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = 1e-9;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
lint mypow(lint a, lint b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	lint memo = mypow(a, b >> 1);
	return memo * memo;
}
lint modpow(lint a, lint b, lint m) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	lint memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
std::string to_string(std::vector<int>& vec) {
	std::string res = "[";
	rep(i, vec.size() - 1)res += std::to_string(vec[i]) + ", ";
	res += std::to_string(vec.back()) + "]";
	return res;
}
int main(){
	int k;
	std::string s;
	std::cin>>k>>s;
	if(s.size()<=k)std::cout<<s<<std::endl;
	else std::cout<<s.substr(0,k)<<"..."<<std::endl;
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
   /* #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    string s,t;
    cin>>s>>t;

    ll n=t.length();
    t=t.substr(0,n-1);
    cerr<<t<<endl;
    if(t!=s)
        No
    else
        Yes
}
return 0;
}

Measured memory_bytes: 3628
program therefore;
var
    n : string;
    x : char;
begin
    readln(n);
    x := n[length(n)];
    if (x = '2') or (x = '4') or (x = '5') or (x = '7') or (x = '9') then 
        writeln('hon')
        else if x = '3' then
            writeln('bon')
                else writeln('pon');
end.

Measured memory_bytes: 1332
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
//typedef __int64 LL;
//typedef long long int LL;
typedef pair<int,int> P;
//typedef pair<LL,LL> PL;

const int MOD=1000000007;

	
int main()
{
	int n;cin>>n;
	for(int i=111;i<=999;i+=111)
	{
		if(i>=n)
		{
			cout<<i<<"\n";
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>

//#define PI 3.141592653589

using namespace std;


int main()
{
	map<string,int> table;
	string word, ans1, ans2;
	int freq=0, len=0;
	while (cin >> word)
	{
		if (table.find(word) == table.end())
		{
			table[word] = 1;
		} else {
			table[word]++;
		}
		if (table[word] > freq)
		{
			freq = table[word];
			ans1 = word;
		}
		if (word.size()>len)
		{
			len = word.size();
			ans2 = word;
		}
	}
	cout << ans1 << " " << ans2 << endl;
	
	return 0;
}

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

int main(){
	int m, f, r, a;
	for(int i=0;;i++){
		cin >> m >> f >> r;
		if(m==-1&&f==-1&&r==-1){
			break;
		}else{
			a=m+f;
			if(m==-1||f==-1){
				cout << "F" << endl;
			}else if(a>=80){
				cout << "A" << endl;
			}else if(a<80&&a>=65){
				cout << "B" << endl;
			}else if(a<65&&a>=50){
				cout << "C" << endl;
			}else if(a<50&&a>=30){
				if(r>=50){
					cout << "C" << endl;
				}else{
					cout << "D" << endl;
				}
			}else if(a<30){
				cout << "F" << endl;
			}
		}
	}
	return 0;
}

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

namespace ConsoleApp14
{
    class Class2
    {
        static void Main()
        {
            var I = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = I[0];
            int K = I[1] > N ? N : I[1] ;
            var H = Console.ReadLine().Split().Select(long.Parse).ToArray();
            Array.Sort(H);
            Array.Reverse(H);
            
            for(int i = 0; i < K; i++)
            {
                H[i] = 0;
            }
            Console.WriteLine(H.Sum());
        }
    }
}


Measured memory_bytes: 37376
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define ifaxb(a, x, b) if (a < x && x < b)  // 比較は昇順
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define all(x) x.begin(), x.end()
#define pi 3.1415926536
#define ff first
#define ss second
#define pq priority_queue
#define ipair pair<int, int> s
#define lpair pair<LL, LL>
#define MP make_pair
#define INF 2147483647
#define _INF -2147483647
#define MM multimap
#define PB push_back
#define MAXN 100004
using namespace std;
typedef long long ll;

int main() {
    int x,a;
    cin >> x >> a;
    if(x<a){
        cout << 0;
    }
    if(a<=x){
        cout << 10;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb 		push_back
#define mp 		make_pair
#define pii 	pair<int,int>
#define vi 		vector<int>
#define vii 	vector<vector<int>>;
#define vpii 	vector<pii>
#define ar 		array
#define SZ(x) 	((int)(x.size()))
#define fi 		first
#define se 		second


#define TRvi(a,it)   for(auto (it)=(a).begin(),it!=(a).end();it++) 	
#define FORV (a,x)   for(auto (x):(a))
#define FOR(i,n)	 for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) 	for(int (i)=1;(i)<=(n);++(i))
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)

#define IN(x,y) 	((y).find((x))!=(y).end())
#define ALL(t) 		t.begin(),t.end()

#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define DBG cerr << "debug here" << endl;
#define DBGV(vari) cerr << #vari<< " = "<< (vari) <<endl;
#define all(x) (x).begin(), (x).end()
#define str(s) to_string(s);

typedef long long ll;

const int INF = 1e9;

const int MINV = 1;
const int MAXV = 10;
#define M (ll)1000000007

    long long mod(long long x){
        return (x%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
    long long mul(long long a, long long b){
        return mod(mod(a)*mod(b));
    }

int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n;
	cin>>n;
	vi A(n);
	ll pre[n];
	
	ll sum=0;
	for(int i=0;i<n;i++){
	    cin>>A[i];
	}
	pre[n-1]=A[n-1];
	for(int i=n-2;i>=0;i--){
	    
	    pre[i]=pre[i+1]+A[i];
	  
	}

	for(int i=1;i<n;i++){
	    
	    sum=add(sum,mul(A[i-1],pre[i]));
	}
	cout<<sum<<endl;
	
	
    
    
  return 0;  
}



Measured memory_bytes: 5548
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        int[][] x = new int[n][d];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < d; j++) {
                x[i][j] = sc.nextInt();
            }
        }
        int count = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                double sum = 0;
                for (int k = 0; k < d; k++) {
                    sum += Math.pow(Math.abs(x[i][k] - x[j][k]), 2);
                }
                for (int k = 1; k <= sum; k++) {
                    if (Math.pow(k, 2) > sum) {
                        break;
                    }
                    if (Math.pow(k, 2) == sum) {
                        count++;
                        break;
                    }
                }
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 23252
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        long A = scanner.nextLong();
        long B = scanner.nextLong();
        long K = scanner.nextLong();
        long ans = K;
 
        while(!(K == 0L)){
            if(!(A == 0L)){
                K = K - A;
                if(K >= 0L){
                    A = 0L;
                }else{
                    A = A - ans;
                    break;
                }
            }else{
                if(B >= K){
                    B = B - K;
                    K = 0L;
                }else{
                    B = 0L;
                    K = 0L;
                }
            }
        }
        System.out.print(A + " " + B);
	}
}

Measured memory_bytes: 38604
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
using ll = long long;

int main() {
    int K,X;
    cin >> K >> X;
    
    for(int i=(X-K+1);i<=(X+K-1);i++){
        cout << i  << " " << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define MAX 100000
using namespace std;
int main(){
  int N, M, count, Root[MAX], A, B;
  long long  H[MAX];
  count = 0;
  scanf("%d %d", &N, &M);
  for(int i = 0; i < N; i++){
    scanf("%lld", &H[i]);
    Root[i] = 1;
  }
 
  for(int i = 0; i < M; i++){
    scanf("%d %d", &A, &B);
    if(H[A - 1] < H[B - 1]) Root[A - 1] = 0;
    else if( H[B - 1] < H[A - 1]) Root[B - 1] = 0;
    else if( H[A - 1] == H[B - 1]) Root[A - 1] = Root[B - 1] = 0;
    
  }
  
  for(int i = 0; i < N; i++){
    if(Root[i] == 1) count++;
  }
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 4396
def solve(n, m):
    if n == 1 and m == 1:
        return 1
    if n == 1:
        return m - 2
    if m == 1:
        return n - 2
    return (n - 2) * (m - 2)

if __name__ == "__main__":
    n, m = map(int, input().split())
    print(solve(n, m))


Measured memory_bytes: 2940
using System;
using System.Linq;

namespace B.Maximum_Sum
{
    class Program
    {
        static void Main(string[] args)
        {
            var ABC = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var K = int.Parse(Console.ReadLine());
            int ans = 0;

            Array.Sort(ABC);

            for (int i = 0; i < K; i++)
            {
                ABC[ABC.Length - 1] *= 2;
            }

            Console.WriteLine(ABC.Sum());
        }
    }
}

Measured memory_bytes: 11348
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    long long a[6];
    long long n,i;
    cin >> n;
    for(i=0;i<5;i++) cin >> a[i];
    long long ans=0;
    if(n%a[0]==0) ans=n/a[0];
    else ans=n/a[0]+1;
    long long x=a[0];
    for(i=1;i<5;i++){
        if(a[i]<x) {
            x=a[i];
            if(n%a[i]==0) ans=n/a[i]+i;
            else ans=n/a[i]+i+1;
        }
        else ans+=1;
    }
    cout << ans << endl;
    return 0;

}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
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 (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    ll A, B;
    cin >> A >> B;
    if(A+B>=10) cout << "error" << endl;
    else cout << A+B << endl;
    return 0;
}

Measured memory_bytes: 256
import Control.Monad
main = do
  [n, y] <- (map read . words) <$> getLine
  putStrLn $ unwords $ map show $ resolve n y

co [] = [-1, -1, -1]
co (w:_) = w

resolve:: Int -> Int -> [Int]
resolve n y = w
  where
    w = co [[m, g, s] | m <- [0..n], g <- [0..(n - m)], s <- [n - m - g], m + g + s == n, m * 10000 + g * 5000 + s * 1000 == y]


Measured memory_bytes: 764
def getInt(): return int(input())

def getIntList(): return [int(x) for x in input().split()]

N = getInt()
p = getIntList()
n = 0
for i in range(N):
    if not (i+1==p[i]):
        n += 1
if(n<=2):
    print('YES')
else:
    print('NO')

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

int main() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;

	if (k <= a) {
		cout << k << endl;
	}
	else {
		int plus = a;
		if (k - a <= b) {
			cout << plus << endl;
		}
		else {
			int minus = k - a - b;
			cout << a - minus << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3588
from collections import defaultdict, deque

N = int(input())
neighbors = defaultdict(list)
for i in range(N - 1):
    ai, bi, ci = map(int, input().split())
    ai -= 1
    bi -= 1
    neighbors[ai].append((bi, ci))
    neighbors[bi].append((ai, ci))
Q, K = map(int, input().split())
K -= 1
queries = [tuple(map(lambda s: int(s) - 1, input().split())) for i in range(Q)]

queue = deque([K])
d = [0] * N
while len(queue) > 0:
    v = queue.pop()
    for child, ci in neighbors[v]:
        if child == K or d[child] != 0:
            continue
        d[child] = d[v] + ci
        queue.append(child)

for xi, yi in queries:
    print(d[xi] + d[yi])


Measured memory_bytes: 62564
function main(input) {
  var a = Number(input.split(" ")[0]);
  var b = Number(input.split(" ")[1]);
  var c = Number(input.split(" ")[2]);

  var ans = false;
  if(a==b && a==c && b==c){
    ans=true;
  }
  console.log(ans?"Yes":"No");


}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 21576
#include<stdio.h>

int main(void)
{
  int n,i,hantei=0;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);

  for(i=n-1;i>0;i--){
    if(a[i]>=a[i-1]){

    }
    else if(a[i-1]-a[i]==1){
      a[i-1]-=1;
    }
    else{
      hantei=1;
    }
  }
  if(n==1)  hantei=0;

  if(hantei)  printf("No\n");
  else  printf("Yes\n");
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    ll n,m;
    cin >> n >> m;
    
    vector<pair<ll,ll>> p(n);

    rep(i,n){
        cin >> p[i].first >> p[i].second;
    }

    sort(all(p));

    ll cnt =0;
    ll ans =0;

    while(cnt < m){
        rep(i,n){
            ans += min(m-cnt, p[i].second) * p[i].first;
            cnt += p[i].second;
            if(cnt >= m) break;
        }
    }

    dunk(ans);
}





Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstdlib> 
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
	int x=0,f=1; char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();}
	return x*f;
}
int n,a[110000],now=1,l,r,sum,MAX;
bool via[110000];
int main()
{
	n=read();
	for (int i=1; i<=n; i++) a[i]=read();
	sort(a+1,a+n+1);
	while (now<=n) {
		if (via[a[now]]==0) {
			via[a[now]]=1;
			sum=1;
			l=now; r=now;
			while (l-1>=1 && a[now]-a[l-1]<=1) {sum++; l--;}
			while (r+1<=n && a[r+1]-a[now]<=1) {sum++; r++;}
			if (sum>=MAX) MAX=sum;
		}
		while (via[a[now]]) now++;
	}
	printf("%d\n",MAX);
	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#define rep(i, n) for (i = 0; i < n; i++)
using namespace std;

int n;
int p[100000];
bool ok[100001];

int main() {
	int i;
	
	cin >> n;
	rep(i, n) cin >> p[i];
	
	rep(i, n) ok[i] = (p[i] == i + 1);
	
	int ans = 0;
	rep(i, n) {
		if (ok[i] && ok[i + 1]) {
			ok[i] = ok[i + 1] = false;
			ans++;
		}
		else if (ok[i]) {
			ok[i] = false;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 768
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define ALL(a) a.begin(), a.end()
typedef long long ll;
using namespace std;

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

    int a, b;
    cin >> a >> b;

    if (b % a == 0)
        cout << a + b << endl;
    else
        cout << b - a << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new KK(); }
class KK
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	double[] GR => Strs.Select(double.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	public const int MOD = 1000000007;
	public const long INFL = 4011686018427387913L;
	public KK()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	int N;
	long[,] a;
	void Solve()
	{
		N = F;
		a = new long[N, N];
		for (var i = 0; i < N; i++)
		{
			var I = G;
			for (var j = 0; j < N; j++) a[i, j] = I[j];
		}
		dp = new long[1 << N];
		done = new bool[1 << N];
		WriteLine(Calc((1u << N) - 1));
	}
	long[] dp;
	bool[] done;
	long Calc(uint s)
	{
		if (s == 0) return 0;
		if (!done[s])
		{
			done[s] = true;
			var t = MSB(s);
			var s2 = s ^ (1u << t);
			dp[s] = Calc(s2);
			var left = new List<int> { t };
			for (var U = (1u << N) - 1; ; --U)
			{
				U &= s2;
				if (U == 0) break;
				var p = 0L;
				for (var i = 0; i < N; i++) if ((U & (1 << i)) != 0) left.Add(i);
				for (var i = 0; i < left.Count; i++) for (var j = i + 1; j < left.Count; j++) p += a[left[i], left[j]];
				dp[s] = Max(dp[s], Calc(s2 ^ U) + p);
				left.Clear();
				left.Add(t);
			}
		}
		return dp[s];
	}
	public static int MSB(uint n)
	{
		n |= n >> 1;
		n |= n >> 2;
		n |= n >> 4;
		n |= n >> 8;
		n |= n >> 16;
		return BitCount(n) - 1;
	}
	public static int BitCount(uint n)
	{
		n = (n & 0x55555555) + ((n >> 1) & 0x55555555);
		n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
		n = (n & 0x0f0f0f0f) + ((n >> 4) & 0x0f0f0f0f);
		n = (n & 0x00ff00ff) + ((n >> 8) & 0x00ff00ff);
		return (int)((n & 0x0000ffff) + ((n >> 16) & 0x0000ffff));
	}
}


Measured memory_bytes: 17888
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#define ll long long
using namespace std;

struct node{int a,b,c;}p[100100];
bool operator < (node x,node y){return x.a<y.a;}
bool cmp(node x,node y){return x.a>y.a;}
ll sum,ans;int x,y,z;
priority_queue<int> q;
ll fr[100100],bk[100100],sm;
void solve()
{
	int i,j;ll cur=0,tot=0;
	sort(p+1,p+x+y+z+1,cmp);
	for(i=1;i<=x+y+z;i++)	sm=sm+p[i].b;
	for(i=1;i<=x;i++)	q.push(p[i].b-p[i].a),cur+=p[i].a-p[i].b;
	fr[x]=cur;
	for(i=x+1;i<=x+y;i++)
	{
		if(q.top()>p[i].b-p[i].a)
		{
			cur+=q.top();
			q.pop();
			q.push(p[i].b-p[i].a);
			cur+=p[i].a-p[i].b;
		}
		fr[i]=cur;
	}
	while(!q.empty())	q.pop();
	for(i=x+y+z;i>x+y;i--)	q.push(p[i].b),tot+=p[i].b;
	bk[x+y]=tot;
	for(i=x+y;i>x;i--)
	{
		if(q.top()>p[i].b)
		{
			tot-=q.top();
			q.pop();
			q.push(p[i].b);
			tot+=p[i].b;
		}
		bk[i-1]=tot;
	}
	for(i=x;i<=x+y;i++)
		ans=max(ans,sm+fr[i]-bk[i]+sum);
	printf("%lld\n",ans);
}
int main()
{
	int i,j;
	scanf("%d%d%d",&x,&y,&z);
	for(i=1;i<=x+y+z;i++)	scanf("%d%d%d",&p[i].a,&p[i].b,&p[i].c),p[i].a-=p[i].c,p[i].b-=p[i].c,sum=sum+(ll)p[i].c;
	solve();
	return 0;
}

Measured memory_bytes: 2944
def solve():
    S = input()
    if len(S) < 7:
        return(False)
    keyence = "keyence"
    for i in range(len(keyence) + 1):
        head = S[0:i]
        tail = S[len(S)-len(keyence)+i:len(S)]
        if keyence[:i] != head:
            continue
        if keyence[i:] != tail:
            continue
        else:
            return(True)
    return(False)

if solve():
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(1,n-2):
    if a[i-1] == a[i]:
        a[i] = -i
        ans += 1
    elif a[i+1] == a[i]:
        a[i+1] = - (i+1)
        ans += 1
if a[-1] == a[-2]:
	ans += 1
print(ans)


Measured memory_bytes: 3060
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]


s = input()

for i in range(len(s)):
    if (i+1) % 2 != 0:
        print(s[i], end="")



Measured memory_bytes: 9100
#include <bits/stdc++.h>
using namespace std;
const int N = 102;
const short INF = 30000;
short dp[N][N][N][N],n,m,mat[N][N],px,py,ans;
char s[N];
short query(int u,int d,int l,int r) {
  if (u > d || l > r) return 0;
  return mat[d][r] - mat[u-1][r] - mat[d][l-1] + mat[u-1][l-1];
}
short calc(int u,int d,int l,int r,int u1,int d1,int l1,int r1) {
  return query(u,d,l,r) - query(max(u,u1),min(d,d1),max(l,l1),min(r,r1));
}
int main() {
  cin >> n >> m;
  for (int i = 1 ; i <= n ; ++ i) {
    scanf("%s",s+1);
    for (int j = 1 ; j <= m ; ++ j) {
      mat[i][j] = s[j] == 'o';
      if (s[j] == 'E') px = i, py = j;
    }
  }
  for (int i = 1 ; i <= n ; ++ i)
    for (int j = 1 ; j <= m ; ++ j)
      mat[i][j] += mat[i][j-1];
  for (int i = 1 ; i <= n ; ++ i)
    for (int j = 1 ; j <= m ; ++ j)
      mat[i][j] += mat[i-1][j];
  ans = mat[n][m];
  for (int s1 = 1 ; s1 <= n ; ++ s1)
    for (int s2 = 1 ; s2 <= m ; ++ s2) {
      int l = s2 - m + py;
      int r = py;
      int u = s1 - n + px;
      int d = px;
      for (int i = 1, j = s1 ; j <= n ; ++ i, ++ j)
	for (int a = 1, b = s2 ; b <= m ; ++ a, ++ b) {
	  dp[i][j][a][b] = INF;
	  dp[i][j][a][b] = min(dp[i][j][a][b],(short)(dp[i][j-1][a][b]+calc(j,j,a,b,i+u-1,i+d-1,a+l-1,a+r-1)));
	  dp[i][j][a][b] = min(dp[i][j][a][b],(short)(dp[i+1][j][a][b]+calc(i,i,a,b,i+u-1,i+d-1,a+l-1,a+r-1)));
	  dp[i][j][a][b] = min(dp[i][j][a][b],(short)(dp[i][j][a+1][b]+calc(i,j,a,a,i+u-1,i+d-1,a+l-1,a+r-1)));
	  dp[i][j][a][b] = min(dp[i][j][a][b],(short)(dp[i][j][a][b-1]+calc(i,j,b,b,i+u-1,i+d-1,a+l-1,a+r-1)));
	}
    }
  ans -= dp[1][n][1][m];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 209152
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#include<ext/rope>
#define int long long
using namespace std;
using namespace __gnu_cxx;
typedef long long LL;
const int MAXN = 2e6+10;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
signed main(){
#ifndef ONLINE_JUDGE
    //freopen("C:\\Users\\Administrator\\Desktop\\in.txt","r",stdin);
#endif // ONLINE_JUDGE
	int n; string ss; cin>>n>>ss;
	for(int i=0;i<(int)ss.size();i++) ss[i]=((ss[i]-'A')+n)%26+'A';
	cout<<ss<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
using namespace std;
 
typedef long long ll;
 
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;

#define INF 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { debug(itr); }
 
template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
  ll x;
  cin >> x ;
//  auto p = SievePrimes(100010);
  for (int i = x; ; ++i) {
    if (IsPrime(i)) {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n, q;
  map<int, int> mp;
  cin >> n;
  ll sum_v = 0;
  rep(i, n){
    int v;
    cin >> v;
    sum_v += v;
    mp[v]++;
  }
  cin >> q;
  vector<int> b(q), c(q);
  rep(i, q) cin >> b[i] >> c[i];

  for(int i = 0; i < q; ++i){
    int v1 = mp[b[i]];
    mp[c[i]] += v1;
    mp[b[i]] = 0;
    sum_v -= (ll)v1 * (ll)b[i];
    sum_v += (ll)v1 * (ll)c[i];
    cout << sum_v << endl;
  }

  return 0;
}

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

int main(){
    long long k, s;
    cin >> k >> s;

    long long cnt = 0;

    for(long long z = 0; z <= k; z++){
        for(long long y = 0; y <= k; y++){
            long long x = s - y - z;
            if(0 <= x and x <= k) cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3596
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    string s,t;cin>>s>>t;
    cout<<t+s<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int n,m,K;
int main()
{
    scanf("%d%d%d",&n,&m,&K);
    bool flag=false;
    for (int i=0;i<=n;++i)
        for (int j=0;j<=m;++j)
            if (i*m+j*n-2*i*j==K)
                flag=true;
    puts(flag?"Yes":"No");
    return 0;
}


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

using namespace std;

int main( void ){
  
  	int a, a1;
	int sum = 1;
  
 	cin >> a;
 	for( int i = 0; i < a; i++ ){
  		int tmp;
      cin >> tmp;
      if( i == 0 ){
        a1 = tmp;
        continue;
       }
      if( a1 <= tmp ){
        sum++;
        a1 = tmp;
      }
    }
      
 	cout << sum << endl;
 	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define rrep(i, a, b) for (int i = (a); i < (b); ++i)
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using tl = tuple<ll, ll, ll>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n; cin>>n;
    vl as(n); cin>>as;
    sort(rrng(as));
    ll ans = as[0];
    ll cur = 2;
    vl cs{as[1], as[1]};
    while (cur < n) {
        vl temp;
        swap(cs, temp);
        for (auto c : temp) {
            if (cur >= n) break;
            ans += c;
            cs.push_back(as[cur]);
            cs.push_back(as[cur]);
            cur++;
        }
    }
    cout<<ans<<endl;
}

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

int main(){
    int N; cin >> N;
    map<int,int> mp;
    int num = 1;
    for(int i = 0;i < N;++i){
        int A;
        cin >> A;
        mp[A] = num;
        num++;
    }
    for(int i = 0;i < N-1;++i){
        cout << mp[i+1] << " ";
    }
    cout << mp[N] << endl;
}

Measured memory_bytes: 5504
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
def ang(n) Array.new(n){gsmi} end
def debug(k,v) puts "#{k}: #{v}" end
def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

$stdin = File.open('input.txt') if File.exist?('input.txt')
puts gets.to_i^1


Measured memory_bytes: 14308
n = int(input())
xs = [int(i) for i in input().split()]
length = len(xs)
count = 0

while True:
  xs = [x // 2 for x in xs if x % 2 == 0]
  
  if length == len(xs):
    count += 1
  else:
    break
    
print(count)

Measured memory_bytes: 3060
#include<iostream>
#include <sstream> 
#include<string>
#include <list>
using namespace std;
int main(){
	long valueA,valueB;
	std::list<long> stack;
	string ss,s;
	getline (cin, ss);
	istringstream sstream(ss);
	while(!sstream.eof()){
		sstream >> s;
		switch(s.at(0)){
			case '+':
				valueA = *(--stack.end());
				stack.pop_back();
				valueB = *(--stack.end());
				stack.pop_back();
				stack.push_back(valueB+valueA);
				break;
			case '-':
				valueA = *(--stack.end());
				stack.pop_back();
				valueB = *(--stack.end());
				stack.pop_back();
				stack.push_back(valueB-valueA);
				break;
			case '*':
				valueA = *(--stack.end());
				stack.pop_back();
				valueB = *(--stack.end());
				stack.pop_back();
				stack.push_back(valueB*valueA);
				break;
			case '/':
				valueA = *(--stack.end());
				stack.pop_back();
				valueB = *(--stack.end());
				stack.pop_back();
				stack.push_back(valueB/valueA);
				break;
			default:
				int i;
				istringstream iss(s);
				iss >> i;
				stack.push_back(i);
				break;
		}
	}
	long value = *(--stack.end());
	cout  << value << std::endl;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;

int main() {
  int A, B;
  cin >> A >> B;
  
  cout << (A+B)%24 << endl;
}

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

using namespace std;
typedef long long ll;

int main(){
    ll ans = 0;
    string s;
    cin >> s;
    for(char c : s){
        if(c == '+'){
            ans++;
        }else{
            ans--;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a[51],h=0,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)  cin>>a[i];
    sort(a,a+n);
    for(int i=n-1;i>n-1-k;i--)  h=h+a[i];
    cout<<h<<endl;
    return 0;
}

Measured memory_bytes: 256