akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace  std ;
typedef long l ;
typedef long long ll ;
typedef vector<int>vi ;
typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
long long power(long long k , long long n , long long m=1e9+7)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}
ll nck(ll n , ll k ,ll m=1e9+7)
{
    ll i , j,b=1,c=1 ;
    if(n-k<k)
    {
        k = n-k ;
    }
    while(k)
    {
        b*=n ;
        c*=k ;
        ll g = __gcd(b,c) ;
        b/=g ;
        c/=g ;
        n--;
        k-- ;
    }
    return(b) ;
}
long long fact(long long n , long long m = 1e9+7)
{
    long long a = 1 ;
    if(n==0 || n==1)
    {
        return(1) ;
    }
    while(n>0)
    {
        a = (a%m * n%m)%m ;
        n-- ;
    }
    return(a) ;
}
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(10);
    ll a,b,c,d,e,x,i,j,n,t,m,k,y,s;
    double p,q,r,w,u ;
    string str = "",str1 = "" ;
    char ch,chr ;
    ll a1=0,a2=0,b1=0,b2=0 ;
    cin>>n;
    vll v;
    READ(v,n);
    vll dp(n,0);
    dp[1] = abs(v[1] - v[0]);
    for(i=2 ; i<n;  i=i+1)
    {
        dp[i] = min(dp[i-1]+abs(v[i-1]-v[i]),dp[i-2]+abs(v[i-2]-v[i]));
    }
    cout<<dp[n-1] ;
}

Measured memory_bytes: 1908
s = input()

ue = int(s[0]+s[1])
sita = int(s[2]+s[3])

if ue == 0 and sita == 0:
    print('NA')
elif ue == 0 and sita > 0 and sita <= 12:
    print('YYMM')
elif sita == 0 and ue > 0 and ue <= 12:
    print('MMYY')
elif sita > 0 and sita <= 12 and ue > 0 and ue <= 12:
    print('AMBIGUOUS')
elif sita > 0 and sita <= 12 and ue > 12:
    print('YYMM')
elif ue > 0 and ue <= 12 and sita > 12:
    print('MMYY')
elif ue > 12 and sita > 12:
    print('NA')
else:
    print('NA')



Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
  int n;
  cin >> n;
  double sum = 0;
  for(int i=0; i<n; i++) {
  	double l;
  	cin >> l;
  	sum += 1/l;
  }
  cout << 1/sum << endl;
  return 0;
}

Measured memory_bytes: 256
program main
implicit None
	character(len = 100)::s
	integer(8)::k,i,n,c = 1
	
	read*,s
	read*,k
	n = len_trim(s)
	
	if(k < n) n = k
	
	do i = 1,n
		if(s(i:i) /= "1")then
			read(s(i:i),*) c
			exit
		endif
	enddo
	
	print "(i0)",c
	
end program main

Measured memory_bytes: 384
// +build ignore
package main

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

func solve(sc *scanner, wr *bufio.Writer) int {
	N := sc.i()

	ans := 0
	for i := 0; i < N; i++ {
		a := sc.i()
		if i%2 == 0 && a%2 == 1 {
			ans++
		}
	}

	fmt.Println(ans)

	return 0
}

func main() {
	sc := newScanner(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)
	ret := solve(sc, wr)
	wr.Flush()
	os.Exit(ret)
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}


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

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

    int n;
    cin >> n;
    vector<long long> A(n + 1), B(n);
    for(int i = 0; i < n + 1; i++){
        cin >> A[i];
    }
    for(int i = 0; i < n; i++){
        cin >> B[i];
    }

    long long ans = 0;
    for(int i = 0; i < n; i++){
        ans += min(A[i], B[i]);
        B[i] -= min(A[i], B[i]);

        ans += min(A[i + 1], B[i]);
        A[i + 1] -= min(A[i + 1], B[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<iostream>

using namespace std;

int main(void){
  int D;
  cin >> D;
  if(D==25){
    cout << "Christmas" << endl;
  }
  if(D==24){
    cout << "Christmas Eve" << endl;
  }
  if(D==23){
    cout << "Christmas Eve Eve" << endl;
  }
  if(D==22){
    cout << "Christmas Eve Eve Eve" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define uint unsigned int
#define MOD 998244353
#define MAXN 200005
#define MAXH 4
#define MAXM 100
#define INF 1LL << 30
#define ll long long
#define ull unsigned long long
#define RNG mt19937
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define T int
#define PI 3.1415926535897932384626433
using namespace std;

int main(){
	fast_io();
	int n,l;cin >> n >> l;
	vector<int> v(n);
	cu(i,0,n)cin >> v[i];
	int ind = -1;
	cu(i,0,n-1){
		if(v[i] + v[i+1] >=l){
			ind = i + 1;
			break;
		}
	}
	if(ind != -1){
		cout << "Possible" << '\n';	
		vector<int> ans(n-1);
		cu(i,0,n-1)ans[i] = i + 1;
		reverse(ans.begin() + ind - 1, ans.end());
		cu(i,0,n-1)cout << ans[i] << '\n';
	}
	else{
		cout << "Impossible" << '\n';
	}
}


Measured memory_bytes: 1664
//AtCoder ABC052 A - Two Rectangles
#include <bits/stdc++.h>
using namespace std;
using lli=int64_t;

int main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d; 
    lli ans0=a*b;
    lli ans1=c*d; 
    cout<<(ans0>ans1?ans0:ans1)<<endl;
    return 0;
}

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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int A, B; cin >> A >> B;
    if (A % 2 == 0 || B % 2 == 0) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
a,b,c,d=gets.split.map(&:to_i)
e=c-a
f=d-b
puts ?R*e+?U*f+?L*e+?D*f+?D+?R*e+?R+?U*f+?U+?L+?U+?L*e+?L+?D*f+?D+?R

Measured memory_bytes: 1916
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int N,K;
cin>>N>>K;
vector<int> Stick(N);
for(int i = 0; i < N; i++)
{
cin>>Stick[i];
}
sort(Stick.rbegin(),Stick.rend());
long long ans = 0;
for(int i = 0; i < K; i++)
{
ans+=Stick[i];
}
cout<<ans;
return 0;
}

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

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007
#define maxn 100005
#define IN freopen("XOR IT(testcase).txt","r",stdin)
#define OUT freopen("XOR IT(testcase).txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000000000LL
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2


using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int x[maxn] , y[maxn] ;

int main()
{
    int i , j , k , l , m , n ;

    i64 ans1=0  , ans2 = 0 , sum ;

    scanf("%d %d",&n,&m) ;
    for(i=1 ; i<=n ; i++) sf("%d",&x[i]) ;
    for(i=1 ; i<=m ; i++) sf("%d",&y[i]) ;

    for(i=1, sum = 0 ; i<=n ; i++ )
    {
        ans1 = (ans1 + (i64)x[i]*(i-1) - sum)%mod ;
        sum = (sum + x[i])%mod ;
    }
    for(i=1, sum = 0 ; i<=m ; i++ )
    {
        ans2 = (ans2 + (i64)y[i]*(i-1) - sum)%mod ;
        sum = (sum + y[i])%mod ;
    }

    cout<<((ans1*ans2)%mod+mod)%mod<<endl ;

    return 0 ;
}


Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(5 * 10**5)
input = sys.stdin.readline

N, M = list(map(int, input().split()))

A = 1 - 1 / 2**M
B = 100 * N + 1800 * M

ans = A * B / (2**M - 1) / (1 - A)**2

print(round(ans))

Measured memory_bytes: 3060
// Written By NewbieChd
#include <cstdio>
#include <cctype>
#include <cmath>
using namespace std;

const int BUF = 1000000;
char buf[BUF], *p1, *p2;
inline char getChar() { return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BUF, stdin), p1 == p2) ? EOF : *p1++; }
inline int read() {
    register int f = 0;
    bool b = 1;
    char c;
    while (!isdigit(c = getChar()))
        if (c == 45)
            b = 0;
    do
        f = f * 10 + (c ^ 48);
    while (isdigit(c = getChar()));
    return b ? f : ~f + 1;
}

const int maxN = 103;
const double eps = 1e-6;
int n, d, x[maxN][maxN];
inline double square(int x) { return 1. * x * x; }
inline double absolute(double x) { return x > 0 ? x : -x; }
inline bool judge(int a, int b) {
    double o = 0;
    for (int i = 1; i <= d; ++i)
        o += square(x[a][i] - x[b][i]);
    o = sqrt(o);
    return absolute(o - (int)(o + 0.5)) < eps;
}

int main() {
    n = read(), d = read();
    int i, j, ans = 0;
    for (i = 1; i <= n; ++i)
        for (j = 1; j <= d; ++j)
            x[i][j] = read();
    for (i = 1; i <= n; ++i)
        for (j = 1; j < i; ++j)
            ans += judge(i, j);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
var print = console.log; // like python
var input_lines; // ?¨??????\????????????????????????????????????

function PreMain(input) {
    input_lines = input.split("\n");
    var f = function () {
        return input_lines.shift();
    };
    Main(f);
}

function IL(min1Flg) {
    var s = input_lines.shift().split(' ');
    var offset = min1Flg ? -1 : 0;
    var res = [];
    for (var i = 0; i < s.length; i++) {
        res.push(parseInt(s[i]));
    }
    return res;
}

/**
 * @return {number}
 */
Array.prototype.SUM = function SUM() {
    var sum = 0;
    this.forEach(function (elm) {
        sum += elm;
    });
    return sum;
};

/**
 * @return {string}
 */
Array.prototype.Format = function Format(split) {
    if (split === undefined) {
        split = " ";
    }
    return this.join(split);
};

Array.prototype.Copy = function Copy() {
    return [].concat(this);
};

/***
 * ??????Sort
 * <Array>.sort?????¨???(?????????)???????????????????????¨????????¨???
 * ??°????????????????????§?????°????????????????????????????????´??????????????????????????¨?????????
 * @constructor
 */
Array.prototype.Sort = function Sort() {
    this.sort(function (a, b) {
        if (a < b) return -1;
        if (a > b) return 1;
        return 0;
    });
    return this;
};

/*

(((???????????)??? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

*/
function item_getter_key(x, desc, func_when_eq) {
    var sign = 1;
    if (desc) {
        sign = -1;
    }
    return function (a, b) {
        if (a[x] < b[x]) return -1 * sign;
        else if (a[x] > b[x]) return sign;

        if (func_when_eq === undefined) {
            return 0;
        } else {
            return func_when_eq(a, b);
        }
    };
}


function Main(input) {
    var lst = [];
    for (var i = 0; i < input_lines.length; i++) {
        var x = input_lines[i].split(' ');
        if(x.length<=1){continue;}
        var flg = false;
        lst.forEach(function (v) {
            if (v[0] === x[0]) {
                v[1].push(parseInt(x[1]));
                flg = true;
            }
        });
        if (!flg) {
            lst.push([x[0], [parseInt(x[1])]]);
        }
    }

    lst.sort(item_getter_key(0));
    for (var i = 0; i < lst.length; i++) {
        print(lst[i][0]);
        print(lst[i][1].Sort().Format());
    }
}

PreMain(require("fs").readFileSync("/dev/stdin", "utf8"));
//PreMain(require("fs").readFileSync("input.txt", "utf8"));

Measured memory_bytes: 15560
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		int max = Math.max(A, Math.max(B, C));
		int min = Math.min(A, Math.min(B, C));
		int med = (A + B + C) - max - min;

		int max_min_2 = max - min;
		int max_med_2 = max - med;

		int ans = 0;

		int temp = max_min_2 / 2;
		ans += temp;
		temp = max_med_2 / 2;
		ans += temp;

		if ((max_min_2 % 2) == (max_med_2 % 2)) {
			ans += max_min_2 % 2;
		} else {
			ans += 2;
		}
		System.out.println(ans);
	}
}

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

int main(){
    char s[19];
    cin >> s;
    for (int i=0;i<19;i++){
        switch (i){
            case 5:
                cout << ' ';
                break;
            case 13:
                cout << ' ';
                break;
            default:
                cout << s[i];
                break;
        }
    }
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    static long waru=1000000007;
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);


        int n=scan.nextInt();
        int m=scan.nextInt();
        int kakeru=0;
        if(Math.abs(n-m)==2) kakeru=0;
        if(Math.abs(n-m)==1) kakeru=1;
        if(Math.abs(n-m)==0) kakeru=2;


        long ans=1;
        for(int i=n;i>0;i--){
            ans=(ans%waru*i%waru)%waru;
        }
        for(int i=m;i>0;i--){
            ans=(ans%waru*i%waru)%waru;
        }
        System.out.println((ans*kakeru)%waru);


    }
}

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

typedef long long ll;

using namespace std;

int main() {
    string S;
    cin >> S;
    cout << (S[0] != S[1] || S[1] != S[2] ? "Yes" : "No") << endl;
    return 0;
}



Measured memory_bytes: 256
N, M = list(map(int, input().split()))
C = [1] * (N + 1)
B = [True, True] + [False] * (N - 1)
flg = False
for _ in range(M):
    x, y = list(map(int, input().split()))
    if B[x]:
        B[y] = True
    if x == 1 and not flg and C[1] == 1:
        B[1] = False
        flg = True
    if y == 1 and not flg:
        flg = True
    C[x] -= 1
    C[y] += 1
    if C[x] == 0:
        B[x] = False
res = 0
for i in range(1, N + 1):
    if B[i] and C[i] > 0:
        res += 1
print(res)


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

ll n, m, q;
vector<ll> a, b, c, d;

ll score(vector<ll> &A)
{
  ll res = 0;
  for (ll i = 0; i < q; i++)
  {
    if (A[b[i]] - A[a[i]] == c[i])
    {
      res += d[i];
    }
  }
  return res;
}

ll dfs(vector<ll> &A)
{
  if (A.size() == n)
  {
    return score(A);
  }
  ll res = 0;
  ll prev_last = A.empty() ? 0 : A.back();
  for (ll i = prev_last; i < m; i++)
  {
    A.push_back(i);
    res = max(res, dfs(A));
    A.pop_back();
  }
  return res;
}

int main()
{
  cin >> n >> m >> q;
  a = b = c = d = vector<ll>(q);
  for (ll i = 0; i < q; i++)
  {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    --a[i];
    --b[i];
  }
  vector<ll> A;
  cout << dfs(A) << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    vector<vector<ll>> dp(N, vector<ll>(3, -(1LL << 61))); // N/2, N/2+1
    dp[0][2] = 0;
    if(N % 2 == 1) {
        dp[0][0] = A[0];
        dp[1][1] = A[1];
    }
    else {
        dp[0][1] = A[0];
        dp[1][2] = A[1];
    }
    rep(i, 2, N) {
        rep(j, 3) dp[i][j] = dp[i - 2][j] + A[i];
        if(i >= 3) {
            rep(j, 2) dp[i][j + 1] = max(dp[i][j + 1], dp[i - 3][j] + A[i]);
        }
    }
    ll ans = max(dp[N - 1][2], dp[N - 2][1]);
    if(N >= 3) ans = max(ans, dp[N - 3][0]);
    output(ans);
    return 0;
}


Measured memory_bytes: 15868
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 1e5 + 10;
int n , a[N];

ll solve(int sig) {
    ll sum = 0 , cost = 0;
    rep(i,0,n) {
        sum += a[i];
        if(sig > 0 && sum <= 0) {
            cost += 1 - sum;
            sum = 1;
        } else if(sig < 0 && sum >= 0){
            cost += sum + 1;
            sum = -1;
        }
        sig *= -1;
    }
    return cost;
}

int main(){
    scanf("%d",&n);
    rep(i,0,n) scanf("%d",a + i);
    printf("%lld\n",min(solve(1) , solve(-1)));
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <queue>
#include <map>
#include <array>

using namespace std;

int stairs[31];

void Solve(){
  stairs[0] = 1;

  for(int i=0; i<30; i++){
	for(int j=1; j<=3; j++){
	  if(i+j >= 31){
		break;
	  }
	  stairs[i+j] += stairs[i];
	}
  }
}

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

  Solve();

  while(1){
	int n;
	cin >> n;
	
	if(n == 0){
	  return 0;
	}
	int years;
	years = (stairs[n]/3650);
	years += (stairs[n]%3650 != 0) ? 1 : 0;
	
	cout << years << endl;
  }
}

Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

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

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    vec H(N); readv(H);
    int ans = 0, m = -1;
    REP(i, N){
        if(H[i] >= m){
            ans++;
            m = H[i];
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    string S;
    cin >> S;
    ll N = S.length();
    string key = "keyence";
    for(ll i = 0; i < N; i++) {
        for(ll j = i; j < N; j++) {
            string tmp = S;
            tmp.erase(i,j-i);
            if (tmp == key) {
                YES;
                return 0;
            }
        }
    }
    NO;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define pint pair<int,int>
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int i,j,n,k;	cin>>n>>k;
	int d[k];
	for(i=0;i<k;i++){
		cin>>d[i];
	}
	--n;
	while(1){
		++n;
		int temp=n;
		while(temp>0){
			for(j=0;j<k;j++){
				if(d[j]==(temp%10))	break;
			}
			if(j<k)	break;
			temp/=10;
		}
		if(temp==0)	break;
	}
	cout<<n<<endl;
	return 0;
}

Measured memory_bytes: 256
import itertools
import numpy as np
n,m,x = map(int, input().split())
c = []
a = []
for i in range(n):
    t = list(map(int, input().strip().split()))
    c.append(t[0])
    a.append(t[1:])

a = np.array(a)

W = []
for i in range(1,n+1):
    Q = list(itertools.combinations(range(1, n + 1), i))
    for q in Q:
        W.append(list(q))

#print(W)
min = 1e10 + 9
flag = False
for w in W:
    z = np.zeros((m))
    ct = 0
    #print('---')
    #print(w)
    for i in range(len(w)):
        ct += c[w[i]-1]
        z += a[w[i]-1]
        #print(z)
        #print(ct)

    #print(len(np.where(z>=x)[0]),np.where(z>=x)[0])
    if len(np.where(z>=x)[0])>= m:
        #print('find')
        if ct < min:
            min = ct
            flag = True
            #print('min:',min)
    #print('---')
if flag:
    print(min)
else:
    print(-1)


Measured memory_bytes: 27700
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	ll ans = 0;
	for( ll i = 1; i <= n; ++i ){
		if( i % 3 != 0 and i % 5 != 0 ) ans += i;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3636
/*input
9999 1
0
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  bool dig[10]={};
  while(k--){
  	int x;
    cin >> x;
    dig[x] = true;
  }
  for(int i=n;i<=99999;i++){
  	int x = i;
    bool ok = false;
    while(x){
    	if(dig[x%10]) ok = true;
      	x /= 10;
    }
    if(not ok){
      cout << i << "\n";	break; }
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

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

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

int main_() {
	string S;
	cin >> S;
	int N = S.size();

	string ans;
	FOR(i, 0, N) {
		if (S[i] == ',') ans += ' ';
		else ans += S[i];
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int x, y, z, _x, _y, _z;
  int ans;

  while(1){
    scanf("%d", &z);
    if(z == 0) break;
    _z = z*z*z;
    ans = _z;

    for(x=1; x<z; x++){
      _x = x*x*x;
      if(_z < 2*_x) break;

      for(y=x; y<z; y++){
        _y = y*y*y;
        if(_z < _x+_y) break;
        else if(ans >= _z-_x-_y) ans = _z-_x-_y;
      }
    }

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

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<valarray>
using namespace std;
int main()
{
	valarray<long> a;
	int n;
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++)
	{
		int t;
		cin >> t;
		a[i] = t;
	}
	cout << a.min() <<" "<< a.max() <<" "<< a.sum() << endl;
}


Measured memory_bytes: 3132
//author:luckYrat(twitter:@luckYrat_)
//<ここに一言>

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  string s;cin>>s;
  for(int i = 0; 3 > i; i++){
    if(s[i] == '7'){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3652
/*					                                
								   *                             *
                                    *             * * * * * * * *
                                    *             *
                                    *             *
                                    *             *
                                    *             *
                                    *             *
                                    *             *
                                    * * * * * * * * * * * * * * *
                                                  *             *
                                                  *             *
                                                  *             *
                                                  *             *
                                                  *             *
                                                  *             *
                                    * * * * * * * *             *
                                   *                             *                             
*/
import java.util.*;
import java.io.*;
import java.lang.*;
class Main{
	public static int dp[][]=new int[100002][3];
	public static int happiness(int arr[][],int n,int m) {
		/*if(n==0) {
			if(m==0) 
				return Main.dp[0][0];
			else if(m==1)
				return Main.dp[0][1];
			else
				return Main.dp[0][2];
		}*/
		if(dp[n][m]!=-1) {
			return Main.dp[n][m];
		}
		else if(m==0) {
			Main.dp[n][m]=arr[n][0]+Math.max(Main.happiness(arr, n-1, 1),Main.happiness(arr, n-1, 2));
			return dp[n][m];
		}
		else if(m==1) {
			Main.dp[n][m]=arr[n][1]+Math.max(Main.happiness(arr, n-1, 0),Main.happiness(arr, n-1, 2));
			return dp[n][m];
		}
		else {
			dp[n][m]=arr[n][2]+Math.max(Main.happiness(arr, n-1, 0),Main.happiness(arr, n-1, 1));
			return dp[n][m];
		}
	}
	public static void main(String []args) {
		for(int i=0;i<100002;i++) {
			for(int j=0;j<3;j++) {
				Main.dp[i][j]=-1;
			}
		}
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int arr[][]=new int[N][3];
		for(int i=0;i<N;i++) {
			arr[i][0]=sc.nextInt();
			arr[i][1]=sc.nextInt();
			arr[i][2]=sc.nextInt();
		}
		Main.dp[0][0]=arr[0][0];
		Main.dp[0][1]=arr[0][1];
		Main.dp[0][2]=arr[0][2];
	    int x=Main.happiness(arr,N-1,0);
	    int y=Main.happiness(arr,N-1,1);
	    int z=Main.happiness(arr,N-1,2);
		System.out.println(Math.max(x,Math.max(y, z)));
		sc.close();
	}
}

Measured memory_bytes: 71604
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) ((x).begin()),((x).end())
#define eps 1e-7
#define int ll
using pii = pair <int, int>;

int32_t main()
{
    int a, b; cin >> a >> b;
    for (int i = 1; i<=100000; i++)
    {
        if ((int)(i*0.08) == a)
        {
            if ((int)(i*0.10) == b)
            {
                cout << i << '\n';
                return 0;
            }
        }
    }
    cout << -1 << '\n';
}

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

int main(void){
    int x,a;
    scanf("%d%d",&x,&a);
    if (x<a){
        printf("0\n");
    } else {
        printf("10\n");
    }
    
    return 0;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}
void debug(istringstream&){}
template <char sep=',', class Head, class... Tail>
void debug(istringstream& iss, Head&& head, Tail&&... tail)
{
  string name;
  getline(iss, name, ',');
  cerr << sep << name << "=" << head;
  debug(iss, forward<Tail>(tail)...);
}
#define DEBUG(...) \
  do{ \
    istringstream ss(#__VA_ARGS__); \
    debug<' '>(ss, __VA_ARGS__); \
    cerr<<endl; \
  }while(0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N, T, A;
  cin >> N >> T >> A;

  int ans = -1;
  double df = 1e9;
  REP(i,N){
    int h;
    cin >> h;
    double t = T - h * 0.006;
    if(df > abs(t-A)){
      df = abs(t-A);
      ans = i;
    }
  }

  cout << ans+1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define MOD 1000000007
#define MOD2 1000000009
#define sp fixed<<setprecision
#define sz(x) (int)(x).size()
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
ll fpow(ll x,ll y,ll p=MOD){x=x%p;ll sum=1;while(y){if(y&1)sum=sum*x;sum%=p;y=y>>1;x=x*x;x%=p;}return sum;}
ll inv(ll a,ll m=MOD){ll c=m;ll y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=c;return x;}
ll add(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return (a%MOD + b%MOD + MOD)%MOD;}
ll sub(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return (a%MOD - b%MOD + MOD)%MOD;}
ll mul(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return ((a%MOD)*(b%MOD) + MOD)%MOD;}
void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if (sz(name)) {
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}
int main(){
    setIO();
    ll n;
    cin>>n;
    bool occur = false;
    ll cnt  = 0;
    for(int i=0;i<n;i++){
      ll x,y;
      cin>>x>>y;
      if(x==y)
        cnt++;
      else
        cnt=0;
      if(cnt>=3)
      occur=true;
    }
    if(occur)
      cout<<"Yes\n";
    else
      cout<<"No\n";
}


Measured memory_bytes: 3652
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	int d = a / b;
	int r = a % b;
	double f = 1.0* a / b;
	cout << d << " "<< r <<" ";



	printf("%.5lf\n", f);
	return 0;
}


Measured memory_bytes: 3244
#include<bits/stdc++.h>
using namespace std;
const int maxn=8005;
char shit[maxn];
int dpx[2][maxn<<1],dpy[2][maxn<<1];
void upx(int now,int w)
{
    memset(dpx[now],0,sizeof(dpx[now]));
    for(int i=0;i<(maxn<<1);i++)
    {
        if(i-w>=0) dpx[now][i]|=dpx[1-now][i-w];
        if(i+w<(maxn<<1)) dpx[now][i]|=dpx[1-now][i+w];
    }
}
void upy(int now,int w)
{
    memset(dpy[now],0,sizeof(dpy[now]));
    for(int i=0;i<(maxn<<1);i++)
    {
        if(i-w>=0) dpy[now][i]|=dpy[1-now][i-w];
        if(i+w<(maxn<<1)) dpy[now][i]|=dpy[1-now][i+w];
    }
}
int main()
{
    int x,y;
    scanf("%s",shit);
    scanf("%d%d",&x,&y);
    int n=strlen(shit);
    int now=0;
    int t=maxn/2;
    memset(dpx,0,sizeof(dpx));
    memset(dpy,0,sizeof(dpy));
    int i=0;
    while(shit[i]=='F'&&i<=n){
        now++;i++;
    }
    int cntx=0,cnty=0;
    dpx[cntx][now+maxn]=1;
    dpy[cnty][0+maxn]=1;
    int last=0;
    now=0;
    shit[n]='T';
    for(i;i<=n;i++)
    {
        if(shit[i]=='T'){
            if(last==0){
                cntx=1-cntx;
                upx(cntx,now);
            }
            else{
                cnty=1-cnty;
                upy(cnty,now);
            }
            last=1-last;
            now=0;
        }
        else{
            now++;
        }
    }
    if(dpx[cntx][maxn+x]&&dpy[cnty][maxn+y]) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 512
fun main(args: Array<String>) {
    val s = readLine()!!.split(" ").map { it.toInt() }
    val a = s[0]
    val b = s[1]
    var flag = 0
    for (i in 0..1000000000){
        var syouhizeiA = i * 0.08
        var syouhizeiAInt = syouhizeiA.toInt()
        var syouhizeiB = i * 0.1
        var syouhizeiBInt = syouhizeiB.toInt()
        if (a == syouhizeiAInt){
            if (b == syouhizeiBInt){
                println(i)
                flag = 1
                break
            }
        }
    }
    if (flag == 0){
        println("-1")
    }
}


Measured memory_bytes: 37996
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
vector<int> p(5);
int maxtime(int x) {
	return (x + 9) / 10 * 10;
}

int resttime(int x) {
	return maxtime(x) - x;
}

void solve() {
	for (int i = 0; i < 5; ++i) {
		cin >> p[i];
	}
	int sum = 0;
	for (int i = 0 ; i < 5; ++i) {
		sum += maxtime(p[i]);
	}
	int rest = -INF;
	for (int i = 0; i < 5; ++i) {
		rest = max(rest, resttime(p[i]));
	}
	int ans = sum - rest;
	cout << ans << endl;
	return;
}
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
	  fac[i] = fac[i-1] * i % MOD;
	  inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
	  finv[i] = finv[i-1] * inv[i] % MOD;
	}
}
//組み合わせ
long long COM (int n, int k) {
	if(n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
int main(int args, char* argv[]) {
	solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define all(v) v.begin(),v.end()
#define mem(v,x) memset(v,x,sizeof(v))
#define N 100005

using namespace std;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	int n,m;
	cin>>n>>m;
	bool a[n][m];
	for(int i=0;i<n;i++){
        string s;
        cin>>s;
        for(int j=0;j<m;j++){
            if(s[j]=='.'){
                a[i][j] = 1;
            }
            else{
                a[i][j] = 0;
            }
        }
	}
	ll dp[n][m];
	ll mod = 1e9+7;
	dp[n-1][m-1] = 1;
	for(int i=m-2;i>=0;i--){
        if(a[n-1][i]){
            dp[n-1][i] = dp[n-1][i+1];
        }
        else{
            dp[n-1][i] = 0;
        }
	}
	for(int i=n-2;i>=0;i--){
        if(a[i][m-1]){
            dp[i][m-1] = dp[i+1][m-1];
        }
        else{
            dp[i][m-1] = 0;
        }
	}
	for(int i=n-2;i>=0;i--){
        for(int j=m-2;j>=0;j--){
            if(a[i][j]){
                dp[i][j] = (dp[i][j+1]+dp[i+1][j])%mod;
            }
            else{
                dp[i][j] = 0;
            }
        }
	}
	cout<<dp[0][0];
	return 0;
}


Measured memory_bytes: 9088
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author emli
 */


#include <bits/stdc++.h>



#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define forx(i, n) for(int i = 1 ; (i) <= (n) ; ++i)
#define ll long long
#define all(x) (x).begin(),(x).end()
#define sqr(x) (x) * (x)
#define debug(x) cout << #x <<" = " << x << endl
#define printvpair(v) for(auto x : v) cout << x.first  <<" " << x.second << endl;
#define printv(v) if (v.size()> 0) {for(auto x : v) cout << x << " "; cout << endl;}
#define MINUS(a) memset(a,0xff,sizeof(a))

const int INF = INT_MAX / 2;
const int N = (int)1e6 + 7;

const int dx[4] = {0,  0, 1, -1};
const int dy[4] = {1, -1, 0,  0};
using namespace std;

class BCollatzProblem {
public:
    int f(int n){
        if (n % 2 == 0){
            return n / 2;
        }
        return 3 * n + 1;
    }
	void solve(std::istream& cin, std::ostream& cout) {
		ios::sync_with_stdio(false);
        cin.tie(nullptr);
        int s;
        cin >> s;
        vector<int> a = {s};

        for(int i = 1; i <= N; i++){
            a.emplace_back(f(a[i-1]));
        }


        unordered_map<int,bool > m;
        for (int i = 0; i < a.size(); ++i) {
            if (m.count(a[i])){
                cout << i + 1 << endl;
                return;
            }
            m[a[i]] = true;
        }

	}
};


int main() {
	BCollatzProblem solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 6256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;
//const long long int MOD = 998244353;

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	vector<string>s(N);
	for (auto &i : s)cin >> i;
	bool flag = false;
	vector<int>placed(N);
	vector<int>non_placed(N);
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (s[i][j] == '#') {
				placed[j] = 1;
				flag = true;
			}
			else {
				non_placed[j] = 1;
			}
		}
	}
	if (!flag) {
		cout << -1 << endl;
		return 0;
	}
	int add = accumulate(non_placed.begin(), non_placed.end(), 0);
	int ans = MOD;
	for (int i = 0; i < N; i++) {
		int box = 0;
		for (int j = 0; j < N; j++) {
			if (s[i][j] == '.') {
				box++;
			}
		}
		if (!placed[i])box++;
		ans = min(ans,add + box);
	}
	cout << ans << endl;
	return 0;

}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  if (b >= a) {
    cout << "un";
  }
  cout << "safe\n";
  return 0;
}


Measured memory_bytes: 3568
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
using namespace std;


int main(void) {

  long long int N;
  cin >> N;
  for(long long int h=1; h<=3500; h++){
    for(long long int n=h; n<=3500; n++){
      long long int tmp1 = h * n * N;
      long long int tmp2 = 4 * h * n - N * n - N * h;
      if( tmp2 == 0 ) continue;
      if( tmp1 % tmp2 == 0 ){
        if( tmp1 / tmp2 <= 0 ) continue;
        cout << h << " " << n << " " << tmp1/tmp2 << endl;
        return 0;
      }
    }
  }

  return 0;
}


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

using namespace std ;

int main(){
	string s;
	cin >> s;
	long long int sum = 0;
	long long int cur = 0;
	for(int i = s.size() - 1; i >= 0; i--){
		if(s[i] == 'W'){
			cur++;
		}
		else{
			sum += cur;
		}
	}
	cout << sum;
}

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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int k = scan.nextInt();
		int sum = 0;

		for(int i =1;i<=k;i++) {
			for(int j=1;j<=k;j++) {
				for(int l=1;l<=k;l++) {

			sum += Euqlid(i,Euqlid(j,l));
				}
			}
		}

		System.out.println(sum);
		scan.close();
	}

	public static int Euqlid(int a,int b){

		if(b == 0) {
			return a;
		}else

		return Euqlid(b,a%b);
	}
}


Measured memory_bytes: 27072
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();

	int kotae = getint();
	rep1(i, N - 1) {
		kotae = __gcd(kotae, getint());
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 512
/** Author : Parth Prajapati
 * 	Institute : Pandit Deendayal Petroleum University
**/
#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k,i;
    bool f = 0;
    cin>>n;
    for(i=0;i<n;++i)
    {
        cin>>k;
        if(k%2 == 0)
        {
            if(k%3 != 0 && k%5 != 0)
                f = 1;
        }
    }
    if(f)   cout<<"DENIED";
    else    cout<<"APPROVED";
    return 0;
}

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

int main() {
  long long a, b, c, d, aa, bb;
  long long c_, d_, lcm, r, x, tmp;
  cin >> a >> b >> c >> d;
  c_=c;
  d_=d;
  x = c_ * d_;
  if(c_<d_){
    tmp = c_;
    c_ = d_;
    d_ = tmp;
  }
  r = c_ % d_;
  while(r!=0){
    c_ = d_;
    d_ = r;
    r = c_ % d_;
  }
  lcm = x/d_;
  bb = b - b/c - b/d + b/lcm;
  aa = (a-1) - (a-1)/c - (a-1)/d + (a-1)/lcm;
  cout << bb-aa << endl;
}



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

int used[1000];

int main ()
{
    string s;
    cin>>s;
    for(int i=0;i<s.size();++i)
        used[(int)s[i]]=1;

    for(int i=97;i<=122;++i)
    {
        if(used[i]!=1)
        {
            cout<<(char)i<<endl;
            return 0;
        }
    }
    cout<<"None"<<endl;
    return 0;
}

Measured memory_bytes: 512
number = input()
le = len(number)
wst = [0] * le
bst = [0] * le
for k in range(le):
  if k % 2 == 0:
    wst[k] = 1
  else:
    bst[k] = 1
wsc = 0
bsc = 0
for k in range(le):
  if int(number[k]) != wst[k]:
    wsc += 1
  if int(number[k]) != bst[k]:
    bsc += 1
print(min([wsc,bsc]))

Measured memory_bytes: 4724
h,w,k=map(int,input().split())
s=[]
ans=[]
for i in range(h):
    s.append(list(input()))
    ans.append(['1']*w)
cnt=0
flag=0
flag2=0
for i in range(h):
    if flag2==0:
        cnt+=1
    if s[i].count('#')>0:
        flag = s[i].count('#')+cnt-1
        for j in range(w):
            ans[i][j]=str(cnt)
            if flag2>0:
                for k in range(1, flag2+1):
                    ans[i-k][j]=str(cnt)
            if s[i][j]=='#':
                if cnt != flag:
                    cnt+=1
        flag2=0
    else:
        flag2+=1
        if i == h-1:
            for j in range(w):
                for k in range(flag2):
                    ans[i-k][j]=ans[i-flag2][j]
        
for i in range(h):
    print(' '.join(ans[i]))

Measured memory_bytes: 16064
//119A
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int y, m, d=0;
    char a;
    cin >> y >> a >> m >> a >>d; //分けて代入できる
    if(m> 4){
        cout << "TBD";
    }else{
        cout << "Heisei";
    }
}

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

int main(void){
    string s;
    char q;
    int a,b,c,d=0,e=0;
    while(cin>>a>>q>>b>>q>>c){
        if(a==b) d++;
        if(a*a+b*b==c*c) e++;
        
    }
    cout<<e<<endl<<d<<endl;
}



Measured memory_bytes: 2996