akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

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

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
int a,b,c;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>a>>b>>c;
  if((a*100+b*10+c)%4==0) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  
}

int main(){
  solve();
  return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

const ll mod = 1000000007;

int main() {
    int n;
    cin >> n;
    ll ans = 0;
    vector<ll> d(1000010);
    d[0] = 0;
    d[1] = d[2] = d[3] = 1;
    for (int i = 0;i < n;++i) {
        if (i > 2) d[i+1] = (d[i]+d[i-1]+d[i-3])%mod;
        if (i < n-1) (ans += d[i+1]*(n-1)%mod*(n-1)%mod) %= mod; 
        if (i < n-2) (ans += d[i+1]*(i+2)) %= mod;
        else (ans += d[i+1]*(i+1)) %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 8064
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
  int n,s[500][500],f[100010]={},cnt=0,p=1;
  scanf("%d",&n);
  for(int i=1;i*(i-1)<=2*n;i++){
    if(i*(i-1)==2*n){
      printf("Yes\n");
      printf("%d\n",i);
      for(int j=0;j<i;j++){
        cnt=0;
        for(int k=0;k<j;k++){
          for(int l=0;l<i-1;l++){
            if(f[s[k][l]]==1){
              s[j][cnt]=s[k][l];
              f[s[k][l]]++;
              cnt++;
              break;
            }
          }
        }
        for(int k=cnt;k<i-1;k++){
          while(f[p]!=0)
            p++;
          s[j][k]=p;
          f[p]++;
        }
        printf("%d ",i-1);
        for(int k=0;k<i-1;k++)
          printf("%d ",s[j][k]);
        printf("\n");
      }
      return 0;
    }
  }
  printf("No\n");
}

Measured memory_bytes: 2560
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  input! {
    n: usize,
    s: [i64; n],
  }
  let mut ans = 0;
  for c in 1 .. n - 1 {
    let mut score = 0;
    let mut used = vec![false; n];
    let mut k = 1;
    while k * c < n - 1 {
      let i = n - 1 - k * c;
      let j = k * c;
      if i < c || i == j || used[i] || used[j] {
        break;
      }
      used[i] = true;
      used[j] = true;
      score += s[i] + s[j];
      ans = cmp::max(ans, score);
      k += 1;
    }
  }
  println!("{}", ans);
}


Measured memory_bytes: 6524
N = int(input())
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]

ans_list = [0] * (2 ** 10 - 1)
# 開ける時間をbit全探索
for i in range(1, 2**10):
    open_day = [0] * 10
    # 店を開ける時間を調べる
    for j in range(10):
        if i & (1 << j):
            open_day[j] = 1
    # 店k について一緒に開く時間帯の数を調べ，その個数をP[k][count]に入れる
    for k in range(N):
        count = 0
        for t in range(10):
            if open_day[t] == F[k][t] and F[k][t] == 1:
                count += 1
        ans_list[i-1] += P[k][count]

print(max(ans_list))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)

int main(){
  ll M1,M2,M3,M4;
  cin>>M1>>M2>>M3>>M4;
  if(M1!=M3){
    cout<<1<<endl;

  }
  else{
    cout<<0<<endl;
  }
}

Measured memory_bytes: 256
K = int(input())
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[K-1])


Measured memory_bytes: 3316
#include <stdio.h>



#define N 10000
#define Q 500



void display(int data[], int n);

void bubbleSort(int data[], int n);
void selectionSort(int data[], int n);
void insertionSort(int data[], int n);

int binarySearchTF(int key, int data[], int n);



int main(){
	
	//??????
	int data[N];
	
	int S[N];
	int T[Q];
	
	
	//??其?????即?????属
	int i, k;
	
	//?????????????卒???属
	int n, q;
	
	//?????属, ?????属??????
	int count = 0;
	
	
	//????卒???属?????\???
	scanf("%d", &n);	
	
	//??????????????\???
	for(i=0; i<n; i++){
		
		scanf("%d", &S[i]);
		
	}
	
	scanf("%d", &q);
	
	for(i=0; i<q; i++){
		
		scanf("%d", &T[i]);
		
	}
	
	
	insertionSort(S, n);
	
	for(i=0; i<q; i++){
		
		if(binarySearchTF(T[i], S, n)){
			
			count++;
			
		}
		
	}
	
	printf("%d\n", count);
	
	return 0;
	
}



//?????????????卒???????????????????
void display(int data[], int n){
	
	int i;
	
	for(i=0; i<n; i++){
		if(i>0){
			printf(" ");
		}
		printf("%d", data[i]);
	}
	
	printf("\n");
	
	return;
}



//??????????????????
void bubbleSort(int data[], int n){
	
	int i, j, temp;
	int count = 0;
	
	for(i=0; i<n; i++){
		
		for(j=n-1; j>i; j--){
			
			if(data[j] < data[j-1]){
				
				temp = data[j];
				data[j] = data[j-1];
				data[j-1] = temp;
				
				//?????属????即????
				count++;
				
			}
			
		}
		
		//???????????其????????????
		//display(data, n);
		
	}
	
	
	//??????
	//display(data, n);
	
	//???????????属?????????
	//printf("%d\n", count);
	
	return;
}



//???????????????
void selectionSort(int data[], int n){
	
	int i, k, temp;
	int min = 0;
	int count = 0;
	
	for(i=0; i<n; i++){
		
		min = i;
		
		for(k=i+1; k<n; k++){
			
			if(data[min] > data[k]){
				
				min = k;
				
			}
			
		}
		
		
		//min > i  ???  ??????????????????
		if(min > i){
			
			temp = data[min];
			data[min] = data[i];
			data[i] = temp;
			
			count++;
		}
		
	}
	
	display(data, n);
	
	//???????????属?????????
	//printf("%d\n", count);
	
	return;
}



//?????\?????????
void insertionSort(int data[], int n){
	
	int i, j, temp;
	
	for(i=1; i<n; i++){
		
		j = i;
		temp = data[j];
		
		while(j>0 && temp < data[j-1]){
			
			data[j] = data[j-1];
			j--;
			
		}
		data[j] = temp;
		
		//???????????其????????????
		//display(data, n);
	}
	
	return;
}



//????????蔵?卒蔵	??????????????????(0 or 1)?????????
int binarySearchTF(int key, int data[], int n){
	
	int min = 0,  max = n-1, pos = (min+max)/2;
	
	while(min <= max){
		
		if(key < data[pos]){
			
			max = pos-1;
			pos = (min+max)/2;
			
		}
		else if(key > data[pos]){
			
			min = pos+1;
			pos = (min+max)/2;
			
		}
		else{
			
			return 1;
			
		}
		
	}
	
	return 0;
	
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define all(x) x.begin(), x.end()
using namespace std;

const int mxN = 1e3+1;
ll w[101]; int val[101];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
    int n; ll c; cin >> n >> c;
	int vv = 0;
    for(int i = 1; i <= n; i++){
        cin >> w[i] >> val[i];
	    vv += val[i];
    }
    vector<vector<ll>> dp(vv+1, vector<ll> (n+1));

    for(int i = 0; i <= n; i++)
        dp[0][i] = 0;
    for(int i = 1; i <= vv; i++)
		dp[i][0] = 1e18;

    int ans = 0;
    for(int i = 1; i <= vv; i++) {
        for(int j = 1; j <= n; j++) {
            dp[i][j] = dp[i][j-1];
            if(i >= val[j]) {
                dp[i][j] = min(dp[i][j], w[j]+dp[i-val[j]][j-1]);
            }
            if(dp[i][j] <= c)
                ans = i;
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 85112
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int K, S;
int main() {
  int c = 0;
  cin >> K >> S;
  for (int i=0; i<=K; i++) {
    for (int j=0; j<=K; j++) {
      int z = S - (i+j);
      if (z < 0) break;
      if (z <= K) c++;
    }
  }
  cout << c << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*pi*/const double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll i,fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=0,i=0;while(n/10>0){i++;d++;}return d;}
/*迷路移動*/const int dx[4]={1,0,-1,0};const int dy[4]={0,1,0,-1};
llfor;//ll ans=0;////////////////////////////////////////////////////////////
int main(){
 ll h,w,k;
 char s[350][350];
 cin>>h>>w>>k;
 ll st[h+10]={0};    
 bool used[h+10]={0};
 rep(i,0,h){
  rep(j,0,w){
   cin>>s[i][j];
   if(s[i][j]=='#'){
    st[i]++;
    used[i]=true;
   }
  }
 }
  
 ll now=1;
 ll ans[h][w];
 rep(i,0,h){
  rep(j,0,w){
   ans[i][j]=0;
  }
 }
  
 bool flag=true;
 rep(i,0,h){
  if(st[i]==0)continue;   
  rep(j,0,w){
   ans[i][j]=now;
   if(s[i][j]=='#'&&now<k&&st[i]>1){
    st[i]--;
    now++;
    flag=true;
   }
   else flag=false;
  // cout<<i<<" **"<<j<<" "<<ans[i][j]<<endl;
  }
  if(!flag)now++;
 }
  
  
 rep(i,0,h){
  if(used[i]!=false)continue;
  rep(j,0,w){
   if(i>0)ans[i][j]=ans[i-1][j];
   else ans[i][j]=ans[i+1][j];
   if(ans[i][j]!=0)used[i]=true;
  }
 } 
 rrp(i,h,0){
  if(used[i]!=false)continue;
  rep(j,0,w){
   if(i<h)ans[i][j]=ans[i+1][j];
   else ans[i][j]=ans[i-1][j];
  }
 } 
  
 rep(i,0,h){
  rep(j,0,w){
   printf("%lld ",ans[i][j]);
  }
  pnn;
 }
   
 return 0;}

Measured memory_bytes: 4564
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <algorithm>
// #include "./Debug.h"

namespace AtCoder {
	using Input = std::vector<std::string>;
	using Num = std::vector<int>;

	Input input(void) {
		Input result;
		{
			std::string buf = "", row = "";
			std::getline(std::cin, buf);
			for (unsigned int i = 0; i < buf.size(); i++) {
				if (' ' == buf[i]) {
					result.push_back(row);
					row = "";
				} else {
					row += buf[i];
				}
			}
			result.push_back(row);
		}
		return result;
	}

	Num replaceToInteger(Input original = { "" }) {
		Num result;
		for (unsigned int i = 0; i < original.size(); i++) {
			result.push_back(atoi(original[i].c_str()));
		}
		return result;
	}
}

int main(void) {

	AtCoder::Num s = AtCoder::replaceToInteger(AtCoder::input());

	const int k = s[0], x = s[1];

	for (int i = (x - k + 1); i < (x + k); i++ ) {
		printf("%d ", i);
	}

	printf("\n");

	return 0;
}


Measured memory_bytes: 888
a,b,x = list(map(int,input().split()))

import math

if a*b/2 > x/a:
    h = 2*x/a/b
    print(math.degrees(math.atan(b/h)))
else:
    h = 2*(a*b-x/a)/a
    print(math.degrees(math.atan(h/a)))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){

  string s;
  cin >> s;
  int l=0;
  int r=s.size()-1;
  int ans=0;
  while(l<r){
    if(s[l]==s[r]){
      l++;r--;
    }
    else if(s[l]=='x'){
      l++;ans++;
    }
    else if(s[r]=='x'){
      r--;ans++;
    }
    else{
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;

  
  
  return 0;

}


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

int main() {
  int n;
  cin >> n;
  long long int total = 0;
  int limit = 0;
  for(int i=1;i<=n;i++) {
    if(i * (i + 1) / 2 >= n) {
      total = i * (i + 1) / 2;
      limit = i;
      break;
    }
  }

  if(total == n) {
    for(int i=1;i<=limit;i++) cout << i << endl;
  } else {
    int exception = total - n;
    for(int i=1;i<=limit;i++) {
      if(i == exception) continue;
      else cout << i << endl;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(){
    ll N,M,c=0,s=0;
    cin >> N >> M;
    vector<pair<ll,ll>> A(N);
    for(ll i = 0; i < N; i++)
    {
        cin >> A[i].first >> A[i].second;
    }
    sort(A.begin(),A.end());
    for(ll i = 0; i < N; i++)
    {
        for(ll j = 0; j < A[i].second; j++)
        {
            if (c < M) {
                s += A[i].first;
                c++;
            }
            else {
                break;
            }
        }
        if (c >= M) {
            break;
        }
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  int h, w;
  bool x = true;
  char a[51][51];

  cin >> h >> w;

  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      cin >> a[i][j];
    }
  }

  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (a[i][j] == '#') {
        if (a[i - 1][j] == '.' && a[i + 1][j] == '.' && a[i][j - 1] == '.' && a[i][j + 1] == '.') {
          x = false;
          break;
        }
      }
    }
  }

  if (x == true)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<map>
 #define ll long long
  ll a[100005],b[100005];
using namespace std;
int main()
{
    int n;
    int flag=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
       scanf("%lld",&a[i]);
    }
    sort(a,a+n);
    int t=0;
    for(int j=n-1;j>=0;j--)
    {
        if(a[j]==a[j-1])
        {
            b[t]=a[j];
            a[j]=a[j-1]=0;
            t++;
            if(t==2)
            {
                flag=1;
                break;
            }
        }
    }
    if(flag==0)
        printf("0\n");
    else
    printf("%lld\n",b[0]*b[1]);
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdint>
#include <cmath>

const int64_t MOD = 1000000007;

using namespace std;

int64_t f(int64_t n) {
  int64_t a = 1;
  for (int i = 1; i <= n; i++) {
    a = (a * i) % MOD;
  }
  return a;
}

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  int64_t n, m;
  cin >> n >> m;

  if (abs(n - m) > 1) {
    cout << 0 << endl;
    return 0;
  }
  int64_t fn = 0;
  int64_t fm = 0;

  if (n == m) {
    fn = f(n);
    cout << (((fn * fn) % MOD) * 2) % MOD << endl;
  } else if (n > m) {
    fm = f(m);
    fn = (fm * n) % MOD;
    cout << (fn * fm) % MOD << endl;
  } else {
    fn = f(n);
    fm = (fn * m) % MOD;
    cout << (fn * fm) % MOD << endl;
  }
}



Measured memory_bytes: 256
/*C - Fennec vs Monster*/

#include <bits/stdc++.h>
using namespace std;

int main(){
    
    int tam;
    int veces;
    long long ans = 0ll;
    
    cin >> tam >> veces;
    
    vector <long long> arr(tam);
    
    for(int i = 0; i < tam; i++){
        cin >> arr[i];
    }
    
    if(veces >= tam)
       cout << "0";
    else{
        sort(arr.begin(), arr.end());
        tam -= veces;
        
        for(int i = 0; i < tam; i++)
           ans += arr[i];
        
        cout << ans;
    }
    
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
//条件式は=じゃないぞ!!!==だぞ!!!
int main() {
  int N;
  double A,ans;
  cin >> N;
  A = N-N/2;
  ans = 1.0/N*A;
  cout << ans << endl;
}

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


def solve(N: int, K: int, p: "List[int]"):
    expectation = [1]*1000
    for i in range(1, len(expectation)):
        expectation[i] = expectation[i-1]+i+1
    for i in range(len(expectation)):
        expectation[i] /= (i+1)
    costs = [0]*(N-K+1)
    for i in range(K):
        costs[0] += expectation[p[i]-1]
    for i in range(1, len(costs)):
        costs[i] = costs[i-1] - expectation[p[i-1]-1]+expectation[p[i+K-1]-1]
    print(max(costs))
    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
    p = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, p)


if __name__ == '__main__':
    main()


Measured memory_bytes: 29004
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#define ll  unsigned long long
#define ull unsigned long long
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define main() int main()
#define ff1(i,n) for(int i=1;i<=n;++i)
#define ff0(i,n) for(int i=0;i<n;++i)
#define pi acos(-1.0)
#define ms(a, x) memset(a, x, sizeof(a))
#define lowbit(x) ((x)&(-(x)))
#define pb push_back
#define binarycount __builtin_popcount(x)
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define fir first
#define sec second
#define debug(x) cout<<x<<'\n'
#define sa(a) scanf("%d", &a)
#define sab(a, b) scanf("%d%d", &a, &b)
#define pa(a) printf("%d",a)
#define pab(a,b) printf("%d%d",a,b)
#define pii pair<int,int>
using namespace std;

#define maxn 1000005
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-8;
ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}
ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}
ll powmod(ll a,ll b){
    ll ans = 1, pow = a%mod;
    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }
    return ans;
}
bool run(int year=NULL)
{
    if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
        return true;
    else
        return false;
}
struct node{
	int x,y;
}a[20000];
main(){
	int n;
	scanf("%d",&n);
	while(n){
		if(n%10==7){printf("Yes\n");return 0;}
		n/=10;
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include <cmath>
#define PI 3.14159265
using namespace std;

int main() {
  double x,y,theta;
  int n;
  while(cin >> n) {
    if(n == -1) break;
    x = 1.0;
    y = 0.0;
    theta = 0.0;
    for(int i=1;i<n;i++) {
      x -= cos((PI / 2) - theta);
      y += sin((PI / 2) - theta);
      theta = atan2(y,x);
    }
    printf("%.2lf\n",x);
    printf("%.2lf\n",y);
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<int,int> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> a(n),b(n);
    rep(i,n){
      cin>>a[i];
    }
    if(n%2==0){
      ll e=n/2;
      ll o=n/2-1;
      rep(i,n){
        if(i%2==0){
          b[e]=a[i];
          e++;
        }else{
          b[o]=a[i];
          o--;
        }
      }
    }else{
      ll e=n/2;
      ll o=n/2+1;
      rep(i,n){
        if(i%2==0){
          b[e]=a[i];
          e--;
        }else{
          b[o]=a[i];
          o++;
        }
      }
    }
    cout_vec(b);
}

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

int main() {
  ll mod = 998244353;
  int n,s;
  cin >> n >> s;
  vector<vector<ll>> dp;
  dp.assign(n+2,vector<ll>(s+10,0));
  ll ans = 0;
  rep(i,0,n) {
    int a;
    cin >> a;
    rep(j,0,s+1) {
      if (j == 0) {
        if (j+a <= s) {
          dp[i+1][j+a] += i+1;
          dp[i+1][j+a] %= mod;
        }
      } else if (0 < j && j < s) {
        dp[i+1][j] += dp[i][j];
        dp[i+1][j] %= mod;
        if (j+a <= s) {
          dp[i+1][j+a] += dp[i][j];
          dp[i+1][j+a] %= mod;
        }
      } else {
        ans += dp[i][s] * (n-i+1);
        ans %= mod;
      }
    }
  }
  ans += dp[n][s];
  ans %= mod;
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 73904
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1000 * 100 + 10;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}
int solve (int val , int start , int steps = 0)
{
    // cout<<val<<" "<<start<<" "<<steps<<endl;
    if(!val)
        return steps;
    else
    {
        val%=start;
        int dum = __builtin_popcount(val);
        return solve(val,dum,steps+1);
    }

}
signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    //*comment for all except cc/cf    
    #ifndef ONLINE_JUDGE    
           freopen("input.txt","r",stdin);
           freopen("output.txt","w",stdout);
    #endif//*/
    int n;
    cin>>n;
    string s;
    cin>>s;
    int off = 0;
    for(auto x: s)
        if(x=='1')
            off++;
    int lo = max(0ll,off-1);
    int hi = off+1;
    int storelo(0),storehi(0);
    reverse(all(s));
    for (int i = 0; i < n; ++i)
    {
        if(s[i]=='1')
        {
            if(lo)
                storelo+=power(2,i,lo);
            storehi+=power(2,i,hi);
            storehi%=hi;
            if(lo)
                storelo%=lo;
        }
    }
    vector<int> ans(n);
    for (int i = 0; i < n; ++i)
    {
        int temp,dum;
        if(s[i]=='1')
        {
            if(!lo)
            {
                ans[i] = 0;
                continue;
            }
            temp = storelo;
            dum = power(2,i,lo);
            temp-=dum;
            temp+=lo;
            temp%=lo;
            ans[i] = solve(temp,__builtin_popcount(temp),1);
        }
        else
        {
            temp = storehi;
            dum = power(2,i,hi);
            temp+=dum;
            temp%=hi;
            ans[i] = solve(temp,__builtin_popcount(temp),1);
           
        }
    }
    reverse(all(ans));
    for(auto x : ans)
        cout<<x<<endl;
    printclock;
    return 0;
}


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

using ll = long long;

constexpr ll mod = 1e9 + 7;

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

int main() {
    int N, C;
    cin >> N >> C;
    vector<int> A(N), B(N);
    for(int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    for(int i = 0; i < N; ++i) {
        cin >> B[i];
    }

    vector<vector<ll>> x_sum(401, vector<ll>(C + 1));
    for(int i = 1; i <= 400; ++i) {
        for(int j = 0; j < C + 1; ++j) {
            x_sum[i][j] = (x_sum[i - 1][j] + modpow(i, j)) % mod;
        }
    }

    vector<vector<ll>> dp(N, vector<ll>(C + 1, -1));
    function<ll(int, int)> solve = [&](int i, int c) {
        if(dp[i][c] != -1) return dp[i][c];
        ll res = 0;
        if(i == N - 1) {
            res = (x_sum[B[i]][c] - x_sum[A[i] - 1][c] + mod) % mod;
        } else {
            for(int distribute = 0; distribute <= c; ++distribute) {
                (res += (x_sum[B[i]][distribute] - x_sum[A[i] - 1][distribute] + mod) * solve(i + 1, c - distribute)) %= mod;
            }
        }
        return dp[i][c] = res;
    };

    cout << solve(0, C) << endl;
}

Measured memory_bytes: 2816
n, k = [ int(v) for v in input().split() ]
s = input()

if s[0] == "L":
    mode = "R"
else:
    mode = "L"

p, q = 0, 0
p_list, q_list = [], []
for i in range(n):
    if s[i] == mode:
        p += 1
        if i == n-1:
            p_list.append(p)
        if q != 0:
            q_list.append(q)
        q = 0
    else:
        q += 1
        if i == n-1:
            q_list.append(q)
        if p != 0:
            p_list.append(p)
        p = 0

ans_list = [sum(p_list[:k])+ sum(q_list[:k+1])] + p_list[k:] + q_list[k+1:]

ans = 0
for i in ans_list:
    ans += i-1
print(ans)

Measured memory_bytes: 44656
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
const LL INF = 999999999999;

signed main(){
    int a,b,q;
    cin >> a >> b >> q;
    vector<LL> s(a+1, INF), t(b+1, INF);
    rep(i, a) cin >> s[i];
    rep(i, b) cin >> t[i];
    sort(all(s));
    sort(all(t));
    rep(i, q){
        LL x;
        cin >> x;
        int is = lower_bound(all(s), x) - s.begin();
        int it = lower_bound(all(t), x) - t.begin();
        LL ans = INF;
        if(is<a&&it<b)ans = min(ans, abs(x-max(s[is], t[it])));
        if(is>0&&it>0) ans = min(ans, abs(x-min(s[is-1], t[it-1])));
        LL ns = abs(x-s[is]);
        if(is>0) ns = min(ns, abs(x-s[is-1]));
        LL nt = abs(x-t[it]);
        if(it>0) nt = min(nt, abs(x-t[it-1]));
        ans = min({ans, nt*2+ns, nt+ns*2});
        cout << ans << endl;
    }

}


Measured memory_bytes: 2944
import java.util.*;

public class Main {
  public static void main(String[] args) {
          Scanner sc = new Scanner(System.in);
          int num1 = sc.nextInt();
    	  int num2 = sc.nextInt();
    		if(num1 * num2 % 2==0) {
              System.out.println("No");
            } else {
              System.out.println("Yes");
            }
        }
      }

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1005,INF=1<<30;

ll rui(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1) ans=ans*a%mod;
        a=a*a%mod;
        b/=2;
    }
    return ans;
}

int main(){
    
    int N,X,Y,Z;cin>>N>>X>>Y>>Z;
    int M=X+Y+Z+1;
    int dp[1<<M][N+1];//状態がSでj番目まで見たときにXYZの並びが発生してないパターン数
    for(int i=0;i<(1<<M);i++){
        for(int j=0;j<N+1;j++){
            dp[i][j]=0;
        }
    }
    dp[1][0]=1;
    
    for(int j=0;j<N;j++){
        for(int i=0;i<(1<<M);i++){
            for(int k=1;k<=10;k++){
                int a=((i<<k)&((1<<M)-1))+1;
                if((a&(1<<Z))&&(a&(1<<(Y+Z)))&&((a&(1<<(X+Y+Z))))) continue;
                dp[a][j+1]+=dp[i][j];
                dp[a][j+1]%=mod;
            }
        }
    }
    
    ll ans=rui(10,N);
    
    for(int i=0;i<(1<<M);i++){
        ans+=mod-dp[i][N];
        ans%=mod;
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 42240
N = int(input())
A_list = list(map(int, input().split()))
M = 10**6+1
cnt = [0 for _ in range(M)]

for i in A_list:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    for j in range(i, M, i): cnt[j] += 1

ans = 0
for k in A_list:
    if cnt[k] == 1: ans += 1
print(ans)

Measured memory_bytes: 32240
#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007
#define dancila 3.14159265359
#define eps 1e-9

using namespace std;

typedef long long ll;


int add(int a, int b)
{
    int x = a+b;
    if(x >= mod)
        x -= mod;
    if(x < 0)
        x += mod;
    return x;
}
ll mul(ll a, ll b)
{
    return (a*b) % mod;
}

ll pw(ll a, ll b)
{
    ll ans = 1;
    while(b)
    {
        if(b & 1)
            ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

int cnt[4002][4];
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i = n-1; i >= 0; --i)
    {
        if(s[i] == 'R')
            cnt[i][0]++;
        if(s[i] == 'G')
            cnt[i][1]++;
        if(s[i] == 'B')
            cnt[i][2]++;
        cnt[i][0] += cnt[i+1][0];
        cnt[i][1] += cnt[i+1][1];
        cnt[i][2] += cnt[i+1][2];
    }
    ll ans = 0;
    for(int i = 0; i + 2 < n; ++i)
        for(int j = i+1; j + 1 < n; ++j)
            if(s[i] != s[j])
            {
                if(j + j - i < n && s[j + j - i] != s[i] && s[j + j - i] != s[j])
                    --ans;
                bool is0 = 0, is1 = 0, is2 = 0;
                if(s[i] == 'R' || s[j] == 'R')
                    is0 = 1;
                if(s[i] == 'G' || s[j] == 'G')
                    is1 = 1;
                if(s[i] == 'B' || s[j] == 'B')
                    is2 = 1;
                if(!is2)
                    ans += cnt[j+1][2];
                if(!is1)
                    ans += cnt[j+1][1];
                if(!is0)
                    ans += cnt[j+1][0];
            }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3720
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
    test = input()
    if test == 'AC':
        AC += 1
    elif test == 'WA':
        WA += 1
    elif test == 'TLE':
        TLE += 1
    else:
        RE += 1
print('AC x {}'.format(AC))
print('WA x {}'.format(WA))
print('TLE x {}'.format(TLE))
print('RE x {}'.format(RE))

Measured memory_bytes: 9116
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
p2 = [1]*N
for i in range(1,N):
  p2[i] = p2[i-1]*2%mod
N,*C = map(int, open(0).read().split())
C.sort()
ans = 0
for i,c in enumerate(C):
  n = N-1-i
  ans += c*(n*p2[n-1]+p2[n])*p2[n+1]*p2[2*i]%mod
print(ans%mod)

Measured memory_bytes: 132864
#include <stdio.h>

int main()
{
    int a,b,c;
    int d = 0;
    scanf("%d %d %d",&a,&b,&c);
    for(;a<=b;a++){
        if(c%a==0) d++;
    }
    printf("%d\n",d);
    return 0;
}

Measured memory_bytes: 596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class293
    {
        static void Main()
        {
            var SW = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int S = SW[0];
            int W = SW[1];
            if (W >= S) Console.WriteLine("unsafe");
            else Console.WriteLine("safe");
        }
    }
}


Measured memory_bytes: 28292
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n; cin >> n;
    // cout << n / (-2) << endl;
    // cout << n % (-2) << endl;
    vector<int> res;
    ll temp = n;
    if(temp == 0)res.push_back(0);
    while(temp != 0){
        ll quot = temp / (-2);
        ll sur = temp % (-2);
        if(sur == -1){
            sur = 1;
            quot += 1;
        }
        res.push_back(sur);
        temp = quot;
        // cout << temp << endl;
    }
    reverse(res.begin(), res.end());
    for(auto i : res)cout << i;
    cout << endl;
    return 0;
}

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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

signed main(){
	using regex = basic_regex<char>;
	string k = "keyence";
	string str; cin >> str;
	if(str.find(k) < str.length()){
		cout << "YES" << endl;
		return 0;
	}
	for(int i = 1; i < 7; i++){
		string tmp = k.substr(0,i) + ".*" + k.substr(i,k.length()-i);
		regex pat(tmp.c_str());
		if(regex_match(str.c_str(), pat)){
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;

	return 0;
}



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

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef set<int> si;
typedef set<ll> sll;
typedef map<int, int> mii;
typedef map<ll, ll> mll;

const double pi = acos(-1.0);
const long long INF = 2e18;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define in insert
#define endl "\n"

#define sqr(a) ((a) * (a))
#define jor(a) !(a&1)// jor means EVEN number
#define bjor(a) (a&1)// bjor means ODD number

#define all(a)  a.begin(), a.end()
#define mem(arr, b) memset(arr, b, sizeof(arr)) //memset only for -1 and 0

#define for0(i,b) for(int i=0;i<(b);i++)
#define for1(i,b) for(int i=1;i<=(b);i++)
#define forab(i,a,b) for(int i=(a);i<=(b);i++)
#define forba(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fileRead freopen("input.txt", "r", stdin);
#define fileWrite freopen("output.txt", "w", stdout);

void print(int a[], int n){ // for testing or debugging
    for(int i=0;i<n;i++)cout<<a[i]<<" "; cout<<endl;
}

///-------------------------------------------------------------------

#define mx 100000
ll n, W, wt[mx], val[mx];
ll dp[100][mx+1];

ll knapsack(int indx, int Wcantake)
{
    if(indx>=n) return 0;

    if(Wcantake==0) return 0;/// bag is full
    
    if(dp[indx][Wcantake]!=-1) return dp[indx][Wcantake];

    if(wt[indx] <= Wcantake){
        ll left = val[indx] + knapsack(indx+1, Wcantake-wt[indx]); /// if i take this element
        ll right = knapsack(indx+1, Wcantake); /// if i don't take this element
        
        return dp[indx][Wcantake] = max(left,right);
    }
    else{
        return dp[indx][Wcantake] = knapsack(indx+1,Wcantake); /// if this is too large to take skip this
    }
}

int main(){
    cin>>n;
    cin>>W;
    for0(i,n){
        cin>>wt[i]>>val[i];
    }
    mem(dp,-1);
    cout<<knapsack(0, W);
}


Measured memory_bytes: 81732
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>

using namespace std;

int a[1000009], st;
int seat[10000000];

int main() {
  scanf("%d", &a[0]);
  for(int i = 1; i <= 1000000; i++)
    if(a[i - 1] % 2 == 0) a[i] = a[i - 1] / 2;
    else a[i] = a[i - 1] * 3 + 1;
  memset(seat, -1, sizeof(seat));
  for(int i = 0; i <= 1000000; i++) {
    if(~seat[a[i]]) {
      printf("%d\n", i + 1);
      return 0;
    } seat[a[i]] = i;
  }
}


Measured memory_bytes: 43264
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    string s; cin >> s;
    cout << s.substr(0, s.length() - 8) << "\n";
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)

const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;

int main() {
    int N;
    ll S = 0;
    cin >> N;
    vector<int> A(N + 2);
    A[0] = 0;
    rep(i, 1, N + 1) cin >> A[i];
    A[N + 1] = 0;
    rep(i, 1, N + 2) S += abs(A[i] - A[i - 1]);
    rep(i, 1, N + 1) cout << S + abs(A[i + 1] - A[i - 1]) -
                                 abs(A[i] - A[i - 1]) - abs(A[i + 1] - A[i])
                          << endl;
}


Measured memory_bytes: 1664
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;


public class Main {
	public static void main(String[] args){
		PrintWriter out = new PrintWriter(System.out);
		InputReader sc=new InputReader(System.in);
		int N=sc.nextInt();
		int M=sc.nextInt();
		int[] A=sc.nextIntArray(M);
		int sum=0;
		for (int i = 0; i < A.length; i++) {
			sum+=A[i];
		}
		System.out.println(Math.max(N-sum,-1));
	}
	
	static class InputReader { 
		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;
		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}
 
		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}
 
		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}
 
		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}
 
		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}
 
		public boolean hasNext() {
			skip();
			return hasNextByte();
		}
 
		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
 
		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}
 
		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}
 
		public double nextDouble() {
			return Double.parseDouble(next());
		}
 
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
 
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
 
		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}


Measured memory_bytes: 33452
/*
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 T;
	cin >> T;
	ll A[T], B[T], C[T], D[T];
	for (int i = 0; i < T; ++i) cin >> A[i] >> B[i] >> C[i] >> D[i];
 
	// 解法
	for (int i = 0; i < T; ++i){
		bool ans=true;
		if (B[i]>A[i]) ans = false; // 初回でアウト
		else if (B[i]>D[i]) ans = false; // 消費が常に勝る
		else if (C[i]>=B[i]) ans = true; // stock=Bになる前に必ず補充する
		else{
			ll g = __gcd(B[i], D[i]);
			ll tmp = B[i] - g + A[i]%g;
			if (tmp>C[i]) ans = false;
			else ans = true;
			// cout <<"K " << K <<" AmodK " << AmodK <<" CmodK " << CmodK << " ";
			
		}
		if (ans) printf("Yes\n");
		else printf("No\n");
	}
}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;

int main() {
    i32 k;
    cin >> k;
    queue<i64> q;
    for (i32 i = 1; i < 10; i++) q.push(i);

    i64 ans;
    for (i32 i = 0; i < k; i++) {
        ans = q.front(); q.pop();
        i64 d = ans % 10;
        if (d > 0) q.push(ans * 10 + d - 1);
        q.push(ans * 10 + d);
        if (d < 9) q.push(ans * 10 + d + 1);
    }

    cout << ans << endl;
}


Measured memory_bytes: 1792
h, w, k = gets.split.map &:to_i
c = []
h.times do
 c << gets.split("").map(&:to_s)
end

ans = 0
for h_ in 0..2**h-1
  for w_ in 0..2**w-1
    count = 0
    for i in 0..h-1
      for j in 0..w-1
        if (h_ >> i & 1 == 0) && (w_ >> j & 1 == 0) &&  (c[i][j] == "#")
          count += 1
        end
      end
    end
    ans += 1 if count == k
  end
end

puts ans


Measured memory_bytes: 14276