akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>

using namespace std;
using namespace placeholders;

using LL = long long;
using ULL = unsigned long long;
using VI = vector< int >;
using VVI = vector< vector< int > >;
using VS = vector< string >;
using SS = stringstream;
using PII = pair< int, int >;
using VPII = vector< pair< int, int > >;
template < typename T = int > using VT = vector< T >;
template < typename T = int > using VVT = vector< vector< T > >;
template < typename T = int > using LIM = numeric_limits< T >;

template < typename T > inline istream& operator>>( istream &s, vector< T > &v ){ for ( T &t : v ) { s >> t; } return s; }
template < typename T > inline ostream& operator<<( ostream &s, const vector< T > &v ){ for ( int i = 0; i < int( v.size() ); ++i ){ s << ( " " + !i ) << v[i]; } return s; }
template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define REP2( i, n ) REP3( i, 0, n )
#define REP3( i, m, n ) for ( int i = ( int )( m ); i < ( int )( n ); ++i )
#define GET_REP( a, b, c, F, ... ) F
#define REP( ... ) GET_REP( __VA_ARGS__, REP3, REP2 )( __VA_ARGS__ )
#define FOR( e, c ) for ( auto &&e : c )
#define ALL( c ) begin( c ), end( c )
#define AALL( a, t ) ( t* )a, ( t* )a + sizeof( a ) / sizeof( t )
#define DRANGE( c, p ) ( c ).begin(), ( c ).begin() + ( p ), ( c ).end()

#define SZ( v ) ( (int)( v ).size() )
#define EXIST( c, e ) ( ( c ).find( e ) != ( c ).end() )

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

#define PB push_back
#define EM emplace
#define EB emplace_back
#define BI back_inserter

#define MP make_pair
#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

bool ok( const VI &forbidden, int n )
{
	for ( ; n; n /= 10 )
	{
		if ( forbidden[ n % 10 ] )
		{
			return false;
		}
	}
	return true;
}

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

	int N, K;
	cin >> N >> K;

	VI forbidden( 10 );
	REP( _, K )
	{
		int d;
		cin >> d;
		forbidden[d] = 1;
	}

	REP( i, N, 999999999 )
	{
		if ( ok( forbidden, i ) )
		{
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
n=gets.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
c=gets.split.map(&:to_i)
s=b[0]
for i in 1..n-1 do
  if a[i]==a[i-1]+1 then
    s+=c[a[i-1]-1]
  end
  s+=b[i]
  
end
p s

Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;int*t,n,m,d,i,s[99999];main(){for(;cin>>d>>n>>m,s[i=n]=d;cout<<i<<'\n'){for(;--i;)cin>>s[i];for(sort(s,s+n);m--;t=upper_bound(s,s+n,d),i+=min(*t-d,d-t[-1]))cin>>d;}}

Measured memory_bytes: 0
import scala.io.StdIn

import scala.annotation.tailrec

object Main extends App {
  val s = StdIn.readLine

  def check(str:String):Boolean = {
    val len = str.length
    if((len&1) == 0) str.substring(0,len/2) == str.substring(len/2)
    else false
  }

  @tailrec
  def rec(cnt:Int, ss:String):Int = {
    if(check(ss)) cnt
    else rec(cnt-1,ss.init)
  }

  val ans = rec(s.length-1,s.init)
  println(ans)
}

Measured memory_bytes: 27304
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
constexpr auto INF = 1000000000;

int main() {
	ll n;
	cin >> n;
	vector<ll> x(n), y(n), h(n);
	FOR(i, n)cin >> x[i] >> y[i] >> h[i];
	ll top;
	eFOR(i, 100)eFOR(j, 100) {
		FOR(k, n) {
			if (h[k] != 0) {
				top = h[k] + abs(x[k] - i) + abs(y[k] - j);
				break;
			}
		}
		if (top < 1)continue;
		bool f = 1;
		FOR(k, n) {
			ll a = top - abs(x[k] - i) - abs(y[k] - j);
			if (a < 0)a = 0;
			if (h[k] != a ) {
				f = 0;
			}
		}
		if (f) {
			cout << i << " " << j << " " << top;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#include<queue>
#include<tuple>
#include<stdio.h>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int a[9], b[9];
	rep(i, 9){
		cin>>a[i];
		b[i]=0;
	}
	int n;
	cin>>n;
	int c[n];
	rep(i, n){
		cin>>c[i];
		rep(j, 9){
			if(c[i]==a[j]){
				b[j]=1;
			}
		}
	}
	bool f=0;
	rep(i, 3){
		if(b[i*3]==1 && b[i*3+1] == 1 && b[i*3+2] == 1)
			f=1;
		if(b[i] == 1 && b[i+3] == 1 && b[i+6] == 1)
			f=1;
	}
	if(b[0]==1 && b[4]==1 && b[8]==1)
		f=1;
	if(b[2]==1 && b[4]==1 && b[6]==1)
		f=1;
	
	if(f==1)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab.sort(reverse = True)
count = 0
ans = 0
while count < m:
  l = ab.pop()
  for i in range(l[1]):
    count += 1
    ans += l[0]
    if count == m:
      break
print(ans)

Measured memory_bytes: 27880
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        TreeSet<Integer> orSet = new TreeSet<>();
        ArrayList<Integer> andList = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            orSet.add(sc.nextInt());
        }
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt();
            if (orSet.contains(x)) {
                andList.add(x);
            } else {
                orSet.add(x);
            }
        }
        StringBuilder sb = new StringBuilder();
        sb.append(andList.size()).append(" ").append(orSet.size()).append("\n");
        for (int x : andList) {
            sb.append(x).append("\n");
        }
        for (int x : orSet) {
            sb.append(x).append("\n");
        }
        System.out.print(sb);
    }
}


Measured memory_bytes: 122856
// Author : Rifayat Samee (Sanzee)
// Problem :
// Algorithm:

/*

*/
#include <bits/stdc++.h>
using namespace std;
#define maxval 100005
int V[maxval][3];
int main(){

	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        int a,b,c;
        scanf("%d %d %d",&V[i][0],&V[i][1],&V[i][2]);
    }
    int dp[n+5][3];
    for(int i=0;i<n;i++){
        dp[0][0] = V[0][0];
        dp[0][1] = V[0][1];
        dp[0][2] = V[0][2];
    }

    for(int i = 1;i<n;i++){
        dp[i][0] = max(dp[i-1][1] + V[i][0],dp[i-1][2] + V[i][0]);
        dp[i][1] = max(dp[i-1][0] + V[i][1],dp[i-1][2] + V[i][1]);
        dp[i][2] = max(dp[i-1][0] + V[i][2],dp[i-1][1] + V[i][2]);
    }
    int res = max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 2560
n= input()
n = int(n)
nums= input().split()
#map(int,input().split())
state = 1
for i in range(n):
    if int(nums[i]) &1 == 0 :
        if int(nums[i])%3 ==0 or int(nums[i])%5 ==0:
            continue
        else:
            state= 0
            #print("DENIED")
            break
if state == 1:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
char s[105];
char t[105];
int flag;
int cmp(char a,char b,int i){
	if(flag) return 0;
	if(i==strlen(t)){
		flag=1;
		cout<<"No"<<endl;
		return 0;
	}
	if(i==strlen(s)&&i!=strlen(t)){
		flag=1;
		cout<<"Yes"<<endl;
		return 0;
	}
	if(a>b){
		cout<<"No"<<endl;
		flag=1;
		return 0;
	}
	if(a<b){
		cout<<"Yes"<<endl;
		flag=1;
		return 0;
	}
	if(a==b) cmp(s[i+1],t[i+1],i+1);
	return 0;
}
int main(){
	cin>>s;
	cin>>t;
	sort(s,s+strlen(s));
	sort(t,t+strlen(t));
	reverse(t,t+strlen(t));
	cmp(s[0],t[0],0);
	return 0;
} 

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

int main(){
  int M,N,C,success=0,s=0,i,j;
  cin >> N >> M >> C;
  int B[M];
  for(i=0;i<M;i++){
    cin >> B[i];
  }
  int A[N][M];
  for(i=0;i<N;i++){
    for(j=0;j<M;j++){
      cin >> A[i][j];
    }
  }
  for(i=0;i<N;i++){
    for(j=0;j<M;j++){
      s += A[i][j]*B[j]; 
    }
    if(s + C > 0){
      success++;
    }
    s=0;
  }
  cout << success << endl;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

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


def f():
    h,w,n = list(map(int, input().split()))
    t = collections.defaultdict(int)
    for _ in range(n):
        a,b = list(map(int, input().split()))
        for i in range(3):
            if a+i < 3 or a+i > h:
                continue
            ai = (a+i) * inf
            for j in range(3):
                if b+j < 3 or b+j > w:
                    continue
                t[ai+b+j] += 1
    r = [0] * 10
    for v  in t.values():
        r[v] += 1
    r[0] = (h-2)*(w-2) - len(t)
    return "\n".join(map(str,r))

print(f())


Measured memory_bytes: 107040
#include <iostream>
#include <cmath>

using namespace std;

int main(){
    int N;
	cin >> N;
    int F[N][10];
	for(int i = 0; i < N; i++){
		for(int j = 0; j < 10; j++){
			cin >> F[i][j];
		}
	}
    int P[N][11];
	for(int i = 0; i < N; i++){
		for(int j = 0; j < 11; j++){
			cin >> P[i][j];
		}
	}


	int ans = INT32_MIN;
    int c;
    int r;
	for(int bit = 1; bit < (1<<10); bit++){
		r = 0;
		for(int i = 0; i < N; i++){
			c = 0;
			for(int j = 0; j < 10; j++){
				if(((bit>>j) & 1) && F[i][j]){
                    c++;
                }
			}
			r += P[i][c];
		}
        ans = max(ans, r);
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = Integer.parseInt(sc.next());
		int H = Integer.parseInt(sc.next());
		int[] spcs = new int[N];
		int maxAtk = 0;
		for (int i = 0; i < N; i++) {
			maxAtk = Math.max(maxAtk, Integer.parseInt(sc.next()));
			spcs[i] = Integer.parseInt(sc.next());
		}
		Arrays.sort(spcs);
		int l = -1;
		int r = spcs.length;
		while (r - l > 1) {
			int mid = (l + r) / 2;
			if (spcs[mid] >= maxAtk) r = mid;
			else l = mid;
		}
		long sum = 0;
		int i = N - 1;
		for (; i >= r && sum < H; i--) {
			sum += spcs[i];
		}
		System.out.println((N - i - 1) + -Math.floorDiv(-Math.max(H - sum, 0), maxAtk));
	}
}

class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

Measured memory_bytes: 50480
#include <stdio.h>
#include <set>

using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)

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

    set<int> d;
    REP(i, N) {
        int j = 0;
        scanf("%d", &j);
        d.insert(j);
    }

    printf("%lu\n", d.size());
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

using namespace std;

bool is_prime[1000000];
int prime[1000000];

void init_prime()
{
	int n = sizeof(prime)/sizeof(prime[0]);
	int i;

	memset(is_prime, 1, sizeof(is_prime));
	is_prime[0] = is_prime[1] = false;
	prime[0] = prime[1] = 0;
	for (i=2; i<n; i++) {
		prime[i] = prime[i-1];
		if (is_prime[i]) {
			prime[i]++;
			int j;
			for (j=i+i; j<n; j+=i)
				is_prime[j] = false;

		}
	}
}

int main()
{
	//freopen("in.txt", "r", stdin);

	init_prime();
	int a;

	while (scanf("%d", &a)==1) {
		printf("%d\n", prime[a]);

	}

	return 0;
}

Measured memory_bytes: 5912
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
int n;
vector <pii> G[N];
ll dis[N];
void dfs(int u, int fa)
{
	for(auto it : G[u])
	{
		int v = it.first, w = it.second;
		if(v==fa) continue;
		dis[v] = dis[u] + w;
		dfs(v, u);
	}
}
void solve()
{
	cin >> n;
	for(int i=1; i<n; i++)
	{
		int u, v, w;
		cin >> u >> v >> w;
		G[u].pb(mp(v, w));
		G[v].pb(mp(u, w));
	}
	dfs(1, 0);
	for(int i=1; i<=n; i++)
		cout << dis[i]%2 << '\n';
}
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	solve();
	return 0;
}


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

int main() {
	
	int n,m,x;
	cin >> n >> m >> x;
	int i,j,a[m+1],s=x;
	int costS=0,costE=0;
	
    for(int i=0;i<m;++i)cin>>a[i];
    
	for(i=0;i<n;++i){
	    s++;
	    for(j=0;j<m;++j){
	        if(s==a[j])costE++;
	    }
	    if(s==n)break;
	}
	
	
	
	for(i=0;i<n;++i){
	    x--;
	    for(j=0;j<m;++j){
	        if(x==a[j])costS++;
	    }
	    if(x==0)break;
	}
	
	
	int ans=min(costS,costE);
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 256
#include <numeric>
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
using namespace std;
#define int long long
#define inf 1000000007
#define rep(i,j,n) for(int i=j;i<n;i++)
typedef pair<int,int>  P;
double pi = 3.141592653589793;
//使うやつはここから下に置こうな
signed main(){
    int n;cin>>n;
    int a[114514],b[114514];
    rep(i,0,n)cin>>a[i]>>b[i];
    reverse(a,a+n),reverse(b,b+n);
    int ans=0;
    rep(i,0,n){
        a[i]+=ans;
        if(a[i]%b[i]==0)continue;
        ans+=b[i]-(a[i]%b[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main()
{
    char input_ch = 0;;
    char pair_ch = 0;;

    if(scanf("%c", &input_ch) != 1){
        return 0;
    }

    switch(input_ch){
        case 'A':
            pair_ch = 'T';
            break;
        case 'T':
            pair_ch = 'A';
            break;
        case 'C':
            pair_ch = 'G';
            break;
        case 'G':
            pair_ch = 'C';
            break;
        default:
        break;
    }

    printf("%c\n", pair_ch);

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_s(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

#define MOD 1000000007

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

  map<ll, ll> primes;

  double sqrtNum = sqrt(n);
  // 素因数分解
  for (int i = 2; i <= sqrtNum; i += 1) {
    while(n % i == 0) {
      primes[i]++;
      n /= i;
    }
  }
  if (n > 1) {
    primes[n]++;
  }

  ll ans = 0;
  for (auto itr = primes.begin(); itr != primes.end(); itr++) {
    for (int i = 1; itr->second >= i; i++) {
      ans++;
      itr->second -= i;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3624
use proconio::fastout;
use proconio::input;
use std::i64;

#[fastout]
fn main() {
    input! {
        n: usize, m: usize, x: u32,
        cas: [(u32, [u32; m]); n],
    }
    let mut ans = i64::MAX;
    for i in 1..4096 {
        let mut total = 0;
        let mut skills = vec![0; m];
        for (j, (c, an)) in cas.iter().enumerate() {
            if (i >> j) & 1 == 1 {
                total += c;
                for (l, a) in an.iter().enumerate() {
                    skills[l] += a;
                }
            }
        }
        if skills.iter().all(|&y| y >= x) {
            ans = ans.min(total as i64);
        }
    }
    println!("{}", if ans == i64::MAX { -1 } else { ans });
}


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

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

using namespace std;

void solve(){
	int n; cin>>n;
	vector<unsigned long long> a(n);
	rep(i,n) cin>>a[i];
	string s; cin>>s;

	vector<unsigned long long> B;
	for(int i=n-1;i>=0;i--){
		auto v=a[i];
		for(auto b:B) v=min(v,v^b);
		if(v!=0){
			if(s[i]=='1'){
				puts("1");
				return;
			}
			B.emplace_back(v);
		}
	}
	puts("0");
}

int main(){
	int q; scanf("%d",&q); rep(_,q) solve();
	return 0;
}


Measured memory_bytes: 3608
class Diff_m:
  def __init__(self):
    m1 = list(map(int,(input().split(' '))))
    m2 = list(map(int,(input().split(' '))))
    self.m1, self.m2 = m1[0], m2[0]
  
  def diff_m(self):
    if self.m2 == self.m1 + 1 or self.m1 - self.m2 == 11:
      print(1)
    else:
      print(0)
      
solve = Diff_m()
solve.diff_m()

Measured memory_bytes: 3060
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

ll nCm(ll n, ll m){
    if(m == 0 || m == n){
        return 1;
    } else if(m == 1){
        return n;
    }
    return (nCm(n - 1, m) + nCm(n - 1, m - 1));
}

//-----------------------ここから-----------

int g[55][55] = {0};
int n, m;
int counter = 1;
int ans = 0;
int visited[55] = {0};

void dfs(int now){
    for(int i = 1; i <= n; i++){
        if(g[now][i] == 1){
            if(visited[i] == 1)continue;
            counter++;
            visited[i] = 1;
            dfs(i);
        }
    }
}

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

    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        g[a][b] = 1;
        g[b][a] = 1;
    }

    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            if(i >= j)continue;
            if(g[i][j] != 1) continue;
            g[i][j] = 0;
            g[j][i] = 0;
            for(int k = 0; k < 55; k++){
                visited[k] = 0;
            }
            counter = 0;
            dfs(i);
            g[i][j] = 1;
            g[j][i] = 1;
            if(counter == n)continue;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };



signed main() {
	ll a, b;

	cin >> a >> b;

	ll sum = 1, cnt = 0;

	while (sum < b)
	{
		sum += a;
		sum--;
		cnt++;
	}

	cout << cnt << endl;


	return 0;
}

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

int main() {
  int N;
  cin >> N;
  map<string, int> MA;
  int mx = 0;
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    mx = max(mx, ++MA[S]);
  }
  for (auto ma : MA) if (ma.second == mx) cout << ma.first << "\n"; 
}

Measured memory_bytes: 25216
#include  <stdio.h>
int min(int x, int y) {
	return x < y ? x : y;
}

int main() {
	int i;
	int N;
	int B[100001];
	int ans = 0;

	scanf("%d", &N);
	for (i = 0; i < N - 1; i++) {
		scanf("%d", &B[i]);
	}

	for (i = 0; i < N; i++) {
		if (i == 0) {
			ans += B[i];
		} else if (i == N - 1) {
			ans += B[i - 1];
		} else {
			ans += min(B[i - 1], B[i]);
		}
	}

	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 128
#include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
// #include <unordered_map>
// #include <unordered_set>
#include <utility>
#include <vector>

#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))

#ifdef ONLINE_JUDGE
#define link renamelink
#define next renamenext
#define prev renameprev
#endif

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef long double ld;

inline void EnableFileIO(const string& fileName, bool local = 0) {
  if (fileName.empty()) return;
  if (local) {
    freopen((fileName + ".in").c_str(), "r", stdin);
    freopen((fileName + ".out").c_str(), "w", stdout);
    return;
  }
#ifdef ONLINE_JUDGE
  freopen((fileName + ".in").c_str(), "r", stdin);
  freopen((fileName + ".out").c_str(), "w", stdout);
#endif
}

const int INF = (1 << 30) - 1;
const LL LINF = (1LL << 61) - 1;
const double EPS = 1e-10, PI = acos(-1);

LL n;

typedef vector<int> vec;
vec calc(LL k) {
  if (k <= 1) return vec(0);
  vec v;
  if (k & 1) {
    v = calc(k - 1);
    v.insert(v.begin(), (int)v.size());
  } else {
    v = calc(k / 2);
    v.pb((int)v.size());
  }
  return v;
}

int main() {
  // srand((int)time(0));
  // printf("Hello, world!\n");
  // EnableFileIO("");

  cin >> n;
  vec v = calc(n + 1);
  cout << v.size() * 2 << endl;
  for (int i : v) cout << i + 1 << ' ';
  for (int i = 0; i < v.size(); i++) cout << i + 1 << ' ';
  return 0;
}


Measured memory_bytes: 256
n = gets.to_i
c = gets.chomp.chars
pL = 0
pR = n-1
ans = 0
loop do
  while c[pL]=="R"
    pL += 1
  end
  while c[pR]=="W"
    pR -= 1
  end
  if pL >= pR
    p ans
    exit
  end
  ans += 1
  pL += 1
  pR -= 1
end


Measured memory_bytes: 30588
#include<stdio.h>
#include<string.h>
#define FR(N) for(int i = 0;i < N;i++)
#define PR(N) printf("%s\n",N);
int main(void){
  int n;
  scanf("%d",&n);
  int a = n / 100,b = n % 100;
  if(0 < a && a < 13 && 0 < b && b < 13){
    PR("AMBIGUOUS");
  }else if((12 < a || a == 0) && 0 < b && b < 13){
    PR("YYMM");
  }else if((12 < b || b == 0) && 0 < a && a < 13){
    PR("MMYY");
  }else{
    PR("NA");
  }
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int coin[6];
	int i;
	int total;
	
	scanf("%d %d %d %d %d %d", &coin[0], &coin[1], &coin[2], &coin[3], &coin[4], &coin[5]);
	
	total = coin[0] + (coin[1] * 5) + (coin[2] * 10) + (coin[3] * 50) + (coin[4] * 100) + (coin[5] * 500);
	if (total >= 1000){
		printf("1\n");
	}
	else {
		printf("0\n");
	}
	
	return (0);
}

Measured memory_bytes: 584
#include <cstdio>
#include <set>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

#define ll long long
const ll N = 1000000000000000;

int main(){
    int s, w;
    cin >> s >> w;
    if (s <= w) {
        cout << "unsafe";
    } else {
        cout << "safe";
    }
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> Pii;
int main() {
  int n;
  while(cin >> n && n) {
    vector<Pii> vec(n);
    for(int ii=0; ii<n; ii++) {
      int S, m, s;
      cin >> S;
      int t = 0;
      for(int i=0; i<4; i++) {
	cin >> m >> s;
	t += s+m*60;
      }
      vec[ii] = Pii(t, S);
    }
    sort(vec.begin(),vec.end());
    cout << vec[0].second << endl << vec[1].second << endl << vec[vec.size()-2].second << endl;
  }
  return 0;
}

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

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

    int n;
    cin >> n;
    vector<int> A(n);
    // vector<int> B(n);
    // vector<int> C(n);
    for(int i = 0; i < n; i++){
        cin >> A[i];
        A[i]--;
    }
    map<int, int> B;
    for(int i = 0; i < n; i++){
        int b;
        cin >> b;
        B[i] = b;
    }
    map<int, int> C;
    for(int i = 0; i < n - 1; i++){
        int c;
        cin >> c;
        C[i] = c;
    }

    int ans = 0;
    for(int i = 0; i < n; i++){
        if(i == 0){
            ans += B[A[i]];
            continue;
        }
        ans += B[A[i]];
        if(A[i - 1] + 1 == A[i]){
            ans += C[A[i - 1]];
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
       
for i in range(n-1):
    w=a[i]+a[i+1]
    if w > x:
        if a[i+1] >= w-x:
            a[i+1]-=(w-x)
        else:
            a[i+1]=0
            a[i]-=(w-x-a[i+1])
        ans+=(w-x)
print(ans)

Measured memory_bytes: 14068
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(N: int, K: int):
    result = 0
    for i in range(0, N-K+2):
        s = (K + i) * (2 * N - K - i + 1) // 2 - (K + i) * (K + i - 1) // 2 + 1
        result += s
    print(result%(10**9+7))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9204
N,P = map(int,input().split())
S = input()

if P in (2,5):
    ans = 0
    for i,c in enumerate(S):
        c = int(c)
        if c%P==0:
            ans += (i+1)
    print(ans)
else:
    ans = 0
    a = [0]
    j = 1
    for c in S[::-1]:
        c = int(c)
        a.append((a[-1] + j*c) % P)
        j *= 10
        j %= P
    from collections import Counter
    ctr = Counter(a)
    for k,v in ctr.items():
        ans += v*(v-1)//2
    print(ans)

Measured memory_bytes: 12028
#include<stdio.h>
int main()
{
	char a[4];
	int s;
	while(~scanf("%s",a))
	{
		s=1;
		for(int i=0;i<3;i++)
		{
			if(a[i]==a[i+1])
			s=0;
		}
		if(s==1)
		printf("Good\n");
		else
		printf("Bad\n");
	}
	return 0;
} 

Measured memory_bytes: 128
def solve():
    n = int(input())
    txy = list(map(int, input().split()) for _ in range(n))
    now_t, now_x, now_y = 0, 0, 0
    for t, x, y in txy:
        dt, dx, dy = t - now_t, x - now_x, y - now_y
        if dt % 2 != (abs(dx) + abs(dy)) % 2 or dt < abs(dx) + abs(dy):
            return "No"
        now_t, now_x, now_y = t, x, y
    return "Yes"


def resolve():
    print(solve())


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 79320
/* Tuan Kkura */
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define base 31
#define MOD 1e9+7
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORs(i, a, b) for(int i = a; i >= b; i--)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define __FOR(i, a, b, k) for(int i = a; i <= b; i+= k)
#define __REP(i, a, b, k) for(int i = a; i < b; i+= k)
#define pb push_back
#define _io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

typedef pair <int, int> ii;
typedef vector <ii> vii;
#define fi first
#define se second
#define mp make_pair
#define PROB "text"
#define MAXN 200005

int main()
{
    _io
    int n; string s; cin >> n >> s;
    REP(i, 0, s.size())
    {
        int val = (s[i] - 'A' + n)%26 + 'A';
        s[i] = val;
    }
    cout << s;
}


Measured memory_bytes: 256
/*
for (int i = 0; i < N; ++i){}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<int,int> point;
#define rep(i,n) for(i,0,n)
 
int main() {
	// 入力
	int N;
	cin >> N;
	long a[N];
	for (int i = 0; i < N; ++i) cin >> a[i];
 
	// 解法
	ll ans = 0; 
	for (int i = 0; i < N; ++i) {
		ans += a[i]-1;
	}
	
	//出力
	printf("%lld\n", ans); 
}
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N,K; cin>>N>>K;
    vector<ll> A(N);
    rep(i,N) cin>>A[i];
    SORT(A);

    /*bis*/ ll low= -INF2 , high= INF2 ; // min-1, max+1
    while( abs(high-low)>1 ){ ll mid=(high+low)/2;
        ll xika=0;

        rep(i,N){
            if(A[i]>=0){
                /*bis*/ ll low2= i, high2= N ; // min-1, max+1
                while( abs(high2-low2)>1 ){ ll mid2=(high2+low2)/2;
                    ( A[mid2]*A[i]<=mid ? low2 : high2 ) = mid2;
                }// if ok, okdir = mid
                xika+=low2-i;
            }
            else{
                /*bis*/ ll low2= i , high2= N ; // min-1, max+1
                while( abs(high2-low2)>1 ){ ll mid2=(high2+low2)/2;
                    ( A[mid2]*A[i]<=mid ? high2 : low2 ) = mid2;
                }// if ok, okdir = mid
                xika+=N-high2;
            }
        }
        //de(mid);
        //de(xika);
        ( xika>=K ? high : low ) = mid;
    }// if ok, okdir = mid
    cout<< high <<"\n";
}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 1792
import java.util.*;

public class Main {
    static int count = 0;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(); //数列Sの長さ
        int[] s = new int[n]; //数列S
        for (int i=0; i<n; i++) {
            s[i] = sc.nextInt();
        }
        //マージソート
        mergeSort(s,0,n); //配列、０、配列の長さ
        //出力
        System.out.print(s[0]);
        for (int i=1; i<n; i++) {
            System.out.print(" " + s[i]);
        }
        System.out.println();
        System.out.println(count);
    }
    /**
     * マージソート
     */
    static void mergeSort(int[] s, int left, int right) {
        if(left+1 < right) {
            int mid = (left+right)/2;
            mergeSort(s, left, mid); //先頭から中間まで
            mergeSort(s, mid, right); //中間から末尾まで
            merge(s,left,mid,right); //二つの配列を結合する
        }
    }
    /**
     * マージ
     */
    static void merge(int[] s, int left, int mid, int right) {
        int n1 = mid-left;
        int n2 = right-mid;
        int[] a = new int[n1+1];
        int[] b = new int[n2+1];
        for(int i=0; i<n1; i++) a[i] = s[left+i];
        for(int i=0; i<n2; i++) b[i] = s[mid+i];
        a[n1] = Integer.MAX_VALUE;
        b[n2] = Integer.MAX_VALUE;
        int i=0, j=0;
        for (int k=left; k<right; k++) {
            count++;
            if(a[i]<=b[j]) {
                s[k] = a[i];
                i++;
            } else {
                s[k] = b[j];
                j++;
            }
        }
    }
}



Measured memory_bytes: 167288
#include<stdio.h>


int main()
{

    int a,b,c,i,j=0,sum=0,max,x,min,count1=0,count2=0,P;

    scanf("%d%d%d",&a,&b,&c);

    int A[b+1],B[a+1];
    
    
    for(i=0; i<a+1; i++){
        
        B[i]=0;
    }
        

    for(i=1;i<=b;i++){

        scanf("%d",&A[i]);

        B[A[i]]=1;

    }






    for(i=c;i>0;i--){

        if(B[i]==1) count1++;


    }

    for(i=c;i<a+1;i++){

        if(B[i]==1) count2++;


    }

    if(count1>count2) printf("%d\n",count2);

    else printf("%d\n",count1);







    return 0;

}



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

int main() {
  int n, x;
  cin >> n >> x;
  int mi=1000000;
  for (int i=0; i<n; i++) {
    int a;
    cin >> a;
    x-=a;
    mi=min(mi,a);
  }
  n+=x/mi;
  cout << n << '\n';
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N, K;
    cin >> N >> K;
    vector<ll> H(N);
    rep(i, N) cin >> H[i];
    vector<ll> dp(N, INF);
    dp[0] = 0;
    rep(i, N) {
        rep(j, K + 1) {
            if (i + j < N) {
                dp[i + j] = min(dp[i + j], dp[i] + abs(H[i] - H[i + j]));
            }
        }
    }
    cout << dp[N - 1] << '\n';
}

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


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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
  	cout << "vowel" << endl;
  } else {
  	cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n;
    cin>>n;
    string s;
    cin>>s;

    ll ans = 0;
    vvl dp(n + 1, vl(n + 1));
    rep(i, n) rep(j, n) {
        if (s[i] == s[j]) dp[i + 1][j + 1] = min((ll)i - j, dp[i][j] + 1);
        chmax(ans, dp[i + 1][j + 1]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 195840
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



n, k = LI()
s = S()
X = []
if s[0] == '0':
    X += [0]

cnt = 1
for i in range(n - 1):
    if s[i] != s[i + 1]:
        X += [cnt]
        cnt = 1
    else:
        cnt += 1
X += [cnt]
if s[n - 1] == '0':
    X += [0]

if len(X) <= 2 * k + 1:
    print(n)
else:
    ans = 0
    acc = list(accumulate([0] + X))
    for j in range(2 * k + 1, len(acc), 2):
        ans = max(acc[j] - acc[j - (2 * k + 1)], ans)
    print(ans)




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

main(){
    int x,y,i1,ans=0,b,s;
    cin >> x >> y;
    if (x<y) {
        s=x;
        b=y;
    }
    else {
        s=y;
        b=x;
    }
    for (i1=1;i1<=s;i1++){
        if ((i1*b)%s==0) ans++;
    }
    cout << x+y-ans+1 << endl;
}




Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001



int main (){
    ll N, M; cin >> N >> M;
    vector<PLL> D(N);
    for(int i=0; i<N; i++){
        ll A, B; cin >> A >> B;
        D[i] = PLL(A, B);
    }
    
    sort(D.begin(), D.end());
    
    ll sum = 0;
    for(int i=0; i<N; i++){
        ll buy = min(M, D[i].second);
        sum += buy * D[i].first;
        M -= buy;
    }
    
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> V;
const long long MOD=1000000007LL;
const long long INFL=1LL << 60;
const int INF=1<<29;


int main() {
    ll r,D,x;
    cin >>r >>D>>x;
    for(int i=0;i<10;i++){
        x=r*x-D;
        cout<<x<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#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()

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

    // start
    int a, b;
    cin >> a >> b;
    if (a + b == 15)
        cout << '+';
    else if (a * b == 15)
        cout << '*';
    else
        cout << 'x';
    cout << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define endl "\n"
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

int main() {
	ll n;
	cin>>n;
	cout << n*n*n << endl;
	return 0;
}

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

int main(void){
  string str;
  cin >> str;

  stringstream ss;
  for(int i=0;i<str.length();i++){
    if(str[i] != '/'){
      ss << str[i];
    }
  }
  string day = ss.str();
  if(stoi(day) <= 20190430){
    cout << "Heisei" << endl;
  }else{
    cout << "TBD" << endl;
  }
  return 0;
}


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

int ppp[4000001];

void judge(int a){    
    if(ppp[a] == 0){
        printf("no\n");
    }
    else{
        printf("yes\n");
    }
}

int fillin(int a, int b, int n, int arr[]){
    if(a==n){
        ppp[b]=1;
        return 1;
    }
    fillin(a+1, b, n, arr);
    fillin(a+1, b+arr[a], n, arr);
}

int main(int argc, char** argv) {
    int n1, n2;
    scanf("%d", &n1);
    int arr1[n1];
    for(int i=0; i<n1; i++){
        scanf("%d", &arr1[i]);
    }
    fillin(0, 0, n1, arr1);
    
    int temp = 0;
    scanf("%d", &n2);
    for(int i=0; i<n2; i++){
        scanf("%d", &temp);
        judge(temp);
    }
    
    return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;
#define MOD 1000000007
#define INF 1000000
#define MAX_N 100010

/*
iの答え＝
(属する連結成分の個数)-(直接の友達)-(連結成分のうちブロック関係な人)-(自分自身)

連結成分の個数、どうやったら早くできるかな
*/

int par[MAX_N];//親の番号
int siz[MAX_N];//ランク

void init(int n)
{
  //根の定義・・・par[i]=iの時iを根という
  //最初全てが根
  for (int i=0;i<=n;i++){
    par[i]=i;
    siz[i]=1;
  }
}

//木の根を求める
int root(int x){
  if (par[x]==x){  //xが根の時
    return (x); 
  }else{
    par[x]=root(par[x]);//xを、xの親の根につなぎ直す
    return par[x]; //経路圧縮
  }
}

//x,yが同じ集合に属しているか、つまり同じ根に繋がっているか
bool same(int x,int y){
  return ( root(x)==root(y) );
}

//x,yの属する集合を合併する
bool merge(int x, int y) {
   x = root(x); y = root(y);
   if (x == y) return false;
   if (siz[x] < siz[y]) swap(x, y);
   siz[x]+=siz[y];
   par[y] = x; //ランクが大きい方に小さい方を繋げる
   return true;
}

int treesize(int x)
{
  return (siz[root(x)]); 
}

int main()
{
  ll N,M,K;cin>>N>>M>>K;
  
  init(N);//Union Find
  
  Graph F(N+1),B(N+1);
  vector<ll> f(N+1,0),br(N+1,0);//直接の友達とパスでつながっているブロック関係
  for (int i=1;i<=M;i++)
  {
    ll a,b;cin>>a>>b;
    F[a].push_back(b);
    F[b].push_back(a);
    f[a]++;f[b]++;
    merge(a,b);
  }
  for (int i=1;i<=K;i++)
  {
    ll a,b;cin>>a>>b;
    B[a].push_back(b);
    B[b].push_back(a);
    if (same(a,b))
    {
      br[a]++;br[b]++; 
    }
  }
  
  vector<ll> tree(N+1);
  for (int i=1;i<=N;i++)
  {
    tree[i]=treesize(i);
    //cout<<treesize[i]<<endl;
  }
  
  for (int i=1;i<=N;i++)
  {
    ll ans = tree[i]-f[i]-br[i]-1;
    cout<<ans<<" ";
  }
}

Measured memory_bytes: 16116
#include<bits/stdc++.h>
using namespace std;
#define nn 100408
#define ll long long	 
ll mod;
vector<int> v[nn];
int n;
ll dp[nn];ll ans[nn];
void add(int &x,int y)
{
	x=(x+y);
	if(x>=mod) x-=mod;
}
void dfs(int x,int p)
{
	for(int i=0;i<(int)v[x].size();i++)
	{
		int y=v[x][i];
		if(y==p) 
		{
			v[x].erase(v[x].begin()+i);
			i--;
			continue;
		}
		dfs(y,x);
	}
	dp[x]=1;
	for(int i=0;i<(int)v[x].size();i++)
	{
		int y=v[x][i];
		dp[x]=dp[x]*dp[y]%mod;
	}
	dp[x]+=1;dp[x]%=mod;
}
vector<int> ps[nn],ss[nn];
void efs(int x,int p,int road)
{
	ps[x].resize(v[x].size()),ss[x].resize(v[x].size());
	for(int i=0;i<(int)v[x].size();i++)
	{
		int y=v[x][i];
		if(i==0) ps[x][i]=dp[y];
		else ps[x][i]=1ll*ps[x][i-1]*dp[y]%mod;
	}
	for(int i=(int)v[x].size()-1;i>=0;i--)
	{
		int y=v[x][i];
		if(i==(int)v[x].size()-1) ss[x][i]=dp[y];
		else ss[x][i]=1ll*ss[x][i+1]*dp[y]%mod;
	}
	for(int i=0;i<(int)v[x].size();i++)
	{
		int y=v[x][i];
		int p,s;
		if(i==0) p=1;
		else p=ps[x][i-1];
		if(i==(int)v[x].size()-1) s=1;
		else s=ss[x][i+1];
		efs(y,x,(1ll*s*p%mod*road%mod+1)%mod);
	}
//	cout<<"a";

if(v[x].size()>0)//cout<<x<<" "<<ps[x][v[x].size()-1]<<"\n",
	ans[x]=1ll*road*ps[x][v[x].size()-1]%mod;
else ans[x]=road;
//	cout<<"b";
}
int main()
{
	scanf("%d",&n);cin>>mod;
	for(int i=1;i<n;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		v[x].push_back(y);v[y].push_back(x);
	}
	dfs(1,0);efs(1,0,1);
	for(int i=1;i<=n;i++) printf("%lld\n",ans[i]);
	return 0;
}

Measured memory_bytes: 25216
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#define llong long long
#define INF (__INT32_MAX__ / 2)

using namespace std;

int main(int argc, char **argv) {
    int A, B;
    scanf("%d %d", &A, &B);

    int res = 0;
    if(max(A, B) > min(A, B))
        res = max(A, B) * 2 - 1;
    else
        res = max(A, B) + min(A, B);

    printf("%d\n", res);
}

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

int main() {
#ifndef ONLINE_JUDGE
   freopen("inp.txt", "r", stdin);      freopen("outp.txt", "w", stdout);
#endif
   ios::sync_with_stdio(false);   cin.tie(NULL);   cout.tie(NULL);

   int n;
   cin >> n;
   if (n >= 30)
      cout << "Yes\n";
   else
      cout << "No\n";

   return 0;
}

Measured memory_bytes: 3560
#include<stdio.h>
int main()
{
 	int x,a,sum=0;
 	scanf("%d",&x);
 	a=x/500;
 	x=x%500;
 	sum=sum+a*1000;
 	a=x/5;
 	sum=sum+a*5;
 	printf("%d",sum);
 }


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

int main(){
  int N;
  cin >> N;
  vector<int64_t> v(N);
  for(int i=0;i<N;i++){
    cin >> v.at(i);
  }
  sort(v.begin(),v.end(),greater<int64_t>());
  int64_t ans=0;
  ans+=v.front();
  int index=1;
  for(int i=0;i<N-2;i++){
    ans+=v.at(index);
    if(i%2!=0){
      index++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4836
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c) {
    cout << "No" << endl;
  }
  else if ((a == b && b != c) || (b == c && c != a) || (c == a && a != b)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256