akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair < int, int >
typedef vector<int> vi;
typedef   long long ll;
const int mod =1e9+7;
const int N = (int)2e5 + 5;

void solve(){
	int k;
	cin>>k;
	string s;
	cin>>s;
	if(k>=sz(s))cout<<s;
	else{
		//cout<<sz(s)<<"\n";
		for(int i=0;i<k;i++)cout<<s[i];
		cout<<"...";
	}	

}

int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 3548
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std ;

typedef long long LL ;

const int N = 500010 ;

int n ;
LL f[N][4] ;


int qr(){
    int r = 0, f = 1 ;
    char c = getchar() ;
    while (!isdigit(c)){
        if (c == '-') f = -f ;
        c = getchar() ;
    }
    while (isdigit(c)){
        r = r * 10 + c - 48 ;
        c = getchar() ;
    }
    return r * f ;
}
int main(){
    cin >> n ; int x ;
    f[0][1] = f[0][2] = -(1ll << 52) ;
    for (int i = 1 ; i <= n ; ++ i){
        x = qr() ;
        f[i][0] = x ;
        f[i][2] = x ;
        f[i][1] = -x ;
        f[i][2] += f[i - 1][2] ;
        f[i][1] += max(f[i - 1][1], f[i - 1][2]) ;
        f[i][0] += max(f[i - 1][1], f[i - 1][0]) ;
        if (x < 0){
            f[i][2] = max(f[i][2], f[i][1]) ;
            f[i][1] = max(f[i][1], f[i][0]) ;
        }
    }
    cout << max(f[n][1], max(f[n][0], f[n][2])) << endl  ;
    return 0 ;
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  int h,w;
  cin>>h>>w;
  int ch,cw,dh,dw;
  cin>>ch>>cw>>dh>>dw;
  ch--;cw--;dh--;dw--;
  char s[h][w];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>s[i][j];
    }
  }
  deque<int> memo1;
  memo1.push_back(ch);memo1.push_back(cw);
  int ans[h][w];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      ans[i][j]=-1;
    }
  }
  ans[ch][cw]=0;
  int dy[4]={1,0,-1,0},dx[4]={0,1,0,-1};
  while(!memo1.empty()){
    int y=memo1.front();memo1.pop_front();
    int x=memo1.front();memo1.pop_front();
    for(int i=0;i<4;i++){
      int ny=y+dy[i],nx=x+dx[i];
      if(ny<0 or ny>=h or nx<0 or nx>=w) continue;
      if(s[ny][nx]=='#') continue;
      if(ans[ny][nx]<0 or ans[ny][nx]>ans[y][x]){
        ans[ny][nx]=ans[y][x];
        memo1.push_front(nx);memo1.push_front(ny);
      }
    }
    for(int i=-2;i<=2;i++){
      for(int j=-2;j<=2;j++){
        int ny=y+i,nx=x+j;
        if(ny<0 or ny>=h or nx<0 or nx>=w) continue;
        if(s[ny][nx]=='#') continue;
        if(ans[ny][nx]<0){
          ans[ny][nx]=ans[y][x]+1;
          memo1.push_back(ny);memo1.push_back(nx);
        }
      }  
    }
  }
  cout<<ans[dh][dw]<<endl;
  return 0;
}


Measured memory_bytes: 8548
program main
implicit none
integer :: i, j, k
integer :: n, m
integer , allocatable :: x(:), t(:), p(:)

read(*,*) n
allocate( x(n) )
read(*,*) x
read(*,*) m
allocate( t(m), p(m) )
j = sum( x )
do i = 1, m
   read(*,*) t(i), p(i)
   k = t(i)
   write(*,'(i0)') j - x(k) + p(i)
end do


end program main


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
    int A;
    cin >> A;
    int S = A % 10;
    if(S == 3){
        cout << "bon" << endl;
    }
    else if(S == 0 || S == 1 || S == 6 || S == 8){
        cout << "pon" << endl;
    }
    else{
        cout << "hon" << endl;
    }
}


Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775808;

int main() {
    int N;
    cin >> N;
    string s;
    cin >> s;
    string ans = "";
    stack<string> st;
    for (int i = 0; i < N; i++) {
        if (s[i] == '(') {
            st.push("(");
        } else {
            if (st.empty()) {
                ans += "(";
            } else {
                st.pop();
            }
        }
    }
    ans += s;
    for (int i = 0; i < st.size(); i++) {
        ans += ")";
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#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>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

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

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


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

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 lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = 1e18+7;

constexpr int INF = 1e9+7;

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

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n);
    rep(i,0,n){
        cin >> a[i];
        a[i]--;
    }
    vector<int> c(n,0);
    c[0] = 1;
    int flag = 0;
    int ans = 0;
    while(true){
        flag = a[flag];
        ans++;
        if(c[flag]!=0){
            break;
        }
        if(flag==1){
            cout << ans << endl;
            return 0;
        }
        c[flag]++;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 998244353
#define inf 1e18 
 
using namespace std;
 
signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif
    
    IOS;
    int n;
    cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        if(i%3!=0&&i%5!=0)
        {
            sum+=i;
        }
    }
    cout<<sum;
}

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

int main() {
	int N, K;
	int h[100000] = {};
	int ninzuu = 0;
	cin>>N>>K;
	for (int i = 0; i < N; i++)
	{
		cin >> h[i];
	}
	for (int i = 0; i < N; i++)
	{
		if (h[i]>=K)
		{
			ninzuu++;
		}
	}
	cout<<ninzuu;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define REPR(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
const int INF = 1001001001;

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

using Graph = vector<vector<int> >;

int n;
vector<bool> seen;
vector<int> dist;
priority_queue<pair<int, int> > pq;

void dijkstra(const Graph &G, int v){
  seen[v] = true;

  rep(u, n){
    if(G[v][u] == -1) continue;
    if(seen[u] == true) continue;
    if(chmin(dist[u], dist[v]+G[v][u])) pq.push(make_pair((-1)*dist[u], u));
  }

  while(!pq.empty()){
    pair<int, int> tmp;
    tmp = pq.top();
    pq.pop();
    if(seen[tmp.second]) continue;
    int nv = tmp.second;
    dijkstra(G, nv);
  }

  return;
}

int main(){
  cin >> n;

  Graph G(n, vector<int>(n, -1));
  rep(i, n){
    int v, k; cin >> v >> k;
    rep(j, k){
      int u, c; cin >> u >> c;
      G[v][u] = c;
    }
  }

  seen.assign(n, false);
  dist.assign(n, INF);
  dist[0] = 0;
  dijkstra(G, 0);

  rep(i, n) cout << i << " " << dist[i] << endl;

  return 0;
}




Measured memory_bytes: 3216
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 
int main(){

    int A;
    cin >> A;
    int B;
    cin >> B;
    int C;
    cin >> C;


    cout << A*B/2;    

}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

#define UF_NUM 505050

li parent[UF_NUM];

inline void init_uf() {
    rep(i, UF_NUM)parent[i] = i;
}

inline li find(li x) {
    if (parent[x] == x)return x;
    else return (parent[x] = find(parent[x]));
}

inline void union_(li x, li y) {
    li parent_x = find(x);
    li parent_y = find(y);
    parent[parent_x] = parent_y;
}

li n;
PI xy[100100];

PI val[200200];

int main() {
    cin >> n;
    const li lim = 100000;
    init_uf();
    rin{
        cin >> xy[i].F >> xy[i].S;
        xy[i].F--;
        xy[i].S--;
        union_(xy[i].F, xy[i].S + lim);
    }

    set<li> st;
    rep(i, lim) {
        val[find(i)].F++;
        val[find(i + lim)].S++;
        st.insert(find(i));
        st.insert(find(i + lim));
    }

    li res = 0;
    for (auto && item : st) {
        res += val[item].F * val[item].S;
    }



    cout << res - n << endl;


    return 0;
}

Measured memory_bytes: 18304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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; }

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

    int H, W; cin >> H >> W;
    ves S(H); rep(i,H) cin >> S[i];
    int U[2005][2005],D[2005][2005], R[2005][2005], L[2005][2005];

    rep(i,H) rep(j,W) {
        if(S[i][j] == '#') U[i][j] = 0;
        else if(i == 0) U[i][j] = 1;
        else U[i][j] = U[i-1][j] + 1;
    } 

    for(int i = H-1; i >= 0; i--) rep(j,W) {
        if(S[i][j] == '#') D[i][j] = 0;
        else if(i == H-1) D[i][j] = 1;
        else D[i][j] = D[i+1][j] + 1;
    } 
    rep(i,H) rep(j,W) {
        if(S[i][j] == '#') L[i][j] = 0;
        else if(j == 0) L[i][j] = 1;
        else L[i][j] = L[i][j-1] + 1;
    } 
    rep(i,H) for(int j = W-1; j >= 0; j--) {
        if(S[i][j] == '#') R[i][j] = 0;
        else if(j == W-1) R[i][j] = 1;
        else R[i][j] = R[i][j+1] + 1;
    } 
    int ans = 0;
    rep(i,H) rep(j,W) {
        int temp = R[i][j] + L[i][j] + U[i][j] + D[i][j] - 3;
        ans = max(ans, temp);
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
    
    int a,b;
    while(1){
        scanf("%d %d",&a,&b);
        if(a>b)swap(a,b);
        if(a== 0 && b==0) break;
        else printf("%d %d\n",a,b);
        
    }
    
}


Measured memory_bytes: 3128
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
using namespace std;
int main(){
	int a = 0, b = 0, c, d[100000], e[100000], count = 0;
	char uc[100000];
	cin >> a>>b;
	if (a % 2 == 1 && b % 2 == 1) {
		cout << "Odd" << endl;
	}
	else {
		cout << "Even" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define all(x) x.begin(),x.end()
#define pb push_back
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define sll set<ll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define endl "\n"
const ll maxn = 1e6+2;

int main()
{
    fastio; //remove for interactive
    ll i, j, k, n, m, t;

    cin>>i>>j>>k>>m;

    cout<<max(max(j*m,i*k),max(i*m,j*k))<<endl;

    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a > b){
		printf("a > b\n");
	}else if(a < b){
		printf("a < b\n");
	}else{
		printf("a == b\n");
	}
}


Measured memory_bytes: 2580
#include<bits/stdc++.h>
#define For(i,n) for(int i =0;i<n;i++)
#define whatis(x) cerr<<#x<<" is: "<<x<<endl;
using namespace std;
typedef long long ll;

int main(){
    #ifdef magUNbos
    freopen("in" ,"r" ,stdin);
    freopen("out","w",stdout);
    #endif // magUNbos


    ll a[7];
    For(i,7)
    cin>>a[i];
    ll ans=0;
    if(a[0] && a[3] && a[4]){
        if(a[0]%2 +  a[3] %2 + a[4] %2 >1){
            ans+=3;
            a[0]--;
            a[3]--;
            a[4]--;
        }

    }
    ans+=a[0]-(a[0]%2);
    ans+=a[3]-(a[3]%2);
    ans+=a[4]-(a[4]%2);
    ans+=a[1];
    cout<<ans<<'\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;
 
int main()
{
    int N,T;
    cin >> N >> T;
    vector<int> t(N);
    ll ans = T;
    cin >> t[0];
    for(int i = 1; i < N; i++){
        cin >> t[i];
        if(t[i]-t[i-1] < T) ans += t[i]-t[i-1];
        else ans += T;
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
	int n,k;
	cin >> n >> k;
	string s;
	cin >> s;
	
	int res = 0;
	for(int i=0; i<n-1; i++){
		if(s[i]==s[i+1]) res++;
	}
	
	cout << min(n-1, res+2*k) << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <list>
#include <map>
using namespace std;

int main(void){
  int N;
  
  cin >> N;
  cout << (N*800 - (N/15)*200) << endl;
  return 0;
}


Measured memory_bytes: 256
io = STDIN
n=io.gets.to_i
ax=io.gets.split.map(&:to_i)
cnt,sum,r=0,0,0
ax.each_with_index do |a,l|
  while (r<n && sum+ax[r]==sum^ax[r])
    sum+=ax[r]
    r+=1
  end
  cnt+=r-l
  sum-=a
end
puts cnt


Measured memory_bytes: 15364
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int gcd(int a,int b){
  if(a<b) swap(a,b);
  if(b==0) return a;
  return gcd(b,a%b);
}

// kmp をやるための前計算
vector<int> makeTable(const string& s) {
    int n = s.size();
    vector<int> ret(n+1);
    ret[0] = -1;
    int j = -1;
    for (int i = 0; i < n; i++) {
        while (j >= 0 && s[i] != s[j]) j = ret[j];
        ret[i+1] = ++j;
    }
    return ret;
}

// str の中に word とマッチする場所のリストを返す
// ret のそれぞれの要素 el は, 「str[el] からの文字列が word と一致する」ことを示す
vector<int> kmp(const string & str, const string& word) {
    vector<int> table = makeTable(word), ret;
    int m = 0, i = 0, n = str.size();
    while (m+i < n) {
        if (word[i] == str[m+i]) {
            if (++i == (int)(word.size())) {
                ret.push_back(m);
                m = m+i-table[i];
                i = table[i];
            }
        } else {
            m = m+i-table[i];
            if (i > 0) i = table[i];
        }
    }
    return ret;
}

string s,s_,t;
int d[3000010];

void solve(){
  cin >> s_ >> t;
  while(s.length()<t.length()){
    s+=s_;
  }
  s+=s+s;
  //cout << s << " " << t << endl;
  vector<int> v_=kmp(s,t),v;
  if(v_.empty()){
    cout << 0 << endl;
    return;
  }
  int n=2*s.length()/3,sta=v_[0];
  for(int p:v_){
    if(p-sta>=n) break;
    v.push_back(p-sta);
  }
  int g=gcd(n,t.length());bool eta=true;int ans=0;
  for(int p:v){
    //cout << p << endl;
    if(p<t.length())d[p]=1;
    else d[p]=d[p-t.length()]+1;
    ans=max(ans,d[p]);
  }
  rep(i,n/g){
    if(d[i*g]==0) eta=false;
  }
  if(eta){
    cout << -1 << endl;
    return;
  }
  else{
    cout << ans << endl;
  }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

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

int main() {
	int n;
	cin >> n;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int b[n];
	for(int k=0;k<n;k++){
		b[k]=0;
	}
	
	for(int i=0;i<n-1;i++){
		b[a[i]-1]++;
	}
	
	for(int l=0;l<n;l++){
		cout<<b[l]<<endl;
	}
	return 0;
}

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


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //long s = Console.ReadLine();
        //long n = long.Parse(Console.ReadLine());
        long[] hw = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long h = hw[0];
        long w = hw[1];

        //分割方法は4パターン
        //初めに2パターン
        long s1 = 0;
        long s2 = 0;
        long s3 = 0;
        long h1 = 1;
        long max = 0;
        long min = 0;
        long ans = long.MaxValue;
        for (h1 = 1; h1 < h; h1++)
        {
            //残りの二つを横に分割するパターン
            s1 = h1 * w;
            s2 = (h - h1) / 2 * w;
            s3 = h * w - s1 - s2;
            max = Math.Max(Math.Max(s1, s2), s3);
            min = Math.Min(Math.Min(s1, s2), s3);
            ans = Math.Min(ans, max - min);

            //残りの二つを縦に分割するパターン
            s1 = h1 * w;
            s2 = (h - h1) * (long)Math.Floor((double)w / (double)2);
            s3 = h * w - s1 - s2;
            max = Math.Max(Math.Max(s1, s2), s3);
            min = Math.Min(Math.Min(s1, s2), s3);
            ans = Math.Min(ans, max - min);
        }

        long w1 = 1;
        for (w1 = 1; w1 < w; w1++)
        {
            //残りの二つを横に分割するパターン
            s1 = w1 * h;
            s2 = (w - w1) / 2 * h;
            s3 = h * w - s1 - s2;
            max = Math.Max(Math.Max(s1, s2), s3);
            min = Math.Min(Math.Min(s1, s2), s3);
            ans = Math.Min(ans, max - min);

            //残りの二つを縦に分割するパターン
            s1 = w1 * h;
            s2 = (w - w1) * (long)Math.Floor((double)h / (double)2);
            s3 = h * w - s1 - s2;
            max = Math.Max(Math.Max(s1, s2), s3);
            min = Math.Min(Math.Min(s1, s2), s3);
            ans = Math.Min(ans, max - min);
        }

        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13396
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let ab = read_vec::<i32>();
    let a = ab[0];
    let b = ab[1];

    let mut x = (b - 1) / (a - 1);
    let y = (b - 1) % (a - 1);
    if y != 0 {
        x += 1;
    }
    println!("{}", x);
}

Measured memory_bytes: 4352
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int t = sc.nextInt();

        System.out.println(t / a * b);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


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

c=0


for i in range(0,n):
	minj=i
	for j in range(i,n):
		if a[j] < a[minj]:
			minj=j
	if i != minj:
		c+=1
	a[i],a[minj]=a[minj],a[i]

print(*a)
print(c)



Measured memory_bytes: 5604
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M,X,Y;
  cin>>N>>M>>X>>Y;
  vector<int>x(N);
  vector<int>y(M);
  for(int i=0;i<N;i++){
    cin>>x.at(i);
  }
  for(int i=0;i<M;i++){
    cin>>y.at(i);
  }
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  int s;
  int t;
  s=x.at(N-1);
  t=y.at(0);
  if(s<t){
    bool frag=false;
    for(int i=X+1;i<Y+1;i++){
      if(s<i&&i<=t){
        frag=true;
      }
      else{
      }
    }
    if(frag==true){
      cout<<"No War"<<endl;
    }
    else{
      cout<<"War"<<endl;
    }
  }
  else{
    cout<<"War"<<endl;
  }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n;i>0;i--)
#define rep1(i,s,n) for(int i=s;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c) 
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;

int main(){
    int a,b;
    cin >> a >> b;
    if(a>9||b>9) cout << -1;
    else cout << a*b;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e16;
const double PI = 2 * asin(1);
typedef long long ll;

int main(){

  string S; cin >> S;

  vector <int> dx, dy;
  int now = 0; bool flag = true;
  for (int i = 0; i < S.length(); i++){
    if (S[i] == 'F'){
      now++;
    }

    if (S[i] == 'T' || i == S.length() - 1){
      if (flag == true){
        dx.push_back(now);
        flag = false;
      }else{
        dy.push_back(now);
        flag = true;
      }
      now = 0;
    }
  }
  
  int offset = S.length();

  bool DPX[dx.size() + 1][2 * offset + 1], DPY[dy.size() + 1][2 * offset + 1];
  
  for (int i = 0; i < dx.size() + 1; i++){
    for (int j = 0; j < 2 * offset + 1; j++){
      DPX[i][j] = false;
    }
  }
  DPX[0][0 + offset] = true;

  for (int i = 0; i < dx.size(); i++){
    for (int j = 0; j < 2 * offset + 1; j++){
      if (DPX[i][j] == true){
        DPX[i + 1][j + dx[i]] = true;

        if (i != 0 || S[0] == 'T'){
          DPX[i + 1][j - dx[i]] = true; 
        }
      }
    }
  }
  

  for (int i = 0; i < dy.size() + 1; i++){
    for (int j = 0; j < 2 * offset + 1; j++){
      DPY[i][j] = false;
    }
  }
  DPY[0][0 + offset] = true;

  for (int i = 0; i < dy.size(); i++){
    for (int j = 0; j < 2 * offset + 1; j++){
      if (DPY[i][j] == true){
        DPY[i + 1][j + dy[i]] = true;
        DPY[i + 1][j - dy[i]] = true;
      }
    }
  }
  
  int X, Y; cin >> X >> Y;
  if (DPX[dx.size()][offset + X] == true && DPY[dy.size()][offset + Y] == true){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  

  
  return 0;
}


Measured memory_bytes: 123264
import java.util.Scanner;
public class Main {
	 public static void main(String args[]){
		 Scanner std = new Scanner(System.in);
		 int n = std.nextInt();
		 int[] v = new int[n];
		 int[] c = new int[n];
 		 for (int i=0;i<n;i++) {
			 v[i] = std.nextInt();
		 }
		 for( int i=0;i<n;i++) {
			 c[i] = std.nextInt();
		 }
		 int count =0;
		 for( int i=0;i<n;i++) {
			 if(v[i]>c[i]) {
				 count += v[i]-c[i];
			 }
		 }
		 System.out.println(count);
	 }
}


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

vector<int> a, b, c;
int dp[100100100][3];
int main(){
    int N;
    cin >> N;
    a = b = c = vector<int>(N); 
    int ans;
    rep(i, N) cin >> a[i] >> b[i] >> c[i];
    rep(i,N){
	dp[i+1][0]=max(dp[i][1]+a[i],dp[i][2]+a[i]);
	dp[i+1][1]=max(dp[i][0]+b[i],dp[i][2]+b[i]);
	dp[i+1][2]=max(dp[i][0]+c[i],dp[i][1]+c[i]);
}
    ans=max(dp[N][0],max(dp[N][1],dp[N][2]));
    
    cout  << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define forn(i,n) for (int i=0; i<int(n); ++i)

void cxxio() {
    ios::sync_with_stdio(false);
    cin.tie(0);
}

int main() {
    cxxio();
    int n, k;
    cin>>n>>k;
    vi xs(n);
    forn(i, n) cin>>xs[i];
    forn(i, n-1) if (xs[i]+xs[i+1]>=k) {
        cout<<"Possible\n";
        for (int j=1; j<=i; j++)
            cout<<j<<'\n';
        for (int j=n-1; j>i+1; j--)
            cout<<j<<'\n';
        cout<<(i+1)<<'\n';
        return 0;
    }
    cout<<"Impossible\n";
}


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

#define int long long
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
using namespace std;

const unsigned int M = 1e9 + 7;

int32_t main() {
	fastio;

	int k, a, b;
	cin >> k >> a >> b;
	int flag = 0;
	for(int i = a; i <= b; ++i) {
		if(i % k == 0) {
			flag = 1;
			break;
		}
	}
	puts(flag ? "OK" : "NG");

	return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>

using namespace std;

const double EPS = 1e-9;

int arr[4];
double dp[305][305][305];
int n;

double solve(int a, int b, int c)
{
    if(a==0&&b==0&&c==0) return 0;
    if(dp[a][b][c]>0) return dp[a][b][c];
    else {
        double ans = n*1.0/(a+b+c);
        if(a) ans += 1.0*a/(a+b+c)*solve(a-1, b, c);
        if(b) ans += 1.0*b/(a+b+c)*solve(a+1, b-1, c);
        if(c) ans += 1.0*c/(a+b+c)*solve(a, b+1, c-1);
        return dp[a][b][c] = ans;
    }
}

int main()
{
    scanf("%d", &n);
    int t;
    for(int i=0;i<n;++i) {
        scanf("%d", &t);
        arr[t]++;
    }
    printf("%.9lf\n", solve(arr[1], arr[2], arr[3]));
    return 0;
}

Measured memory_bytes: 219392
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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 main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,K; cin >> N >> K;
    vector<int> V(N);
    rep(i,N) cin >> V[i];

    int ans = 0;
    for (int i = 0; i <= min(N,K); i++) {
        for (int j = 0; j <= min(N-i,K-i); j++) {
            priority_queue <int, vector<int>, greater<int>> pq;
            int val = 0;
            for (int k = 0; k < i; k++) {
                val += V[k];
                if (V[k] < 0) pq.emplace(V[k]);
            }
            for (int k = N-1; k > N-1-j; k--) {
                val += V[k];
                if (V[k] < 0) pq.emplace(V[k]);
            }
            int cnt = K-i-j;
            while (!pq.empty() && cnt > 0) {
                val -= pq.top(); pq.pop();
                cnt--;
            }
            chmax(ans,val);
        }
    }

    cout << ans << endl;
}

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

using namespace std;
using namespace __gnu_cxx;

#define all(v)   v.begin(), v.end()
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define START cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define isOdd(n)    (n&1)
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMN INT_MIN
#define IMX INT_MAX
#define pow(n, m) power((ll)n, (ll)m)
#define numOfDigits(n)  ((n)? (ll)(log10(n))+1 : 1)
#define mem(x, val)    memset(x, val, sizeof(x)) //be careful
#define sz(x)          (int) x.size()
#define var auto
#define MOD 1000000007


typedef long long ll;
typedef long double ld;
typedef double dd;
typedef pair<int, int> pii;

const int W = 1e5 + 1;
int main()
{
    START
    //freopen("test cases\\in.txt", "r", stdin) ;
    int n, cap; cin>>n>>cap;
    int v[n], w[n];
    for(int i = 0; i<n; i++)cin>>w[i]>>v[i];
    ll dp[n+1][cap+1];
    for(int i = 0; i<=n; i++){
        for(int weight = 0; weight<=cap; weight++){
            if(!i || !weight) dp[i][weight] = 0;

            else if(w[i-1]<=weight) dp[i][weight] = max(v[i-1] + dp[i-1][weight - w[i-1]], dp[i-1][weight]);

            else dp[i][weight] = dp[i-1][weight];
        }
    }
    cout<<dp[n][cap];
	return 0;
}


Measured memory_bytes: 79232
lst = []
for i in range(int(input())):
    S,P = input().split()
    lst.append([S,int(P),i])

sorted_point = sorted(lst,key = lambda x: x[1], reverse = True)
sorted_name = sorted(sorted_point,key = lambda x: x[0], reverse = False) 

for i in sorted_name:
    print(i[2] + 1)

Measured memory_bytes: 9176
s = input()

s = [c for c in s]

left = s[:len(s)//2]
right = s[len(s)//2+1:]

def check(s):
    left = []
    right = []
    while len(s)>1:
        left.append(s.pop(0))
        right.append(s.pop())

    if left==right:
        return True
    else:
        return False


if check(left)==True and check(right)==True and check(s)==True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args) {
	
		Scanner sc = new Scanner(System.in);
		char[] list = sc.next().toCharArray();

		Arrays.sort(list);

		boolean flg = true;

		for(int i = 0; i < list.length-1; i++ ){
			if(list[i] ==  list[i + 1]) {
				flg = false;
			}
		}

		if(flg) {
			System.out.print("yes");
		}else{
			System.out.print("no");
		}

	}
}

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

const int MAX = 200000;

int n, k;
double p[MAX];

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

    rep(i,n){
        cin >> p[i];
    }

    double sum = k;
    rep(i,k){
        sum += p[i];
    }
    
    double ans = sum;
    for(int i = 0; i < n - k; i++){
        sum += p[i + k];
        sum -= p[i];
        ans = max(sum, ans);
    }
    ans /= 2.0;

    printf("%lf\n", ans);
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
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;
}

int main()
{
    int N, K;
    cin >> N >> K;

    string S;
    cin >> S;

    S[K - 1] = S[K - 1] + 0x20;

    cout << S << endl;
    return 0;
}


Measured memory_bytes: 256
import std.stdio;
void main() {
	float w;
	while ("%f\n".readf(&w)) {
		auto s = w <= 48.00 ? "light fly"
			: w <= 51.00 ? "fly"
			: w <= 54.00 ? "bantam"
			: w <= 57.00 ? "feather"
			: w <= 60.00 ? "light"
			: w <= 64.00 ? "light welter"
			: w <= 69.00 ? "welter"
			: w <= 75.00 ? "light middle"
			: w <= 81.00 ? "middle"
			: w <= 91.00 ? "light heavy"
			: "heavy";
		s.writeln;
	}
}

Measured memory_bytes: 2456
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < sz(s); i++) {
        if (s[i] != s[sz(s) - 1 - i]) {
            ++ans;
        }
    }
    cout << (ans + 1) / 2 << '\n';
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    vector<int> v(n),c(n);
    rep(i,n) cin>>v[i];
    rep(i,n) cin>>c[i];
    int ans=0;
    rep(i,n){
        if(v[i]>=c[i]) ans+=v[i]-c[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  for (int i = 0; i <3; i++) {
    if (s.at(i) == '1') {
      s.at(i) = '9';
    }
    else s.at(i) = '1';
  }
  cout << s << endl;
}

Measured memory_bytes: 256
// stay fuckin hard -- Abhinav -IIITA
#include<bits/stdc++.h>
#define int long long
#define ld long double
using namespace std;
int mod=1e9;
int32_t main(){
	ld r; cin>>r;
	r*=2;
	ld pi=3.1415926535;
	r*=pi;
	cout<<r<<"\n";
	return 0;
}


Measured memory_bytes: 3788
use std::io::*;
use std::str::FromStr;
use std::process::exit;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
  let a: u32 = read();
  let b: u32 = read();

  for x in 0..1001 {
//    println!("x={:?}", x as f64 * 0.08);
//    println!("y={:?}", x as f64 * 0.1);
     if (x as f64 * 0.08).floor() == a as f64
       && (x as f64 * 0.1).floor() == b as f64 {
       println!("{:?}", x);
       exit(0)
     }
  }
  println!("{:?}", -1);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  // ここにプログラムを追記
  int a = 0, b = 0, c = 0;
  cin >> a >> b;
  c = 2*b - a;    //b = (a + c)/2
  cout << c << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N,X; cin>>N>>X;
    vector<int> L(N);
    int count=1;
    int kyo=0;
    for(int i=0;i<N;i++){
        cin>>L[i];
    }
    for(int i=0;i<N;i++){
        kyo=kyo+L[i];
        if(kyo<=X){
            count++;
        }
    }
    cout<<count;
    return 0;
}

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

int main() {
  long long a,count;
  count=0;
  cin>>a;
  for(int i=0;i<48;i++){
    if(a>=1){
      count=2*count+1;
      a/=2;
    }
    else break;
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(i=0; i<n; ++i)
#define xrep(i) for(; i; i&=-((i&-i)+1))
using namespace std;

int numofbits(long bits)
{
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

void xnumofbits(int k, int& sum, vector<int> hw){
  int l;
  xrep(k){
    l = numofbits((k&-k)-1);
    sum += hw[l];
  }
}

void xnumofbits2(int k, int l, int& sub, string s, vector<string> ss){
  int p,q,r;
  xrep(k){
    r = l;
    xrep(r){
      p = numofbits((k&-k)-1);
      q = numofbits((r&-r)-1);
      s = ss[p];
      if(s[q]=='#') ++sub;
    }
  }
}

int binarysearch(int H, int W, int K,string s,vector<string> ss,vector<int> sh,vector<int> sw, int count){
  int hb=(int)pow(2,H),wb=(int)pow(2,W);
  int i,j,k,l,sum,sub,score=0;
  rep(i,hb){
    rep(j,wb){
      sum = 0; sub = 0;
      k = i;
      xnumofbits(k,sum,sh);
      k = j;
      xnumofbits(k,sum,sw);
      k = i;
      l = j;
      xnumofbits2(k,l,sub,s,ss);
     if((count-(sum-sub))==K) ++score;
     }
  }
  return score;
}

int main(void){
  int H,W,K; cin >> H >> W >> K;
  string s;
  vector<string> ss(H);
  int i,j,count=0;
  vector<int> sh(H,0),sw(W,0);
  rep(i,H){
    cin >> s; ss[i]=s;
    rep(j,W) if(s[j]=='#') {++sh[i]; ++sw[j]; ++count;}
  }
  cout << binarysearch(H,W,K,s,ss,sh,sw,count) << endl;
  
  return 0;
}


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

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

using namespace std;




void one_case() {
    int n;
    cin >> n;
    vector<vector<int>> table(2, vector<int>(n));
    for (auto& row : table) {
        for (auto& el : row) {
            cin >> el;
        }
    }
    int t = table[0][0];
    int b = table[0][0] + table[1][0];
    for (int i = 1; i < n; ++i) {
        t += table[0][i];
        b = max(t, b) + table[1][i];
    }

    cout << b << "\n";
}


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


    int t = 1;
//    cin >> t;
    while (t--) {
        one_case();
    }

    return 0;
}


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

using namespace std;

class B {
	string s;
public:
	void solve()
	{
		cin >> s;

		do
		{
			s.pop_back();
			s.pop_back();
		} while (s.substr(0, s.size() / 2).compare(s.substr(s.size() / 2)) != 0);

		cout << s.size() << endl;
	}

};


int main()
{
	B solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fr first
#define sc scanf
#define pf printf
#define se second
#define sq(x) x * x
#define ll long long
#define pb push_back
#define mk make_pair
#define ld long double
#define pr pair<int,int>
#define sz(s) int(s.size())
#define piip pair< pair<ll,ll>,ll >
#define fin(s) freopen( s, "r", stdin )
#define fout(s) freopen( s, "w", stdout )
#define TIME ios_base::sync_with_stdio(0)
using namespace std;

const ll INF = 1e9;
const ll N = 2e2+7;
const ll mod = 1e9 + 7;
const long double eps = 1E-7;
ll a, b, n , cnt ,mx,ans,c;
ll used[ N ];
ld x , y;
string s;
char z;
int main()
{
        TIME;
        cin >> a >> z >> b >> z >> c;
        if( b>4 )
            cout<<"TBD";
        else
            cout<<"Heisei";
}


/* MADE BY
//________________________________________________________
//________________________________________________________ //
                                                           //
// ██╗   ██╗     ██████╗     ███████╗    ██╗    ███╗   ██╗ //
// ╚██╗ ██╔╝    ██╔═══██╗    ██╔════╝    ██║    ████╗  ██║ //
//  ╚████╔╝     ██║   ██║    ███████╗    ██║    ██╔██╗ ██║ //
//   ╚██╔╝      ██║   ██║    ╚════██║    ██║    ██║╚██╗██║ //
//    ██║       ╚██████╔╝    ███████║    ██║    ██║ ╚████║ //
//    ╚═╝        ╚═════╝     ╚══════╝    ╚═╝    ╚═╝  ╚═══╝ //
//________________________________________________________ //
//________________________________________________________ */


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

using namespace std;

int main()
{
	int n, ans = 1;
	vector<int> mochi;

	cin >> n;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		mochi.push_back(x);
	}

	sort(mochi.begin(), mochi.end());

	for (int i = 0; i < mochi.size() - 1; i++) {
		if (mochi[i] != mochi[i + 1]) {
			ans++;
		}
	}

	cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int H, A, i, X;
    scanf("%d %d", &H, &A);
    for(i=1;i<=H;i++)
    {
        X=i*A;
        if((H-X)<=0)
            break;
    }
    printf("%d", i);
    return 0;
}

Measured memory_bytes: 128
from heapq import heappush, heappop
while 1:
    n, m = map(int, raw_input().split())
    if n==m==0:
        break
    s, g = map(int, raw_input().split())
    G = [[] for i in xrange(n+1)]
    for i in xrange(m):
        x, y, d, c = map(int, raw_input().split())
        d = float(d)
        G[x].append((y, d, c))
        G[y].append((x, d, c))

    dist = {}
    # (cost, v, prev, speed)
    que = [(0, (s, -1, 1))]
    dist[s, -1, 1] = 0
    ans = 1e18
    while que:
        cost, key = heappop(que)
        if dist[key] < cost:
            continue
        v, prev, sp = key
        for t, d, c in G[v]:
            if t == prev or sp > c:
                continue
            n_cost = cost + d/sp
            for dv in [-1, 0, 1]:
                if not 0 < sp+dv <= 30:
                    continue
                n_key = (t, v, sp+dv)
                if n_cost < dist.get(n_key, 1e18):
                    dist[n_key] = n_cost
                    heappush(que, (n_cost, n_key))
            if t == g and sp==1:
                ans = min(ans, n_cost)
    print "%.10f" % ans if ans < 1e17 else "unreachable"

Measured memory_bytes: 13984
N,M = map(int,input().split())
X,Y,Z = [],[],[]
INF = -float('inf')
for i in range(N):
    x,y,z = map(int,input().split())
    X.append(x)
    Y.append(y)
    Z.append(z)
ans = 0
for a in range(-1,2,2):
    for b in range(-1,2,2):
        for c in range(-1,2,2):
            List = []
            for i in range(N):
                tmp = a*X[i]+b*Y[i]+c*Z[i]
                List.append(tmp)
            List.sort(reverse=True)
            ans = max(ans,sum(List[:M]))
print(ans)


Measured memory_bytes: 3188
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String S = sc.next();
    	long K = sc.nextLong();
    	int i = 0;
    	for (; i < S.length(); i++) {
    		if (S.charAt(i) == '1') {
    			continue;
    		} else {
    			break;
    		}
    	}
    	if (K <= i) {
    		System.out.println(1);
    	} else {
    		System.out.println(S.charAt(i));
    	}
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
 
using namespace std;
 
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
 
typedef vector<int> vi;
typedef pair<int,int> pii;
 
int main(void) {
  int i,j;
  int n,q;
  while(1){
    cin>>n>>q;
    if(n+q==0)break;
    vector<pair<pii,string> > p(n);
    rep(i,n){
      int a,b;
      cin>>p[i].second>>a>>b;
      p[i].first.first=b-a+1;
      p[i].first.second=b;
    }
    sort(all(p));
    rep(i,q){
      int y;
      cin>>y;
      rep(j,n)
    if(p[j].first.first<=y && y<=p[j].first.second){
      cout<<p[j].second<<" "<<y-p[j].first.first+1<<endl;
      break;
    }
      if(j==n)cout<<"Unknown"<<endl;
    }
  }
}

Measured memory_bytes: 3140