akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod


#include <bits/stdc++.h>
using namespace std;
signed main(){
    int N;
    string S;
    cin>>N>>S;
    int ans=1;
    REP(i,N-1){
        if(S[i]!=S[i+1]) ans ++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
package main

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

func main() {
	defer writer.Flush()
	n := ReadInt()
	adjL := make([][]int, n)
	for i := 0; i < n; i++ {
		adjL[i] = ReadInts(ReadInt())
	}
	// 親ノードへのダブリング
	parent := make([][]int, 20)
	for k := 0; k < 20; k++ {
		parent[k] = make([]int, n)
	}
	for i := 0; i < n; i++ {
		for _, v := range adjL[i] {
			parent[0][v] = i
		}
	}
	for k := 1; k < 20; k++ {
		for v := 1; v < n; v++ {
			parent[k][v] = parent[k-1][parent[k-1][v]]
		}
	}
	// n回上に辿った親ノード
	findNthParent := func(v int, n int) int {
		if n <= 0 {
			return v
		}
		for k := 0; k < 20; k++ {
			if n>>uint(k)&1 == 1 {
				v = parent[k][v]
			}
		}
		return v
	}

	// 各ノードの深さを調べる
	depth := make([]int, n)
	var dfs func(v int, d int)
	dfs = func(v int, d int) {
		depth[v] = d
		for _, u := range adjL[v] {
			dfs(u, d+1)
		}
	}
	dfs(0, 0)

	for q := ReadInt(); q > 0; q-- {
		u, v := ReadInt(), ReadInt()
		// u, v の高さを揃うまで親を辿る
		u = findNthParent(u, depth[u]-depth[v])
		v = findNthParent(v, depth[v]-depth[u])
		if u == v {
			Println(u)
			continue
		}
		// 共通の親を2分探索で見つける
		for k := 20 - 1; k >= 0; k-- {
			if parent[k][u] != parent[k][v] {
				u = parent[k][u]
				v = parent[k][v]
			}
		}
		Println(parent[0][u])
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}

var writer = bufio.NewWriter(os.Stdout)

func Println(a ...interface{}) { fmt.Fprintln(writer, a...) }



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

int main() {
	char a[10] = {}, b[10] = {};
	cin >> a >> b;
	if (a[1]==b[1]&&a[2] == b[0] && a[0] == b[2]) { cout << "YES" << endl; }
	else { cout << "NO" << endl; }
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int n; cin >> n;
  int c[n],s[9]={},sum=0;
  for(int i=0;i<n;i++){
    cin >> c[i];
    for(int j=0;j<8;j++){
      if(j*400<= c[i] && c[i] <= j*400+399) 
        s[j]++;
    }
    if(c[i]>=3200) s[8]++;
  }
  for(int i=0;i<8;i++){
    if(s[i]) sum++;
  }
  if(sum)
    cout << sum << " " << sum+s[8] << endl;
  else
    cout << 1 << " " << sum+s[8] << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#define pb push_back
#define mod 1000000007
using namespace std;
typedef long long int ll;

int main(void){
  int n;
  ll t,a;
  cin>>n;
  cin>>t>>a;
  ll x,y;
  for(int i=1;i<n;i++){
    cin>>x>>y;
    if(a*x==t*y) continue;
    else{
      ll tmp1,tmp2;
      tmp1=(t+x-1)/x;
      tmp2=(a+y-1)/y;
      if(tmp1>tmp2){
        ll ttt;
        ttt=tmp1;
        tmp1=tmp2;
        tmp2=ttt;
      }
      if(x*tmp1>=t && y*tmp1>=a){
        t=tmp1*x;
        a=tmp1*y;
      }
      else{
        t=tmp2*x;
        a=tmp2*y;
      }
    }
  }
  cout<<t+a<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int a[3][3]={0}, i, j, k;
    for(i=0; i<3; i++){
        for(j=0; j<3; j++){
            scanf("%d", &a[i][j]);
        }
    }
    int n, m;
    scanf("%d",&n);
    for(i=0; i<n; i++){
        scanf("%d",&m);
        for(j=0; j<3; j++){
            for(k=0; k<3; k++){
                if(a[j][k]==m){ a[j][k]=0; }
            }
        }
    }
    int flag=0;
    for(i=0; i<3; i++){
        if( a[i][0]==0 && a[i][1]==0 && a[i][2]==0 ){ flag=1; }
        if( a[0][i]==0 && a[1][i]==0 && a[2][i]==0 ){ flag=1; }
    }
    if( a[0][0]==0 && a[1][1]==0 && a[2][2]==0 ){ flag=1; }
    if( a[0][2]==0 && a[1][1]==0 && a[2][0]==0 ){ flag=1; }
 
    if( flag ){ printf("Yes\n"); }
    else      { printf("No\n");  }
    return 0;
}

Measured memory_bytes: 1596
#include <iostream>
//#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && a != c) {
        cout << "Yes" << endl;
    }
    else if(b == c && b!=a) {
        cout << "Yes" << endl;
    }
    else if (c == a && c!=b) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    int x[] = {4, 1, 4, 1, 2, 1, 2, 1};
    int p[8];
    while(cin >> p[0]) {
        rep(i,1,8) cin >> p[i];

        vector< pair<int ,string> > ans;

        rep(i,0,8) {
            int ret = 0;
            string a;
            rep(j,0,8) {
                ret += max(0, p[j] - x[(i+j) % 8]);
                a += to_string(x[(i+j) % 8]);
            }
            ans.push_back(pair<int ,string>(ret, a));
        }
        sort(ans.begin(), ans.end());

        rep(i,0,8) {
            if(i == 0) cout << ans[0].second[i];
            else cout << " " << ans[0].second[i];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3128
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <time.h>
#include <cmath>
#include <stdlib.h>
#define LL long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
#define ou(a) printf("%d\n",a)
#define pb push_back
#define pii pair<int,int>
#define mkp make_pair
#define IN freopen("in.txt","r",stdin);
#define OUT freopen("out.txt","w",stdout);
using namespace std;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int N=1e5+5;
int f[N<<1],H,W,A,B,inv[N<<1];
int fp(int x,int y){
  int ret = 1;
  while(y){
     if(y&1)ret = 1ll*ret*x%mod;
     x = 1ll*x*x%mod;
     y>>=1;
  }
  return ret;
}
int C(int x,int y){
  if(y>x)return 0;
  return 1ll*f[x]*inv[x-y]%mod*inv[y]%mod;
}
int main()
{
    scanf("%d%d%d%d",&H,&W,&A,&B);
    f[0] = 1;
    for(int i=1;i<=H+W+5;++i)f[i] = 1ll*i*f[i-1]%mod;
    inv[H+W] = fp(f[H+W],mod-2);
    inv[0]=inv[1] = 1;
    for(int i=H+W-1;i>1;--i){
        inv[i] = 1ll*(i+1)*inv[i+1]%mod;
    }
    int ret = 0;
    for(int i=B+1;i<=W;++i){
        int x = H-A,y = i;
        int t1 = C(x+y-2,x-1);
        int t2 = C(H-x-1+W-y,H-x-1);
        // printf("%d %d\n",t1,t2);
        // system("pause");
        ret += 1ll*t1*t2%mod;
        ret%=mod;
    }
    printf("%d\n",ret);
    return 0;
}


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

int main()
{
	int n, c[500], s[500], f[500], time[500];

	cin >> n;

	for (int i = 1; i < n; i++)
	{
		cin >> c[i] >> s[i] >> f[i];
		time[i] = 0;
	}

	for (int i = 1; i < n; i++)
	{
		for (int j = i; j < n; j++)
		{
			if (time[i] < s[j])
			{
				time[i] = s[j];
			}

			else if (time[i] % f[j] != 0)
			{
				time[i] = time[i] + f[j] - time[i] % f[j];
			}
			
			time[i] += c[j];
		}
	}

	for (int i = 1; i < n; i++)
	{
		cout << time[i] << endl;
	}

	cout << 0 << endl;
}

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

const int MAXN = 510;
typedef long long LL;
int n;
LL A[MAXN][MAXN], B[MAXN][MAXN], dp[MAXN][MAXN];
void getmin(LL & x, LL y) { x > y ? x = y : 0; }

int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n;
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j < i; ++j) std::cin >> B[j][i];
		for (int j = i + 1; j <= n; ++j) std::cin >> A[i][j];
	}
	memset(dp, 0x3f, sizeof dp);
	dp[0][0] = 0;
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j)
			A[i][j] += A[i][j - 1];
	for (int i = n; i; --i)
		for (int j = i + 1; j <= n; ++j)
			A[i][j] += A[i + 1][j];
	for (int i = 1; i <= n; ++i)
		for (int j = i; j <= n; ++j)
			B[i][j] += B[i - 1][j];
	for (int i = 0; i <= n; ++i)
		for (int j = i; j <= n; ++j) {
			LL tot = 0;
			for (int k = j + 1; k <= n; ++k) {
				tot += B[i][k];
				getmin(dp[j][k], dp[i][j] + A[j + 1][k] + tot);
			}
		}
	LL ans = 0x3f3f3f3f3f3f3f3fLL;
	for (int i = 1; i <= n; ++i) getmin(ans, dp[i][n]);
	std::cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 6272
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanRunes() []rune { return []rune(scanString()) }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	s := scanString()

	a := []rune{'S','S','W','W'}
	b := []rune{'S','W','S','W'}

	for i := 0; i < 4; i++ {
		ans := make([]rune, n+1)
		ans[0] = a[i]
		ans[1] = b[i]
		
		for j := 1; j < n; j++ {
			if s[j] == 'o' {
				if ans[j] == 'S' {
					ans[j+1] = ans[j-1]
				} else {
					if ans[j-1] == 'S' {
						ans[j+1] = 'W'
					} else {
						ans[j+1] = 'S'
					}
				}
			} else {
				if ans[j] == 'S' {
					if ans[j-1] == 'S' {
						ans[j+1] = 'W'
					} else {
						ans[j+1] = 'S'
					}
				} else {
					ans[j+1] = ans[j-1]
				}
			}
		}

		debug(string(ans[:n]))

		if ans[n] != ans[0] {
			continue
		}

		if ans[0] == 'S' {
			if s[0] == 'o' && ans[n-1] == ans[1] || s[0] == 'x' && ans[n-1] != ans[1] {
				fmt.Fprintln(wr, string(ans[:n]))
				return
			}
		} else {
			if s[0] == 'x' && ans[n-1] == ans[1] || s[0] == 'o' && ans[n-1] != ans[1] {
				fmt.Fprintln(wr, string(ans[:n]))
				return
			}
		}
	}

	fmt.Fprintln(wr, -1)

}


Measured memory_bytes: 3712
#include "bits/stdc++.h"
#include<cmath>

using namespace std;
typedef long long li;

const li mod = 998244353;

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

    li n;
    cin>>n;

    map <string, li> counts;
    for(int i = 0; i < n; ++i)
    {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        counts[s]++;
    }

    li ans = 0;
    for(auto& item : counts)
    {
        ans += item.second * (item.second - 1) / 2;
    }
    cout << ans << "\n";

    return 0;
}



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

int main() {

    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    int k,a,b;
    cin>>k>>a>>b;
    while(a <= b && a % k != 0) {
    	a++;
    }
    if(a <= b && a % k == 0)
    	cout<<"OK";
    else 
    	cout<<"NG";

	return 0;		
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

ll N, K;
vll A;
vvll par;

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  IN(N,K);
  A.resize(N);
  par.resize(N, vll(61, 0));
  REP(i,N){
    IN(A[i]);
    A[i]--;
    par[i][0] = A[i];
  }

  REP(i,60){
    REP(j,N){
      par[j][i+1] = par[par[j][i]][i];
    }
  }

  ll state = 0;
  ll dist = 0;
  while(K>0){
    if(K%2==1){
      state = par[state][dist];
    }
    K>>=1;
    dist++;
  }

  OUT(state+1);


  return 0;
}

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

int main(){
    string S,T;
    cin >> S >> T;
    vector<int>S2(26);
    vector<int>T2(26);
    for(int i = 0; i < S.size(); i++) {
        S2[S[i]-'a']++;
        T2[T[i]-'a']++;
    }
    sort(S2.begin(),S2.end());
    sort(T2.begin(),T2.end());
    for(int i = 0; i < 26; i++) {
        if(S2[i] != T2[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void solve(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  vector<int> v1={a+c,a+d,b+c,b+d};
  sort(all(v1));
  cout<<v1[0]<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3624
import sys
sys.setrecursionlimit(1000000)
import heapq
N,M,R=map(int,input().split())
r=list(map(int,input().split()))
abc=[[] for _ in range(N)]
for _ in range(M):
  a,b,c=map(int,input().split())
  abc[a-1].append([b,c])
  abc[b-1].append([a,c])

l=[]
for s in r:
  nseen=[i for i in r]
  dist=[float("inf")]*N
  dist[s-1]=0
  q=[[dist[i],i] for i in range(N)]
  heapq.heapify(q)
  while q:
    d,ind=heapq.heappop(q)
    if d<=dist[ind]:
      for n,c in abc[ind]:
        if dist[n-1]>d+c:
          dist[n-1]=d+c
          heapq.heappush(q,[dist[n-1],n-1])
  l.append(dist)

ans=float("inf")
seen=[]
dis=0
def dfs(pos):
  global dis
  global ans
  seen.append(pos)
  if len(seen)==R:
    ans=min(ans,dis)
  else:
    for i in r:
      if i not in seen:
        dis+=l[r.index(pos)][i-1]
        dfs(i)
        dis-=l[r.index(pos)][i-1]
  seen.remove(pos)

for i in r:
  dfs(i)
  
print(ans)

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

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) break;
        
        int s[1000], p[1000], q[1000], r[1000];
        rep(i, n) cin >> s[i] >> p[i] >> q[i] >> r[i];

        int P, Q, R, C;
        cin >> P >> Q >> R >> C;
        int cnt = 0;
        rep(i, n) {
            int cal = 4*p[i]+9*q[i]+4*r[i];
            if (p[i] <= P && q[i] <= Q && r[i] <= R && cal <= C) {
                cout << s[i] << endl;
                cnt++;
            }    
        }
        if (cnt == 0) cout << "NA" << endl;
    }

    return 0;
}


Measured memory_bytes: 3084
#include<iostream>
#include<cstring>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)cin>>a[i];
  while(k--){
    int b[n]={};
    int m=n*2;
    for(int i=0;i<n;i++){
      m=min(m,a[i]);
      b[max(0,i-a[i])]++;
      if(i+a[i]+1<n)b[i+a[i]+1]--;
    }
    if(m>=n)break;
    for(int i=0;i<n-1;i++)b[i+1]+=b[i];
    memcpy(a,b,sizeof(b));
  }
  for(int i=0;i<n;i++)cout<<a[i]<<' ';
}

Measured memory_bytes: 5156
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  ll N;
  cin >> N;
  if(N==2){
    cout << 1 << endl;
    return 0;
  }

  int ans=1;
  for(ll i=1;i*i<=N-1;i++){
    ll tmp=N-1;
    if(tmp%i==0){
      ans+=2;
      if(i==1 || i*i==tmp)  ans--;
    }
  }
  for(ll i=2;i*i<=N;i++){
    ll tmp=N;
    if(tmp%i!=0)  continue;
    while(tmp%i==0) tmp/=i;
    if(tmp%i==1)  ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

struct P {
    bool operator<(const P& p) const {
        return h > p.h;
    }
    int x, y, h;
};

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

    vector<P> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i].x >> p[i].y >> p[i].h;
    }
    sort(p.begin(), p.end());

    for (int x = 0; x <= 100; x++) {
        for (int y = 0; y <= 100; y++) {
            int h = -1;
            int b = 1;
            for (int i = 0; i < n; i++) {
                int t = p[i].h + abs(p[i].x - x) + abs(p[i].y - y);
                if (p[i].h == 0) {
                    //t以下の高さならよい
                    if (h > 0 && h > t) {
                        b = 0;
                        break;
                    }
                } else {
                    if (h < 0) h = t;
                    if (h != t) {
                        b = 0;
                        break;
                    }
                }
            }
            if (b) {
                cout << x << ' ' << y << ' ' << h << endl;
                exit(0);
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
static const int N=1000;

int lcs(string X, string Y) {
    int C[N+1][N+1];
    int m = X.size();
    int n = Y.size();
    int maxl=0;
    X = ' ' + X; // X[0]に空白を挿入
    Y = ' ' + Y;
    for (int i=0; i<=m; i++) C[i][0] = 0;
    for (int j=0; j<=n; j++) C[0][j] = 0;
    
    for (int i=1; i<=m; i++) {
        for (int j=1; j<=n; j++) {
            if (X[i] == Y[j]) {
                C[i][j] = C[i-1][j-1] + 1;
            } else {
                C[i][j] = max(C[i][j-1], C[i-1][j]);
            }
            maxl = max(maxl, C[i][j]);
        }
    }
    
    return maxl;
}

int main() {
    string s1, s2;
    int n;
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> s1 >> s2;
        cout << lcs(s1, s2) << endl;
    }
    
    return 0;
}


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


int main() {
  ll N, M;
  cin >> N >> M;
  int a;
  ll s = 0;
  rep(i, M) {
    cin >> a;
    s += a;
  }
  cout << max(N - s, (ll)-1) << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
typedef pair<char, int> P;

void print_line(vector<P> &line) {
    for (int i = 0; i < line.size(); i++) {
        cout << line[i].first << line[i].second;
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;
const int mod = 1000000007;


int main() {

    int n;
    cin >> n;
    vector<P> a(n);
    rep(i, n) cin >> a[i].first >> a[i].second;
    vector<P> b = a;
    vector<P> c = a;

    {
        // bubble
        for (int i = 0; i < n; i++) {
            for (int j = n - 1; j > i; j--) {
                if (b[j].second < b[j - 1].second) {
                    swap(b[j], b[j - 1]);
                }
            }
        }
        print_line(b);
    }

    cout << "Stable" << endl;


    {
        // bubble
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (c[j].second < c[minj].second) {
                    minj = j;
                }
            }
            swap(c[i], c[minj]);
        }
        print_line(c);
    }

    rep(i, n) {
        if (b[i] != c[i]) {
            cout << "Not stable" << endl;
            return 0;
        }
    }
    cout << "Stable" << endl;

}



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

int main(){
  int N;
  cin >> N;
  int n[N];
  int count;
  for(int i = 0; i<N; i++){
    cin >> n[i];}
  
  while(true){
    bool judge = false;
    
   for(int j =0; j<N; j++){
     if(n[j]%2!=0){judge = true;}
     }
    
    if(judge) break;
    
    for(int k = 0; k<N; k++){
      n[k] /=2;
    }
    
    count++;
  }
  
  
  cout << count;
}
     


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
# include <stdio.h>
#include <bits/stdc++.h>

const int maxn = 3e5 + 111;

using namespace std;        

const int mod = 1e9 + 7;



string s;
int ans = 1e9;
int main() {
    ios_base::sync_with_stdio(0);
    cin >> s;
    if(s[0] == '7' || s[0] == '3' || s[0] == '5') cout << "YES";
    else cout << "NO";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007LL
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(v) ((ll)v.size())
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pii pair<ll,ll> 
#define mod 1000000007
#define MAXN 300002
int dp[101][101];
int subsequenceCount(string S, string T)
{
   int i,j;
   for(i=0;i<=100;i++) for(j=0;j<=100;j++) dp[i][j]=(int)(j==0);
    dp[0][1]=(S[0]==T[0]);
   for(i=1;i<S.size();i++)
    for(j=1;j<=T.size();j++)
    {
      dp[i][j]=dp[i-1][j];
      if(S[i]==T[j-1])
        dp[i][j]+=dp[i-1][j-1];
    }

    return dp[S.size()-1][T.size()];
}

int main() {
       ios::sync_with_stdio(false);
       cin.tie(0);
       cout.tie(0);
       ll a,b,k;
       cin>>a>>b>>k;
       ll c=__gcd(a,b);
       for(ll j=c;j>0;j--)
       {
           if(c%j==0)
           {
            k--;
            if(k==0)
            {
              cout<<j;
              return 0;
            }
           }
       }
       return 0;

}

Measured memory_bytes: 256
#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 pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define int               long long
#define fr                first
#define sc                second
#define vc                vector
#define endl              '\n'
#define pii               pair<int,int>
#define msi               map<string,int>
#define mii               map<int,int>
#define psi               pair<string,int>
#define pis               pair<int,string>
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define LSB(i)            ((i)&-(i))

template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 1e5 + 5;
int a[N][4];
int n;
int dp[N][4];

int dynamin(int pos, int prev)
{
    if (pos > n)
        return 0;
    if (dp[pos][prev] != -1)
        return dp[pos][prev];
    int ans = INT_MIN;
    for (int i = 1; i <= 3; i++)
    {
        if (i != prev)
        {
            ans = max(ans, dynamin(pos + 1, i) + a[pos][i]);
        }
    }
    dp[pos][prev] = ans;
    return ans;
}

void solve()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i][1] >> a[i][2] >> a[i][3];
    }
    mem1(dp);
    cout << dynamin(0, 0);

}
signed main() {
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin>>t;
    while (t--) solve();
    return 0;
}

Measured memory_bytes: 12800
#include <iostream>
#include <queue>
#include <vector>

using namespace std;
using LL = long long;

class Solution {
public:
	/* time: O(n + q), space: O(n) */
	LL powerfulDiscountTickets(const vector<int>& items, int m) {
		priority_queue<int> candidates(items.begin(), items.end());

		for (int i = 0; i < m; ++i) {
			int item = candidates.top();
			candidates.pop(), candidates.push(item / 2);
		}

		LL ans = 0;
		while (!candidates.empty())
			ans += candidates.top(), candidates.pop();
		return ans;
	}
};

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

	vector<int> items(n);
	for (int i = 0; i < n; ++i)
		cin >> items[i];

	Solution sol;
	LL ans = sol.powerfulDiscountTickets(items, m);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include  <string>
#include <cmath>

using namespace std;

int main(){
  int a, b, k;
  cin >> k >> a >> b;
  string s = "NG";
  for (int i = a; i <= b; i++){
    if (i%k == 0){
      s = "OK";
    }
  }
  cout << s << "\n";
}

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

string ans, S, T;

void dfs(int i, int total, string T) {
  if (i == S.size()) {
    if (total == 7) ans = T + "=7";
    return;
  }
  
  dfs(i+1, total+S.at(i)-'0'  , T+'+'+S.at(i));
  dfs(i+1, total-(S.at(i)-'0'), T+'-'+S.at(i));
}

int main() {
  cin >> S;
  T = S.at(0);
  dfs(1, S[0]-'0', T);
  cout << ans << endl;
}

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

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

const int mod=1000000007;

vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}

int main(){
    auto p=prime_table(100000);
    int a[100001]={};
    rep(i,100001){
        if(p[i]){
            if(p[(i+1)/2]){
                a[i]++;
            }
        }
    }
    rep(i,100000)a[i+1]+=a[i];
    int q;
    cin>>q;
    rep(i,q){
        int l,r;
        cin>>l>>r;
        cout<<a[r]-a[l-1]<<endl;
    }
}

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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var nk = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var n = nk[0];
        var k = nk[1];

        Console.WriteLine(k == 1 ? 0 : n - k);
    }
}


Measured memory_bytes: 13268
//https://arc061.contest.atcoder.jp/tasks/arc061_a
#include<iostream>
#include<string>

using namespace std;

int main() {

    string S;

    cin >> S;
    int len = S.size();

    int op = len - 1;

    int a[len];
    for (int i = 0; i < len; i++) {
        a[i] = S[i] - '0';
    }

    //    +
    // 1 2 3 4 5 6 7 8 9
    // 0 1 2 3 4 5 6 7 8
    long long int ans = 0;
    for (int bit = 0; bit < (1<<op); bit++)
    {
        long long int sum = a[0];
        for (int i = 0; i < len-1; i++)
        {
            if (bit & (1 << i)) {
                ans += sum;
                sum = 0;
            }
            sum = sum * 10 + a[i + 1];
        }
        ans += sum;
    }
    cout << ans << endl;
}

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

using namespace std;

#define int long long
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define Endl '\n'
#define cont continue
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b/__gcd(a,b)
#define pb push_back
#define mp make_pair
#define mem(x) memset(x, 0, sizeof(x))

const ll inf=1e18;
const int mod=1e9+7;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
const int mxn = 2e5+10;

int Mod(int a) {
	return a%mod;
}
int Mul(int a, int b) {
	return Mod(Mod(a) * Mod(b));
}
int Add(int a, int b) {
	return Mod(Mod(a) + Mod(b));
}
//ll fact[mxn];
//ll in_fact[mxn];
//fact[0] = 1;
//for(ll i = 1; i < mxn; i++) {
	//fact[i] = (i*fact[i-1])%mod;
//}
//in_fact[mxn-1] = bigmod(fact[mxn-1],mod-2);
//for(ll i = mxn-2; i >= 0; i--) {
	//in_fact[i] = (in_fact[i+1] * (i+1))%mod;
//}
//ll c(ll n,ll r) {
	//ll ans = (fact[n] * (in_fact[r] * in_fact[n-r]%mod))%mod;
	//return ans;
//}

signed main(){
    fast;
	//freopen ("input.txt", "r", stdin);
	//freopen ("output.txt", "w", stdout);
    int tt = 1;
    //cin>>tt;
    for(int tc = 1; tc <= tt; tc++) {
        int n;
        cin>>n;
        int ten = 1,nin = 1,eig = 1;
        for(int i = 0; i < n; i++) {
			ten = Mul(ten,10);
			nin = Mul(nin,9);
			eig = Mul(eig,8);
		}
		nin = Mul(nin,2);
		int ans = Mod(ten - nin + eig + mod);
		cout<<ans<<endl;
		//nin = Mul(nin,2);
		//ten = ten-nin;
		//ten = Add(ten,eig);
		//cout<<ten<<endl;
		//cout<<ten-fck<<endl;
        
    }



return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sax(x) cout << "!!!!!!!!!!! " << #x << " = " << x << '\n'
#define inf (sizeof(int) == 4 ? (int)1E9 : (int)1E18)
#define one(x) x.insert(x.begin(), 0);
#define TCT template <class T>
#define TCT12 template <class T1, class T2>
#define IS istream
#define OS ostream
#define OP operator

//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,
//tree_order_statistics_node_update> imsi;

TCT IS& OP>>(IS &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
TCT OS& OP<<(OS &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const unordered_set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const unordered_multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT IS& OP>>(IS &I, deque<T>& v) {for (T &e: v) I >> e; return I;}
TCT OS& OP<<(OS &O, const deque<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, priority_queue<T> v) {while (!v.empty()) {O << v.top() << ' '; v.pop();} return O;}
TCT OS& OP<<(OS &O, stack<T> v) {while (!v.empty()) {O << v.top() << '\n'; v.pop();} return O;}
TCT OS& OP<<(OS &O, queue<T> v) {while (!v.empty()) {O << v.front() << ' '; v.pop();} return O;}
TCT12 IS& OP>>(IS &I, pair<T1,T2>& p) {return I >> p.first >> p.second;}
TCT12 OS& OP<<(OS &O, const pair<T1,T2>& p) {return O << '(' << p.first << ' ' << p.second << ')';}
TCT12 OS& OP<<(OS &O, const unordered_map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
TCT12 OS& OP<<(OS &O, const map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
typedef pair<int,int> pii;
typedef vector<int> vi;




int mas[200];
void _main() {
        int x, n; cin >> x >> n;
        while (n--) {
                int a; cin >> a;
                mas[a]++;
        }

        int a = 0;
        if (x == 100) a = 101;
        for (int i = -105; i <= 105; i++) {
                if (i < 0 || mas[i]) continue;
                if (abs(x - a) > abs(i - x)) a = i;
        }

        cout << a;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int N,A,B;
  cin >> N >> A >> B;
  int res1,res2;
  res1 = N * A;
  res2 = B;
  cout << min(res1, res2) << endl;
}


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

#define cinsc ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOR(i,n)  for(int i=0;i<n;i++)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

void  in_o(){
	cinsc;
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
}


int main(){
//	in_o();
	int a,b,x,y;
	cin>>a>>b;
	for(int i=1;i<10001;i++){
		x=i*8/100;
		y=i*10/100;
		if(x==a && y==b){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<vector>
#include<cmath>
#include<list>
#include<algorithm>

#define ll long long

using namespace std;

int main() {
	ll x;
	cin >> x;
	bool flag = false;
	for (int a = 0; a <= 120; ++a) {
		for (int b = -120; b <= a; ++b)
			if (pow(a, 5) - pow(b, 5) == x) {
				cout << a << " " << b << endl;
				flag = true;
				break;
			}
		if (flag) break;
	}
	return 0;
}

Measured memory_bytes: 4012
#include<iostream>
#include<string.h>
#include<ctype.h>
#include<string>
#include<math.h>
#define pi 3.141592653589
#include<iomanip>
#include<vector>
using namespace std;
#include<algorithm>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 1e9
#define LINF 1e17
#define ll long long
#define MOD (int)(1e9+7)

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


int main() {

	int a, b, c, m;

	cin >> a >> b >> c;
	m = max(a, max(b, c));
	if (m == a)cout << b + c << endl;
	else if (m == b)cout << a + c << endl;
	else cout << a + b << endl;

	return 0;
}

Measured memory_bytes: 256
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Tree = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n;
	cin >> n;
	Vec a(n+1), b(n+1), c(n+1);
	repn(i, n) cin >> a[i] >> b[i] >> c[i];

	VecVec dp(3, Vec(n+1, LINF));
	dp[0][0] = 0, dp[1][0] = 0, dp[2][0] = 0;
	repn(i, n){
		chmin(dp[0][i], max(dp[1][i-1]+a[i], dp[2][i-1]+a[i]));
		chmin(dp[1][i], max(dp[0][i-1]+b[i], dp[2][i-1]+b[i]));
		chmin(dp[2][i], max(dp[0][i-1]+c[i], dp[1][i-1]+c[i]));
	}
	co(max({dp[0][n], dp[1][n], dp[2][n]}));

	return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    string s,t="";
    cin >> s;
    for(ll i=s.size()-1;i>=0;i--){
        t+=s[i];
        if(t=="maerd" || t=="esare"){
            s.erase(i,5);
            t="";
        }
        else if(t=="remaerd"){
            s.erase(i,7);
            t="";
        }
        else if(t=="resare"){
            s.erase(i,6);
            t="";
        }
    }
    cout << (s.size()==0?"YES\n":"NO\n");
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
 
void solve() {
    string s;
    cin>>s;
    int n;
    cin>>n;
    list<char> l(s.begin(), s.end());
    bool isReversed = false;
    while(n--) {
        int x;
        cin>>x;
        if(x==1) isReversed=!isReversed;
        else {
            int f;
            char c;
            cin>>f>>c;
            if(f==1) isReversed ? l.push_back(c) : l.push_front(c);
            else isReversed ? l.push_front(c) : l.push_back(c);
        }
    }
    if(isReversed) l.reverse();
    string ans(l.begin(), l.end());
    cout<<ans;
}
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(10);
    cout<<fixed;
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
#endif
    solve();
    return 0;
}

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


int main(void){
	int N;
	cin >> N;
	vector<int> a(N+1,N);

	int cnt = 0;
	for(int i=0;i<N;i++){
		cin >> a[i];
		a[i]--;
		if( a[a[i]] == i )cnt++;
	}

	cout << cnt << endl;


	return 0;
}


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

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

if(a>=k)
cout<<k<<endl;

else if((a+b)>=k)
cout<<a<<endl;

else
cout<<(a+(k-(a+b))*(-1))<<endl;

return 0;}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string s;
    cin>>s;

    bool fa=false;
    bool fb=false;
    bool fc=false;
    for(int i=0;i<3;i++){
        if(s[i]=='a'){
            fa=true;
        }
        else if(s[i]=='b'){
            fb=true;
        }
        else
            fc=true;
    }

    cout<<((fa==true)&&(fb==true)&&(fc==true)? "Yes" : "No")<<endl;

    return 0;
}


Measured memory_bytes: 256
import sys
from collections import Counter

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  # applies to only numbers
rs = lambda: stdin.readline().rstrip()  # ignores trailing space

N = ri()
A = rl()
A.sort(reverse=True)
c = Counter(A)
answer = 0
for x in A:
    target = (1 << x.bit_length()) - x
    while c[x] > 0:
        c[x] -= 1
        if c[target] > 0:
            c[target] -= 1
            answer += 1

print(answer)


Measured memory_bytes: 33416
//考虑每个机器人清与不清 
#include <bits/stdc++.h>
#include <stack>
using namespace std;
typedef long long ll;
const int maxn=100005;
const int mod=998244353;
const ll inf=0x3f3f3f3f3f3f3f3f;
struct zb
{
	ll st;
	ll go;
}a[200005];
struct kc
{
	int pos;
	ll ns;
};
ll dp[200005];
int cmp(zb A,zb B)
{
	return A.st<B.st;
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&a[i].st,&a[i].go);
	}
	sort(a+1,a+n+1,cmp);
	dp[n+1]=1;       //清最后末尾值,即不操作机器人 
	stack <kc> s;
	kc k;
	k.ns=inf;
	k.pos=n+1;
	s.push(k);
	for(int i=n;i;i--)
	{
		while((s.top()).ns<a[i].st+a[i].go)
		{
			s.pop();
		}
		int res=(s.top()).pos;      //dp[i]代表考虑到dp[i]会产生的可能数
		dp[i]=dp[res];            // 若清理i,会产生其清理不到的第一个i(res)的可能值,即dp[res] 
		dp[i]=(dp[i]+dp[i+1])%mod;   //结果包括清理i与不清理i,dp[i+1]表示不清理值,dp[i]表示清理值 
		kc k2;
		k2.pos=i;
		k2.ns=a[i].st;
		s.push(k2);
	}
	printf("%lld\n",dp[1]);
	return 0;
}

Measured memory_bytes: 6528