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

using namespace std;

#define	AFTERDAY (5000.0 * 1000000000000)

// n, fig
map<int, long double> nm;

int main(void) {

	int i;
	for (i = 1; i <= 9; i++) {
		long double d = pow((long double)i, (long double)AFTERDAY);
		nm.insert(make_pair(i, d));
	}

	string	S;
	int K;
	cin >> S;
	cin >> K;
	int ans = 0;

	long double	current = 0.0;
	for  (i = 0; i < (int)S.size(); i++) {
		int key = S[i] - '0';
		long double val = nm.at(key);
		current += val;
		if ((long double)K <= current) {
			ans = key;
			break;
		} 
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 384
#include<stdio.h>
int seg[2000006];
int m;
void set(int x, int v)
{
	x += m - 1;
	seg[x] = v;
	while (x > 0)
	{
		x = (x - 1) / 2;
		seg[x] = (seg[2 * x + 1] | seg[2 * x + 2]);
	}
	return;
}
int get(int l, int r)
{
	int res = 0;
	l += m - 1;
	r += m - 1;
	while (l < r)
	{
		if (l % 2 == 0)
		{
			res |= seg[l];
			l++;
		}
		if (r % 2 > 0)
		{
			res |= seg[r];
			r--;
		}
		l = (l - 1) / 2;
		r = (r - 1) / 2;
	}
	if (l == r)
		res |= seg[l];
	return res;
}
int count(int n)
{
	int res = 0;
	while (n > 0)
	{
		res += n % 2;
		n /= 2;
	}
	return res;
}
int main()
{
	int n;
	scanf("%d", &n);
	char s[500005];
	scanf("%s", s);
	int v[30];
	int i;
	v[0] = 1;
	for (i = 1; i < 30; i++)
		v[i] = v[i - 1] * 2;
	m = 1;
	while (m < n)
		m *= 2;
	for (i = 0; i < 2 * m - 1; i++)
		seg[i] = 0;
	for (i = 0; i < n; i++)
		seg[i + m - 1] = v[s[i] - 'a'];
	for (i = m - 2; i >= 0; i--)
		seg[i] = (seg[2 * i + 1] | seg[2 * i + 2]);
	int q;
	int qq, iq, lq, rq;
	char cq;
	scanf("%d", &q);
	for (i = 0; i < q; i++)
	{
		scanf("%d", &qq);
		if (qq == 1)
		{
			scanf("%d %c", &iq, &cq);
			set(iq - 1, v[cq - 'a']);
		}
		else
		{
			scanf("%d %d", &lq, &rq);
			printf("%d\n", count(get(lq - 1, rq - 1)));
		}
	}
	return 0;
}

Measured memory_bytes: 6784
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(
					System.in));
			StringBuilder s=new StringBuilder(); 
			int val = Integer.parseInt(br.readLine());
			int x = 0;

			for (int i = 1; i <= val; i++) {
				if (i % 3 == 0 || i % 10 == 3) {
					s.append(" " + i);
				} else {
					x = i / 10;
					while (x != 0) {
						if (x % 10 == 3) {
							s.append(" " + i);
							break;
						}
						x /= 10;
					}
				}
			}
			System.out.println(s);
			br.close();
		} catch (Exception e) {
			System.err.println(e);
		}
	}
}

Measured memory_bytes: 20736
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    ll n, k;
    cin >> n >> k;
    vector<double> s(n+1,0);
    double ans = 0;
    rep(i,n){
        ll p;
        cin >> p;
        s[i+1] = s[i] + (p+1)/2.0;
    }
    for(int i=k; i<=n; i++){
        ans = max(ans, s[i] - s[i-k]);
    }
    printf("%f\n",ans);
    return 0;
}

Measured memory_bytes: 4784
N = int(input())
S = " " + str(input()) + " "

ans = N+2
prev = ""


black = 0
white = S.count(".")

first_white = white
first_black = N - first_white

for i in range(N+2):
    current = S[i]

    ans = min(ans, black+white)

    if current is ".":
        white -= 1
    elif current is "#":
        black += 1

    prev = current

"""
if ans == N + 1:
    ans = 0
"""

print(min(ans, first_black, first_white))

Measured memory_bytes: 3500
t[999];main(x,n,p,a){for(;scanf("%d%d",&n,t)*n;printf("%d\n",a)){for(p=n;a=p;)scanf("%d",t+p--);for(;p++<*t;n>1?n-=x+t[n-x]:0,a=a|n>1?a:p)scanf("%d",&x);}}

Measured memory_bytes: 0
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdlib>
#include<ctime>
#include<bitset>
#define ll long long
#define rep(i,a,b) for(register int i=a;i<=b;++i)
#define fd(i,a,b) for(register int i=a;i>=b;--i)
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define Abs(a) ((a<0)?-(a):(a))
using namespace std;
namespace io{
	char buf[1<<17],*p1=buf,*p2=buf;
	inline int getc(){
	     return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<17,stdin),p1==p2)?EOF:*p1++;
    }
    template<class T>
    inline void Read(T &x){
        x=0;T f=1;char c;
        for(c=getc();c<'0'||c>'9';f=((c=='-')?-1:f),c=getc());
        for(;c>='0'&&c<='9';x=x*10+(c^48),c=getc());
        x*=f;
    }
    template<class T>
    inline void write(T a){
        if(a==0){putchar('0');return;}
        if(a<0)putchar('-'),a=-a;
        char c1[120];
        int h=0;
        while(a)c1[++h]=a%10+'0',a/=10;
        for(int i=h;i>=1;i--)putchar(c1[i]);
        return;
    }
    template<class T>
    inline void write_(T a){write(a);putchar(' ');}
    template<class T>
    inline void writeln(T a){write(a);putchar('\n');}
}
using namespace io;
template<class T>
inline T gcd(T a,T b){return a==0?b:gcd(b%a,a);}
template<class T>
inline T lcm(T a,T b){return 1ll*a/gcd(a,b)*b;}
/*----------------------------------------------------------------------*/
int cnt, num;

int main(){
    char c;
    c = getc();
    while(c != '\n'){
        ++num;
        if (c == 'o') cnt++;
        c = getc();
    }
    if (cnt  + 15 - num >= 8) puts("YES");
    else puts("NO");
    return 0;
}

Measured memory_bytes: 128
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) x.begin(), x.end()

#define mp make_pair
#define in insert
#define er erase
#define con continue
#define pb push_back
#define sc scanf
#define pr printf
#define ub upper_bound
#define lb lower_bound
#define s second
#define f first
#define int long long

const long long infl = 1e18; 
const int N = 2e5 + 300, N2 = 2e3, inf = 1e9 + 200;

int n;
int t[N], a[N], b[N];

int update(int r, int val){
	for (; r < N; r |= r + 1)	
		t[r] = max(val, t[r]);
}

int get(int r){
	int mx = 0;
	for (; r >= 0; r = (r & (r + 1)) - 1)
		mx = max(mx, t[r]);
	return mx;
}

main (){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	for (int i = 0; i < n; i++){
		cin >> b[i];
	}
	int mx = 0;
	for (int i = 0; i < n; i++){
		int x = get(a[i] - 1);
		update(a[i], b[i] + x);
		mx = max(mx, get(a[i]));
	}
	cout << mx;
	return 0;
}












Measured memory_bytes: 4992
/*
         Md.Fagun Molla
         18ICTCSE006
         BSMRSTU(SHIICT)
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define End return 0

int main () {
    ll n,c=0;
    cin>>n;
    string s;
    cin>>s;
    for(ll i=0; i<n; i++){
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
            c++;
    }
    cout<<c<<endl;
    End;
}
/* pray for me
All is well
*/


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main(void) {

    int R, G, B, N; cin >> R >> G >> B >> N;
    ll ans = 0;
    for (int r = 0; r <= N; ++r) {
        for (int g = 0; g <= N; ++g) {
            int re = N - R*r - G*g;
            if (re % B == 0 && re >= 0) {
                ++ans;
            }
        }
    }
    out(ans);


    return 0;
}









Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007


void solve()
{
	string s,t;
	cin>>s>>t;
	ll a=s.size();
	ll b=t.size();
	if(a<b)
	{
		cout<<"UNRESTORABLE";
		return;
	}
	string ans(a,'z');
	// cout<<ans;
	ll c=0,f=0;
	for(ll i=0;i<a-b+1;i++)
	{
		c=0;
		for(ll j=i;j<i+b;j++)
			if(s[j]!=t[j-i] && s[j]!='?')
			{
				c=1;
				break;
			}
		if(c==0)
		{
			string ans1=s;
			for(ll j=i;j<i+b;j++) 
				ans1[j]=t[j-i];
			
			
			for(ll j=0;j<a;j++)
				if(ans1[j]=='?')
					ans1[j]='a';
				
			ans=min(ans,ans1);
			f=1;
		}
	}
	if(f==0)
		cout<<"UNRESTORABLE";
	else
		cout<<ans;
    return;
}

int main()
{
        fast;
        ll q;
        q=1;
        // cin>>q;
        while(q--)
        	solve();
        
        return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++){
    cin >> a[i];
  }
  for (int i = 0; i < N; i++){
    int j = i;
    while (1){
      if (j == 0){
        break;
      }
      if (a[j] < a[j - 1]){
        swap(a[j], a[j - 1]);
      } else {
        break;
      }
      j--;
    }
    for (int j = 0; j < N; j++){
      cout << a[j];
      if (j < N - 1){
        cout << ' ';
      }
    }
    cout << endl;
  }
}


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

int NdigitsEnd(int n) {
  int a = 1;
  for (int i = 0; i < n; i++) {
    a *= 10;
  }
  return a-1;  
}

int NdigitsBegin(int n) {
  int a = 1;
  if (n == 1) return 0;
  
  for (int i = 1; i < n; i++) {
    a *= 10;
  }
  return a;
}

void assign_deque(deque<int>& d, int n) {
  if (n == 0) {
    d.push_front(0);
  }
  
  while (n > 0) {
    int x = n % 10;
    d.push_front(x);
    n /= 10;
    }
}

int main() { 
  int N, M;
  cin >> N >> M;
  
  pair<int, int> digits_cond[M];

  for (int i = 0; i < M; i++) {
    int s, c;
    cin >> s >> c;
    pair<int, int> p;
    p = make_pair(s-1, c);
    
    digits_cond[i] = p; 
  }
  
  int MIN = NdigitsBegin(N);
  int MAX = NdigitsEnd(N);

  
  for (int i = MIN; i <= MAX; i++) {
    bool cond = true;
    deque<int> dq;
    
    assign_deque(dq, i);
    
    for (int j = 0; j < M; j++) {
      if (dq[digits_cond[j].first] != digits_cond[j].second) {
        cond = false;
        break;
      }
    }
    
    if (cond) {
      cout << i << endl;
      return 0;
    }
    
  }
  cout << -1 << endl;       
           
}

Measured memory_bytes: 256
S=set(list(input()))
n=0
s=0
e=0
w=0
if 'N' in S:
  n=1
if 'S' in S:
  s=1
if 'E' in S:
  e=1
if 'W' in S:
  w=1

if (n^s)|(e^w):
  print('No')
else:
  print('Yes')

Measured memory_bytes: 3064
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

namespace AC
{
   public class shiokara
   {
      static void Main(string[] args)
      {
         int n = int.Parse(ReadLine());
         List<string> list = new List<string>();
         for(int i = 0; i < n; i++){
             list.Add(ReadLine());
         }

         list = list.Distinct().ToList();
         WriteLine(list.Count());

      }
   }
}

Measured memory_bytes: 49496
#include<bits/stdc++.h>
#define register rg
#define int long long
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
using namespace std;
typedef long long ll;
char s[100010];
int vis[110],a[100010];
int f[110][110];//到i为止选了多少个的方案数
const int mod =1e9+7;
main() {
	//file("a");
	int n,tot=0,ans=0;
	cin>>n;
	scanf("%s",s);
	for(int i=0; i<n; i++)
		vis[s[i]-'a']++;
	for(int i=0; i<='z'-'a'; i++)
		if(vis[i])
			a[++tot]=vis[i];
	//f[1][1]=vis[1];
	f[0][0]=1;
	for(int i=1; i<=tot; i++)
		for(int j=0; j<=i; j++) {
			if(j==0)
				f[i][j]=f[i-1][j]%mod;
			else if(j!=i)
				f[i][j]=(f[i-1][j]+f[i-1][j-1]*a[i])%mod;
			else
				f[i][j]=(f[i-1][j-1]*a[i])%mod;
		}
	for(int i=1; i<=tot; i++)
		ans+=f[tot][i],ans%=mod;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T> inline vector<T> readVector(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> void EXIT(T answer) { cout<<answer<<endl; exit(0); }
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef signed long long int ll;

int A[305][305];
const int INF = 1e9+5;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    int n,m,l;
    cin>>n>>m>>l;

    FOR(i,n) FOR(j,n)
        A[i][j] = INF;

    FOR(i,m) {
        int a,b,c; cin>>a>>b>>c;
        a--; b--;
        A[a][b] |= MIN(c);
        A[b][a] |= MIN(c);
    }

    FOR(i,n) A[i][i]=0;

    FOR(k,n) FOR(i,n) FOR(j,n)
        A[i][j] |= MIN( A[i][k] + A[k][j]);

    FOR(i,n) FOR(j,n)
        A[i][j] = (A[i][j]<=l) ? 0 : INF;

    FOR(k,n) FOR(i,n) FOR(j,n)
        A[i][j] |= MIN( A[i][k] + A[k][j] + 1);

    int Q; cin>>Q;
    while(Q--) {
        int s, t; cin>>s>>t;
        s--; t--;
        int ans=A[s][t];
        cout<<(ans==INF ? -1 : ans)<<endl;
    }
    return 0;
}



Measured memory_bytes: 896
//カタラン数を語らん!w

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*2
#define REP(a,b) for(long long a = 0;a < b;++a)
int h, w, k;
int grid[31][31];
int memo[31][31];
int cnt[31][31];
int solve() {
	int ans = 0;
	for (int q = 0; q < 40; ++q) {
		int addition = 0;
		int itr[31] = {};
		for (int i = 0; i < h; ++i) {
			for (int q = 0; q < w; ++q) {
				if (grid[i][q] != 0) {
					grid[itr[q]][q] = grid[i][q];
					itr[q]++;
				}
			}
		}
		for (int q = 0; q < w; ++q) {
			for (int i = itr[q]; i < h; ++i) {
				grid[i][q] = 0;
			}
		}
		for (int i = 0; i < h; ++i) {
			cnt[i][0] = 1;
			for (int q = 1; q < w; ++q) {
				if (grid[i][q - 1] == grid[i][q]) {
					cnt[i][q] = cnt[i][q - 1] + 1;
				}
				else {
					cnt[i][q] = 1;
				}
			}
			for (int q = w - 2; q >= 0; --q) {
				if (grid[i][q] == grid[i][q + 1]) {
					cnt[i][q] = cnt[i][q + 1];
				}
			}
			for (int j = 0; j < w; ++j) {
				if (cnt[i][j] >= k) {
					ans += (1 << q) * grid[i][j];
					addition += (1 << q) * grid[i][j];
					grid[i][j] = 0;
				}
			}
		}
		if (addition == 0) break;
	}
	return ans;
}
int main() {
	cin >> h >> w >> k;
	REP(i, h) {
		string s;
		cin >> s;
		REP(q, w) {
			memo[h - i - 1][q] = s[q] - '0';
		}
	}
	int ans = 0;
	REP(i, h) {
		REP(q, w) {
			REP(j, h) {
				REP(t, w) {
					grid[j][t] = memo[j][t];
				}
			}
			grid[i][q] = 0;
			ans = max(ans, solve());
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Program{
  public static void Main(){
    int[] nm = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
    int n = nm[0];
    int m = nm[1];
    int[] a_array = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
    Array.Sort(a_array);
    Array.Reverse(a_array);
    
    int sumA = 0;
    foreach(int a in a_array){
      sumA += a;
    }
    
    if (a_array[m-1] * (4*m) >= sumA){
      Console.WriteLine("Yes");
    }
    else{
      Console.WriteLine("No");
    }
  }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int n,tot;
ll k,a[N],b[N];
int vis[N];
bool judge(ll m)
{
    ll p=k;
    for(int i=n;i>=1;i--)
    {
        ll t=m/b[i];
        if(a[i]>t) p-=a[i]-t;
        if(p<0) return false;
    }
    return true;
}
int main()
{
    scanf("%d%lld",&n,&k);
    for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
    for(int i=1;i<=n;i++) scanf("%lld",&b[i]);
    sort(a+1,a+1+n);
    sort(b+1,b+1+n);
    reverse(b+1,b+1+n);
    ll l=0,r=1e18,ans;
    while(l<=r)
    {
        ll m=l+r>>1;
        if(judge(m)) ans=m,r=m-1;
        else l=m+1;
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 3328
/*
 * Contents   : AGC025 A
 * Author     : KitauraHiromi
 * LastUpdate : 20180603
 * Since      : 20180603
 */
#include <iostream>
using namespace std;
int digit_sum(int x){
    int ret = 0;
    ret += x / 100000; x %= 100000;
    ret += x / 10000; x %= 10000;
    ret += x / 1000; x %= 1000;
    ret += x / 100; x %= 100;
    ret += x / 10; x %= 10;
    ret += x;
    return ret;
}

int main(void){
    int N, ret;
    cin >> N;
    ret = 1000000007;
    for(int A=1; A<N; ++A){
        int B = N - A;
        // cout << A << ' ' << digit_sum(A) << ' ' << B << ' ' << digit_sum(B) << endl;
        ret = min(ret, digit_sum(A) + digit_sum(B));
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        int A = Integer.parseInt(line[0]);
        int B = Integer.parseInt(line[1]);
        System.out.println(A+B>9?"error":A+B);
	}
}


Measured memory_bytes: 21204
#include<stdio.h>

int IsPrime(int);

main(){

  int N[10000],n,i,count = 0;
  
  scanf("%d",&n);

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

    if(IsPrime(N[i]) == 1){
      count++;
    }
  }

  printf("%d\n",count); 
  return 0;

}

int IsPrime(int n){ // return 1 素数
  
  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;

}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <stack>
using namespace std;

int N, M;
int ans = 0;
int p[100];
vector<set<int>> signals;

void setsignal(stack<int> s)
{
    if (s.size() == N)
    {
        stack<int> temps = s;

        int check[N];
        bool flag = true;
        for (int i = 0; i < N; i++)
        {
            check[i] = temps.top();
            temps.pop();
        }
        for (int i = 0; i < M; i++)
        {
            set<int> st = signals[i];
            int sum = 0;
            for (auto itr = st.begin(); itr != st.end(); ++itr)
            {
                sum += check[*itr];
            }
            if (sum % 2 != p[i])
            {
                flag = false;
                break;
            }
        }
        if (flag)
        {
            ans++;
        }
    }
    else
    {
        /* code */

        s.push(0);
        setsignal(s);
        s.pop();

        s.push(1);
        setsignal(s);
        s.pop();
    }
}

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

    cin >> N >> M;

    for (int i = 0; i < M; i++)
    {
        set<int> st;
        int k;
        cin >> k;
        for (int j = 0; j < k; j++)
        {
            int temp;
            cin >> temp;
            st.insert(temp - 1);
        }
        signals.push_back(st);
    }
    for (int i = 0; i < M; i++)
    {
        int temp;
        cin >> temp;
        p[i] = temp;
    }

    stack<int> s;
    setsignal(s);

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
#include <string>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end());
#define fill(a,x) memset(a,x,sizeof(a))
#define zero(a) fill(a,0)
#define minus(a) fill(a,-1)
#define dbg(x) cout << #x"=" << x << endl

const int INF=INT_MAX/3;
const int LIMIT=100;

int dx[]={0,-1,0,1};
int dy[]={1,0,-1,0};

int a,b,c,d;
int n[4];
string s,ans;

void dfs(int sum, int i, string formula){
    string temp;
    if(i==4){
        if(sum==7){
            temp="=7";
            ans=formula+temp;
            return ;
        }else{
            return ;
        }
    }
    temp = "+" + string(1,s[i]);
    dfs(sum+n[i],i+1,formula+temp);
    temp = "-" + string(1,s[i]);
    dfs(sum-n[i],i+1,formula+temp);
}

int main(){
    cin>>s;
    rep(i,4)n[i]=s[i]-'0';
    string temp = string(1,s[0]);
    dfs(n[0],1, temp);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans = Math.max(a + b, Math.max(a - b, a * b));
		System.out.println(ans);

	}

}


Measured memory_bytes: 21844
n = int(input())
a = list(map(int, input().strip().split()))

a.sort()

min = a[-1]/2
r = a[0]
for item in a[:-1]:
    if abs(item - a[-1]/2) < min:
        min = abs(item - a[-1]/2)
        r = item
print(a[-1], r)

Measured memory_bytes: 14428
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S, T;
  cin >> S >> T;
  if(T.length() == S.length()+1 && S == T.substr(0,S.length())){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e10
using namespace std;
typedef pair<ll, ll> P;

bool prime[100010];
void furui() {
	prime[1] = true;
	int i = 2;
	while (i <= 100000) {
		int j = 2;
		while (j <= sqrt(i) && !prime[i]) {
			if (i%j == 0) {
				prime[i] = true;
				break;
			}
			else j++;
		}
		int z = 2;
		while (!prime[i]) {
			if (i*z <= 100000) {
				prime[i*z] = true;
				z++;
			}
			else break;
		}
		i++;
	}
}

bool odd[100010];
ll num[100010];

int main(void) {
	ll q;
	cin >> q;
	furui();
	for (ll i = 1;i <= 100000;i++) {
		odd[i] = false;
	}
	for (ll i = 1;i <= 100000;i++) {
		if ((i % 2 == 1) && (!prime[i]) && (!prime[(i + 1)/2])) {
			odd[i] = true;
		}
	}
	num[0] = 0;
	for (ll i = 1;i <= 100000;i++) {
		if (odd[i])num[i] = num[i - 1] + 1;
		else num[i] = num[i - 1];
	}
	ll l, r;
	for (ll i = 0;i < q;i++) {
		cin >> l >> r;
		cout << num[r] - num[l - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
typedef int64_t ll;

int main() {
    string S, T;
    cin >> S >> T;
    for (int i = 0; i < S.size(); i++){
        if (S.at(i) != T.at(i)){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<string.h>
#include<cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ll long long
using namespace std;


int main()
{
    int a[3], b[3], c[3][3];
    string ans = "No";
    rep(i, 3) rep(j, 3) cin >> c[i][j];
    rep(i, c[0][0] + 1)
    {
        a[0] = i;
        b[0] = c[0][0] - i;
        rep(j, c[1][1] + 1)
        {
            a[1] = j;
            b[1] = c[1][1] - j;
            rep(k, c[2][2] + 1)
            {
                a[2] = k;
                b[2] = c[2][2] - k;
                if (a[0] + b[1] == c[0][1] &&
                    a[0] + b[2] == c[0][2] &&
                    a[1] + b[0] == c[1][0] &&
                    a[1] + b[2] == c[1][2] &&
                    a[2] + b[0] == c[2][0] &&
                    a[2] + b[1] == c[2][1])
                {
                    ans = "Yes";
                }
            }
        }
    }
    cout << ans << endl;
}


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

using namespace std;

int main(){
    int n,m;
    while(cin>>n>>m,n){
        vector<int>h(n),w(m);
        for(int i=0;i<n;++i){
            cin>>h[i];
        }
        for(int i=0;i<m;++i){
            cin>>w[i];
        }
        vector<int>comb1(1500001,0);
        long long ans=0;
        for(int i=0;i<n;++i){
            for(int j=i;j<n;++j){
                int buf=0;
                for(int k=i;k<=j;++k){
                    buf+=h[k];
                }
                comb1[buf]++;
            }
        }
        for(int i=0;i<m;++i){
            for(int j=i;j<m;++j){
                int buf=0;
                for(int k=i;k<=j;++k){
                    buf+=w[k];
                }
                ans+=comb1[buf];
            }
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 8964
#include <stdio.h>

int main(void)
{
    int x = 100000;
    int i, n;

    scanf("%d", &n);

    for(i=0; i<n; i++) {
        x *= 1.05;
        if(x%1000) {
            x = (x/1000 + 1) * 1000;
        }
    }

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

    return (0);
}

Measured memory_bytes: 592
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
#include<set>

using namespace std;
const int INF = 100;

int main() {
    int x, n;
    cin >> x >> n;
    if (n == 0)
    {
        cout << x << endl;
        return 0;
    }
    int ans = INF;
    set<int> p;
    int r, l;
    l = x;
    r = x;
    for (int i = 0; i < n; i++)
    {
        int inp;
        cin >> inp;
        p.insert(inp);
    }
    while (p.find(l) != p.end())
    {
        l--;
    }
    while (p.find(r) != p.end())
    {
        r++;
    }
    if(x-l==r-x)
    {
        cout << l << endl;
        return 0;
    }
    if (x - l > r - x)
    {
        ans = r;
    }
    else
    {
        ans = l;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
#include <random>
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (ll)(4e18) + 9;
const int MOD = (int)(1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { D, R, U, L , dr, ur, dl, ul };
int dx[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiouy"; //and sometimes "aeiouy"

template<typename X, typename Y> bool ckmin(X& a, Y b) { return a > b ? a = b, true : false; }
template<typename X, typename Y> bool ckmax(X& a, Y b) { return a < b ? a = b, true : false; }
bool cklex(string &a, string b) {
	if (b == "") return false;
	if (a == "") return a = b, true;
	if (sz(a) < sz(b)) return false;
	if (sz(b) < sz(a)) return a = b, true;
	if (a < b) return false;
	return a = b, true;
}

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int conv_2_1(int r, int c, int nCol) { return (nCol*r) + c + 1; } //convert index from 2D array to 1D array. (Zero-indexed)
ii conv_1_2(int n, int nCol) { return{ n / nCol, n % nCol }; } //convert index from 1D array to 2D array (row, col). (Zero-indexed)
template<typename T> void inter(T X) { cout << X << endl; fflush(stdout); }


ll dp[2010];
ll solve(int rem) {
	if (not rem) return 1;
	ll& ret = dp[rem];
	if (~ret) return ret;
	ret = 0;
	for (int i = 3; i <= rem; i++) {
		ret = (ret + solve(rem - i)%MOD)%MOD;
	}
	return ret;
}

void _solve_() {
	int sum;
	cin >> sum;
	mem(dp, -1);
	cout << solve(sum) << endl;
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int t = 1, tt = 0;
	//cin >> t;
	while (tt++ != t) {
		_solve_();
	}


	return 0;
}


Measured memory_bytes: 3684
#include<iostream>
#include<cstring>
#include<climits>
#include<cmath>
#include<algorithm>

using namespace std;
#define pie 3.141592653558
#define lli long long int
int main()
{
    int r;
    double circ;
    cin>>r;

    r*=2;
    circ = (double)(pie*r);
    cout<<circ;
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3732
#include <stdio.h>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
	string S;
  	cin >> S;
  	string ans;
  	if(S == "Sunny") ans = "Cloudy";
  	else if(S == "Cloudy") ans = "Rainy";
  	else ans = "Sunny";
  	cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
n = int(input())
t = [0] * (n+1)
x = [0] * (n+1)
y = [0] * (n+1)

for i in range(1,n+1):
    t[i], x[i], y[i] = map(int, input().split())

for i in range(n):
    length = abs((x[i+1]-x[i])+(y[i+1]-y[i]))
    move = t[i+1]-t[i]
    if move < length:
        print('No')
        sys.exit()
    if (move - length)%2==1:
        print('No')
        sys.exit()
print('Yes')


Measured memory_bytes: 11636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ALDS1_11_A
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = ReadInt();
            int[,] res = new int[n,n];

            for (int i = 0 ; i < n ; i++)
            {
                int[] line = ReadIntAr();
                for (int j = 0 ; j < line[1] ; j++)
                {
                    res[i, line[j+2]-1] = 1;
                }
            }

            for (int i = 0 ; i < n ; i++)
            {
                for (int j = 0 ; j < n ; j++)
                {
                    if (j >0) Console.Write(" ");
                    Console.Write(res[i, j]);
                }
                Console.Write(Environment.NewLine);
            }
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 17956
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define int long long
#define double long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define inf 1000000000 // 1e9
#define M   1000000007 // 1e9 + 7
using namespace std;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}
main(){
    fastio;
    int n,l;
	cin >> n >> l;
	int k = 0;
	int ans = 0;
	int dist = inf;
	for(int i=1;i<=n;i++){
		k+=l + i - 1;
	}
	
	for(int i=1;i<=n;i++){

		if(abs(l + i - 1) < dist){
			dist = abs((l+i-1));
			ans = i;
		} 
	}
    cout << k - (l+ans-1) << endl;
}


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

typedef long long readtype;
typedef long long var;
typedef long double let;

readtype read() {
  readtype a = 0, c = getchar(), s = 0;
  while (!isdigit(c)) s |= c == '-', c = getchar();
  while (isdigit(c)) a = a * 10 + c - 48, c = getchar();
  return s ? -a : a;
}

#ifdef LOCAL_LOGGER
#define logger(...) fprintf(stderr, __VA_ARGS__)
#define abortif(v, ...) if (v) {logger("Error in Line %d, Function '%s()'.\nInfo: ", __LINE__, __FUNCTION__); logger(__VA_ARGS__); exit(0);}
#else
#define logger(...);
#define abortif(v, ...);
#endif
/* }}} */

const let EPS = 1e-8;

int sign(let x) { return (x > EPS) ? 1 : (x < -EPS) ? -1 : 0; }
bool equal(let a, let b) { return sign(a - b) == 0; }

struct Point {
  let x, y;
  friend Point operator - (Point a, Point b) {
    return (Point) {a.x - b.x, a.y - b.y};
  }
  Point operator * (let k) { return (Point) {x * k, y * k}; }
  friend let Times(Point a, Point b) {
    return a.x * b.y - a.y * b.x;
  }
  friend bool operator == (Point a, Point b) {
    return equal(a.x, b.x) && equal(a.y, b.y);
  }

  let Dist() {
    return sqrt(x * x + y * y);
  }
};

typedef Point Vec;

int main() {
// #ifndef ONLINE_JUDGE
//   freopen("CGL_1_3.in", "r", stdin);
//   freopen("CGL_1_3.out", "w", stdout);
// #endif
// #ifdef LOCAL_LOGGER
//   freopen("CGL_1_3.log", "w", stderr);
// #endif

  let xp0 = read(), yp0 = read(), xp1 = read(), yp1 = read();
  Point p0 = (Point) {xp0, yp0}, p1 = (Point) {xp1, yp1};
  Vec v1 = p1 - p0;

  int q = read();
  while (q--) {
    let xp2 = read(), yp2 = read();
    Point p2 = (Point) {xp2, yp2};
    Vec v2 = p2 - p0;
    int vsign = sign(Times(v1, v2));
    if (vsign > 0) puts("COUNTER_CLOCKWISE");
    else if (vsign < 0) puts("CLOCKWISE");
    else {
      if (sign(v1.x) == sign(-v2.x) && sign(v1.y) == sign(-v2.y))
        puts("ONLINE_BACK");
      else if (v1.Dist() < v2.Dist()) puts("ONLINE_FRONT");
      else puts("ON_SEGMENT");
    }
  }
  return 0;
}

/* ==== Makefile ==== {{{
CompileAndRun:
	make Compile
	make Run

Compile:
	g++ -o CGL_1_3 CGL_1_3.cpp -g -Wall -DLOCAL_LOGGER

CompileUF:
	g++ -o CGL_1_3 CGL_1_3.cpp -g -Wall -DLOCAL_LOGGER -fsanitize=undefined

Run:
	./CGL_1_3 < CGL_1_3.in > CGL_1_3.out
==================
}}} */



Measured memory_bytes: 3104
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var ABK = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (A, B, K) = (ABK[0], ABK[1], ABK[2]);

        var gcd = GcdLcm.Gcd(A, B);
        var d = Divisor.GetDivisors(gcd).OrderByDescending(x => x).ToArray();
        var ans = d[K - 1];

        WriteLine(ans);
    }
}
static class GcdLcm
{
    public static long Gcd(long a, long b) => (b != 0) ? Gcd(b, a % b) : a;
    public static long Lcm(long a, long b) => a / Gcd(a, b) * b;
}

static class Divisor
{
    public static IEnumerable<long> GetDivisors(long x)
    {
        var oppositeDivisors = new List<long>();

        for (long i = 1; i * i <= x; i++)
        {
            if (x % i == 0)
            {
                yield return i;
                if (x / i != i)
                    oppositeDivisors.Add(x / i);
            }
        }

        for (int i = oppositeDivisors.Count - 1; i >= 0; i--)
            yield return oppositeDivisors[i];
    }
}


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

#define vi vector<int>
#define ll long long int

int main() {

    int N;
    cin >> N;
    string S;
    cin >> S;

    int ans = 1;
    for (int i = 0; i < N-1; i++) {
        if (S[i] != S[i+1]) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
mod =  1000000007
ret = [-1] * (N+1)
ret[0] = 1
for i in a:
    ret[i] = 0

for i in range(1,N+1):
    if ret[i] == 0:
        continue
    elif i == 1:
        ret[1] = 1
    else:
        ret[i] = ret[i-2] + ret[i-1]

print(ret[len(ret)-1]%mod)


Measured memory_bytes: 460020
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int X, Y, A, B, C;
	cin >> X >> Y >> A >> B >> C;

	vector<lint> a(A);
	vector<lint> b(B);
	vector<lint> c(C);

	vector<lint> V(min(A, X) + min(B, Y) + C);

	for (int i = 0; i < A; i++)
	{
		cin >> a[i];
	}
	for (int i = 0; i < B; i++)
	{
		cin >> b[i];
	}
	for (int i = 0; i < C; i++)
	{
		cin >> c[i];
		V[i] = c[i];
	}
	sort(all(a), greater<lint>());
	sort(all(b), greater<lint>());
	sort(all(c), greater<lint>());

	for (int i = 0; i < min(A, X); i++)
	{
		V[i + C] = a[i];
	}

	for (int i = 0; i < min(B, Y); i++)
	{
		V[i + min(A, X) + C] = b[i];
	}
	sort(all(V), greater<lint>());
	lint ans = 0;

	for (int i = 0; i < X + Y; i++)
	{
		ans += V[i];
	}
	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
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; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


int main(){
    int n, k, s;
    cin >> n >> k >> s;
    rep(i, k) cout << s << " ";
    if(s == 1) s = 100;
    rep(i, n-k) cout << s-1 << " ";
    cout << endl;
}

Measured memory_bytes: 1280
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <iomanip> 
#include <stdio.h>
//end of libraries ;
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// ll lmax(ll o , ll w) {if(o>w)return o; return w;}
// ll lmin(ll o , ll w) {if(o<w)return o; return w;}
#define LNF 3999999999999999999
#define INF 999999999
#define N 3000003
#define PI 3.14159265359
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define ll long long
#define all(c) (c).begin(),(c).end()
#define sz(c) (c).size()
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
int n , w , r , ans , R[N] , L[N] ;
string s;
int main(){
fcin;
    cin >> n ;
    cin >> s;
    for(int i = 0 ; i < sz(s) ; i++){
        if(s[i]=='W') w++;
        else r++;
    }
    ans = min(w,r);
    for(int i = sz(s) - 1 ; i >= 0 ; i--){
        if(s[i]=='R') R[i] = R[i+1] + 1;
        else R[i] = R[i+1];
    }
    for(int i = 0 ; i < sz(s) ; i++){
        if(s[i]=='W') L[i] = L[i-1] + 1;
        else L[i] = L[i-1];
    }
    for(int i = 0 ; i < sz(s) - 1 ; i++){
        ans = min(ans , max(R[i+1],L[i]));
    }
    cout << ans << '\n';
    /*

    RRWRWRWRWWWWRRRWWWWW
    WRRWWRRRWWWWWWRRWWWW

    */

}

Measured memory_bytes: 4840
N = int(input())
D = [input() for j in range(N)]
a = D.count("AC")
w = D.count("WA")
t = D.count("TLE")
r = D.count("RE")
print("AC x "+str(a))
print("WA x "+str(w))
print("TLE x "+str(t))
print("RE x "+str(r))


Measured memory_bytes: 16296
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a = I()
b = I()
c = I()
d = I()
e = I()
k = I()
if e - a > k:
    print(':(')
else:
    print('Yay!')

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

#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
using intmap = map<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
const int MOD = 1e9 + 7;
inline int mod(ll a, int m = MOD) { return (a % m + m) % m; }
inline bool bit(ll b, ll i) { return b & (1 << i); }
inline ll ceiv(ll a, ll b) { return (a + b - 1) / b; }
// struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define debug(x) cerr << #x << ": " << x << '\n'
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()

signed main(){
    int x, k, d;
    cin >> x >> k >> d;
    
    if(x < 0) x = -x;
    
    int tmp = min(x/d, k);
    x -= tmp * d;
    k -= tmp;
    
    cout << (k % 2 ? -(x - d) : x) << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <cmath>
#include <ctime>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main(){
    int N, M;
    string s[110], t[110];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> s[i];
    }
    cin >> M;
    for(int i = 0; i < M; i++){
        cin >> t[i];
    }

    string ans;
    int total[110] = {0};

    for(int i = 0; i < N; i++){
        ans = s[i];
        for(int j = 0; j < N; j++){
            if(s[j] == ans) total[i]++;
        }
        for(int j = 0; j < M; j++){
            if(t[j] == ans) total[i]--;
        }
        
        
    }

    int max = total[0];
    for(int i = 0; i < N; i++){
        if(max < total[i]) max = total[i];
    
    }

    if(max < 0) max = 0;

    cout << max << endl;

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(int (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
const ll MOD=1e9+7;
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> v(N),c(N),a(N);
  rep(i,N){
    cin >> v[i];
  }
  rep(i,N){
    cin >> c[i];
  }
  rep(i,N){
    a[i] = v[i] - c[i];
  }
  sort(All(a));
  int ans = 0,i=N-1;
  while(1){
    if(a[i]>0){
      ans += a[i];
      i--;
    }else{
      break;
    }
  }
  cout << ans << endl;
}


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

using namespace std;

int n, m, p;
vector<tuple<int, int, int>> edges;
vector<int> graph[2500];
vector<int> reverse_graph[2500];

bool can_reach_rev[2500];
bool can_reach[2500];

int coins[2500];

void dfs(int u) {
  if (can_reach[u]) {
    return;
  }
  can_reach[u] = true;
  for (int v : graph[u]) {
    dfs(v);
  }
}

void reverse_dfs(int u) {
  if (can_reach_rev[u]) {
    return;
  }
  can_reach_rev[u] = true;
  for (int v : reverse_graph[u]) {
    reverse_dfs(v);
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> p;

  for (int i = 0; i < n; i++) {
    coins[i] = INT_MIN/2;
  }

  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    c -= p;
    a -= 1;
    b -= 1;
    graph[a].emplace_back(b);
    reverse_graph[b].emplace_back(a);
    edges.emplace_back(a, b, c);
  }
  dfs(0);
  reverse_dfs(n - 1);

  coins[0] = 0;
  for (int i = 0; i < n; i++) {
    for (auto t : edges) {
      int u, v, c;
      tie(u, v, c) = t;
      if (can_reach[u] && can_reach_rev[v]) {
        if (coins[u] + c > coins[v]) {
          coins[v] = coins[u] + c;
        }
      }
    }
  }
  for (auto t : edges) {
    int u, v, c;
    tie(u, v, c) = t;
    if (can_reach[u] && can_reach_rev[v]) {
      if (coins[u] + c > coins[v]) {
        printf("-1\n");
        return 0;
      }
    }
  }
  printf("%d\n", max(coins[n - 1], 0));
}

Measured memory_bytes: 768