akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> node;

ll collect[45 * 20];

ll N;
vector<ll> A;
vector<node> pcom;

int main()
{
    for (int i = 0; i < 45 * 20; i++) collect[i] = 0;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        ll tmp;
        string tmp1;
        string tmp2="", tmp3="";
        cin >> tmp1;
        bool to_mod = false;
        for (int j = 0; j < tmp1.length(); j++)
        {
            if (to_mod)
            {
                tmp3.append(1u, tmp1[j]);
                continue;
            }
            if (tmp1[j] == '.')
            {
                to_mod = true;
                continue;
            }
            else 
            {
                tmp2.append(1u, tmp1[j]);
            }
        }
        // cout << tmp2 << " " << tmp3 << endl;
        for (int j = tmp3.length(); j < 9; j++){
            tmp3.append(1u, '0');
        }

        tmp = stoll(tmp2) * 1000000000 + stoll(tmp3);

        // tmp = 11 ;//(ll)(tmp1 * 1000000000.); // 10 ^ 9
        // cout << tmp << endl;
        A.push_back(tmp);
        int count2 = 0, count5 = 0;
        while (tmp % 2 == 0)
        {
            count2++;
            tmp /= 2;
        }

        while (tmp % 5 == 0)
        {
            count5++;
            tmp /= 5;
        }

        pcom.push_back(make_pair(count2, count5));
        for (int j = 0; j < count2 + 1; j++)
        {
            for (int k = 0; k < count5 + 1; k++)
            {
                collect[j * 20 + k]++;
            }
        }
    }

    ll num_pair = 0;
    for (auto x: pcom)
    {
        int count2, count5;
        count2 = x.first;
        count5 = x.second;

        int need2, need5;
        need2 = 18 - count2;
        need5 = 18 - count5;
        need2 = need2 < 0 ? 0 : need2;
        need5 = need5 < 0 ? 0 : need5;

        ll num_gpair = collect[need2 * 20 + need5];
        if ((count2 >= need2) && (count5 >= need5))
        {
            num_gpair--;
        }
        num_pair += num_gpair;
    }

    if (num_pair % 2 != 0) 
    {
        while (true) {}
    }

    cout << num_pair/2 << endl;
    return 0;

}

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

#define pb(x) push_back(x);
#define in(y) insert(y);
#define tt(t) while(t--)
#define itr ::iterator it;
#define ll long long
#define vi vector<int>
#define ii pair<int, int>
#define vii vector<ii>
#define si set<int>                      
#define msi map<string, int>
#define new cout<<endl
#define ff(n) for(int i=0;i<n;i++)
#define all(v) sort(v.begin(),v.end())

using namespace std;

int main(){
	int N,cnt=0,tmp=0;
	cin>>N;
	vector<int> A(N);
	vector<int> B(100001,0); //freq
	ff(N){
		cin>>A[i];
		B[A[i]]++;
	}
	ff(100001){
		while(B[i]>2){
			B[i]-=2;
		}
		if(B[i]==1){
			cnt++;
		}
		else if(B[i]==2){
			if(tmp){
				tmp=0;
				cnt+=2;
				
			}
			else{
				tmp=1;
			}
		}
	}
 
	cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 1152
fun main(args: Array<String>) {
    val N = nextInt()
    var X = listOfInt()
    val left = X.min()!!
    val right = X.max()!!
    val P = IntArray(right - left + 1)
    var p = left
    while (p <= right) {
        var s = 0
        X.forEach {
            val d = it - p
            s +=  d * d
        }
        P[p - left] = s
        p += 1
    }
    var ans = P.min()!!
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)


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

int h, w, sayu[2020][2020], joge[2020][2020];
char grid[2020][2020];

int main(){
  cin >> h >> w;
  rep(i, h) rep(j, w) cin >> grid[i][j];
  rep(i, h) grid[i][w] = '#';
  rep(i, w) grid[h][i] = '#';
  
  rep(i, h){
    int left = 0;
    rep(j, w + 1){
      if(grid[i][j] == '.') continue;
      for(int k = left; k < j; k++){
        sayu[i][k] = j - left;
      }
      left = j + 1;
    }
  }
  
  rep(j, w){
    int upper = 0;
    rep(i, h + 1){
      if(grid[i][j] == '.') continue;
      for(int k = upper; k < i; k++){
        joge[k][j] = i - upper;
      }
      upper = i + 1;
    }
  }
  
  int ans = 0;
  rep(i, h) rep(j, w) ans = max(ans, sayu[i][j] + joge[i][j] - 1);
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 35968
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long


int main() {
  int a,b,c;
  cin >> a>>b>>c;
  
    if (a+b==c || b+c==a || c+a==b) {
    cout << "Yes" << endl;
    return 0;
    }

 cout << "No" << endl; 
      
}


Measured memory_bytes: 256
s = input()
for i in range(len(s)):
    if i % 2 == 0 and s[i] != 'h':
        print("No")
        exit()
    if i % 2 == 1 and s[i] != 'i':
        print("No")
        exit()
    if len(s) % 2 == 1:
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
#define INF 1e9

static const int D=365;
static const int ntype=26;

class Contest{
public:
    Contest(){
        last=0;
    }
    int s[D+1];
    int c;
    int last;
};

Contest contest[ntype+1];

void Input(){
    int d;
    cin>>d;
    for(int i=1;i<=ntype;++i){
        int t;
        cin>>t;
        contest[i].c=t;
    }
    for(int day=1;day<=D;++day){
        for(int type=1;type<=ntype;++type){
            int t;
            cin>>t;
            contest[type].s[day]=t;
        }
    }
}


void Greedy(){
    vector<int> l(ntype+1,0);
    for(int d=1;d<=D;++d){
        long long score=0;
        for(int i=1;i<=ntype;++i) score-=contest[i].c*(d-l[i]);
        long long temp=-INF;
        int t=-1;
        for(int i=1;i<=ntype;++i){
            long long k=contest[i].s[d]+contest[i].c*(d-l[i])+score;
            if(k>temp){
                temp=k;
                t=i;
            }
        }
        l[t]=d;
        cout<<t<<endl;
    }
}
int main(){
    Input();
    Greedy();
};

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

using namespace std;

vector<int>v[100005];
int parent[100005], child[100005], depth[100005];

int dfs(int a)
{
    child[a] = 1;
    for(int i=0; i<v[a].size(); ++i) {
        if(v[a][i] == parent[a])    continue;

        parent[ v[a][i] ] = a;
        depth[ v[a][i] ] = depth[a] + 1;
        dfs(v[a][i]);
        child[a] += child[ v[a][i] ];
    }

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, a, b;
    cin>>n;
    for(int i=0; i<n-1; ++i){
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    parent[1] = 1, depth[1] = 1;
    dfs(1);

    int mid = (depth[n]-2) / 2, midpoint = n;
    for(int i=0; i<mid; ++i){
        midpoint = parent[midpoint];
    }
    if(child[midpoint] >= n-child[midpoint])
        cout<<"Snuke\n";
    else
        cout<<"Fennec\n";

    return 0;
}


Measured memory_bytes: 11648
import math
def divs(n):
    res = []
    for i in range(1, n+1):
        if i * i > n:
            break
        if n % i == 0:
            res.append(i)
            if i != n//i:
                res.append(n//i)
    return res

def one(n, k):
    if k == 1:
        return False
    while n % k == 0:
        n //= k
    n %= k
    return n == 1


n = int(input())

ans = sorted(set(divs(n) + divs(n-1)))

ok = 0
for x in ans:
    if one(n, x):
        ok += 1

print(ok)


Measured memory_bytes: 3956
#include <stdio.h>

int main(void)
{
    int n, m;
    int i, j, k, l, o;
    int p, q, r;
    int count;
    int s[6], c[6];

    scanf("%d%d", &n, &m);

    for (i = 0; i < m; i++)
    {
        scanf("%d%d", &s[i], &c[i]);
    }

    p = 10;
    q = 0;
    r = 0;
    count = 0;

    if (m != 0)
    {
        for (j = 0; j < m; j++)
        {
            for (k = 0; k < m; k++)
            {
                if (s[j] == s[k])
                {
                    if (c[j] != c[k])
                    {
                        count++;
                    }
                }
            }
        }

        if (count == 0)
        {
            if (n == 1)
            {
                printf("%d", c[0]);
            }

            else if (n == 2)
            {
                for (l = 0; l < m; l++)
                {
                    if (s[l] == 1)
                    {
                        p = c[l];
                    }

                    else if (s[l] == 2)
                    {
                        q = c[l];
                    }
                }

                if (p != 0 && p != 10)
                {
                    printf("%d", p * 10 + q);
                }
              	
              	else if (p == 10)
                {
                  	printf("%d",10 + q);
                }

                else
                {
                    printf("-1");
                }
            }

            else if (n == 3)
            {
                for (o = 0; o < m; o++)
                {
                    if (s[o] == 1)
                    {
                        p = c[o];
                    }

                    else if (s[o] == 2)
                    {
                        q = c[o];
                    }

                    else if (s[o] == 3)
                    {
                        r = c[o];
                    }
                }

                if (p != 0 && p != 10)
                {
                    printf("%d", p * 100 + q * 10 + r);
                }
              	
              	else if (p == 10)
                {
                  	printf("%d", 100 + q * 10 + r);
                }

                else
                {
                    printf("-1");
                }
            }
        }
        
        else if(count != 0)
        {
            printf("-1");
        }
    }

    else if (m == 0)
    {
        if (n == 1)
        {
            printf("0");
        }
        else if (n == 2)
        {
            printf("10");
        }
        else if (n == 3)
        {
            printf("100");
        }
    }

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int num_S[26],num_T[26];
char buf[100001];

int main(){

	for(int i = 0; i < 26; i++){
		num_S[i] = 0;
		num_T[i] = 0;
	}

	int N;
	scanf("%d",&N);

	scanf("%s",buf);
	for(int i = 0;i < N; i++){
		num_S[buf[i]-'a']++;
	}

	scanf("%s",buf);
	for(int i = 0; i < N; i++){
		num_T[buf[i]-'a']++;
	}

	sort(num_S,num_S+26);
	sort(num_T,num_T+26);

	int ans = 0;

	for(int i = 0; i < 26; i++){
		ans += abs(num_S[i]-num_T[i]);
	}

	printf("%d\n",ans/2);

	return 0;
}



Measured memory_bytes: 3376
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
    	int m = scn.nextInt();
    	char[][] aa = new char[n][n];
    	char[][] bb = new char[m][m];
    	for(int i=0; i<n; i++){
      		String a = scn.next();
      		for(int j=0; j<n; j++){
        		aa[i][j]=a.charAt(j);
      		}
    	}
    	for(int i=0; i<m; i++){
      		String b = scn.next();
      		for(int j=0;j<m;j++){
        		bb[i][j]=b.charAt(j);
      		}
    	}
      	for(int i=0; i<n; i++){
      		for(int j=0; j<n; j++){
        		if(i+m>n || j+m>n){
          			break;
        		}
              	String ans = "Yes";
        		for(int k=0; k<m; k++){
          			for(int l=0; l<m; l++){
            			if(aa[i+k][j+l]!=bb[k][l]){
              				ans = "No";
              				break;
            			}
          			}
        		}
              	if(ans.equals("Yes")){
                  System.out.println(ans);
                  return;
                }
            }
      	}
    	System.out.println("No");
	}
}


Measured memory_bytes: 35584
#include <algorithm>
#include <iostream>
#include <string>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main() {
    int A, B;
    cin >> A >> B;

    for (int i = 1; i <= 10000; i++) {
        if (i * 8 / 100 == A && i / 10 == B) {
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
int main() {
	deque<char>q;
	string t;cin>>t;
	for(ll i=0;i<t.size();i++){
		q.push_back(t[i]);
	}
	ll m;
	cin>>m;
	ll p=0;
	for(ll i=0;i<m;i++){
		ll now;
		cin>>now;
		if(now==2){
			ll next;char s;
			cin>>next>>s;
			next--;
			if(p==next){
				q.push_front(s);
			}
			else{
				q.push_back(s);
			}
		}
		else{
			p=abs(p-1);
		}
	}
	if(p==0){
		for(ll i=0;i<q.size();i++){
			cout << q[i];
		}
	}
	else{
		for(ll i=0;i<q.size();i++){
			cout << q[q.size()-i-1];
		}		
	}
	return 0;
}

Measured memory_bytes: 4032
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};

vector<int> edge[MAX_N];
bool reach[MAX_N];
int ans[MAX_N];

int main(void){
    int N,M;
    cin >> N >> M;
    rep(i,M){
        int u,v;
        cin >> u >> v;
        u--,v--;
        edge[u].push_back(v);
        edge[v].push_back(u);
    }
    queue<int> q;
    q.push(0);
    reach[0]=true;
    while(!q.empty()){
        int now=q.front();
        q.pop();
        rep(i,edge[now].size()){
            if(reach[edge[now][i]]) continue;
            reach[edge[now][i]]=true;
            ans[edge[now][i]]=now;
            q.push(edge[now][i]);
        }
    }
    cout << "Yes" << endl;
    for(int i=1;i<N;i++) cout << ans[i]+1 << endl;
}

Measured memory_bytes: 12892
#include<iostream>
#define MAX_SPR 11
#define MAP_SIZE 10
using namespace std;

//}bvTõ
void search_map(int sprx[], int spry[], int pyonx, int pyony, int sprnum, int lastsprnum);

//okflag = search_mapÅgp·éA¶¶©±©çÑé©Ì»ètO
//endflag = XvN[ðêüµ½©Ì»ètO
bool okflag = false, endflag = false;

int main(){
	
	//firstpyonx = ÒåñgNÌúÊuÌ¡ÀW, firstpyony = ÒåñgNÌúÊuÌcÀW,
	int firstpyonx, firstpyony;
	
	while(cin >>firstpyonx >>firstpyony){
		if(firstpyonx == 0 && firstpyony == 0) break;
		okflag = false;
		endflag = false;
		
		//n = XvN[Ì
		//sprx[XvN[ÌÔ] = »ÌÔÌXvN[Ì¡ÀW, spry[XvN[ÌÔ] = »ÌÔÌXvN[ÌcÀW
		int n, sprx[MAX_SPR], spry[MAX_SPR];
		
		cin >>n;
		
		//XvN[ÌÊuîñüÍ
		for(int i = 0; i < n; i++){
			int x, y;
			cin >>x >>y;
			sprx[i] = x;
			spry[i] = y;
		}
		search_map(sprx, spry, firstpyonx, firstpyony, 0, (n - 1));
		
		//}bvTõÌÊðoÍ
		if(okflag == true){
			cout <<"OK" <<endl;
		} else{
			cout <<"NA" <<endl;
		}
	}
	return 0;
}

void search_map(int sprx[], int spry[], int pyonx, int pyony, int sprnum, int lastsprnum){
	
	//map[][] = }bvîñ(·×Ä0Åú»AÄAÌÛÉn·KvÍÈ¢)
	//movepyonx[] = ÒåñgNÌ®­¡ÀWîñ, movepyony[] = ÒåñgNÌ®­cÀWîñ
	//movesprx[] = XvN[ªLøÆÈé¡ÀWîñ, movespry[] = XvN[ªLøÆÈécÀWîñ
	int map[MAP_SIZE][MAP_SIZE] = {0};
	int movepyonx[12] = {-1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2};
	int movepyony[12] = {-2, -2, -2, -1, 0, 1, 2, 2, 2, 1, 0, -1};
	int movesprx[9] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
	int movespry[9] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
	
	//ÅãÌXvN[ÉBµ½ê
	if(sprnum > lastsprnum){
		endflag = true;
		search_map(sprx, spry, pyonx, pyony, 0, lastsprnum);
	
	//TõrÌê(êüµÄßÁÄ«½êàÜÞ)
	} else{
		
		//Òåñg­ñÌs¯éêÌ}bvîñð+1É·é
		for(int i = 0; i < 12; i++){
			
			//}bvðÍÝo³È¢©»è
			if(pyonx + movepyonx[i] < 0 || pyony + movepyony[i] < 0 || pyonx + movepyonx[i] > 9 || pyony + movepyony[i] > 9){
				continue;
			}
			
			map[pyony + movepyony[i]][pyonx + movepyonx[i]]++;
		}
		
		//XvN[ÌLøÈêÌÀWð+2É·é
		for(int k = 0; k < 9; k++){
			
			//}bvðÍÝo³È¢©»è
			if(sprx[sprnum] + movesprx[k] < 0 || spry[sprnum] + movespry[k] < 0 || sprx[sprnum] + movesprx[k] > 9 || spry[sprnum] + movespry[k] > 9){
				continue;
			}
			
			map[spry[sprnum] + movespry[k]][sprx[sprnum] + movesprx[k]] += 2;
		}
		
		//}bvÅ3ÆÈÁ½ÊuðÒåñg­ñÌÊuÆµÄÄA
		for(int y = 0; y < MAP_SIZE; y++){
			for(int x = 0; x < MAP_SIZE; x++){
				if(map[y][x] >= 3){
					
					//endflag = trueÌêÅ3ªo½êÍ¶¶·é½ßAokflagð§ÄÄTõEo
					if(endflag == true){
						okflag = true;
						break;
					}
					else{
						search_map(sprx, spry, x, y, (sprnum + 1), lastsprnum);
					}
				}
			}
			if(okflag == true) break;
		}
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

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

	int cnt=0;
	while(a>=b)
	{
		cnt++;
		b*=2;
	}
	while(b>=c)
	{
		cnt++;
		c*=2;
	}

	cout << (cnt>k ? "No":"Yes") << endl;






}

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

using namespace std;

int main() {
	int n, m, p;
	while (cin >> n >> m >> p) {
		if (n == 0 && m == 0 && p == 0) {
			break;
		}
		int x;
		int sum = 0;
		int y = 0;
		for (int i = 0; i < n; i++) {
			cin >> x;
			sum += x;
			if (i == m - 1) {
				y = x;
			}
		}
		sum *= (100 - p);
		if (y == 0) {
			cout << 0 << endl;
		}
		else {
			cout << sum / y << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int k, s;
    cin >> k >> s;
    int ans = 0;
    for (int i = 0; i <= k; i++) {
        for (int j = 0; j <= k; j++) {
            if (0 <= (s - i - j) && (s - i - j) <= k) {
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう
//a=0x61=97
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
typedef pair<int,int> pairii;
typedef vector<int> veci;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() {
  int n;ld ans=0; 
  cin>>n;
  veci v(n);
  rep(i,n)cin>>v[i];
  sort(v.begin(),v.end());ans=v[0];
  rep(j,n-1){
    ans=((ans+v[j+1])/2);
  }
  cout << fixed << setprecision(7)<<ans<<endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T & a, const T & b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T & a, const T & b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}


#define ARRAY_MAX 100005
const int INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

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


/******************************************************************************************/




int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);

	string s;
	cin >> s;
	string ans = "";
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == '1') {
			ans.push_back('1');
		}
		if (s[i] == '0') {
			ans.push_back('0');
		}
		if (s[i] == 'B') {
			if (ans.size() > 0) {
				ans.pop_back();
			}
		}
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Hamza Hasbi
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        C_Bugged solver = new C_Bugged();
        solver.solve(1, in, out);
        out.close();
    }

    static class C_Bugged {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            long sum = 0;
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                sum += a[i];
            }

            Arrays.sort(a);
            int i = 0;
            while (sum % 10 == 0 && i < n) {
                if (a[i] % 10 != 0) sum -= a[i];
                i++;
            }
            if (sum % 10 == 0) sum = -1;
            out.printLine(sum < 0 ? 0 : sum);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void printLine(long i) {
            writer.println(i);
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		StringTokenizer st = new StringTokenizer(line," ");
		int x = Integer.parseInt(st.nextToken());
		int y = Integer.parseInt(st.nextToken());
		System.out.print(x*y);
		System.out.print(" ");
		System.out.println(2*x+2*y);
	}
}		

Measured memory_bytes: 24228
# C - Folia
import sys
readline = sys.stdin.readline

N = int(readline())
A = list(int(x) for x in readline().split())

leaf = sum(A)
tmp = 1
ans = 0
for a in A:
    if tmp < a:
        ans = -1
        break
    ans += min(tmp, leaf)
    leaf -= a
    tmp -= a
    tmp *= 2

print(int(ans))

Measured memory_bytes: 19976
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

struct UnionFind{
    vector<int> par;

    UnionFind(int n) : par(n,-1) { }
    void init(int n) { par.assign(n,-1); }

    int root(int x){
        if(par[x]<0) return x;
        else return par[x]=root(par[x]);
    }

    bool issame(int x,int y){
        return root(x)==root(y);
    }

    bool merge(int x,int y){
        x=root(x);
        y=root(y);
        if(x==y) return false;
        if(par[x]>par[y]) swap(x,y);
        par[x]+=par[y];
        par[y]=x;
        return true;
    }

    int size(int x){
        return -par[root(x)];
    }
};

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

    UnionFind uf(n);
    vector<vector<int>> G1(n),G2(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        uf.merge(a,b);
        G1[a].push_back(b);
        G1[b].push_back(a);
    }
    rep(i,k){
        int c,d;
        cin>>c>>d;
        c--,d--;
        G2[c].push_back(d);
        G2[d].push_back(c);
    }

    rep(i,n){
        int ans=uf.size(i);
        //cout<<ans<<endl;
        ans--;
        ans-=G1[i].size();
        rep(j,G2[i].size()){
            if(uf.issame(i,G2[i][j])) ans--;
        }
        cout<<ans<<" ";
    }
    cout<<endl;
}



Measured memory_bytes: 12152
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXLEN=500000;
const int MAXLG=18;

char s[MAXLEN+1]; int slen;

int dp[MAXLEN+1]; // dp[i] is minimum j such that s[i..j) can be cleared (-1 if impossible)
int dp2[MAXLEN+1][26]; // dp2[i][c] is minimum j such that c+s[i..j) can be cleared (-1 if impossible)
int dp3[MAXLEN+1][26]; // dp3[i][c] is minimum j such that c+s[i..j) becomes c+1 (-1 if impossible)

int root;
int d[MAXLEN+2];
int par[MAXLEN+2][MAXLG+1];

int lca(int a,int b) {
	if(d[a]<d[b]) swap(a,b);
	for(int k=MAXLG;k>=0;--k) if(d[a]-(1<<k)>=d[b]) a=par[a][k];
	if(a==b) return a;
	for(int k=MAXLG;k>=0;--k) if(par[a][k]!=par[b][k]) a=par[a][k],b=par[b][k];
	return par[a][0];
}

void precalc() {
	dp[slen]=-1; REP(c,26) dp2[slen][c]=dp3[slen][c]=-1;
	for(int i=slen-1;i>=0;--i) {
		dp[i]=dp2[i+1][s[i]-'a']; int x=s[i]-'a';
		{ int cur=dp2[i+1][x]; REP(c,x) dp3[i][c]=cur==-1?-1:dp3[cur][c]; }
		{ int cur=i+1; FOR(c,x,26) { dp3[i][c]=cur; cur=cur==-1?-1:dp3[cur][c]; } }

		{ int cur=dp2[i+1][x]; REP(c,x) dp2[i][c]=cur==-1?-1:dp2[cur][c]; }
		{ int cur=i+1; FOR(c,x,26) { dp2[i][c]=cur==-1?-1:c==25?cur:dp2[cur][c+1]; cur=cur==-1?-1:dp3[cur][c]; } }
	}
	//REPE(i,slen) { printf("%d: %d [",i,dp[i]); REP(c,26) printf("%d ",dp2[i][c]); printf("] ["); REP(c,26) printf("%d%c",dp3[i][c],c==25?']':' '); puts(""); }

	root=slen+1;
	par[root][0]=root; REPE(i,slen) par[i][0]=dp[i]==-1?root:dp[i];
	d[root]=0; for(int i=slen;i>=0;--i) d[i]=d[par[i][0]]+1;
	REP(j,MAXLG) REPE(i,slen) par[i][j+1]=par[par[i][j]][j];
}

int nq;

void run() {
	scanf("%s",s); slen=strlen(s);
	precalc();
	scanf("%d",&nq);
	REP(i,nq) {
		int l,r; scanf("%d%d",&l,&r); --l;
		printf("%s\n",lca(l,r)==r?"Yes":"No");
	}
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 143744
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define P pair<ll,ll>
#define lvector vector<ll> 
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,k,ans=0,val=0;cin>>n>>k;
  lvector v(n,0);rep(i,n) {cin>>v[i];}
  n-=k;ans+=1;
  ans+=(n+k-2)/(k-1);
  print(ans);
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,a,b;cin>>n>>a>>b;
    long long ans=0;

    if(a>b){
        cout<<0<<endl;
        return 0;
    }
    else if(n==1){
        if(a==b){
            cout<<1<<endl;
            return 0;
        }
        else{
            cout<<0<<endl;
            return 0;
        }
    }
    else{
        ans=(b-a)*(n-2)+1;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
from sys import stdin

def main():

    input = stdin.readline

    N = int(input())

    mod = (10 ** 9) +7

    ans = 0

    ans = pow(10,N,mod) - pow(8,N,mod) - (pow(9,N,mod) - pow(8,N,mod))*2

    ans %= mod

    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 9188
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner scan = new Scanner(System.in);
		int j;
		for(int i=1;;i++){
			j = scan.nextInt();
			if(j==0)break;
			System.out.println("Case "+i+": "+j);
		}
	}
}

Measured memory_bytes: 41008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    // 添字として使いたいので-1しておく
    a[i]--;
  }
  int ans = 0, now = 0;
  vector<bool> visited(n, false);
  while (now != 1) {
    if (visited[now]) {
      cout << -1 << endl;
      return 0;
    }
    visited[now] = true;
    now = a[now];
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
using System;

namespace ITP1_1_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] num = Console.ReadLine().Split();
            int d, r = 0;
            double f = 0;

            d = int.Parse(num[0]) / int.Parse(num[1]);
            r = int.Parse(num[0]) % int.Parse(num[1]);
            f = double.Parse(num[0]) / double.Parse(num[1]);

            Console.WriteLine(d + " " + r + " " + f.ToString("F5"));
        }
    }
}



Measured memory_bytes: 15876
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  ll n;cin>>n;
  ll sum=0,ans=0;
  FOR(i,1,n+1){
    sum=0;
    if(i%2){
      FOR(j,1,i+1){
        if(i%j==0){
          sum++;
        }
      }
    }
    if(sum==8){
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
reds = sorted((tuple(map(int, input().split())) for _ in range(n)), key=lambda tuple_: tuple_[1], reverse=True)
blues = sorted((tuple(map(int, input().split())) for _ in range(n)), key=lambda tuple_: tuple_[0])

pairs = 0
for blue in blues:
    for idx, red in enumerate(reds):
        if red[0] < blue[0] and red[1] < blue[1]:
            break
    else:
        continue
    del reds[idx]
    pairs += 1

print(pairs)

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
#include <bitset>
#include <string>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define all(x) (x).begin(),(x).end()
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

int main() {
  std::cout<<std::fixed<<std::setprecision(12);
  int N, K; cin >> N >> K;
  double ans = 0;
  reps(i, N){
    double tmp = 1.0/N;
    int now = i;
    while(now<K){
      now *= 2;
      tmp /= 2;
    }
    ans += tmp;
  }

  cout << ans << endl;
  return 0;

}


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

#define GYOU_MAX 256


int main(void)
{
	
	int N;
	scanf("%d", &N);
	int h[100000];
	for (int i = 0; i < N; i++) {
		scanf("%d", &h[i]);
	}

	int dp[100000] = { 0 };


	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);

	int a = 0, b = 0;
	int min = 0;


	for (int i = 2; i < N; i++) {
		a = dp[i-1]+abs(h[i - 1] -h[i]);
		
		b = dp[i - 2] + abs(h[i - 2] - h[i]); 
		if (a>=b) {
			dp[i] = b;
		}
		else {
			dp[i] = a;
		}
	}

	printf("%d\n", dp[N - 1]);
	



	return (0);
}

Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstdlib>
using namespace std;

#define MAX 2000000

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

    int *A, *B;
    A = (int *) calloc(sizeof(int), n + 1);
    B = (int *) calloc(sizeof(int), n + 1);

    for(int i = 1; i <= n; i++) scanf("%d", &A[i]);

    int C[10001] = {0};
    for(int i = 1; i <= n; i++) C[A[i]]++;

    for(int i = 1; i < 10001; i++)
    {
        C[i] += C[i - 1];
    }

    for(int i = n; i >= 0; i--)
    {
        B[C[A[i]]] = A[i];
        C[A[i]]--;
    }

    for(int i = 1; i <= n; i++)
    {
        if(i - 1) cout << " ";
        cout << B[i];
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 18824
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int K,N;cin>>K>>N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec[i];
  }
  
  int big=0;
  for(int i=0;i<N-1;i++){
    big=max(big,vec[i+1]-vec[i]);
  }
  big=max(big,K-vec[N-1]+vec[0]);
  
  cout<<K-big<<endl;
}

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

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

typedef long long ll;

ll INF = 100000000000000;
ll MOD = 1e9+7;

int main(){
    string S;cin >> S;
    int N = S.size();
    vector<int> ans(N,0);
    ll cnt = 1;
    for(int i = 0;i < N-1;i++){
        if(S[i+1] == S[i] && S[i] == 'R'){
            cnt++;
        }else if(S[i] == 'R'){
            if(cnt % 2 == 0){
                ans[i] += cnt / 2;
                ans[i+1] += cnt / 2;
            }else{
                ans[i] += cnt / 2 + 1;
                ans[i+1] += cnt / 2;
            }
            cnt = 1;
        }
        if(i == N-2 && S[i+1] == S[i] && S[i] == 'R'){
            if(cnt % 2 == 0){
                ans[i] += cnt / 2;
                ans[i+1] += cnt / 2;
            }else{
                ans[i] += cnt / 2 + 1;
                ans[i+1] += cnt / 2;
            }
            cnt = 1;
        }
    }
    for(int i = N-1;i > 0;i--){
        if(S[i] == S[i-1] && S[i] == 'L'){
            cnt++;
        }else if(S[i] =='L'){
            if(cnt % 2 == 0){
                ans[i] += cnt / 2;
                ans[i-1] += cnt / 2;
            }else{
                ans[i] += cnt / 2 + 1;
                ans[i-1] += cnt / 2 ;
            }
            cnt = 1;
        }
        if(i == 1 && S[i] == S[i-1] && S[i] == 'L'){
            if(cnt % 2 == 0){
                ans[i] += cnt / 2;
                ans[i-1] += cnt / 2;
            }else{
                ans[i] += cnt / 2 + 1;
                ans[i-1] += cnt / 2;
            }
            cnt = 1;
        }
    }
    for(int i = 0;i < N;i++){
        cout << ans[i] << ' ';
    }
    cout << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,M,Q;
    cin >> N >> M >> Q;
    int cnt[501][501] = {};
    rep(i,0,M){
        int l,r;
        cin >> l >> r;
        l--,r--;
        rep(j,0,l+1){
            cnt[j][r]++;
        }
    }
    int accu[501][501] = {};
    rep(i,0,500){
        rep(j,0,500){
            accu[i][j+1] = accu[i][j] + cnt[i][j];
        }
    }
    rep(i,0,N+1)rep(j,0,N+1){
        //cout << accu[i][j] << " \n"[j==N];
    }
    rep(i,0,Q){
        int l,r;
        cin >> l >> r;
        cout << accu[l-1][r] << endl;
    }
}

Measured memory_bytes: 2944
import sys

try:
    import solve
except:
    from distutils.core import setup
    from distutils.extension import Extension
    from Cython.Distutils import build_ext
    from Cython.Build import cythonize

    if len(sys.argv) < 2:
        sys.argv.append("build_ext")
    else:
        sys.argv[1] = "build_ext"
    sys.argv.append("--inplace")

    with open(__file__) as f:
        with open('solve.pyx', 'w') as fw:
            while c := f.readline():
                if c.strip() == '"""':
                    nc = f.readline()
                    if nc.strip() == "solve.pyx":
                        while cc := f.readline():
                            if cc.strip() == '"""':
                                break
                            fw.write(cc)
    setup(
        name="my_module",
        ext_modules=cythonize(
            Extension("solve",
                      sources=["solve.pyx"],
                      extra_compile_args=["-O3"],
                      language="c++",
                      ),
            compiler_directives={'language_level': "3"}
        ),
        cmdclass={'build_ext': build_ext},
    )
    exit(0)

solve.main()

"""
solve.pyx
# distutils: language = c++
# cython: language_level=3, boundscheck=True
 
import sys
 
from libcpp.vector cimport vector
 
DEF MAX_N = 100100
DEF MAX_M = 100100
cdef vector[long] *g
cdef long memo[MAX_N]
 
 
cdef long f(long x):
    cdef long ret
    if memo[x] == -1:
        ret = 0
        for y in g[x]:
            ret = max(ret, f(y) + 1)
        memo[x] = ret
    return memo[x]
 
 
def resolve(in_):
    cdef long i
    global g
    cdef vector[long] _g[MAX_M]
    g = _g
    for i in range(MAX_N):
        memo[i] = -1
 
    _n, _m = next(in_).split()
    cdef int n, m
    n = int(_n)
    m = int(_m)
    for line in in_:
        _x, _y = line.split()
        g[int(_x) - 1].push_back(int(_y) - 1)
 
    cdef long ret = 0
    for i in range(n):
        ret = max(f(i), ret)
    return ret
 
 
def main():
    ans = resolve(sys.stdin.buffer)
    print(ans)
"""

Measured memory_bytes: 20608
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#pragma 03
using namespace std;
using namespace __gnu_pbds;
// chctxdy
int main(){
	ll a, b; cin >> a >> b;
	for (ll i = 10 * b; i < 10 * b + 10; i++){
		ll tax = (i * 8 / 100);
		if (tax == a){
			cout << i << endl; return 0;
		}
	}
	cout << -1 << endl; return 0;
}

Measured memory_bytes: 256
import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

h,w,m = (int(x) for x in input().split())
rows = [[0,i] for i in xrange(h)]
cols = [[0,i] for i in xrange(w)]
bomb_dict = dict()
for i in xrange(m):
    hi,wi = (int(x)-1 for x in input().split())
    rows[hi][0] += 1
    cols[wi][0] += 1
    bomb_dict[(hi,wi)] = True

rows = sorted(rows, reverse=True)
cols = sorted(cols, reverse=True)
# print(cols)
ans = 1
for row in rows:
    ans_ans = None
    for col in cols:
        getr = bomb_dict.get((row[1], col[1]), False)
        if getr and ans_ans is None:
            ans_ans = row[0] + col[0] - 1
            # print("1",row[0],col[0], -1)
            best_ans = ans_ans
        elif getr and row[0] + col[0]-1 < ans_ans:
            best_ans = ans_ans
            break
        elif getr:
            pass
        else:
            if ans_ans is None:
                best_ans = row[0] + col[0]
                # print("2",row,col, best_ans)
            else:
                best_ans = max(row[0] + col[0], ans_ans)
                # print("3",row[0],col[0])
            break
    if best_ans > ans:
        ans = best_ans
    if best_ans < ans:
        break
    
print(ans)


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

def main():
    n, t = map(int, input().split())
    ct = []
    for i in range(n):
        ci, ti = map(int, input().split())
        ct.append((ci, ti))

    ac = [ci for (ci, ti) in ct if ti <= t]
    if len(ac) == 0:
        print('TLE')
    else:
        print(min(ac))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
N = int(input())

L = list(map(int, input().split()))

L.sort()

ans = 0

if N >= 3 :
    for i in range(0, N - 1) :
        for j in range(1, N - 1 - i) :
            for k in range(2, N - i):
                if L[i] < L[i+j] < L[i+k] and L[i] + L[i+j] > L[i+k]:
                    ans += 1

print(ans)

Measured memory_bytes: 9072
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


def divisors(m: int):
    i = 1
    div = []
    while i * i <= m:
        if m % i == 0:
            div.append(i)
            div.append(m // i)
        i += 1

    return list(set(div))

n,m = li()

divs = divisors(m)
divs.sort(reverse=True)

ans = 1
for di in divs:
    if m // di >= n:
        ans = di
        break

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>

template<typename T> bool chmax(T &a,T b){
    if(a<b){
        a=b;
        return true;
    }
    return false;
}

template<typename T> bool chmin(T &a,T b){
    if(a>b){
        a=b;
        return true;
    }
    return false;
}

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=1001001000;
const ll LLMAX=1010010010010010000;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string S;
    cin>>S;
    
    string S2=S;
    
    ll ans1=0;
    for(ll i=1;i<S.size();i++){
        if(S[i]==S[i-1]){
            if(S[i]=='0')S[i]='1';
            else S[i]='0';
            ans1++;
        }
    }
    if(S2[0]=='0')S2[0]='1';
    else S2[0]='0';
    ll ans2=1;
    for(ll i=1;i<S2.size();i++){
        if(S2[i]==S2[i-1]){
            if(S2[i]=='0')S2[i]='1';
            else S2[i]='0';
            ans2++;
        }
    }
    cout<<min(ans1,ans2)<<endl;
    
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main()
{
    int a, b, c, d, e, k;
    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    scanf("%d", &d);
    scanf("%d", &e);
    scanf("%d", &k);
    if (e - a <= k)
        printf("Yay!\n");
    else
        printf(":(\n");
}

Measured memory_bytes: 128
import Data.Array
import Data.Array.ST
import Control.Monad.ST
import Control.Monad

type Edges = Array Int (Int,Int)
type Nodes = Array Int [Int]
type Graph = (Nodes,Edges)

edge_to_node::(Int,Int)->Edges->Nodes
edge_to_node (i,f) edges = runSTArray $ do
                        ar<-newArray (i,f) []
                        let (i_e,f_e) = bounds edges
                        forM_ [i_e..f_e] (\i-> do
                                              let (a,b) = edges!i
                                              e_a<-readArray ar a
                                              writeArray ar a (i:e_a)
                                              e_b<-readArray ar b
                                              writeArray ar b (i:e_b))
                        return ar


--ノード数、除外する辺id、グラフ、全探索できたらTrue
dfs_except_i::Int->Int->Graph->Bool
dfs_except_i n i graph =(and.elems) (runSTArray $ do
                        flags<-newArray (1,n) False　
                        rec_except_i graph i 1 flags
                        return flags)

--グラフ　除外辺、現在ノード、到達フラグアレイ、アクション
rec_except_i::Graph->Int->Int->STArray s Int Bool->ST s ()
rec_except_i (nodes,edges) i n flags =do
  b<-readArray flags n
  case b of
    True  -> return ()
    False -> do
      writeArray flags n True
      let neighbor_edges = filter (i/=) (nodes!n)
      let next_nodes = map (\(a,b)->if a==n then b else a) [edges!j|j<-neighbor_edges]
      forM_ next_nodes (\ m -> rec_except_i (nodes,edges) i m flags)


main::IO()
main=do
  nmc<-getLine
  let n:m:[]=map read (words nmc)
  ss<-forM [1..m] (\_ -> getLine)
  let edges = listArray (1,m) (map (\s->let a:b:[]= map read (words s)in (a,b)) ss)
  let nodes = edge_to_node (1,n) edges
  print (m-((length.(filter (\i ->(dfs_except_i n i (nodes,edges))))) [1..m]))

Measured memory_bytes: 1020