akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int N, W;
    cin >> N >> W;
    vector<int>Vs(N);
    vector<int>Ws(N);

    for (int i=0; i<N; i++){
        int vi, wi;
        cin >> vi >> wi;
        Vs[i] = vi;
        Ws[i] = wi;
    }

    vector<vector<int>>dp(N+1, vector<int>(W+1));

    dp[0][0] = 0;
    dp[0].resize(W+1,0);
    for(int i=0; i<N; i++){
        for(int j=0; j<=W; j++){
            int vi, wi;
            vi = Vs[i];
            wi = Ws[i];

            if (j-wi >= 0)dp[i+1][j] = max(dp[i][j], dp[i][j-wi] + vi);
            else {
                dp[i+1][j] = dp[i][j];
            }
        }
    }
    cout << dp[N][W] << endl;
}


Measured memory_bytes: 6848
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int>P;

int dp[301][90001][2];

ll mod_pow(ll a,ll b)
{
    a %= MOD;
    ll res = 1;
    while(b){
        if(b & 1){
            res = res * a % MOD;
        }
        a = a * a %MOD;
        b >>= 1;
    }
    return res;
}

ll add(ll x,ll y)
{
    return (x + y)%MOD;
}

ll sub(ll x,ll y)
{
    return (x+MOD-y)%MOD;
}

ll mult(ll x,ll y)
{
    return x*y%MOD;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int d;
    cin >> d;
    vector<int> l(d);
    rep(i,d){
        cin >> l[i];
    }
    int s;
    cin >> s;
    dp[0][s][0] = 1;
    rep(i,d){
        rep(j,s+1){
            if(j >= l[i]){
                dp[i+1][j-l[i]][1] = add(dp[i+1][j-l[i]][1],dp[i][j][0]);
                dp[i+1][j-l[i]][0] = add(dp[i+1][j-l[i]][0],dp[i][j][1]);
            }
            dp[i+1][j][0] = add(dp[i+1][j][0],dp[i][j][0]);
            dp[i+1][j][1] = add(dp[i+1][j][1],dp[i][j][1]);
        }
    }
    ll ans = 0;
    for(int i=1;i<=s;i++){
        ans = add(ans,mult(mod_pow(i,d),sub(dp[d][i][0],dp[d][i][1])));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 214096
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
const ll MOD = 1000000007;
using namespace std;

int main(int argc, char const *argv[])
{
    ll t1, t2;
    cin >> t1 >> t2;
    ll a1, a2, b1, b2;
    cin >> a1 >> a2;
    cin >> b1 >> b2;
    ll c1 = (a1 - b1) * t1;
    ll c2 = (a2 - b2) * t2;
    cerr << c1 << " " << c2 << endl;
    if (c1 + c2 == 0)
    {
        cout << "infinity" << endl;
        return 0;
    }

    ll ans = 0;
    if (c1 > 0)
    {
        c1 *= -1;
        c2 *= -1;
    }
    if (c1 + c2 < 0)
    {
        ans = 0;
    }
    else
    {
        cerr << "n" << endl;
        ll s = (-c1) / (c1 + c2);
        ll t = (-c1) % (c1 + c2);
        ans = s * 2 + (t == 0 ? 0 : 1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{

    int n;

    cin >>n;

    vector<long long int> happy(3,0);
    vector<long long int> nhappy(3,0);
    for (int i = 0; i < n; i++) {
        int a,b,c;
        cin >>a >>b >>c;
        nhappy[0] = max(happy[1]+a, happy[2]+a);
        nhappy[1] = max(happy[0]+b, happy[2]+b);
        nhappy[2] = max(happy[0]+c, happy[1]+c);

        happy = nhappy;
    }

    printf("%lld\n", max(max(happy[0], happy[1]),happy[2]));
    return 0;
}

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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

ll modpow(ll x, ll n, ll mod = MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

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

    vector<ll> a(n);
    map<ll, int> za;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (za.find(a[i]) == za.end()) {
            za[a[i]] = i;
        } else {
            cout << 0 << endl;
            return 0;
        }
    }

    vector<ll> b(m);
    map<ll, int> zb;
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        if (zb.find(b[i]) == zb.end()) {
            zb[b[i]] = i;
        } else {
            cout << 0 << endl;
            return 0;
        }
    }

    vector<int> useda(n, false), usedb(m, false);
    int cnta = 0, cntb = 0;
    int alla = 0, allb = 0;
    ll ans = 1;
    ll rest = 0;
    for (int i = n * m; i >= 1; i--) {
        bool fa = (za.find(i) != za.end());
        bool fb = (zb.find(i) != zb.end());
        if (fa && fb) {
            if (useda[za[i]] || usedb[zb[i]]) {
                cout << 0 << endl;
                return 0;
            }
            useda[za[i]] = true;
            usedb[zb[i]] = true;
            rest += cnta + cntb;
            cnta++;
            cntb++;
            alla++;
            allb++;
        } else if (fa) {
            if (useda[za[i]] || cnta == 0) {
                cout << 0 << endl;
                return 0;
            }
            (ans *= cnta) %= MOD;
            rest += cnta - 1;
            useda[za[i]] = true;
            alla++;
            cntb++;
        } else if (fb) {
            if (usedb[zb[i]] || cntb == 0) {
                cout << 0 << endl;
                return 0;
            }
            (ans *= cntb) %= MOD;
            rest += cntb - 1;
            usedb[zb[i]] = true;
            allb++;
            cnta++;
        } else {
            if (rest == 0) {
                cout << 0 << endl;
                return 0;
            }
            (ans *= rest) %= MOD;
            rest--;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
package main

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

//FOR I/O : STARTS
var Reader *bufio.Reader = bufio.NewReader(os.Stdin)
var Writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func Printf (f string, a ...interface{}) { fmt.Fprintf(Writer, f, a...) }
func Scanf (f string, a ...interface{}) { fmt.Fscanf(Reader, f, a...) }
func Println (a ...interface{}) { fmt.Fprintln(Writer, a...)}
func Scanln (a ...interface{}) { fmt.Fscanln(Reader, a...)}
//I/O ENDS HERE

func Abs(x int) int {
    if x < 0 {
        return -x
    }
    return x
}

func Min(x, y int) int {
    if x < y {
        return x
    } else {
        return y
    }
}

func Max(x, y int) int {
    if x >= y {
        return x
    } else {
        return y
    }
}

func Ceil(x, y int64) int64 {
    //returns x/y
    if x%y == 0 {
        return x/y
    } else {
        return int64(x/y)+1
    }
}

func main() {
    defer Writer.Flush()

    var n, m int
    Scanf("%d %d\n", &n, &m)

    heights := make([]int, n+5)
    var a, b int

    for i := 1; i <= n; i += 1 {
        Scanf("%d ", &heights[i])
    }

    adj := make([][]int, n+5)

    for i := 1; i <= m; i += 1 {
        Scanf("%d %d\n", &a, &b)
        adj[a] = append(adj[a], b)
        adj[b] = append(adj[b], a)
    }

    // Println(adj)

    cnt := 0

    for i := 1; i <= n; i += 1 {

        if len(adj[i]) == 0 {
            cnt += 1
        } else {
            flag := false
            for j := 0; j < len(adj[i]); j += 1 {
                if heights[i] <= heights[adj[i][j]] {
                    flag = true
                    break
                }
            }
            if !flag {
                cnt += 1
            }
        }
    }

    Println(cnt)
}


Measured memory_bytes: 11452
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    std::cin >> n;
    long long p=1;
    long long m=1000000007;
    for (int i = 1; i <= n; i++) {
        p=p*i%m;
    }
    std::cout << p << std::endl;
    
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i,j,k,n,m,l;
  long A[100][100]={},B[100][100]={},C[100][100]={};

  scanf("%d %d %d", &n, &m, &l);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%ld",&A[i][j]);
    }
  }
  for(i=0;i<m;i++){
    for(j=0;j<l;j++){
      scanf("%ld",&B[i][j]);
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      for(k=0;k<m;k++){
        C[i][j] += (A[i][k]*B[k][j]);
      }
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      printf("%ld",C[i][j]);
      if(j==l-1){
        printf("\n");
      }
      else{
        printf(" ");
      }
    }
  }

  return 0;
}


Measured memory_bytes: 2104
using AtCoderBeginnerContest126.Questions;
using AtCoderBeginnerContest126.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest126.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var nk = inputStream.ReadIntArray();
            var k = nk[1] - 1;
            var s = inputStream.ReadLine().ToCharArray();

            s[k] = (char)(s[k] + ('a' - 'A'));

            yield return string.Concat(s);
        }
    }
}


namespace AtCoderBeginnerContest126
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest126.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest126.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13268
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int cnt = 0;
		for(int i = 1; i <=n; i++) {
			int nn = String.valueOf(i).length();
			if(nn % 2 == 1) {
				cnt++;
			}
		}
		System.out.println(cnt);
		
		
	}

}


Measured memory_bytes: 28500
#define taskname "test"

#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long lli;
typedef pair<int, int> pii;
const int maxn = 3e5 + 5;
int n, m;
vector<int> to[maxn], divs[maxn];

int ans[maxn];

struct fenwick
{
    int val[maxn];

    void init()
    {
        fill(begin(val), end(val), 0);
    }

    void update(int x, int k)
    {
        for(; x < maxn; x += x & -x)
            val[x] += k;
    }

    int get(int x)
    {
        int res = 0;
        for(; x > 0; x -= x & -x)
            res += val[x];
        return res;
    }
} tree;

void read_input()
{
    cin >> n >> m;
    for(int i = 1; i <= n; ++i)
    {
        int l, r;
        cin >> l >> r;
        to[l].push_back(r);
    }
}

void init()
{
    for(int i = 1; i <= m; ++i)
        for(int j = i; j <= m; j += i)
            divs[j].push_back(i);
}

void solve()
{
    tree.init();
    for(int d = 1; d <= m; ++d)
    {
        for(auto&p: to[d])
            tree.update(p, 1);
        for(auto&x: divs[d])
            ans[x] += tree.get(min(d + x - 1, m)) - tree.get(d - 1);
    }

    for(int i = 1; i <= m; ++i)
        cout << ans[i] << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    init();
    solve();
}


Measured memory_bytes: 27520
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char ch;
    cin >> ch;
    if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') cout << "vowel" << endl;
    else cout << "consonant" << endl;
    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define pb push_back
#define eb emplace_back

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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

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

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    else return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    ll n,p;
    cin >> n >> p;
    vector<ll> a(n);
    Rep(i,n) cin >> a[i];
    vector<vector<ll>> dp(n+1,vector<ll>(2));
    dp[0][0] = 1;
    dp[0][1] = 0;
    Rep(i,n){
        if(a[i]%2==0){
            dp[i+1][0] = dp[i][0]*2;
            dp[i+1][1] = dp[i][1]*2;
        }
        else{
            dp[i+1][0] = dp[i][0] + dp[i][1];
            dp[i+1][1] = dp[i][0] + dp[i][1];
        }
    }
    cout << dp[n][p] << endl;
}


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

using namespace std;
#define int long long
#define mp make_pair
#define pb push_back


const int inf = 1e18;
const double EPS = 0.00000001;

signed main(){
    int n;
    cin >> n;
    int xx = 0;
    int nn = n;
    while(nn){
        xx++;
        nn /= 10;
    }
    int cnt = 0;
    vector<vector<int> > v(11,vector<int>(11));
    for(int i = 1;i<=n;i++){
        int a = i%10;
        int n1 = i;
        while(n1 > 9) n1 /= 10;
        int b = n1;
        v[a][b]++;
        cnt += v[b][a];
        v[a][b]++;
    }
    cout << cnt;
}


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

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

string s;
int n, k;

ll dp[111][4][2];

ll rec(int idx, int kx, int tight){
	if(idx >= n) return kx == k;
	if(kx > k) return 0;

	ll &res = dp[idx][kx][tight];
	if(res != -1) return res;

	res = 0;

	int mx = tight ? s[idx] - '0' : 9;

	for(int d = 0; d <= mx; ++d){
		res += rec(idx + 1, kx + (d != 0), tight & (d == (s[idx] - '0')));
	} 

	return res;
}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> s >> k;
	n = s.size();

	memset(dp, 0xff, sizeof dp);

	ll res = rec(0, 0, 1);
	
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	int cost[101][101];
	int tims[101][101];
	
	while(1){
		int n,m;
		cin>>n>>m;
		if(n==0){
			break;
		}
		for(int i=0;i<101;i++){
			for(int j=0;j<101;j++){
				cost[i][j]=tims[i][j]=210000000;
			}
		}
		
		for(int i=0;i<n;i++){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			cost[a][b]=cost[b][a]=c;
			tims[a][b]=tims[b][a]=d;
		}
		
				for(int k=1;k<=m;k++){
		for(int i=1;i<=m;i++){
			for(int j=1;j<=m;j++){
					cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
					tims[i][j]=min(tims[i][j],tims[i][k]+tims[k][j]);
				}
			}
		}
		
		int l;
		cin>>l;
		for(int i=0;i<l;i++){
			int a,b,c;
			cin>>a>>b>>c;
			if(c==0){
				printf("%d\n",cost[a][b]);
			}else{
				
				printf("%d\n",tims[a][b]);
			}
		}
	}
}

Measured memory_bytes: 952
n, m=map(int, input().split())
h=list(map(int, input().split()))

t=[0]*n

for i in range(m):
    a, b=map(int, input().split())

    t[a-1]=max(t[a-1], h[b-1])
    t[b-1]=max(t[b-1], h[a-1])

ans=0

for i in range(n):
    if h[i]>t[i]:
        ans+=1

print(ans)

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

int main(void) {
	int i;
	int x, a, b;
	char buf[128], *ch;

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, " ");
	x = atoi(ch);
	ch = strtok(NULL, " ");
	a = atoi(ch);
	ch = strtok(NULL, " ");
	b = atoi(ch);

	if(a >= b) {
		printf("delicious\n");
	} else if(a + x >= b) {
		printf("safe\n");
	} else {
		printf("dangerous\n");
	}


	return 0;
}


Measured memory_bytes: 2020
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,ans=0;
    scanf("%d",&n);
    for(int i=111;i<=999;i++)
    {
        int x=i;
        bool flag=true;
        while(x)
        {
            if(!(1<=x%10&&x%10<=n))
            {
                flag=false;
                break;
            }
            x/=10;
        }
        if(flag) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
s=input()
if s=='MON':
    print(6)
elif s=='TUE':
    print(5)
elif s=='WED':
    print(4)
elif s=='THU':
    print(3)
elif s=='FRI':
    print(2)
elif s=='SAT':
    print(1)
else:
    print(7)

Measured memory_bytes: 38384
from sys import stdin
from collections import deque
input = stdin.readline

# 自作dequeでは実行時間的に通らないので...

n = int(input())
d: deque = deque([])

for _ in range(n):
    command = input().split()

    if command[0] == "insert":
        x = int(command[1])
        d.appendleft(x)

    elif command[0] == "delete":
        x = int(command[1])
        if d.count(x):
            d.remove(x)

    elif command[0] == "deleteFirst":
        tmp = d.popleft()

    elif command[0] == "deleteLast":
        tmp = d.pop()

while d:
    tmp = d.popleft()

    if d:
        print(tmp, end=" ")
    else:
        print(tmp)



Measured memory_bytes: 45944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
namespace IO
{
	template <typename T> inline void read(T &x)
	{
		int f = 1; x = 0; char c = getchar();
		for (; !isdigit(c); c = getchar()) if (c == '-') f = -1;
		for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
		x *= f;
	}

	template <typename T> inline void chkmax(T &x, T y) { x = x > y ? x : y; }
	template <typename T> inline void chkmin(T &x, T y) { x = x < y ? x : y; }

	template <typename T> inline void write(T x)
	{
		if (x < 0) putchar('-'), x = -x;

		char num[20]; int len = 0;
		while (x > 9) { num[++len] = char(x % 10 + '0'); x /= 10; }

		num[++len] = char(x + '0');

		while (len) putchar(num[len--]);
	}
	template <typename T> inline void writeln(T x) { write(x); puts(""); }
}
using namespace IO;
const int N = 100;
ll n;
ll a[N];
inline ll f(int sum)
{
	ll ret = 0;
	int tot = 0;
	while (sum > 9) a[++tot] = 9, sum -= 9;
	a[++tot] = sum;
	for (int i = tot; i >= 1; i--)
	if (a[i])
	{
		for (int j = i; j >= 1; j--) ret = ret * 10 + a[j];
		return ret;
	}
	return 0;
}
int main(){
	read(n);
	int i;
	for (i = 1; i <= 200; i++) if (f(i) > n) break;
	writeln(i - 1);
  return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  string S;
  cin>>S;
  if(S=="ABC")cout<<"ARC"<<endl;
  if(S=="ARC")cout<<"ABC"<<endl;
  return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <string>

int main()
{
    std::string s;
    std::cin >> s;
    std::string hon = "24579";
    std::string pon = "0168";
    std::string bon = "3";
    char e = *(s.end()-1);
    if(hon.find(e) != std::string::npos)
        std::cout<< "hon";
    else if(pon.find(e) != std::string::npos)
        std::cout<< "pon";
    else
        std::cout<< "bon";
}


Measured memory_bytes: 3636
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

K, S = map(int, input().split())

ans = 0
for z in range(K+1):
    for y in range(K+1):
        x = S - (z + y)
        if x >= 0 and x <= K:
            ans += 1
print(ans)

Measured memory_bytes: 40684
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        final int N = Integer.parseInt(sc.next());
        final int M = Integer.parseInt(sc.next());
        int[] ar = new int[N];

        for (int i = 0; i < M; i++) {
            int a = Integer.parseInt(sc.next());
            int b = Integer.parseInt(sc.next());
            ar[a - 1]++;
            ar[b - 1]++;
        }
        
        for (int i = 0; i < N; i++) {
            out.println(ar[i]);
        }
        
        out.flush();
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* struct for mod Calculation*/
struct mint {
        ll x;
        mint(ll x = 0):x((x % mod + mod) % mod) {}
        mint operator-() const { return mint(-x); }
        mint& operator+=(const mint a) {
            if ((x += a.x) >= mod) x -= mod;
            return *this;
        }
        mint& operator-=(const mint a) {
            if ((x += mod - a.x) >= mod) x -= mod;
            return *this;
        }
        mint& operator*=(const mint a) {
            (x *= a.x) %= mod;
            return *this;
        }
        mint operator+(const mint a) const {
            mint res(*this);
            return res += a;
        }
        mint operator-(const mint a) const {
            mint res(*this);
            return res -= a;
        }
        mint operator*(const mint a) const {
            mint res(*this);
            return res *= a;
        }
        mint pow(ll t) const {
            if (!t) return 1;
            mint a = pow(t >> 1);
            a *= a;
            if (t & 1) a *= *this;
            return a;
        }
        // for prime mod
        mint inv() const {
            return pow(mod - 2);
        }
        mint& operator/=(const mint a) {
            return (*this) *= a.inv();
        }
        mint operator/(const mint a) const {
            mint res(*this);
            return res /= a;
        }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
/* global variables */
/* function */
/* main */
int main(){
    int n;
    cin >> n;
    vector<vector<mint>> dp(4, vector<mint>(n+1, 0));

    // init;
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        dp[3][i+1] += dp[3][i] * 10;
        // 0, 9
        dp[3][i+1] += dp[1][i] + dp[2][i];
        // 0 -> 0, 9 -> 9
        dp[1][i+1] += dp[1][i] * 9;
        dp[2][i+1] += dp[2][i] * 9;
        // non -> 0, non -> 9
        dp[1][i+1] += dp[0][i];
        dp[2][i+1] += dp[0][i];
        // non -> non
        dp[0][i+1] += dp[0][i] * 8;
    }
    cout << dp[3][n] << '\n';
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a, b) accumulate(all(a), b)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
typedef unsigned long long ull;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
ll const INF = 1e18;

template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    cin >> n;
    vector<ll> v(n);
    int minus = 0;
    REP(i, n){
        ll a;
        cin >> a;
        if(a < 0) minus++;
        v[i] = abs(a);
    }
    sort(all(v));
    if(minus%2 == 1) v[0] *= -1;
    cout << SUM(v, 0LL) << endl;
    return 0;
}


Measured memory_bytes: 1152
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    N = int(input())
    A = list(map(int, input().split()))
    suma = sum(A)
    A = Counter(A)
    Q = int(input())
    for _ in range(Q):
        b,c = map(int, input().split())
        suma -= A[b]*b
        suma += A[b]*c
        A[c] += A[b]
        A[b] = 0
        print(suma)

if __name__ == '__main__':
    main()


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

using namespace std;
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,k,h) for(int i = k; i < h; ++i)
#define rep3(i,k,h) for(int i = k; i <= h; ++i)
#define INF LLong_MAX // long long INF
#define inf INT_MAX // int inf

typedef pair<int,int> int_pair;
typedef pair<string,string> string_pair;

int main() {
    int n;
    cin >> n;
    map<string,int> mp;
    vector<string> st(210);
    rep(i,n) {
        string str;
        cin >> str;
        st.at(i) = str;
        mp[str] += 1;
    }
    int m;
    cin >> m;
    rep2(i,n,m+n) {
        string str;
        cin >> str;
        st.at(i) = str;
        mp[str] -= 1;
    }
    int ma = 0;
    rep(i,n+m) {
        ma = max(mp[st.at(i)], ma);
    }
    cout << ma << endl;
    return 0;
}


Measured memory_bytes: 256
from math import *


def f(deg):
  di = radians(90)
  turn = radians(deg)
  i = 1
  x = 0
  y = 1
  while not done(x, y):
    di += turn
    i += 1
    y += sin(di)
    x += cos(di)
    # print(x, y, i, di)
  return i


def done(x, y):
  return abs(x - 0) < 0.00001 and abs(y - 0) < 0.00001

print(f(int(input())))

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

int main(){
  int n;
  cin>>n;
  int tarous=0,hanakos=0;
  for(int i=0;i<n;i++){
    string tarou,hanako;
    cin>>tarou>>hanako;
    if(tarou>hanako){
      tarous+=3;
    }else if(tarou<hanako){
      hanakos+=3;
    }else{
      tarous++;
      hanakos++;
    }
  }
  cout<<tarous<<' '<<hanakos<<endl;
  return 0;
}


Measured memory_bytes: 3192
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>

using namespace std;

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

    string n;
    int k;
    cin >> n >> k;

    n += '0';
    reverse(n.begin(), n.end());

    int dp[n.length()][k+1][2];
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = dp[0][0][1] = 1;
    for (int i = 1; i < n.length(); i++) {
        for (int j = 0; j <= k; j++) {
            for (int x = 0; x <= (j == 0 ? 0 : 9); x++) {
                dp[i][j][0] += dp[i-1][j-!!x][0];
                if (x < n[i] - '0') {
                    dp[i][j][1] += dp[i-1][j-!!x][0];
                } else if (x == n[i] - '0') {
                    dp[i][j][1] += dp[i-1][j-!!x][1];
                }
            }
        }
    }

    cout << dp[n.length()-1][k][1];

    return 0;
}


Measured memory_bytes: 256
N,A,B = map(int,input().split())
H = [ int(input()) for i in range(N)]


def check(n):

    c = 0
    for i in range(N):
        a = H[i] - n*B
        if a > 0:
            c += (a//(A-B)) + 1

    if c <= n:
        return True
    else:
        return False


l,h = 0,10**20
for _ in range(200):
    m = ((l+h)*0.5)
    if check(m):
        h = m
    else:
        l = m
import math
print(math.ceil(m))


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

int main() {
    string S;
    cin >> S;

    map<char, int> letters;

    bool isDuplicated = false;
    rep(i, S.size()) {
        if(letters.count(S.at(i)) == 1) { // 2回目
            isDuplicated = true;
        } else {
            letters[S.at(i)] = 1;
        }
    }

    string ans = isDuplicated ? "no" : "yes";

    cout << ans << endl;

    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e17

ll h,w;
ll L;
string s[111];
char cs[]={'E','N','W','S'};
map<char,int> dir;

ll dist[111][111][5];

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

int main(){
	cin.sync_with_stdio(false);
  dir['E']=0; dir['N']=1; dir['W']=2; dir['S']=3;
  while(1){
    cin>>h>>w>>L;
    if(h==0)break;
    s[0]=s[h+1]="";
    rep(j,w+2){
      s[0]+='#';
      s[h+1]+='#';
    }
    repl(i,1,h+1){
      string ss;
      cin>>ss;
      s[i]='#'+ss+'#';
    }
    h+=2; w+=2;
    ll ni,nj,nd,nl=0;
    rep(i,h)rep(j,w){
      if(s[i][j]!='#'&&s[i][j]!='.'){
        ni=i; nj=j; nd=dir[s[i][j]];
      }
    }
    rep(i,111)rep(j,111)rep(k,5)dist[i][j][k]=INF;
    while(dist[ni][nj][nd]==INF&&L>0){
      //dbg(ni); dbg(nj); dbg(nd);
      //dbg(dist[ni][nj][nd]);
      dist[ni][nj][nd]=nl;
      ll ti=ni+dy[nd],tj=nj+dx[nd];
      if(s[ti][tj]=='#'){
        nd=(nd+3)%4;
      }else{
        ni=ti; nj=tj;
        nl++; L--;
      }
    }
    if(L==0){
      printf("%lld %lld %c\n", ni,nj,cs[nd]);
    }else{
      ll loop=nl-dist[ni][nj][nd];
      L%=loop;
      if(L==0)L=loop;
      //rep(i,111)rep(j,111)rep(k,5)dist[i][j][k]=INF;
      while(L>0){
        ll ti=ni+dy[nd],tj=nj+dx[nd];
        if(s[ti][tj]=='#'){
          nd=(nd+3)%4;
        }else{
          ni=ti; nj=tj;
          L--;
        }
      }
      printf("%lld %lld %c\n", ni,nj,cs[nd]);
    }
  }
  return 0;
}

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

using namespace std;
using ll = long long;

using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

const long long INF = 1LL<<60;
const int mod = 1000000007;

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

int N;
vector<vector<int>> E(100100, vector<int>());
vector<bool> used(100100, false);
vector<vector<ll>> dp(100100, vector<ll>(2, 0));

void rec(int x) {
    used.at(x) = true;
    ll b = 1, w = 1;

    for (int i = 0; i < E.at(x).size(); i++) {
        if (!used.at(E.at(x).at(i))) rec(E.at(x).at(i));
        if (dp.at(E.at(x).at(i)).at(0) == 0) continue;

        b *= dp.at(E.at(x).at(i)).at(1);
        b %= mod;
        w *= dp.at(E.at(x).at(i)).at(0) + dp.at(E.at(x).at(i)).at(1);
        w %= mod;

    }

    dp.at(x).at(0) = b;
    dp.at(x).at(1) = w;

    return;

}

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

    cin >> N;
    REP(i, N - 1) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        E.at(x).push_back(y);
        E.at(y).push_back(x);
    }

    rec(0);

    cout << (dp.at(0).at(0) + dp.at(0).at(1)) % mod << endl;
    
    return 0;
}

Measured memory_bytes: 19584
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds; 
using namespace std;
#define int long long
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define mii map<int,int>
#define mp make_pair
#define pb push_back
#define rep(i,b) for(ll (i)=0;i<(b);i++)
#define all(c) (c).begin(), (c).end()
#define F first
#define S second
#define CLR(p) memset(p, 0, sizeof(p))
#define SET(p) memset(p, -1, sizeof(p))
#define DEBUG true
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
//typedef long long int ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, 
tree_order_statistics_node_update> new_data_set; 
const int MAX=1e6+5;
#define MOD 1000000007
/*std::cout << std::fixed;
std::cout << std::setprecision(6);*/
//(a%mod-b%mod+mod)%mod



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


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

vector<vector<ll>>v;
ll T=0;
ll cnt1=0,cnt0=0;
vector<ll>dep;
bool visited[MAX];
vector<ll>par;
vector<ll>tin,tout;
vector<ll>col;

int countDivisibles(int A, int B, int M) 
{ 
    
    if (A % M == 0) 
        return (B / M) - (A / M) + 1; 
  
    // A is not divisible by M 
    return (B / M) - (A / M); 
} 







signed main(){
    int t=1;
    // cin>>t;
    while(t--){
        int x;
        cin>>x;
        for(int i=0;i<=200;i++){
            for(int j=-1000;j<=1000;j++){
                int a = pow(i,5);
                int b = pow(j,5);
                // cout<<a<<" "<<b<<" ## ";
                if(a-b==x){
                    cout<<i<<" "<<j<<endl;
                    return 0;
                }

            }
        }
    }
    return 0;
}


Measured memory_bytes: 4108
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeSet;

public class Main{
	public static void main(String[] args) throws IOException{
		Scanner in = new Scanner(System.in);
		while(true){
			int t = in.nextInt();
			int p = in.nextInt();
			int r = in.nextInt();
			if(t == 0) break;
			Team[] team = new Team[t];
			for(int i=0; i<t; i++)
				team[i] = new Team(i, p);
			for(int i=0; i<r; i++){
				int tid = in.nextInt()-1;
				int pid = in.nextInt()-1;
				int time = in.nextInt();
				String mes = in.next();
				if(mes.equals("CORRECT")){
					team[tid].solved++;
					team[tid].time += time + team[tid].prob[pid]*1200;
				}else{
					team[tid].prob[pid]++;
				}
			}
			Arrays.sort(team);
			for(int i=0; i<t; i++){
				System.out.println(team[i]);
			}
		}
	}
}

class Team implements Comparable<Team>{
	int id;
	int time;
	int solved;
	int[] prob;
	public Team(int id, int p){
		this.id = id;
		prob = new int[p];
	}
	
	@Override
	public int compareTo(Team o) {
		if(solved != o.solved) return o.solved-solved;
		if(time != o.time) return time - o.time;
		return id - o.id;
	}
	
	public String toString(){
		return (id+1)+" "+solved+" "+time;
	}
}

Measured memory_bytes: 61880
#include <iostream>
#include <vector>
#include <string>
#include <cstring>

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define MEMSET(v, s) memset(v, s, sizeof(v))

using namespace std;

vector<string> v;
const int MOD = 1e8 + 7;
int dp[10][10][60000][3];
int R, C;
int thr[11];

inline int get(int x, int pos){
	return x / thr[pos] % 3;
}

inline int ins(int x, int pos, int val){
	return x + (val - get(x, pos))*thr[pos];
}

int rec(int r, int c, int x, int left){
	if (r == R) return !x;
	if (c == C) return left?0:rec(r + 1, 0, x, 0);

	int &res = dp[r][c][x][left];
	if (res >= 0) return res;

	res = 0;
	if (v[r][c] == '.'){
		if (!(get(x, c) && left)) res = rec(r, c + 1, x, left);
	}
	else{
		int rest = v[r][c] - '0';
		rest -= get(x, c) + left;
		rep(right, 3){
			rep(down, 3){
				if (right + down != rest) continue;
				res += rec(r, c + 1, ins(x, c, down), right);
				res %= MOD;
			}
		}
	}

	return res;
}

int main(){
	thr[0] = 1;
	FOR(i, 1, 11) thr[i] = thr[i - 1] * 3;

	cin >> R >> C;
	v.resize(R);
	rep(i, R) cin >> v[i];

	MEMSET(dp, -1);
	cout << rec(0, 0, 0, 0) << endl;

	return 0;
}

Measured memory_bytes: 71536
s = input()
arr = [0]
for i in range(len(s)):
  if s[i] == '<':
    arr.append(arr[i]+1)
  else:
    arr.append(0)
#print(len(arr))
for i in reversed(range(len(s))):
  if s[i] == '>':
    arr[i] = max(arr[i],arr[i+1]+1)
print(sum(arr))

Measured memory_bytes: 24092
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



int main(){

    itn a,b;
    cin >> a >> b;

    rep(i,0,2000){
	if((int)(i*0.08) == a && (int)(i*0.1) == b){
	    P(i);
	    ret 0;
	}
    }
    P(-1);
    return  0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define Mp make_pair
#define pb push_back
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 1e6 + 100;
int n, a[N], b[N], val, ans, cnt[3];

int bao() {
    while(n) {
        for(int i = 1; i < n; i++) a[i] = abs(a[i + 1] - a[i]);
        n--;
    }
    printf("%d\n", a[1]);
    return 0;
}
int c(int n, int m) {
    return (n&m) == m;
}
int main(){
    // printf("%d\n", c(10, 1));
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%1d", &a[i]), a[i]--, cnt[a[i]]++;
    // if(n <= 100) return bao();
    if(cnt[1]) for(int i = 1; i <= n; i++) if(a[i] == 2) a[i] = 0;
    // for(int i = 1; i <= n; i++) printf("%d ", a[i]); puts("");
    for(int i = 1; i <= n; i++) if(a[i]) ans ^= c(n - 1, i - 1), val = a[i];
    printf("%d\n", val * ans);
    return 0;
}

Measured memory_bytes: 6144
dai=list(map(int,input().split()))
daini=list(map(int,input().split()))
def kouten():
	x=dai[0]
	dai[0]=dai[1]
	dai[1]=dai[5]
	dai[5]=dai[4]
	dai[4]=x
def sokuten():
	x=dai[0]
	dai[0]=dai[2]
	dai[2]=dai[5]
	dai[5]=dai[3]
	dai[3]=x

def tokei():
	dai1 = dai[1]
	dai[1] = dai[2]
	dai[2] = dai[4]
	dai[4] = dai[3]
	dai[3] = dai1
def check():
	for j in range(4):
		if daini[0] == dai[0] and daini[1] == dai[1] and daini[2] == dai[2] and daini[3] == dai[3] and daini[4] == dai[4] and daini[5] == dai[5]:
			print('Yes')
			return True
		tokei()
	return False
for a in range(3):
	if not check():
		kouten()
	else:
	 break
	if not check():
		sokuten()
	else:
		break
	if a==2:
		print('No')


Measured memory_bytes: 5608
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL


struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while( x != NIL){
    y = x;
    if(z->key < x->key){
      x =x->left;
    }else{
      x = x->right;
    }
  }
  z->parent = y;
  if(y == NIL){
    root = z;
  }else {
    if(z->key < y->key){
      y->left = z;
    }else{
      y->right = z;
    }
  }
}

void inorder(Node u){
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d",u->key );
  inorder(u->right);
}

void preorder(Node u){
  if(u == NIL) return;
  printf(" %d",u->key );
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n/*最初の入力数*/, i, x;
  char com[20];/*insert or print*/

  scanf("%d", &n);/*最初の入力数*/

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    
    if ( com[0] == 'i' ){

      scanf("%d", &x);/* insert */
      insert(x);

    } else if ( com[0] == 'p' ){

      inorder(root);
      printf("\n");

      preorder(root);
      printf("\n");

    }
  }

  return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

const ll INF = 1e15;

inline ld calc(ll vmax, ll vmin, ll vmax_r, ll vmin_r, ll vmax_l, ll vmin_l, ld t) {
    return max({(ld)vmax, vmax_r + t, vmax_l - t}) - min({(ld)vmin, vmin_r + t, vmin_l - t});
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> x(n), y(n);
    vector<char> d(n);

    ll xmax = -INF, xmin = INF, ymax = -INF, ymin = INF;
    ll ymax_u = -INF, ymin_u = INF, ymax_d = -INF, ymin_d = INF;
    ll xmax_l = -INF, xmin_l = INF, xmax_r = -INF, xmin_r = INF;
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> d[i];
        if (d[i] == 'U') {
            xmax = max(xmax, x[i]);
            xmin = min(xmin, x[i]);
            ymax_u = max(ymax_u, y[i]);
            ymin_u = min(ymin_u, y[i]);
        } else if (d[i] == 'D') {
            xmax = max(xmax, x[i]);
            xmin = min(xmin, x[i]);
            ymax_d = max(ymax_d, y[i]);
            ymin_d = min(ymin_d, y[i]);
        } else if (d[i] == 'L') {
            ymax = max(ymax, y[i]);
            ymin = min(ymin, y[i]);
            xmax_l = max(xmax_l, x[i]);
            xmin_l = min(xmin_l, x[i]);
        } else {
            ymax = max(ymax, y[i]);
            ymin = min(ymin, y[i]);
            xmax_r = max(xmax_r, x[i]);
            xmin_r = min(xmin_r, x[i]);
        }
    }

    ld ans = 1e50;
    for (int i = 0; i <= 200000000; i++) {
        ld t = (ld)i / 2;
        ld ansx = calc(xmax, xmin, xmax_r, xmin_r, xmax_l, xmin_l, t);
        ld ansy = calc(ymax, ymin, ymax_u, ymin_u, ymax_d, ymin_d, t);
        ans = min(ans, ansx * ansy);
    }

    cout << fixed << setprecision(15) << ans << "\n";
    return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,M; cin >> N >> M;
    int ans = 0;
    for(int i = 0; i<N; i++) ans +=i;
    for(int j = 0; j<M; j++) ans +=j;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256