akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
   
int main(void){
    int h, w;
    cin >> h >> w;
    vector<vector<char>> mp(h+1, vector<char>(w+1, '#'));
    vector<vector<int>> memo(h, vector<int>(w, 0));
    for (int i = 0; i < h; ++i) 
        for (int j = 0; j < w; ++j) cin >> mp[i][j];
    for (int i = 0; i < h; ++i){
        int idx = 0;
        for (int j = 0; j < w+1; ++j) {
            if (mp[i][j] == '#') {
                if (j > idx) {
                    for (int k = idx; k < j; ++k) memo[i][k] += j-idx;
                }
                idx = j+1;
            }
        }  
    } 

    for (int j = 0; j < w; ++j){
        int idx = 0;
        for (int i = 0; i < h+1; ++i) {
            if (mp[i][j] == '#') {
                if (i > idx) {
                    for (int k = idx; k < i; ++k) memo[k][j] += i-idx-1;
                }
                idx = i+1;
            }
        }  
    }
    int ret = 0;
    for (int i = 0; i < h; ++i) 
        for (int j = 0; j < w; ++j) ret = max(ret, memo[i][j]);
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 19968
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <cstring>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

ll inputLLValue(){
    ll a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int main(int argc, const char * argv[]) {
    ll S = inputLLValue();
    vector<int> vecVal;
    int x = ceil(sqrt(S));
    int v = (int)(x * x - S);
    int x1 = x;
    int y2 = x;
    int x2 = v;
    int y1 = v == 0 ? 0 : 1;
    int i = 0;
    cout << "0 0 " << x1 << " " << y1 << " " << x2 << " " << y2 << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 100001
int i,n,in[2000001],tmp[N],out[2000001];
int main()
{
  scanf("%d",&n);
  for(i=1;i<n+1;i++){
    scanf("%d",&in[i]);
  }
  for(i=0;i<N;i++) tmp[i]=0;
  for(i=1;i<n+1;i++)tmp[in[i]]+=1;
  for(i=0;i<N;i++)  tmp[i]+=tmp[i-1];
  for(i=n+1;i>0;i--){
    out[tmp[in[i]]]=in[i];
    tmp[in[i]]-=1;
  }
  for(i=1;i<n;i++){
    printf("%d ",out[i]);
  }
  printf("%d\n",out[i]);
  return 0;
}



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

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
using ll = long long;
using P = pair<int,int>;

// code starts
int main()
{
	string n;
	cin >> n;
	int i;
	int sz = n.size();
	int sum = 0;
	rep(i,sz)
	{
		sum += n[i]-'0';
	}
	if(sum%9 == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  ll a, b, n;
  cin >> n >> a >> b;
  if (n == 1 && a != b)
  {
    cout << 0 << endl;
    return 0;
  }
  if (a > b)
  {
    cout << 0 << endl;
    return 0;
  }
  if (n == 1 && a == b)
  {
    cout << 1 << endl;
    return 0;
  }
  cout << (n - 2) * (b - a) + 1 << endl;
}


Measured memory_bytes: 256
//
//  main.cpp
//  ProCon
//
//  Created by hashimotoryoma on 2017/08/20.
//  Copyright © 2017年 hashimotoryoma. All rights reserved.
//

#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <vector>

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

using namespace std;

typedef long long ll;

int group(int n){
    if(n==2)
        return 2;
    else if(n==4 || n==6 || n==9 || n==11)
        return 1;
    else
        return 0;

}

int main() {
    // insert code here...    return 0;
    //////
    // input from txt
    /*
     std::ifstream in("input.txt");
     std::cin.rdbuf(in.rdbuf());
     std::ofstream out("output.txt");
     std::cout.rdbuf(out.rdbuf());
     ////
     */
    int N;
    cin >> N;
    cout <<"ABC" << N << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())


// a,bの最小公倍数
ll LCM(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll GCD(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}


const int MOD = 1000000007;
const int INF = INT_MAX;



int main(){

    ll n, k;
    cin >> n >> k;

    ll ans;
    for (int i=0; ; ++i) {
        if (pow(k,i-1) <= n && n < pow(k,i)) {
            ans = i;
            break;
        }
    }

    cout << ans << endl;

    
    
}





//              g++ -std=c++1z


Measured memory_bytes: 256
/*************************************************************************
>>> Author: WindCry1
>>> Mail: lanceyu120@gmail.com
>>> Website: https://windcry1.com
>>> Date: 12/30/2019 11:03:37 PM
*************************************************************************/
//#pragma GCC optimize(2)
//#pragma GCC diagnostic error "-std=c++11"
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <iostream>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <stack>
#include <bitset>
#include <iomanip>
#include <list>
#include <sstream>
#include <fstream>
#include <numeric>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define endl '\n'
#define ALL(x) x.begin(),x.end()
#define MP(x,y) make_pair(x,y)
#define ll long long
#define ull unsigned long long
#ifdef WindCry1
#define DEBUG(x) cout<<#x<<" : "<<x<<endl;
#endif
#define lowbit(x) x&(-x)
#define ls x<<1
#define rs x<<1|1
using namespace std;
template<typename T> inline T MIN(const T &a,const T &b) {return a<b?a:b;}
template<typename T> inline T MAX(const T &a,const T &b) {return a>b?a:b;}
template<typename T,typename ...Args> inline T MIN(const T &a,const T &b,Args ...args) {return MIN(MIN(a,b),args...);}
template<typename T,typename ...Args> inline T MAX(const T &a,const T &b,Args ...args) {return MAX(MAX(a,b),args...);}
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
const double pi=acos(-1.0); 
int a[10010];
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#ifdef WindCry1
	freopen("C:/Users/LENOVO/Desktop/in.txt","r",stdin);
#endif
	int n,m;cin>>n>>m;
	for(int i=1;i<=m;i++) cin>>a[i];
	int sum=accumulate(a+1,a+1+m,0);
	cout<<(n-sum<0?-1:n-sum)<<endl;
	return 0;
}



Measured memory_bytes: 3688
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <queue>

using namespace std;

#define ll long long
constexpr ll inf = 1e9+7;

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

    int N;
    cin>>N;
    vector<ll> L(N+1);
    L[0] = 2;
    L[1] = 1;
    for (int n = 2; n <= N; n++) L[n] = L[n-1] + L[n-2];
    cout<<L[N]<<endl;

    return 0;
}

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

int main() {
  string S,T,U;
  int A,B;
  cin >> S >> T >> A >> B >> U;
  
  if(S == U){
    A--;
  }
  
  if(T == U){
    B--;
  }
  
  cout << A << " " << B << endl;
    
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static final int DIVIDE_NUMBER = 1000000007;

	static int childrenCount;
	static int candyCount;
	static int[] childCapacityArray;
	static long[][] dp;

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		childrenCount = scan.nextInt();
		candyCount = scan.nextInt();
		scan.nextLine();

		childCapacityArray = Arrays.stream(scan.nextLine().split(" "))
				.mapToInt(Integer::parseInt)
				.toArray();

		dp = new long[childrenCount + 1][candyCount + 1];

		for (int n = 0; n < childrenCount + 1; n++) {

			for (int k = 0; k < candyCount + 1; k++) {

				dpMethod(n, k);
			}
		}

		println(dp[childrenCount][candyCount]);
	}

	public static void dpMethod(int n, int k) {

		if (k == 0) {

			dp[n][k] = 1;

		} else if (n == 0) {

			dp[n][k] = 0;

		} else {

			long outOfScope = k < childCapacityArray[n - 1] + 1
					? 0
					: dp[n - 1][k - childCapacityArray[n - 1] - 1];

			dp[n][k] = modulo(dp[n - 1][k] + dp[n][k - 1] - outOfScope + DIVIDE_NUMBER);
		}

	}

	public static long modulo(long target) {

		return target % DIVIDE_NUMBER;
	}

	public static void println(Object target) {
		System.out.println(target);
	}
}


Measured memory_bytes: 127956
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <sys/stat.h>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <random>
#include <string.h>//文字列の代入に使う                                                                                                 
#include <bits/stdc++.h>//piの利用で必要(M_PI)                                                                                          
#include <algorithm>


int main() {


  int N;
  int temp;//bnを入れる変数                                                                                                             
  //  vector<vector<int>> A(3, vector<int>(3));                                                                                         
  //  vector<vector<int>> Bingo(3, vector<int>(3, 0));//あたりの位置を記録                                                              
  std::vector<int> A(9);
  std::vector<int> Bingo(9, 0);//あたりの位置を記録                                                                                     
  for(int i = 0; i < 9; i++) {
      std::cin >> A.at(i);
  }

  std::cin >> N;
  for(int i = 0; i < N; i++) {
    std::cin >> temp;
    auto itr = std::find(A.begin(), A.end(), temp);
    if(itr != A.end()) {
      //配列のインデックスを取得するために"itr"を変換                                                                                   
      int wanted_index = std::distance(A.begin(), itr);
      Bingo.at(wanted_index) = 1;
    }
  }
  if(Bingo.at(0) == 1 && Bingo.at(1) == 1 && Bingo.at(2) == 1) std::cout << "Yes" << std::endl;
  else if(Bingo.at(0) == 1 && Bingo.at(1) == 1 && Bingo.at(2) == 1) std::cout << "Yes" << std::endl;
  else if(Bingo.at(3) == 1 && Bingo.at(4) == 1 && Bingo.at(5) == 1) std::cout << "Yes" << std::endl;
  else if(Bingo.at(6) == 1 && Bingo.at(7) == 1 && Bingo.at(8) == 1) std::cout << "Yes" << std::endl;
  else if(Bingo.at(0) == 1 && Bingo.at(3) == 1 && Bingo.at(6) == 1) std::cout << "Yes" << std::endl;
  else if(Bingo.at(1) == 1 && Bingo.at(4) == 1 && Bingo.at(7) == 1) std::cout << "Yes" << std::endl;
  else if(Bingo.at(2) == 1 && Bingo.at(5) == 1 && Bingo.at(8) == 1) std::cout << "Yes" << std::endl;
  else if(Bingo.at(0) == 1 && Bingo.at(4) == 1 && Bingo.at(8) == 1) std::cout << "Yes" << std::endl;
  else if(Bingo.at(2) == 1 && Bingo.at(4) == 1 && Bingo.at(6) == 1) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;

  return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  ll a, b, x; scanf("%lld %lld %lld", &a, &b, &x);
  ll ans = b / x - max(0LL, a - 1) / x;
  if (a == 0) { ++ans; }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 384
import math
k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,k+1):
        if math.gcd(a,b)==1:
            ans+=k
        else :
            for c in range(1,k+1):
                ans+=math.gcd(math.gcd(a,b),c)
print(ans)


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

int M, K;

signed main()
{
  cin >> M >> K;

  int MM = 1;
  REP(m,M) {
    MM *= 2;
  }

  if(K == 0) {
    REP(m,MM*2) {
      cout << m/2;
      if(m < MM*2-1) cout << " ";
    }
    cout << endl;
    return 0;
  }

  int ans = 0;
  REP(m,MM) {
    if(m != K) ans ^= m;
  }

  if(ans != K) {
    cout << -1 << endl;
  } else {
    cout << K << " ";
    REP(m,MM) {
      if(m != K) cout << m << " ";
    }
    cout << K;
    for(int m = MM-1; 0 <= m; m--) {
      if(m != K) cout << " " << m;
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1792
class SegmentTree(object):  # 1-indexed
    def __init__(self, size, S):
        self.len = 1 << size.bit_length()

        self.array = [0] * (2 * self.len)
        for i, s in enumerate(S):
            self.array[i + self.len] = 1 << (ord(s) - ord('a'))
        for i in range(self.len - 1, 0, -1):
            self.array[i] = self.array[i * 2] | self.array[i * 2 + 1]

    def query1(self, i, x):
        i += self.len
        self.array[i] = 1 << (ord(x) - ord('a'))
        i >>= 1
        while i > 0:
            self.array[i] = self.array[i * 2] | self.array[i * 2 + 1]
            i >>= 1

    def get(self, i):
        return self.array[i + self.len]

    def query(self, l, r, i, a, b):
        if l == a and r == b:
            return self.array[i]
        center = (a + b) // 2
        if center >= r:
            return self.query(l, r, i * 2, a, center)
        elif center <= l:
            return self.query(l, r, i * 2 + 1, center, b)
        else:
            return self.query(l, center, i * 2, a, center) | self.query(center, r, i * 2 + 1, center, b)

    def query2(self, l, r):
        ans = self.query(l - 1, r, 1, 0, self.len)
        print(bin(ans).count('1'))


N = int(input())
S = input()
tree = SegmentTree(N, S)
Q = int(input())

for _ in range(Q):
    a, b, c = map(str, input().split())
    if a == "1":
        b = int(b)
        tree.query1(b-1, c)
    else:
        b = int(b)
        c = int(c)
        tree.query2(b, c)


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

int main(){

  int n,m;

  while(cin >> n, n){
    cin >> m;

    int cnt = 0;
    for(int i=n;i<=m;i++){
      int d = i;

      while(!(d%5)) d /= 5;
      while(!(d%3)) d /= 3;
      while(!(d%2)) d /= 2;

      if(d == 1) cnt++;
    }

    cout << cnt << endl;

  }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=300005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int X,N;cin>>X>>N;
    set<int> A;
    for(int i=0;i<N;i++){
        int a;cin>>a;
        A.insert(a);
    }
    
    for(int i=0;;i++){
        if(A.count(X-i)==0){
            cout<<X-i<<endl;
            return 0;
        }
        
        if(A.count(X+i)==0){
            cout<<X+i<<endl;
            return 0;
        }
    }
}



Measured memory_bytes: 3660
def main():
    N = int(input())
    A = list(map(int,input().split()))

    print(' '.join(map(str,A)))

    for i in range(1,N):
        for j in range(i-1,-1,-1):
            if A[j+1] >= A[j]:
                break
            elif A[j+1] < A[j]:
                temp = A[j+1]
                A[j+1] = A[j]
                A[j] = temp
        print(' '.join(map(str,A)))

main()



Measured memory_bytes: 5604
h, w = map(int,input().split())

field=[]
for _ in range(h):
    field.append(list(input()))

dx=[-1,0,1,-1,1,-1,0,1]
dy=[1,1,1,0,0,-1,-1,-1]

for i in range(h):
    for j in range(w):
        if field[i][j]=="#":
            continue
        count=0
        for x,y in zip(dx,dy):
            if i+x<0 or i+x>h-1 or j+y<0 or j+y>w-1:
                continue
            if field[i+x][j+y]=="#":
                count+=1
        field[i][j] = str(count)

for f in field:
    print(''.join(f))

Measured memory_bytes: 9092
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}


const int N=1e6+5;
int n,a[N],ans;
char s[N];



signed main(){
	scanf("%s",s);
	n=strlen(s);
	for(int i=0;s[i];i++) a[n-i]=s[i]^48;
	for(int i=1;i<=n+1;i++){
		if(a[i]^5){
			if(a[i]>5) a[i+1]++,ans+=10-a[i];
			else ans+=a[i];
			continue;
		}
		if(a[i+1]>=5) a[i+1]++;
		ans+=5;
	}
	write(ans);
}

Measured memory_bytes: 5120
#encoding utf-8

n = int(input())
answer = ""

def kenzan(ans):
    val = 0
    ans.reverse()
    for i in range(len(ans)):
        val += answer[i]*(-2)**i
    return int(val)

i = 1

while(n != 0):
    if n % 2 == 0:
        answer = "0" + answer
    else:
        answer = "1" + answer
        n -= 1
    n /= -2
if answer == "":
    answer = 0
print(answer)
# print(kenzan(answer))


Measured memory_bytes: 3060
#pragma GCC optimize("O2")
#include <iostream>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    if (n==1) cout << "Hello World" << endl;
    else {
        int a,b;
        cin >> a >> b;
        cout << a+b << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_d() {
	ll n, k;
	ll ans = 0;
	cin >> n >> k;

	vector<P> td(n);

	ll t, d;
	rep(i, n) {
		cin >> t >> d;
		td[i] = make_pair(d, t);
	}

	sort(RALL(td));

	ll sumD = 0;
	ll sumT = 0;
	V used(n + 1, 0);
	priority_queue<P> pq;
	vector<V> neta(n + 1);
	rep(i, k) {
		d = td[i].first;
		t = td[i].second;
		sumD += d;
		used[t]++;
		if (used[t] == 1) {
			sumT++;
		}
		neta[t].push_back(d);
		pq.push(make_pair(-d, t));
	}

	ans = sumD + sumT * sumT;

	P c;
	rep2(i, k, n) {
		d = td[i].first;
		t = td[i].second;

		if (used[t] == 0) {
			while (pq.size()>0) {
				c = pq.top();
				if (neta[c.second].size() > 1) {
					sumD += d + c.first;
					pq.pop();
					sumT++;
					used[t]++;
					ans = max(ans, sumD + sumT * sumT);
					break;
				}
				pq.pop();
			}
		}
	}

	cout << ans << "\n";
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed;
	//cout << setprecision(7);

	solve_abc_d();

	return 0;
}


Measured memory_bytes: 8564
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<int> a(n - 1);
    map<int,int> b;
    for(int i = 0; i < n - 1; i++){
        cin >> a[i];
        b[a[i] - 1]++;
    }
    for(int i = 0; i < n; i++){
        cout << b[i] << endl;
    }
}

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);

	string s;
	cin >> s;

	int last = -1;
	int ans = 0;

	for (char c : s) {
		if (c != last) {
			last = c;
			ans++;
		}
	}

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

	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin>>s;
    if(s=="Sunny"){
        cout<<"Cloudy"<<endl;
    }
    
    else if(s=="Cloudy"){
        cout<<"Rainy"<<endl;
    }
    
    else if(s=="Rainy"){
        cout<<"Sunny"<<endl;
    }
    
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
#include<memory>
#include<string>
typedef long long ll;
int main() {
	int n;
	ll c = 0;
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		if ((i + 1) % 3 == 0 || (i + 1) % 5 == 0) {
			continue;
		}
		c += (i + 1);
	}
	std::cout << c << std::endl;
	return 0;
}

Measured memory_bytes: 3596
import java.util.*;
import java.lang.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner in = new Scanner(System.in);
     
        while(in.hasNext()) {
            int i = in.nextInt();
            int j = in.nextInt();
            
            System.out.println(Integer.toString(i+j).length());
	    }
	}
}

Measured memory_bytes: 20432
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <bitset>
#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;


int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	int last = n + 1;
	int res = 0;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		if (t <= last) {
			res++;
		}
		last = min(t, last);
	}
	cout << res << endl;
}









Measured memory_bytes: 256
// #define H

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {
#ifdef H
    freopen("in.in", "r", stdin);
#endif
   string str;
   cin >> str;
   if (str[2] == str[3] && str[4] == str[5])
       cout << "Yes" << endl;
   else
       cout << "No" << endl;

}


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

#define pb push_back
#define all(a) a.begin(), a.end()
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repl(i, a, n) for (long long i = a; i < n; i++)
#define vi vector<int>
#define vii vector<pair<int, int>>
#define vl vector<long long>
#define vvi vector<vector<int>>

#define tcases \
  int t;       \
  cin >> t;    \
  while (t--)

typedef long long ll;

// for debugging output uncomment below line
// #define DBG
//NOTE : COMMNET ABOVE LINE BEFORE SUBMITTING

#ifdef DBG
#define dout \
  if (true)  \
  cout
#define dfor \
  if (true)  \
  rep
#else
#define dout \
  if (false) \
  cout
#define dfor \
  if (false) \
  rep
#endif

using namespace std;

#define MOD 1000000007

void optimizeIO()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//==================================================================================///////////////////
///                  CLASHER
//////////////==========================================================//////////////////////////////

int main()
{
  // ifstream cin("input.txt");
  //for optimizing input output
  optimizeIO();
  char c;
  cin >> c;
  char z = c + 1;
  cout << z;

  return 0;
}


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


int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    int now = 1;
    int ans = 0;
    rep(i,n){
        if(a[i]==now){
            now++;
        }else{
            ans ++;
        }
    }
    if(ans==n) cout<< -1 << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
s = input()  
ans = []
for i in range(len(s)):
  cnt = 0
  for i in range(i,len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
      cnt += 1
      ans.append(cnt)
    else:
      break
if ans != []:
  print(max(ans))
else:
  print(0)

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

int main() {
  int a, b;
  char op;

  while (true) {
    cin >> a >> op >> b;
    if (op == '?')
      break;
    else if (op == '+')
      cout << a + b << endl;
    else if (op == '-')
      cout << a - b << endl;
    else if (op == '*')
      cout << a * b << endl;
    else if (op == '/')
      cout << a / b << endl;
  }
}


Measured memory_bytes: 3088
N = int(input())
r = 0
nBA = 0
nA = 0
nB = 0
for i in range(N):
  s = input()
  r += s.count("AB")
  if s[0] == "B" and s[-1] == "A":
    nBA += 1
  elif s[0] == "B":
    nB += 1
  elif s[-1] == "A":
    nA += 1
r += min(nA, nB)
if nA > 0 or nB > 0:
  r += nBA
else:
  r += max(0, nBA-1)
print(r)


Measured memory_bytes: 3064
#include<stdio.h>
int gcd(int,int);
int main(){
  int x,y;
  int a;
  scanf("%d%d",&x,&y);
  a=gcd(x,y);
  printf("%d\n",a);
  return 0;
}
int gcd(int x,int y){
  int r,a;
  if(x<y){
    a=x;
    x=y;
    y=a;
  }
  while(y>0){
    r=x%y;
    x=y;
    y=r;
  }
  return x;
}


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

const int INF = 1e9;

int main() {
  int n;
  cin>>n;
  int c[n],s[n],f[n];
  for(int i=0;i<n-1;i++){
    cin>>c[i]>>s[i]>>f[i];
  }
  for(int i=0;i<n-1;i++){
    int t=c[i]+s[i];
    for(int j=i+1;j<n-1;j++){
      if(s[j]>t){
        t=c[j]+s[j];
        continue;
      }
      if(t%f[j]==0){
        t=t+c[j];
        continue;
      }
      t=t+c[j]+(f[j]-t%f[j]);
    }
    cout<<t<<endl;
  }
  cout<<0<<endl;

}

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

int	main() {
	long	N;
	cin >>N;
	vector<vector<long>> A;
	// Initialize
	long AA=1;
	A.push_back({AA, 0});
	AA *= -2;
	A.push_back({AA, 0});
	AA *= -2;
	long AAA=0;
	while (abs(AA)<1e9) {
		AAA=A.at(A.size()-2).at(0)+A.at(A.size()-2).at(1);
		A.push_back({AA, AAA});;
		AA *= -2;
	}
	for (int i=0; i<3; i++) {
		AAA=A.at(A.size()-2).at(0)+A.at(A.size()-2).at(1);
		A.push_back({AA, AAA});;
		AA *= -2;
	}
	// Intialize done
	string S="";
	for (int i=A.size()-1; i>=0; i--) {
		if (A.at(i).at(0)>0) {
			if (N>A.at(i).at(1)) {
				S += '1';
				N -= A.at(i).at(0);
			} else if (S != "") S += '0';
		} else {
			if (N<A.at(i).at(1)) {
				S += '1';
				N -= A.at(i).at(0);
			} else if (S != "") S += '0';
		}
	}
	if (S=="") S="0";
	cout << S << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <numeric>

using namespace std;

int main(){
    int n,m,p;
    while(cin >> n >> m >> p, n+m+p!=0){
        vector<int> a;
        for(int i=0; i<n; i++){
            int tmp; cin >> tmp;
            a.push_back(tmp);
        }
        int sum = accumulate(a.begin(), a.end(), 0);
        int haibun = sum * (100 - p), haitou = 0;
        if(a[m-1] != 0){
            haitou = haibun / a[m-1];
        }

        cout << haitou << endl;
    }
    return 0;
}



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

#define int long long
#define endl "\n"
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);


main(){
	FIO
	int t;
	t=1;
	while(t--){
		int n,x,y;
		cin>>n>>x>>y;
		if(x*y<n){
			cout<<"No"<<endl;
		}
		else{
			cout<<"Yes"<<endl;
		}
	}
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var a = input[0];
            var b = input[1];
            var c = input[2];

            var subItem = a;
            a = b;
            b = subItem;

            var subItem2 = a;
            a = c;
            c = subItem2;

            Console.WriteLine(a);
            Console.WriteLine(b);
            Console.WriteLine(c);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11092
#include <vector>
#include <iostream>
using namespace std;
vector<int> generate(int N) {
	if (N == 1) return { 0, 1 };
	if (N == 2) return { 0, 2, 1, 3 };
	if (N % 2 == 1) {
		vector<int> p;
		int st = N * 2 - (N / 2) - 1;
		for (int i = 0; i * 2 < st - i; ++i) {
			p.push_back(i * 2);
			p.push_back(st - i);
		}
		for (int i = 0; (2 * N + i) - (2 * N - i - 1) < 2 * N - i - 1; ++i) {
			p.push_back((2 * N + i) - (2 * N - i - 1));
			p.push_back(2 * N - i - 1);
		}
		return p;
	}
	else {
		vector<int> p;
		p.push_back(0);
		p.push_back(N);
		int st = N * 2 - (N / 2) + 1;
		for (int i = 0; i * 2 + 1 < st - i - 1; ++i) {
			p.push_back(i * 2 + 1);
			p.push_back(st - i - 1);
		}
		for (int i = 0; (2 * N + i + 1) - (2 * N - i - 1) < 2 * N - i - 1; ++i) {
			p.push_back((2 * N + i + 1) - (2 * N - i - 1));
			p.push_back(2 * N - i - 1);
		}
		return p;
	}
	return vector<int>();
}
int main() {
	int N, K;
	cin >> N >> K;
	vector<int> p = generate(N);
	vector<int> a, b, c;
	for (int i = 0; i < N; ++i) {
		a.push_back(p[2 * i] + K);
		b.push_back(p[2 * i + 1] + K);
		c.push_back(2 * N + i + K);
	}
	bool ok = true;
	for (int i = 0; i < N; ++i) {
		if (a[i] + b[i] > c[i]) {
			ok = false;
		}
	}
	if (!ok) {
		cout << -1 << endl;
	}
	else {
		for (int i = 0; i < N; ++i) {
			cout << a[i] << ' ' << b[i] << ' ' << c[i] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 4980
n, k = list(map(int,input().split()))
p = list(map(int,input().split()))
p = list(map(lambda x: (x+1)/2, p))

temp = 0

for i in range(k):
    temp += p[i]

ans = temp

for i in range(1, n-k+1):
    temp -= p[i-1]
    temp += p[i+k-1]
    if temp > ans:
        ans = temp

print(ans)

    


Measured memory_bytes: 25060
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
char PS(char x) {
return x-0X20;
}
  
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  
  string A;
  string B;
  cin >>A>>B;
  int a=A.size();
  int b=B.size();
  if(a>b) {
    cout<<"GREATER"<<endl;
  }
else if (a<b) {
  cout<<"LESS"<<endl;
}
else if (a==b) {
if(A>B) {
  cout<< "GREATER"<<endl;
}
if(A==B) {
cout<<"EQUAL"<<endl;
}
if(A<B) {
cout<< "LESS"<<endl;
}
}
  
}


Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *V = map(int, read().split())

    V.sort()
    ans = V[0]
    for v in V[1:]:
        ans = (ans + v) / 2

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9168
program greedyTakahashi
    implicit none
    integer(8):: a,b,k
    integer(8):: i

    read*, a,b,k
    
    if (a > k) then
        print*, a-k, b
    else 
        print*, 0, max(a+b-k,0)
    end if

end program greedyTakahashi

Measured memory_bytes: 640
n,k = map(int,input().split())
A=list(map(int, input().split()))
mod = 10**9+7
ans_inlist = [0]*n
ans_forwardlist = [0]*n
for i in range(n):
    for j in range(n):
        if A[i]>A[j]:
            ans_forwardlist[j] += 1
            if i<j:
                ans_inlist[j]+=1
#print(sum(ans_forwardlist), sum(ans_inlist))
ans = (k*(k-1)//2)*sum(ans_forwardlist)%mod +k*sum(ans_inlist)%mod
print(ans%mod)



Measured memory_bytes: 9168
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
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; }
//#define int long long

void solve() {
	int n, m, k; cin >> n >> m >> k;
    set<int> se;
    for(int i = 0; i <= m; ++i) {
        for(int j = 0; j <= n; ++j) {
            se.insert(m * j + n * i - 2 * i * j);
        }
    }
    if(se.count(k)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;
const int INF = 1<<30;

int main(){
  map<int, int> mp;
  for(int i=0;i<3;i++){
    int a;cin>>a;
    mp[a]++;
  }
  cout<<(int)mp.size()<<endl;
}

Measured memory_bytes: 256
X = input()
n = len(X)
S_waitng_for_T = 0
ans = n
for i in range(n):
    if X[i] == 'S':
        S_waitng_for_T += 1
    else:
        if S_waitng_for_T > 0:
            S_waitng_for_T -= 1
            ans -= 2
print(ans)


Measured memory_bytes: 67472
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;

int main() {
  //
  int n;
  cin >> n;
  vi d(n);
  rep(i, n) cin >> d[i];
  sort(ALL(d));
  int m1 = d[n / 2 - 1];
  int m2 = d[n / 2];
  if (m1 == m2) {
    cout << 0 << endl;
    return 0;
  }
  cout << m2 - m1 << endl;
  return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long int
#define inf 1000000000

signed main(){
    int n,k,s;
    cin >> n >> k >> s;
    for(int i=0;i<k;i++){
        cout << s << " ";
    }
    for(int i=k;i<n;i++){
        if(s!=inf){
            cout << inf;
        }else{
            cout << 1;
        }
        if(i!=n-1){cout << " ";}
    }
    cout << endl;
}

Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define printP(x) "(" << (x).first << ", " << (x).second << ")"
#define mod 1000000007
using namespace std;
typedef pair<llint, llint> P;

llint n;
llint x[505], rem[505];
llint ans[250005];
priority_queue<P, vector<P>, greater<P> > Q;
multiset<llint> S;

int main(void)
{
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> x[i];
		ans[x[i]] = i;
		rem[i] = i-1;
		if(i > 1) Q.push(P(x[i], i));
	}
	
	for(int i = 1; i <= n*n; i++){
		if(ans[i]){
			for(int j = 0; j < n-ans[i]; j++) S.insert(ans[i]);
			continue;
		}
		if(Q.size()){
			llint p = Q.top().first, id = Q.top().second;
			Q.pop();
			if(p < i){
				cout << "No" << endl;
				return 0;
			}
			ans[i] = id;
			rem[id]--;
			if(rem[id] > 0) Q.push(P(x[id], id));
		}
		else{
			if(S.size() == 0){
				cout << "No" << endl;
				return 0;
			}
			ans[i] = *S.begin();
			S.erase(S.begin());
		}
	}
	
	cout << "Yes" << endl;
	for(int i = 1; i <= n*n; i++) cout << ans[i] << " ";  cout << endl;
	
	return 0;
}


Measured memory_bytes: 8960
#include<cstdio>
#include<vector>

using namespace std;

int main()
{
	int n, i;
	int sum = 0;
	int max = 0;
	int input;

	scanf("%d", &n);

	for (i = 0; i < n; i++)
	{
		scanf("%d", &input);

		sum += input;

		if (input > max)
		{
			max = input;
		}
	}

	printf("%d\n", sum - max / 2);

	return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> a(N);
    vector<ll> b(N);

    REP(i, N){
        cin >> a[i];
    }

    REP(i, N){
        cin >> b[i];
    }

    ll plus = 0;
    ll minus = 0;

    REP(i, N){
        if(b[i]-a[i] > 0){
            plus += (b[i]-a[i])/2;
        }
        else{
            minus += a[i]-b[i];
        }
    }
    if(plus >= minus){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>

#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{

    
    int a, b;
    
    cin >> a >> b;
    cout << a*b;
    
}

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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    rep(i,n) cout << 'x';
    cout << endl;
    return 0;
}

Measured memory_bytes: 3592
def main():
  n,x,y = (int(i) for i in input().split())
  num_list = [0] * (n - 1)

  for i in range(1, n):
    for j in range(i + 1, n + 1):
      num = min(abs(i - j), abs(x - i) + 1 + abs(y - j), abs(y - i) + 1 + abs(x - j))
      if(num < n):
        num_list[num - 1] += 1

  for i in range(len(num_list)):
    print(num_list[i])

if __name__ == '__main__':
  main()      


Measured memory_bytes: 3444
import java.util.Scanner

object Main extends App {

  val sc = new Scanner(System.in)

  val a = sc.nextLong
  val b = sc.nextLong
  val k = sc.nextLong

  val takahashi = Math.max(a - k, 0L)
  val aoki =
    if(a >= k) b
    else Math.max(0L, a + b - k)

  println(s"$takahashi $aoki")
}

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

int main()
{
   int i,n,m;
   cin>>n>>m;
   vector<double> v;
   double t=1*1.0/(4*m);
   double sum=0;
   for(i=0;i<n;i++)
   {
       double x;
       cin>>x;
       sum+=x;
       v.push_back(x);
   }
   t=t*sum;
   int c=0;
   for(i=0;i<n;i++)
   {
       if(v[i]>=t)
      {
         c++;
      }
   }
   if(c>=m)
   {
       cout<<"Yes";
   }
   else cout<<"No";



}


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

int main(){
	int a,b,h;
	cin >> a >> b >> h;
	int ans = (a+b)*h/2;
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h> 
#define ll                 long long                            
#define ra                 return a;                                          
#define pb                 push_back                                                     
#define sti                stack<ll>
#define spi                stack<pair<ll,ll>>
#define S                  second
#define msi                map<string,ll >
#define msi                map<string,ll >
#define mii                map<ll ,ll >
#define dbg(x)             { cerr<<#x<<": "<<x<< endl; }
#define dbg2(x,y)          { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z)        { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define mis                map<ll , string>
#define rep(i,a,b)         for(ll  i=a;i<b;i++)
#define mpi                map<pair<ll ,ll >,ll >                                                
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define F                  first 
#define vi                 vector<ll >
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define vs                 vector<string>
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define hell               1000000007
#define bs                 binary_search
#define mp                 make_pair
#define qi                 queue<ll>
#define qs                 queue<string>
#define qpi                queue<pair<ll,ll>>
#define qps                queue<pair<ll,string>> 
#define endl               '\n' 
#define itr(a,it)          for(typeof(a.begin()) it=a.begin();it!=a.end();it++)// This will produce const_iterator for const object and normal iterator for non-const object
#define ss                 set<string>
using namespace std;
#define N  300005
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
//    cin>>t;
    while(t--)
{
    ll n,k;
    cin>>n>>k;
    ll hands=0,ans=0;
    ll q[n];
    rep(i,0,n)cin>>q[i];
    rep(i,0,n)
    {
    	ll dumsum=0,dumcnt=0;
    	vi dummy;
    	rep(c,0,i+1)
    	{
    		dummy.pb(q[c]);
    		dumsum+=q[c];
    		dumcnt++;
    		ans=max(ans,dumsum);
    		if(dumcnt==k)break;
    	}
	    	ll g=dumcnt;
	    	vi r=dummy;
	    	ll e=dumsum;
    		sort(all(dummy));
		    ll c=0;
		    while(dumcnt<k&&c<sz(dummy)&&dummy[c]<0)
		    {
		    	dumcnt++;
		    	dumsum-=dummy[c];
		    	c++;
		    }
		    ans=max(ans,dumsum);
		    dumsum=e;
		    dummy=r;
		    dumcnt=g;
    	if(dumcnt<k)
    	{
	    	rep(f,1,n)
	    	{
	    		ll g=dumcnt;
	    		vi r=dummy;
	    		ll e=dumsum;
		    	for(ll j=n-1;j>=n-f&&j>i;j--)
		    	{
		    		dumsum+=q[j];
		    		dummy.pb(q[j]);
		    		dumcnt++;
		    		if(dumcnt==k)break;
		    	}
		    	sort(all(dummy));
		    	ll c=0;
		    	while(dumcnt<k&&c<sz(dummy)&&dummy[c]<0)
		    	{
		    		dumcnt++;
		    		dumsum-=dummy[c];
		    		c++;
		    	}
		    	ans=max(ans,dumsum);
		    	dumsum=e;
		    	dummy=r;
		    	dumcnt=g;
	    	}
    	}
    }
    cout<<ans;
}
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a, b=0, c=0;
	string d,e;
	cin >> a;
	for (int i = 0; i < a; i++) {
		cin >> d >> e;
		if (d < e)c = c + 3;
		if (d > e)b = b + 3;
		if (d == e){b++; c++;}
	}
	cout << b << " " << c << "\n";
}


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

int main() {
  int n;
  cin >> n;
  int A=pow(10,5);
  for (int i=0; i<n; i++) {
    A*=(1.05);
    A=(A+999)/1000*1000;
  }
  printf("%d\n",A);
  return 0;
}

Measured memory_bytes: 3160
#include <stdio.h>
#include <utility>
#include <algorithm>
#include <set>
using namespace std;
char txt[500001];
set<int> visit[26];
int main(){
	int N;
	scanf("%d",&N);
	scanf("%s",txt+1);
	for(int i=1;i<=N;i++) visit[txt[i]-'a'].insert(i);
	for(int i=0;i<26;i++) visit[i].insert(987654321);
	int Q;scanf("%d",&Q);
	while(Q--){
		int a;scanf("%d",&a);
		if(a==1){
			int i;
			char c;
			scanf("%d %c",&i,&c);
			visit[txt[i]-'a'].erase(i);
			txt[i]=c;
			visit[txt[i]-'a'].insert(i);
		}
		else{
			int l,r;
			scanf("%d %d",&l,&r);
			int cnt=0;
			for(int i=0;i<26;i++){
				if((*visit[i].lower_bound(l))<=r) cnt++;
			}
			printf("%d\n",cnt);
		}
	}
}

Measured memory_bytes: 24192
#include <iostream>
#include<algorithm>
using namespace std;
int main() {
	int a[20], w1 = 0, w2 = 0, w3 = 0, k1 = 0, k2 = 0, k3 = 0;
	for (int i = 0; i < 20; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < 10; i++) {
		if (w3 < a[i])
			w3 = a[i];
		if (w2 < w3)
			swap(w2, w3);
		if (w1 < w2)
			swap(w2, w1);
	}
	for (int i = 10; i < 20; i++) {
		if (k3 < a[i])
			k3 = a[i];
		if (k2 < k3)
			swap(k2, k3);
		if (k1 < k2)
			swap(k2, k1);
	}
	cout << w3 + w2 + w1 << " " << k1 + k2 + k3 << endl;
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1e9+7;
int p[15];
vector<int> a[15];
int main() {
    int n, m; cin>>n>>m;
    for(int i=0; i<m; i++) {
        int x; cin>>x;
        for(int j=0; j<x; j++) {
            int v; cin>>v;
            a[i].push_back(v-1);
        }
    }
    for(int i=0; i<m; i++) cin>>p[i];
    int ans = 0;
    for(int i=0; i<(1<<n); i++) {
        map<int, int> mp;
        for(int j=0; j<n; j++) {
            if(i&(1<<j)) mp[j] = 1;
        }
        int ok = 0;
        for(int j=0; j<m; j++) {
            int sum = 0;
            for(int k=0; k<a[j].size(); k++) {
                if(mp[a[j][k]]) sum++;
            }
            if(sum%2!=p[j]) {
                ok = 1;
                break;
            }
        }
        if(!ok) ans++;
        //if(!ok) cout<<i<<endl;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256