akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC117
{
    static class Streamline
    {
        static void Main(string[] args)
        {
            int[] nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ans;
            if (nm[0] >= nm[1]) { ans = 0; }
            else
            {
                int[] dif = new int[nm[1] - 1];
                Array.Sort(x);
                for (int i = 0; i < nm[1] - 1; i++)
                {
                    dif[i] = x[i + 1] - x[i];
                }
                int sum = x.Max() - x.Min();
                Array.Sort(dif);
                int difMs = 0;
                for (int i = 0; i < nm[0] - 1; i++)
                {
                    difMs += dif[nm[1] - 2 - i];
                }
                ans = sum - difMs;
            }
            Console.WriteLine(ans);
        }
    }
}


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

int main() {
  int N,K;
  cin>>N>>K;
  int x;
 x=1;
  for (int i = 0; i < N; i++) {
    
  if(2*x>=x+K){x+=K;}
    else{x*=2;}
}
cout << x << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
	string s;
	cin>>s;
	for(int i=0;i<5;i++)cout<<s[i];
	cout<<" ";
	for(int i=6;i<13;i++)cout<<s[i];
	cout<<" ";
	for(int i=14;i<19;i++)cout<<s[i];
	cout<<endl;
	return 0;
}


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

int main()
{
	int64_t s;
	cin >> s;

	int64_t mod = 1000000007;

	vector<vector<int64_t>> dp(s / 3 + 1, vector<int64_t>(s + 1, 0));
	dp[0][0] = 1;
	for (int64_t i = 0; i < s / 3; i++)
	{
		vector<int64_t> d(s + 1, 0);

		for (int64_t j = 0; j <= s; j++)
		{
			if (j + 3 <= s)
			{
				(d[j + 3] += dp[i][j]) %= mod;
			}
		}

		for (int64_t j = 0, tmp = 0; j <= s; j++)
		{
			(tmp += d[j]) %= mod;
			(dp[i + 1][j] += tmp) %= mod;
		}
	}

	int64_t ans = 0;
	for (int64_t i = 1; i <= s / 3; i++)
	{
		(ans += dp[i][s]) %= mod;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 13756
#include<iostream>
#include<string>
using namespace std;
int main(){
  
  string str;
  int sum=0;

  cin >> str;
  for(int i=0;i<str.size();i++){
    if(sum%2==0 && str[i]=='A') sum++;
    if(sum%2==1 && str[i]=='Z') sum++;
  }

  if(sum <= 1) cout << -1;
  while(sum > 1){
    cout << "AZ";
    sum -= 2;
  }
  
  cout << endl;
   return (0);
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, t=0;
  cin >> N;
  vector<int> A(N);
  REP(i,N) cin >> A[i];
  int no_1=0, no_2=0;
  REP(i,N) {
    if(A[i]>no_1) {
      no_1=A[i];
      t=i;
    }
    else {
      if(no_2<A[i] && A[i] <= no_1) no_2=A[i];
    }
  }
  REP(i,N) {
    if(i!=t) cout << no_1 << endl;
    else  cout << no_2 << endl;
  }
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Num 1000000007
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

LL int find(LL int x, LL int y)
{
    LL int ans = INT_MAX;
    rep(i, x)
    {
        vector<long long int > a(3);
        a[0] = i * y;
        LL int div = y / 2;
        a[1] = (x - i) * div;
        a[2] = (x - i) * (y - div);
        SORT(a);
        if (DEBUG)
            cout << a[0] << " " << a[1] << " " << a[2] << endl;
        ans = min(ans, a[2] - a[0]);
        div = (x - i) / 2;
        a[0] = i * y;
        a[1] = y * div;
        a[2] = y * (x - i - div);
        SORT(a);
        if (DEBUG)
            cout << a[0] << " " << a[1] << " " << a[2] << endl;
        ans = min(ans, a[2] - a[0]);
    }
    return ans;
}
int main()
{
    LL int h, w;
    cin >> h >> w;
    cout << min(find(h, w), find(w, h)) << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            long[] s = ReadLine().Split(' ').Select(long.Parse).ToArray();
            long[] tmp = new long[n+1];
            tmp[0] = 0;
            for (int i = 0; i < n; i++)
            {
                tmp[i+1] = s[i]+ tmp[i];
            }
            Array.Sort(tmp);
            var Dic = new Dictionary<long, long>();
            for (int i = 0; i < n+1; i++)
            {
                try
                {
                    Dic.Add(tmp[i], 1);
                }
                catch (Exception)
                {
                    Dic[tmp[i]]++;
                }
            }

            long ans = 0;
            foreach (var item in Dic)
            {
                if (item.Value >=2)
                {
                    ans += Combination(item.Value, 2);
                }
            }
            WriteLine(ans);
        }

        static long Combination(long n, long r)
        {
            if (n < r) return -1;
            long ans = 1;
            for (long i = n; i > n - r; i--)
            {
                ans *= i;
            }
            for (long i = 2; i <= r; i++)
            {
                ans /= i;
            }
            return ans;
        }
    }

}


Measured memory_bytes: 43960
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <utility>
#include <algorithm>
using namespace std;

int main(void){
    string s;
    cin>>s;
    
    bool bb=true;
    
    if(s[0]!='A'){
        bb=false;
    }
    
    int cnt=0;
    for(int i=2; i<s.size()-1; i++){
        if(s[i]=='C'){
            cnt++;
        }
        
        if(cnt>1){
            bb=false;
            break;
        }
    }
    if(cnt==0){
        bb=false;
    }
    
    for(int i=0; i<s.size(); i++){
        if(s[i]>='D'&&s[i]<='Z'){
            bb=false;
            break;
        }
        if(s[i]=='B'){
            bb=false;
            break;
        }
    }
    
    cout<<(bb?"AC":"WA")<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
    static void Main(string[] args){
    var N = int.Parse(Console.ReadLine());
    var vals = Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
    int ans=vals.Sum()-vals.Count();
    Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13436
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>	
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>	
#include <algorithm>
#include <functional> 
#include <iomanip>
#include <unordered_map>
#include <fstream>
#include <cstdio>
#include <memory.h>

using namespace std;

int main(void)
{
	int n, a;
	cin >> n;
	cin >> a;
	n %= 500;
	if (n <= a)
	{
		cout << "Yes" << '\n';
	}
	else
	{
		cout << "No" << '\n';
	}

	return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}

int main(){
    int N; cin >> N;
    vector<int> a(N); REP(i, N) cin >> a[i];

    sort(all(a));

    int alice = 0;
    int bob = 0;
    for(int i = N; i > 0; --i) {
        if(i % 2 == 0) alice += a[i - 1];
        if(i % 2 == 1) bob += a[i - 1];
    }

    cout << abs(alice - bob) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
#include <sstream>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

 
int main() {
    ll ans = 0;
    ll n;

    cin >> n;

    for (int i = 1; i <= n; i++) {
        if (((ll)log10(i)) % 2 == 0) ans++;
    }
    
    cout << ans << endl;
}

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

int main(){
    int N, M;

    cin >> N >> M;

    if(N < M){
        for(int i = 0; i < M; ++i ){
            cout << N;
        }
        cout << endl;
    }else{
        for(int i = 0; i < N; ++i ){
            cout << M;
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
XYP = [tuple(map(int, input().split())) for i in range(n)]
X = [x for x, y, p in XYP]
Y = [y for x, y, p in XYP]
P = [p for x, y, p in XYP]
pow2 = [2**i for i in range(n + 1)]

DX = [[0] * n for s in range(pow2[n])]
DY = [[0] * n for s in range(pow2[n])]
for s in range(1 << n):
    for i in range(n):
        DX[s][i] = abs(X[i]) * P[i]
        DY[s][i] = abs(Y[i]) * P[i]
        for j in range(n):
            if s & (1 << j):
                DX[s][i] = min(DX[s][i], abs(X[i] - X[j]) * P[i])
                DY[s][i] = min(DY[s][i], abs(Y[i] - Y[j]) * P[i])

BC = [bin(s).count("1") for s in range(pow2[n])]

A = [10**20] * (n + 1)
for sx in range(pow2[n]):
    rx = (pow2[n] - 1) ^ sx
    sy = rx
    for _ in range(pow2[n - BC[sx]]):
        sy = (sy - 1) & rx
        d = 0
        for i in range(n):
            d += min(DX[sx][i], DY[sy][i])
        c = BC[sx] + BC[sy]
        A[c] = min(A[c], d)
print(*A, sep="\n")


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

using namespace std;

int main() {
	int n;
	ios::sync_with_stdio(0);
	cin >> n;
	string s;
	cin >> s;
	char c = s[0];
	int ans = 1;
	for(int i = 1 ; i < n ; i++) {
		if(s[i] != c) {
			c = s[i];
			ans++;
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include <map>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include"time.h"
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define dump(x)  cerr << #x << " = " << (x) << endl
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
const int INF = (1 << 30);

//毎回変える場所
#define N_MAX 200
#define INF 9999999999

//問題文のとおり
int N;
vector<vector<LL>> abc;

int main() {
	//入力とソート
	cin >> N;
	REP(i, 3) {
		abc.push_back(vector<LL>());
		REP(j, N) {
			LL tmp;
			cin >> tmp;
			abc[i].push_back(tmp);
		}
		sort(abc[i].begin(), abc[i].end());
	}

	//計算
	LL ans = 0;
	REP(i, N) {
		LL centerLen = abc[1][i];

		LL upNum = lower_bound(abc[0].begin(), abc[0].end(), centerLen) - abc[0].begin();
		LL downNum = upper_bound(abc[2].begin(), abc[2].end(), centerLen) - abc[2].begin();

		ans += upNum*(N - downNum);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3316
using System;
using System.Collections;
using System.Collections.Generic;

using System.Linq;
public class abc178_a {

    static DateTime START_TIME;
    public static void Main() {
        START_TIME = DateTime.Now;
#if MYTEST
        while (true) {
            System.Console.Error.WriteLine("TEST MODE>");
            START_TIME = DateTime.Now;
            System.Console.WriteLine(Answer());  // debug
            System.Console.WriteLine($"{(DateTime.Now - START_TIME).Seconds} sec.");
        }
#else
        System.Console.WriteLine(Answer());
#endif
    }
    public static void debugOut(string str) {
#if MYTEST
        System.Console.Error.Write(str);
#endif
    }
    public static string Answer() {
        var p = System.Console.ReadLine().Trim().Split(' ');
        var N = int.Parse(p[0]);
        var result = (1 - N).ToString();
        return result;
    }
}

Measured memory_bytes: 29660
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n,i,j;
    ll a[100005],x[2];
    while(cin>>n)
    {
        for(i=0;i<n;i++)
            cin>>a[i];
        sort(a,a+n);
        j=x[0]=x[1]=0;
        for(i=n-1;i>=0;i--)
        {
            if(a[i]==a[i+1])
            {
                x[j]=a[i];
                i--;
                j++;
            }
            if(j==2)
                break;
        }
        if(j==2)
            printf("%lld\n",x[0]*x[1]);
        else
            printf("0\n");
    }
    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

ll n, over = 1LL << 53, mx = over - 1;
char s[100];

void print(ll x, ll y) { // xをy桁
  for (ll i = 1LL << (y-1); i > 0; i /= 2) {
    if ((x & i) == 0) printf("0");
    else printf("1");
  }
}

int main() {
  while (scanf("%lld", &n), n) {
    scanf("%s", s);
    ll x = 0, y = 1;
    for (ll i = 0; i < 52; i++) y = y * 2 + (ll)(s[i] - '0');
    ll add = y;
    while (n > 0) {
      ll counter = (over - y - 1) / add + 1;
      if (counter > n) {
        y += add * n;
        break;
      }
      y += add * counter;
      n -= counter;
      y /= 2;
      add /= 2;
      x++;
      if (x == 53) break;
    }
    y %= over;
    print(x, 12);
    print(y, 52);
    printf("\n");
  }
}



Measured memory_bytes: 2588
#include<cstdio>
#include<algorithm>
using namespace std;

int n;
int a[100005],ans[100005],cnt[100005];

int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    for(int i=0;i<n;i++)
    {
        while(a[i]%2==0)
        {
            a[i]/=2;
            cnt[i]++;
        }
    }
    sort(cnt,cnt+n);
    int pos=0;
    for(int i=0;i<n;i+=2)
    {
        ans[i]=cnt[pos++];
    }
    pos=n-1;
    for(int i=1;i<n;i+=2)
    {
        ans[i]=cnt[pos];
        pos--;
    }
    for(int i=0;i<n-1;i++)
    {
        if(ans[i]+ans[i+1]<2)
        {
            printf("No");
            return 0;
        }
    }
    printf("Yes");
    return 0;
}


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

namespace ABC126_1
{
    class C
    {
        static void Main(string[] args)
        {
            var nk = Console.ReadLine().Split().Select(double.Parse).ToArray();
            var n = nk[0];
            var k = nk[1];

            var res = 0.0;
            for (var i = 1.0; i <= n; i++)
            {
                var tmp = i;
                var count = 0.0;
                while (tmp < k)
                {
                    tmp *= 2;
                    count++;
                }
                //Console.WriteLine(count);
                res += (1.0 / n) * Math.Pow(1.0 / 2.0, count);
            }
            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 13396
#! usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    x1, y1, x2, y2 = map(int, input().split())

    dx, dy = abs(x2-x1), abs(y2-y1)
    if x2 < x1:
        if y1 < y2:
            x3, y3 = x2 - dy, y2 - dx
            x4, y4 = x1 - dy, y1 - dx
        else:
            x3, y3 = x2 + dy, y2 - dx
            x4, y4 = x1 + dy, y1 - dx

    else:
        if y1 < y2:
            x3, y3 = x2 - dy, y2 + dx
            x4, y4 = x1 - dy, y1 + dx
        else:
            x3, y3 = x2 + dy, y2 + dx
            x4, y4 = x1 + dy, y1 + dx

    print(x3, y3, x4, y4)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
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; }
using Graph = vector<vector<int>>;
struct edge{int from,to,cost;};
signed main(){
  int a;
  cin>>a;
  vector<int> c(a);
  rep(i,a)
    cin>>c[i];
  int b;
  cin>>b;
  vector<int> d(b);
  rep(i,b)
    cin>>d[i];
  map<int,int> e,f;
  rep(i,a)
    e[c[i]-1]++;
  rep(i,b)
    f[d[i]-1]++;
  bool ans=1;
  rep(i,b){
  if(e[d[i]-1]<f[d[i]-1])
    ans=0;
  }
  if(ans)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

Measured memory_bytes: 28416
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const double pi = 3.14159265358979323846;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int main()
{
  speed;
  ll a,b;
  cin>>a>>b;
  cout<<a*b;
  
  return 0;
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
char garden[100][100];
int H = 1, W = 1;
int result = 0;
int dx[4] = {-1,0,0,1};
int dy[4] = {0,1,-1,0};
void dfs(int sx, int sy,char c){
	garden[sx][sy] = 'x';
	for(int i = 0; i < 4;++i){
		int x = sx + dx[i], y = sy + dy[i];
		if(x >= 0 && x < H && y >= 0 && y < W && garden[x][y] == c){
			dfs(x,y,c);
		}
	}
	return;
}
int main(){
	while(H != 0 && W != 0){
		cin >> H >> W;
		if(H == 0 && W == 0){
			return 0;
		}
		for(int i = 0; i < H; ++i){
			for(int j = 0; j < W; ++j){
				cin >> garden[i][j];
			}
		}
		for(int i = 0; i < H; ++i){
			for(int j = 0; j < W; ++j){
				if(garden[i][j] != 'x'){
					dfs(i,j,garden[i][j]);
					result++;	
				}
			}
		}
		cout << result << endl;
		result = 0;
	}
}

Measured memory_bytes: 1632
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


template<class T> class BIT   // 1-indexed (0 is not used)
{
private:
    int num;
    vector<T> bit;
public:
    BIT(int n):bit(vector<T>(n+1, 0)), num(n) {}

    T sum(int i) {   // sum of 1..i
        if (!i) return 0;
        return bit[i] + sum(i-(i&-i));
    }

    void add(int i, T x) {
        if (i > num) return;
        bit[i] += x;
        add(i+(i&-i), x);
    }

    int lower_bound(T x) {
        T res=0;
        int N=1;
        while(N<num) N*=2;
        int i;
        for(i=N/2; i>0; i/=2) {
            if(res+i<num && bit[res+i]<x) {
                x = x - bit[res +i];
                res = res + i;
            }
        }
        return res + 1;
    }
};

int main(int argc, char* argv[])
{
    int n,m;
    scanf("%d%d", &n, &m);

    vector<vector<int> > z(m+1);   // length, l
    int i;
    for(i=0; i<n; i++) {
        int l,r;
        scanf("%d%d", &l, &r);
        z[r-l+1].push_back(l);
    }

    vector<int> ans(m+1);
    BIT<int> bit(m);

    for(i=1; i<=m; i++) {
        int siz=z[i].size();
        int k;
        for(k=0; k<siz; k++) {
            int l=z[i][k], r=l+i-1;
            bit.add(l, 1);
            bit.add(r+1, -1);
        }

        for(k=i; k<=m; k+=i) {
            ans[i]+=bit.sum(k);
        }
    }

    int sum=n;
    for(i=1; i<=m; i++) {
        sum-=(int)z[i].size();
        ans[i]+=sum;
    }

    for(i=1; i<=m; i++) {
        printf("%d\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 7168
import math

def isPrime( x ):
	if 2 == x or 3 == x:
		return True
	if 0 == x&1:
		return False
	i = 3
	limit = math.sqrt( x )
	while  i <= limit:
		if 0 == x%i:
			return False
		i += 2
	return True
 
 
n = int( input( ) )
nums = []
i = 0
while i < n:
    nums.append( int( input( ) ) )
    i += 1
cnt = i = 0
for val in nums:
    if isPrime( val ):
        cnt += 1
 
print( cnt )

Measured memory_bytes: 8052
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, A, B;
  cin>>N>>A>>B;
  string S;
  cin>>S;
  int anum=0, bnum=0;
  for(int i=0;i<S.size();++i) {
    if(S[i]=='a') {
      if(anum+bnum<A+B) {
        cout<<"Yes"<<endl;
        anum++;
      }
      else cout<<"No"<<endl;
    }
    else if(S[i]=='b') {
      if(anum+bnum<A+B && bnum<B) {
        cout<<"Yes"<<endl;
        bnum++;
      }
      else cout<<"No"<<endl;
    }
    else cout<<"No"<<endl;
  }
}



Measured memory_bytes: 3752
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    ll k;cin>>k;
    ll sum=0;
    FOR(a,1,k){
        FOR(b,1,k){
            FOR(c,1,k){
                sum+=gcd(a,gcd(b,c));
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}


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

typedef long long LL;

const int OO = 1e9;
const int MOD = 1e9 + 7;

const int MAXN = 2 * 123456;

int f[MAXN];

int power(int a, int b) {
	if (b == 0) return 1;
	int ans = power(a, b / 2);
	return (LL) ans * ans % MOD * (b % 2 == 1 ? a : 1) % MOD;
}

int C(int n, int r) {
	return (LL) f[n] * power(f[r], MOD - 2) % MOD * power(f[n - r], MOD - 2) % MOD;
}

void solve() {
	f[0] = 1;
	for (int i = 1; i < MAXN; ++i)
		f[i] = (LL) f[i - 1] * i % MOD;

	int h, w, a, b;
	scanf("%d%d%d%d", &h, &w, &a, &b);
	int ans = C(h + w - 2, w - 1);
	for (int i = 1; i <= b; ++i) {
		ans = (ans - (LL) C(h - a - 1 + i - 1, i - 1) * C(a - 1 + w - i, a - 1) % MOD + MOD) % MOD;
	}
	printf("%d\n", ans);
}

int32_t main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);

// 	clock_t begin = clock();
// #endif

	solve();

// #ifndef ONLINE_JUDGE
// 	clock_t end = clock();
// 	printf("ELAPSED TIME: %f\n", (double) (end - begin) / CLOCKS_PER_SEC);
// #endif

	return 0;
}


Measured memory_bytes: 1152
/*  -*- coding: utf-8 -*-
 *
 * e.cc: E - Sum of gcd of Tuples (Hard)
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_K = 100000;
const int MOD = 1000000007;

/* typedef */

typedef long long ll;

/* global variables */

int cs[MAX_K + 1];

/* subroutines */

int powmod(int a, int n) {  // a^n % MOD
  int pm = 1;
  while (n > 0) {
    if (n & 1) pm = (ll)pm * a % MOD;
    a = (ll)a * a % MOD;
    n >>= 1;
  }
  return pm;
}

inline void addmod(int &a, int b) { a = (a + b) % MOD; }

/* main */

int main() {
  int n, k;
  scanf("%d%d", &n, &k);

  int sum = 0;
  for (int x = k; x >= 1; x--) {
    cs[x] = powmod(k / x, n);
    for (int y = x * 2; y <= k; y += x)
      addmod(cs[x], MOD - cs[y]);
    addmod(sum, (ll)x * cs[x] % MOD);
  }

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


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007ll;


int main(){
	int a,b;
	std::cin >> a>>b;
	if(a+b>=10){
		std::cout << "error" << std::endl;
	}else std::cout << a+b << std::endl;
}


Measured memory_bytes: 256
n, x = list(map(int, input().split(' ')))
xs = list(map(int, input().split(' ')))

ns = list(map(lambda n: abs(n - x), xs))


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

result = ns[0]
for i in range(1, n):
    if result > ns[i]:
        result = gcd(result, ns[i])
    else:
        result = gcd(ns[i], result)

print(result)



Measured memory_bytes: 63444
// Problem Link: 
// Tutorial Link: 

#include<bits/stdc++.h>
 
using namespace std;
 
#define LL long long
#define ll  long long
#define all(v) v.begin(), v.end()
#define pb push_back
#define pLL pair<LL,LL>
#define ff first
#define ss second
#define rep(i,a,b) for(LL i=a;i<b;++i)
#define repb(i,a,b) for(LL i=a;i>b;--i)
#define ld double
#define mp make_pair
#define vLL vector<LL>
#define vpLL vector<pLL>
#define vld vector<ld>
#define pld pair<ld,ld>
#define vpld vector<pld>
#define SLL set<LL>
#define SpLL set<pLL>
#define FIO ios::sync_with_stdio(false)
#define mod 1000000007

LL n,k,a[200005];

int main()
{
	FIO;
	cin >> n >> k;
	rep(i,1,n+1) cin >> a[i];
	rep(i,k+1,n+1) {
		if(a[i] > a[i-k]) cout << "Yes\n";
		else cout << "No\n";
	}
}

Measured memory_bytes: 5212
#include<stdio.h>

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

	scanf("%d %d %d",&a,&b,&c);
	if (b<a){
		k=a;
		a=b;
		b=k;
	}
	if (c<b){
		k=b;
		b=c;
		c=k;
	}
	if (b<a){
		k=a;
		a=b;
		b=k;
	}
printf("%d %d %d\n",a,b,c);
return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<int(n);i++)
using namespace std;
int main() {
	int n;
	string ans="No";
	cin >>n;
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			if (i*j==n){
				ans="Yes";
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <sstream>

#define DEBUG 0
#define fi first
#define se second
#define pb push_back
#define fore(i,a,b) for (int i = (a), _b = (b); i < (_b); ++i)
#define fort(i,a,b) for (int i = (a), _b = (b); i <= (_b); ++i)
#define ford(i,a,b) for (int i = (a), _b = (b); i >= (_b); --i)

using namespace std;

typedef long long LL;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int INF = 1e9 + 3;
const int MOD = 1e9 + 7;

int main() {
    if (DEBUG) {
        freopen("CP.inp", "r", stdin);
        //freopen("CP.out", "w", stdout);
    }
    ios_base::sync_with_stdio(false); cin.tie(0);
    int m, d; cin >> m >> d;
    int cnt = 0;
    fort(i, 2, 9) fort(j, 2, 9) if (i * 10 + j <= d && i * j <= m) ++cnt;
    cout << cnt << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

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

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

typedef long long LL;
static LL INF = (1LL<<62);

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL N;
	cin >> N;
	LL SA = 0, SB = 0;
	vector<LL> A, B, C;

	for(int i=0; i<N; i++){
		LL a; cin >> a;
		A.push_back(a);
		SA += a;
	}
	for(int i=0; i<N; i++){
		LL b; cin >> b;
		B.push_back(b);
		SB += b;
	}

	if(SA < SB){
		printf("-1\n");
		return 0;
	}

	LL s = 0;
	LL ans = 0;
	for(int i=0; i<N; i++){
		LL c = B[i] - A[i];
		C.push_back(c);
		if(c > 0){
			s += c;
			ans++;
		}
	}
	if(s == 0){
		printf("0\n");
		return 0;
	}
	sort(C.begin(), C.end());
	int i=0;
	map<int, int> M;
	while(true){
		if(C[i] < 0){
			LL w = min(s, (-1)*C[i]);
			s -= w;
			C[i] += w;
			if(M.count(i) == 0){
				M[i] = 1;
			}
			if(s == 0){
				break;
			}
		}
		if(C[i] >= 0){
			i++;
		}
	}
	ans += M.size();
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 6848
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String a = sc.next();
        String s[] = a.split("");
        int i,j;
        String ans = "",ans2 = "";
        String check;
		if(a.equals("keyence")){
          System.out.println("YES");
          return;
        }
        
        
        for(i = 0;i < a.length();i++){
          for(j = i;j < a.length();j++){
            ans = a.substring(0, i);
            ans2 = a.substring(j, a.length());
            check = ans + ans2;           
       	    if(check.equals("keyence")){
          	 System.out.println("YES");
         	 return;
      	 	 }else if(ans.equals("keyence")){
          	 System.out.println("YES");
         	 return;
            }else if(ans2.equals("keyence")){
          	 System.out.println("YES");
         	 return;
            }
          }
        }
        System.out.println("NO");
 
    }
}

Measured memory_bytes: 40364
#include<iostream>
#include<set>
#include<map>
#include<functional>
#include<queue>
#include<string.h>
#include <sstream>
#include<stdio.h>
#include<iomanip>
#include<stdlib.h>
#include<math.h>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<bitset>
#include<assert.h>
#include<fstream>

using namespace std;

//typedef vector<int>VI;
//typedef pair<int,int>PII;
//#define FOR(x,y,z)for(int x=y;x<=z;++x)
//#define FORD(x,y,z)for(int x=y;x>=z;--x)
//#define FOReach(x,Z)for(_typeof((Z).begin())x=(Z).begin();x!=(Z).end();++x)
//#define REP(x,y)for(int x=0;x<y;++x)
//#define PB push_back
//#define ALL(X)(X).begin(),(X).end()
//#define SZ(X)((int)(X).size())
//#define CLR(X,x)memset(X,x,sizeof(X))
//#define MP make_pair
//#define ST first
//#define ND second
//#define DBG
//#ifdef DBG
//#define debug printf
//#else
//#define debug(fmt,...)
//#endif
//const int MAX = 16;
//const int INF = 1000000001;
//const int mod=1000000000+7;
//typedef long long ll;
//typedef long double ld;

int main(){
long long dp[100];
dp[0]=2;
dp[1]=1;
for(int i=2;i<100;i++){
dp[i]=dp[i-1]+dp[i-2];
}
int n;
cin>>n;
cout<<dp[n]<<endl;

return 0;
}

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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;







int main() {
	
	
	int n, m;
	cin >> n >> m;

	VI v(m, 0);
	REP(i, n) {
		int k;
		cin >> k;
		REP(j, k) {
			int a;
			cin >> a;
			a--;
			v[a]++;
		}
	}

	int ans = 0;
	REP(i, m) {
		if (v[i] == n)ans++;
	}

	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rfor(i,a,b) for(ll (i) = (a); (i) > (b); --(i))
#define ll long long
#define mod (1000000007)
#define pf(x) cout << (x) << endl;
#define all(x) (x).begin(),(x).end()

ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    for (ll i = 1; i <= k; ++i) {
        r *= n--;
        r /= i;
    }
    return r;
}

ll n,q,k;
vector<queue<pair<ll, ll>>> v(1e5 + 2);
vector<ll> cost(1e5 + 2,0);

void d(ll p,ll now){
    if(p != 0)cost[now] = cost[p] + v[p].front().second;
    while (!v[now].empty()) {
        if(v[now].front().first != p)d(now,v[now].front().first);
        v[now].pop();
    }
    return;
}

int main()
{
    ll n,q,k;
    cin >> n;
    rep0(i, n - 1){
        ll a,b,c;
        cin >> a >> b >> c;
        v[a].push(make_pair(b, c));
        v[b].push(make_pair(a, c));
    }
    cin >> q >> k;
    d(0,k);
    rep0(i, q){
        ll x,y;
        cin >> x >> y;
        pf(cost[x] + cost[y]);
    }
    return 0;
}


Measured memory_bytes: 74496
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
ans = 0
for i in range(N):
    A = list(map(int,input().split()))
    S = 0
    for j in range(M):
        S += A[j] * B[j] 
    S += C
    if S > 0:
        ans += 1
print(ans)


Measured memory_bytes: 3060
/*input
2
*/

#include <bits/stdc++.h>
#define ll long long

using namespace std;

void run() {
	ll n;
	cin >> n;
	vector<ll> fn, fn1;
	if(n == 2) {
		cout << "1" << endl;
		return;
	}
	for(ll x = 2; x*x <= n; x++) {
		if(n % x == 0) {
			fn.emplace_back(x);
			if(x * x != n) 
				fn.emplace_back(n / x);
		}
		if((n - 1 > x) && ((n - 1) % x == 0)) {
			fn1.emplace_back(x);
			if(x * x != n - 1) {
				fn1.emplace_back((n - 1) / x);
			}
		}
	}
	fn.emplace_back(n);
	fn1.emplace_back(n-1);
	int ret = 0;
	for(int i=0; i<fn.size(); i++) {
		ll cur = fn[i];
		ll nn = n;
		while(nn % cur == 0)
			nn /= cur;
		ret += (nn % cur == 1);
	}
	cout << ret + fn1.size() << endl;
}

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


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
ll INF = 1000000000000000001; //10^18+1
ll MOD = 1000000007; //10^9+7
//cout << fixed << setprecision(15); (小数点以下表示)


int main() {
  int64_t N,K;
  cin >> N >> K;
  vector<int64_t>p(N);
  vector<int64_t>sum(N-K+1,0);
  for(int i=0;i<N;i++){
    cin >> p.at(i);
  }
  for(int i=0;i<K;i++){
    sum.at(0)+=p.at(i);
  }
  for(int i=1;i<N-K+1;i++){
    sum.at(i)=sum.at(i-1)-p.at(i-1)+p.at(i+K-1);
  }
  sort(sum.begin(),sum.end());
  cout << fixed << setprecision(15) << (sum.at(N-K)+K)/2.0 << endl;
}

Measured memory_bytes: 3328
use std::error::Error;
use std::io;
use std::collections::HashSet;

fn main() {
    if let Err(e) = run() {
        println!("{}", e);
    }
}

fn run() -> Result<(), Box<Error>> {
    let mut s = String::new();
    io::stdin().read_line(&mut s)?;
    let mut set = HashSet::new();
    for b in s.trim().as_bytes() {
        set.insert(b);
    }
    for b in 0x61u8..0x7bu8 {
        if !set.contains(&b) {
            println!("{}", String::from_utf8(vec![b])?);
            return Ok(());
        }
    }
    println!("None");
    Ok(())
}


Measured memory_bytes: 4352
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(){
    int n,x;cin>>n>>x;
    vector<int> vec(n);
    for(int i=0;i<n;i++)cin>>vec[i];
    lint ans=0;
    if(vec[0]>x){
        ans+=(vec[0]-x);
        vec[0]=x;
    }
    int d;
    for(int i=1;i<n;i++){
        d=vec[i]+vec[i-1];
        if(d>x){
            ans+=(d-x);
            vec[i]-=(d-x);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3720
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 17;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

map <pll, int> Sx;

ll R[100050];
ll mn[100050];
ll mx[100050];
ll sum[100050];
int main() {
	int X, K, Q, i;
	scanf("%d %d", &X, &K);
	for (i = 1; i <= K; i++) scanf("%d", &R[i]);

	int st = 0, en = X, s = 0;
	mx[0] = X;
	for (i = 1; i <= K; i++) {
		int t = R[i] - R[i - 1];
		if (i % 2 == 1) {
			s -= t;
			if (st <= en && st + s <= 0) {
				int v = min(en, -s);
				Sx[pii(st, v)] = i;
				st = v + 1;
			}
			mn[i] = max(0ll, mn[i - 1] - t);
			mx[i] = max(0ll, mx[i - 1] - t);
			sum[i] = sum[i - 1] - t;
		}
		else {
			s += t;
			if (st <= en && en + s >= X) {
				int v = max(st, X - s);
				Sx[pii(v, en)] = i;
				en = v - 1;
			}
			mn[i] = min((ll)X, mn[i - 1] + t);
			mx[i] = min((ll)X, mx[i - 1] + t);
			sum[i] = sum[i - 1] + t;
		}
	}
	if (st <= en) Sx[pii(st, en)] = K + 1;

	scanf("%d", &Q);
	while (Q--) {
		int t, a;
		scanf("%d %d", &t, &a);

		int p = lower_bound(R + 1, R + K + 1, t + 1) - R - 1;
		
		auto it = Sx.lower_bound(pll(a + 1, 0));
		it--;
		int p2 = it->second;

		int x = 0;
		if (p < p2) x = a + sum[p];
		else if (p2 % 2 == 1) x = mn[p];
		else x = mx[p];
		
		if (p % 2 == 0) x = max(0ll, x - (t - R[p]));
		else x = min((ll)X, x + (t - R[p]));
		printf("%d\n", x);
	}
	return 0;
}

Measured memory_bytes: 4352
import sys
def LI():
	return [ int(s) for s in input().split() ]
 
H,W = LI()
 
if H == 1 or W == 1:
  print(1)
  sys.exit()
 
if H % 2 == 1 and W % 2 == 1:
  print(H*W//2+1)
else:
  print(H*W//2)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0; i < n; i++)
int main()
{
	string S;
	int K,num;
	cin >> K >> S;
	num = S.size();

	if(num<=K){
		rep(i,num){
			cout << S[i];
		}
	}
	else{
		rep(i,K){
			cout << S[i];
		}
		cout << "...";
	}

	cin >> K;
	
	return 0;	
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

int main() {
    int N;
    cin >> N;
    int K = 0;
    while ((K + 1) * (K + 1) <= N) ++K;
    cout << K * K << "\n";
    return 0;
}


Measured memory_bytes: 3632
def main():
    a, b = map(int, input().split())
    eight = [i for i in range(0, 2000) if a == int(i * 0.08)]
    ten = [i for i in range(0, 2000) if b == int(i * 0.1)]
    for i in eight:
        for j in ten:
            if i == j:
                print(i)
                return
    print(-1)


if __name__ == '__main__':
    main()


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

int N, K;
vector<vector<int>> E;
map<pair<int, int>, int> mp;
vector<int> ans;

int nextColor(int c){
    if(c == K) return 1;
    else return c + 1;
}

void dfs(int n, int p){
    int parentColor;
    if(p == -1){
        parentColor = 0;
    }else{
        int parentEdge = mp[{min(n, p), max(n, p)}];
        parentColor = ans[parentEdge];
    }
    
    int color = nextColor(parentColor);
    for(int i=0; i<E[n].size(); i++){
        int v = E[n][i];
        if(v == p) continue;
        int edge = mp[{min(n, v), max(n, v)}];
        ans[edge] = color;
        color = nextColor(color);
        dfs(v, n);
    }
}

int main(){
    cin >> N;
    E.resize(N);
    for(int i=0; i<N-1; i++){
        int a, b;  cin >> a >> b;
        a--;  b--;
        E[a].push_back(b);
        E[b].push_back(a);
        mp[{a,b}] = i;
    }

    K = 0;
    for(auto v: E){
        K = max(K, (int)v.size());
    }

    int color = 1;
    ans.resize(N-1, -1);
    dfs(1, -1);

    cout << K << endl;
    for(int a : ans){
        cout << a << endl;
    }
}

Measured memory_bytes: 14720
# -*- coding: utf-8 -*-

# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n = input_int()

    ans = 0
    for j in range(1, n + 1):
        temp = n // j
        ans += temp * (temp + 1) * j // 2
        # for i in range(j, n + 1, j):
        #     ans += i

    print(int(ans))


if __name__ == "__main__":
    main()


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


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = String.valueOf(n);
        int sum = 0;
        for (int i = 0; i < s.length(); i++) {
            sum += s.charAt(i) - '0';
        }
        if (sum == 1) {
            System.out.println(10);
        } else {
            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 21332
#include <stdio.h>
#include <stdlib.h>

int main()
{

    int N;
    int i;
    int sum=0;
    char a;
    scanf("%d",&N);
    char str[N];
    scanf("%s",str);
    for(i=0;i<N;i++)
    {
        if(str[i]==a)
        {
            continue;
        }
        if(str[i]==str[i+1])
        {
            sum++;
            a=str[i];
        }
        else
        {
             a=str[i];
             sum++;
        }

    }

    printf("%d",sum);

    return 0;
}

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

int main(int argc, char const *argv[])
{
	int n, k; cin >> n >> k;
	if (k == 1) {
		printf("0\n");
		return 0;
	}
	int r = n - k; 
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  int m=0;
  cin >> n;
  vector<int>a(n);
  for (int i=0;i<n;i++) {
    cin >> a.at(i); 
  }
  for (int i=0;i<n;i++) {
    if(i%2==0 && a[i]%2==1){
      m++;
    } 
  }
  cout << m << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>

#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
using namespace std;

int main () {
    vector<int>u;
    int n, k, q, memo;
    cin >> n >> k >> q;
    rep(i, n){
        u.push_back(0);
    }
    rep(i, q){
        cin >> memo;
        --memo;
        ++u[memo];
    }
    q = q - k;
    rep(i, n){
        if((u[i] - q) <= 0){
            cout << "No";
        }else{
            cout << "Yes";
        }
        cout << endl;
    }
}

Measured memory_bytes: 1144
#include<bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++)
using namespace std;
int n,k,x,p,l,a[201],v,u,t,c[11111];
double ans,o=1;
int main(){
  cin>>n>>k>>t>>u>>v>>l;
  r(i,0,n)cin>>a[i],c[a[i]]=1;
  r(i,1,l+1){
    ans+=x?o/v:o/u;
    if(x&&p+t*v==i)x--,p=i;
    if(c[i]){
      if(++x==1)p=i;
      if(x-1>k)x--,p=i;
    }
  }
  printf("%.9f\n",ans);
}

Measured memory_bytes: 3224
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, kk;
	cin >> nn >> kk;
	vector<int64> hh(nn);
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> hh[ii];
	}
	sort(hh.begin(), hh.end());
	auto ans = lower_bound(hh.begin(), hh.end(), kk);
	cout << distance(ans, hh.end()) << endl;
	return 0;
}


Measured memory_bytes: 3876
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    ll n, m;
    cin >> m >> n;
    ll ans = 0, dk = 1;
    while(dk < n){
        ans++;
        dk += (m-1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8


def main():
    s = input()
    mm = ['{:0>2}'.format(i+1) for i in range(12)]
    d = 0
    if s[:2] in mm:
        d += 2
    if s[2:] in mm:
        d += 1
    ans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS']
    print(ans[d])


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }
int main() {
  cin.tie(0); ios::sync_with_stdio(false);

  int N;
  vector<int> take(3);
  cin >> N;
  rep(i, 3) cin >> take[i];
  vector<int> l(N);
  rep(i, N) {
    cin >> l[i];
  }

  int ans = 10000000;
  rep(i, 1<<2*N) {
    vector<int> sum(3);
    vector<int> cnt(3);
    rep(j, N) {
      if (i & 1 << j*2) {
        if (i & 1 << j*2+1) {
          sum[0] += l[j];
          cnt[0]++;
        } else {
          sum[1] += l[j];
          cnt[1]++;
        }
      } else {
        if (i & 1 << j*2+1) {
          sum[2] += l[j];
          cnt[2]++;
        }
      }
    }

    if (any_of(all(cnt), [](int n){return n==0;})) continue;
    

    int mp = 0;
    rep(i, 3) {
      mp += abs(take[i]-sum[i]) + (cnt[i]-1)*10;
    }
    cmin(ans, mp);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean approved = true;
		for(int i = 0; i < n ; i++) {
			int val = sc.nextInt();
			if(val % 2 == 0) {
				if(val % 3 == 0 || val % 5 == 0) {
					continue;
				}else {
					approved = false;
					break;
				}
			}
		}
		sc.close();
		if(approved) {
			System.out.println("APPROVED");
		}else {
			System.out.println("DENIED");
		}
	}

}


Measured memory_bytes: 22868