akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
  ll n;
  cin >> n;
  vl c,v;
  inputv(v,n);
  inputv(c,n);
  ll sum = 0;
  rep(i,n){
    v[i] = max((ll)0,(v[i]-c[i]));
    sum += v[i];
  }
  cout << sum;
  
 return 0;
}


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

int main(){
	int i, j;
	int H = 0;
	int W = 0;

	while (cin >> H >> W){
		if (H != 0 || W != 0){
			for (i = 0; i < H; i++){
				for (j = 0; j < W; j++){
					if ((i + j) % 2 == 0){
						cout << "#";
					}
					else {
						cout << ".";
					}
				}
				cout << "\n";
			}
			cout << "\n";
		}
		else {
			break;
		}
	}
}

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;
signed main() {
  int64_t d;
  cin >> d;
  int64_t c[26];
  vector<vector<int64_t>> s(d);
  for(int i=0;i<26;i++){
    cin >> c[i];
  }
  
  for(int i=0;i<d;i++){
    for(int j=0;j<26;j++){
      int x;
      cin >> x;
      s[i].push_back(x);
    }
  }
  
  int64_t satis[26] = {0};
  int lastD[26] = {0};

  int t[d];

  int64_t totalSatis = 0;
  for(int i=0;i<d;i++){
    int maxId = 0;
    int64_t maxTotal = -100000000;
    for(int j=0;j<26;j++){
      int64_t tmpTotal = totalSatis;
      tmpTotal += s[i][j];
      for(int k=0;k<26;k++){
        if(k==j)continue;
        tmpTotal -= c[k]*(i+1-lastD[k]);
      }
      if(tmpTotal>maxTotal){
        maxTotal = tmpTotal;
        maxId = j;
      }
    }
    lastD[maxId]=i+1;
    totalSatis = maxTotal;
    cout << maxId+1 << endl;
    t[i] = maxId;
  }
  
  return 0;
}




Measured memory_bytes: 3816
from collections import deque

def main():
    n, m = map(int, input().split())
    adj = [[]for i in range(n+1)]
    for i in range(m):
        a, b = map(int, input().split())
        adj[a].append(b)
        adj[b].append(a)
    parent = [0]*(n+1)
    visited = [0]*(n+1)
    root = 1
    visited[root] = 1
    q = deque([root])
    while q:
        v = q.popleft()
        for i in adj[v]:
            if visited[i]:
                continue
            visited[i] = 1
            parent[i] = v
            q.append(i)
    print('Yes')
    print(*parent[2:], sep='\n')

if __name__ == '__main__':
    main()

Measured memory_bytes: 36308
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        Map<String, Integer> blueCards = inputCount(cin);
        Map<String, Integer> redCards = inputCount(cin);

        int max = 0;
        for (String card : blueCards.keySet()) {
            int value = blueCards.get(card) - redCards.getOrDefault(card, 0);
            if (max < value) max = value;
        }
        System.out.println(max);
    }

    static Map<String, Integer> inputCount(Scanner cin) {
        int n = cin.nextInt();
        String[] cards = new String[n];
        for (int i = 0; i < n; i++) {
            cards[i] = cin.next();
        }
        Map<String, Integer> result = new HashMap<>();
        if (cards.length == 0)
            return result;

        Arrays.sort(cards);
        String s = cards[0];
        int count = 0;
        for (String card: cards) {
            if (card.equals(s)) {
                count++;
            } else {
                result.put(s, count);
                count = 1;
                s = card;
            }
        }
        result.put(s, count);
        return result;

    }
}

Measured memory_bytes: 21844
n=int(input())
x=26
l=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
r=[]
while n > 0:
    r.append(l[n%x-1])
    n=int((n-1)/x)
r=r[::-1]
print("".join(r))


Measured memory_bytes: 9196
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class C
{
	public static void Main()
	{
		int N = Int32.Parse(Console.ReadLine());
		int[] A = new int[N+2];  // A[0] = 0, A[N+1] = 0
		string[] args = Console.ReadLine().Split(' ');
		for(int i = 1; i <= N; i++)
			A[i] = Int32.Parse(args[i-1]);

		int sum = 0;
		for(int i = 0; i <= N; i++)
			sum += Math.Abs(A[i+1] - A[i]);

		for(int i = 1; i <= N; i++)
			Console.WriteLine(sum -
				Math.Abs(A[i] - A[i-1]) -
				Math.Abs(A[i+1] - A[i]) +
 				Math.Abs(A[i+1] - A[i-1]));
	}
}





Measured memory_bytes: 24796
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
vector<int> x = {1,-1,0,0};
vector<int> y = {0,0,-1,1};
int main(){
    int n,k;
    cin >> n >> k;
    vector<int> data(200000);
    rep(i,0,n){
        int a;
        cin >> a;
        data[a]++;
    }
    sort(data.begin(),data.end());
    reverse(data.begin(),data.end());
    int sum=0;
    rep(i,0,k){
        sum += data[i];
    }
    cout<<n-sum<<endl;

    
    
  return 0;
}

Measured memory_bytes: 4036
#include <iostream>
#include <functional>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <map>
#include <cmath>

using namespace std;

namespace _{struct _{_(){ // initialize
  cin.tie(0); ios::sync_with_stdio(false);
}}_;}
template <typename T, size_t size>
inline size_t len(const T (&)[size]) { return size; }
#define println(s) cout << s << '\n';
#define str to_string
#define rep(i, n) for (int i=0; i<int(n); i++)
#define all(c) (c).begin(), (c).end()


int c[5];
int count_gu;
int count_tyo;
int count_paa;
#define GU 1
#define TYO 2
#define PAA 3

#define WIN 1
#define LOSE 2
#define AIKO 3

void count() {
  count_gu = 0; count_tyo = 0; count_paa = 0;
  rep(i, 5) {
    switch (c[i]) {
      case GU:  count_gu++;  break;
      case TYO: count_tyo++; break;
      case PAA: count_paa++; break;
    }
  }
}


int main() {
  while (true) {
    cin >> c[0];
    if (c[0] == 0) break;
    cin >> c[1] >> c[2] >> c[3] >> c[4];
    int a[5]; // answer
    count();
    // kati/make
    if (!((count_gu == 5 || count_paa == 5 || count_tyo == 5) ||
        (count_gu != 0 && count_tyo != 0 && count_paa != 0))) {
      // tyo -> win / paa -> lose
      if (count_gu == 0) {
        rep(i, 5) {
          if (c[i] == TYO) a[i] = WIN;
          else             a[i] = LOSE;
        }
      }
      // tyo -> lose / gu -> win
      if (count_paa == 0) {
        rep(i, 5) {
          if (c[i] == GU) a[i] = WIN;
          else            a[i] = LOSE;
        }
      }
      // paa -> win / gu -> lose
      if (count_tyo == 0) {
        rep(i, 5) {
          if (c[i] == PAA) a[i] = WIN;
          else             a[i] = LOSE;
        }
      }
    }
    // aiko
    else rep(i, 5) a[i] = AIKO;

    rep(i, 5) cout << a[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 1192
import sys
sys.setrecursionlimit(1000000)
n, m = map(int, input().split())
s = input()
links = [[] for _ in range(2*n)]
visit = [0] * n *2
for line in sys.stdin.readlines():
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    if s[a] == s[b]:
      links[a].append(b+n)
      links[b].append(a+n)
    else:
      links[a+n].append(b)
      links[b+n].append(a)
def dfs(v):
  visit[v] = 1
  for i in links[v]:
    if visit[i] == 1:
      print("Yes")
      exit()
    elif visit[i] == 0:
      dfs(i)
  visit[v] = -1
  
for i in range(n):
  if visit[i] == 0:
    dfs(i)
print("No")

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

int32_t main() {
	ios::sync_with_stdio(0);cin.tie(0);
	int n, m;
	cin >> n >> m;
	int l = 1, r = 2;
	for(int i=1; i<=m; i+=2) {
		cout << l << ' ' << r << '\n';
		l--, r++;
		if(!l)
			l = n;
	}
	int t = (l+r)/2;
	l = t-1;
	r = t+1;
	for(int i=2; i<=m; i+=2) {
		cout << l << ' ' << r << '\n';
		l--, r++;
	}
}

Measured memory_bytes: 3648
// C++ code to find number of distinct numbers 
// in a subarray 
#include<bits/stdc++.h> 
using namespace std; 
  
const int MAX = 1000001; 
  
// structure to store queries 
struct Query 
{ 
    int l, r, idx; 
}; 
  
// cmp function to sort queries according to r 
bool cmp(Query x, Query y) 
{ 
    return x.r < y.r; 
} 
  
// updating the bit array 
void update(int idx, int val, int bit[], int n) 
{ 
    for (; idx <= n; idx += idx&-idx) 
        bit[idx] += val; 
} 
  
// querying the bit array 
int query(int idx, int bit[], int n) 
{ 
    int sum = 0; 
    for (; idx>0; idx-=idx&-idx) 
        sum += bit[idx]; 
    return sum; 
} 
  
void answeringQueries(int arr[], int n, Query queries[], int q) 
{ 
    // initialising bit array 
    int bit[n+1]; 
    memset(bit, 0, sizeof(bit)); 
  
    // holds the rightmost index of any number 
    // as numbers of a[i] are less than or equal to 10^6 
    int last_visit[MAX]; 
    memset(last_visit, -1, sizeof(last_visit)); 
  
    // answer for each query 
    int ans[q]; 
    int query_counter = 0; 
    for (int i=0; i<n; i++) 
    { 
        // If last visit is not -1 update -1 at the 
        // idx equal to last_visit[arr[i]] 
        if (last_visit[arr[i]] !=-1) 
            update (last_visit[arr[i]] + 1, -1, bit, n); 
  
        // Setting last_visit[arr[i]] as i and updating 
        // the bit array accordingly 
        last_visit[arr[i]] = i; 
        update(i + 1, 1, bit, n); 
  
        // If i is equal to r of any query  store answer 
        // for that query in ans[] 
        while (query_counter < q && queries[query_counter].r == i) 
        { 
            ans[queries[query_counter].idx] = 
                     query(queries[query_counter].r + 1, bit, n)- 
                     query(queries[query_counter].l, bit, n); 
            query_counter++; 
        } 
    } 
  
    // print answer for each query 
    for (int i=0; i<q; i++) 
        cout << ans[i] << endl; 
} 
  
// driver code 
int main() 
{ 
	int N,Q;
	cin>>N>>Q;
	int a[N]; Query queries[Q];
	for(int i=0; i<N; i++)cin>>a[i];
	for(int i=0; i<Q; i++){
		int a,b;
		cin>>a>>b;
		queries[i].l=a-1;
		queries[i].r=b-1;
		queries[i].idx=i;
	}
    int n = sizeof(a)/sizeof(a[0]); 
    int q = sizeof(queries)/sizeof(queries[0]); 
    sort(queries, queries+q, cmp); 
    answeringQueries(a, n, queries, q); 
    return 0; 
} 

Measured memory_bytes: 19312
N, T = map(int, input().split())
A = [None] * N
B = [None] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())


dp1 = [[0] * T for _ in range(N + 1)]
for i in range(N):
    for j in range(T):
        here = dp1[i][j]
        a, b = A[i], B[i]
        if j < a:
            dp1[i + 1][j] = here
        else:
            dp1[i + 1][j] = max(here, dp1[i][j - a] + b)

dp2 = [[0] * T for _ in range(N + 2)]
for i in range(N, 0, -1):
    for j in range(T):
        here = dp2[i + 1][j]
        a, b = A[i - 1], B[i - 1]
        if j < a:
            dp2[i][j] = here
        else:
            dp2[i][j] = max(here, dp2[i + 1][j - a] + b)

ans = 0
for i in range(1, N + 1):
    for j in range(T):
        n1 = dp1[i - 1][j]
        n2 = dp2[i + 1][T - 1 - j]
        last = B[i - 1]
        ans = max(ans, n1 + n2 + last)

print(ans)


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

int main()
{
    int a;
  	cin >> a;
 	string b[a];
  	cin >> b[0];
  	for(int i=1;i<a;i++){
        cin >> b[i];
      	if(b[i-1][b[i-1].length()-1]!=b[i][0]){
         cout << "No" << endl;
         return 0;
        }
      	for(int j=0;j<i;j++){
          if(b[i]==b[j]){
            cout << "No" << endl;
            return 0;
          }
        }
    }

  	cout << "Yes" << endl;
  
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const double eps=1e-9;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
int N;
string s;
int person[15];
int field;
int nowturn;
int main(void)
{
  while(cin >> N && N)
    {
      cin >> s;
      field=0;
      nowturn=0;
      memset(person,0,sizeof(person));
      for(int i=0;i<100;i++)
	{
	  person[nowturn]++;
	  if(s[i]=='S')
	    {
	      field+=person[nowturn];
	      person[nowturn]=0;
	    }
	  else if(s[i]=='L')
	    {
	      person[nowturn]+=field;
	      field=0;
	    }
	  nowturn=(nowturn+1)%N;
	}
      sort(person,person+N);
      for(int i=0;i<N;i++)
	{
	  cout << person[i] << ' ';
	}
      cout << field << endl;
    }
  return 0;
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 200010;
const int MAXK = 110;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    string s, t;
    cin >> s >> t;
    int res = 0;
    FOR(i,0,SZ(s)-1) res += (s[i] == t[i]);
    cout << res;
    return 0;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	bool ap = true;
	int n;
	vector <int> a;
	cin >> n;
	a.resize(n);
	for(int& elem: a)
		cin >> elem;
	for(int i = 0; i < n; i++) {
		if (a[i] % 2 == 0 && (a[i] % 3 != 0 && a[i] % 5 != 0))
			{ap = false; break;}
	}
	
	if (ap)
			cout << "APPROVED\n";
	else cout << "DENIED\n";
  return 0;
}

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

class Dice{
    public:
        int face1,face2,face3,face4,face5,face6;
        Dice(int f1,int f2,int f3, int f4, int f5, int f6){
            face1 = f1;
            face2 = f2;
            face3 = f3;
            face4 = f4;
            face5 = f5;
            face6 = f6;
        }
        void North_Roll(){
            int tmp;
            tmp = face1;
            face1 = face2;
            face2 = face6;
            face6 = face5;
            face5 = tmp;
        }
        void South_Roll(){
            int tmp;
            tmp = face1;
            face1 = face5;
            face5 = face6;
            face6 = face2;
            face2 = tmp;
        }
        void East_Roll(){
            int tmp;
            tmp = face1;
            face1 = face4;
            face4 = face6;
            face6 = face3;
            face3 = tmp;
        }
        void West_Roll(){
            int tmp;
            tmp = face1;
            face1 = face3;
            face3 = face6;
            face6 = face4;
            face4 = tmp;
        }
        void Result(){
            cout << face1 << endl;
        }
};

int main(){
    int f1,f2,f3,f4,f5,f6;
    string command;
    cin >> f1 >> f2 >> f3 >> f4 >> f5 >> f6 >> command;
    Dice d1(f1, f2, f3, f4, f5, f6);
    for (int i = 0; i < command.size(); i++){
        if (command[i] == 'E'){
            d1.East_Roll();
        }
        if (command[i] == 'W'){
            d1.West_Roll();
        }
        if (command[i] == 'N'){
            d1.North_Roll();
        }
        if (command[i] == 'S'){
            d1.South_Roll();
        }
    }
    d1.Result();
    return 0;
}


Measured memory_bytes: 3192
N,K=gets.split.map(&:to_i)
S=gets.chomp.chars

arr = S.chunk {|c| c}.map{|a,b| [a,b.length]}.to_a

i = 0
j = K
sum = 0
ret = 0
while i < arr.length
    c,n = arr[i]
    if c == '1'
        sum += n
    elsif 0 < j
        j -= 1
        sum += n
    else
        sum -= arr[i-K*2][1]
        sum -= arr[i-K*2-1][1] if 0 <= i-K*2-1
        sum += n
    end
    # p [ret,sum,i,j]
    ret = sum if ret < sum
    i += 1
end

puts ret

Measured memory_bytes: 27496
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/rope>

using namespace __gnu_pbds; 
using namespace __gnu_cxx;
using namespace std;
using ll = long long;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define precision(n) fixed<<setprecision(n)

#ifdef LOCAL
    #include "debug.h"
#else
    #define debug(...) 42
#endif

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);    
    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
}

template<typename T> using oset = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update >;
template<typename T> using MinPriorityQueue = priority_queue <T, vector <T>, greater <T> >;
template<typename T> void done(T ans) {cout << ans << "\n"; exit(0);}


template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
  for(auto& i:x)
    input>>i;
  return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
  for(auto& i:x)
    output<<i<<' ';
  return output;
}

 

const int mod = 1e9;
const int N = 3e5 + 5;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937_64 mt(seed);

template <typename T>
long long myrand(T m) {
    long long mod = m;
    long long x = mt()%mod;

    return x;
}

int main() {
    io();
    int t;
    int x, a, b;
    cin >> x >> a >> b;
    for(int i = a; i <= b; i++) {
        if(i % x == 0) {
            cout << "OK";
            return 0;
        }
    }
    cout << "NG";
}




Measured memory_bytes: 3640
#include <iostream>

using namespace std;


int main() {
    bool isUsedColor[8] {};
    int n;
    cin >> n;

    int freeColor {};

    for(int rate; cin >> rate;) {
        int rateColor = rate / 400;

        if(rateColor < 8) {
            isUsedColor[rateColor] = true;
        }
        else {
            ++freeColor;
        }
    }

    bool isAllFreeColor {true};
    int colMin {};

    for(auto t : isUsedColor) {
        if(t) {
            isAllFreeColor = false;
            ++colMin;
        }
    }

    cout << (isAllFreeColor ? 1 : colMin) << " " << colMin + freeColor << endl;


    return 0;
}

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

int main(){
    long long int a, b, k;
    cin >> a >> b >> k;
    if (k <= a){
        a -= k;
    }
    else{
        k -= a;
        a = 0;
        if (k <= b)b -= k;
        else b = 0;
    }
    cout << a << " " << b << endl;
    return 0;
}

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int N; cin >> N;
        vector<ll> B(N - 1); cin >> B;
        ll ans = 0;
        rep(i, N) {
            if(i == 0) ans += B.front();
            else if(i == N - 1) ans += B.back();
            else ans += min(B[i - 1], B[i]);
        }
        cout << ans << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  immutable mod = 1_000_000_000 + 7;

  int n, k;
  readf("%s %s\n", &n, &k);

  auto a = readln.chomp.split.to!(int[]);

  long cn, bn;

  foreach (i; 0..n) {
    foreach (j; 0..n) {
      if (a[i] > a[j]) {
        bn++;
      }

      if (i >= j) continue;
      if (a[i] > a[j]) {
        cn++;
      }
    }
  }

  long res = (cn * k) % mod;

  auto bncnt = ((k.to!BigInt - 1) * k) / 2;

  res = res + (bn * (bncnt % mod));
  res %= mod;

  res.writeln;
}


Measured memory_bytes: 380
from collections import deque
s = [0,0,0]

sa = deque(list(input()))
sb = deque(list(input()))
sc = deque(list(input()))

now = sa.popleft()

if now == 'a':
	d = sa
if now == 'b':
	d = sb
if now == 'c':
	d = sc

while True:
	if len(d) == 0:
		ans = now
		break
	now = d.popleft()
	if now == 'a':
		d = sa
	if now == 'b':
		d = sb
	if now == 'c':
		d = sc

print(ans.upper())


Measured memory_bytes: 3316
#include <iostream>
#include <set>
#include <cmath>
using namespace std;
const int N=100000+10;
typedef long long LL;
int n,a[N];
int main(){
    scanf("%d",&n);
    long long ans=0, mn=1e9;
    int cnt=0;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        mn = min(mn, (LL)abs(a[i]));
        if(a[i]<0) cnt++;
        ans += abs(a[i]);
    }
    if(cnt%2==0){
        cout<<ans<<endl;
    }else{
        cout<<ans-2*mn<<endl;
    }
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void){
    int n;
    scanf("%d",&n);
    int tmp;
    int a[111];
    int i;
    for(i=0;i<n;i++) scanf("%d",a+i);
    
    int flg = 1, cnt = 0;
    while(flg){
        flg=0;
        for(i=n-1;i>0;i--){
            if(a[i]<a[i-1]){
                tmp = a[i];
                a[i] = a[i-1];
                a[i-1] = tmp;
                cnt = cnt + 1;
                flg = 1;
            }
        }
    }
    for(i=0;i<n;i++){
        printf("%d%c",a[i]," \n"[i==n-1]);
    }
    printf("%d\n",cnt);
    
}


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

int main(){
  int N, M;
  cin >> N >> M;
  int temp = 0;
  int flag = 1;
  for(int i  = 0; i < M ; i++){
    cin >> temp;
    N = N - temp;
    if(N < 0){
      cout << -1 << endl;
      flag = 0;
      break;
    }
  }
  if(flag)
	cout << N <<endl;
  return 0;
}

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

vector<int> parse(int n, string& s) {
    char c = s[0];
    int tmp = 1;
    vector<int> res;
    for (int i = 1; i < n; i++) {
        if (s[i] != c) {
            c = s[i];
            res.push_back(tmp);
            tmp = 1;
        } else {
            tmp++;
        }
    }
    res.push_back(tmp);
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    string s;
    cin >> n >> k >> s;
    vector<int> v = parse(n, s);
    int ans = 0, cnt = 0, seq = 0;
    queue<int> q;
    if(s[0] == '0'){
        if(v.size()%2 != 0) v.push_back(0);
        for(int i = 0; i < v.size(); i+=2){
            if(seq >= k){
                int p = q.front();
                q.pop();
                cnt -= p;
                if(seq != k){
                    p = q.front();
                    q.pop();
                    cnt -= p;
                }
            }
            q.push(v[i]);
            q.push(v[i+1]);
            cnt += v[i]+v[i+1];
            ans = max(ans, cnt);
            seq++;
        }
    }
    else{
        ans += v[0];
        if(v.size()%2 == 0) v.push_back(0);
        for(int i = 1; i < v.size(); i+=2){
            if(seq >= k){
                int p = q.front();
                q.pop();
                cnt -= p;
                if(seq != k){
                    p = q.front();
                    q.pop();
                    cnt -= p;
                }
            }
            q.push(v[i]);
            q.push(v[i+1]);
            cnt += v[i]+v[i+1];
            ans = max(ans, cnt);
            seq++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
//    ios_base::sync_with_stdio(false);
//    cin.tie(0);
	ll n;
	cin >> n;
	ll i,j,t,k;
	map<ll,ll> a,b;
	vector<ll> ans;
	for(i=0;i<n;i++){
		cin >> t;
		a[t]++;
		ans.push_back(t);
	}
	ll sum=0;
	for(auto it:a){
		if(it.second>1){
			b[it.first]=(it.second)*(it.second-1)/2;
			sum+=b[it.first];
		}
		else{
			b[it.first]=0;
		}
	}
	for(i=0;i<n;i++){
		if(a[ans[i]]>=2){
			cout << sum-b[ans[i]]+(a[ans[i]]-1)*(a[ans[i]]-2)/2 << endl;
		}
		else{
			cout << sum-b[ans[i]] << endl;
		}
	}
    return 0;
}

Measured memory_bytes: 19284
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func readFloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

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

func main() {
	sc.Split(bufio.ScanWords)
	n, m := readInt(), readInt()
	a := make([]int, n)
	sum := 0
	for i := 0; i < m; i++ {
		a[i] = readInt()
		sum += a[i]
	}
	if sum > n {
		fmt.Println("-1")
		return
	}

	fmt.Println(n - sum)
}


Measured memory_bytes: 2188
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include<stack>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
string s;


int main(void)
{
    
    cin>>s;
    ll i=s.size()-1;

    while(i>0)
    {
        if(s.substr(i-4,5)=="dream") i-=5;
        else if(s.substr(i-4,5)=="erase") i-=5;
        else if(s.substr(i-5,6)=="eraser") i-=6;
        else if(s.substr(i-6,7)=="dreamer") i-=7;

        else
        {
            
            cout<<"NO"<<endl;
            return 0;
        }
        


    }
    cout<<"YES"<<endl;


}

Measured memory_bytes: 3224
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#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 rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
#define fi first
#define se second
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    ll n;cin>>n;
    vll a(n);
    rep(i,n) cin>>a[i];
    sort(all(a));

    ll ans;
    rep(i,n-1){
      a[i+1]=__gcd(a[i],a[i+1]);
    }
     cout<<a[n-1]<<endl;
}

Measured memory_bytes: 3972
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll d[1010];

int isPrime(int n) {
	int i;

	if (n < 2) {
		return 0;
	}
	else if (n == 2) {
		return 1;
	}

	if (n % 2 == 0) {
		return 0;
	}

	for (i = 3; i * i <= n; i += 2) {
		if (n % i == 0) {
			return 0;
		}
	}

	return 1;
}

int main() {
	vector<ll> isP;
	ll n;
	cin >> n;
	if(n==1){
		cout << 1 << endl;
		return 0;
	}
	rep(i, 2, n+1) {
		if (isPrime(i) == 1) {
			isP.pb(i);
		}
	}
	clr(d, 0);
	rep(i, 2, n + 1) {
		ll dd[1010];
		clr(dd, 0);
		rep(j,0,isP.sz){
			rep(k,1,11){
				ll a = pow(isP[j],k);
				if(i%a==0){
					dd[isP[j]]=max(dd[isP[j]],k);
				}
			}
		}
		rep(j,0,1010){
			d[j] += dd[j];
		}
	}
	ll ans = 1;
	rep(i,2,1010){
		ans *= d[i]+1;
		ans %= MOD;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 512
from collections import Counter

n=int(input())
a=list(map(int,input().split()))

c=Counter(a)
l=c.most_common()
rectangle=[]
square=[]
x=len(l)
for i in range(x):
    if l[i][1]>=2:
        rectangle.append(l[i][0])
    if l[i][1]>=4:
        square.append(l[i][0])
rectangle.sort()
square.sort()
if len(rectangle)<2 and len(square)<1:
    print(0)
elif len(rectangle)>=2 and len(square)<1:
    print(rectangle[-1]*rectangle[-2])
elif len(rectangle)<2 and len(square)>=1:
    print(square[-1]**2)
else:
    ans1=rectangle[-1]*rectangle[-2]
    ans2=square[-1]**2
    if ans1<ans2:
        print(ans2)
    else:
        print(ans1)

Measured memory_bytes: 21668
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    INT(n);
    VI a(n);
    VVI x(n),y(n);
    rep(i,n){
        cin >> a[i];
        x[i].resize(a[i]);
        y[i].resize(a[i]);
        rep(j,a[i]){
            cin >> x[i][j] >> y[i][j];
            x[i][j]--;
        }
    }

    int ma = -1;
    rep(i,(1 << n)){
        bool flag = true;
        rep(j,n){
            if(!(i&(1<<j))) continue;
            rep(k,a[j]) if(((i >> x[j][k]) & 1) ^ y[j][k]) flag = false;
        }
        int cnt = 0;
        rep(j,n) if((i>>j)&1) cnt++;
        if(flag) ma = max(cnt,ma);
    }
    OUT(ma);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define all(v) v.begin(),v.end()
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }

class Solver {
  public:
    bool solve() {
        int N; cin >> N;
        vector<ll> A(3 * N); cin >> A;
        sort(all(A), greater<ll>());
        ll ans = 0;
        rep(i, N) ans += A[i * 2 + 1];
        cout << ans << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 2560
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
using namespace std;
using ld = long double;
const ld eps = 1e-9;

int main() {
	

	long long int N; cin >> N;
	long long int amax;
	for ( amax=1; amax <= N; ++amax) {
		long long int sum = (amax*(amax + 1) / 2);
		if (sum >= N) {
			break;
		}
	}
	int rest = N;
	for (int score = amax; score >= 1; --score) {
		if (rest >= score) {
			cout << score << endl;
			rest -= score;
		}
	}
	return 0;
}

Measured memory_bytes: 256
def solve():
    N = int(input())
    A = [int(input()) for i in range(N)]

    A = sorted(A)

    i = 0
    k = 0
    ans = 0

    while i < N:
        tmp = A[i]
        n = 0
        while k < N and tmp == A[k]:
            n += 1
            k += 1
        i = k
        if n%2 == 1:
            ans += 1

    print(ans)
            
        


if __name__ == "__main__":
    solve()


Measured memory_bytes: 14000
import numpy as np
k = int(input())
a = 0
for i in range(1,k+1):
  for j in range(1,k+1):
    d = np.math.gcd(i,j)
    for l in range(1,k+1):
      e = np.math.gcd(d,l)
      a += e
print (a)

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

int main() {
  int N,over=0;
  cin>>N;
  vector<int> a(N),c(8);
  
  for(int i=0;i<N;i++){
    cin>>a[i];
    for(int j=0;j<8;j++) if(j*400<=a[i]&&a[i]<(j+1)*400) c[j]=1;
    if(3200<=a[i]) over++;
  }
  
  int cnt=0;
  for(int j=0;j<8;j++) cnt+=c[j];
  
  int min,Max;
  
  if(cnt==0) min=1;
  else min=cnt;
  
  Max=cnt+over;
  
  cout<<min<<" "<<Max;
}

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

using namespace std;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    
    int divisor = 0; 
    
    for(int i=a;i<b+1;i++){
        if(c%i==0){
            divisor++;
        }
    }
    
    cout << divisor << endl;
    
    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <cstdio>
#include <cstring>
 
using namespace std;
int main(){
  int N, T, E;
  cin >> N >> T >> E;
  int Time;
  int ans = 0;
  int x;
  for(int i = 1 ; i <= N ; i++){
    cin >> Time;
    for(int j = 1 ; Time*j <= T+E ; j++){
      x = Time * j;
      if(T - E <= x && x <= T + E){
	ans = i;
	break;
      }
    }
  }
  if(ans == 0) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

ll n;
vl a;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	ll t=0;
	a=vl(n);
	for(int i=0;i<n;i++){
		ll x,y;
		cin>>x>>y;
		a[i]=x+y;
		t+=x;
	}
	sort(a.rbegin(),a.rend());
	for(int i=1;i<n;i+=2) t-=a[i];
	cout<<t<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
	long long int A, B;
    int K; 
	cin >> A >> B >> K; 
	for(int i = 0; i < K; i++){
		if(i % 2 == 0){
			B = B + A / 2; 
			A = A / 2; 
		}
		if(i % 2 == 1){
			A = A + B / 2; 
			B = B / 2; 
		}
	}
	cout << A << " " << B << endl; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    #define double long double
    typedef long long ll;
    #define pr pair<int,int>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define SZ(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    void chmax(int &x,const ll y) {x=(x>y?x:y);}
    void chmin(int &x,const ll y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):0;}
    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    inline int mm(const int x){return x>=MOD?x-MOD:x;}
    inline ll qpower(ll x,ll e)
    {
        ll ans=1;
        while(e)
        {
            if(e&1) ans=ans*x%MOD;
            x=x*x%MOD;e>>=1;
        }
        return ans;
    }
    inline int invm(int x){return qpower(x,MOD-2);}
    const int N=1e6+10;

    char str[N];int cnt[N];
    void to(int &x,int &y){if(x) y++,x--;}
    void main()
    {
        int n=qread();ll ans=1;for(int i=2;i<=n;i++) ans=ans*i%MOD;
        scanf("%s",str+1);
        for(int i=1;i<=3*n;i++)
        {
            int now=(str[i]=='R'?1:(str[i]=='G'?2:3));
            if(cnt[7-now]) ans=ans*cnt[7-now]%MOD,cnt[7-now]--;
            else if(now==1 and cnt[2]+cnt[3]) ans=ans*(cnt[2]+cnt[3])%MOD,to(cnt[2],cnt[2+now+1]),to(cnt[3],cnt[3+now+1]);
            else if(now==2 and cnt[1]+cnt[3]) ans=ans*(cnt[1]+cnt[3])%MOD,to(cnt[1],cnt[1+now+1]),to(cnt[3],cnt[3+now+1]);
            else if(now==3 and cnt[1]+cnt[2]) ans=ans*(cnt[1]+cnt[2])%MOD,to(cnt[2],cnt[2+now+1]),to(cnt[1],cnt[1+now+1]);
            else cnt[now]++;
            // puts("");
        }write(ans);
    }
};
int main()
{
    srand(time(0));
    mine::main();
}


Measured memory_bytes: 2432
from decimal import Decimal


def com_interest(n: int) -> int:
    saving = Decimal('100')
    interest_per = 0.01
    years = 0

    while True:
        years += 1
        saving = int(saving * Decimal('1.01'))
        if saving >= n:
            break
    return years


print(com_interest(int(input())))


Measured memory_bytes: 9920
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  string s;
  cin>>s;
  vector<int> v;
  int aq=0;
  
  for(int i=0;i<3;i++){
    if(s[i]=='R')  aq++;
    else {
      v.push_back(aq);
      aq=0;
    }

 if(i==2&&s[i]=='R') v.push_back(aq);
  }
 
 
  int ans=0;
  for(int j=0;j<3;j++){
    if(v[j]>ans) ans=v[j];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    set<string>s;

    int n;
    cin>>n;
    for (int i=0; i<n; ++i)
    {
        string t;
        cin>>t;
        s.insert(t);
    }
    cout<<s.size()<<"\n";

}


Measured memory_bytes: 19224
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int a,b,c,d,e,f;
	string x,y;
	cin>>x>>y;
	if(x=="A"){
		a=10;
		x=a;
	}
	if(y=="A"){
		a=10;
		y=a;
	}
	if(x=="B"){
		b=11;
		x=b;
	}
	if(y=="B"){
		b=11;
		y=b;
	}
	if(x=="C"){
		c=12;
		x=c;
	}
	if(y=="C"){
		c=12;
		y=c;
	}
	if(x=="D"){
		d=13;
		x=d;
	}
	if(y=="D"){
		d=13;
		y=d;
	}
	if(x=="E"){
		e=14;
		x=e;
	}
	if(y=="E"){
		e=14;
		y=e;
	}
	if(x=="F"){
		f=15;
		x=f;
	}
	if(y=="F"){
		f=15;
		y=f;
	}
	
	if(x>y){
		cout<<">"<<endl;
	}else if(x<y){
		cout<<"<"<<endl;
	}else{
		cout<<"="<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  int ans = 0, mx = 0;
  for(int i=0; i<n; i++) {
    int a; cin >> a; ans += a; mx = max(mx, a);
  }
  
  cout << (ans-mx/2) << endl;
  
  return 0;
}

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

using namespace std;
#define X first
#define Y second
typedef long long ll;
typedef pair<int,int> P;
const int MAXN=1e5+10;
P sqr[MAXN*10];
ll sum=0,cnt[15];
int n,m,k,x,y,tot;
int dx[]={-2,-2,-2,-1,-1,-1,0,0,0};
int dy[]={-2,-1,0,-2,-1,0,-2,-1,0};

int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=k;i++)
	{
		scanf("%d%d",&x,&y);
		for(int j=0;j<9;j++)
		{
			int fx=x+dx[j],fy=y+dy[j];
			if(fx>0&&fy>0&&fx<=n-2&&fy<=m-2)
				sqr[++tot]=P(fx,fy);
		}
	}
	
	sort(sqr+1,sqr+tot+1);
	int cur=1;
	for(int i=2;i<=tot;i++)
		if(sqr[i]==sqr[i-1]) cur++;
		else cnt[cur]++,cur=1;
	if(k) cnt[cur]++;//²»ÒªÍü¼Ç¶ÔÄ©Î²µÄ´¦Àí 
	
	for(int i=1;i<=9;i++) sum+=cnt[i];
	cnt[0]=1ll*(m-2)*(n-2)-sum;
	for(int i=0;i<10;i++) printf("%lld\n",cnt[i]);
	return 0;
}

Measured memory_bytes: 7296
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        String[] S = new String[N];
        int[] P = new int[N];
        for (int i=0; i<N; i++) {
            S[i] = sc.next();
            P[i] = sc.nextInt();
        }

        List<Item> ans = solve(N, S, P);
        for (int i=0; i<N; i++) {
            System.out.println(ans.get(i).index);
        }
    }

    private static List<Item> solve(int N, String[] S, int[] P) {
        List<Item> ans = new ArrayList<>();

        for (int i=0; i<N; i++) {
            ans.add(new Item(S[i], P[i], i+1));
        }

        Collections.sort(ans);

        return ans;
    }

    static class Item implements Comparable<Item> {
        String city;
        int score;
        int index;
        public Item(String city, int score, int index) {
            this.city = city;
            this.score = score;
            this.index = index;
        }

        public int compareTo(Item item) {
            if (!city.equals(item.city)) {
                return city.compareTo(item.city);
            }

            return item.score - score;
        }
    }
}


Measured memory_bytes: 22356
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long LL;
const LL MAXN = 8e5 + 5;
struct balls{
	LL x, node;
}a[MAXN + MAXN];
LL ok[MAXN];
LL dif(LL n){
	LL min1 = 0x7f7f7f7f, min2 = 0x7f7f7f7f, max1 = 0, max2 = 0;
	for(LL i = 0 ; i < n << 1 ; i += 2){
		LL k1 = min(a[i].x, a[i + 1].x), k2 = max(a[i].x, a[i + 1].x);
		min1 = min(min1, k1);
		max1 = max(max1, k1);
		min2 = min(min2, k2);
		max2 = max(max2, k2);
	}
	return (max1 - min1) * (max2 - min2);
}
bool cmp(balls y, balls z){
	return y.x < z.x;
}
LL same(LL n, LL r1, LL r2){
	LL sum = 0, i;
	for(i = 1 ; i <= n ; ++i)
		sum += i;
	LL mmin = min(r1 & 1 ? a[r1 - 1].x : a[r1 + 1].x, r2 & 1 ? a[r2 - 1].x : a[r2 + 1].x),
	   mmax = max(r1 & 1 ? a[r1 - 1].x : a[r1 + 1].x, r2 & 1 ? a[r2 - 1].x : a[r2 + 1].x);
	sum -= r1 / 2 + r2 / 2 + 2;
	ok[r1 / 2 + 1] = ok[r2 / 2 + 1] = 3;
	sort(a , a + 2 * n, cmp);
	LL l = 0, r = 0, ans = 0x7f7f7f7f7f7f7f7f;
	while(r < n << 1 && l < n << 1){
		if(!sum){
			ans = min(ans, max(mmax, a[r - 1 >= 0 ? r - 1 : 800000].x) - min(mmin, a[l].x));
			if(ok[a[l].node] == 1) sum += a[l].node;
			--ok[a[l].node];
			++l;
		}
		if(ok[a[l].node] >= 2) --ok[a[l].node], ++l;
		if(sum){
			if(!ok[a[r].node])
				sum -= a[r].node;
			++ok[a[r].node];
			++r;
		}
	}
	return ans;
}
int main(){
	LL n, i, mmin = 0x7f7f7f7f7f7f7f7f, mmax = 0, r1, r2, ans = 0x7f7f7f7f7f7f7f7f;
	scanf("%lld", &n);
	for(i = 0 ; i < n << 1 ; ++i){
		scanf("%lld", &a[i].x);
		a[i].node = i / 2 + 1;
		if(a[i].x > mmax){
			mmax = a[i].x;
			r1 = i;
		}
		if(a[i].x < mmin){
			mmin = a[i].x;
			r2 = i;
		}
	}
	ans = dif(n);
	if(r1 + 1 != r2 && r2 + 1 != r1)
		ans = min(ans, same(n, r1, r2) * (mmax - mmin));
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 9984
#include<cstdio>
#include<string>
#include<iostream>
char s[5];


int main(void){
    

    scanf("%s",&s);

    int a = s[0] - '0';
    int b = s[1] - '0';
    int c = s[2] - '0';
    int d = s[3] - '0';

    if(a + b + c + d == 7){
        printf("%d+%d+%d+%d=7\n", a, b, c, d);
    }
    else if(a + b + c - d == 7){
        printf("%d+%d+%d-%d=7\n", a, b, c, d);
    }
    else if(a + b - c + d == 7){
        printf("%d+%d-%d+%d=7\n", a, b, c, d);
    }
    else if(a + b - c - d == 7){
        printf("%d+%d-%d-%d=7\n", a, b, c, d);
    }
    else if(a - b + c + d == 7){
        printf("%d-%d+%d+%d=7\n", a, b, c, d);
    }
    else if(a - b + c - d == 7){
        printf("%d-%d+%d-%d=7\n", a, b, c, d);
    }
    else if(a - b - c + d == 7){
        printf("%d-%d-%d+%d=7\n", a, b, c, d);
    }
    else if(a - b - c - d == 7){
         printf("%d-%d-%d-%d=7\n", a, b, c, d);
    }
    return 0;
}

Measured memory_bytes: 256