akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;

int main(){
  int n;
  cin >> n;
  map<int,int> m;
  rep(i,n) {
    int a;
    cin >> a;
    m[a]++;
  }
  bool f = true;
  for(auto x: m) {
    if(x.second > 1) f = false;
  }
  cout << (f? "YES" : "NO") << endl;
  return 0;
}

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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    int n;
    cin >> n;
    vector<double> a(n);
    for(auto& x : a)
        cin >> x;
    vector<double> dp(301, INF);
    dp[1] = 0;
    for(int i = 0; i < n; ++i){
        vector<double> nex(301, INF);
        for(int j = 1; j < 301; ++j){
            if(dp[j] == INF)
                continue;
            for(int k = 1; k < 301; ++k){
                double s = 0;
                if(j <= a[i] && k <= a[i]){
                    s += a[i] - max(j, k);
                    s += 1.0 * abs(j - k) / 2;
                }
                else if(j > a[i] && k > a[i]){
                    s += min(j, k) - a[i];
                    s += 1.0 * abs(j - k) / 2;
                }else{
                    double diff = k - j;
                    double bo = a[i] - j;
                    double pos = bo / diff;
                    s += abs(pos * bo / 2);
                    s += abs((1.0 - pos) * (diff - bo) / 2);
                }
                nex[k] = min(nex[k], dp[j] + s);
            }
        }
        dp = move(nex);
    }
    printf("%.20lf\n", *min_element(dp.begin(), dp.end()));
}



Measured memory_bytes: 3272
// 0bd35dc5e428754fa574049b6be8efe0

#include <bits/stdc++.h>

using namespace std;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getchar());
	for(; !isdigit(ch); ch = getchar()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

typedef long long LL;
typedef pair<int, int> pii;

const int MOD = (int) 1e9 + 7;

inline int fpm(int x, int y)
{
	int res = 1;
	for(; y; y >>= 1, x = (LL) x * x % MOD) if(y & 1) res = (LL) res * x % MOD;
	return res;
}

const int MAXN = (int) 2e3;

int n, k;

inline void input()
{
	n = read<int>(), k = read<int>();
}

inline void solve()
{
	static int f[MAXN + 5][MAXN + 5], suf[MAXN + 5][MAXN + 5];

	f[0][n + 1] = 1;
	for(int i = n + 1; i >= 1; --i) suf[0][i] = 1;
	for(int i = 1; i < k; ++i)
	{
		for(int j = 1; j <= n; ++j)
		{
			(f[i][j] += suf[i - 1][j + 1]) %= MOD;
			if(n - j + 1 >= i) (f[i][j] += f[i - 1][j]) %= MOD;
		}

		for(int j = n; j >= 1; --j) suf[i][j] = (f[i][j] + suf[i][j + 1]) % MOD;
	}

	int ans = 0;
	for(int i = 2; i <= n + 1; ++i) (ans += f[k - 1][i]) %= MOD;
	ans = (LL) ans * fpm(2, max(n - k - 1, 0)) % MOD;
	printf("%d\n", (ans + MOD) % MOD);
}

int main()
{
#ifndef ONLINE_JUDGE
//	freopen("F.in", "r", stdin);
//	freopen("F.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}



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

int main() {
  int n;
  cin >> n;
  double a;
  double res = 0.0;
  for( int i = 0; i < n; ++i ) {
    cin >> a;
    res += 1.0 / a;
    
  }
  
  cout << 1.0 / res << endl;
  return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
#include <cassert>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define PP(p) cout<<(p)<<" ";
#define INF 1e18

typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
//int dy[8]={1,1,1,0,-1,-1,-1,0};
//int dx[8]={-1,0,1,1,1,0,-1,-1};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int N;
vi m;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>N;
    m.resize(N,0);
    rep(i,N-1){
        int a;
        cin>>a;
        a--;
        m[a]++;
    }
    rep(i,N){
        cout << m[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 4780
<?php

fscanf(STDIN, "%d %d", $n, $q);
fscanf(STDIN, "%s", $S);
$L = [];
$R = [];
for ($i = 0; $i < $q; ++$i) {
    fscanf(STDIN, "%d %d", $l, $r);
    --$l;
    --$r;
    $L[] = $l;
    $R[] = $r;
}

$sl = array_fill(0, $n, 0);
$sl[0] = 0;
for ($i = 1; $i < $n; ++$i) {
    if ($S[$i - 1] === 'A' && $S[$i] === 'C') {
        $sl[$i] = $sl[$i - 1] + 1;
    } else {
        $sl[$i] = $sl[$i - 1];
    }
}

$sr = array_fill(0, $n, 0);
$sr[$n - 1] = 0;
for ($i = $n - 2; $i >= 0; --$i) {
    if ($S[$i + 1] === 'C' && $S[$i] === 'A') {
        $sr[$i] = $sr[$i + 1] + 1;
    } else {
        $sr[$i] = $sr[$i + 1];
    }
}

$total = $sl[$n - 1];

for ($i = 0; $i < $q; ++$i) {
    $tmp_total = $total;

    if ($L[$i] === 0) {
        $tl = 0;
    } else {
        $tl = $sl[$L[$i] - 1];

        if ($S[$L[$i]] === 'C' && $S[$L[$i] - 1] === 'A') {
            --$tmp_total;
        }
    }

    if ($R[$i] === $n - 1) {
        $tr = 0;
    } else {
        $tr = $sr[$R[$i] + 1];

        if ($S[$R[$i]] === 'A' && $S[$R[$i] + 1] === 'C') {
            --$tmp_total;
        }
    }
/* echo "tl: $tl, tr: $tr, tmp_total: $tmp_total", PHP_EOL; */
    echo $tmp_total - $tr - $tl, PHP_EOL;
}


Measured memory_bytes: 22644
n = int(input())
h = list(map(int, input().split()))
h[0] -= 1 if h[0] > 0 else 0
for i in range(1, n):
    if h[i] > h[i-1]:
        h[i] -= 1
    if h[i] < h[i-1]:
        print("No")
        exit()
print("Yes")


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

int main(){
	long long n, a, b;
	cin >> n >> a >> b;
	
	long long ans = n / (a + b) * a;

	ans += min(n % (a + b), a);
	
	cout << ans << "\n";
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long int
#define pb push_back             
#define se second                
#define fi first  
#define be begin()
#define en end()
#define all(v) v.be, v.en
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }
template<typename... T> void po(T... args) { ((cout << args << " "), ...); cout<<""; }
// #define mod 1000000007
ll mod = 1e9+7;

ll gcd(ll a, ll b); 
  
// To compute x raised to power y under modulo m 
ll power(ll x, ll y, ll m); 
  
// Function to find modular inverse of a under modulo m 
// Assumption: m is prime 
ll modInverse(ll a, ll m) 
{ 
    // ll g = gcd(a, m); 
    ll g = 1;
    if (g != 1) 
        cout << "Inverse doesn't exist"; 
    else
    { 
        // If a and m are relatively prime, then modulo inverse 
        // is a^(m-2) mode m 
        // cout << "Modular multiplicative inverse is "
            //  << power(a, m-2, m); 
            return power(a, m-2, m); 
    } 
} 
  
// To compute x^y under modulo m 
ll power(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2, m) % m; 
    p = (p * p) % m; 
  
    return (y%2 == 0)? p : (x * p) % m; 
} 


ll findProductSum(ll A[], ll n) 
{ 
    // calculating array sum (a1 + a2  ... + an) 
    ll array_sum = 0; 
    for (ll i = 0; i < n; i++){
         array_sum = array_sum + A[i]; 
         array_sum%=mod;
    }
       
  
    // calcualting square of array sum 
    // (a1 + a2 + ... + an)^2 
    ll array_sum_square = array_sum * array_sum; 
    array_sum_square%=mod;
  
    // calcualting a1^2 + a2^2 + ... + an^2 
    ll individual_square_sum = 0; 
    for (ll i = 0; i < n; i++){
        individual_square_sum += A[i]*A[i]; 
        individual_square_sum%=mod;

    }
  
    // required sum is (array_sum_square - 
    // individual_square_sum) / 2 
    ll ans = (array_sum_square - individual_square_sum); 
    ans = (ans+mod+mod+mod)%mod; 

    ans*=500000004;
    ans%=mod;
    return ans; 
}  
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
 
     int test=1;
     //cin>>test;
     for(int tt=1; tt<=test; tt++){
       ll n;
       cin>>n;
       ll a[n];
       for(ll i=0; i<n; i++){
           cin>>a[i];
       }
        ll ans = findProductSum(a, n);
        pp(ans);
     //cout<<"Case #"<<tt<<": ";  
     }
 
    return 0;
}

Measured memory_bytes: 5212
#include<stdio.h>
#include<math.h>

int main(){
	int a,b,C;
	double rad;
	double c;
	double S,L,h;
	scanf("%d %d %d",&a,&b,&C);
	rad=C*3.14159265359/180;
	
	S=(a*b*sin(rad))/2;
	h=b*sin(rad);
	c=sqrt(a*a+b*b-2*a*b*cos(rad));
	L=a+b+c;
	printf("%lf\n",S);
	printf("%lf\n",L);
	printf("%lf\n",h); 
	
	return 0;
}

Measured memory_bytes: 636
#include<stdio.h>
#include<string.h>

int main() { 
	int k, i;
	char s[1000] = "ACL", c[10] = "ACL";
	scanf("%d",&k);
	for(i = 1; i < k; i++){
		strcat(s,c);
	}
	printf("%s",s);
	return 0;

}


Measured memory_bytes: 1732
#include<cstdio>
#include<algorithm>

using namespace std;

typedef long long ll;

int main(){
	int n; scanf("%d", &n);
	ll x = 1, y = 1;
	for(int i = 0; i < n; i++){
		int t, a; scanf("%d %d", &t, &a);
		ll r = max((x + t - 1) / t, (y + a - 1) / a);
		x = t * r; y = a * r;
	}
	printf("%lld\n", x + y);
	return 0;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(i+1<s.size()&&s[i]==s[i+1])
        {
            cout<<i+1<<" "<<i+2<<endl;
            return 0;
        }
        if(i+2<s.size()&&s[i]==s[i+2])
        {
            cout<<i+1<<" "<<i+3<<endl;
            return 0;
        }
    }
    cout<<-1<<" "<<-1<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
using namespace std;
 
int main(){
  string s;
  cin >> s;
  int i, count=0;
  
  for(i=0;i<=3;++i){
    if(s[i] == '1') ++count;
  }
  cout << count << endl;
  
  return 0;
}

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

int main(){
  int X;
  cin >> X;
  
  int happy = 0;
  
  while(true){
    if(X-500 >= 0){
      X -= 500;
      happy += 1000;
    }else break;
  }
  
  while(true){
    if(X-5 >= 0){
      X -= 5;
      happy += 5;
    }else break;
  }
  
  cout << happy << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

static int A, B;

void solve();

void solve() {
  if (A <= 8 && B <= 8) {
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }
}

int main() {
  cin >> A >> B;
  solve();
  return 0;
}


Measured memory_bytes: 256
import sys

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

def com(n,r):
    ans1 = 1
    ans2 = 1
    tmp = r
    while r != 0:
        ans1 = ans1 * (n)
        ans2 = ans2 * r
        n -= 1
        r -= 1

    return ans1/ans2

print(int(com(N,2)+com(M,2)))


Measured memory_bytes: 2940
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

class Union_Find
{
	std::vector<LL>per, rank, cnt;
public:
	void init(LL size)
	{
		rep(i, size)
		{
			per.push_back(i);
			rank.push_back(0);
			cnt.push_back(1);
		}
	}
	LL get_per(LL x)
	{
		if (x == per[x]) return x;
		return per[x] = get_per(per[x]);
	}
	bool is_same_per(LL x, LL y)
	{
		return get_per(x) == get_per(y);
	}
	void unite(LL x, LL y)
	{
		LL x_per = get_per(x), y_per = get_per(y);
		if (x_per == y_per) return;
		if (rank[x_per] < rank[y_per])
		{
			per[x_per] = y_per;
			cnt[y_per] += cnt[x_per];
			cnt[x_per] = 0;
		}
		else
		{
			per[y_per] = x_per;
			cnt[x_per] += cnt[y_per];
			cnt[y_per] = 0;
			if (rank[x_per] == rank[y_per]) ++rank[x_per];
		}
	}
	LL get_cnt(LL x)
	{
		return cnt[get_per(x)];
	}
};

int main()
{
	LL N, M;
	in >> N >> M;
	std::vector<LL>X(M), Y(M), Z(M);
	rep(i, M) in >> X[i] >> Y[i] >> Z[i];

	Union_Find tree;
	tree.init(N + 1);
	rep(i, M) tree.unite(X[i], Y[i]);

	std::set<LL>ans;
	for (LL i = 1; i <= N; ++i) ans.insert(tree.get_per(i));

	out << ans.size() << std::endl;
}


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

int main() {
	int n,a,b;cin>>n>>a>>b;
	vector<long long> v(n);
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	sort(v.begin(),v.end(),greater<long long>());
	long long sum=0;
	long long ex=0;
	long long count=0;
	for(int i=0;i<a;i++){
		sum+=v[i];
	}
	int first,last;
	for(int i=0;i<n;i++){
		if(v[a-1]==v[i]){
			if(i==0){
				first=i;
			}else if(v[i-1]!=v[i]){
				first=i;
			}
			if(i==n-1){
				last=i;
			}else if(v[i+1]!=v[i]){
				last=i;
			}
		}
	}
	long long ans2=0;
	for(int j=a;j<=b;j++){
		long long r=last-first+1;
		long long k=j-1-first+1;
		if(r<k)continue;
		long long anst=1;
		for(int i=0;i<k;i++){
			anst*=r-i;
			anst/=i+1;
		}
		ans2+=anst;
		if(first!=0)break;
	//	cout<<anst<<endl;
	}
	double ans=double(sum)/a;
	cout<<setprecision(10)<<ans<<endl<<ans2<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int i;
    long r,d,x,a;
    scanf("%ld%ld%ld",&r,&d,&x);
    for(i=0,a=r*x-d;i<10;i++,a=r*a-d)
        printf("%ld\n",a);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


int main(void) {

    int n;
    cin>>n;
    cout<<pow(2,floor(log2(n)))<<endl;
}


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

// find_by_order(k) returns the iterator to the kth largest element (start from 0)
// order_of_key(k) returns the number of elements in the set which are strictly less than the value k

using namespace std;
using namespace __gnu_pbds;

#define ff              first
#define ss              second
#define all(v)          v.begin(), v.end()
#define int             long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mem(dp,x)       memset(dp,x,sizeof dp);
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define rightmostbit(x) __builtin_ffsll(x)
#define mod             1000000007
#define inf             1e18
#define pi              3.141592653589793238
#define mk(a,n)         int n;cin>>n;vi a(n);for(int i=0;i<n;i++) cin>>a[i]
#define w(x)            int x; cin>>x; while(x--)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

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

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void g_b()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
}
// .Always initialize dp array
// 1, 1, 2, 5, 14, 42, 132, 429, 1430, CATALAN NUMBER
int dp[3001][3001];
void LCS(string s , string v , int m , int n)
{
	string ans = "";
	for (int i = 1; i <= m; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (s[i - 1] == v[j - 1] )
				dp[i][j] = dp[i - 1][j - 1] + 1;
			else dp[i][j] = max(dp[i - 1][j] , dp[i][j - 1]);
		}
	}
	int i = m, j = n ;
	while (i > 0 && j > 0 )
	{
		if (s[i - 1] == v[j - 1])
		{
			ans += (s[i - 1]);
			i--, j--;
		}
		else {
			if (dp[i][j - 1] > dp[i - 1][j]) j--;
			else i--;
		}
	}
	reverse(ans.begin(), ans.end());
	cout << ans;
}
int32_t main()
{
	g_b();
	string s, v; cin >> s >> v;
	int m = s.size();
	int n = v.size();
	LCS(s, v, m, n);

	return 0;
}

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

int main(){
    int n,k;
    cin>>n>>k;
    int p[200010];
    rep(i, n){
        cin>>p[i];
    }
    int sum=0;
    rep(i,k) sum+=p[i];
    int ans=sum;
    for(int i=1;i<=n-k;i++){
        sum-=p[i-1];
        sum+=p[i+k-1];
        ans=max(ans,sum);
    }
    double ANS=(double)(ans+k)/2.0;
    cout<<fixed<<setprecision(12)<<ANS<<endl;
}

Measured memory_bytes: 4548
#include <iostream>
#include <string>
using namespace std;
long long sum=0;
int main(){
	int i,j,k,n;
	string st;
	cin>>st;
	for(i=1;i<st.length();i++)
	if(st[i]!=st[i-1])sum++;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ll long long
#define ld long double
ll const N=1e6+5;
ll const INF=9223372036854775807;
 
#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()
#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en
#define len length()
#define umap unordered_map
#define uset unordered_set
#define acc(v) accumulate(all(v), 0)
#define F first
#define S second
 
#define forz(i, n) for (ll i = 0; i < n; i++)
#define fore(i, m, n) for (ll i = m; i <= n; i++)
#define rforz(i, n) for (ll i = n - 1; i >= 0; i--)
#define rfore(i, m, n) for (ll i = n; i >= m; i--)
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define gcd __gcd
#define sexy ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
 
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
 
#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define osetll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
int main(){
	int n;
  cin>>n;
  if(n>=30)
    cout<<"Yes";
  else
    cout<<"No";
 
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <tuple>
#include <iterator>
using namespace std;
using ll = long long;

int main()
{
  int a, b;
  cin >> a >> b;
  if (a + b == 15)
    cout << '+' << endl;
  else if (a * b == 15)
    cout << '*' << endl;
  else
    cout << 'x' << endl;
}


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

int main () {

  int N, L;
  
  cin >> N >> L ;
 
  int sum = L;
  
  
 
  for (int i = 1; i < N; ++i) {
	sum += (L + i);
  }

  if (L >= 0) {
	 cout << sum - L << "\n";
  }
  else if ( (L + N - 1) >= 0) {
	cout << sum << "\n";
  }
  else {
       cout << sum - (L+ N - 1) << "\n";
  }

  
  
 
       
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include<string>
#include<utility>
#include<iterator>
#include<regex>
#include<math.h>
#include<numeric>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(lli i=0;i<j;i++)
#define rep1(i,j) for(lli i=1;i<=j;i++)
#define rep0d(i,j) for(lli i=j-1;i>=0;i--)
#define MAX 1000000007
typedef struct tree Tree;

using namespace std;

bool cmpf(pair<lli, lli> left, pair<lli, lli> right) {
	return left.first < right.first;
}
bool cmp(pair<lli, lli> left, pair<lli, lli> right) {
	if (left.first != right.first)return left.first < right.first;
	else return left.second < right.second;
}

int main(){
	lli n, m;
	cin >> n>> m;
	queue<lli> mq, sq;
	vector<lli>vec(n);
	rep0(i,n){
	    cin >> vec[i];
	}
	sort(rall(vec));
	rep0(i, n) {
		mq.push(vec[i]);
	}
	rep0(i, m) {
		if(!sq.empty()){
		    if(mq.empty()){
		        sq.push(sq.front()/2);
		        sq.pop();
		        continue;
		    }
		    if(sq.front()>mq.front()){
		        sq.push(sq.front()/2);
		        sq.pop();
		        continue;
		    }
		}
		sq.push(mq.front()/2);
		mq.pop();
	}
	lli ans=0;
	while(!sq.empty()){
	    ans+=sq.front();
	    sq.pop();
	}
	while(!mq.empty()){
	    ans+=mq.front();
	    mq.pop();
	}
	cout << ans;
}

Measured memory_bytes: 1920
N=int(input())
A=list(map(int,input().split()))
mod=10**9+7
factl=[1]
for i in range(1,N+1):
    factl.append(factl[-1]*i%mod)
invl=[pow(factl[-1],mod-2,mod)]
for i in range(N,0,-1):
    invl.append(invl[-1]*i%mod)
invl.reverse()
def Comb(a,b):
    return factl[a]*invl[a-b]*invl[b]

C=[0,0,0]
ans=1
for x in A:
    ans *= C.count(x)
    ans%=mod
    for i,a in enumerate(C):
        if a==x:
            C[i]+=1
            break
print(ans)

Measured memory_bytes: 15536
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  ll N, K;
  cin >> N >> K;

  vector<vector<ll>> P(N);
  for (ll i = 0; i < N; i++)
  {
    ll t, d;
    cin >> t >> d;
    t--;
    P.at(t).push_back(d);
  }

  for (auto &p : P)
  {
    if (p.empty())
      p.push_back(-(K * K + 10));
    sort(p.begin(), p.end(), greater<ll>());
  }
  sort(P.begin(), P.end(),
       [](const vector<ll> &a, const vector<ll> &b)
          { return (a.front() > b.front()); });

  priority_queue<ll> Q;
  ll tmp = 0;
  for (ll i = 0; i < K; i++)
  {
    tmp += P.at(i).front();
    for (ll j = 1; j < P.at(i).size(); j++)
    {
      Q.push(P.at(i).at(j));
    }
  }
  for (ll i = K; i < N; i++)
  {
    for (ll j = 0; j < P.at(i).size(); j++)
    {
      Q.push(P.at(i).at(j));
    }
  }

  ll ans = tmp + K * K;
  for (ll x = K - 1; x > 0; x--)
  {
    ll v = P.at(x).front();
    ll w = Q.top();
    if (v < w)
    {
      Q.pop(), Q.push(v);
      tmp -= v, tmp += w;
    }

    chmax(ans, tmp + x * x);
  }
  cout << ans << endl;
}

Measured memory_bytes: 8696
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>

using namespace std;
typedef long long LL;

const int Pi = acos(-1.0);
const int INf = 0x7fffffff;
const int eps = 1e-9;

int sgn(double d) {
    if(abs(d) < eps)
        return 0;
    if(d > 0)
        return 1;
    return -1;
}

int dcmp(double x, double y) {
    if(abs(x - y) < eps)
        return 0;
    if(x > y)
        return 1;
    return -1;
}

struct Point {
    double x, y;
    Point(double _x = 0, double _y = 0):x(_x), y(_y){}
};

typedef Point Vector;

Vector operator + (Vector A, Vector B) {
    return Vector(A.x + B.x, A.y + B.y);
}

Vector operator - (Point A, Point B) {
    return Vector(A.x - B.x, A.y - B.y);
}

Vector operator * (Vector A, double p) {
    return Vector(A.x * p, A.y * p);
}

Vector operator / (Vector A, double p) {
    return Vector(A.x / p, A.y / p);
}

bool operator == (const Point &a, const Point &b) {
    if(sgn(a.x-b.x) == 0 && sgn(a.y-b.y) == 0)
        return true;
    return false;
}

double Dot(Vector A, Vector B) {
    return A.x * B.x + A.y * B.y;
}

double Cross(Vector A, Vector B) {
    return A.x * B.y - B.x * A.y;
}

double Length(Vector A) {
    return sqrt(Dot(A, A));
}

double Angle(Vector A, Vector B) {
    return acos(Dot(A, B) / Length(A) / Length(B));
}

double Area2(Point A, Point B, Point C) {
    return Cross(B - A, C - A);
}

Vector Rotate(Vector A, double rad) { // 逆时针旋转rad
    return Vector(A.x * cos(rad) - A.y * sin(rad), A.x * sin(rad) - A.y * cos(rad));
}

Vector Normal(Vector A) {      //A左转90°的单位法向量
    double L = Length(A);
    return Vector(-A.y / L, A.x / L);
}

bool ToLeftTest(Point a, Point b, Point c) {
    return Cross(b - a, c - a) > 0;
}

struct Line {
    Point v, p;
    Line(Point v, Point p) : v(v), p(p){}
    Point point(double t) {
        return v + (p - v) * t;
    }
};

Point GetLineIntersection(Point P, Vector v, Point Q, Vector w) {
    Vector u = P - Q;
    double t = Cross(w, u) / Cross(v, w);
    return P + v * t;
}

double DistanceToLine(Point P, Point A, Point B) {
    Vector v1 = B - A, v2 = P - A;
    return fabs(Cross(v1, v2) / Length(v1));
}

double DistanceToSegment(Point P, Point A, Point B) {
    if(A == B)
        return Length(P - A);
    Vector v1 = B - A, v2 = P - A, v3 = P - B;
    if(sgn(Dot(v1, v2)) < 0)
        return Length(v2);
    if(sgn(Dot(v1, v3)) > 0)
        return Length(v3);
    return DistanceToLine(P, A, B);
}

Point GetLineProjection(Point P, Point A, Point B) {
    Vector v = B - A;
    return A + v * (Dot(v, P - A) / Dot(v, v));
}

int main() {
    Point A, B, P;
    scanf("%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y);
    int q;
    scanf("%d", &q);
    while(q--) {
        scanf("%lf%lf", &P.x, &P.y);
        Point projection = GetLineProjection(P, A, B);
        Point ans(2 * projection.x - P.x, 2 * projection.y - P.y);
        printf("%.10f %.10f\n", ans.x, ans.y);
    }
    return 0;
}



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

int main() {
  ll n,r,ans=0;

  cin >> n >> r;

  if (n >= 10) ans = r;
  else ans = r + 100*(10-n);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#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 INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef long long ll;

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

    int smt = a / 0.08 + 1; 
    if (a == 0.08*(smt-1)) smt--;
    int lgt = (a+1) / 0.08;
    if (a+1 == 0.08*lgt) lgt--;

    FOR(i, smt, lgt+1){
        if (i * 0.100000 >= b && i * 0.100000 < b+1){
            cout << i << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int p=1;
    cin >> n;
    while(p<n){
        p=p*2;
    }
    if(p>n)
    cout << p/2 << endl;
    else if(p==n)
    cout << n << endl;
    return 0;
}

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

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

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

#define MAX 100005
#define INF 1001001001

int main(int, char**)
{
  int n;
  cin >> n;
  int k;
  cin >> k;
  bitset<28> mask(0);
  rep(i,k) {
    int b; cin >> b;
    mask.set(b);
  }

  rep(i,1<<n) {
    bitset<28> b(i);
    if ((b&~mask).any()) continue;
    cout << i << ":";
    rep(j,n) if (b[j]) cout << " " << j;
    cout << endl;
  }

  return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

ll n,m,q;
vl a,b,c,d;
ll ans=0;

void solve(vl v){
	if(v.size()==n){
		ll score=0;
		rep(i,q){
			if(v[b[i]]-v[a[i]]==c[i])score+=d[i];
		}
		chmax(ans,score);
	}
	else{
		range(i,(v.size()!=0?v.back():1),m+1){
			v.push_back(i);
			solve(v);
			v.pop_back();
		}
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin>>n>>m>>q;
	rep(i,q){
		ll in;
		cin>>in;a.push_back(in);a[i]--;
		cin>>in;b.push_back(in);b[i]--;
		cin>>in;c.push_back(in);
		cin>>in;d.push_back(in);
	}
	vl v;
	solve(v);
	cout<<ans<<endl;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <fstream>
#define ni(n) scanf("%d", &n)
#define nl(n) scanf("%lld", &n)
#define nai(a,n) for (int i = 0; i < (n); i++) ni((a)[i])
#define nal(a,n) for (int i = 0; i < (n); i++) nl((a)[i])
#define case(t) printf("Case #%d: ", (t))
#define pii pair<int, int>
#define vii vector<pii>
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define f first
#define s second
typedef long long ll;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e5 + 5;
const double eps = 1e-9;
using namespace std;

int main()
{
    ll n, k;
    cin >> n >> k;
    if (k == 0)
    {
        cout << n * n << endl;
        return 0;
    }
    ll ans = k * k - k * (2 * n + 1) + n * (n + 1);
    ans /= 2;
    for (ll b = k + 1; b <= n; b++)
    {
        ll st = ((n - b + 1) / b + 1) * b;
        if ((n - b + 1) % b == 0) st = n - b + 1;
        if (st > n - k)
        {
            ans += (b - k) * ((n - k) / b);
            continue;
        }
        ans += (st - n + b - 1) * ((n - b + 1) / b);
        for (; st + b <= n - k; st += b)
        {
            ans += (b - 1) * st / b;
        }
        if (st + b > n - k)
        {
            ans += (n - k - st + 1) * (st / b);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, k, s=0, ans=0;std::cin >> n >> k;
  vll a(n);re(i, n) std::cin >> a[i], s+=a[i];
  vll y;
  for(ll i=1;i*i<=s;i++) if(s%i==0) y.push_back(i), y.push_back(s/i);
  re(i, y.size()){
    ll t = 1000000000000000;
    vll x, z;
    re(j, n) x.push_back(a[j]%y[i]);
    re(j, n) z.push_back(y[i] - x[j]);
    sort(all(x));sort(all(z));
    rep(j, 1, n) x[j] += x[j-1], z[j] += z[j-1];
    re(j, n-1){
      t = min(t, max(x[j], z[n-2-j]));
    }
    t = min({t, x[n-1], z[n-1]});
    if(t<=k) ans = max(y[i], ans);
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
const fs = require('fs')
const inputs = fs.readFileSync('/dev/stdin', 'utf8').trim().split(/\s+/).map(s => parseInt(s))

const x = inputs[0]
const n = inputs[1]
const pSet = new Set()

inputs.slice(2, n + 2).forEach(p => pSet.add(p))

let diff = 0
while (true) {
  if (!pSet.has(x - diff)) {
    console.log(x - diff)
    break;
  }
  if (!pSet.has(x + diff)) {
    console.log(x + diff)
    break;
  }
  diff += 1
}


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

int main(int argc, char const *argv[]) {
  string right="CODEFESTIVAL2016";
  string s;
  std::cin >> s;
  int n=0;
  for (size_t i = 0; i < s.length(); i++) {
    if (right[i]!=s[i]) {
      n++;
    }
  }
  std::cout << n << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <map>
#include <vector>
#include <string>
#include <climits>
#include <algorithm>
#include <string>
using namespace std;

int main() {
    
    string S;
    cin >> S;
    
    if(S == "ABC"){
        cout << "ARC" << endl;
    }
    else{
        cout << "ABC" << endl;
    }
    
    return 0;
    
}



Measured memory_bytes: 3132
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            string s = ReadString();
            string t = ReadString();

            for (int i = 0; i < s.Length; i++)
            {
                string lotated = s.Substring(i) + s.Substring(0, i);
                if (t == lotated)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

Measured memory_bytes: 13140
#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 = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
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 (a>b) { a=b; return true; } return false; }

const int mod = 1e9+7;

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    VVL dp(h+1, VL(w, 0));
    dp[0][0] = 1;
    rep(hi, h) rep(wi, w) rep(li, 1<<(w-1)){
        bool ok = true;
        rep(i, w-2){
            bool seq = ((li >> i) & 1) && ((li >> (i+1)) & 1);
            if (seq){
                ok = false;
                break;
            }
        }
        if (!ok) continue;

        bool okRight = (wi != w-1) && ((li >> wi) & 1);
        bool okLeft = (wi != 0) && ((li >> (wi-1)) & 1);

        // 右に移動
        if (okRight){
            dp[hi+1][wi+1] += dp[hi][wi];
            dp[hi+1][wi+1] %= mod;
        }

        // 左に移動
        if (okLeft){
            dp[hi+1][wi-1] += dp[hi][wi];
            dp[hi+1][wi-1] %= mod;
        }

        // そのまま下に移動
        if (!okRight && !okLeft){
            dp[hi+1][wi] += dp[hi][wi];
            dp[hi+1][wi] %= mod;
        }
    }
    cout << dp[h][k-1] << endl;
    return 0;
}

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

int main() {
  int n;
  cin>>n;
  if(n%10==3)
    cout<<"bon"<<endl;
  else if(n%10==0||n%10==1||n%10==6||n%10==8)
    cout<<"pon"<<endl;
  else
    cout<<"hon"<<endl;
}

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

int main(){

    string s;
    cin>>s;

    for(int i=0;i<s.size();i++){
        if(i%2==0&&s.at(i)=='L'||i%2==1&&s.at(i)=='R'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;





    return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int MOD = 1000000007;


int main() {
    int D, N;
    cin >> D >> N;
    int base = pow(100, D);
    if (N == 100) N++;
    cout << base * N << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;
	
	string S;
	cin >> S;
	
	vector<int> nums;
	
	int now = 1;
	int cnt = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == (char)('0' + now)) {
			cnt++;
		} else {
			now = 1 - now;
			nums.push_back(cnt);
			cnt = 1;
		}
	}
	nums.push_back(cnt);	// 最後の要素
	
	
	int res = 0;
	int k_now = 0;
	int tmp = 0;
	/* start位置 */
	for (int i = 0; i < nums.size(); i+=2) {	// 1始まりでループ
		/* 計測 */
		for (int j = i; j < nums.size(); j++) {
			if (j % 2 == 1) {		// 0の連続数
				if (k_now >= K)
					break;
				k_now++;
			}
			tmp += nums[j];
		}
		res = max(res, tmp);
		tmp = 0;
		k_now = 0;
	}
	
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1020
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt();
		
		List<Integer> data=new ArrayList<>();
		
		for(int i=0;i<n;i++)data.add(cin.nextInt());
		
		int res=-2000000000,minv=data.get(0);
		
		for(int i=1;i<n;i++) {
			res=Math.max(res, data.get(i)-minv);
			minv=Math.min(minv, data.get(i));
		}
		System.out.println(res);
	}

}



Measured memory_bytes: 105560
#include<stdio.h>
int main(void){
	char str1[256],str2[256],str3[256],str4[256],str5[256],str6[256];
	char str7[256],str8[256],str9[256];
	int i;
	int before[9],after[9];
	int n_sum[9] = {0};
	int m_sum[9] = {0};
	
	scanf("%s %d %d",str1,&before[0],&after[0]);
	n_sum[0] = before[0] + after[0];
	m_sum[0] = before[0] * 200 + after[0] * 300;
	
	scanf("%s %d %d",str2,&before[1],&after[1]);
	n_sum[1] = before[1] + after[1];
	m_sum[1] = before[1] * 200 + after[1] * 300;
	
	scanf("%s %d %d",str3,&before[2],&after[2]);
	n_sum[2] = before[2] + after[2];
	m_sum[2] = before[2] * 200 + after[2] * 300;
	
	scanf("%s %d %d",str4,&before[3],&after[3]);
	n_sum[3] = before[3] + after[3];
	m_sum[3] = before[3] * 200 + after[3] * 300;
	
	scanf("%s %d %d",str5,&before[4],&after[4]);
	n_sum[4] = before[4] + after[4];
	m_sum[4] = before[4] * 200 + after[4] * 300;
	
	scanf("%s %d %d",str6,&before[5],&after[5]);
	n_sum[5] = before[5] + after[5];
	m_sum[5] = before[5] * 200 + after[5] * 300;
	
	scanf("%s %d %d",str7,&before[6],&after[6]);
	n_sum[6] = before[6] + after[6];
	m_sum[6] = before[6] * 200 + after[6] * 300;
	
	scanf("%s %d %d",str8,&before[7],&after[7]);
	n_sum[7] = before[7] + after[7];
	m_sum[7] = before[7] * 200 + after[7] * 300;
	
	scanf("%s %d %d",str9,&before[8],&after[8]);
	n_sum[8] = before[8] + after[8];
	m_sum[8] = before[8] * 200 + after[8] * 300;
	
	printf("%s %d %d\n",str1,n_sum[0],m_sum[0]);
	printf("%s %d %d\n",str2,n_sum[1],m_sum[1]);
	printf("%s %d %d\n",str3,n_sum[2],m_sum[2]);
	printf("%s %d %d\n",str4,n_sum[3],m_sum[3]);
	printf("%s %d %d\n",str5,n_sum[4],m_sum[4]);
	printf("%s %d %d\n",str6,n_sum[5],m_sum[5]);
	printf("%s %d %d\n",str7,n_sum[6],m_sum[6]);
	printf("%s %d %d\n",str8,n_sum[7],m_sum[7]);
	printf("%s %d %d\n",str9,n_sum[8],m_sum[8]);
	
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define forr(x,n) for(int x = 0; x < n; ++x)
#define pr pair<int,int>
#define ll long long int
const int mod=1e9+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    string ans="No";
    if(s[2]==s[3]&&s[4]==s[5])
    ans="Yes";
    cout<<ans;
}


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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int M = Math.max(A, Math.max(B, C));

		if((A+B+C)%2 == M%2) {
			System.out.println((3*M-(A+B+C))/2);
		}else {
			System.out.println(((3*M+3)-(A+B+C))/2);
		}

	}

}


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

int main()
{
    int c;
    cin >> c;
    int a=c%10;
    int b=c/10%10;
    int d=c/100%10;
    if(a==7||b==7||d==7){
        printf("Yes");
    }else
    {
        printf("No");
    }
    return 0;
}


Measured memory_bytes: 3760
#include<iostream>
#include<string>
using namespace std;
 
int main() {
	string s;
	int ans = 0;
	cin >> s;
	for (int i = 0;i < 4;i++) {
		if (s[i] == '+') ans++;
		else ans--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if( b + c - a >=0){
    cout << b+c-a;
  }
  else{
    cout << 0;
  }  
  cout <<endl;
  
  return 0;
}

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

using namespace std;

int main(){
    long long H, W;
    cin >> H >> W;
    unsigned long long ans = 1;

    if (W == 1 || H==1){
        ans = 1;
    }else{

        if(W % 2 == 0){
            ans = H * W / 2;
        }else{
            ans = 0;
            for(int i=0; i<H; i++){
                if(i%2 == 0){
                    ans += W /2 + 1;
                }else{
                    ans += W /2;
                }
            }
        }

    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 3608
#include <algorithm>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define REP(i, m, n) for (int i = int(m); i < int(n); i++)
#define RREP(i, m, n) for (int i = int(n) - 1; i >= int(m); --i)
#define EACH(i, c) for (auto &(i) : c)
#define all(c) begin(c), end(c)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(begin(c), end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x) cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s)                                                               \
    do {                                                                       \
    } while (0)
#define dump(x)                                                                \
    do {                                                                       \
    } while (0)
#define BR
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int, int>;
using VP = vector<PII>;

void solve() {
    string s;
    cin >> s;
    s[3] = '8';
    cout << s << endl;
}

signed main() {
    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 100005;

int a, b, v, w, t, dist, dv;

int main() {
scanf("%d %d %d %d %d", &a, &v, &b, &w, &t);
if (w >= v) printf("NO\n"); else {
	dist = abs(a - b);
	dv = v - w;
	if (dv * 1LL * t >= dist) printf("YES\n"); else printf("NO\n");
}
return 0;
}

Measured memory_bytes: 3760