akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
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;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int p = 0;
int N;
bool is_prime[MAX_N];
int prime[MAX_N];

void init()
{
  ll m = 55555;
  for (int i = 0; i < m; i++) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  for (ll i = 2; i <= m; i++) {
    if (is_prime[i]) {
      prime[p++] = i;
      for (int j = i * 2; j <= m; j += i) is_prime[j] = false;
    }
  }
}

int main(void)
{
  cin >> N;
  vector<int> ans;

  init();

  for (int i = 0; i < p; i++) {
    if (prime[i] % 5 == 1) {
      ans.push_back(prime[i]);
    }
  }

  for (int i = 0; i < N; i++) {
    cout << ans[i] << SLN(i, N);
  }
  return 0;
}


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

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

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

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

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

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

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

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


int main(void){
	int a, b, k;
	cin >> a >> b >> k;

	vector<int> l;
	for(int i = a; i < min(b, a + k); i++){
		l.push_back(i);
	}

	for(int i = max(a, b - k + 1); i <= b; i++){
		bool same = false;
		for(int j = 0; j < l.size(); j++){
			if(l[j] == i){
				same = true;
				break;
			}
		}
		if(same)continue;
		l.push_back(i);
	}

	for(int i = 0; i < l.size(); i++){
		cout << l[i] << endl;
	}


}



Measured memory_bytes: 256
// In His Name

#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define gcd __gcd
#define int long long
#define ull unsigned long long

using namespace std;

typedef pair<int, int> pii;

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

main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for (int i = 0 ; i < n ; i++){
		cin >> a[i];	
	}
	dp[0] = 0;
	dp[1] = abs (a[1] - a[0]);
	for (int i = 2 ; i < n ; i++){
		dp[i] = min (dp[i - 1] + abs (a[i] - a[i - 1]) , dp[i - 2] + abs (a[i] - a[i - 2]));
	}
	cout << dp[n - 1];
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		while(true){
			int price=cin.nextInt();
			int money=cin.nextInt();
			if(price+money==0)break;
			price=money-price;
			int a=0,b=0,c=0;
			while(price>=1000){
				price-=1000;
				c++;
			}
			while(price>=500){
				price-=500;
				b++;
			}
			while(price>=100){
				price-=100;
				a++;
			}
			System.out.println(a+" "+b+" "+c);
		}

	}

}

Measured memory_bytes: 25068
#include<bits/stdc++.h>
#define C(x,y) (1ll*fac[x]*invf[y]%mod*invf[x-(y)]%mod)
using namespace std;
const int mod=1e9+7;
int n,a,b,c,fac[200010],invf[200010],ans;
int POW(int x,int y){
	int tot=1;
	while(y)y&1?tot=1ll*tot*x%mod:0,x=1ll*x*x%mod,y>>=1;
	return tot;
}
int main(){
	scanf("%d%d%d%d",&n,&a,&b,&c),fac[0]=1;
	for(int i=1;i<=(n<<1);++i)fac[i]=1ll*fac[i-1]*i%mod;
	invf[n<<1]=POW(fac[n<<1],mod-2);
	for(int i=(n<<1)-1;i>=0;--i)invf[i]=1ll*invf[i+1]*(i+1)%mod;
	for(int i=n;i<(n<<1);++i)ans=(ans+1ll*C(i-1,n-1)*((1ll*POW(a,n)*POW(b,i-n)+1ll*POW(a,i-n)*POW(b,n))%mod)%mod*i%mod*100%mod*POW(POW(a+b,i),mod-2)%mod*POW(100-c,mod-2)%mod)%mod;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1792
import math
import fractions
#import sys
#input = sys.stdin.readline

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''

#a = list(map(int, input().split()))

#################################################
#################################################
#################################################
#################################################

n = int(input())
a = list(map(int, input().split()))

imp = -999999999999999999

dp = [[-1e30,-1e30,-1e30,-1e30] for i in range(n)]
#donthave-Small, donthave-Big, have-Small, have-Big

dp[0][0] = 0
dp[0][1] = imp
dp[0][2] = imp
dp[0][3] = a[0]
dp[1][0] = 0
dp[1][1] = dp[0][3]
dp[1][2] = imp
dp[1][3] = a[1]

for ii in range(n-2):
    i = 2+ii
    must = i//2
    if(i%2==0):
        dp[i][0] = max(dp[i-1][1],dp[i-1][3])
        dp[i][1] = imp
        dp[i][2] = dp[i-1][0] + a[i]
        dp[i][3] = dp[i-1][1] + a[i]
    else:
        dp[i][0] = max(dp[i-1][0],dp[i-1][2])
        dp[i][1] = max(dp[i-1][1],dp[i-1][3])
        dp[i][2] = imp
        dp[i][3] = dp[i-1][0] + a[i]
        
if(n%2==0):
    print(max(dp[-1][1],dp[-1][3]))
else:
    print(max(dp[-1][0],dp[-1][2]))
    
    
    
    
    
    
    
    
    




Measured memory_bytes: 130348
#x>Kの時、x => x-k =>x-2k => x-3k ... : xをkで割った余りになる
#x<Kの時、x　=> k-x => x : max(x,k-x)
n,k = map(int,input().split())
if n >= k:
    n = n%k
print(n if n%k <= k-n else k-n)

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ll long long int

using namespace std;

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

  pair<int,int> p[100];

  if (n%2 == 0) {
    REP(i, n/2) {
      p[i] = make_pair(i + 1, n - i);
    }

    if(n == 4) {
      cout << 4 << endl;
      cout << p[0].first << " " << p[1].first << endl;
      cout << p[0].second << " " << p[1].first << endl;
      cout << p[0].first<< " " << p[1].second << endl;
      cout << p[0].second << " " << p[1].second << endl;
      return 0;
    } else {
      cout << 2*n << endl;
      REP(i, n/2) {
        if (i != (n/2) - 1) {
          cout << p[i].first << " " << p[i+1].first << endl;
          cout << p[i].second << " " << p[i+1].first << endl;
          cout << p[i].first << " " << p[i+1].second << endl;
          cout << p[i].second << " " << p[i+1].second << endl;
        } else {
          cout << p[i].first << " " << p[0].first << endl;
          cout << p[i].second << " " << p[0].first << endl;
          cout << p[i].first << " " << p[0].second << endl;
          cout << p[i].second << " " << p[0].second << endl;
        }
      }
    }
  } else {
    REP(i, (n-1)/2) {
      p[i] = make_pair(i + 1, n - i - 1);
    }

    if (n == 3)
    {
      cout << 2 << endl;
      cout << p[0].first << " " << n << endl;
      cout << p[0].second << " " << n << endl;
      return 0;
    } else {
      cout << 2 * (n-1) << endl;

      REP(i, (n-1)/2)
      {
        if (i != ((n-1)/2)-1)
        {
          cout << p[i].first << " " << p[i + 1].first << endl;
          cout << p[i].second << " " << p[i + 1].first << endl;
          cout << p[i].first << " " << p[i + 1].second << endl;
          cout << p[i].second << " " << p[i + 1].second << endl;
        } else {
          cout << p[i].first << " " << n << endl;
          cout << p[i].second << " " << n << endl;
          cout << p[0].first << " " << n << endl;
          cout << p[0].second << " " << n << endl;
        }
      }
    }
  }
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll X, A, B;
    cin >> X;
    cin >> A;
    cin >> B;

    cout << (X-A)%B << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
//cout << fixed << setprecision(15);

int main() {
  int n;
  cin >> n;
  if(n < 3) {
    cout << 0 << endl;
    return 0;
  }

  vector<ll> L(n);
  rep(i, n) cin >> L[i];

  int ans = 0;
  rep(i, n-2) {
    for(int j = i+1; j < n-1; j++) {
      for(int k = j+1; k < n; k++) {
        if(L[i] != L[j] && L[j] != L[k] && L[k] != L[i] && L[i] > L[k] - L[j] && L[j] > L[i] - L[k] && L[k] > L[j] - L[i]) ans++;
      }
    }
  }
  cout << ans << endl;
}


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

int main(){
  int a, b, c, k, max = 0;
  cin >> a >> b >> c >> k;

  if (k < a){
    cout << k << endl;
    return 0;
  }
  k -= a;
  max += a;
  if (k < b){
    cout << max << endl;
    return 0;
  }
  k -= b;
  cout << max - k << endl;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
bool is_prime(int x) {
  for(long i = 2; i<x; i++){
    if(x%i==0){
		return (false);
    }
  }
  return (true);
}
int main() {
    int x;
    cin >> x;
    while (true) {
        if (is_prime(x)) {
            cout << x << '\n';
            return 0;
        } else {
            x++;
        }
    }
}

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

namespace ABC043A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n , s , i;
            n = int.Parse(Console.ReadLine());

            s = 0;

            for (i = 1; i <= n; i++)
            {
                s = s + i;
            }

            Console.WriteLine(s);

            Console.ReadKey();
            
        }
    }
}

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

int main(){
    int x,n;
    cin >> x >> n;
    vector<int> p(n);
    rep(i,n) cin >> p.at(i);
    int ans1 = INF;
    for(int i = x; i <= 101;i++){
        bool f = true;
        for(auto pi : p){
            if(pi == i) f = false;
        }
        if(!f)continue;
        if(abs(ans1 - x) > abs(i - x)) ans1 = i;
    }
    int ans2 = INF;
    for(int i = x; i >= 0;i--){
        bool f = true;
        for(auto pi : p){
            if(pi == i) f = false;
        }
        if(!f)continue;
        if(abs(ans2-x) > abs(x - i)) ans2 = i;
    }
    int ans;
    if(abs(ans1 - x) > abs(ans2 - x)) ans = ans2;
    else if(abs(ans1 - x) == abs(ans2 - x)) ans = min(ans1,ans2);
    else ans = ans1;
    cout << ans << endl; 

}

Measured memory_bytes: 3628
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n) {
        if (a[i] % 2 == 1) {
            cout << "first" << endl;
            return 0;
        }
    }
    cout << "second" << endl;
}


Measured memory_bytes: 640
#include <stdio.h>

int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	
	int c = b - a;
	int A = 0;
	int i;
	for(i = 1; i < c; i++){
		A += i;
	}
	
	int Ans = A - a;
	
	printf("%d", Ans);
	
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		while (true) {
			int n = scan.nextInt();
			int x = scan.nextInt();
			if (n == 0 && x == 0) break;
			int count = 0;
			for (int i = 1; i <= n - 2; i++) {
				for (int j = i + 1; j <= n - 1; j++) {
					for (int k = j + 1; k <= n; k++) {
						if (i + j + k == x) count++;
					}
				}
			}
			System.out.println(count);
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 26124
N = int(input())
S = dict()
for i in range(N):
    s = input()
    if s in S:
        S[s] += 1
    else:
        S[s] = 1

max_val = max(S.values())
max_key = [key for key in S if S[key] == max_val]
print("\n".join(sorted(max_key)))


Measured memory_bytes: 36684
N, M = map(int, input().split())
X = list(set(map(int, input().split())))
M = len(X)

if N>=M:
  print(0)
else:
  X.sort()
  Y=[]
  for i in range(len(X)-1):
    Y.append([i,X[i+1]-X[i]])
  Y.sort(reverse=True, key=lambda x:x[1])
  Y=Y[:N-1]
  Y.sort()
  ans=0
  old=0
  for i in range(N-1):
    tmp=X[old:Y[i][0]+1]
    ans+=max(tmp)-min(tmp)
    old=Y[i][0]+1
  else:
    if old<len(X):
      tmp=X[old:]
      ans+=max(tmp)-min(tmp)
  print(ans)

Measured memory_bytes: 21592
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,v,j;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++){
    if(i!=n-1) cout<<a[i]<<" ";
    else cout<<a[i];
  }
  cout<<endl;
  for(int i=1;i<n;i++){
    v=a[i];
    j=i-1;
    while(j>=0 && a[j]>v){
      a[j+1]=a[j];
      j--;
      a[j+1]=v;
    }
    for(int k=0;k<n;k++){
      if(k!=n-1) cout<<a[k]<<" ";
      else cout<<a[k];
    }
    cout<<endl;
  }
  return 0;
}
  


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k; cin >> n >> k;
    vector<ll> a(n);
    REP(i,n) cin >> a[i];
    ll ans = 0;
    REP(i,n) {
        ll b=0, d=0;
        REP(j,i) {
            b += (a[j]>a[i]);
        }
        REP(j,n) {
            d+=(a[j]>a[i]);
        }
        ans += b*k + (k*(k-1)/2)%MOD*d%MOD;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
//const long long mod = 1000000007;
//const long long mod = 998244353;

struct  W
{
	int f, t, c;
};

int main() {
	int N, M, P;
	scanf("%d %d %d", &N, &M, &P);
	W*w = new W[M];
	for (int i = 0; i < M; i++) {
		int f, t, c;
		scanf("%d %d %d", &f, &t, &c);
		w[i].f = f - 1;
		w[i].t = t - 1;
		w[i].c = c - P;
	}
	bool *cgfs = new bool[N];
	bool *cgtg = new bool[N];
	std::vector<int> fs, fg;
	fs.push_back(0);
	fg.push_back(N - 1);
	cgfs[0] = true;
	cgtg[N - 1] = true;
	for (int i = 0; i < N; i++) {
		cgfs[i] = false;
		cgtg[i] = false;
	}
	for (int i = 0; i < N; i++) {
		if (i < fs.size()) {
			for (int j = 0; j < M; j++) {
				if (w[j].f == fs[i] && !cgfs[w[j].t]) {
					cgfs[w[j].t] = true;
					fs.push_back(w[j].t);
				}
			}
		}
		if (i < fg.size()) {
			for (int j = 0; j < M; j++) {
				if (w[j].t == fg[i] && !cgtg[w[j].f]) {
					cgtg[w[j].f] = true;
					fg.push_back(w[j].f);
				}
			}
		}
	}
	long long *v = new long long[N];
	for (int i = 0; i < N; i++) {
		v[i] = 0xbfffffffffffffff;
	}
	v[0] = 0;
	bool inf = false;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			if (v[w[j].t] < v[w[j].f] + w[j].c) {
				v[w[j].t] = v[w[j].f] + w[j].c;
				if (i == N - 1 && cgfs[w[j].t] && cgtg[w[j].t]) {
					inf = true;
					break;
				}
			}
		}
	}
	if (inf) {
		printf("-1");
	}
	else {
		printf("%lld", v[N - 1] < 0 ? 0 : v[N - 1]);
	}
	return 0;
}

Measured memory_bytes: 384
import java.util.*
fun main(args:Array<String>){
    val line = readLine()!!.split(" ").map {it.toLong()}
    val a = line[0]
    val b = line[1]
    val c = line[2]
    if(c-a-b<0){
        println("No")
    }else{
        if(4*a*b<(c-a-b)*(c-a-b)){
            println("Yes")
        }else{
            println("No")
        }
    }
}

Measured memory_bytes: 37988
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
L = [[int(v) - 1 for v in input().split()] for _ in range(M)]

L.sort(key = lambda x:(-x[1], -x[0]))

ans = 0
k = 0
bx = L[0][0]
for i in range(M):
    x, y = L[i]
    if bx < y:
        k += 1
        if bx <= x:
            bx = x
        continue
    else:
        ans += 1
        if i == M - 1:
            k = 1

        bx = x

print(ans + (1 if k != 0 else 0))

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

using namespace std;

#define ull unsigned long long int
#define ll long long int 

template <typename T>std::string NumberToString ( T Number ){std::ostringstream ss; ss << Number;return ss.str(); } // Usages NumberToString(3)
template <typename T>T StringToNumber ( const string &Text ){istringstream ss(Text);T result;return ss >> result ? result : 0;} // StringToNumber<int>("3")

int main(){

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

    int n;
    cin >> n;
    cout << n/2 + n%2 << endl;

   
   return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}

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

signed main(void)
{
  int n, a, b;
  cin >> n >> a >> b;
  if((a-b)%2) {
    cout << "Borys" << endl;
  } else {
    cout << "Alice" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include"stdio.h"
#define LN 999999
int main(){
    int n,i,e=0,res=LN;
    char s[LN];
    scanf("%d%s",&n,s);
    for(i=0;i<n;i++){
        if(s[i]=='E') e++;
    }
    for(i=0;i<n;i++){
      	if(s[i]=='E') e--;
        res=min(res,e);
        if(s[i]=='W') e++;
    }
    printf("%d",res);
    return 0;
}
int min(int a,int b){
    if(a<b){
        return a;
    }
    else{
        return b;
    }
}


Measured memory_bytes: 2004
import  scala.io.StdIn
object Main extends App {
  val a = StdIn.readLine()
  val b = StdIn.readLine()
  if(b.charAt(0).toString == "-")println("GREATER")
  else {
    (a, b) match {
      case (a, b) if (a.length > b.length) => println("GREATER")
      case (a, b) if (a.length < b.length) => println("LESS")
      case (a, b) if (a.length == b.length) => {
        if (a == b) println("EQUAL")
        else {
          var i = 0
          while (i < a.length) {
            if (a(i) > b(i)){
              println("GREATER")
              i = a.length
            }
            else if (a(i) < b(i)) {
              println("LESS")
              i = a.length
            }
            i = i+1
          }
        }
      }
      case _ => println("")
    }
  }
}

Measured memory_bytes: 25380
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
//#define uint __int128_t

#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))-(a).begin()
#define upp(a,b) upper_bound(all(a),(b))-(a).begin()
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;

int N,K;
int a[303];
int dp[303][100010];


signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    cin>>N>>K;
    rep(i,0,N)cin>>a[i];
    rep(i,0,N+1)dp[i][0]=1;
    
    rep(i,0,N){
        rep(j,1,K+1){
            if(j-1-a[i]>=0){
                dp[i+1][j]=(dp[i+1][j-1]+dp[i][j]-dp[i][j-1-a[i]]+MOD)%MOD;
            }else{
                dp[i+1][j]=(dp[i+1][j-1]+dp[i][j])%MOD;
            }
        }
    }
    cout<<dp[N][K]<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
    return 0;
}

Measured memory_bytes: 79360
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  ll H;cin >> H;
  ll n = 1;
  while(H!=0){
    H/=2;
    n *= 2;
  }
  --n;
  cout << n << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll k;
  cin >> k;
  ll n=50;
  vec a(n);
  for(ll i=0;i<n;i++) {
    a[i]=i+k/n;
  }
  k%=50;
  for(ll i=0;i<n;i++) {
    if(i<k) {
      a[i]+=n-k+1;
    }
    else {
      a[i]-=k;
    }
  }
  cout << n << endl;
  for(ll i=0;i<n;i++) {
    if(i) cout << " ";
    cout << a[i];
  } 
}

Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())

dx = tx - sx
dy = ty - sy
n = dx + dy
memo = ['' for i in range(n)]
memo2 = ['' for i in range(n)]
lmemo = ['' for i in range(n+2)]
lmemo2 = ['' for i in range(n+2)]

ans = ''

for i in range(dy):
    ans += 'U'

for i in range(dx):
    ans += 'R'

for i in range(dy):
    ans += 'D'

for i in range(dx):
    ans += 'L'

# 2回目
ans += 'L'
for i in range(dy+1):
    ans += 'U'

for i in range(dx+1):
    ans += 'R'

ans += 'D'
ans += 'R'
for i in range(dy+1):
    ans += 'D'

for i in range(dx+1):
    ans += 'L'

ans += 'U'

print(ans)

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

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

using namespace std;

const double PI=acos(-1);

template<class T>
vector<T> longest_increasing_subsequence(const vector<T> &a){
	vector<T> lis;
	for(const auto& x:a){
		auto it=lower_bound(lis.begin(),lis.end(),x);
		if(it!=lis.end()) *it=x;
		else lis.emplace_back(x);
	}
	return lis;
}

int main(){
	int sx,sy,gx,gy,n;
	scanf("%d%d%d%d%d",&sx,&sy,&gx,&gy,&n);
	vector<int> x(n),y(n);
	rep(i,n) scanf("%d%d",&x[i],&y[i]);

	if(sx>gx){
		sx*=-1;
		gx*=-1;
		rep(i,n) x[i]*=-1;
	}
	if(sy>gy){
		sy*=-1;
		gy*=-1;
		rep(i,n) y[i]*=-1;
	}
	if(gx-sx>gy-sy){
		swap(sx,sy);
		swap(gx,gy);
		rep(i,n) swap(x[i],y[i]);
	}

	if(sx==gx){
		int m=0;
		rep(i,n) if(x[i]==sx && sy<y[i] && y[i]<gy) m++;
		printf("%.15f\n",100.0*(gy-sy)+(10*PI-20)*m);
		return 0;
	}
	if(sy==gy){
		int m=0;
		rep(i,n) if(y[i]==sy && sx<x[i] && x[i]<gx) m++;
		printf("%.15f\n",100.0*(gx-sx)+(10*PI-20)*m);
		return 0;
	}

	vector<int> Y;
	{
		vector<pair<int,int>> p;
		rep(i,n) if(sx<=x[i] && x[i]<=gx && sy<=y[i] && y[i]<=gy) {
			p.emplace_back(x[i],y[i]);
		}
		sort(p.begin(),p.end(),[](const auto& a,const auto& b){
			return make_pair(a.first,-a.second)<make_pair(b.first,-b.second);
		});
		rep(i,p.size()) Y.emplace_back(p[i].second);
	}

	int m=longest_increasing_subsequence(Y).size();
	if(m<=gx-sx) printf("%.15f\n",100.0*(gx-sx+gy-sy)+(5*PI-20)*m);
	else         printf("%.15f\n",100.0*(gx-sx+gy-sy)+(5*PI-20)*(m-1)+(10*PI-20));

	return 0;
}


Measured memory_bytes: 5232
#include <iostream>
#include <queue>
using namespace std;
typedef long long ll;

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

    int sum = 0, i = 0, j = 0;
    while (i < N && sum + A[i] <= K){
        sum += A[i++];
    }
    while (j < M && sum + B[j] <= K){
        sum += B[j++];
    }


    int ans = i + j;
    while (i > 0){
        sum -= A[--i];

        while (j < M && sum + B[j] <= K){
            sum += B[j++];
        }
        ans = max(ans, i+j);
    }

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

Measured memory_bytes: 5104
use std::cmp::min;
use std::collections::HashMap;
use std::io::prelude::*;

fn main() {
    let stdin = std::io::stdin();
    let mut reader = std::io::BufReader::new(stdin.lock());
    let mut s = String::new();
    reader.read_line(&mut s).unwrap();
    let n: usize = s.trim().parse().unwrap();

    let mut s = String::new();
    reader.read_line(&mut s).unwrap();
    let v: Vec<usize> = s.split_whitespace().map(|x| x.parse().unwrap()).collect();

    let mut odd = HashMap::new();
    let mut even = HashMap::new();

    for i in 0..n {
        if i % 2 == 0 {
            let count = odd.entry(v[i]).or_insert(0);
            *count += 1;
        } else {
            let count = even.entry(v[i]).or_insert(0);
            *count += 1;
        }
    }

    let mut odd: Vec<_> = odd.iter().collect();
    let mut even: Vec<_> = even.iter().collect();
    odd.sort_by_key(|k| k.1);
    even.sort_by_key(|k| k.1);
    odd.reverse();
    even.reverse();

    println!(
        "{}",
        if odd[0].0 != even[0].0 {
            v.len() - odd[0].1 - even[0].1
        } else {
            min(n - odd[0].1 - if even.len() > 1 { *even[1].1 } else { 0 }, n - even[0].1 - if odd.len() > 1 { *odd[1].1 } else { 0 })
        }
    );
}


Measured memory_bytes: 14200
#include<cstdio>

int main(){
	int a;
  	scanf("%d",&a);
  	a=a%10;
  switch(a){
    case 2:;
    case 4:;
    case 5:;
    case 7:;
    case 9:printf("hon");
      		break;
    case 1:;
    case 0:;
    case 6:;
    case 8:printf("pon");
      		break;
    case 3:printf("bon");
      		break;
  }
  return 0;
}

Measured memory_bytes: 3244
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < ( n ); ++i )
using namespace std;
using ll = long long;
using ull = unsigned long long;
using p  = pair<int, int>;
using vec_int = vector<int>;
using vec_str = vector<string>;
#define INF (1<<29)

int main()
{
    int N = 0;
    string S;

	cin >> S;

    if(S[0] == '7'||S[1] == '7'||S[2] == '7') cout << "Yes";
    else cout << "No";

    return 0;
}

Measured memory_bytes: 3624
import java.util.*;
public class Main{
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int p[]=new int[N];
		for(int i=0;i<N;i++) {
			p[i]=sc.nextInt();
		}
		sc.close();
		int count=0;
		for(int j=0;j<N;j++) {
			if(p[j]!=(j+1)) {
				count++;
			}
		}
		if(count==0||count==2) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define popcnt __builtin_popcount
#define getBit(x, k) ((x >> k) & 1)
#define all(x) (x).begin(),(x).end()
// ---------------------------------

void Main() {
  int n; cin >> n;
  string s; cin >> s;
  vector<int> l(n), r(n);
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') l[i]++;
    if (i) l[i] += l[i - 1];
  }
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '.') r[i]++;
    if (i < n - 1) r[i] += r[i + 1];
  }
  int ans = 2e9;
  for (int i = 0; i <= n; i++) {
    int t = 0;
    if (i - 1 >= 0) t += l[i - 1];
    if (i <= n - 1) t += r[i];
    ans = min(ans, t);
  }
  cout << ans << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  cerr << "- ---- -- ----- <3\n";
#endif
  cin.tie(0)->sync_with_stdio(0);
  int T = 1;
  // cin >> T;
  while (T--) Main();
}


Measured memory_bytes: 6784
#include <iostream>
#include <math.h>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    int x=0;
    if(b<10){
        x=10*a+b;
    }
    else if(b<100){
        x=100*a+b;
    }
    else if(b==100){
        x=1000*a+b;
    }
    for(int i=1;i<1000;i++){
        if(i*i==x){
            cout<<"Yes"<<endl;
            return 0;
        }
        else if(i*i>x){
            cout<<"No"<<endl;
            return 0;
        }
    }
}


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

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

  int n;
  cin >> n;
  int ans = 0, front_highest = 0;
  rep(i, 0, n) {
    int h;
    cin >> h;
    if (h >= front_highest) {
      ans++;
      front_highest = h;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

int main() {
    int a[5];
    rep(i,5){
        cin >> a[i];
        if(a[i] == 0) dunk(i+1);
    }
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005;
const ll INF=1LL<<60;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<ll> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    ll x=A[0]+A[1],y=0;
    for(int i=2;i<N;i++) y^=A[i];
    
    if((x&1LL)!=(y&1LL)||x<y){
        cout<<-1<<endl;
        return 0;
    }
    
    ll z=(x-y)/2;
    
    ll ans=z;
    
    for(int i=60;i>=0;i--){
        if(z&(1LL<<i)) continue;
        if(!(y&(1LL<<i))) continue;
        
        if(ans+(1LL<<i)<=A[0]){
            ans+=(1LL<<i);
        }
    }
    
    if(ans==0||ans>A[0]||y&z) cout<<-1<<endl;
    else cout<<A[0]-ans<<endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const long double EPS = 1e-10;

class Point {
  public:
  long double x, y;

  Point(long double x = 0, long double y = 0): x(x), y(y) {}

  Point operator + (Point &p) {
    return Point(x + p.x, y + p.y);
  }

  Point operator - (Point &p) {
    return Point(x - p.x, y - p.y);
  }

  Point operator * (long double k) {
    return Point(x * k, y * k);
  }

  Point operator / (long double k) {
    return Point(x / k, y / k);
  }

  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
};

long double norm(Point p) {
  return p.x * p.x + p.y * p.y;
}

long double abs(Point p) {
  return sqrt(norm(p));
}

long double dot(Point p1, Point p2) {
  return p1.x * p2.x + p1.y * p2.y;
}

long double cross(Point p1, Point p2) {
  return p1.x * p2.y - p1.y * p2.x;
}

int ccw(Point p0, Point p1, Point p2) {
  Point v1 = p1 - p0, v2 = p2 - p0;
  if (cross(v1, v2) > 0) return 1;
  else if (cross(v1, v2) < 0) return -1;
  else if (dot(v1, v2) < 0) return 2;
  else if (norm(v1) < norm(v2)) return -2;
  else return 0;
}

bool intersect(Point p1, Point p2, Point p3, Point p4) {
  return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}

long double getDistanceLP(Point p1, Point p2, Point p3) {
  return fabs(cross(p2-p1, p3-p1) / abs(p2-p1));
}

long double getDistanceSP(Point p1, Point p2, Point p3) {
  if (dot(p2-p1, p3-p1) < 0) return abs(p3-p1);
  else if (dot(p1-p2, p3-p2) < 0) return abs(p3-p2);
  else return getDistanceLP(p1, p2, p3);
}

long double getDistanceTS(Point p1, Point p2, Point p3, Point p4) {
  if (intersect(p1, p2, p3, p4)) return 0;
  long double ans = INF;
  ans = min(ans, getDistanceSP(p1, p2, p3));
  ans = min(ans, getDistanceSP(p1, p2, p4));
  ans = min(ans, getDistanceSP(p3, p4, p1));
  ans = min(ans, getDistanceSP(p3, p4, p2));
  return ans;
}

class Circle {
  public:
  Point p;
  long double r;
};

int main() {
  Circle c1, c2;
  cin >> c1.p.x >> c1.p.y >> c1.r;
  cin >> c2.p.x >> c2.p.y >> c2.r;
  if (c2.p < c1.p) swap(c1, c2);

  long double t, a;
  t = atan2(c2.p.y - c1.p.y, c2.p.x - c1.p.x);
  a = acos((norm(c2.p - c1.p) + c1.r * c1.r - c2.r * c2.r) / (2 * abs(c2.p - c1.p) * c1.r));

  Point a1, a2;
  a1.x = c1.r * cos(t+a) + c1.p.x;
  a1.y = c1.r * sin(t+a) + c1.p.y;
  a2.x = c1.r * cos(t-a) + c1.p.x;
  a2.y = c1.r * sin(t-a) + c1.p.y;

  if (equals(a1.x, 0)) a1.x = 0;
  if (equals(a1.y, 0)) a1.y = 0;
  if (equals(a2.x, 0)) a2.x = 0;
  if (equals(a2.y, 0)) a2.y = 0;
  if (a2 < a1) swap(a1, a2);

  cout << setprecision(20) << a1.x << " " << a1.y << " " << a2.x << " " << a2.y << endl;


  
  return 0;
}


Measured memory_bytes: 3596
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        long n = Long.parseLong(br.readLine());
        long i=1L;
        long tot = 0L;
        while(i<=n){
            if(i%3!=0 && i%5!=0){
                tot+=i;
            }
            i++;
        }
        System.out.println(tot);
    }
}



Measured memory_bytes: 32556
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x7f
#define MAX_INF_VAL 0x7f7f7f7f
#define pi 3.141592653589
#define eps 1e-6
//#define p 2173412051LL
//#define sz 2

using namespace std;

char s[ 200010 ];
int f[ 2 ][ 200010 ];

int main() {
	int n;
	scanf( "%s", s + 1 );
	n = strlen( s + 1 );
	for( int i = 1; i <= n; ++i ) {
		if( s[ i ] != s[ i - 1 ] )
			f[ 0 ][ i ] = max( f[ 0 ][ i ], f[ 0 ][ i - 1 ] + 1 );
		if( i > 1 )
			f[ 0 ][ i ] = max( f[ 0 ][ i ], f[ 1 ][ i - 1 ] + 1 );
		if( i > 1 )
			f[ 1 ][ i ] = max( f[ 1 ][ i ], f[ 0 ][ i - 2 ] + 1 );
		if( i > 2 && ( s[ i - 3 ] != s[ i - 1 ] || s[ i - 2 ] != s[ i ] ) )
			f[ 1 ][ i ] = max( f[ 1 ][ i ], f[ 1 ][ i - 2 ] + 1 );
	}
	printf( "%d", max( f[ 0 ][ n ], f[ 1 ][ n ] ) );
	return 0;
}

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


int main(){
	long long int a,b,n;
	cin >> a >> b >> n;
	if(b>n){
		cout << floor(a*n/b) << endl;
	}else{
		cout << floor(a*(b-1)/b) << endl;
	}
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void print() { cout << "\n"; }
template <class T, class... Args>
void print(const T &x, const Args &... args) { cout << x << " "; print(args...);}
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  string s;
  cin >> s;
  if (s == "ABC") cout << "ARC\n";
  else cout << "ABC\n";
  return 0;
}

Measured memory_bytes: 3612
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

LL modinv(LL a) {
    LL b = MOD, u = 1, v = 0;
    while (b) {
        LL t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

LL moddev(LL a, LL b){
	return a * modinv(b) % MOD;
}

void Main()
{
    int n,m; cin >> n >> m;

    VI s(n,0);
    int ac = 0;
    int wa = 0;
    
    REP(i, m){
        int p;
        string type;
        cin >> p >> type;

        if(type == "AC"){
            if(s[p] != -1){
                ac ++;
                wa += s[p];
                s[p] = -1;
            }
        }
        else{
            if(s[p] != -1){
                s[p] ++ ;
            }
        }
    }

    cout << ac << " " << wa << endl;

    

    

	return;
}

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

Measured memory_bytes: 640
S = input()

i = 1
cnt = 0
for s in S:
    if i % 2 != 0:
        if s == 'R' or s == 'U' or s == 'D':
            cnt += 1
            i +=1
        else:
            i +=1
            continue
    elif i % 2 == 0:
        if s == 'L' or s == 'U' or s == 'D':
            cnt += 1
            i+=1
        else:
            i+=1
            continue
if cnt == len(S):
    print('Yes')
else:
    print('No')



Measured memory_bytes: 3064
N = int(input())
T = list(int(x) for x in input().split())
H = list(int(y) for y in input().split())
ans = list()
for i in H:
  div = 0
  tem = T[0] - i*0.006
  if tem > T[1]:
    div = tem - T[1]
  else:
    div = T[1] - tem
  ans.append(div)
print(ans.index(min(ans))+1)


Measured memory_bytes: 3060
w = input()
dic = {}
for i in w:
    if(i in dic) == False:
        dic[i] = 1
    else:
        dic[i] += 1
ans = True
for key,value in dic.items():
    if(value %2 == 0):
        continue
    else:
        ans = False
        break
if(ans):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
import sys

# 実行環境(0:vscode, 1:atcoder)
MODE = 1

# 入力の次元
DIMENSION = 1

# int型に変換
INT_TYPE = 1

if not (MODE):
    with open("input.txt", "r") as f:
        s = f.read()
else:
    s = sys.stdin.read()

if DIMENSION == 0:
    if INT_TYPE == 1:
        s = int(s)
elif DIMENSION == 1:
    if INT_TYPE == 0:
        s = s.split()
    elif INT_TYPE == 1:
        s = [int(x) for x in s.split()]
elif DIMENSION == 2:
    if INT_TYPE == 0:
        s = [x.split() for x in s.splitlines()]
    elif INT_TYPE == 1:
        s = [[int(y) for y in x.split()] for x in s.splitlines()]

print(s[0]*s[1])


Measured memory_bytes: 9212
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>

typedef long double ld;
typedef long long ll;

template<typename H> void print(H head) { std::cout << head << std::endl; }

int main()
{
  ll N;
  std::cin >> N;

  std::vector<ld> va(N, 0.0);
  for (ll i = 0; i < N; ++i) {
    std::cin >> va[i];
  }

  ld tmp = 0.0;
  for (auto& x : va) {
    tmp += 1.0 / x;
  }

  ld ans = 1.0 / tmp;

  std::cout << std::setprecision(16);
  print(ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<math.h>
#include <climits>

using namespace std;

int main() {
    int n,ans[3] = {0},a[3];
    cin>>n;
    for(int i=0;i<n;i++) {
        for(int j = 0;j<3;j++)
        cin>>a[j];
        int x[3] = {0};
        for(int k = 0;k<3;k++){
            for(int j = 0;j<3;j++){
                if(k!=j)
                x[k] = max(x[k],ans[j]+a[k]);
            }
        }
        for(int j = 0;j<3;j++)
        ans[j]= x[j];
    }
    cout<<max(max(ans[0],ans[1]),ans[2]);
}

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

int main()
{
  int N;
  cin >> N;
  string S;
  cin >> S;
  int K;
  cin >> K;
  char c = S.at(K - 1);
  for (int i = 0; i < S.size(); i++)
  {
    if (S.at(i) != c)
      S.at(i) = '*';
  }
  for (int i = 0; i < S.size(); i++)
  {
    cout << S.at(i);
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void) {
	int i, n,a[4];
	
	// 標準入力する
	for (i = 0, n = sizeof(a); i < n; ++i) {
		cin >> a[i];
	}

	// 標準出力する
	cout << (a[0] - a[2]) * (a[1] - a[3]);
}

Measured memory_bytes: 256
lst = input()
count = 0
for i in range(int(lst)):
    q = input()
    q = q.split()
    for d in range(len(q)):
        q[d] = int(q[d])
    if q[0] == q[1]:
        count += 1
    else:
        count = 0
    if count > 2:
        print('Yes')
        exit()
print('No')

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
 
#define             ll  long long
#define            ull  unsigned long long
#define            P_B  push_back
#define            M_P  make_pair
#define         DBG(x)  printf("%s %d\n", #x, x)
#define       DBGLL(x)  printf("%s %lld\n", #x, x)
#define         SCI(x)  scanf("%d",&x)
#define         SCD(x)  scanf("%lf",&x)
#define         SCS(x)  scanf("%s",x)
#define         CLR(x)  memset(x, 0, sizeof(x))
#define        CLRN(x)  memset(x, -1, sizeof(x))
#define        SCLL(x)  scanf("%lld", &x)
#define      FOR(i, n)  for(int i = 0; i < n; i++)
#define  FORR(i, m, n)  for(int i = m; i < n; i++)
#define     SCI2(m, n)  scanf("%d%d", &m, &n)
#define  SCI3(m, n, o)  scanf("%d%d%d",&m, &n, &o)
#define     SCD2(m, n)  scanf("%lf%lf",&m,&n)
#define  SCD3(m, n, o)  scanf("%lf%lf%lf",&m,&n,&o)
#define    SCLL2(m, n)  scanf("%lld%lld", &m, &n)
#define SCLL3(m, n, o)  scanf("%lld%lld%lld",&m, &n, &o)
#define             vi  vector<int>
#define            vii  vector<pair<int, int> >
#define            vll  vector<pair<ll, ll> >
#define            Mod  998244353
#define            INF  1000000000
 
int n;
int w[105][2];
int m;
int dp[105];
int fl[105];

int f(int i, int W)
{
	if(W == 0) return 0;
	if(W < 0) return -INF;
	if(i == n) return 0;
	if(fl[i]) return dp[i];
	dp[i] = max(f(i+1, W - w[i][0]) + w[i][1], f(i+1, W));
	fl[i] = 1;
	return dp[i];
}

int main()
{
	CLR(fl);	
	SCI2(n, m);
	FOR(i, n)SCI2(w[i][0], w[i][1]);
	int x[100005];
	CLRN(x);
	FOR(i, n){
		for(int j = 100000; j > 0; j--){
			if(x[j] != -1){
				if(x[j] + w[i][0] <= m){
					if(x[j + w[i][1]] != -1)
						x[j + w[i][1]] = min(x[j] + w[i][0], x[j+w[i][1]]);
					else
						x[j + w[i][1]] = x[j] + w[i][0];
				}
			}
		}
		if(w[i][0] <= m){
			if(x[w[i][1]] != -1)x[w[i][1]] = min(x[w[i][1]], w[i][0]);
			else x[w[i][1]] = w[i][0];
		}
	}
	int y = 0;
	for(int i = 100000; i >= 0; i--) 
		if(x[i] > 0){
			y = i;
			break;	
		}
	printf("%d\n", y);
}

Measured memory_bytes: 640