akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
ll N;
  ll K;
    cin >>N>>K;
  vl h(N);
  rep(i,N) {
cin >>h.at(i);
  }
  sort(all(h));
  
  
  vl vec(N-K+1);
    rep(i,N-K+1) {
      vec.at(i)=h.at(i+K-1)-h.at(i);
    }
  
  
  sort(all(vec));
  
  cout<<vec.at(0)<<endl;
}
      
  


Measured memory_bytes: 1792
/**********************************************************************
   File hoge.cpp
   Author  harunaya
   Date   2020-06-27(Sat)
   note   
**********************************************************************/

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

int main() {
  int a;
  cin >> a;
  int ans = a + a*a + a*a*a;
  cout << ans << endl;
  return 0; 
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define mm(a,b) memset(a,b,sizeof(a))
#define ACCELERATE (ios::sync_with_stdio(false),cin.tie(0))
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<long long,long long>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define pf(x) printf("%d\n",x)
#define pf2(x,y) printf("%d %d\n",x,y)
#define pf3(x,y,z) printf("%d %d %d\n",x,y,z)
#define all(x) (x).begin(),(x).end()
#define PI acos(-1.0)
#define E exp(1.0)
#define db double
#define ll long long
#define ld long double
#define ull unsigned long long
//#define io
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
//#define gc getchar
//char buf[1<<21],*p1=buf,*p2=buf;
//inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
//inline int read()
//{
//    int ret=0,f=0;char c=gc();
//    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
//    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
//    if(f)return -ret;return ret;
//}
int a,b,c;
int main()
{
    #ifdef io
    freopen("in.txt","r",stdin);
    #endif
    cin>>a>>b>>c;
    int t=a*b;
    cout<<min(t,c)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

struct TWO {
	long long int a, b;
};

bool cmp(TWO x, TWO y) {
	return x.a < y.a;
}

//ユークリッドの互除法　a,bは最大公約数を求めたい２つの数
long long int gcd(long long int a, long long int b) {
	long long int tmp;
	long long int r = 1;
	if (b > a) {
		tmp = a;
		a = b;
		b = tmp;
	}
	r = a % b;
	while (r != 0) {


		a = b;
		b = r;
		r = a % b;

	}
	return b;
}

//階乗先に計算
long long int kaizyou[200005] = { 1 };
long long int kai(long long int a, long long int b, long long int mod) {
	long long int tmp = 1;
	for (long long int i = a; i <= b; i++) {
		tmp *= i;
		tmp %= mod;

		kaizyou[i] = tmp;
	}
	return tmp;
}


//累乗(繰り返し2乗法)　aのb乗(mod)を求める。
long long int rui(long long int a, long long int b, long long mod) {
	int memo[65] = {};
	long long int A[65] = {};
	long long int tmp = 1;
	for (int i = 0; i < 65; i++) {
		memo[i] = b % 2;
		b /= 2;
	}

	A[0] = a;
	A[0] %= mod;

	for (int i = 1; i < 65; i++) {
		A[i] = A[i - 1] * A[i - 1];
		A[i] %= mod;
	}
	for (int i = 0; i < 65; i++) {
		if (memo[i] == 1) {
			tmp *= A[i];
			tmp %= mod;
		}
	}
	tmp %= mod;
	return tmp;
}

//コンビネーション計算
long long int comb(long long int n, long long int r, long long int mod) {
	long long int tmp;

	tmp = (kaizyou[n] * rui(kaizyou[r], mod - 2, mod)) % mod;
	tmp *= rui(kaizyou[n - r], mod - 2, mod);
	tmp %= mod;
	if (tmp < 0) { tmp = (mod - tmp) % mod; }
	return tmp;
}


int main() {
	complex<long double>cmpmp;
	const long long int mod = 1000000007,INF=100000000000000;
	map<long long int, long long int>mp;
	string str,str2;
	cout << fixed << setprecision(10);
	long long int n, m, h, w, res = 0, num[200] = {}, p[300000], sum[200003] = {}, dp[3000][3000] = {};
	TWO two[200001];
	cin >>n>>m;
	kai(1, 200000, mod);
	for (int i = 0; i <= 2500; i++) {
		dp[1][i] = 1;
	}

	for (int i = 2; i <= 2500; i++) {
		long long int tmp = 1;
		for (int j = i; j <= 2500; j++) {
			dp[i][j] += tmp;
			dp[i][j] %= mod;
			tmp += dp[i - 1][j];
			tmp %= mod;
		}
	}

	for (int i = 1; i <= m; i++) {
		if (n - m + 1 >= i) {
			cout << (comb((n - m + 1), i, mod) * dp[i][m]) % mod << endl;
		}
		else {
			cout << 0 << endl;
		}
	}
} 


Measured memory_bytes: 72064
#include <iostream>

using namespace std;

int main(){
        char in[10];
        while(cin >> in[0]){
                in[0] -= '0';
                for(int i = 1; i < 10; i++){
                        cin >> in[i];
                        in[i] -= '0';
                }   
                for(int i = 0; i < 9; i++){
                        for(int j = 0; j < 9; j++){
                                in[j] = (in[j]+in[j+1])%10;
                        }   
                }   
                cout << (int)in[0] << endl;
        }   
}

Measured memory_bytes: 0
import math
def slove(n, m):

    if abs(n-m) >= 2:
        return 0
    elif abs(n-m) == 1:
        ans = math.factorial(n) * math.factorial(m)
        return ans % (10**9 + 7)
    else:
        ans = math.factorial(n) * math.factorial(m) * 2
        return ans % (10**9 + 7)

if __name__ == "__main__":
    n, m = [int(i) for i in input().split()]
    print(slove(n, m))

Measured memory_bytes: 5176
#include<iostream>
using std::cin;
using std::cout;
using std::endl;
int n,b,f,r,v,i,j,k,room[4][3][10];
int main(void){
  cin>>n;
  for(i=0;i<n;i++){
    cin>>b>>f>>r>>v;
    room[b-1][f-1][r-1]+=v;
  }
  for(i=0;i<4;i++){
    for(j=0;j<3;j++){
      for(k=0;k<10;k++){
        cout<<" "<<room[i][j][k];
      }
      cout<<endl;
    }
    if(i!=3)cout<<"####################"<<endl;
  }
  return 0;
}



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

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define each(e, collection) for(auto& e: collection)              // for each
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

#endif

int main(void)
{
	ll n, k; cin >> n >> k;

	ll max = (n - 1) * (n - 2) / 2;

	if (max < k)
	{
		cout << -1;
		return 0;
	}

	vector<pair<ll, ll>> ans;
	ans.push_back({ 0, 1 });
	rep(i, 2, n)
		ans.push_back({ 1, i });


	rep(e, 2, n)
	{
		if (max == k)
			break;

		ans.push_back({ 0, e });
		max--;
	}

	rep(s, 2, n-1)
	{
		if (max == k)
			break;

		rep(e, s + 1, n)
		{
			if (max == k)
				break;

			ans.push_back({ s, e });
			max--;
		}
	}

	cout << size(ans) << endl;
	each(e, ans)
		cout << e.first + 1 << " " << e.second + 1 << endl;

	return 0;
}



Measured memory_bytes: 512
from collections import deque
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cntA = [0] * (N + 1)
cntB = [0] * (N + 1)
for i in range(N):
    cntA[A[i]] += 1
    cntB[B[i]] += 1
nums = [(cntA[i], cntB[i], i) for i in range(1, N+1)]
nums.sort(key=lambda p: p[0] + p[1], reverse=True)
a = deque()
b = deque()
c = deque(list(range(N)))
ansa = [0] * N
ansb = [0] * N
for x, y, n in nums:
    if x == y == 0:
        break
    if x + y > len(a) + len(b) + len(c):
        print('No')
        exit()
    if x + y <= len(c):
        for i in range(x):
            ansa[c[0]] = n
            b.append(c[0])
            c.popleft()
        for i in range(y):
            ansb[c[0]] = n
            a.append(c[0])
            c.popleft()
    else:
        ra = x - len(a)
        rb = y - len(b)
        if ra > 0:
            for i in range(ra):
                ansa[c[0]] = n
                b.append(c[0])
                c.popleft()
            x -= ra
        if rb > 0:
            for i in range(rb):
                ansb[c[0]] = n
                a.append(c[0])
                c.popleft()
            y -= rb
        while len(c):
            if x:
                ansa[c[0]] = n
                b.append(c[0])
                x -= 1
            else:
                ansb[c[0]] = n
                a.append(c[0])
                y -= 1
            c.popleft()
        for i in range(x):
            ansa[a[0]] = n
            a.popleft()
        for i in range(y):
            ansb[b[0]] = n
            b.popleft()
ans = []
for i in range(N):
    ans.append((ansa[i], ansb[i]))
ans.sort()
print('Yes')
print(*[p[1] for p in ans])

Measured memory_bytes: 171404
#[allow(dead_code)]
fn main() {
    let n = i::u();
    let mut a = i::iv(n);
    for i in 0..n {
        a[i] -= i as i64;
    }

    let mut d = HashMap::new();
    for i in 0..n {
        *d.entry(a[i]).or_insert(0usize) += 1;
    }

    let mut ans = 0usize;
    for i in 0..n {
        let cur = a[i];
        // A_iは削除しておく
        *d.entry(cur).or_insert(0usize) -= 1;
        //足して -2iになる組み合わせがあれば、答えとして加える
        let c = 0 - cur - 2 * i as i64;
        if d.contains_key(&c) {
            ans += d[&c];
        }
    }
    println!("{}", ans);
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 10244
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int N,D;
  cin>>N>>D;
  int r = 2*D+1;
  cout<<(N+r-1)/r<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5, mod = 1e9 + 7;

map<pair<int, int>, int> mp;
int x[maxn], y[maxn];
int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i){
        cin >> x[i] >> y[i];
    }
    int m = 0;
    for (int i = 0; i < n; ++i){
        for (int j = 0; j < n; ++j){
            if (i == j) continue;
            ++mp[make_pair(x[j] - x[i], y[j] - y[i])];
            m = max(m, mp[make_pair(x[j] - x[i], y[j] - y[i])]);
        }
    }
    cout << n - m << endl;
    return 0;
}


Measured memory_bytes: 384
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var ND = Sarray();
            var N = ND[0];
            var D = ND[1];
            var dstLst = new List<long>[N];
            for (var i = 0; i < N; ++i)
                dstLst[i] = Slist();
            var ans = 0L;
            for (var i = 0; i < N; ++i)
            {
                for (var j = i + 1; j < N; ++j)
                {
                    var pow = 0L;
                    for (var k = 0; k < D; ++k)
                        pow += (dstLst[i][k] - dstLst[j][k]) * (dstLst[i][k] - dstLst[j][k]);
                    var sqrt = (long)Sqrt(pow);
                    if (sqrt * sqrt == pow)
                        ++ans;
                }
            }
            WriteLine(ans);
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13396
#include<cstdio>

int main(){
    char s[3];
    for(int i=0;i<3;i++){
        scanf("%c",&s[i]);
    }

    int na=0,nb=0,nc=0;
    for(int i=0;i<3;i++){
        if(s[i]=='a'){
            na++;
        }else if(s[i]=='b'){
            nb++;
        }else if(s[i]=='c'){
            nc++;
        }
    }

    if(na==1&&nb==1&&nc==1){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define SORT(i) sort((i).begin(),(i).end())
constexpr ll INF = 2000000000;
constexpr ll mod = 1000000007;

int main() {
	int k, s; cin >> k >> s;
	int ans = 0;
	rep(i, k+1) {
		rep(j, k + 1) {
			int z = s - i - j;
			if (0 <= z && z <= k)++ans;
		}
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) for(ll i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

ll dp[100010][11];
ll c[100010];
int main(){
	ll n, m;
	scanf("%lld %lld",&n,&m);
	vector<vector<ll>> edge(n);
	rep(i,m){
		ll a,b; cin>>a>>b;
		edge[a-1].pb(b-1);
		edge[b-1].pb(a-1);
	}
	ll q;cin>>q;
	FOR(i,1,q+1){
		ll v,d; cin>>v>>d>>c[i];
		dp[v-1][d]=i;
	}

	for(ll i=9;i>=0;i--){
		rep(j,n){
			//一つ上のものが塗られているか.
			dp[j][i]=max(dp[j][i],dp[j][i+1]);
			//接続先が塗られているか.
			for(ll to: edge[j]){
				dp[j][i]=max(dp[j][i],dp[to][i+1]);
			}
		}
	}
	//(N+M)d

	rep(i,n){
		cout<<c[dp[i][0]]<<endl;
	}

    return 0;
}

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

int main(){
  int N,K,a;
  cin>>N>>K;
  a=1;
  for (int i=0;i<N;i++){
    if (a*2<a+K){
      a *=2;
    }
    else {
      a +=K;
    }
  }
  cout<<a<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
static const ll M = 1000000000000000000;
 
int main(){
    int n;
    ll a[100005];
    ll ans = 1;
    cin >> n;
    rep(i,n) {
        cin >> a[i];
        if (a[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    rep(i,n){
        if(ans > M/a[i]){
            cout << -1 << endl;
            return 0;
        }
      	ans *= a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4336
N, Y = map(int, input().split())
Y //= 1000
modYN = (Y - N)%4

for i in range(N//4 + 1):
    a = 4 * i + modYN
    b = (Y - N - 9 * a) // 4
    c = N - a - b
    if 0 <= b and 0 <= c:
        print(a, b, c)
        break
else:
    print(-1, -1, -1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
static const int mod = 1e9+7;
ll fac(int n){
    if (n == 1) return 1;
    return n * fac(n - 1) % mod;
}
int main(){
    int n, m, ans;
    sc(n) sc(m)
    if (m == n - 1) ans = fac(n)*fac(m)%mod;
    else if (m == n) ans = 2 * fac(n)*fac(m)%mod;
    else if (m == n + 1) ans = fac(n)*fac(m)%mod;
    else ans = 0;
    cout << ans << endl;
    return 0;
}

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

const int maxn = 100010;
int n, m, a[maxn];
long long sum, cnt[maxn], tmp[maxn];

int main() {
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    for (int i = 1; i < n; i++) {
        if (a[i] < a[i + 1]) {
            sum += a[i + 1] - a[i];
            cnt[a[i] + 2]--, cnt[a[i + 1] + 1]++;
            tmp[a[i + 1] + 1] += a[i + 1] - a[i] - 1;
        } else {
            sum += a[i + 1] + m - a[i];
            cnt[a[i] + 2]--;
            tmp[1] -= m - a[i] - 1, tmp[a[i + 1] + 1] += m - a[i] - 1;
            cnt[1]--, cnt[a[i + 1] + 1]++;
            tmp[a[i + 1] + 1] += a[i + 1];
        }
    }
    for (int i = 1; i <= m; i++) {
        cnt[i] += cnt[i - 1];
    }
    long long ans = 1e18;
    for (int i = 1; i <= m; i++) {
        cnt[i] += cnt[i - 1], tmp[i] += tmp[i - 1];
        ans = min(ans, sum + cnt[i] + tmp[i]);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
#define pb push_back
int main(void){
    ll n;
    cin>>n;
    ll n0=(ll)sqrt(n)+1;
    vector<ll>p,bp;
    ll ans=0;
    rep(2,i,n0){
        //cout<<i<<endl;
        bool pt=true,bpt=false;
        if(n%i==0){
            rep(0,j,p.size()){
                if(i%p[j]==0){
                    pt=false;
                    if(bp[j]==i){
                        bpt=true;
                        bp[j]*=p[j];
                    }
                }
            }
            if(pt){
                //cout<<i<<endl;
                p.pb(i);
                bp.pb(i*i);
            }
            if(pt||bpt){
                //cout<<i<<endl;
                n/=i;
                ++ans;
            }
        }
        if(n==1)break;
    }
    if(n>1e6&&n!=1)++ans;
    cout<<ans;
}

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

const int MAXN = 1000000;

int noprime[MAXN];
bool isprime[MAXN];

void sieve()
{
	int p = 0;
	for (int i = 0; i < MAXN; i++)
		isprime[i] = true;
	isprime[0] = isprime[1] = false;
	for (int i = 2; i < MAXN; i++)
	{
		if (isprime[i])
		{
			p++;
			for (int j = 2 * i; j <= MAXN; j += i)
				isprime[j] = false;
		}
		noprime[i] = p;
	}
}

int main()
{
	sieve();
	int n;
	while (cin >> n)
		cout << noprime[n] << endl;
	return 0;
}


Measured memory_bytes: 7964
#include <stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	if (n==1)
	{
		printf("Hello World\n");
	}else if (n==2)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		printf("%d\n",a+b);
	}
}

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

int main(){
  string S;
  int Q;
  cin >> S >> Q;

  int query,q1; string s_q;
  bool is_flipped= false;
  for(int i=0; i<Q; i++){
    cin >> query;
    if(query==1){
      is_flipped= !is_flipped;
    }
    else{
      cin >> q1 >> s_q;
      if(q1==1){
        if(!is_flipped) S.insert(0, s_q);
        else            S.append(s_q);
      }
      else{
        if(!is_flipped) S.append(s_q);
        else            S.insert(0, s_q);
      }
    }
  }
  if(is_flipped) reverse(S.begin(), S.end());

  cout << S << endl;
}

Measured memory_bytes: 900
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>

using namespace std;




int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s, t;

	cin >> s >> t;
	if ((t.length() == s.length() + 1) && (t.substr(0, s.length()) == s)) cout << "Yes\n";
	else cout << "No\n";


	return 0;
}


Measured memory_bytes: 3136
h,w,k = map(int,input().split())
m=[list(input()) for i in range(h)]
o=0
for h_bit in range(2**h):
    for w_bit in range(2**w):
        c=0
        for i in range(h):
            for j in range(w):
                if (h_bit>>i)&1==0 and (w_bit>>j)&1==0 and m[i][j]=='#':
                    c+=1
        if c==k:
            o+=1
print(o)

Measured memory_bytes: 9108
#include<stdio.h>

int main(void){
  int a[100001];
  int i,n,m,s=0;

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

  for(i=0;i<n;i++){
    scanf("%d",&m);
  
      a[m-1]++;a[m]++;a[m+1]++;  
  }

  for(i=1;i<=100000;i++){
    if(a[i]>s)
      s = a[i];
  }

  printf("%d\n",s);

  return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
typedef priority_queue<ll> PQ_HIGH;
typedef priority_queue<ll,VL,greater<ll>> PQ_LOW;//昇順

void test(priority_queue<pair<ll,ll>> que){
  while(!que.empty()){
    cout<<que.top().first<<" "<<que.top().second<<endl;
    que.pop();
  }
}

ll mod=1000000007;

int main(){
  int n;cin>>n;
  ll r,g,b;
  r=g=b=0;
  ll ans=1;
  for(int i=0;i<n;i++){
    int count=0;
    ll tmp;cin>>tmp;
    if(tmp==r){count++;}
    if(tmp==g){count++;}
    if(tmp==b){count++;}
    ans*=count;
    ans%=mod;
    if(tmp==r){r++;continue;}
    if(tmp==g){g++;continue;}
    if(tmp==b){b++;continue;}
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#pragma region header
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int n;cin >> n;
    vi a(n);
    rep(i, n)cin >> a[i];
    int count=0;
    rep(i, n) {
        if(i>0) {
            if(a[i-1]>a[i]){
                count+=a[i-1]-a[i];
                a[i]=a[i-1];
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 4836
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
ll N;
vector<ll> H;
const ll INF = 1e12;

int main()
{
    cin >> N;
    H.resize(N);
    for (int i = 0; i < N; ++i)
    {
        cin >> H[i];
    }

    int res = 0;
    int temp = 0;
    for (int i = 0; i < N - 1; ++i)
    {
        if (H[i] < H[i + 1])
        {
            res = max(res, temp);
            temp = 0;
            continue;
        }
        ++temp;
    }
    res = max(res, temp);
    cout << res << endl;
}

Measured memory_bytes: 1024
n,k = map(int,input().split())
h = [int(input()) for i in range(n)]

h.sort()
dh = [h[i+1]-h[i] for i in range(0,n-1)]

mindh = dhsum = sum(dh[:k-1])
for i in range(1,n-k+1):
    dhsum = dhsum-dh[i-1]+dh[i+k-2]
    mindh = min(dhsum,mindh)

ans = mindh
print(ans)

Measured memory_bytes: 11856
N, K = map(int, input().split())
K = min(2 * N, K)
MOD = 10 ** 9 + 7


factorial = [1, 1]  # 元テーブル
inverse = [1, 1]  # 逆元テーブル
inverse_from = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, 2 * N + 10):
    factorial.append((factorial[-1] * i) % MOD)
    inverse_from.append((-inverse_from[MOD % i] * (MOD // i)) % MOD)
    inverse.append((inverse[-1] * inverse_from[-1]) % MOD)


def nCr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % MOD


ans = nCr(N * 2 - 1, N)
for x in range(K + 1, N):
    ans -= nCr(N, x) * nCr(N - 1, x) % MOD
    ans %= MOD

print(ans % MOD)


Measured memory_bytes: 50772
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

long long a,b,c,ans = 0x7f7f7f7f;

int main()
{
	long long n,m;
	scanf("%lld%lld",&n,&m);
	if(n % 3 == 0 || m % 3 == 0)
	{
		printf("0\n");
		return 0;
	}
	for(int i = 1;i <= n;i++)
	{
		a = m * i;
		if(m % 2 == 0 || (n - i) % 2 == 0)
		{
			b = (n - i) * m / 2,c = (n - i) * m / 2;
			ans = min(ans,max(max(a,b),c) - min(min(a,b),c));
		}
		else
		{
			c = ((n - i) * m - (n - i)) / 2,b = ((n - i) * m + (n - i)) / 2;
			ans = min(ans,max(max(a,b),c) - min(min(a,b),c));
			c = ((n - i) * m - (m)) / 2,b = ((n - i) * m + (m)) / 2;
			ans = min(ans,max(max(a,b),c) - min(min(a,b),c));
		}
	}
	for(int i = 1;i <= m;i++)
	{
		a = n * i;
		if(n % 2 == 0 || (m - i) % 2 == 0)
		{
			b = (m - i) * n / 2,c = (m - i) * n / 2;
			ans = min(ans,max(max(a,b),c) - min(min(a,b),c));
		}
		else
		{
			c = ((m - i) * n - (m - i)) / 2,b = ((m - i) * n + (m - i)) / 2;
			ans = min(ans,max(max(a,b),c) - min(min(a,b),c));
			c = ((m - i) * n - (n)) / 2,b = ((m - i) * n + (n)) / 2;
			ans = min(ans,max(max(a,b),c) - min(min(a,b),c));
		}
		
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,a=0,b=0,c=0,d=0;
    cin>>n ;
    ll arr[n];
    for(int i=0;i<n;i++)  {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    ll sum=0;
    for(int i=n/2;i<n;i++){
        sum+=arr[i];
        sum+=arr[i];
    }
    if(n%2){
        sum-=arr[n-1];
        sum-=arr[n/2];
    }
    else{
        sum-=arr[n-1];
    }
    cout<<sum;
   
}

Measured memory_bytes: 5180
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, LL> Vec2;
typedef tuple<LL, LL, LL> Tll;
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,n) for(LL i=n-1;i>=0;i--)
struct Edge { LL to, cost; };
vector<Edge>vec[1100000];
LL h, w, n, m, s, t, sum, ans = 0,a[1000000];
int main() {
	cin >> n ;
	rep(i, n)
		cin >> a[i];
	cin >> m;
	rep(i, m) {
		LL now;
		cin >> now;
		LL high = n, low = -1, mid = (high + low) / 2;
		while (high - low > 1) {
			if (a[mid] >= now) {
				high = mid;
			}
			else low = mid;
			mid = (high + low) / 2;
		}
		if (a[high] == now)ans++;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 29644
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  int h=0;
  int cnt=0;
  int l=1000000001;
  int r;
  cin >> r;
  rep(i,n){
    int y;
    cin >> y;
    //cout << l << " " << y << " " << h << " " << cnt << endl; 
    if(h==(y-l))cnt++;
    if(h<(y-l)){
      h=(y-l);
      cnt=1;
    }
    l=min(l,y);
    
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
	int H,W,K;
	cin >> H >> W >> K;
	vector <string>S(H);
	for (int n = 0;n<H;++n) {
		cin >> S[n];
	}
	//読み替え
	vector<vector<int>> data(H, vector<int>(W));
	for (int n = 0; n < H; ++n) {
		for (int m = 0;m < W;++m) {
			int inp=0;
			if ('1' == (S[n])[m]) {
				inp = 1;
			}
			data[n][m] = inp; 
		}
	}
	int ans = H + W;
	int num = 1 << (H-1);
	for (int n = 0;n<num;++n) {
		vector<int>Yoko;
		Yoko.push_back(0);
		for (int m = 0;m < H-1;++m) {
			if (0 != (n & (1 << m))) {
				Yoko.push_back(m+1);
			}
		}
		Yoko.push_back(H);
		bool bContinue = true;
		vector<vector<int>> data2(Yoko.size()-1, vector<int>(W));
		for (int n = 0; n < Yoko.size()-1;++n) {
			for (int m = 0;m<W;++m) {
				int inp = 0; 
				for (int l = Yoko[n];l<Yoko[n+1];++l) {
					if (1 == data[l][m]) {
						inp++;
					}
				}
				data2[n][m] = inp; 
				if (inp > K) {
					bContinue = false;
					continue;
				}
			}
		}
		if (!bContinue) {
			continue;
		}
		int anstmp = 0;
		vector<int>data3(Yoko.size()-1);
		for (int n = 0;n < W;++n) {
			bool cut = false;
			for (int m = 0; m < Yoko.size()-1; ++m) {
				data3[m] += data2[m][n];
				if (data3[m]>K) {
					cut = true; 
					break;
				}
			}
			if (cut) {
				anstmp++;
				for (int i = 0;i < Yoko.size()-1;++i) {
					data3[i] = data2[i][n];
				}
			}
		}
		ans = min(ans, anstmp + (int)Yoko.size() -2);
	}
	cout <<ans<<endl;
	return 0;
}
//cout << "test" << n << endl;
//continue;

Measured memory_bytes: 3672
a = int(input())
b = int(input())
c = int(input())
x = int(input())

l = 0

def pattern(a, b, c, x):
	if x == 0:
		return 1
	else:
		if (x >= 500) and (a >= 1):
			return pattern(a - 1, b, c, x - 500) + pattern(0, b, c, x)
		elif (x >= 100) and (b >= 1):
			return pattern(a, b - 1, c, x - 100) + pattern(a, 0, c, x)
		elif (x >= 50) and (c >= 1):
			return pattern(a, b, c - 1, x - 50) + pattern(a, b, 0, x)
		else:
			return 0

ans = pattern(a, b, c, x)

print(ans)

Measured memory_bytes: 3064
h,w=map(int,input().split())
c=[list(map(int,input().split())) for i in range(10)]
a=dict()
#cost=[[0]*10 for i in range(10)]
for i in range(h):
    line=list(map(int,input().split()))
    for l in line:
        if l==-1 or l==1:
            continue
        else:
            if l not in a:
                a[l]=1
            else:
                a[l]+=1
#print(a)

n=10

def warshall_floyd():
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                c[i][j] = min(c[i][j],c[i][k] + c[k][j])

warshall_floyd()
ans=0
for num,k in a.items():
    ans+=c[num][1]*k 
print(ans)


Measured memory_bytes: 40684
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

bool check(string s, string t)
{
	int sp = 0, tp = 0;
	while (tp < t.size())
	{
		if (s[sp] == t[tp]) tp++;
		sp++;
		if (sp == s.size() && tp != t.size()) return false;
	}
 	return true;
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	string s, t;
	cin >> s >> t;
	string s1, s2;
	REP(i, s.size())
	{
		if (i % 2 == 0) s1.push_back(s[i]);
		else s2.push_back(s[i]);
	}
	if (check(t, s1) || check(t, s2)) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
 
int main() {

    int a,b,c;
  cin >> a>>b>>c;
  
  int five = 0;
  int seven = 0;
  if(a == 5)five ++;
  if(a == 7)seven ++;
  if(b == 5)five ++;
  if(b == 7)seven ++;
  if(c == 5)five ++;
  if(c == 7)seven ++;
  
  if(five == 2 && seven == 1)cout << "YES"<<endl;
  else cout <<"NO"<<endl;;
  
   
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	vi s(n); rep(i, n) cin >> s[i];
	
	ll ans = 0;
	vector<ll> dp(n);
	for(int k = 1; k < n - 1; k++){
		vector<ll> next(1);
		for(int c = 1; k * c < n; c++){
			int a = n - 1 - k * c;
			ll cost = dp[c] + s[a] + s[k * c];
			if(a > c && (k * c < a || (n - 1) % c != 0)) ans = max(ans, cost);
			next.pb(cost);
		}
		dp = next;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 2552
#include<stdio.h>
int X[]={1,0,-1,0};
int Y[]={0,1,0,-1};
int main(){
  char d[300][300]={};
  int n,i,j,k,c=0,t,r,x[100010],y[100010],ny,nx;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++)scanf(" %c",&d[i+1][j+1]);
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(d[i+1][j+1]=='x')continue;
      d[y[t=0]=i+1][x[0]=j+1]='x';
      c++;
      for(r=1;r-t;t++){
	for(k=0;k<4;k++){
	  ny=y[t]+Y[k];
	  nx=x[t]+X[k];
	  if(d[ny][nx]-'o')continue;
	  d[y[r]=ny][x[r]=nx]='x';
	  r++;
	}
      }
    }
  }
  printf("%d\n",(c-1)/3);
  return 0;
}

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

const int MOD = 1000000007;

const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    string S;
    int N;
    int K;
    cin >> N >> K;
    cin >> S;
    S.at(K - 1) = (char)tolower(S.at(K - 1));

    cout << S << endl;
}

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

int main() {
    int n;
    multiset<int> s;
    cin >> n;
    for(int i=0;i<n;i++){
        int a;
        cin >> a; a = -a;
        auto itr = s.upper_bound(a);
        if(itr != s.end()){
            s.erase(itr);
            
        }
        s.insert(a);
    }
    cout << s.size() << endl;
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
void fp(bool flag, string s, string t){
    if(flag)cout << s << endl;
    else cout << t << endl;
}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
signed main(){
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    bool d = true;
    if(s[2] != s[3])d = false;
    if(s[4] != s[5])d = false;
    fp(d);
    return 0;
}

Measured memory_bytes: 256
import collections
from fractions import gcd

inputs = []
N, X = map(int, input().split())
inputs = list(map(int, input().split()))
inputs.append(X)
inputs.sort()
D = []
for i in range(len(inputs)-1):    
    D.append(abs(inputs[i] - inputs[i+1]))

uniqueD = list(set(D))
#print(uniqueD)

result = uniqueD[0]
for i in range(len(uniqueD)):
    result = gcd(result, uniqueD[i])

print(result)


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

int N,M;

char n[70][70],m[70][70];

bool check(int nx,int ny){
    for(int i=0;i<M;i++){
        for(int j=0;j<M;j++){
            if(n[nx+i][ny+j]!=m[i][j]) return false;
        }
    }
    return true;
}
int main(void){
    
    
    cin>>N>>M;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            cin>>n[i][j];
        }
    }
    for(int i=0;i<M;i++){
        for(int j=0;j<M;j++){
            cin>>m[i][j];
        }
    }
    
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(n[i][j]==m[0][0]){
                if(check(i,j)){
                    cout<<"Yes"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"No"<<endl;
    
}


Measured memory_bytes: 256
/*
 *Author : zsenshi
 DP 
 */
#include <bits/stdc++.h> //Only for gcc compilers
#define mt make_tuple
#define eb emplace_back
#define pb push_back
#define dg(x) cout << #x << ":"<<x<<endl
#define dg2(x,y) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<endl
#define dg3(x,y,z) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<endl
#define dg4(x,y,z,zz) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<' '<<#zz<<':'<<zz<<endl
#define rep(i,begin,end) for(__typeof(end) i = (begin)-((begin) > (end)); i != (end) - ((begin) > (end)); i += 1-2*((begin) > (end)))
using namespace std;
typedef long long ll;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vector<pii>> vvpi;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  double p_head;
  vector<double> dp(n+1);
  dp[0]=1;
  for(int coin = 0; coin < n; coin++){
    cin >> p_head;
    for(int i = coin+1; i >= 0; i--){
      dp[i] = (i == 0 ? 0 : dp[i-1]*p_head) + dp[i]*(1-p_head);
    }
  }
  double answer = 0;
  for(int heads = 0; heads <=n ;heads++){
    int tails = n - heads;
    if(heads > tails){
      answer += dp[heads];
    }
  }
  printf("%.10lf\n",answer);
}


Measured memory_bytes: 256
{-# OPTIONS_GHC -O #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}

import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

d2 a
    | even a = 1 + (d2 $ a `div` 2)
    | True = 0

cnt [] = 0
cnt (a:as) = (d2 a) + (cnt as)

main=do
    n<-readLn::IO Int
    as<-unfoldr (B.readInt.B.dropWhile(==' '))<$>B.getLine :: IO[Int]
    print $ cnt as


Measured memory_bytes: 1276
#include<stdio.h>

#define N 100

int main(){
    int A[N];
    int n,i,flag=1;

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
        if(A[i]%2==0){
            if(A[i]%3!=0 && A[i]%5!=0){
                flag = 0;
                break;
            }
        }
    }

    if(flag){
        puts("APPROVED");
    }else{
        puts("DENIED");
    }

    return 0;
}

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back


int main(){
    int n, m; cin >> n >> m;
    vector<vector<int> >  tree(n);
    REP(i, 0, m){
        int a, b; cin >> a >> b;
        a--; b--;
        tree[a].pb(b);
        tree[b].pb(a);
    }
    queue<int> q;
    vector<int> flag(n, 0);
    q.push(0);
    flag[0] = -1;
    while(!q.empty()){
        int now = q.front();
        q.pop();
        REP(i, 0, tree[now].size()){
            int next = tree[now][i];
            if(flag[next] == 0){
                flag[next] = now+1;
                q.push(next);
            }
        }
    }
    cout << "Yes" << endl;
    REP(i, 1, n){
        cout << flag[i] << endl;
    }
}

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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; }

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  rep(i,h) cin>>s[i];
  
  string ans="Yes";
  rep(i,h) rep(j,w) if(s[i][j]=='#'){
    int cnt=0;
    if(i>0) if(s[i-1][j]=='#') cnt++;
    if(i<h-1) if(s[i+1][j]=='#') cnt++;
    if(j>0) if(s[i][j-1]=='#') cnt++;
    if(j<w-1) if(s[i][j+1]=='#') cnt++;
    if(cnt==0){
      ans="No";
      break;
    }
  }
  cout<<ans<<endl;
}


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

static const int N = 1000;
typedef int data;


void trace(int A[], int n){
  int i;
  for(i=1; i<=n; i++){
    if(i>1) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}

void INSERTION_SORT(data *A, int n){
  data key;
  int i,j;
  for(j=1; j<=n; j++){
    key = A[j];
    i = j-1;  //A[j]???A[0...j-1]????????\??????
    while(i>=0 && A[i]>key){ //?????????????????§???A[j]????????????A[i]?????????????????°???
      A[i+1] = A[i]; //A[0...j-1]?????´???????????§???????????¨?????¨???
      i -= 1;
     }
     A[i+1] = key;
     trace(A,n);
  }

}

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d",&n);

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

  INSERTION_SORT(A,n);

  return 0;
}

Measured memory_bytes: 2704