akhauriyash/Code-Regression huggingface dataset:
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeFamilies #-}
import           Data.Maybe
import           Data.Int
import           Data.List
import           Data.Char
  -- import qualified Data.Vector.Unboxing as VU
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS
import           Data.List (scanl')
import           Data.IORef
import           Control.Monad
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Control.Applicative

readInt = BS.readInt . BS.dropWhile isSpace
getVector f = VU.unfoldr f <$> BS.getLine
getIntVector = getVector readInt
getBSVector = getVector BS.uncons

solve' a b c x y = minimum $ map value solve1'
  where
    value [an,bn,abn] = an*a + bn*b + abn*c
    solve1' = do
      let n = max x y

      abNum <- [0,2..2*n]
      aNum  <- [0..n-(abNum `div` 2)]
      bNum  <- [0..n-(abNum `div` 2)]

      guard $ ((abNum `div` 2) + aNum == x && (abNum `div` 2) + bNum == n) || ((abNum `div` 2) + aNum == n && (abNum `div` 2) + bNum == y)

      let chosen = [aNum, bNum, abNum]

      return chosen

solve a b c x y = minimum $ map value solve1
  where
    value [an,bn,abn] = an*a + bn*b + abn*c*2
    solve1 = do
      let n = max x y

      abNum <- [0..n]
      let aNum = if x - abNum < 0 then 0 else x - abNum
          bNum = if y - abNum < 0 then 0 else y - abNum


      -- aNum  <- [0..n-(abNum `div` 2)]
      -- bNum  <- [0..n-(abNum `div` 2)]

      -- guard $ ((abNum `div` 2) + aNum == x && (abNum `div` 2) + bNum == n) || ((abNum `div` 2) + aNum == n && (abNum `div` 2) + bNum == y)

      let chosen = [aNum, bNum, abNum]

      return chosen

main = do
  [a,b,c,x,y] <- map read . words <$> getLine
  print $ solve a b c x y


Measured memory_bytes: 892
/* ex3_2
   moka223711 */

#include <stdio.h>

int main(void){
	int num;
	// 入力numを受け取る
	scanf("%d", &num);

	// num % 10で1の位を取得する
	// switch文で各値に対してnum本の本の読み方を出力する
	switch(num % 10){
		case 2: case 4: case 5: case 7: case 9:
			printf("hon");
			break;
		case 0: case 1: case 6: case 8:
			printf("pon");
			break;
		default:
			printf("bon");
	}

	return 0;
}


Measured memory_bytes: 1704
//#pragma GCC target ("avx2,sse2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree <pair <ll, int>, null_type, less <pair <ll, int> >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long
#define ull unsigned long long
#define db double
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define fi first
#define se second
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define endl "\n"

#define left fsdsdfoisf
#define sum dpsdfioppsf
#define assign xcvjlkdjfio
#define trie fksdfkjkfnjuiv
#define next sidlfjsfkl
#define merge sdfksdkfsldf

//#define int long long

using namespace std;

void dout() {
    cerr << endl;
}
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;

const int N = 3007, MOD = 1e9 + 7;
int n, dp[N][N], p[N][N];
string s;

void add(int & x, int y) {
    x += y;
    if (x >= MOD) {
        x -= MOD;
    }
}

void solve(int tc) {
    // check for (int i = 0; i < n; j++)
    cin >> n >> s;
    for (int i = 0; i <= n; i++) {
        dp[1][i] = 1;
        if (i > 0) {
            add(p[1][i], p[1][i - 1]);
        }
        add(p[1][i], dp[1][i]);
    }
    for (int i = 2; i <= n; i++) {
        for (int j = 0; j <= n - (i - 1); j++) {
            if (s[i - 2] == '<') {
                add(dp[i][j], (p[i - 1][n - (i - 1)] - p[i - 1][j] + MOD) % MOD);
            }   else {
                add(dp[i][j], p[i - 1][j]);
            }
            if (j > 0) {
                add(p[i][j], p[i][j - 1]);
            }
            add(p[i][j], dp[i][j]);
        }
    }
    cout << dp[n][0];
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int tc = 1;
//    cin >> tc;
    for (int i = 0; i < tc; i++) {
        solve(i);
//        cleanup();
    }
}


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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << end
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n,m; cin >> n >> m;
    vl a(n),b(n),c(m),d(m);
    rep(i,n)cin >> a[i] >> b[i];
    rep(i,m)cin >> c[i] >> d[i];

    rep(i,n){
        int idx;
        ll mi = L_INF;
        rep(j,m){
            ll ans = abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(ans < mi){
                mi = ans;
                idx=j+1;
            }
        }
        cout << idx << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m,total=0;
	scanf("%d%d",&n,&m);
	char queue[n+1];
	for(int i=1;i<=n;i++){
		cin>>queue[i];
		if(queue[i]!=queue[i-1]){
			total++;
		}
	}
	m*=2;
	if(m<total){
		printf("%d",n+m-total);
	}
	else{
		printf("%d",n-1);
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    string s;
    cin >>s;
    
    if (s[0] != s[1] && s[1] != s[2] && s[0] != s[2])cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}



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

int main() {
	int N;
	cin >> N;
	vector<int> s(N);
	int sum = 0;
	for (int& i : s) {
		cin >> i;
		sum += i;
	}
	sort(s.begin(), s.end());
	if (sum % 10) cout << sum;
	else {
		int i;
		for (i = 0; i < N; ++i) {
			if ((sum - s[i]) % 10) break;
		}
		if (i == N) cout << 0;
		else cout << sum - s[i];
	}
}

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

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

    char mark[n], mark1[n], mark2[n];
    int num[n], num1[n], num2[n];
    int judge1[4], judge2[4];

    int i,j,k,tmp1,counter1,counter2;
    char tmp2;

    for(i=0; i<n; i++){
        cin >> mark[i];
        cin >> num[i];
    }

    for(i=0; i<n; i++){
        mark1[i] = mark[i];
        mark2[i] = mark[i];
        num1[i] = num[i];
        num2[i] = num[i];
    }
    
    //bubblesort
    int flag = 1;

    while(flag){
        flag=0;
        for(j=n-1; j>0; j--){
            if(num1[j]<num1[j-1]){
                tmp1 = num1[j];
                num1[j] = num1[j-1];
                num1[j-1] = tmp1;
                tmp2 = mark1[j];
                mark1[j] = mark1[j-1];
                mark1[j-1] = tmp2;
                flag = 1;
            }
        }
    }

    for(i=0; i<n-1; i++){
        cout << mark1[i] << num1[i] <<' ';
    }
    cout << mark1[n-1] << num1[i]<< endl;

    flag=1;
    for(i=1; i<14; i++){
        counter1=0;
        counter2=0;
        for(j=0; j<n; j++){
            if(num[j]==i){
                judge1[counter1]=mark[j];
                counter1++;
            }
            if(num1[j]==i){
                judge2[counter2]=mark1[j];
                counter2++;
            }
        }
        for(j=0; j<counter1; j++){
            if(judge1[j]!=judge2[j]){
                flag=0;
                break;
            }
        }
        if(flag==0) break;
    }

    if(flag==0) cout << "Not stable" << endl;
    else cout << "Stable" << endl;

    //selectionsort
    int minj;

    for(i=0; i<n-1; i++){
        minj = i;
        for(j=i; j<n; j++){
            if(num2[j]<num2[minj]) minj = j;
        }
        if(i!=minj){
            tmp1 = num2[i];
            num2[i] = num2[minj];
            num2[minj] = tmp1;
            tmp2 = mark2[i];
            mark2[i] = mark2[minj];
            mark2[minj] = tmp2;
        }
    }

    for(i=0; i<n-1; i++){
        cout << mark2[i] << num2[i] <<' ';
    }
    cout << mark2[n-1] << num2[i]<< endl;

    flag=1;
    for(i=1; i<14; i++){
        counter1=0;
        counter2=0;
        for(j=0; j<n; j++){
            if(num[j]==i){
                judge1[counter1]=mark[j];
                counter1++;
            }
            if(num2[j]==i){
                judge2[counter2]=mark2[j];
                counter2++;
            }
        }
        for(j=0; j<counter1; j++){
            if(judge1[j]!=judge2[j]){
                flag=0;
                break;
            }
        }
        if(flag==0) break;
    }

    if(flag==0) cout << "Not stable" << endl;
    else cout << "Stable" << endl;
    
    return 0;
}


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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N,x;
int A[110000];
signed main() {
    cin>>N>>x;
    for(int i=0;i<N;i++)cin>>A[i];
    sort(A,A+N);
    int ans=0;
    for(int i=0;i<N-1;i++){
        if(x>=A[i])ans++,x-=A[i];
    }
    if(x==A[N-1])ans++;
    cout<<ans<<endl;
}


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

long long N, M;

int main(){
  ios_base::sync_with_stdio(false); 
  cin >> N >> M;
  if(2*N <= M){
     cout << (M-2*N)/4 + N << "\n";
  }
  else{
     cout << M/2 << "\n";
  }
  return 0;
}


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

int main(){
    int n;

    cin >> n;

    int a[n + 1];
    map<int, int>mp;

    for(int i = 2; i < n + 1; i++){
        cin >> a[i];
        mp[a[i]]++;
    }

    for(int i = 1; i <= n; i++) {
        cout << mp[i] << "\n";
    }
    return 0;
}

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

#define FOR(a, b, c) for(int a = b; a <= c; ++a)
#define fi first
#define se second
#define pb push_back
#define int long long

typedef pair<int, int> ii;
typedef pair<int, ii> iii;

const int N = 1e5 + 10;
const int oo = 1e18;

signed main()  {
    //freopen("test.inp", "r", stdin);
    //freopen("test.out", "w", stdout);
    ios_base::sync_with_stdio(false); cout.tie(0);

    int n, m;
     cin >> n >> m;
     if(n == 1 || m == 1) return cout << "1", 0;
     return cout << ((n + 1) / 2) * ((m + 1) / 2) + (n / 2) * (m / 2),0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Main instance = new Main();

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int A = scan.nextInt();
		int B = scan.nextInt();
		int H = scan.nextInt();
		int M = scan.nextInt();

		//WK変数
		double Aspeed = 360.0 / 60 / 12;
		double Bspeed = 360.0 / 60 / 1;

		double Aposition = Aspeed * (H * 60 + M);
		double Bposition = Bspeed * (H * 60 + M);

		//演算
		double result = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(Math.toRadians(Bposition - Aposition)));

		//結果出力
		System.out.println(result);
	}
}

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

int n;

int partition(int [], int, int);
void swap(int *, int *);

int main(){
  int *A;
  int k, i;

  scanf("%d",&n);

  A = (int *)malloc(n * sizeof(int));

  for(i=0; i<n; i++)
    scanf("%d",&A[i]);

  k = partition(A, 0, n-1);

  for(i=0; i<n; i++){
    if(i==k)
      printf("[%d]",A[i]);
    else
      printf("%d",A[i]);

    if(i<n-1)
      printf(" ");
  }
  printf("\n");
  
  free(A);
  return 0;
}

int partition(int A[], int p, int r){
  int x;
  int i, j;
  
  x = A[r];
  i = p-1;

  for(j=p; j<r; j++){
    if(A[j] <= x){
      i++;
      swap(&A[i], &A[j]);
    }
  }

  swap(&A[i+1], &A[r]);
  return i+1;
}

void swap(int *a, int *b){
  int tmp;

  tmp = *a;
  *a = *b;
  *b = tmp;
}



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

using namespace std;
using ll = long long;

int A, B;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>A>>B;
    for(double i=0;i<=1000000;i++){
        if((int)floor(i * 0.08) == A && (int)floor(i*0.1) == B){
            cout<<(int)i;
            return 0;
        }
    }
    cout<<-1;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define pqmin priority_queue<int,vector<int>,greater<int>>
#define pqmax priority_queue<int>
using namespace std;
int32_t main()
{
    IOS;
   int a,b;
   cin>>a>>b;
   if((a-2*b)<=0)
   cout<<0<<endl;
   else 
   cout<<a-2*b<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(void) {
	int h, w;
	cin >> h >> w;
	vector<string>s;
	for (int i(0); i < h; i++) {
		string ss;
		cin >> ss;
		s.push_back(ss);
	}
	for (int i(0); i < h; i++) {
		for (int j(0); j < w; j++) {
			if (s[i][j] == '#')cout << "#";
			else {
				int cnt(0);
				for (int k(i - 1); k <= i + 1; k++) {
					for (int l(j - 1); l <= j + 1; l++) {
						if (k<0 || k>=h || l<0 || l>=w)continue;
						if (s[k][l]=='#')cnt++;
					}
				}
				cout << cnt;
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 384
#pragma GCC optimize("O3")

#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
#include <cstring>
#include <numeric>
#include <set>
#include <queue>
#include <deque>
#include <array>
#include <string>
#include <cmath>
#include <random>
#include <ctime>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using ld = long double;

int32_t main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int ans = 0;
	int M, D;
	cin >> M >> D;
	for (int m = 1; m <= M; m++) {
		for (int d = 20; d <= D; d++) {
			if (d % 10 >= 2 && (d / 10) * (d % 10) == m) {
				ans++;
			}
		}
	}
	cout << ans;
}


Measured memory_bytes: 256
io = STDIN
$n,$m=io.gets.chomp.split.map(&:to_i)
$maybered=Array.new($n,false)
$maybered[0]=true
$count=Array.new($n,1)
$m.times do
  x,y = io.gets.chomp.split.map(&:to_i).map(&:pred)
  $count[y]+=1
  $count[x]-=1
  $maybered[y]=true if $maybered[x]
  $maybered[x]=false if $count[x]==0
end
puts $maybered.count(true)

Measured memory_bytes: 3324
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; i++)


int calcNumOfDigit(long long num)
{
    int cnt = 0;
    while(num > 0)
    {
        num /= 10;
        cnt++;
    }
    return cnt;
}

int main(void)
{
    long long N;
    cin >> N;
    long long res = 0;
    long long min_res = INT32_MAX;
    
    for(long long A = 1; A <= sqrt(N); A++)
    {
        if(N % A == 0)
        {
            int  a = calcNumOfDigit(A);
            int  b = calcNumOfDigit(N / A);
            res = max(a, b);
            min_res = min(res, min_res);
        }
    }
    
    cout << min_res << endl;    

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
  {
    
     int n,count=0;
     string s;
     cin>>n;
     cin>>s;
     
     for(int i = 0, j =n/2 ;i<n/2,j<n;i++,j++)
     {
       if(s[i]==s[j])
       count++;
     }
     if((count+count)==n)
     cout<<"Yes"<<endl;
     else
     cout<<"No"<<endl;
  }  

Measured memory_bytes: 3616
import numpy as np

data = input().split()
n = int(data[0])
m = int(data[1])
x = int(data[2])
data = []
for _ in range(n):
    data.append(np.array(list(map(int,input().split()))))

INF = 10000000
ans = INF
for b in range(2**n):
    value = np.array([0 for _ in range(m+1)])
    b = bin(b)[2:]
    for zero in range(n-len(b)):
        b = "0" + b
    for i in range(n):
        if b[i] == "1":
            value += data[i]
    ok = True
    for i in range(1,m+1):
        if value[i] < x:
            ok = False
    if ok == True and value[0] <= ans:
        ans = value[0]
if ans == INF:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 27072
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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


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

	ll a, b, x; cin >> a >> b >> x;
	
	if (a == 0) cout << b/x + 1 << endl;
	else cout << b/x - (a-1)/x << endl;
}

Measured memory_bytes: 256
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int n;
	cin>>n;
	int req=0;
	if(n%2==0)
		req=n/2;
	else
		req=n/2+1;
	cout<<fixed<<setprecision(6)<<double(req)/(double)n<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}






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

using namespace std;

#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
    int n, k, s;
    while (cin >> n >> k >> s, n|k|s) {
        int cnt = 0;
        REP(i, 1<<n) {
            if (__builtin_popcount(i) == k) {
                int sum = 0;
                REP(j, n) {
                    if ((i >> j) & 1) {
                        sum += j+1;
                    }
                }
                if (sum == s) {
                    cnt++;
                }
            }
        }
        cout << cnt << endl;
    }
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int X,Y;
    cin >> X >> Y;
    if (Y%2==1) {
        cout << "No";
        return 0;
    }
    if (Y>=X*2 && Y<=X*4) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3648
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
p1 = []
for i in range(n):
  p1.append(a[i]-1)
p2 = []
for i in range(n):
  p2.append(a[i]+1)
chk = a+p1+p2
chk.sort()
#print(chk)
ans =[]
count = 0
for i in range(3*n-1):
  if chk[i+1] == chk[i]:
    count += 1
  else:
    ans.append(count)
    count = 0
print(max(ans)+1)

Measured memory_bytes: 19452
integer N,Y
integer m,g,s !万，五千,千

read*,N,Y

do i=0,N
  m=N-i
  do j=0,i
    g=i-j
    s=j
    if(GK(m,g,s)==Y)then
      print"(I0,A,i0,A,i0)",m," ",g," ",s
      STOP
    endif
  end do
end do

print"(I0,A,i0,A,i0)",-1," ",-1," ",-1
contains

pure function GK(m,g,s)
integer,intent(in)::m,g,s
integer GK
GK=m*10000+g*5000+s*1000
end function GK
end

Measured memory_bytes: 256
N,M=map(int,input().split())
H=map(int,input().split())
S=[[] for _ in range(N)]
for _ in range(M):
    A,B=map(int,input().split())
    S[A-1].append(B-1)
    S[B-1].append(A-1)
answer=0
H=[int(h) for h in H]
n=0
for s in S:
    kazu=0
    number=len(s)
    for a in s:
        if H[n] > H[a]:
            kazu+=1
    if kazu==number:
            answer+=1
    n+=1
print(answer)


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  string str = readString();
  vi squares(str.size(), 0);
  int cnt = 0;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == 'R') {
      cnt++;
    } else {
      squares[i - 1] += cnt / 2 + (cnt & 1);
      squares[i] += cnt / 2;
      cnt = 0;
    }
  }
  if (cnt != 0)
    squares[str.size() - 1] += cnt;
  cnt = 0;
  for (int i = str.size() - 1; i >= 0; i--) {
    if (str[i] == 'L') {
      cnt++;
    } else {
      if (i + 1 != str.size())
        squares[i + 1] += cnt / 2 + (cnt & 1);
      squares[i] += cnt / 2;
      cnt = 0;
    }
  }
  if (cnt != 0)
    squares[0] += cnt;
  for (auto &v : squares)
    print(v, 2);
}


Measured memory_bytes: 3328
lis=[]
for i in range(5):
  lis.append(int(input()))
saitei=10
keep=0
for j in range(0,5):
  if 1<=lis[j]%10<saitei:
    saitei=lis[j]%10
    keep=j+1
res=0
for k in range(0,5):
  if lis[k]%10==0:
    res+=lis[k]
  else:
    res+=lis[k]+10-lis[k]%10

print([res,res-(10-lis[keep-1]%10)][bool(keep)])

Measured memory_bytes: 3064
A, B, C, K = map(int, input().split())
maxL = 10 ** 18
L = [A, B, C]
ans = A - B
if ans >= maxL:
    print("Unfair")
else:
    if K % 2 == 0:
        print(ans)
    else:
        print(ans * (-1))

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
main()
{
  int a,s;
  cin>>a>>s;
  int count = 0;
  for (int i = 0;i<=a;i++){
    for (int j = 0; j <= a;j++){
        if(0<=s-(i+j)&&s-(i+j)<=a)
          count++;
    }
  }
  cout << count << endl;
}



Measured memory_bytes: 256
def isNotLower(s):
  return not (ord('a') <= ord(s) <= ord('z'))

S = input()

if S[0] != 'A':
  print("WA")
  exit()

if S[2:-1].count('C') != 1:
  print("WA")
  exit()

upper_num = 0
for s in S:
  if isNotLower(s):
    upper_num += 1

if upper_num != 2: # expected only 'A', 'C'
  print("WA")
  exit()

print("AC")


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

int main()
{
    int n, m;
    cin >> n >> m;
    if (n == m) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

int N, Q;
string S;
char t[202020], d[202020];

int bs(int x) {
    rep(i, 0, Q) {
        if(S[x] == t[i]) {
            if(d[i] == 'L') x--;
            else x++;
        }
        if(x < 0) return 1;
        else if(x >= N) return 2;
    }
    return 0;
}

int main() {
    cin >> N >> Q >> S;
    rep(i, 0, Q) cin >> t[i] >> d[i];
    int l = -1, r = N;
    while(r - l > 1) {
        int mid = (l + r) / 2;
        if(bs(mid) == 1) l = mid;
        else r = mid;
    }
    int l2 = -1, r2 = N;
    while(r2 - l2 > 1) {
        int mid = (l2 + r2) / 2;
        if(bs(mid) == 2) r2 = mid;
        else l2 = mid;
    }
    cout << r2 - l - 1 << endl;
    return 0;
}


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

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

    int l, r, d;
    cin >> l >> r >> d;

    int ans = 0;
    for (int i = l; i <= r; ++i) {
        if (i % d == 0) ++ans;
    }

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3632
m, d = map(int, input().split(' '))
ans = 0
for i in range(10, d + 1):
    s = str(i)
    d1 = int(s[1])
    d10 = int(s[0])
    if 2 <= d1 and 2 <= d10 and d1 * d10 <= m:
        ans += 1
print(ans)


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

namespace ProblemA
{
    class Program
    {
        static void Main(string[] args)
        {
            var read = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var L = read[0];
            var R = read[1];
            var d = read[2];
            var lDivd = L / d;
            var rDivd = R / d;
            var lPard = L % d;
            Console.WriteLine(lPard == 0 ? rDivd - lDivd + 1 : rDivd - lDivd);
        }
    }
}


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

int main() {
	int A, B;
	cin >> A >> B;
	if (A == B) {
		cout << "Draw" << endl;
	}
	else if (A > B && B != 1 || A == 1) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Bob" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	string s,t;
	set<string>ss;
	int i;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>s>>t;
		if(s=="insert")	ss.insert(t);
		else{
			auto it=ss.find(t);
			cout<<((it!=ss.end())?"yes":"no")<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 32556
// ITP1_1_D
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  // 初期値
  int S, h, m, s; 
  cin >> S;
  
  // Main loop
  h = S / 3600;
  m = S % 3600 / 60;
  s = S % 60;
  
  cout << h << ":" << m << ":" << s << endl;
   
  return 0;
}


Measured memory_bytes: 3044
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

def lcm(a,b):
  return a*b//gcd(a,b)

A,B,C,D = (int(i) for i in input().split())

hogeb = B // D
hogec = B // C
hogebc = B // lcm(D,C)

hoge = B-(hogeb + hogec -hogebc)

ononb = (A-1) // D
ononc = (A-1) // C
ononbc = (A-1) // lcm(D,C)

onon = A-1-(ononb + ononc - ononbc)

print(hoge-onon)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v{0};
  int n; cin >> n;
  for (int i = 0; i < n; i++) {
    int t; cin >> t;
    v.push_back(t);
  }
  v.push_back(0);
  int total = 0;
  auto dist = [&](int a, int b) -> int {
    return abs(v[a] - v[b]);
  };
  for (int i = 1; i <= n+1; i++) {
    total += dist(i, i-1);
  }
  for (int i = 1; i <= n; i++) {
    cout << total - dist(i, i-1) - dist(i, i+1) + dist(i-1, i+1) << endl;
  }
}

Measured memory_bytes: 1784
char buf[1<<20];sz;
N,H;
main()
{
	read(0,buf,1<<20);
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		H=H*10+k-'0';
	}
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(int i=0;i<N;i++)
	{
		int A=0;
		for(;;)
		{
			char k=buf[sz++];
			if(k<'0')break;
			A=A*10+k-'0';
		}
		H-=A;
	}
	puts(H>0?"No":"Yes");
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int res,n;
cin>>res>>n;
int arr[n];
for(int i=0;i<n;i++)
{
    cin>>arr[i];
}
int ans=INT_MAX;
for(int i=0;i<n;i++)
{
    int val;
    if(i==0)
    val=arr[n-1]-arr[0];
    else
    {
        val=res-arr[i];
        val+=arr[i-1];
    }
    ans=min(ans,val);

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


Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
#include<queue>
#include<vector>
using namespace std;
#define inf 0x3f3f3f
typedef long long ll;
const int maxn = 109;
char s[maxn];
int main(){
	scanf("%s",s+1);
	int n = strlen(s+1);
	int flag = 1;
	for(int i = 1;i <= n/2;i++){
		flag = 1;
		if(s[i] != s[n-i+1]){
			flag = 0;
			break;
		}
	}
	if(flag){
		for(int i =1;i <= (n-1)/4;i++){
			if(s[i] != s[(n-1)/2-i+1]){
				flag = 0;
				break;
			}
		}
		if(flag){
			for(int i = 1;i <= (n-1)/4;i++){
				if(s[(n+3)/2+i-1] != s[n - i+1]){
					flag = 0;
					break;
				}
			}
		if(flag){
			printf("Yes\n");
			return 0;
		}
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (let* ((n (read))
         (k (read)))
    (println
     (if (oddp k)
         (expt (floor n k) 3)
         (+ (expt (floor (+ n (floor k 2)) k) 3)
            (expt (floor n k) 3))))))

#-swank(main)


Measured memory_bytes: 21220
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	long long N, K;
	cin >> N >> K;
	vector<pair<int, int>> A(N);
	for (int i = 0; i < N; i++) cin >> A[i].first >> A[i].second;
	sort(A.begin(), A.end());
	int i = -1;
	while (K > 0) {
		i++;
		K -= A[i].second;
	}
	cout << A[i].first << endl;
}


Measured memory_bytes: 1024
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using static System.Linq.Enumerable;
using static System.Numerics.BitOperations;

namespace ABC175
{
    class SolverC
    {
        static void Main()
        {
            SetOut(new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false});
            new SolverC().Solve();
            Out.Flush();
        }

        public void Solve()
        {
            (long X, long K, long D) = Get.Tuple<long,long,long>();
            long a = Abs(X) / D;
            long ans;
            if(K < a){
                ans = Abs( Abs(X) - D * K);
            }else{
                if((K-a) % 2 == 0){
                    ans = Abs( Abs(X) - D * a);
                }else{
                    ans = Abs( Abs(X) - D * (a+1));
                }
            }
            WriteLine(ans);
        }




        private static class Get
        {
            public static string Str() => ReadLine().Trim();
            public static int Int() => int.Parse(Str());
            public static long Long() => long.Parse(Str());
            public static double Double() => double.Parse(Str());
            public static string[] Strs() => Str().Split(' ', StringSplitOptions.RemoveEmptyEntries);
            public static int[] Ints() => Strs().Select(int.Parse).ToArray();
            public static long[] Longs() => Strs().Select(long.Parse).ToArray();
            public static double[] Doubles() => Strs().Select(double.Parse).ToArray();
            static bool TypeEq<T,U>() => typeof(T).Equals(typeof(U));
            static T TypeConv<T,U>(U u) => (T)Convert.ChangeType(u, typeof(T));
            static T TypeConv<T>(string s) => TypeEq<T, int>() ?   TypeConv<T, int>(int.Parse(s))
                                        : TypeEq<T, long>() ?       TypeConv<T, long>(long.Parse(s))
                                        : TypeEq<T, double>() ?     TypeConv<T, double>(long.Parse(s))
                                        : TypeConv<T, string>(s);
            public static (T,U) Tuple<T,U>() {string[] strs = Strs(); T t = TypeConv<T>(strs[0]); U u = TypeConv<U>(strs[1]); return(t,u);}
            public static (T,U,V) Tuple<T,U,V>() {string[] strs = Strs(); T t = TypeConv<T>(strs[0]); U u = TypeConv<U>(strs[1]); V v = TypeConv<V>(strs[2]); return(t,u,v);}
        }
    }
}


Measured memory_bytes: 27540
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vs = vector<string>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" );
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
const ll INF = 1e9+9, LINF = 1e18;


int main()
{
    string s;
    cin>>s;
    s+="AB";
    rep(i,s.size()){
        if(s[i]==s[i+1])cout<<i+1<<" "<<i+2<<endl,exit(0);
        if(s[i]==s[i+2])cout<<i+1<<" "<<i+3<<endl,exit(0);
    }
    cout<<"-1 -1\n";
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000009
const long long INF = 1LL<<60;

int main() {
    int n,m;
    cin>>n>>m;
    priority_queue<int> q;
    rep(i,n){
        int a;
        cin>>a;
        q.push(a);
    }
    rep(i,m){
        int p=q.top();
        q.pop();
        p/=2;
        q.push(p);
    }

    ll ans=0;
    while (!q.empty()) {
      ans+=q.top();
      q.pop();
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (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; //1e-9?
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...)); }

ll gcd(ll a, ll b) {
    if (b == 0)return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}
int main() {
    init();

    ll a, b, c, d; cin >> a >> b >> c >> d;
    --a;
    ll y = b, x = a;
    y -= b / c + b / d;
    y += b / lcm(c, d);
    x -= a / c + a / d;
    x += a / lcm(c, d);
    cout << y - x << "\n";
}

Measured memory_bytes: 384
#include<cstdio>
using namespace std;
int main(void)
{
	int i,j,h,w,flg,k;
	scanf("%d %d",&h,&w);
	while(!(h==0 && w==0)){
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){	
				if((i+j)%2==1) printf(".");
				else printf("#");
			}
			printf("\n");
		}
		scanf("%d %d",&h,&w);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1000
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  int a;
  cin >> a;
  ll b = 0;
  for (int i = 1; i <= a; i++) {
    if (i % 3 != 0 and i % 5 != 0) {
      b += i;
    }
  }
  cout << b;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
//配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


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

int main(void)
{
	//変数の宣言
	int n;
	char s[100010];
	int sint[100010];
	int animal[100010];
	int flag=0;
	int i,j,k;
	
	//データの読み込み
	scanf("%d\n%s",&n,&s);
	
	for(i=0;i<n;i++){
		if(s[i]=='o'){
			sint[i]=0;
		}else{
			sint[i]=1;
		}
	}
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	for(i=0;i<4;i++){
		if(i%2==0){
			animal[0]=0;
		}else{
			animal[0]=1;
		}
		if(i<2){
			animal[1]=0;
		}else{
			animal[1]=1;
		}
		
		for(j=2;j<=n;j++){
			animal[j]=(animal[j-2]+animal[j-1]+sint[j-1])%2;
		}
		
//		printf("0→%d,n→%d\n",animal[0],animal[n]);
		if(animal[n]==animal[0]&&animal[1]==(animal[n-1]+animal[n]+sint[0])%2){
			flag=1;
			break;
		}
	}
	
	
//	for(i=0;i<n;i++){
//		printf("sint[%d]=%d\n",i,sint[i]);
//	}
	
//	for(i=0;i<n;i++){
//		printf("animal[%d]=%d\n",i,animal[i]);
//	}
	
	
//	printf("計算部分終了\n");
	
	//出力
	
	if(flag==1){
		for(i=0;i<n;i++){
			if(animal[i]==0){
				printf("S");
			}else{
				printf("W");
			}
		}
	}else{
		printf("-1");
	}
	
	
//	printf("結果の出力終了\n");
	
	return 0;
}



Measured memory_bytes: 1152
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;
main(){
    int n=in();
  int mat[600][600];
  rep(i,n){
  string s;
  cin>>s;
  rep(j,n)mat[i][j]=(s[j]=='#'?1:0);}
  int M=INF;
  int c=0;
  rep(i,n)rep(j,n)c+=mat[i][j];
  if(!c){cout<<-1;return 0;}
  rep(j,n){
  int k=0;
  rep(i,n)k+=mat[i][j];
  
    int t=n;
  rep(i,n){
  t-=mat[j][i];}
    if(!k)t++;
  M=min(M,t);}
  
  M+=n;
  rep(j,n){
    int k=0;
    rep(i,n)k+=mat[i][j];
    if(k==n)M--;
  }
  cout<<M;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define _GLIBCXX_DEBUG

bool test(auto &D, int N) {
  string n = to_string(N);
  rep(i, n.size()) {
    if(D[n[i]-'0']) return false;
  }
  return true;
}

signed main() {
  int N, K; cin >> N >> K;
  vector<bool> D(10, false);
  rep(i, K) {
    int d; cin >> d;
    D[d] = true;
  }
  while(!test(D, N)) N++;
  cout << N << endl;
  
}

Measured memory_bytes: 256