akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int n, ans, minSuffix[100100], minPrefix[100100];
pair<int, int> a[100100];

int getAns(int minL, int maxL, int minR, int maxR)
{
  return max(0, maxL - minL + 1) + max(0, maxR - minR + 1);
}

void solve1()
{
  for (int i = 0; i < n - 1; i++)
    ans = max(ans, getAns(a[i].first, minPrefix[i], a[n - 1].first, minSuffix[i + 1]));
  cout << ans << endl;
}

void solve2(int minL, int maxL, vector<pair<int, int>> l, vector<pair<int, int>> r)
{
  int minR = r[0].first, maxR = r[0].second;
  for (auto u : r)
  {
    minR = max(minR, u.first);
    maxR = min(maxR, u.second);
  }
  if (minR > maxR)
  {
    cout << ans << endl;
    exit(0);
  }

  if (l.empty())
  {
    ans = max(ans, getAns(minL, maxL, minR, maxR));
    cout << ans << endl;
    exit(0);
  }

  int m = l.size();
  minPrefix[0] = l[0].second;
  for (int i = 1; i < m; i++)
    minPrefix[i] = min(minPrefix[i - 1], l[i].second);
  minSuffix[m - 1] = l[m - 1].second;
  for (int i = m - 2; i >= 0; i--)
    minSuffix[i] = min(minSuffix[i + 1], l[i].second);

  // put all to left
  ans = max(ans, getAns(max(minL, l[m - 1].first), min(maxL, minPrefix[m - 1]), minR, maxR));
  // put all to right
  ans = max(ans, getAns(minL, maxL, minR, min(maxR, minPrefix[m - 1])));
  // split
  for (int i = 0; i < m - 1; i++)
    ans = max(ans, getAns(max(minL, l[i].first), min(maxL, minPrefix[i]), minR, min(maxR, minSuffix[i + 1])));
  cout << ans << endl;
}

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

  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i].first >> a[i].second;

  sort(a, a + n);
  minPrefix[0] = a[0].second;
  for (int i = 1; i < n; i++)
    minPrefix[i] = min(minPrefix[i - 1], a[i].second);
  minSuffix[n - 1] = a[n - 1].second;
  for (int i = n - 2; i >= 0; i--)
    minSuffix[i] = min(minSuffix[i + 1], a[i].second);

  ans = max(ans, getAns(a[0].first, a[0].second, a[n - 1].first, minSuffix[1]));
  ans = max(ans, getAns(a[n - 1].first, a[n - 1].second, a[n - 2].first, minPrefix[n - 2]));
  for (int i = 0; i < n; i++)
    ans = max(ans, getAns(a[i].first, a[i].second, a[n - 1].first, min(minSuffix[i + 1], minPrefix[i - 1])));

  int minRId = 0;
  for (int i = 1; i < n; i++)
    if (a[i].second < a[minRId].second)
      minRId = i;

  vector<pair<int, int>> l, r;
  for (int i = 0; i < n; i++)
    if (i != minRId)
    {
      if (a[i].first > a[minRId].second) r.push_back(a[i]);
      else l.push_back(a[i]);
    }

  sort(l.begin(), l.end());
  sort(r.begin(), r.end());

  if (r.empty()) solve1();
  else solve2(a[minRId].first, a[minRId].second, l, r);
}


Measured memory_bytes: 3576
moji = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
moji = moji.split(",")
a = input()

print(int(moji[int(a)-1]))

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define SQ(a) a*a


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    // code here
    string s,t;
    cin >> s >> t;
    t.pop_back();
    if( t == s ) cout <<"Yes"<<endl;
    else cout <<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define MP make_pair
#define EB emplace_back
#define endl "\n"
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

void solve() {
    ll n,k,q;
    cin>>n>>k>>q;
    ll a[n];
    for(int i=0;i<n;i++){
        a[i]=k;
    }
    ll num;
    for(int i=0;i<q;i++){
        cin>>num;
        a[num-1]++;
    }

    for(int i=0;i<n;i++){
        if(a[i]-q>0){
            cout<<"Yes"<<endl;
        }
        else cout<<"No"<<endl;
    }

}


int main()
{
    IOS;
    ll t=1;
   // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


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

int main()
{
    int n, l;
    cin>>n>>l;
    string s[n];
    set<string>st;
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    sort(s, s+n);
    string ans;
    for(int i=0;i<n;i++)
    {
        ans+=s[i];
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 3624
import sys
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

D.sort()
T.sort()
l = 0
for i in range(M):
    while True:
        if D[l] == T[i]:
            l += 1
            break
        elif D[l] > T[i]:
            print("NO")
            sys.exit()
        l += 1
        
print("YES")

Measured memory_bytes: 35556
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int judge(int);

int main(){
  int i,j;
  int n;
  int *A;
  int num=0;

  scanf("%d",&n);
  
  A =(int *)malloc(n*sizeof(int ));
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<n;i++){
    if(judge(A[i]))num++;
  }
  printf("%d\n",num);
  return 0;
}

int judge(int x){
  int i;
  if(x==2)return 1;
  if(x<2||x%2==0)return 0;
  i=3;
  while(i<=sqrt(x)){
      if(x%i==0) return 0;
      i=i+2;
  }
  return 1;
}



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

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

char s[100];
string ans = "Yes";
cin >> s;
for(int i=0;i<100;++i){
    if(s[i]=='\0'){
        break;
    }
    if(i==0){
        if(s[i]=='R'||s[i]=='U'||s[i]=='D'){
            //nothing
        }else{
            ans="No";
            break;
        }
    }
    if(i%2==0){
        if(s[i]=='R'||s[i]=='U'||s[i]=='D'){
            //nothing
        }else{
            ans="No";
            break;
        }
    }else{
        if(s[i]=='L'||s[i]=='U'||s[i]=='D'){
            //nothing
        }else{
            ans="No";
            break;
        }
    }
}
cout << ans;
//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cctype>

using namespace std;

typedef long long Board;

const int N = 9;
const Board GOAL = 0x087654321;

const int PATTERN = 362880;
bool frontier[PATTERN];

struct State {
    Board board;
    int count;
};

queue<State> q;
set<Board> history;

// I made this function based on one by Haruhiko Okumura(Algorithm 
// Dictionary, p116) and one by M.Hiroi(Puzzle DE Programming).
int change_number(long long board) {
    static int fact_table[N] = {
         40320, 5040, 720, 120, 24, 6, 2, 1, 0      // on N = 8
    };
    int value = 0;
    for (int j = 0; j < N - 1; ++j) {
        int J = static_cast<int>((board >> (j*4) & 0xF));
        value += fact_table[j] * J;
        for (int k = j + 1; k < N; ++k) {
            int K = static_cast<int>((board >> k*4) & 0xF);
            if (J < K) {
                board &= ~(0xFLL << k*4);
                board |= (static_cast<long long>(K - 1) << k*4);
            }
        }
    }
//    printf("[change_number] value = %d\n", value);
    return value;
}

inline void swap(int numpos, int spacepos, Board& board) {
    long long num = (board >> (numpos*4)) & 15;
    board |= num << (spacepos*4);
    board &= ~(15LL << (numpos*4));
}

inline int swap_and_check(int numpos, int spacepos, State s) {
    swap(numpos, spacepos, s.board);
    if (s.board == GOAL) {
        return ++s.count;
    }
    int pos = change_number(s.board);
    if (!frontier[pos]) {
        ++s.count;
        q.push(s);
        frontier[pos] = true;
    }
//    if (history.insert(s.board).second) {
//        ++s.count;
//    }
    return -1;
}

void print(Board b) {
    for (int i = 0; i < N; ++i) {
        printf("%2lld", (b >> (i*4) & 15));
    }
    printf("\n");
}

// OK
int main(void) {

    Board board = 0;
    for (int i = 0, num; i < N; ++i) {
        scanf("%d", &num);
        board |= static_cast<long long>(num) << (i*4);
    }
//    print(GOAL);
//    print(board);

    int count = 0;
    if (board == GOAL) {
        goto END;
    }

    q.push({ board, 0 });
    while (!q.empty()) {
        State s = q.front();
        q.pop();

        int pos = -1;
        while (++pos < N) {
            if (((s.board >> (pos*4)) & 15) == 0) {
                break;
            }
        }

        if (pos < 6) {
            if ((count = swap_and_check(pos + 3, pos, s)) > 0) {
                break;
            }
        }
        if (pos > 2) {
            if ((count = swap_and_check(pos - 3, pos, s)) > 0) {
                break;
            }
        }
        if (pos % 3 < 2) {
            if ((count = swap_and_check(pos + 1, pos, s)) > 0) {
                break;
            }
        }
        if (pos % 3 > 0) {
            if ((count = swap_and_check(pos - 1, pos, s)) > 0) {
                break;
            }
        }
    }

END:
    printf("%d\n", count);

    return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(n), c(m), d(m), ck(m, 0);
    rep(i, n) cin >> a[i] >> b[i];
    rep(i, m) cin >> c[i] >> d[i];

    rep(i, n)
    {
        ll dis = 1001001001001001001;
        int idx;
        rep(j, m)
        {
            ll tmp = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if (dis > tmp && !ck[j])
            {
                dis = tmp;
                idx = j;
            }
        }
        cout << idx + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3616
if __name__ == '__main__':
    n = int(input())
    S = list(map(int, input().split()))
    q = int(input())
    T = list(map(int, input().split()))

    cnt = 0
    for i in T:
        for j in S:
            if i == j:
                cnt += 1
                break

    print(cnt)



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

#include <math.h>
#include <stdlib.h>


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

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string a, b, c; cin >> a >> b >> c;
    if(a.back() == b[0] && b.back() == c[0]) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.*;

public class Main {
    public static void main (String[] args) throws IOException{
        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);

        String str = br.readLine();
        int x = Integer.parseInt(str);

        x = x*x*x;

        System.out.println(x);

    }

}

Measured memory_bytes: 24092
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int a,b,c;
            cin>>a>>b>>c;
            if(a+b+c>=22)
                cout<<"bust"<<endl;
            else
                cout<<"win"<<endl;
        }
        return 0;
    }


Measured memory_bytes: 256
//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
pair<int, int> E[100001];
int H[100001];
int n[100001], kari[100001];
int sagasu(int A) {
	if (n[A] == n[A - 1]) return 0;
	int k = n[A - 1];
	for (int i = H[A]; i; i = E[i].second) {
		kari[k++] = sagasu(E[i].first);
	}
	sort(kari + n[A - 1], kari + n[A], greater<int>());
	int ret = 0;
	for (int i = 0; i < n[A] - n[A - 1]; i++) ret = max(ret, kari[n[A - 1] + i] + i);
	return ret + 1;
}

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


	int N = getint();

	for (int i = 2; i <= N; i++) {
		int a = getint();
		n[a]++;
		E[i] = mp(i, H[a]);
		H[a] = i;
	}
	rep1(i, N) n[i] = n[i - 1] + n[i];

	printf("%d\n", sagasu(1));

	Would you please return 0;
}

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

#define pii pair<int, int>

using namespace std;

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

struct pt {
    int x, y;

    pt(int tx, int ty) : x(tx), y(ty) { };
};

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    pii p1 = make_pair(x1, y1);
    pii p2 = make_pair(x2, y2);
    int delta_y = y2 - y1;
    int delta_x = x2 - x1;
    //cout << delta_x << ' ' << delta_y << endl;
    if (delta_y < 0) {
        if (delta_x < 0) {
            cout << p2.first + abs(delta_y) << ' ' << p2.second - abs(delta_x) << ' ' << p1.first + abs(delta_y) << ' ' << p1.second - abs(delta_x);
            return 0;
        }
        else if (delta_x > 0) {
            cout << p2.first + abs(delta_y) << ' ' << p2.second + abs(delta_x) << ' ' << p1.first + abs(delta_y) << ' ' << p1.second + abs(delta_x);
            return 0;
        }
        else {
            cout << p2.first + abs(delta_y) << ' ' << p2.second + abs(delta_x) << ' ' << p1.first + abs(delta_y) << ' ' << p1.second + abs(delta_x);
            return 0;
        }
    }
    else if(delta_y > 0){
        if (delta_x < 0) {
            cout << p2.first - abs(delta_y) << ' ' << p2.second - abs(delta_x) << ' ' << p1.first - abs(delta_y) << ' ' << p1.second - abs(delta_x);
            return 0;
        }
        else if (delta_x > 0){
            cout << p2.first - abs(delta_y) << ' ' << p2.second + abs(delta_x) << ' ' << p1.first - abs(delta_y) << ' ' << p1.second + abs(delta_x);
        }
        else {
            cout << p2.first - abs(delta_y) << ' ' << p2.second + abs(delta_x) << ' ' << p1.first - abs(delta_y) << ' ' << p1.second + abs(delta_x);
            return 0;
        }
    }
    else {
        if (delta_x < 0) {
            cout << p2.first + abs(delta_y) << ' ' << p2.second - abs(delta_x) << ' ' << p1.first + abs(delta_y) << ' ' << p1.second - abs(delta_x);
            return 0;
        }
        else {
            cout << p2.first + abs(delta_y) << ' ' << p2.second + abs(delta_x) << ' ' << p1.first + abs(delta_y) << ' ' << p1.second + abs(delta_x);
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define MOD 1000000007
#define sp fixed<<setprecision
#define sz sizeof
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
bool pr[1000007];
ll fpow(ll x,ll y){x=x%MOD;ll res=1;while(y){if(y&1)res=res*x;res%=MOD;y=y>>1;x=x*x;x%=MOD;}return res;}
ll inv(ll a,ll m=MOD){ll c=m;ll y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=c;return x;}
const int M=50;
ll tet[M][M];
ll tet1[M][M];
ll n,k;
void multiply(ll a[M][M],ll b[M][M])
{
	ll res[M][M];
	for(int i=0;i<M;i++)
	for(int j=0;j<M;j++)
	{
		res[i][j]=0;
		for(int k=0;k<M;k++)
		{
			res[i][j]+=((a[i][k]%MOD)*(b[k][j]%MOD))%MOD;
			res[i][j]%=MOD;
		}
	}
	for(int i=0;i<M;i++)
	for(int j=0;j<M;j++)
	a[i][j]=res[i][j];
}
ll matpow(ll x[M][M],ll p)
{
	if(p==1)
	{
		ll sum=0;
		for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
		{
			sum+=x[i][j];
			sum%=MOD;
		}
		return sum;
	}
	matpow(x,p/2);
	multiply(x,x);
	if(p&1)
	multiply(x,tet1);
	ll sum=0;
	for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
	{
		sum+=x[i][j];
		sum%=MOD;
	}
	return sum;

}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>k;
	for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
	{
		cin>>tet[i][j];
		tet1[i][j]=tet[i][j];
	}
	cout<<matpow(tet,k)<<"\n";



}


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

int main()
{
    int n, left_number;

    cin >> n;

    left_number = (n % 10);
    
    switch(left_number)
    {
        case 3:
            printf("bon\n");
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            printf("pon\n");
            break;
        default:
            printf("hon\n");
            break;
    }

    return 0;
}

Measured memory_bytes: 3584
while True:
    q = int(input())
    if q == -1:
        break
    x = q / 2
    ep = 0.00001 * q
    
    while True:
        x2 = x * x
        t = x2 * x - q
        if -ep < t < ep:
            break
        x = x - t / (3 * x2)
    print("%.06f" %x)


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

#include <iostream>
#include <algorithm>

#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <utility>
#include <array>
#include <complex>
#include <valarray>

#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>


using namespace std;
#define int long long

typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod
#define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> lists;
    bool checked[300000 + 1] = {};
    rep2(i, 2, 300000 + 1) {
        if (checked[i]) continue;
        if (i % 7 == 1 || i % 7 == 6) {
            lists.push_back(i);
            int k = 1;
            while (i * k <= 300000) {
                checked[i * k] = true;
                k++;
            }
        }
    }
    while (true) {
        int n;
        cin >> n;
        if (n == 1) break;
        vector<int> ans;
        for (auto p : lists) {
            if (n % p == 0) {
                ans.push_back(p);
            }
        }
        cout << n << ':';
        rep(i, ans.size()) {
            cout << " " << ans[i];
        }
        cout << endl;
    }
}

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

struct mint {
    // Preparation: MOD is already defined.
    ll value;

    mint(ll value = 0) : value((value % MOD + MOD) % MOD) {}

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint pow(mint m) const {
        return pow(m.value);
    }

    mint inv() const {
        ll a = value, b = MOD, u = 1, v = 0;
        while (b) {
            ll t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        return u;
    }

    mint &operator+=(const mint a) {
        if ((value += a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((value += MOD - a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator*=(const mint a) {
        (value *= a.value) %= MOD;
        return *this;
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

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

    rep(i, h) {
        rep(j, w) {
            if ((i < b) xor (j < a)) {
                cout << 1;
            } else {
                cout << 0;
            }
        }
        cout << '\n';
    }
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define ff first
#define ss second
#define INF (int)2e9
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int SZ=100005;
int arr[SZ];
int memo[SZ];
int main(void){
	ios::sync_with_stdio(false); cin.tie(NULL);
	int n; cin>>n;
	for(int i=1;i<=n;i++) cin>>arr[i];
	int ans=0;
	for(int i=n-1;i>=1;i--){
		if(arr[i]>=arr[i+1]){
			memo[i]=memo[i+1]+1;
			ans=max(memo[i],ans);
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
n,m=map(int,input().split())
l=[]
r=[]
for i in range(m):
    l1,r1=map(int,input().split())
    l.append(l1)
    r.append(r1)
print(0 if min(r)-max(l)+1<0 else min(r)-max(l)+1)

Measured memory_bytes: 10980
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    int N, K;
    cin >> N >> K;
    int count = 0;
    for (int i = 0; i < N; i++) {
        int h;
        cin >> h;
        if (h >= K) count += 1;
    }
    cout << count << endl;
    
    return 0;
}



Measured memory_bytes: 256
/************************************
	Name: 荆国浩 
	E-mail: 1839714778@qq.com 
************************************/
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <fstream>
#define rep(N) for(int i=0;i<N;i++)
#define ll long long 
#define pii pair<int,int>
#define For(I,N) for(int I=0;I<N;I++)
using namespace std;
int n;
int dist[2][100005];
vector <int> vec[100005];

void bfs(int x,bool the)
{
	bool visit[n]={0};
	queue <pair<int,int> >que;
	que.push(make_pair(x,0));
	while(!que.empty())
	{
		int nx=que.front().first;
		int ns=que.front().second;
		que.pop();
		rep(vec[nx].size())
		{
			if(visit[vec[nx][i]]) continue;
			visit[vec[nx][i]]=true;
			dist[the][vec[nx][i]]=ns+1;
			que.push(make_pair(vec[nx][i],ns+1));
		}
	}
} 

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n;
	int x,y;
	rep(n-1)
	{
		cin>>x>>y;
		vec[--x].push_back(--y);
		vec[y].push_back(x);
	}
	bfs(0,0);
	dist[0][0]=0;
	bfs(n-1,1);
	dist[1][n-1]=0;
	int fen=0,snu=0;
	rep(n)
	{
		if(dist[0][i]<=dist[1][i]) fen++;else snu++; 
	}
	cout<<(snu>=fen?"Snuke":"Fennec")<<endl;
	return 0;
}

Measured memory_bytes: 6852
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 0;
    for(int i = 1; i <= n; i++){
      if(i%2 == 1){
        int count = 0;
        for(int j = 1; j <= n; j++){
          if(i%j == 0){
            count++;
          }
        }
        if(count == 8){
          ans++;
        }
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21716
S = list(input())

check = [0, 0, 0]
for i in range(3):
    if S[i] == 'a':
        check[0] = 1
    if S[i] == 'b':
        check[1] = 1
    if S[i] == 'c':
        check[2] = 1

if sum(check) == 3:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
def kazoe(x, y, mainlist):
    chousa = []
    cnt = 0
    for i, k in [(i, k) for i in range(-1, 2) for k in range(-1, 2)]:
        if len(mainlist) > x + i >= 0 and len(mainlist[x+i]) > y + k >= 0:
            chousa.append((x + i, y + k))
    for i in range(len(chousa)):
        cnt += 1 if mainlist[chousa[i][0]][chousa[i][1]] == "#" else 0
    return str(cnt)
mainlist = []
dstlist = []
x, y = map(int, input().split())
for i in range(x):
    mainlist.append(input())
dstlist = ["" for i in range(len(mainlist))]
for i, strings in enumerate(mainlist):
    for k, char in enumerate(strings):
        dstlist[i] += kazoe(i, k, mainlist) if char == "." else char
for i in dstlist:
    print(i)


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

template <class t>
using vc = vector<t>;
template <class t>
using vvc = vector<vector<t>>;
typedef long long ll;
typedef vc<int> vi;
typedef vvc<int> vvi;
typedef pair<int, int> pi;

#define endl "\n"

#define k first
#define v second
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()

#define ALL(a) a.bg, a.ed

template <class t, class u>
ostream &operator<<(ostream &os, const pair<t, u> &p) {
    return os << "( " << p.k << ", " << p.v << " )";
}

template <class t>
ostream &operator<<(ostream &os, const vc<t> &v) {
    os << "[ ";
    for (int i = 0; i < v.size(); i++) {
        os << v[i];
        if (i != v.size() - 1) {
            os << ", ";
        }
    }
    return os << " ]";
}

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    // cout << fixed << setprecision(18);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution
    int n, t;
    cin >> n >> t;
    ll time_on = 0;
    unsigned long long on_until = 0;
    for (int i = 0; i < n; i++) {
        int ti;
        cin >> ti;
        if (ti < on_until) {
            time_on -= on_until - ti;
        }
        time_on += t;
        on_until = ti + t;
    }
    cout << time_on << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    int year;
    cin >> year;
    if(year == 3 || year == 5 || year == 7) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

int main(){
  int k,n,i,ans=1000000000;
  cin >> n >> k;
  vector<int> h(n);
  for(i=0; i<n; i++){
    cin >> h[i];
  }
  sort(h.begin(), h.end());
  for(i=0; i<n-k+1; i++){
    ans=min(ans, abs(h[i]-h[i+k-1]));
  }
  cout << ans;
}
  

Measured memory_bytes: 640
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    a, b = MAP()
    A = str(a)*b
    B = str(b)*a
    li = [A, B]
    li.sort()
    print(li[0])


if __name__=='__main__':
    main()


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

int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int num=0,C=c,B=b;
    if(b>=c){
        while(b>=C){
            C*=2;
            num++;
        }
    }
    if(num>k){
        cout<<"No"<<endl;
        return 0;
    }
    if(a>=C){
        while(a>=C){
            C*=2;
            num++;
        }
    }
    if(num>k){
        cout<<"No"<<endl;
        return 0;
    }
    if(a>=B){
        while(a>=B){
            B*=2;
            num++;
        }
    }
    if(num>k){
        cout<<"No"<<endl;
        return 0;
    }
    if(B>=C){
        while(B>=C){
            C*=2;
            num++;
        }
    }
    if(num<=k)
    cout<<"Yes"<<endl;    
    else
    cout<<"No"<<endl;
    return 0;
}

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

using namespace std;

int n, m, ans;
vector< pair<int, int> > edges;
int dis[55][55];
int cnt;
bool vis[55];

void dfs(int pos){
  for(int i=1; i<=n; i++){
    if(!vis[i] && dis[pos][i] != 0){
      vis[i] = true;
      dfs(i);
    }
  }
}

bool isSpecial(pair<int, int> e){
  dis[e.first][e.second] = 0;
  dis[e.second][e.first] = 0;
  cnt = 0;
  memset(vis, false, sizeof(vis));
  for(int i=1; i<=n; i++){
    if(!vis[i]){
      dfs(i);
      cnt++;
    }
  }
  dis[e.first][e.second] = 1;
  dis[e.second][e.first] = 1;
  if(cnt == 1)
    return false;
  else
    return true;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for(int i=0; i<m; i++){
    int x, y;
    cin >> x >> y;
    edges.push_back({x, y});
    dis[x][y] = 1;
    dis[y][x] = 1;
  }
  for(auto x : edges){
    if(isSpecial(x)){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import qualified Data.Map.Strict as M
import qualified Data.Vector.Unboxed as VU

getInts :: IO[Int]
getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

cnt::Int->Int->Int->Int->(Int,Int,Int)
cnt k a b c | mod k 4 == 0 = (a+1,b,c)
            | mod k 2 == 0 = (a,b+1,c)
            | otherwise = (a,b,c+1)


solve::Int->Int->Int->String
solve a b c | b > 0 && a >= c = "Yes"
            | b == 0 && a >= c -1  = "Yes"
            | otherwise = "No"

main = do
  getLine
  an <- getInts
  let (a4,a2,a1) = VU.foldl (\(a,b,c) x-> cnt x a b c) (0,0,0) $ VU.fromList an
  putStrLn $ solve a4 a2 a1

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
    int l;
    cin >> l;
    vector<int> ana;
    int check;
    int ind = 1001;
    if (l == 1) {
        cin >> check;
        if (check < 0) {
            cout << 1 << endl;
            return 0;
        }
        else {
            cout << "OK" << endl;
            return 0;
        }
    }
    for (int i = 0; i < l; i++) {
        cin >> check;
        if (check < 0) {
            if (ana.back() == abs(check)) {
                ana.pop_back();
            }
            else {
                ind = i;
                break;
            }
        }
        else {
            auto itr = std::find(ana.begin(), ana.end(), check);    //  最初の要素5へのイテレータを返す
            if( itr != ana.end() ) {     // 発見した場合
                ind = i;
                break;
            }
            else {
                ana.push_back(check);
            }
        }
    }
    if (ind == 1001) {
        cout << "OK" << endl;
    }
    else {
        cout << ind+1 << endl;
    }
}


Measured memory_bytes: 3152
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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 main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    rep(i,n){
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }
    int ans = 1e9;
    rep(S,(1<<n)){
        int score = 0;
        vector<int> alg(m, 0);
        rep(j,n){
            if(S>>j & 1){
                score += c[j];
                rep(k,m){
                    alg[k] += a[j][k];
                }
            }
        }
        bool ok = true;
        rep(k,m){
            if(alg[k] < x) ok = false;
        }
        if(ok) chmin(ans, score);
    }
    if(ans == 1e9) ans = -1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef pair<string, int> Ps;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int n, cost;
	cin >> n >> cost;
	queue<Ps> que;
	rep(i, n){
		string s;
		int ms;
		cin >> s >> ms;
		que.push(Ps(s, ms));
	}
	int now_time = 0;
	while(!que.empty()){
		Ps p = que.front();que.pop();
		p.second -= cost;
		if(p.second <= 0){
			cout << p.first << " " << now_time + cost + p.second << endl;
			now_time += p.second;
		}else{
			que.push(p);
		}
		now_time += cost;
	}

	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

Measured memory_bytes: 4408
S = input()
N = len(S)
c1 = c2 = 0
for i in range(N):
    if (S[i] == '0') ^ (i % 2):
        c1 += 1
    elif (S[i] == '1') ^ (i % 2):
        c2 += 1
print(min([c1, c2]))


Measured memory_bytes: 3188
#include <bits/stdc++.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++)


int main(void)
{
    int n,count=0;
    long tmpx,tmpy,d,t;
    cin >> n;
    cin >> d;
    vector<long> x,y;

    rep(i,n){
        cin >> tmpx >> tmpy;
        if(tmpx<0){
            tmpx=-tmpx;
        }
        if(tmpy<0){
            tmpy=-tmpy;
        }
        x.push_back(tmpx);
        y.push_back(tmpy);
    }
    rep(i,n){
        t=d*d;
        t-=(x.at(i))*(x.at(i));
        if(t<0){
            continue;
        }
        t-=(y.at(i))*(y.at(i));
        if(t<0){
            continue;
        }
        count+=1;
    }

    cout << count << endl;
    return 0;
}

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

int main()
{
	LL N, x;
	in >> N >> x;
	std::vector<LL>a(N);
	rep(i, N) in >> a[i];

	LL sum = 0;
	rep(i, N) sum += a[i];

	LL ans;
	if (x > sum) ans = N - 1;
	else
	{
		std::sort(a.begin(), a.end());
		ans = 0;
		rep(i, N)
		{
			if (a[i] <= x)
			{
				x -= a[i];
				++ans;
			}
			else break;
		}
	}

	out << ans << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int N;
    cin >> N;
    cout << N * N * N << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
#include <vector>
#include <stdio.h>
#include <iomanip>
using namespace std;

const int NMAX = 310;
double expected[NMAX][NMAX][NMAX];

int main()
{
    int n;
    cin >> n;
    int nr1 = 0, nr2 = 0, nr3 = 0;

    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        nr1 += (x == 1);
        nr2 += (x == 2);
        nr3 += (x == 3);
    }

    for (int v3 = 0; v3 <= n; v3++) {
        for (int v2 = 0; v2 + v3 <= n; v2++) {
            for (int v1 = 0; v1 + v2 + v3 <= n; v1++) {
                if (v1 + v2 + v3 == 0)
                    continue;
                double e = 0;
                if (v1)
                    e += expected[v1 - 1][v2][v3] * v1;
                if (v2)
                    e += expected[v1 + 1][v2 - 1][v3] * v2;
                if (v3)
                    e += expected[v1][v2 + 1][v3 - 1] * v3;
                e += n;
                e /= v1 + v2 + v3;
                expected[v1][v2][v3] = e;
            }
        }
    }
/*
    n * E = n + v1 * q1 + v2 * q2 + v3 * q3 + (n - v1 - v2 - v3) * E
    E (v1 + v2 + v3) = ...
    E = e / (1 - q)
*/

    cout << setprecision(9) << fixed << expected[nr1][nr2][nr3] << '\n';

    return 0;
}


Measured memory_bytes: 225536
#include<bits/stdc++.h>
using namespace std;
int main(){
  long q,h,s,d,n;
  cin >> q >> h >> s >> d;
  cin >> n;
  long ans = 0;
  if(n%2==0){
    ans = min(8*q,min(4*h,min(2*s,d))) * (n/2);
  }else{
    ans = ans = min(8*q,min(4*h,min(2*s,d))) * (n/2);
    ans += min(4*q,min(2*h,s));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))//数组(结构体)清零 
#define ll long long
//int A(int a,int b){if(a<b||a<1||b<0)return 0;int k=1;while(b--){k*=a--;}return k;}//数学中的Aab,传递ab,返回Cab//类型为int//如果不符合条件则返回0 
//int C(int a,int b){if(a<b||a<1||b<0)return 0;b=min(a-b,b);int k=A(a,b),t=1;while(--b)k/=++t;return k;}//数学中的Cab,传递ab,返回Cab//类型为int//如果不符合条件则返回0 
//int HW(char*HWa,int HWl,int HWr){if(HWr<HWl)swap(HWl,HWr);for(int i=0;i<(HWr-HWl)/2+1;i++)if(HWa[HWl+i]!=HWa[HWr-i])return 0;return 1;}//传递字符串名,判断区间l r,如果是回文字符串就返回1,否则返回0 
//int SS(int a){if(a>4&&((a-1)%6)&&((a+1)%6))return 0;for(int i=2;i<=sqrt(a);i++)if(a%i==0)return 0;return 1;}//判断一个数是不是质数，是1 否0；请确保a>1; 
/*记得如果改int为long long,就把printf与scanf中相应的%d也改成%lld*/

int main()
{
	int a,b;
	cin>>a>>b;
	cout<<a*b<<' '<<a+a+b+b<<endl;
	return 0;
}


Measured memory_bytes: 3080
#include <stdio.h>
int main() {
	unsigned i, j, l, r, s = 2e9;
	scanf("%u%u", &l, &r);
	for (i = l; i <= r; i++){
		if (i % 673 == 0) {
			s = 0;
			break;
		}
	}
	for (i = l % 2019; i <= r % 2019; i++)for(j = i+1; j <= r % 2019 ; j++){
		if ((i * j) % 2019 < s) s = (i * j) % 2019;
	}
	printf("%u", s);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int X,Y,Z,a;
  cin>>X>>Y>>Z;
  for(int i=0;i<50000;i++){
    if(i*Y+(i+1)*Z<=X&&(i+1)*Y+(i+2)*Z>X){cout<<i<<endl;exit(0);
  }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int>v;
int main()
{
    int n,k;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        v.push_back(s[i]);
    }
    for(int i=0;i<s.size();i++)
    {
        k=v[i]+n;

        if(k<=90)
        {
            cout<<char(k);
        }else
        {
            cout<<char(k-26);
        }
    }
    return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
 
long long int INF = 2e18;
const ll fact_table = 1200008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←

#define endl "\n"
#ifdef ENJAPMA
    #undef endl
#endif
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
 
const ll mod = 998244353ll;
// const ll mod = 1000000007ll;
  
ll mypow(ll number1,ll number2, ll mod){
    if(number2 == 0){
        return 1ll;
    }else{
        ll number3 = mypow(number1,number2 / 2, mod);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
bool multicase = false;

ll n,m,num,a,b,c,d,e,h,q;
ll x[100], y[100], z[100], w[100];

void solve(){
    cin >> a >> b >> n;
    ll k;
    if(n >= b){
        k = b - 1;
    }else{
        k = n;
    }
    ll ans = k * a / b;
    p(ans);
    return;
}


int main(){
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if(multicase){
        cin >> q;
    }else{
        q = 1; 
    }
    while(q--){
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}
















Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <set>
#include <map>
#include <cassert>
#include <unordered_map>
#include <unordered_set>

using namespace std;

using ll = long long;
using ldb = long double;

#define forn(i, x, n) for (int i = x; i < (int)(n); ++i)
#define forcin(a, n) for (int i = 0; i < n; cin >> a[i], ++i)
#define forb(i, x, n) for (int i = (int)(x); i >= n; --i)
#define mmax(a, b, c) max(a, max(b, c))
#define mmin(a, b, c) min(a, min(b, c))
#define pb push_back
#define mp make_pair

const int N = 100500;

int d[N][2];
int a[N][2];

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

    for (int j = 0; j < 2; ++j) {
        forn(i, 0, n) {
            cin >> a[i][j];
        }
    }

    d[0][0] = a[0][0];

    for (int j = 0; j < 2; ++j) {
        forn(i, 0, n) {
            if (i > 0 && j > 0) {
                d[i][j] = max(d[i - 1][j], d[i][j - 1]) + a[i][j];
            } else if (i > 0) {
                d[i][j] = d[i - 1][j] + a[i][j];
            } else if (j > 0) {
                d[i][j] = d[i][j - 1] + a[i][j];
            }
        }
    }

    cout << d[n - 1][1];

}

Measured memory_bytes: 256
import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        int a = sc.nextInt();
        int b = sc.nextInt();

        switch (a+b) {
            case 3:
                System.out.println(3);
                break;
            case 4:
                System.out.println(2);
                break;
            case 5:
                System.out.println(1);
                break;
        }
    }
}


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

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

int main(){
    int a, b, c, d; cin >> a >> b >> c >> d;
    int turn = 1;
    int stop = 0;
    while(stop == 0){
        if(turn%2 != 0) c = c - b;
        else a = a - d;

        if(a <= 0){
            cout << "No" << endl;
            stop = 1;
        }
        else if(c <= 0){
            cout << "Yes" << endl;
            stop = 1;
        }
        
        turn++;
    }
}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)

typedef long long ll;

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


int main() {
    double n,k;
    cin>>n>>k;

    vector<double>p(n),s(n),ss(n);
    rep(i,n){
        cin>>p[i];
        s[i]=(1+p[i])/2.0;
    }

    ss[0]=s[0];
    rep2(i,1,n)ss[i]=ss[i-1]+s[i];


    double ans=ss[k-1];

    rep(i,n-k+1){
        ans=max(ans,ss[k+i]-ss[i]);
    }

    cout<<fixed<<setprecision(12)<<ans<<endl;
}


Measured memory_bytes: 4992
import itertools,copy
N = int(input())
a = list(map(int,input().split()))

def judge(array):
  for i in range(len(array)-1):
    if array[i] < array[i+1]:
      continue
    else:
      return False
  return True

def swap(i,j,array):
  arr = copy.copy(array)
  tmp = arr[i]
  arr[i] = arr[j]
  arr[j] = tmp
  return arr

ans = False
asc = judge(a)
if asc:
  ans = True
for (i,j) in itertools.combinations(range(N),2):
  arr = swap(i,j,a)
  asc = judge(arr)
  if asc: 
    ans = True
if ans:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 3568
import sys
read_=sys.stdin.buffer.readline

N=int(read_())
A=[list(map(int,read_().split())) for _ in range(2)]

D=[[0]*N for _ in range(2)]

D[0][0]=A[0][0]
D[1][0]=A[0][0]+A[1][0]

for i in range(2):
    if i==0:
        for j in range(1,N):
            D[i][j]=D[i][j-1]+A[i][j]
        continue
    for j in range(1,N):
        D[i][j]=max(D[i][j-1],D[i-1][j])+A[i][j]

print(D[1][N-1])

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
A = int(input())
B = int(input())
C = int(input())
X = int(input())

_500 = 500
_100 = 100
_50 = 50

count = 0

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if X - (a*_500 + b*_100 + c*_50) == 0:
                count = count + 1

print(count)


Measured memory_bytes: 3060