akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(){
  int N,A;
  cin >> N;
  bool flag=true;
  for(int i=0;i<N;i++){
    cin >> A;
    if(A%2)continue;
    if(A%3!=0 && A%5!=0)flag=false;
  }
  if(flag)cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define ld long double
#define pb push_back

using namespace std;

const int N=2e5+5;

ll n,k,a[N],ans;

int main()
{
    cin >> n >> k;
    for (int i=0;i<n;i++)
    {
        cin >> a[i];
    }
    sort(a,a+n);
    reverse(a,a+n);
    for (int i=k;i<n;i++)
    {
        ans+=a[i];
    }
    cout << ans << endl;
    return 0;
}



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

int main(){
    string x;
    cin >> x;

    int flag = 0;
    if(x[0] == x[1]){
        if(x[1] == x[2]){
            flag = 1;
        }
    }
    if(x[1] == x[2]){
        if(x[2] == x[3]){
            flag = 1;
        }
    }

    if(flag == 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include <iostream>

using namespace std;

#define sz(a) (int)a.size()

const int N = 6e3;

int n, dp[N][N], ans;
string s;

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> n;
	cin >> s;
//	s = '#' + s;
	n = sz(s) - 1;
	for(int i = 1; i <= n + 1; ++i) {
		for(int j = i + 1; j <= n + 1; ++j) {
			if(s[i - 1] == s[j - 1] && (j - i) > dp[i - 1][j - 1]) {
				dp[i][j] = dp[i - 1][j - 1] + 1;
				ans = max(dp[i][j], ans);
			}
	 	}
	}
	cout << ans;
	return 0;
}
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include <iostream>

using namespace std;

#define sz(a) (int)a.size()

const int N = 1e5;

int n, ans, z[N];
char s[N];

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> n;
	for(int i = 0; i < n; ++i)
		cin >> s[i];
	for(int j = 0; j < n; ++j) {
    	if(ans >= (n - j) / 2) break;
    	z[j] = 0;
    	int l = j, r = j;
    	for(int i = j + 1; i < n; ++i) {
    		z[i] = 0;
    		if(i <= r) {
    			z[i] = min(r - i + 1, z[i - l]);
    		}
    		while(i + z[i] < n && j + z[i] < i && s[j + z[i]] == s[i + z[i]]) {
    			++z[i];
    		}
    		if(i + z[i] - 1 > r) {
    			l = i;
    			r = i + z[i] - 1;
    		}
    		ans = max(ans, z[i]);
    	}
	}
	cout << ans;
	return 0;
}
*/
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include <iostream>

using namespace std;

#define sz(a) (int)a.size()

const int N = 1e5;

int n;
string s;

bool check(int len) {
	if(!len) return 1;
	for(int j = len; j < n; ++j) {		
		int cnt = 0;
		int i = j;
		while(i < n && s[i] == s[i - len]) {
			++cnt;
			++i;
			if(cnt == len) 
				return 1;
		}
	}
	return 0;
}

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> n;
	cin >> s;
	int l = 0, r = n / 2;
	while(l < r) {
		int mid = (l + r) / 2;
		if(check(mid)) r = mid;
		else l = mid + 1;
	}
	cout << r;
	return 0;
}
*/

Measured memory_bytes: 119168
#include <bits/stdc++.h>
#define N 510
#define ll long long
#define For(i,x,y) for(int i=(x);i<=(y);++i)
#define Rof(i,x,y) for(int i=(x);i>=(y);--i)
#define Edge(x) for(int i=head[x];i;i=e[i].nxt)
#define mset(x,y) memset(x,y,sizeof(x))
using namespace std;
ll dp[N][N],A[N][N],B[N][N],a[N][N],b[N][N];
ll getB(int rx,int ry,int lx,int ly){
	if(lx>rx||ly>ry) return 0;
	return B[rx][ry]-B[lx-1][ry]-B[rx][ly-1]+B[lx-1][ly-1];
}
ll getA(int rx,int ry,int lx,int ly){
	if(lx>rx||ly>ry) return 0;
	return A[rx][ry]-A[lx-1][ry]-A[rx][ly-1]+A[lx-1][ly-1];
}
void chkmin(ll &x,ll y){ if(y<x) x=y; }
int main(){
	int n;ll ans=0;
	scanf("%d",&n);
	For(i,1,n){
		For(j,1,i-1) scanf("%lld",&b[i][j]);
		For(j,i+1,n) scanf("%lld",&a[i][j]);
		For(j,1,n){
			A[i][j]=A[i-1][j]+A[i][j-1]+a[i][j]-A[i-1][j-1];
			B[i][j]=B[i-1][j]+B[i][j-1]+b[i][j]-B[i-1][j-1];
		}
	}
	mset(dp,0x3f);ans=dp[0][0];
	dp[0][0]=0;
	For(i,0,n) For(j,0,max(i-1,0)) For(k,i+1,n)
		chkmin(dp[k][i],dp[i][j]+getB(n,i,k+1,j+1)+getA(k,k,i+1,i+1));
	For(j,1,n) chkmin(ans,dp[n][j]);
	printf("%lld",ans);
}

Measured memory_bytes: 10368
n,c=map(int,input().split())
D=[]
for i in range(c):
    D.append(list(map(int,input().split())))
C=[]
for i in range(n):
    C.append(list(map(int,input().split())))
    
A=[[0]*c for i in range(3)]
for i in range(n):
    for j in range(n):
        a=(i+j)%3
        A[a][C[i][j]-1]+=1

ans=10**100
for a0 in range(c):
    for a1 in range(c):
        for a2 in range(c):
            if a0==a1 or a1==a2 or a2==a0:
                continue
            cnt=0
            for i in range(c):
                cnt+=D[i][a0]*A[0][i]
                cnt+=D[i][a1]*A[1][i]
                cnt+=D[i][a2]*A[2][i]
            ans=min(cnt,ans)
print(ans)

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);

int gcd (int x, int y){
    int a, b;
    if (x > y) {
        a = x; b = y;
    } else {
        a = y; b = x;
    }
    while(true) {
        if (a % b == 0) {
            return b;
        } else {
            int t = b;
            b = a % b;
            a = t;
        }
        //cerr << a << b << endl;
    }
}


int main(void)
{
    IOS
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0 ; i < n; i++) cin >> a[i];

    vector<int> lgcd(n); lgcd[0] = a[0];
    vector<int> rgcd(n); rgcd[n-1] = a[n-1];
    vector<int> lrgcd(n);
    
    for(int i = 1; i < n; i++){
        lgcd[i] = gcd(lgcd[i-1] , a[i]);
        rgcd[n-i-1] = gcd(rgcd[n-i] , a[n-i-1]);
        //cerr << "i:" << i << " " << lgcd[i] << " " << rgcd[n-i-1] << endl;
    }
    //cerr << "gcd1" << endl;
    for(int i = 0; i < n; i++){
        if (i == 0) {
            lrgcd[i] = rgcd[i+1];
        } else if (i == n-1) {
            lrgcd[i] = lgcd[i-1];
        } else {
            lrgcd[i] = gcd(lgcd[i-1], rgcd[i+1]); 
        }
    }
    auto itr = max_element(lrgcd.begin(),lrgcd.end());
    cout << *itr << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
	while(true){
		int a,b,c;
		cin >> a;
		if(a==0)
			{break;}
		int student[a]={};
		for(int n=0;n<a;n++){
			cin >> b;
			student[n]=b;
		}
		sort(student,student+a);
		c=student[0]-student[1];
		for(int m=0;a-1>m;m++){
			if(c<student[m]-student[m+1]){
				c=student[m]-student[m+1];
		}}
		printf("%d\n",c*-1);
}}



Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb push_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int oo = 0x3f3f3f3f;
const int maxn = 1000 + 10;

template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

int n, m;
int cnt[maxn];
deque<int> G[maxn];

int main() {
#ifdef Wearry
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif
    
    cin >> n >> m; 
    for(int i = 1; i <= n; ++i) {
        for(int j = 0; j < m; j++) {
            int x;
            cin >> x;
            G[i].pb(x);

            if(j == 0) ++ cnt[x];
        }
    }

    int ans = oo;
    while(true) {
        int res = 0, u = -1;
        for(int i = 1; i <= m; ++i) if(cnt[i] > res) res = cnt[i], u = i; 

        ans = min(ans, res);

        cnt[u] = -1;
        for(int i = 1; i <= n; ++i) if(G[i].front() == u) {
            while(cnt[G[i].front()] == -1 && !G[i].empty()) 
                G[i].pop_front();

            if(G[i].empty()) { printf("%d\n", ans); exit(0); }
            ++ cnt[G[i].front()];
        }
    }

    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
#include <numeric>
#include <queue>
#include <map>
#include <cstdint>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long int ll;
typedef pair<ll, ll> P;
const vector<int> di = { -1, 0, 1, 0 };
const vector<int> dj = { 0, 1, 0, -1 };
const double PI = 3.14159265358979323846;

int main() {

	ll n;
	cin >> n;
	vector<ll> a(n - 1);
	rep(i, n - 1) cin >> a.at(i);

	vector<ll> b(n);
	rep(i, n - 1) {
		b.at(a.at(i) - 1)++;
	}
	rep(i, n) {
		cout << b.at(i) << endl;
	}
   
	return 0;
	
}



Measured memory_bytes: 6376
#include<stdio.h>

int check(int n, int x){
    int i, j, counter = 0;
    for (i = 1; i <= n;i++){
        for (j = i + 1; j <= n;j++){
            int substract = (x - j) - i;
            if(j < substract && substract <= n){
                //printf("%d %d\n", i, j);
                counter++;
            }
        }
    }
    return counter;
}

int main(void){
    int n, x;
    while(1){
        scanf("%d %d", &n, &x);
        if(n == 0 && x == 0){
            break;
        }
        printf("%d\n", check(n, x));
    }
    return 0;
}


Measured memory_bytes: 2104
from scipy.sparse.csgraph import floyd_warshall as fw

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

S = [[float("inf") for i in range(N)] for i in range(N)]

for i in range(M):
    a, b, c = map(int, input().split())
    S[a-1][b-1] = c
    S[b-1][a-1] = c

Sdist = fw(S)

Ssup_init = [[float("inf") for i in range(N)] for i in range(N)]

for i in range(N):
    for j in range(N):
        if Sdist[i][j]<=L:
            Ssup_init[i][j] = 1

Ssup = fw(Ssup_init)

Q = int(input())

for i in range(Q):
    s, t = map(int, input().split())
    if Ssup[s-1][t-1]==float("inf"):
        print(-1)
    else:
        print(int(Ssup[s-1][t-1]-1))

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll X, Y;
ll s[300] = {0,300000, 200000, 100000};
int main(){
    scanf("%lld%lld", &X, &Y);
    if(X==1&&Y==1){
        printf("%lld", 1000000ll);
    }else{
        printf("%lld", s[X] + s[Y]);
    }

    return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <set>

class APoor {
public:
    void solve(std::istream &in, std::ostream &out) {
        using namespace std;
        int a, b, c;
        in >> a >> b >> c;

        set<int> st = {a, b, c};

        if (st.size() == 2) {
            out << "Yes" << endl;
        } else {
            out << "No" << endl;
        }
    }
};


int main() {
    APoor solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
import sys
n = int (sys.stdin.readline())
a = map (int, sys.stdin.readline().split())
res = 0
for i in range (n):
  if a[i] == i+1:
    if i+1 < n:
      a[i], a[i+1] = a[i+1], a[i]
    res += 1
print (res)


Measured memory_bytes: 11304
S = set(input())
if len(S) == 2:
  if len(S & {'N', 'S'}) == 2 or len(S & {'E', 'W'}) == 2:
    print('Yes')
  else:
    print('No')
elif len(S) == 4:
  print('Yes')
else:
  print('No')
  

Measured memory_bytes: 2940
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<Pll> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define SORT(x) sort(all(x))
#define RSORT(x) sort(all(x),greater<ll>())
#define vec_max(V) *max_element(all(V))
#define vec_min(V) *min_element(all(V))
#define vec_sum(V) accumulate(all(V), 0LL)
#define print(X) cout << (X) << "\n"
#define sprint(X) printf("%f\n", (X)) // 小数点の出力
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
#define case(X) cout << "Case #" << (X) + 1 << ":" << "\n"
static const int INF = 1e+9+7;

int main(){

  ll N;
  str S;
  cin >> N >> S;

  rep(i,0,sz(S)){
    int x = (S[i] - 'A' + N) % 26;
    cout << char('A' + x);
  }

  print("");

 return 0;
}


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

int main()
{
    double xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2;

    while( cin >> xa1 >> ya1 >> xa2 >> ya2 >> xb1 >> yb1 >> xb2 >> yb2 )
    {
        bool judge = true;
        if( xb2 < xa1 )
            judge = false;
        else if( ya2 < yb1 )
            judge = false;
        else if( yb2 < ya1 )
            judge = false;
        else if( xa2 < xb1 )
            judge = false;
        else;

        if( judge == true )
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 3044
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int n, point[200], tmp[3][200], tmp2;

int main(){

	cin >> n;
	rep(i, n) {
		rep(j, 3)cin >> tmp[j][i];
	}
	rep(i, 3) {
		rep(j, n) {
			tmp2 = tmp[i][j];
			rep(k, n) {
				if (j == k)continue;
				if (tmp2 == tmp[i][k]) {
					tmp[i][j] = 0;
					tmp[i][k] = 0;
				}
			}
		}
	}
	rep(i, n) {
		rep(j, 3) {
			point[i] += tmp[j][i];
		}
	}

	rep(i, n)cout << point[i] << endl;

	return 0;
}


Measured memory_bytes: 3088
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<queue>
#define _USE_MATH_DEFINES
#include<math.h>
#include<cmath>
#include<ctime>
#include<map>
#include<typeinfo>
#define R(i, n) for(int i = 0;i < n; i++)
#define S(a) scanf("%d", &a)
#define S2(a, b) scanf("%d%d", &a, &b)
#define S3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define SL(a) scanf("%lld", &a)
#define SL2(a, b) scanf("%lld%lld", &a, &b)
#define SL3(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)
#define SA(i, n, a) R(i, n) scanf("%d", &a[i])
#define SAL(i, n, a) R(i, n) scanf("%lld", &a[i])
#define SC(a) scanf("%c", &a)
#define P(a) printf("%d", a)
#define PL(a) printf("%lld", a)
#define PY printf("YES")
#define PN printf("NO")
#define Py printf("Yes")
#define Pn printf("No")
using namespace std;
using ll = long long;
using PR = pair<int, int>;
const ll MOD = 1e+9 + 7;
const int INF = 1e+9;
const double PI = acos(-1);

int main() {
	int n, q;
	string s;
	S2(n, q);
	cin >> s;
	vector<int> ac(s.size() + 1);
	ac[1] = 0;
	for (int i = 1; i < s.size(); i++) {
		if (s.substr(i - 1, 2) == "AC") ac[i + 1] = ac[i] + 1;
	    else ac[i + 1] = ac[i];
	}
	R(i, q) {
		int l, r;
		S2(l, r);
		P(ac[r] - ac[l]);
		printf("\n");
	}
}

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

int main(){
  ll a,b;
  cin >> a >> b;
  if(a<=0&&0<=b){
    cout << "Zero" << endl;
  }else if(0<a&&0<b){
    cout << "Positive" << endl;
  }else{
    ll t = abs(a-b);
    if(t%2){
      cout << "Positive" << endl;
    }else{
      cout << "Negative" << endl;
    }
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod (ll)1000000007
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int k;
int digitsum(int n) {
	int res = 0;
	while (n) {
		res += n % 10;
		n /= 10;
	}
	return res;
}
int mypow(int a, int b) {
	if (!b)return 1;
	if (b % 2)return mypow(a, b - 1) * a;
	int memo = mypow(a, b / 2);
	return memo * memo;
}
bool func(int a, int b) {
	if (a * digitsum(b) == b * digitsum(a))return a < b;
	return a * digitsum(b) < b * digitsum(a);
}
signed main() {
	cin >> k;
	vector<int> vec;
	REP(i, 99)vec.push_back(i);
	rep(i, 13) {
		int n = mypow(10, i) - 1;
		for (int j = 100; j <= 999; j++) {
			vec.push_back(n + j * mypow(10, i));
		}
	}
	sort(vec.begin(), vec.end(), func);
	int ma = 0, cnt = 0, i = 0;
	while (true) {
		if (ma >= vec[i]) {
			i++;
			continue;
		}
		cout << vec[i] << endl;
		cnt++;
		ma = max(ma, vec[i]);
		i++;
		if (cnt == k)break;
	}
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main(){
	int n; cin >> n;
	std::vector<std::pair<int, int>> vec;
	for(int i = 0; i < n; i++) {
		int a, b; cin >> a >> b;
		if(a > b) std::swap(a, b);
		
		vec.push_back({a, b});
	}
	sort(begin(vec), end(vec)); reverse(begin(vec), end(vec));
	
	int Ami = 1 << 30, Bmi = 1 << 30, Ama = 0, Bma = 0;
	std::vector<int> miA(n + 1, 1 << 30), maA(n + 1, 0), miB(n + 1, 1 << 30), maB(n + 1, 0);
	for(int i = n - 1; i >= 0; i--) {
		Ami = std::min(Ami, vec[i].first);
		Ama = std::max(Ama, vec[i].first);
		Bmi = std::min(Bmi, vec[i].second);
		Bma = std::max(Bma, vec[i].second);
		
		miA[i] = Ami;
		maA[i] = Ama;
		miB[i] = Bmi;
		maB[i] = Bma;
	}
	
	
	i64 ans = 1LL << 60;
	Ami = Bmi = 1 << 30, Ama = Bma = 0;
	for(int i = -1; i < n; i++) {
		if(~i) {
			Ami = std::min(Ami, vec[i].first);
			Ama = std::max(Ama, vec[i].first);
			Bmi = std::min(Bmi, vec[i].second);
			Bma = std::max(Bma, vec[i].second);
		}
		
		i64	AmiA = std::min(Ami, miB[i + 1]);
		i64	AmaA = std::max(Ama, maB[i + 1]);
		i64	BmiB = std::min(Bmi, miA[i + 1]);
		i64	BmaB = std::max(Bma, maA[i + 1]);
		
		ans = std::min(ans, (AmaA - AmiA) * (BmaB - BmiB));
	}
	
	cout << ans << endl;
	return 0;
}


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

using namespace std;

#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	#ifndef ONLINE_JUDGE
//		freopen("input.txt","r",stdin);
	#endif
	int n;
	cin>>n;
	vector<ll> a(n);
	ll ans = 1e18,x = 0,y=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		x += a[i];
	}
	for(int i=0;i<n-1;i++){
		y+=a[i];
		x-=a[i];
		ans = min(ans,abs(x-y));
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var dg = Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToList();

            var n = dg[0];
            var t = dg[1];

            int min = int.MaxValue;
            for (int i = 0; i < n; ++i)
            {
                var input = Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToList();
                var c = input[0];
                var tn = input[1];
                
                if (tn <= t && min > c)
                {
                    min = c;
                }
            }
            
            Console.WriteLine((min == int.MaxValue) ? "TLE" : "" + min);
        }
    }
}


Measured memory_bytes: 11220
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
s = ns()
pre = s[0]
c = 1
for si in s[1:]:
    if si != pre:
        c += 1
        pre = si
print(c)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int n,m;
string a;
int main()
{
    cin>>a;
    int is=0,is1=0;
    for(int i=0;i<a.size();i++)
    {
        if(a[i]=='A'&&a[i+1]=='C')
        {
            cout<<"Yes";return 0;
        }
    }
 cout<<"No";
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i < (n)i++)
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
#define pii pair<int, int>
#define abs(a) llabs(a)
#define log int64_t
#define re(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

signed gcd(log a, log b)
{
   if (a < b)
      swap(a, b);

   log r = a % b;
   while (r != 0)
   {
      a = b;
      b = r;
      r = a % b;
   }
   return b;
}

signed lcm(log a, log b)
{
   return a / gcd(a, b) * b;
}

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

   log a, b;
   cin >> a >> b;
   if (lcm(a, b) % a != 0 || lcm(a, b) % b != 0)
   {
      cout << a * b << '\n';
   }
   else
      cout << lcm(a, b) << '\n';
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    bool flg = false;
    for (int i = 0; i < 26; ++i) {
        for (int j = 0; j < 15; ++j) {
            int sum = 4 * i + j * 7;
            if (n == sum) flg = true;
        }
    }

    if (flg) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


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

using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    vector<string> name;
    vector<int> score;
    vector<int> sa;
    cin >> n;
    name.resize(n);
    score.resize(n);
    for (int i = 0 ; i < n; i++)
        cin >> name[i] >> score[i];
    sa.resize(n);
    for (int i = 0; i < n; i++)
        sa[i] = i;
    sort(sa.begin(), sa.end(),
        [&](int a, int b) {
            if (name[a] != name[b])
                return name[a] < name[b];
            return score[a] > score[b];
        });
    for (auto a: sa) {
        cout << a + 1 << '\n';
    }
    return 0;
}


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


int main() {
    int N;
    ll T;
    cin >> N >> T;
    vector<ll> t(N);

    rep(i,N) cin >> t[i];

    ll sum = 0LL;
    rep(i,N-1){
        sum += min(t[i+1] - t[i], T);
    }
    cout << sum + T << endl;
}


Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
//#define fi first
//#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


template <typename U>
map<U, int> doPrimeFactorization(U n) {
#define PrimeFactorization_DebugPrint false

  map<U, int> rs;
  U a = 1;

  while (!(n & 1)) {
    n >>= 1;
    rs[2]++;
  }

  for (U i = 3; i * i <= n; /*NOP*/) {
    auto q = n / i;
    auto r = n - i * q;
    if (r == 0) {
      rs[i]++;
      n = q;
    }
    else {
      i += 2;
    }
  }

  if (n > 1) {
    rs[n]++;
  }

  return move(rs);
}

// コレクションの重複要素を数え、<要素, 個数> のコレクションを返す
template<typename T>
map<T, int> countAllElements(const vector<T>& src) {
  map<T, int> results;

  for (auto& e : src) {
    auto it = results.find(e);
    if (it != results.end()) {
      it->second++;
    }
    else {
      results[e] = 1;
    }
  }

  return results;
}

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  // 整数列 A を全て 2 で割った整数列 B = b1, b2,...,bN
  // bk * (2p + 1) = X
  // つまりどの数にも奇数をかけて得られる最小公倍数がX
  // B に偶数が含まれていた場合、いずれのbkに対しても2がかけられている個数が同じでないといけない
  // そうでない場合は、個数は 0 になる
  // 最小公倍数を m とすると、m, 3m, 5m, 7m... が答えになるのでそれを数える
  
  int N, M;
  cin >> N >> M;

  map<int, int> mlcm;
  i64 lcm = 1;

  vector<int> as(N);
  bool fail = false;

  cin >> as[0];
  as[0] >>= 1;
  int ns = 0;
  while (!(as[0] & 1)) {
    as[0] >>= 1;
    ns++;
  }

  FOR(i, 1, N) {
    //int a;
    //cin >> a;
    cin >> as[i];
    as[i] >>= 1;

    int n = 0;
    while (!(as[i] & 1)) {
      as[i] >>= 1;
      n++;
    }
    if (n != ns) fail = true;
  }

  i64 result;
  if (fail) {
    //if (mlcm[2] > 0) {

    result = 0;
  }
  else {
    M >>= ns;

    F0R(i, N) {
      auto pf = doPrimeFactorization(as[i]);
      for (auto p : pf) {
        if (mlcm[p.first] < p.second) {

          //lcm *= pow<i64>(p.first, p.second - mlcm[p.first]);
          mlcm[p.first] = p.second;
        }
      }
    }
    for (auto p : mlcm) {
      lcm *= pow<i64>(p.first, p.second);
    }
    result = (M / lcm + 1) / 2;
  }

  cout << result;
}
#endif


Measured memory_bytes: 640
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int[] h = new int[n];

        int max = 0;
        int tmp = 0;
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        for (int i = 0; i < n-1; i++) {
            if (h[i] >= h[i+1]) {
                tmp++;
            } else {
                max = Math.max(tmp, max);
                tmp = 0;
            }
        }

        max = Math.max(tmp, max);
        System.out.println(max);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 39776
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	ns := makeGrid(n, 1<<uint(n))
	ew := makeGrid(n, 1<<uint(n))
	xx := make([]int64, n)
	yy := make([]int64, n)
	pp := make([]int64, n)
	for i := 0; i < n; i++ {
		xx[i] = getNextInt64(scanner)
		yy[i] = getNextInt64(scanner)
		pp[i] = getNextInt64(scanner)
	}
	for i := 0; i < 1<<uint(n); i++ {
		for j := 0; j < n; j++ {
			x := min(abs(xx[j]), abs(yy[j]))
			y := min(abs(xx[j]), abs(yy[j]))
			for k := 0; k < n; k++ {
				if i>>uint(k)&1 == 0 {
					continue
				}
				if x > abs(xx[j]-xx[k]) {
					x = abs(xx[j] - xx[k])
				}
				if y > abs(yy[j]-yy[k]) {
					y = abs(yy[j] - yy[k])
				}
			}
			ns[j][i] = x
			ew[j][i] = y
		}
	}
	cnt := 1
	for i := 0; i < n; i++ {
		cnt *= 3
	}
	ans := make([]int64, n+1)
	for i := 0; i < n+1; i++ {
		ans[i] = math.MaxInt64
	}
	for i := 0; i < cnt; i++ {
		nsbit := 0
		ewbit := 0
		xbit := i
		c := 0
		for j := 0; j < n; j++ {
			switch xbit % 3 {
			case 1:
				nsbit = nsbit | 1<<uint(j)
				c++
			case 2:
				ewbit = ewbit | 1<<uint(j)
				c++
			}
			xbit /= 3
		}
		a := int64(0)
		for j := 0; j < n; j++ {
			a += min(ns[j][nsbit], ew[j][ewbit]) * pp[j]
		}
		if ans[c] > a {
			ans[c] = a
		}
	}
	for k := 0; k < n+1; k++ {
		fmt.Fprintln(writer, ans[k])
	}
}
func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func makeGrid(h, w int) [][]int64 {
	index := make([][]int64, h, h)
	data := make([]int64, h*w, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}


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

int main(){
  int n, k;
  int a[100];
  cin >> n >> k;
  for(int i = 0; i < n; ++i) cin >> a[i];

  sort(a, a + n, greater<int>());
  int ans = 0;
  for( int i = 0; i < k; ++i ) {
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

aa = [a, b, c, d, e]


def v(x):
    if x % 10 == 0:
        return 9
    else:
        return x % 10


bb = list(reversed(sorted(map(lambda x: (v(x), x), aa))))

total = 0
for _, x in bb:
    if total % 10 == 0:
        pass
    else:
        total = ((total // 10) + 1) * 10
    total += x

print(total)



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

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	string sh, sh1; cin >> sh;
	getchar();
	cin >> sh1;
	int length = sh.size();
	for (int i = 0; i < length; ++i)
	{
		if (sh[i] != sh1[i])
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3620
import math


def a():
    s = input()
    if s[-1] == 's':
        print(s + 'es')
    else:
        print(s + 's')


def b():
    n = int(input())
    d = []
    for i in range(n):
        d.append(list(map(int, input().split())))
    for i in range(n - 2):
        if d[i + 2][0] == d[i + 2][1] and \
            d[i + 1][0] == d[i + 1][1] and \
                d[i][0] == d[i][1]:
            print('Yes')
            break
    else:
        print('No')


def c():
    pass


def d():
    pass


# a()
b()
# c()
# d()


Measured memory_bytes: 9204
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<time.h>
#include<typeinfo>
#include <cstdlib>

using namespace std;

#define ll long long
#define MOD 1000000007

int main(){
	string in;
	cin >> in;
	int ini = atoi(in.c_str());
	int x = ini/100;
	int y = ini%100;
	bool ok1 = true;
	bool ok2 = true;
	if(y==0 || y > 12){//yymm
		ok1 = false;
	}
	if(x==0 || x > 12){//mmyy
		ok2 = false;
	}
	if(ok1&&ok2){
		cout << "AMBIGUOUS" << endl;
	}else if(ok1){
		cout << "YYMM" << endl;
	}else if(ok2){
		cout << "MMYY" << endl;
	}else{
		cout << "NA" << endl;
	}
}

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

int main(){
	char input[16];
	long sq,num;
	int i,j,n,sum;
	
	fgets(input,sizeof input,stdin);
	sscanf(input,"%d",&n);
	sum=n;
	
	for(i=0;i<n;i++){
		fgets(input,sizeof input,stdin);
		sscanf(input,"%ld",&num);
		sq=(long)(sqrt(num))+1;
		for(j=2;j<sq;j++){
			if(num%j==0){
				sum--;
				break;
			}
		}
		
	}
	printf("%d\n",sum);
	
	return 0;
}

Measured memory_bytes: 604
#include<stdio.h>
char x[9]={48,49,50,51,53,55,56,57};

void f(int n)
{
	if(n)
	{
		f(n/8);
		putchar(x[n%8]);
		
	}
}

int main()
{
	int n;
	for(;scanf("%d",&n),n;puts(""))
		f(n);
	return 0;
}

Measured memory_bytes: 588
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>/*toupperとかが入っている*/
#include<vector>/*可変長配列vectorのインクルード*/
 
const int MOD=1000000007;/* 1,000,000,007 で割った余りを出力する　のとき使う*/
using namespace std;/*標準名前空間を利用する。cinやcoutはこれによって利用可能になる*/

int K,N;
int H=0;
int A[1000005];
int B[1000005];

int main(void) {
  cin >> K >> N;
  for(int i=0; i<N; i++) cin >> A[i];
  for(int i=0; i<N; i++){
    B[i] = A[i+1] - A[i];
  }
  B[N-1] = K - A[N-1] +A[0];

  int max = 0;
  for(int i=0; i<N; i++){
    if(max < B[i]) max = B[i];
  }

  cout << K-max << endl;
  
  return 0;
}

Measured memory_bytes: 5248
#include <iostream>
#include <math.h>
using namespace std;

int main(){
  long long int N;
  cin >> N;
  long long int T[N], A[N];

  for(int i = 0; i < N; ++i){
    cin >> T[i] >> A[i];
  }

  long long int ans1 = T[0];
  long long int ans2 = A[0];

  for(int i = 0; i < N-1; ++i){
    long long int j = max(
      (ans1 + T[i+1] - 1) / T[i+1],(ans2 + A[i+1] - 1) / A[i+1]
    );

        ans1 = T[i+1] * j;
        ans2 = A[i+1] * j;
  }

  cout << ans1 + ans2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int N,K;
    scanf("%d %d",&N,&K);
    char S[N];
    scanf("%s",S);
    if(S[K-1]=='A') S[K-1]='a';
    else if(S[K-1]=='B') S[K-1]='b';
    else S[K-1]='c';
    printf("%s\n",S);
}

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

using namespace std;
string a, b, c;
int p = 0, q = 0, r = 0, k = 0;
int CardA() {
	if (a[p] == NULL)
		return 1;
	else {
		if (a[p] == 'a')
			k = 0;
		else if (a[p] == 'b')
			k = 1;
		else if (a[p] == 'c')
			k = 2;
		p++;
		return 0;
	}
}
int CardB() {
	if (b[q] == NULL)
		return 2;
	else {
		if (b[q] == 'a')
			k = 0;
		else if (b[q] == 'b')
			k = 1;
		else if (b[q] == 'c')
			k = 2;
		q++;
		return 0;
	}
}
int CardC() {
	if (c[r] == NULL)
		return 3;
	else {
		if (c[r] == 'a')
			k = 0;
		else if (c[r] == 'b')
			k = 1;
		else if (c[r] == 'c')
			k = 2;
		r++;
		return 0;
	}
}
int main()
{
	cin >> a >> b >> c;
	int ok = 0;
	while (1) {
		switch (k) {
		case 0: ok = CardA(); break;
		case 1: ok = CardB(); break;
		case 2: ok = CardC(); break;
		}
		if (ok) break;
	}
	switch (ok) {
	case 1: cout << "A"; break;
	case 2: cout << "B"; break;
	case 3: cout << "C"; break;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int i,p,sp,n;
cin>>p>>sp>>n;
long long int a[n],h[p];

for(i=0;i<p;i++)
h[i]=sp;

for(i=0;i<n;i++)
cin>>a[i];

for(i=0;i<n;i++)
 h[a[i]-1]++;

for(i=0;i<p;i++)
h[i]=h[i]-n;





for(i=0;i<p;i++)
{
   if(h[i]<=0)
    cout<<"No"<<endl;
   else
   cout<<"Yes"<<endl;
}

return 0;
}



Measured memory_bytes: 2176
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::HashMap;
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::usize;

#[allow(unused_macros)]
macro_rules! read_cols {
    ($($t:ty),+) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();

        let mut it = line.trim()
            .split_whitespace();

        ($(
            it.next().unwrap().parse::<$t>().ok().unwrap()
        ),+)
    }}
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn main() {
    let s = read::<String>().chars().collect::<Vec<char>>();
    let t = read::<String>().chars().collect::<Vec<char>>();

    let mut ans = t.len();
    for i in 0..=s.len()-t.len() {
        ans = min(t.iter().zip(&s[i..]).filter(|(c, d)| c != d).count(), ans);
    }

    println!("{}", ans);
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    REP(i, N)
    {
        if (i == K - 1)
        {
            if (S[i] == 'A')
                cout << 'a';
            else if (S[i] == 'B')
                cout << 'b';
            else
                cout << 'c';
        }
        else
        {
            cout << S[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 764
if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    count = 0

    for i in range(n):
        if a[i] % 2 == 1:
            count += 1

    if count % 2 == 1:
        print('NO')
    else:
        print('YES')


Measured memory_bytes: 14108
N, M = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())

AB = list(zip(A, B))
AB.sort()
A, B = zip(*AB)

sum = 0
num = 0
for i in range(N):
    num += B[i]
    if num >= M:
        num -= B[i]
        for j in range(B[i]):
            num += 1
            sum += A[i]
            if num >= M:
                print(sum)
                exit()
    else:
        sum += A[i] * B[i]


Measured memory_bytes: 26852
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int main()
{
    long long int x,y,i=0;
    scanf("%lld %lld",&x,&y);
    while(y>=x) {x*=2;i++;}
    printf("%lld",i);
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	//	"strings"
	"math"
)

func main() {
	sc := NewScanner()

	n := sc.NextInt()
	s := make([]int, n)
	sum := 0
	for i := 0; i < n; i++ {
		s[i] = sc.NextInt()
		sum += s[i]
	}
	ans := 0
	m := int(math.Round(float64(sum) / float64(n)))

	if n == 1 {
		ans = 0
	} else {
		for i := 0; i < n; i++ {
			ans += (m - s[i]) * (m - s[i])
		}
	}
	fmt.Printf("%+v\n", ans) // output for debug
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 1776
#include <cstdio>
#include <cstring>

#include <vector>
#include <algorithm>

using namespace std;

#define NMAX 100000

inline int c2(int n) {
    return n * (n - 1) >> 1;
}

static vector<int> buc[NMAX + 10];

int main() {
    int n;
    scanf("%d", &n);
    int k = 1;
    for (; c2(k + 1) <= n; k++) ;
    if (c2(k) == n) {
        for (int t = 1, l = 1, p = 1; t <= n; t++, p++) {
            buc[p].push_back(t);
            buc[p + l].push_back(t);
            if (p + l == k) {
                l++;
                p = 0;
            }
        }
        puts("Yes");
        printf("%d\n", k);
        for (int i = 1; i <= k; i++) {
            printf("%zu ", buc[i].size());
            for (int v : buc[i]) printf("%d ", v);
            puts("");
        }
    } else puts("No");
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop for(;;)
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
#define inf (1e9)
#define eps (1e-9)

int main() {
  int ans = 0;
  loop {
    string s; cin >> s;
    if (not cin) break;
    bool res = true;
    for (int i = 0, n = s.size(); i*2 < n-1; ++i)
      if (s[i] != s[n-i-1]) res = false;
    if (res) ++ans;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1188
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < ( int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
int even(ll n) {
	int count = 0;
	while (n > 0) {
		if (n % 2 == 0) {
			count++;
			n /= 2;
		}
		else {
			break;
		}
		//cout << n << endl;
	}
	return count;
}

int main() {
	int n;
	scanf("%d",& n);
	int ans = 0;
	rep(i, n) {
		ll a;
		cin >> a;
		ans += even(a);
	}
	cout << ans << endl;

}

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

#include<iostream>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<vector>

using namespace std;

#define Max(a,b) (a)>(b)?(a):(b);
#define Min(a,b) (a)<(b)?(a):(b);
int prime[1000000];
int main()
{
    prime[0]=1;
    prime[1]=1;
    long long i,j;
    for(i=2;i*i<=1000000;i++){
        if(prime[i]==0)
        for(j=i+i;j<=1000000;j+=i){
            prime[j]=1;
        }
    }

    int cnt = 0;
    for(i=2; i<1000000;i++){
        if(prime[i]==0)prime[i]= ++cnt;
        else prime[i]= cnt;
    }

    int n;
    while(scanf("%d",&n)==1)
    {
        if(n<2){cout<<"0"<<endl; continue;}

        cout<<prime[n]<<endl;
    }

    return 0;
}

Measured memory_bytes: 5112
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
int N; 
int p[200010];
int _p[200010];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    
    rep(i, N) cin >> p[i];
    rep(i, N) p[i]--;
    rep(i, N) _p[p[i]] = i;
    int ans = 1;
    int len = 1;
    rep(i, N - 1) {
        if(_p[i] < _p[i + 1]) len++;
        else len = 1;
        ans = max(ans, len);
        //cout << "*" << len << " " << _p[i] << " " << _p[i + 1] << endl;
    }
    cout << N - ans << endl;
    

    return 0;
}
// 8 4 5 6 7 1 2 3

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

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

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main()
{
	ll n,m;
	cin>>n>>m;
	if(n>=2 && m>=2){
		cout<<(n-2)*(m-2)<<endl;
	}else if(n<2 && m<2){
		cout<<1<<endl;
	}else{
		cout<<n*m-2<<endl;
	}
	return 0;
}

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

int main() {
  int N;
  map<int, int> A;
  cin >> N;
  
  for(int n=2; n<=N; n++) {
    int div = 2;
    int n_tmp = n;
    
    while(n>=div*div) {
      if(n_tmp%div==0) {
        A[div]++;
        n_tmp /= div;
      } else {
        div++;
      }
    }
  
    if(n_tmp!=1) {
      A[n_tmp]++;
    }
  }
  
  int over_75 = 0;
  int over_25 = 0;
  int over_15 = 0;
  int over_5 = 0;
  int over_3 = 0;
  
  for(auto a:A) {
    int num = a.second;
    if(num+1>=75) {
      over_75++;
    }
    if(num+1>=25) {
      over_25++;
    }
    if(num+1>=15) {
      over_15++;
    }
    if(num+1>=5) {
      over_5++;
    }
    if(num+1>=3) {
      over_3++;
    }
  }
    
  int ans = over_75;
  ans += over_25 * max(0, (over_3-1));
  ans += over_15 * max(0, (over_5-1));
  ans += over_5 * max(0, (over_5-1)) * max(0, (over_3-2)) / 2;
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int n;
	cin >> n;
	n%=10;
	cout << (n==3 ? "bon":(n==0 or n==1 or n==6 or n==8 ? "pon":"hon")) << endl;




}


Measured memory_bytes: 3048