akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>

using namespace std;

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int N,i,total,ans;
  cin >> N;
  ans=1000000;
  for(i=1;i<N;i++){
    total = findSumOfDigits(N-i) + findSumOfDigits(i);
    ans = min(ans,total);
  }
  cout << ans << endl;
}


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

using namespace std;

int main()
{
	int n;

	cin >> n;

	if ( n < 1000 )
	{
		cout << "ABC" << endl;
	}
	else
	{
		cout << "ABD" << endl;
	}

	return 0;
}


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

const int MAX_N = 110;
int N, X[MAX_N];

ll cost(int P) {
    ll res = 0;
    for(int i = 0; i < N; ++i) res += ll(X[i]-P)*(X[i]-P);
    return res;
}

int main()
{
    scanf("%d", &N);
    int ans = 0;
    for(int i = 0; i < N; ++i) {
        scanf("%d", &X[i]);
        ans += X[i];
    }
    ans /= N;
    printf("%lld\n", min(cost(ans), cost(ans+1)));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

vector<int> G[200005];

int main(){
  int N;
  cin >> N;
  REP(i,2,N+1){
    int x;
    cin >> x;

    G[x].push_back(i);
  }

  REP(i,1,N+1){
    cout << G[i].size() << endl;
  }
  
  return 0;
}



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

using namespace std;

const long long MOD = 1000000000 + 7;
const string abc = "abacaba";

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> p(n), c(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
    for (int i = 0; i < n; i++) {
        cin >> c[i];
    }
    long long res = -1000000000;
    for (int s = 0; s < n; s++) {
        int t = s;
        long long cnt = 0;
        long long local_mx = -1000000000;
        vector<long long> v;
        do {
            t = p[t];
            cnt += c[t];
            v.push_back(cnt);
//            res = max(res, cnt);
            local_mx = max(local_mx, cnt);
        } while (t != s);
        long long mx = -1000000000;
        for (int i = 0; i < k % (int)v.size(); i++) {
            mx = max(mx, v[i]);
        }
        if (cnt > 0) {
            res = max(res, cnt * (k / (int)v.size()) + mx);
            if (k >= v.size()) {
                res = max(res, cnt * (k / (int) v.size() - 1) + local_mx);
            }
        } else {
            if (k >= v.size()) {
                res = max(res, local_mx);
            } else {
                res = max(res, mx);
            }
        }
    }
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
//    int t;
//    cin >> t;
//    for (int tt = 0; tt < t; tt++) {
//        solve();
//    }
    solve();
    return 0;
}

Measured memory_bytes: 3692
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	private static FastScanner sc = new FastScanner();

	public static void main(String[] args) {
		int n = sc.nextInt();
		
		int[] A = new int[n];
		for(int i=0; i<n; i++) {
			A[i] = sc.nextInt();
		}
		
		int q = sc.nextInt();
		
		for(int i=0; i<q; i++) {
			int m = sc.nextInt();
			
			if(exhaustiveSearch(A, m, 0, 0)){
				System.out.println("yes");
				continue;
			} else {
				System.out.println("no");
			}
		}
	}
	
	static boolean exhaustiveSearch(int[] A, int m, int sum, int idx) {
		for(int i=idx; i<A.length; i++) {
//			System.out.println(sum + " " + idx + " " + i);
			if(sum + A[i] == m) {
				return true;
			} else if(sum + A[i] < m) {
				if(exhaustiveSearch(A, m, sum + A[i], i+1)) {
					return true;
				}
			}
		}
		
		return false;
	}

	static class FastScanner {
	    private final InputStream in = System.in;
	    private final byte[] buffer = new byte[1024];
	    private int ptr = 0;
	    private int buflen = 0;
	    private boolean hasNextByte() {
	        if (ptr < buflen) {
	            return true;
	        }else{
	            ptr = 0;
	            try {
	                buflen = in.read(buffer);
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	            if (buflen <= 0) {
	                return false;
	            }
	        }
	        return true;
	    }
	    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
	    public String next() {
	        if (!hasNext()) throw new NoSuchElementException();
	        StringBuilder sb = new StringBuilder();
	        int b = readByte();
	        while(isPrintableChar(b)) {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        return sb.toString();
	    }
	    public long nextLong() {
	        return Long.parseLong(next());
	    }
	    public int nextInt(){
	    	return Integer.parseInt(next());
	    }
	}
}

Measured memory_bytes: 24988
#pragma region header
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#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 <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define ts to_string
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector <string>
#define vvs vector <vector<string>>
#define pq  priority_queue<int>
using ll = long long;
/* ----------------よく使う数字や配列----------------- */
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */
/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
bool isprime(ll a)//素数判定、primeならtrue,違うならfalse
{
    if (a < 2) return false;
    else if (a == 2) return true;
    else if (a % 2 == 0) return false;
    double m = sqrt(a);
    for (int i = 3; i <= m; i += 2)
    {
        if (a % i == 0)
        {
            return false;
        }
    }
    // 素数である
    return true;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
ll kind(vi SYURUI) {//vector<int>型の配列の要素の種類数
    int size = SYURUI.size();
    sort(all(SYURUI));
    int cnt = 1;
    rep(i, size-1) {
        if (SYURUI[i] != SYURUI[i + 1])cnt++;
    }
    return cnt;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    vi A = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
    int K; cin >> K;
    cout << A[K - 1] << endl;
}






Measured memory_bytes: 3572
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Golden Coins
            int X = int.Parse(Console.ReadLine());

            var ans = X / 500 * 1000;
            ans += (X % 500) / 5 * 5;

            Console.WriteLine(ans);
        }
    }
}

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

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	t := make([]int, N)
	x := make([]int, N)
	y := make([]int, N)
	for i := 0; i < N; i++ {
		t[i], x[i], y[i] = getInt(), getInt(), getInt()
	}

	cx := 0
	cy := 0
	ct := 0
	ok := true
	for i := 0; i < N; i++ {
		dx := abs(cx - x[i])
		dy := abs(cy - y[i])
		dt := t[i] - ct
		l := dx + dy
		if dt < l {
			ok = false
			break
		}
		l -= dt
		if l%2 != 0 {
			ok = false
		}
		cx = x[i]
		cy = y[i]
		ct = t[i]
		// out(dx, dy, dt)
	}
	if ok {
		out("Yes")
	} else {
		out("No")
	}

}


Measured memory_bytes: 4224
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<limits>
#include<iomanip>
#include<set>
#include<tuple>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1000000000 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main() {
	int n,ans=0;
	cin >> n;
	vector<ll> a(n),s(n+1);
	s[0] = 0;
	rep(i, n) cin >> a[i];

	rep(i, n) {
		s[i + 1] = s[i] + a[i];
	}
	sort(all(s));
	
	ll cnt=1,sum=0;
	for (int i = 1; i < n+1; i++) {
		if (s[i]==s[i-1]) {
			cnt++;
		} else {
			//cout << cnt << endl;
			sum += cnt * (cnt - 1) / 2;
			cnt = 1;
		}
	}
	sum += cnt * (cnt - 1) / 2;

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

Measured memory_bytes: 3328
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

n=int(input())
arr=list(map(int,input().split()))
for i in range(n-2,-1,-1):
  arr[i]=(arr[i]*arr[i+1])//gcd(arr[i],arr[i+1])
print(arr[0])


Measured memory_bytes: 5600
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int a, b, c, k; cin >> a >> b >> c >> k;
	
	if (a >= k) {
		cout << k << endl;
	}
	else if (a < k && k <= (a + b)) {
		cout << a << endl;
	}
	else {
		int t = k - (a + b);
		cout << a - t << endl;
	}

	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define all(a) a.begin(),a.end()
#define ld long double
using namespace std;
// For ordered_set
using namespace __gnu_pbds;
template <typename T>
using ord_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);

int main(){
    string s;
    cin >> s;
    if(s == "MON"){
        cout << 6;
        return 0;
    }
    if(s == "TUE"){
        cout << 5;
        return 0;
    }
    if(s == "WED"){
        cout << 4;
        return 0;
    }
    if(s == "THU"){
        cout << 3;
        return 0;
    }
    if(s == "FRI"){
        cout << 2;
        return 0;
    }
    if(s == "SAT"){
        cout << 1;
        return 0;
    }
    if(s == "SUN"){
        cout << 7;
        return 0;
    }
   return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	int A, B;
	
	cin >> A >> B;
	if((1 <= A && A <= 9) && (1<=B && B<=9)) {
		cout << A*B << endl;
	}else{
		cout << -1 << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
import numpy as np
n = int(input())
L = np.array([int(i) for i in input().split()])

count = 0
s = 0
  
# print(L)
  
loopnum = n//2

#+-+-...

for i in range(loopnum):
  s = s + L[2*i]
  if s <= 0:
    subt = -s + 1
    count += subt
    s = s + subt
  # print("s, count = {0}, {1}".format(s, count))
  s = s + L[2*i+1]
  if s >= 0:
    subt = s + 1 
    count += subt
    s = s - subt
  # print("s, count = {0}, {1}".format(s, count))
    
if n%2 == 1:
  s = s + L[-1]
  if s <= 0:
    subt = -s + 1
    count += subt

cand1 = count
# print(cand1)

count = 0
s = 0

#-+-+...

for i in range(loopnum):
  s = s + L[2*i]
  if s >= 0:
    subt = s + 1
    count += subt
    s = s - subt
  # print("s, count = {0}, {1}".format(s, count))
  s = s + L[2*i+1]
  if s <= 0:
    subt = -s + 1 
    count += subt
    s = s + subt
  # print("s, count = {0}, {1}".format(s, count))
    
if n%2 == 1:
  s = s + L[-1]
  if s >= 0:
    subt = s + 1
    count += subt

cand2 = count
# print(cand2)

print(min(cand1,cand2))

Measured memory_bytes: 23280
#include<iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

typedef unsigned long long ul;

int a,b;

int main(){
  cin >> a >> b;
  if((a*b)%2==0){
    cout << "Even" << endl;
  }else{
    cout << "Odd" << endl;
  }
  return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/





int N; ll X[1010], Y[1010];
ll U[1010], V[1010];
int M;
ll d[40];
string dir = "LRDU";
int du[4] = { -1, 1, -1, 1 };
int dv[4] = { -1, 1, 1, -1 };
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> X[i] >> Y[i];
    rep(i, 0, N) U[i] = X[i] + Y[i], V[i] = X[i] - Y[i];

    int mo = abs(X[0] + Y[0]) % 2;
    rep(i, 0, N) if (abs(X[i] + Y[i]) % 2 != mo) {
        printf("-1\n");
        return;
    }

    M = 39;
    d[38] = 1;
    rrep(i, 37, 0) d[i] = d[i + 1] * 2;

    if (mo % 2 == 0) {
        d[39] = 1;
        M++;
    }

    printf("%d\n", M);
    rep(i, 0, M) {
        if (i) printf(" ");
        printf("%lld", d[i]);
    }
    printf("\n");

    rep(i, 0, N) {
        ll u = 0, v = 0;

        string ans = "";
        rep(j, 0, M) {
            ll mi = infl; int mid = -1;
            rep(k, 0, 4) {
                ll uu = u + du[k] * d[j];
                ll vv = v + dv[k] * d[j];
                ll del = abs(U[i] - uu) + abs(V[i] - vv);
                if (del < mi) {
                    mi = del;
                    mid = k;
                }
            }
            u += du[mid] * d[j];
            v += dv[mid] * d[j];
            ans += dir[mid];
        }
        assert(u == U[i] and v == V[i]);
        printf("%s\n", ans.c_str());
    }
}


Measured memory_bytes: 384
package main

import (
	"bufio"
	"os"
	"strconv"
)

func main() {
	pq := []int{-1}
	
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	wr := bufio.NewWriter(os.Stdout)
	for {
		sc.Scan()
		c := sc.Text()
		if c == "end" {
			break
		} else if c ==  "extract" {
			m := extractMax(&pq)
			wr.WriteString(strconv.Itoa(m))
			wr.WriteString("\n")
		} else if c == "insert" {
			sc.Scan()
			k, _ := strconv.Atoi(sc.Text())
			insert(&pq, k)
		}
	}
	wr.Flush()
}

func insert(pq *[]int, k int) {
	*pq = append(*pq, k)
	for n := len(*pq) - 1; n > 1; n /= 2 {
		if (*pq)[n] <= (*pq)[n/2] {
			break
		}
		(*pq)[n], (*pq)[n/2] = (*pq)[n/2], (*pq)[n]
	}
}

func extractMax(pq *[]int) int {
	max := (*pq)[1]
	if len(*pq) > 2 {
		(*pq)[1] = (*pq)[len(*pq)-1]
		*pq = (*pq)[0:len(*pq)-1]
		maxHeapify(pq, 1)
	} else {
		*pq = []int{-1}
	}
	return max
}

func maxHeapify(heap *[]int, i int) {
	l := 2*i
	r := 2*i+1

	var large int
	if l < len(*heap) && (*heap)[l] > (*heap)[i] {
		large = l
	} else {
		large = i
	}
	if r < len(*heap) && (*heap)[r] > (*heap)[large] {
		large = r
	}

	if large != i {
		(*heap)[large], (*heap)[i] = (*heap)[i], (*heap)[large]
		maxHeapify(heap, large)
	}
}



Measured memory_bytes: 43136
package main

import "fmt"

func main() {
	var r, d, x int
	fmt.Scan(&r, &d, &x)

	res := r*x - d
	fmt.Println(res)
	for i := 0; i < 9; i++ {
		res = r*res - d
		fmt.Println(res)
	}
}


Measured memory_bytes: 512
package main

import (
	"fmt"
	"sort"
)

func main() {
	ns := make([]int, 3)
	fmt.Scan(&ns[0], &ns[1], &ns[2])
	sort.Ints(ns)

	switch {
	case ns[0]%2 == ns[1]%2 && ns[0]%2 == ns[2]%2:
		fmt.Println((ns[2]-ns[0])/2 + (ns[2]-ns[1])/2)
	case ns[2]%2 != ns[0]%2 && ns[2]%2 != ns[1]%2:
		fmt.Println((ns[2]-ns[0])/2 + (ns[2]-ns[1])/2 + 1)
	default:
		fmt.Println((ns[2]-ns[0])/2 + (ns[2]-ns[1])/2 + 2)
	}
}


Measured memory_bytes: 512
#ifdef ConanYu
#include "local.hpp"
#else
#pragma GCC optimize("-O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void Main();
#define debug(...) do { } while(0)
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main();
}
#endif

void Main() {
  string s; cin >> s;
  for(int i = 0; i < int(s.size()); i++) cout << 'x';
  cout << "\n"; 
}


Measured memory_bytes: 256
//O(N^2 * NK)やる。
#include<iostream>
using namespace std;

int n, p;
int c[114];

int getscore() {
	int ret = 0;
	int i, j;
	for( i = 0; i < n; i++ ) {
		int score = 1;
		for( j = 0; j < p; j++ ) {
			if ( i + j >= n )
				break;
			score *= c[i+j];
		}
		if ( j == p )
			ret = max(score, ret);
	}
	return ret;
}

void solve() {
	int i, j;
	for( i = 0; i < n; i++ )
		cin >> c[i];

	int Score = getscore();
	int ans = -1;
	for( i = 0; i < n; i++ ) {
		for( j = i+1; j < n; j++ ) {
			c[i] = c[i] + c[j];
			c[j] = c[i] - c[j];
			c[i] = c[i] - c[j];
			
			int score = getscore();
			ans = max(ans, score - Score);

			c[i] = c[i] + c[j];
			c[j] = c[i] - c[j];
			c[i] = c[i] - c[j];
		}
	}
	if ( ans == -1 )
		cout << "NO GAME" << endl;
	else 
		cout << ans << endl;
}

int main() {
	while( cin >> n >> p ) {
		if ( !n ) break;
		solve();
	}
	return 0;
}

Measured memory_bytes: 1160
N = gets.to_i
A = []
B = []
N.times do
  tmp = gets.split.map(&:to_i)
  if tmp[2] > 0
    A << tmp
  else  
    B << tmp 
  end
end

for cy in 0..100
  for cx in 0..100
    tmp = A.map{|x, y, h| h + (x - cx).abs + (y - cy).abs}
    if tmp.uniq.size == 1
      ht = tmp[0]
      if B.all?{|x, y , h0| ht <= (x - cx).abs + (y - cy).abs}
        puts "#{cx} #{cy} #{ht}"
        exit
      end
    end 
  end 
end


Measured memory_bytes: 3708
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 1000000000
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
	int n;
	cin >> n;
	int ans = 0;
	REP(i, n){
		int x;
		cin >> x;
		if(x % 2 == 1) ans++;
	}
	if(ans % 2 == 0) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

void solve() {
    int N; cin >> N;
    int count = 0;
    for(int i = 1; i < 10; i++)
        if(N % i == 0 && N / i <= 9) count++;
    if(count >= 1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main() {
    solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 3005;

// ll solve(vi a) {
//   if (sz(a)&1) {
//     ll res = 0;
//     rep(i,sz(a)) res += (i&1)?-a[i]:a[i];
//     return res;
//   }
//   ll res = -LINF;
//   rep(ti,2) {
//     vi b = a;
//     ll now = 0;
//     if (ti) {
//       now = b.back();
//       b.pop_back();
//       now -= solve(b);
//     } else {
//       now = b[0];
//       b.erase(b.begin());
//       now -= solve(b);
//     }
//     maxs(res,now);
//   }
//   return res;
// }

ll dp[MX][MX];
int used[MX][MX];
vi a;

ll dfs(int l, int r) {
  if (l == r) return 0;
  if (used[l][r]) return dp[l][r];
  used[l][r] = 1;
  ll res = -LINF;
  maxs(res, a[l]-dfs(l+1,r));
  maxs(res, a[r-1]-dfs(l,r-1));
  return dp[l][r] = res;
}

int main() {
  int n;
  scanf("%d",&n);
  a = vi(n);
  cin>>a;
  // ll ans = solve(a);
  // cout<<ans<<endl;
  cout<<dfs(0,n)<<endl;
  return 0;
}






















Measured memory_bytes: 105088
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        System.out.println((a*b)-(a+b-1));
    }
}


Measured memory_bytes: 35552
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > using vec = std::vector< T >;
template < class T > void print(T &x) { cout << x << "\n"; }
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, K;
  cin >> N >> K;
  vec< int > a(N);
  int count = 0;
  REP(i, N) { cin >> a[i]; }
  REP(i, N) {
    FOR(j, i + 1, N) {
      if (a[i] > a[j]) {
        count++;
      }
    }
  }
  int MOD2 = 500000004;
  count *= K;
  // print(count);
  int tmp = 0;
  REP(i, N) {
    REP(j, N) {
      if (i != j && a[i] > a[j])
        tmp++;
    }
  }
  tmp *= K;
  tmp %= MOD;
  tmp *= K - 1;
  tmp %= MOD;
  tmp *= MOD2;
  tmp %= MOD;
  count += tmp;
  count %= MOD;
  print(count);
  // print();
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
	char s[1000];
	char s2[1000];
	scanf("%s",s);
	for(int i=0;i<strlen(s)-8;i++){
		s2[i] = s[i];
	}
	s2[strlen(s)-8] = '\0';
	printf("%s\n",s2);
	return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;
// #include "prettyprint.hpp"


int main() {
  int N, L;
  cin >> N >> L;
  int sum = 0;
  for (int i = 1; i <= N; i++) {
    sum += L + i - 1;
  }

  int min, max;
  min = L;
  max = L + N - 1;
  if (max <= 0) {
    cout << sum - max << endl;
  } else if (min >= 0) {
    cout << sum - min << endl;
  } else {
    cout << sum << endl;
  }

  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
#define mod(int)(1000000007)
using namespace std;
const int INF = 1000000000000;
int maze[2134][2134], test[11];
signed main() {
	int n, m, knt, a = 0; string s; cin >> n >> m >> knt;
	const int INF = 1000000000; typedef pair<int, int>P;
	for (int h = 0; h < n; h++) {
		cin >> s;
		for (int i = 0; i < m; i++) {
			maze[h][i] = (int)(s[i] - '0');
		}
	}
	int ans = 10000000000;
	for (int i = 0; i < (1 << n - 1); i++) {
		vector<int> sep = {  }; int cnt = 0;
		for (int j = 0; j < n; j++) {
			if ((i & (1 << j)) > 0) {
				sep.push_back(j);
			}
		}
		cnt += sep.size(); sep.push_back(10000);
		for (int h = 0; h < 11; h++) { test[h] = 0; }
		for (int j = 0; j < m; j++) {
			int a = 0, ok = 0;
			for (int k = 0; k < n; k++) {
				if (maze[k][j] == 1) { test[a]++; ok++; }
				if (ok > knt) { k = n; j = m; cnt = 1000000; continue; }
				if (test[a] > knt) {
					cnt++; j--; k = n - 1;
					for (int h = 0; h < 11; h++) { test[h] = 0; }
				}
				if (k == sep[a]) { a++; ok = 0; }
				//cout << k << ' ' << j << ' ' << ok << endl;
				//cout << k << ' ' << j << ' ' << a << ' ' << sep[a] << endl;
			}
		}
		ans = min(ans, cnt);
		//cout << ans << endl;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    int n;
    int h[101000];
    int count = 0;
    int max = 0;

    cin >> n;

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

    for (int i = 0; i < (n - 1); i++) {
        if (h[i] < h[i + 1]) {
            max = ((max < count) ? count : max);
            count = 0;
        }
        else {
            count++;
        }
    }

    max = ((max < count) ? count : max);
    cout << max << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vecll = vector<long long>;
#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)

int main()
{
    ll q, que, x;
    set<ll> S;
    cin >> q;

    rep(i, q)
    {
        cin >> que >> x;
        if (que == 0)
            S.insert(x);
        else if (que == 2)
        {
            S.erase(x);
            continue;
        }

        cout << (que ? S.count(x) : S.size()) << endl;
    }
    return 0;
}


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

int main() {
  int N, A;
  int cnt = 0;
  int min_cnt = 0;
  cin >> N;
  
  for( int i = 0; i < N; i++ ) {
  	cin >> A;
    
    cnt = 0;
    while( 1 ){
	    if( A & 0x1 ){
          if( min_cnt == 0 ){
        	min_cnt = cnt;
          } else if( min_cnt >= cnt ){
        	min_cnt = cnt;
          }
    	  break;
    	}
    	cnt++;
    	A /= 2;
    }
    
    if( min_cnt == 0 ){
      break;
    }
  }
  cout << min_cnt << endl;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    n, k = LI()
    a = sorted(LI())
    f = sorted(LI())[::-1]
    ok = 10**12
    ng = -1

    def can(x):
        times = 0
        for i in range(n):
            if f[i] * a[i] > m:
                times += ((f[i] * a[i] - m) // f[i] + 1)
                if (f[i] * a[i] - m) % f[i] == 0:
                    times -= 1
        if times <= k:
            return True
        return False

    while ok > ng + 1:
        m = (ok + ng) // 2
        if can(m):
            ok = m
        else:
            ng = m
    print(ok)

main()



Measured memory_bytes: 127556
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;} 
int main(void)
{
    int x, y,f=0;
    scanf("%d %d",&x,&y);
    for(int i=0;i<=x;i++)
    {
        if(y==2*(x-i)+4*i)
        {
            printf("Yes");
            f=1;
            break;
        }
    }
    if(f==0)
    printf("No");
}

Measured memory_bytes: 1724
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int times = Integer.parseInt(scanner.nextLine());
		HashMap<String, Integer> map = new HashMap<String, Integer>();
		for(int i = 0; i < times; i++) {
			map.put(scanner.nextLine(),1);
		}

		System.out.println(map.size());

	}
}

Measured memory_bytes: 79656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

//long long a[100010][3]; // a[i], b[i], c[i] をそれぞれまとめて a[i][0], a[i][1], a[i][2] にしてしまう

// DP テーブル
//long long dp[100010][3];
ll a[100010][3];
ll dp[100010][3];
int main() {
    //入力
    //ll a[100010][3];
    //ll dp[100010][3];
    ll N; 
    cin >> N;
    for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> a[i][j];

    //遷移
    for (ll i = 0;i<N;i++) {
        for (ll j = 0;j<3;j++) {
            for (ll k = 0;k<3;k++) {
                if (j==k) continue;
                chmax(dp[i+1][k],dp[i][j] + a[i][k]);
            }
        }
    }
    ll ans = max(dp[N][0],dp[N][1]); //dp[i] はi日目なので注意,
    ans = max(ans,dp[N][2]);         //N日目はN-1でなく、dp[N]なので注意
    cout << ans << endl;
}

Measured memory_bytes: 4992
#include <functional>
#include <vector>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    vector<vector<int> > adj(n);
    for (int i = 1; i < n; i++) {
        int a, b; cin >> a >> b;
        a--; b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    function<bool(int, int)> dfs = [&](int i, int p) {
        if (p >= 0 && adj[i].size() == 1) return false;
        int c = 0;
        for (int j : adj[i]) if (j != p && !dfs(j, i)) c++;
        if (c > 1) {
            cout << "First\n";
            exit(0);
        }
        return c == 1;
    };
    cout << (dfs(0, -1) ? "Second\n" : "First\n");
}


Measured memory_bytes: 5888
n = int(input())
P = list(map(int, input().split()))
minSoFar = 2 * 10**5 + 1
ans = 0
for i in range(n):
    if P[i] < minSoFar:
        ans += 1
    minSoFar = min(minSoFar, P[i])
print(ans)

Measured memory_bytes: 32280
#include<iostream>
#include<cmath>
#include<limits.h>
using namespace std;
int main()
{
  long long x, k, d, mnabs, m;
  mnabs = LLONG_MAX;
  cin >> x >> k >> d;
  if(x < 0)
    x = -x;
  if(d > x)
  {
  	if(k%2==0)
  		mnabs = min(abs(x), abs(x-2*d));
  	else
	  	mnabs = min(abs(x-d), abs(x-3*d));
	cout << mnabs;
	return(0);
  }
  m = (x/d) < k ? (x/d) : k;
  if(m!=k)
  {
  	k = k-m;
  	x = x - m * d;
  	if(k%2==1)
	  	mnabs = min(abs(x-d), abs(x+d));
	else
		mnabs = abs(x);
	cout << mnabs;
	return(0);
  }
  else
  {
  	x = x - k * d;
  	mnabs = abs(x);
  	cout << mnabs;
  	return(0);
  }

  return(0);
}
  

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

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] l = new int[m][2];
        for(int i=0; i<m; i++){
            l[i][0] = sc.nextInt();
            l[i][1] = sc.nextInt();
        }
        int lmax = 1;
        int rmin = n;
        for(int i=0; i<m; i++){
            lmax = Math.max(lmax, l[i][0]);
            rmin = Math.min(rmin, l[i][1]);
        }
        int ans = rmin >= lmax ? rmin - lmax + 1 : 0;
        System.out.println(ans);
    }

    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }
}


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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    int jp = 0, oversea = 0;
    for (auto& c : s) {
        switch (c) {
            case 'a':
                if (jp + oversea < a + b) {
                    cout << "Yes" << endl;
                    jp++;
                }
                else cout << "No" << endl;
                break;
            case 'b':
                if (jp + oversea < a + b && oversea < b) {
                    cout << "Yes" << endl;
                    oversea++;
                }
                else cout << "No" << endl;
                break;
            default:
                cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 976
week = gets.strip

case week
  when 'SUN'
  	puts 7
  when 'MON'
  	puts 6
  when 'TUE'
    puts 5
  when 'WED'
    puts 4
  when 'THU'
    puts 3
  when 'FRI'
    puts 2
  when 'SAT'
    puts 1
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(ll i = 0;i < (n); ++i)
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    string s;
    cin >> s;
    int ans = 0;
    string a,b;
    rep(i,s.size()){
        a += s[i];
        if(a != b){
            b = a;
            ans++;
            a = "";
        }
    }
    cout << ans << endl;
} 

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]", B: "List[int]", C: "List[int]"):
    result = 0
    i_before = -100
    for i in A:
        j = i - 1
        result += B[j]
        if j == i_before + 1:
            result += C[j - 1]
        i_before = j
    print(result)


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    B = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    C = [int(next(tokens)) for _ in range(N - 1)]  # type: "List[int]"
    solve(N, A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vll vector<ll>
#define ub upper_bound
#define lb lower_bound
#define allv v.begin(),v.end()
ll mod = 998244353;

ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x = x*x;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}

int main(){
	ll n,m;
  	cin>>n>>m;
  	cout<<(n*(n-1) + m*(m-1))/2<<endl;
	
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int n; cin >> n;
    string s; cin >> s;
    ll r = 0;
    ll g = 0;
    ll b = 0;
    /*
    for(int i = 0; i < n; i++) {
        if(s[i]== 'R') r++;
        else if(s[i]== 'G') g++;
        else    b++;
    }
    */
    r = count(s.begin(),s.end(),'R');
    g = count(s.begin(),s.end(),'G');
    b = count(s.begin(),s.end(),'B');

    ll ans = r * g * b;

    ll del = 0;
    for(int m = 1; m < n -1; m++) {
        for(int d = 1; d <=n; d++) {
            int _min = m - d;
            int _max = m + d;
            if(_min < 0 || _max >= n) continue;
            if(s[m]!=s[_min] && s[_min] != s[_max] && s[_max] != s[m]) {
                del++;
            }
        }
    }
    cout << ans -del << endl;

    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  if((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3]))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
/*
	*	Created By: 'Present_Sir'
	*	Created On: Sunday 05 July 2020 09:12:26 PM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define int long long
using namespace std;

void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cout << " " << to_string(H); 
	debug_out(T...);
}
#ifndef ONLINE_JUDGE
#define db(...)  cout << "[" << #__VA_ARGS__ << "]:" , debug_out(__VA_ARGS__) 
#else
#define db(...)
#endif

void solve(){
    int n,m,k;
    cin>>n>>m>>k;
    vector<string> v(n);
    for(int i=0; i<n; i++){
        cin>>v[i];
    }
    int ans=0;
    for(int i=0; i<(1<<n); i++){
        for(int j=0; j<(1<<m); j++){
            int count=0;
            for(int p=0; p<n; p++){
                for(int q=0; q<m; q++){
                    if(!(i&(1<<p))) continue;
                    if(!(j&(1<<q))) continue;
                    if(v[p][q] == '#'){
                        count++;
                    }
                }
            }
            if(count == k){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}

int32_t main(){
    IOS;
    //int t; cin>>t; while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3664
def main() -> None:
    A, B, C = map(int, input().split())
    K = int(input())
    m = [A, B, C]
    m.sort(reverse=True)
    ans = m[0] * (2 ** K)
    ans += sum(m[1:])
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
/*
  B - Minesweeper
  http://abc075.contest.atcoder.jp/tasks/abc075_b
*/

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[]) {

  int H,W;
  char S[51][51];
  int i,j,ii,jj;

  scanf("%d %d\n", &H,&W);
  for( i=0; i<H; i++ ){
    scanf("%s\n", S[i]);
  }

  for( i=0; i<H; i++ ){
    for( j=0; j<W; j++ ){
      if( S[i][j] == '.' ){
        S[i][j] = '0';
        for( ii=-1; ii<=1; ii++ ){
          for( jj=-1; jj<=1; jj++ ){
            if( (i+ii>=0) && (j+jj>=0) && (i+ii<H) && (j+jj<W) ){
              if( S[i+ii][j+jj] == '#' ){
                S[i][j]++;
              }
            }
          }
        }
      }
    }
  }

  for( i=0; i<H; i++ ){
    printf("%s\n", S[i]);
  }

  return 0;
}


Measured memory_bytes: 128
N, A = [int(x) for x in input().split()]
X = [int(x) - A for x in input().split()]

S = [[None] * N for x in range(3000)]
def search(value, pos):
    if pos == N: return 0 if value else 1
    if S[value + A][pos] is not None: return S[value + A][pos]
    S[value + A][pos] = search(value, pos + 1) + search(value + X[pos], pos + 1)
    return S[value + A][pos]

print(search(0, 0) - 1)


Measured memory_bytes: 4596
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(int argc, char const *argv[])
{
    int N, L;
    cin >> N >> L;
    vector<string> S;
    string tmp;
    for (int i = 0; i < N; i++)
    {
        cin >> tmp;
        S.emplace_back(tmp);
    }

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

    string ans = S[0];
    for (int i = 1; i < N; i++)
    {
        ans += S[i];
    }
    
    cout << ans << endl;

    return 0;
}

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

int N;
string S;

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

    int ans=0;
    int i=0;
    for(int i=0;i<N-2;i++){
        if(S[i]=='A' && S[i+1]=='B' && S[i+2]=='C'){
            ans++;
        }
    }

    cout<<ans;
}

Measured memory_bytes: 256