akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
int A[MAX_N];
bool used[MAX_N];

void solve() {
	cin >> N;
	memset(A, -1, sizeof(A));
	rep(i, 0, N) {
		cin >> A[i];
		A[i]--;
	}
	int lv = -1, uv = -1;
	for(int i = 0; i < N; i++) {
		// debug(uv, lv);
		// debug(vi(used, used + N));
		if(uv == -1) {
			if(A[i] != i) {
				uv = A[i]; lv = i;
				if((uv - lv) % 2) {
					cout << "No\n";
					return;
				}
			}
		}
		else if((uv - i) % 2) {
			if(A[i] != i) {
				cout << "No\n";
				return;
			}
		}
		else {
			if(A[i] > uv) {
				used[uv] = true;
				uv = A[i];
			}
			else if(lv == A[i]) {
				used[lv] = true;
				while(used[lv]) lv += 2;
			}
			else {
				cout << "No\n";
				return;
			}
			if(lv == uv) {
				lv = -1, uv = -1;
			}
		}
	}
	if(lv != -1) cout << "No\n";
	else cout << "Yes\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 1792
let [| A; B; C; D |] = stdin.ReadLine().Split() |> Array.map int

let rec solver a c i =
    if a <= 0 then "No"
    elif c <= 0 then "Yes"
    elif i % 2 = 1 then solver (a - D) c (i + 1)
    else solver a (c - B) (i + 1)

solver A C 0 |> stdout.WriteLine


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

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


int main() {
    cout << fixed << setprecision(12);
    int n, k;
    cin >> n >> k;
    double ans = 0;
    int cnt = 0;
    double t = 1.0 / n;
    for(int i = 1; i < n + 1; ++i){
        cnt = 0;
        int tmp = i;
        while(tmp < k){
            tmp *= 2;
            cnt++;
        }
        ans += t * pow(0.5, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define Mod 1000000007
#define M 100005
int n,m,a,b,c,d;
int Dis[M],Cnt[M];
int Ans[M],Deep[M];
int f[M][20];
struct Node {
	int id,c,a,k;
};
struct Edge {
	int x,c,d;
};
vector<Edge>E[M];
vector<Node>Q[M];
int Up(int x,int Step) {
	for(int i=0; i<20; i++)
		if(Step&(1<<i))x=f[x][i];
	return x;
}
int LCA(int a,int b) {
	if(Deep[a]>Deep[b])swap(a,b);
	b=Up(b,Deep[b]-Deep[a]);
	if(a==b)return a;
	for(int i=19; ~i; --i)
		if(f[a][i]!=f[b][i]) {
			a=f[a][i];
			b=f[b][i];
		}
	return f[a][0];
}
void pre_dfs(int x,int F) {
	f[x][0]=F,Deep[x]=Deep[F]+1;
	for(int i=1; i<20; i++)
		f[x][i]=f[f[x][i-1]][i-1];
	for(int i=0; i<E[x].size(); i++) {
		int u=E[x][i].x;
		if(u==F)continue;
		pre_dfs(u,x);
	}
}
void dfs(int x,int d) {
	for(int i=0; i<Q[x].size(); i++) {
		Node T=Q[x][i];
		Ans[T.id]+=T.k*(d-Dis[T.c]+Cnt[T.c]*T.a);
	}
	for(int i=0; i<E[x].size(); i++) {
		Edge T=E[x][i];
		if(T.x==f[x][0])continue;
		++Cnt[T.c];
		Dis[T.c]+=T.d;
		dfs(T.x,T.d+d);
		--Cnt[T.c];
		Dis[T.c]-=T.d;
	}
}
int main() {
	scanf("%d%d",&n,&m);
	for(int i=1; i<n; i++) {
		scanf("%d%d%d%d",&a,&b,&c,&d);
		E[a].push_back((Edge)<%b,c,d%>);
		E[b].push_back((Edge)<%a,c,d%>);
	}
	pre_dfs(1,0);
	for(int i=1; i<=m; i++) {
		scanf("%d%d%d%d",&c,&d,&a,&b);
		int lca=LCA(a,b);
		Q[lca].push_back((Node)<%i,c,d,-2%>);
		Q[a].push_back((Node)<%i,c,d,1%>);
		Q[b].push_back((Node)<%i,c,d,1%>);
	}
	dfs(1,0);
	for(int i=1; i<=m; i++)printf("%d\n",Ans[i]);
}

Measured memory_bytes: 31988
#include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
int main(){
    int N;
    cin >> N;
    int ans=0;
    rep(i,N){
        int a;
        cin >> a;
        if(i%2==0&&a%2==1){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3596
a = []
b = []

while True:
    n, m = map(int, input().split())
    if n == 0 and m == 0:
        break
    elif n >= m:
        a.append(m)
        b.append(n)
    else:
        a.append(n)
        b.append(m)
for i in range(len(a)):
    print(a[i], b[i])


Measured memory_bytes: 6124
#include <iostream> 
#include <list>     
#include <cstdlib>  
#include <cstdio>   
#include <algorithm>

using std::cout;    
using std::endl;    
using std::cin;     using std::list;    

int main(){
  int q,x;  char com[20];     
  list<int> v;
  scanf("%d", &q);
  for(int i=0;i<q;i++){
    scanf("%s", com);
    if(com[0]=='i'){
      scanf("%d", &x);
      v.push_front(x);
    }else if(com[6]=='L'){
      v.pop_back();
    }else if(com[6]=='F'){
      v.pop_front();
    }else if(com[0]=='d'){
      scanf("%d", &x);
      for(list<int>::iterator it=v.begin(); it!=v.end(); it++){
        if(*it==x){
          v.erase(it);
          break;
        }
      }
    }
  }
  int i=0;
  for(list<int>::iterator it=v.begin();it!=v.end();it++){
    if(i++) cout << " ";
    cout << *it;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 34376
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
#include <numeric>
using namespace std;

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n + 1, 0);
    rep(i,m) {
        int tmp;
        cin >> tmp;
        a[tmp] = 1;
    }
    vector<long long int> dp(n + 2, 0);
    dp[n] = 1;
    dp[n + 1] = 0;
    for (int i = n - 1; i >= 0; i--) {
        if (a[i] == 1) {
            continue;
        }
        dp[i] = (dp[i + 1] + dp[i + 2]) % 1000000007;
    }
    cout << dp[0] << endl;
}


Measured memory_bytes: 1408
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#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 pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
int n, k, a[MAXN];
ll sm[MAXN], dp[MAXN], mx[MAXN];

int main() {
	scanf("%d %d", &n, &k);
	for (int i = 1; i <= n; i++) {
		ni(a[i]);
		sm[i] = sm[i-1] + max(a[i], 0);
		dp[i] = dp[i-1] + a[i];
	}
	for (int i = n; i; i--)
		mx[i] = mx[i+1] + max(a[i], 0);
	ll ans = 0;
	for (int i = k+1; i <= n+1; i++)
		ans = max(ans, sm[i-k-1]+mx[i] + max(0ll, dp[i-1] - dp[i-k-1]));
	prl(ans);
	return 0;
}


Measured memory_bytes: 11264
#include <iostream>
#include <string>
#include <cmath>
#include <cstdint>

int check(std::string::iterator start) {
    auto stop = std::next(start, 3);
    int num = 0;
    int d = 2;
    for (auto i = start; i != stop; ++i) {
        num += static_cast<int>(*i - '0') * std::pow(10, d);
        d--;
    }
    return num;
}

int abs_diff(int N) {
    if (753 >= N)
        return 753 - N;
    else
        return N - 753;
}

int main() {
    int64_t temp;
    std::cin >> temp;
    std::string S = std::to_string(temp);
    
    int len = S.length();
    int ans = 700; // max
    int diff = 0;
    for (auto i=0; i<=len-3; ++i) {
        auto start = std::next(S.begin(), i);
        temp = check(start);
        diff = abs_diff(temp); 
        if (ans > diff) {
            ans = diff;
        }
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

typedef long long ll;
/*#define INF 100000000
#define MOD 1000000007*/


int main()
{
	const int N = 100000;
	int n, ans = 1, id = 0;
	ll a[N];
	bool d = false;
	
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (int i = 0; i < n - 1; i++) {
		if (a[i] == a[i + 1]) {
			continue;
		} else if (!d) { // 非減少(1)か非増加(2)が未決定のとき
			if (a[i] < a[i + 1]) id = 1;
			else id = 2;
			d = true;
		} else {
			if (a[i] < a[i + 1] && id == 2 || a[i] > a[i + 1] && id == 1) {
				ans++;
				d = false;
			}
		}
	}
	cout << ans << endl;

	return (0);
}

Measured memory_bytes: 1024
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

void dout() { cerr << '\n'; }

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

#ifdef LOCAL
    #define dbg(...) cerr << #__VA_ARGS__, dout(__VA_ARGS__)
#else
    #define dbg(...) ;
#endif

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

const int N = 305;
const ll inf = 1e18;
int n, k, h[N], m;
ll dp[N][N][N], p[N][N][N], s[N][N][N];

int main() {
    ios_base::sync_with_stdio(false), cin.tie(NULL);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif

    cin >> n >> k;
    vector <int> vec;
    vec.pb(0);
    for (int i = 1; i <= n; i++) {
        cin >> h[i];
        vec.pb(h[i]);
    }
    sort(all(vec));
    vec.erase(unique(all(vec)), vec.end());
    m = vec.size();
    memset(& dp, 0x3f, sizeof(dp));
    memset(& p, 0x3f, sizeof(p));
    memset(& s, 0x3f, sizeof(s));
    dp[0][0][1] = 0;
    for (int i = 1; i <= m; i++) {
        p[0][0][i] = 0;
    }
    s[0][0][1] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= k; j++) {
            for (int l = 1; l <= m; l++) {
                int cost = (vec[l - 1] != h[i]);
                if (cost <= j) {
                    dp[i][j][l] = vec[l - 1] + p[i - 1][j - cost][l - 1];
                    dp[i][j][l] = min(dp[i][j][l], s[i - 1][j - cost][l]);
                }
                p[i][j][l] = min(p[i][j][l - 1], dp[i][j][l] - vec[l - 1]);
            }
            for (int l = m; l >= 1; l--) {
                s[i][j][l] = min(s[i][j][l + 1], dp[i][j][l]);
            }
        }
    }
    ll res = inf;
    for (int i = 0; i <= k; i++) {
        for (int j = 1; j <= m; j++) {
            res = min(res, dp[n][i][j]);
        }
    }
    cout << res;
}


Measured memory_bytes: 665216
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9 + 7, A = 5e5 + 2;
ll GCD(ll x, ll y) {
    return (!y) ? x : GCD(y, x % y);
}
int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n;
    cin >> n;
    int a[n], gcd[n], gcd2[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (i == 0) gcd[i] = a[i];
        else gcd[i] = GCD(gcd[i - 1], a[i]);
    }
    for (int i = n - 1; i >= 0; i--) {
        if (i == n - 1)  gcd2[i] = a[i];
        else gcd2[i] = GCD(gcd2[i + 1], a[i]);
    }
    ll ans = max(gcd[n - 2], gcd2[1]);
    for (int i = 1; i < n - 1; i++) {
        ans = max(ans, GCD(gcd[i - 1], gcd2[i + 1]));
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 4744
def solve(a, b):
    n = 0
    c = 0
    while (True):
        c = a + (n - 1) * (a - 1)
        if c >= b:
            break
        else:
            n = n + 1
    return n

a, b = [int(x) for x in input().split()]
answer = solve(a, b)
print(answer)


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
	class Program
	{
		public static void Main(string[] args)
		{
			int n=int.Parse(Console.ReadLine());
			int[] array= new int[n];
			for(int k=0;k<n;k++)
			{
				array[k]=int.Parse(Console.ReadLine());
			}
			int cnt=0;
			int m=1;//?????£??????????????°???h=3???m?????????/??? h<n???
			List<int> G=new List<int>();//?????£??????????´???????????????£???????????????????????????????????????????????£??????
			G.Add(1);
			int h=0;
			for(int gap=2;(h=(int)((Math.Pow(3,gap)-1)/2))<n;gap++)
			{			
				m++;
				G.Add(h);
			}
			
			Console.WriteLine(m);
			for(int j=0;j<m-1;j++)
			{
				cnt+=sort( array, n, G[m-1-j]);//?????\?????????????????????
				Console.Write(G[m-1-j]+" ");
			}
			//?????????????????????m???????????????G[i]????????????????????§???????????????G?????¨????????´??????count?????????
			//????????????????????????????????????
			
			cnt+=sort( array, n, G[0]);
			Console.Write(G[0]+"\r\n");//???????????§?????????
			Console.WriteLine(cnt);//?????????
			for(int l=0;l<n;l++)
			{
				Console.WriteLine(array[l]);
			
			}
			
			
		}
		public static int sort(int [] A,int n,int g)
		{
			int count=0;//??????????????°
			for (int k=0;k<g;k++)
			{
				
			for(int i=k+g;i<n;i+=g)
			{
				
				int v=A[i];
				int j=i-g;
				while(j>=0&&A[j]>v)
				{
					A[j+g]=A[j];
					j=j-g;
				count ++; //????????????????????§????????????????????§??????????????¢??????
				A[j+g]=v;//????????????A[j]???????????????????§?????????????????????\????????????
				//??????????????????????°?????????????????????´?????????????????£?????????????????????????´??????´???????????????????°?????????????????????????0
				//?????????????????????????????\???
				}
				
			}
			}
			return count;
		}
		
	}
	

Measured memory_bytes: 16732
n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
if n >= m:
  print(0)
else:
  L = []
  for i in range(m-1):
    L.append(x[i+1]-x[i])
  L_sort = sorted(L)
  print(sum(L_sort[:m-1-(n-1)]))

Measured memory_bytes: 13964
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int[] a = sc.IntArray();

        a = a.OrderBy(i => i).ToArray();

        int answer = a[0];

        for (int i = 1; i < n; i++)
        {
            answer = Gcd(answer, a[i]);
        }

        Console.WriteLine(answer);
    }

    // 最大公約数
    private static int Gcd(int a, int b)
    {
        if (a < b)
        {
            return Gcd(b, a);
        }
        while (b != 0)
        {
            int r = a % b;
            a = b;
            b = r;
        }
        return a;
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 24544
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


s = S()
# 後ろから見る
s = s[::-1]
t = ''
ans = 'YES'
i = 0
while True:
    # print(f'{i=}')
    # print(f'{s[i:]=}')
    if s[i: i + 7] == 'dreamer'[::-1]:
        i += 7
    elif s[i: i + 6] == 'eraser'[::-1]:
        i += 6
    elif s[i: i + 5] == 'dream'[::-1]:
        i += 5
    elif s[i: i + 5] == 'erase'[::-1]:
        i += 5
    elif i >= len(s):
        break
    else:
        ans = 'NO'
        break
print(ans)


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



int main()
{
    int n,leg;
    int b, t;
    cin >> n >> leg;

    for (int i = 0; i <= 100; i++) {
        if (leg % 2 != 0)
            break;
        for (int j = 0; j <= 100; j++) {
            if (i + j == n && 2 * i + 4 * j == leg) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
   

    cout << "No" << endl;

    return 0;
}

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

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

int main()
{
    int N, K; cin >> N >> K;
    // combinationを計算
    vector<vector<ll>> comb(N+1, vector<ll>(N+1,1));
    for (int i = 2; i <= N; i++)
    {
        for (int j = 1; j <= i - 1; j++)
        {
            comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % mod;
        }
        
    }
    
    for (int i = 1; i <= K; i++)
    {
        ll ans = (N - K + 1 >= i) ? (comb[K - 1][i - 1] * comb[N - K + 1][i]) % mod : 0;
        cout << ans << endl;
    }
    return 0;
}

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

int main()
{
  int A, B;
  cin >> A >> B;

  int tapNum = 0;
  int kuchi = 1;
  while (kuchi < B)
  {
    tapNum++;
    kuchi = kuchi - 1 + A;
  }

  cout << tapNum << endl;
}

Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(n - 2):
    if p[i] <= p[i + 1] < p[i + 2]:
        ans += 1
    elif p[i + 2] <= p[i + 1] < p[i]:
        ans += 1
    else:
        continue

print(ans)


Measured memory_bytes: 3060
#include<stdio.h>
int prime_number(int n) {
	int i;

	for (i = 2; i < n; i++) {
			if (n%i == 0) 
				return 1;
	}
	return 0;
}

int main(void)
{
	int n,max,min;
	int i;

	while (scanf("%d", &n) != EOF) {
		max = 0, min = 0;
		for (i = 1; i < n; i++) {
			if (!prime_number(n - i)) {
				max = n - i;
				break;
			}
		}
		for (i = 1; i < n; i++) {
			if (!prime_number(n +i)) {
				min = n + i;
				break;
			}
		}
		printf("%d %d\n",max,min);
	}
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
//#include <iomanip>
#include <string>
//#include <algorithm>
//#include <utility>
//#include <stack>
//#include <queue>
//#include <tuple>
//#include <set>
//#include <map>
//#include <unordered_map>
//#include <vector>
//#include <functional>
//#include <bitset>
//#include <cmath>
using namespace std;

typedef long long lint;
typedef unsigned long long ulint;
#define MOD 1000000007

int main(){
    string S,T;
    cin >> S >> T;
    int cnt[2][100001];
    cnt[0][0]=cnt[1][0]=0;
    for(int i=1;i<=S.size();i++){
        if(S[i-1]=='A'){
            cnt[0][i]=cnt[0][i-1]+1;
        }else{
            cnt[0][i]=cnt[0][i-1]+2;
        }
    }
    for(int i=1;i<=T.size();i++){
        if(T[i-1]=='A'){
            cnt[1][i]=cnt[1][i-1]+1;
        }else{
            cnt[1][i]=cnt[1][i-1]+2;
        }
    }
    int q;
    cin >> q;
    for(int i=0;i<q;i++){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        if((cnt[0][b]-cnt[0][a-1])%3==(cnt[1][d]-cnt[1][c-1])%3)
            cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int eatnum(int a, int d) {
  int sum = 0;
  for(int i = 0; i*a+1<=d; i++) {
    sum++;
  }
  return sum;
}
int main() {
  int n;
  cin >> n;
  int d, x;
  cin >> d >> x;
  int sum = 0;
  rep(i, n) {
    int a;
    cin >> a; 
    sum += eatnum(a, d); 
  }
  cout << x+sum << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int a[10000],i,n,max,min;
	long sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	min=a[0];
	max=a[0];
	for(i=1;i<n;i++){
		if(min>a[i]){
			min=a[i];
		}
		if(max<a[i]){
			max=a[i];
		}
	}
	for(i=0;i<n;i++){
		sum=a[i]+sum;
	}
	printf("%d %d %ld\n",min,max,sum);
	
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N;
	cin >> N;
	bool b = false;
	for (int i = 0; i < N; ++i) {
		int n;
		cin >> n;
		if (n % 2 == 1) {
			b = true;
		}
	}
	if (b) {
		cout << "first"<<endl;
	}
	else {
		cout <<"second"<<endl;
	}
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  for(int i = N/1.10; i <= N; i++) {
    if(floor(i*1.08) == N) {
      cout << i << "\n";
      return 0;
    }
  }
  cout << ":(" << "\n";
}

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;

int main(){
  int n;
  cin>>n;
  vector<int>d(n);
  rep(i,n)cin>>d[i];
  sort(d.begin(),d.end());
  n=(n-1)/2;
  int cnt=0;
  int x=d[n+1]-d[n];
  if(x!=0)cnt=x;
  cout<<cnt<<endl;
}

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

typedef long long ll;

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

int N;
string S1, S2;
char type_l, type_r;
ll ans;

int calcu(int p) {
	type_r = (S1[p] == S2[p]) ? 'X' : 'Y';
	if (type_l == 'X') {
		if (type_r == 'X') {
			ans *= 2;
			++p;
		}
		else {
			ans *= 2;
			p += 2;
		}
	}
	else {
		if (type_r == 'X') {
			ans *= 1;
			++p;
		}
		else {
			ans *= 3;
			p += 2;
		}
	}
	type_l = type_r;
	ans %= MOD;
	return p;
}

int main(void) {
	cin >> N >> S1 >> S2;

	int p = 0;
	type_l = (S1[p] == S2[p]) ? 'X' : 'Y';
	if (type_l == 'X') {
		ans = 3;
		++p;
	}
	else {
		ans = 6;
		p += 2;
	}

	while (p < N) {
		p = calcu(p);
	}

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


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include <iomanip>
#include <limits>
#include<unordered_set> 
#include<cmath>
using namespace std;
//long long p = 998244353;
long long p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define fcout cout << fixed << setprecision(15)
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n) {
    if (n == 0) { return 1; }
    int x = rui(a, n / 2);
    x *= x; x %= p;
    if (n % 2 == 1) { x *= a; x %= p; }
    return x;
}
int inv(int a) { return rui(a, p - 2); }
void make_kai() {
    for (int i = 1; i < max_kai; i++) { kai[i] = kai[i - 1] * i; kai[i] %= p; }
    inv_kai = kai;
    rep(i, max_kai) { inv_kai[i] = inv(kai[i]); }
}
int nCr(int n, int r) {
    if (n < 0 || r<0 || r>n) { return 0; }
    int a = kai[n] * inv_kai[r]; a %= p;
    a *= inv_kai[n - r]; a %= p;
    return a;
}
vel pa;
int root(int x) {
    if (pa[x] == -1) { return x; }
    int ans = root(pa[x]); pa[x] = ans;
    return ans;
}
void marge(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) { pa[x] = y; }
}
int gcd(int x, int y) {
    if (x < y) { return gcd(y, x); }
    if (y == 0) { return x; }
    return gcd(y, x % y);
}
#define pd pair<int,double>
#define ved vector<double>
bool is_in(pin lr, int x) {
    return (lr.first <= x) && (x < lr.second);
}
signed main() {
    int n; cin >> n;
    vel dp(n, 1);
    int sum1 = 0;
    int sum0 = 0;
    int ans = 0;
    rep(i,n ) {
        dp[i] += sum1; dp[i] %= p;
        if (i != n - 1) {
            ans += dp[i]; ans %= p;
        }
        if (i >= 2) { sum0 += dp[i - 2]; sum0 %= p; }
        sum1 += sum0; sum1 %= p;
    }
    ans *= n; ans %= p;
    ans *= (n - 1); ans %= p;
    ans += dp[n - 1]*(n-1);
    ans +=1; ans %= p;
    cout << ans << endl;
}


Measured memory_bytes: 9216
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


def main():
	n = int(input())
	a = []
	for i in range(n):
		a.append(int(input()))
	mx = max(a)
	if(a.count(mx)!=1):
		for i in range(n):
			print(mx)
	else:
		for i in range(n):
			if(a[i]==mx):
				b = deepcopy(a)
				b.pop(a.index(mx))
				print(max(b))
			else:
				print(mx)

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()


Measured memory_bytes: 122708
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, P;

void solve() {
	cin >> N >> P;
	if(N % 2 == 0) {
		cout << (N / 2) * (100.0 / P);
	}
	else {
		cout << (N - 1) / 2 + (100.0 - P) / P * (N + 1) / 2 + 1.0;
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 256
// OURL: https://atcoder.jp/contests/abc134/tasks/abc134_c
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define MAT1D(V,T,a) vector<T> V (a)
#define MAT2D(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define MAT3D(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v); }

template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool>::reference b) { return to_string(bool(b)); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(vector<vector<A>> v) { string res; for(const auto &x : v) {res+="\n ";res += to_string(x);} return res;}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L" << to_string(__LINE__) << ":" <<#__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  auto as = make_v<int>(n+2);
  REP(i,n) {
    cin >> as[i+1];
  }
  auto as_f = make_v<int>(n+2);
  auto as_b = make_v<int>(n+2);
  // int ma = 0;
  RREP(i,1,n+1) {
    as_f[i] = max(as_f[i-1], as[i-1]);
  }
  RREP(i,1,n+1) {
    int j = n-i;
    as_b[j] = max(as_b[j+1], as[j+1]);
  }
  stringstream ss;
  RREP(i,1,n+1) {
    ss << max(as_f[i], as_b[i]) << endl;
  }
  cout << ss.str() << endl;
  return 0;
}


Measured memory_bytes: 6788
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void) {
	int n, a;
	cin >> n;
	vector<int> table(100001, 0);
	for (int i = 0; i < n; ++i) {
		cin >> a;
		if (a - 1 >= 0) ++table[a - 1];
		++table[a];
		++table[a + 1];
	}
	int max_table = *max_element(table.begin(), table.end());
	cout << max_table << endl;
	return 0;
}

Measured memory_bytes: 640
#ifdef __APPLE__
#include "bits:stdc++.h"
#else
#include <bits/stdc++.h>
#endif

#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (LL I = 0; I < (N); ++I)
#define REPP(I, A, B) for (LL I = (A); I < (B); ++I)
#define RI(X) scanf("%lld", &(X))
#define RII(X, Y) scanf("%lld%lld", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%lld%lld%lld", &(X), &(Y), &(Z))
#define DRI(X) LL (X); scanf("%lld", &X)
#define DRII(X, Y) LL X, Y; scanf("%lld%lld", &X, &Y)
#define DRIII(X, Y, Z) LL X, Y, Z; scanf("%lld%lld%lld", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<LL>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second


using namespace std;
typedef long long LL;
VL g[100000];
bool vis[100000]={0};
LL a,b,ap,bp,N;
vector<LL> path;
bool found=0;
void dfs1(LL v,LL p=-1){
  path.PB(v);
  vis[v]=1;
  if(v==N-1){
    ap=path[(SZ(path)+1)/2-1],bp=path[(SZ(path)+1)/2];
    found=1;
  }
  for(LL u:g[v]) {
    if(found)break;
    if(u==p)continue;
    dfs1(u,v);
  }
  path.pop_back();
}
const LL B=1,W=2;
LL dfs2(LL color,LL v,LL p=-1){
  LL ans=0;
  for(LL u:g[v]){
    if(color==B && u==bp)continue;
    if(color==W && u==ap)continue;
    if(u==p)continue;
    ans+=dfs2(color,u,v);
  }
  return ans+1;
}
int main(){
  RI(N);
  REP(i,N-1){
    RII(a,b);--a,--b;
    g[a].PB(b);
    g[b].PB(a);
  }
  dfs1(0);
  LL A=dfs2(B,ap),B=dfs2(W,bp);
  puts(A>B?"Fennec":"Snuke");
}

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

int main() {
  int a, b, c , d, e, A, B, C, D, E;
  cin >> a >> b >> c >> d >> e;
  
  A = a;
  B = b;
  C = c;
  D = d;
  E = e;
  while(a > 10){
    a %= 10;
    if(a == 0){
      a += 10;
    }
  }
  while(b > 10){
    b %= 10;
    if(b == 0){
      b += 10;
    }
  }
  while(c > 10){
    c %= 10;
    if(c == 0){
      c += 10;
    }
  }
  while(d > 10){
    d %= 10;
    if(d == 0){
      d += 10;
    }
  }
  while(e > 10){
    e %= 10;
    if(e == 0){
      e += 10;
    }
  }
  int minv = 100;
  minv = min(a, min(b, min(c, min(d, e))));
  
  while(A % 10 != 0){
    A += 1;
  }
  while(B % 10 != 0){
    B += 1;
  }
  while(C % 10 != 0){
    C += 1;
  }
  while(D % 10 != 0){
    D += 1;
  }
  while(E % 10 != 0){
    E += 1;
  }
  cout << A + B + C + D + E - (10 - minv) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

// 素因数分解：nの素因数分解を{素数, 指数}の形で昇順に返す。
vector<pair<long long, long long>> primeFactorize(long long n){
    vector<pair<long long, long long>> ret;
    for(long long i=2; i*i<=n; i++){
        if(n%i != 0) continue;
        long long ex = 0;
        while(n%i == 0){ ex++; n /= i; }
        ret.push_back({i, ex});
    }
    if(n != 1) ret.push_back({n, 1});
    return ret;
}

int main(){
    Init();
    ll n, p, ans = 1; cin >> n >> p;
    auto pFac = primeFactorize(p);
    for(auto &num: pFac) if(num.second >= n) ans *= pow(num.first, (ll)(1.0*num.second/n));
    cout << ans << endl;
}

Measured memory_bytes: 4060
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

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

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

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return true;
    }
    return false;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return true;
    }
    return false;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};

int main() {
    int N, K; cin >> N >> K;
    string S; cin >> S;

    for(int i=0; i<S.size(); i++){
        if(i==K-1){
            cout << char(S[i]-'A'+'a');
        }else{
            cout << S[i];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair <int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int mod = 1e9 + 7;
const char nl = '\n';

const int N = 50000;

void solve() {
    ll n;
    cin >> n;
    string ans = "";
    while(n){
        int x = (n - 1) % 26;
        ans += 'a' + x;
        n = (n - 1) / 26;
    }
    for(int i = 0; i < ans.length(); ++i){
        cout << ans[ans.length() - i - 1];
    }
}

int main() {
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}

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

long long MOD = 1e9 + 7;

long long mul(long long a, long long b) {
    return a * b % MOD;
}

long long fac[100010];

long long pow_mod(long long x, long long n) {
    long long res = 1;
    while (n) {
        if (n & 1) res = mul(res, x);
        x = mul(x, x);
        n /= 2;
    }
    return res;
}

long long inv(long long n) {
    return pow_mod(n, MOD - 2);
}

long long binomial(int k, int n) {
    if(n<0 || k<0 || n-k<0) return 0;
    return mul(mul(fac[n], inv(fac[n - k])), inv(fac[k]));
}

int main(int argc, char *argv[])
{
    fac[0] = 1;
    for (int i = 1; i < 100001; i++) {
        fac[i] = mul(fac[i - 1], i);
    }
    int N, K;
    cin >> N >> K;
    vector<long long> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    sort(begin(a), end(a));
    long long res = 0;
    for (int i = 0; i < N/* = N - K */; i++) {
        res = (res - mul(a[i], binomial(K - 1, N - i - 1)) + MOD) % MOD;
    }
        for (int i = 0; i < N/* = N - K */; i++) {
//for (int i = N - 1; i >= K - 1; i--) {
        res = (res + mul(a[i], binomial(K - 1, i))) % MOD;
    }
    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 1792
new Promise(function(resolve, reject) {
    let cin = "";
    process.stdin.on("data", chunk => { cin += chunk; });
    process.stdin.on("end", () => { resolve([cin, process.stdout]); });
}).then(function([cin, cout]) {
    const [[n, m], c] = cin.split("\n").map(elt => elt.split(" ").map(e => parseInt(e)));
    const opt = new Array(n + 1).fill(-1);
    opt[0] = 0;
    for (const unit of c.slice(0, m)) {
        for (let j = unit; j <= n; ++j) {
            if (opt[j - unit] < 0) continue;
            const candidate = opt[j - unit] + 1;
            opt[j] = opt[j] < 0 ? candidate : Math.min(opt[j], candidate);
        }
    }
    cout.write(`${opt[n]}\n`);
});



Measured memory_bytes: 16344
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String[] list={sc.next(), sc.next(), sc.next()};
        int five_count=0;
        int seven_count=0;
        for(String l:list){
            if(l.equals("5"))
                five_count++;
            else if(l.equals("7"))
                seven_count++;
        }
        if(five_count==2 && seven_count==1)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 998244353;
const int INF = -1001001001;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

int root[200005];
vector<int> leaf[200005];
mint dp[200005];

int main(){
    int n;
    cin >> n;
    vector<P> xd(n);
    rep(i, n) {
        cin >> xd[i].first >> xd[i].second;
    }
    sort(xd.begin(), xd.end());
    stack<P> s;
    rep(i, n) {
        root[i] = -1;
    }
    rep(i, n) {
        while (!s.empty() && xd[i].first>=s.top().first) {
            s.pop();
        }
        if (!s.empty()) {
            int id = s.top().second;
            root[i] = id;
            leaf[id].push_back(i);
        }
        int v = xd[i].first + xd[i].second;
        s.push(P(v, i));
    }
    
    mint ans(1);
    for(int i=n-1; i>=0; i--) {
        dp[i] = mint(1);
        for (int v:leaf[i]) {
            dp[i] *= dp[v];
        }
        dp[i] = dp[i] + mint(1);
        if (root[i]==-1) {
            ans *= dp[i];
            //cout << dp[i].x << endl;
        }
    }
    
    cout << ans.x << endl;
    
    return 0;
}


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

using namespace std;

typedef long long LL;

const int N = 100010;

int n;

int main()
{
    cin >> n;
    if(n == 1)
    {
        puts("1");
        return 0;
    }

    int cnt = 0;
    while(n)
    {
        n >>= 1;
        cnt++;
    }

    cnt--;

    cout << (1 << cnt) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9+7;
//const ll mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int ninf = 0xc0c0c0c0; 
int main(){
	//freopen("in.txt","r",stdin);
	int n,m;
	int a[10005];
	cin>>n>>m;
	int t;
	int sum=0;
	for(int i=0;i<m;i++){
		cin>>t;
		sum+=t;

	}
	if(sum>n) cout<<-1<<endl; else cout<<n-sum<<endl;
	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int A, B, C; cin >> A >> B >> C;

  string result = "NO";
  if ( A==5 && B==5 && C==7 ) result = "YES";
  if ( A==5 && B==7 && C==5 ) result = "YES";
  if ( A==7 && B==5 && C==5 ) result = "YES";
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()
{
  string line;
  
  getline(cin, line);
  const int n =  stoi(line);

  int count = 0;
  for(int a=1; a<n; ++a) {
    for(int b=1; b<n; ++b) {
      if(a*b < n) {
	//printf("%d %d %d\n", a, b, n - a - b);
	count++;
      }
      else
	break;
    }
  }

  printf("%d\n", count);
  
  
  return 0;
}


Measured memory_bytes: 3260