akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10 ** 6)

def main():
    L, R = map(int, sys.stdin.readline().rstrip().split())

    if (R // 2019) > (L // 2019):
        print(0)
        exit()

    L %= 2019
    R %= 2019
    ans = 2019
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ans = min(ans, (i*j) % 2019)
    
    print(ans)


if __name__ == '__main__':
    main()

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

int main() {
  int a, b,c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  int i = 0;
  i = e - a;
  if(i <= k) {
    cout << "Yay!" << endl;
  }
  else {
    cout << ":(" << endl;
  }
}


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

int main(){
	
	int i,length,MAX,s,t;
	char X[200001];

	cin >> X;

	for(i=0;X[i]!='\0';i++){}
	MAX = i;
	length = MAX;
	
	for(i=0;i<MAX;i++){
		if(X[i]=='S'){s++;}
		else if(X[i]=='T' && s>0){s--;length -= 2;}
	}

	cout << length << endl;

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#undef int
#define mk make_pair
#define pb push_back
typedef pair<int, int> pii;
const int mod = 1000000007;
const int INF = 1000000009;
const long long INFL = 1000000000000000018ll;

string s;
int D, N;
int dp[11000][110][2];

int dfs(int k = -1, int sum = 0, bool flag = false)
{
    int mem;
    if(flag)mem = 1;
    else mem = 0;
    if(k == -1){
        int res = 0;
        for(int i = 0; i <= s[k + 1] - '0'; i++){
            res += dfs(k + 1, (sum + i) % D, i == s[k + 1] - '0');
            res %= mod;
        }
        return res % mod;
    }
    if(~dp[k][sum][mem]){
        return dp[k][sum][mem] % mod;
    }
    if(k == N - 1){
        if(sum % D == 0){
            //printf("%lld %lld %lld\n", k, sum, mem);
            return dp[k][sum][mem] = 1;
        }
        else {
            return dp[k][sum][mem] = 0;
        }
    }
    if(flag){
        int res = 0;
        for(int i = 0; i <= s[k + 1] - '0'; i++){
            res += dfs(k + 1, (sum + i) % D, i == s[k + 1] - '0');
            res %= mod;
        }
        return dp[k][sum][mem] = res % mod;
    }
    else {
        int res = 0;
        for(int i = 0; i <= 9; i++){
            res += dfs(k + 1, (sum + i) % D, false);
            res %= mod;
        }
        return dp[k][sum][mem] = res % mod;
    }
}

signed main()
{
    cin >> s;
    cin >> D;
    N = s.size();
    memset(dp, -1, sizeof(dp));

    cout << (dfs() - 1 + mod) % mod << endl;

    return 0;
}
/*



*/




Measured memory_bytes: 19968
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a <= 9 && b <= 9) {
			System.out.println(a*b);
		}
		else {
			System.out.println(-1);
		}
	}
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

#define all(x) x.begin(),x.end()
#define halt(...) {fo << (__VA_ARGS__) << '\n';exit(0);}
#define db(n) cerr << #n << " = " << n << '\n'

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int n;
	cin>>n;
	vector<int> v(2*n);
	
	for (int i=0; i<2*n; i++)	cin>>v[i];
	sort(v.begin(),v.end());
	
	int ans = 0;
	for (int i=0; i<2*n; i+=2)
		ans+=v[i];
		
	cout<<ans;


	return 0;
}


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

int main() {
	int a, p = 0;
	cin >> a;
	for (int i = 1; i <= a; i+=2) {
		int o = 0;
		for (int j = 1; j <= i; j++) {
			if (i % j == 0)o++;
		}
		if (o == 8)p++;
	}
	cout << p << endl;
	return 0;
}

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

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, b, e) for (i64 i = (b); i <= (e); ++i)
#define repr(i, b, e) for (i64 i = (b); i >= (e); --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
  cin >> head;
  input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? " " : "");
  outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? "\n" : "");
  outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
  cout << head;
  outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
  return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
  return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

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

  var(string, s);

  if (s == "Sunny") outl("Cloudy");
  else if (s == "Cloudy") outl("Rainy");
  else outl("Sunny");

  return 0;
}


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

using namespace std;

int main()
{
	int X, Y;
	cin >> X >> Y;

	int ans = 0;

	ans += max(0, 300000 - (X - 1) * 100000);
	ans += max(0, 300000 - (Y - 1) * 100000);
	if (X == 1 && Y == 1) {
		ans += 400000;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  
  int n;
  string s;
  cin >> n >> s;
  
  char a,b,c;
  int count=0;
  for(int i=0; i<n-2; i++){
    a=s[i],b=s[i+1],c=s[i+2];
    
  	if(a=='A'&&b=='B'&&c=='C') count++;
  }
  
  cout << count << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    int ans = 1;
    int t = 0;
    for (int i = 2; i <= N; i++) {
        int time = 0;
        int n = i;
        while (n % 2 == 0) {
            time++;
            n /= 2;
        }
        if (chmax(t, time)) {
            ans = i;
        }
    }
    cout << ans << endl;
}


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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;


string s;
ll N = 0;
ll ret = 0;

void input() {
  IN(s);
}

void solve() {
  ll max = 0;
  ll count = 0;
  REP(i, s.size()) {
    char c = s[i];
    if (c == 'A' || c == 'T' || c == 'G' || c == 'C') {
      count++;
    } else {
      count = 0;
    }
    if (count > max) {
      max = count;
    }
  }
  ret = max;
}

int main(void){
  input();
  solve();
  PRINT(ret);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int cards_to_pick=d;
    int sum=0;
    if(cards_to_pick>0)
    {
        if(cards_to_pick>a)
        {
            sum+=a;
            cards_to_pick-=a;
        }
        else if(cards_to_pick<a)
        {
            sum+=cards_to_pick;
            cards_to_pick=0;
        }
        else{
            sum+=cards_to_pick;
            cards_to_pick=0;
        }
    }
    if(cards_to_pick>0)
    {
        if(cards_to_pick>b)
        {
            cards_to_pick-=b;
        }
        else if(cards_to_pick<b)
        {
            //sum+=cards_to_pick;
            cards_to_pick=0;
        }
        else{
           // sum+=cards_to_pick;
            cards_to_pick=0;
        }
    }
    if(cards_to_pick>0)
    {
        if(cards_to_pick>c)
        {
            sum+=-c;
            cards_to_pick-=c;
        }
        else if(cards_to_pick<c)
        {
            sum+=cards_to_pick*(-1);
            cards_to_pick=0;
        }
        else{
            sum+=cards_to_pick*(-1);
            cards_to_pick=0;
        }
    }
    cout<<sum;
    
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
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;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

int main() {
    cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(20);

    ll a;
    cin >> a;
    cout << a + a*a + a*a*a << endl;
}


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


using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;




ll pow_mod(ll n, ll k, ll m) {
	ll r = 1;
	for (; k > 0; k >>= 1) {
		if (k & 1)r = (r*n) % m;
		n = (n*n) % m;
	}
	return r;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}



int main() {
	COMinit();

	ll n, k;
	cin >> n >> k;

	vector<ll> v(n);
	REP(i, n)cin >> v[i];
	sort(ALL(v));

	if (k == 1||k==n) {
		cout << 0 << endl;
		return 0;
	}


	vector<ll> a(n);
	vector<ll> b(n);

	REP(i, n) {
		a[i] = COM(n - i - 1, k - 1);
		b[i] = a[i];
	}
	reverse(ALL(b));

	ll ans = 0;

	REP(i, n) {
		ll t = b[i] - a[i];
		t += mod;
		t %= mod;
		t *= v[i];
		t %= mod;
		ans += t;
		ans += mod;
		ans %= mod;
	}

	cout << ans << endl;


}

Measured memory_bytes: 14592
#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
#define int long long
int A[100010];
pair<int, int> P[100010];
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M; cin >> N >> M;
    rep(i, N) {
        cin >> A[i];
    }
    sort(A, A + N);
    rep(i, M) {
        cin >> P[i].second >> P[i].first;
    }
    sort(P, P + M, greater<pair<int, int>>());
    int s = 0;
    rep(i, N) {
        if (A[i] < P[s].first) {
            A[i] = P[s].first;
            P[s].second--;
        }
        while (P[s].second == 0) {
            s++;
            if (s == M) break;
        }
        if (s == M) break;
    }
    int sum = 0;
    rep(i, N) {
        sum += A[i];
    }
    //rep(i, N) cout << A[i] << " ";
    //cout << endl;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

int ans=0;
string s,t;

int main(){
	while(cin>>s){
		t=s;
		reverse(s.begin(),s.end());
		if(s==t)ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 0
// at_abc139d.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;

int main()
{
    long long temp;cin >> temp;
    cout << temp * (temp - 1) / 2 << "\n";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


Measured memory_bytes: 256
s=list(input()) ;k=int(input()) ;n=len(s)
ss=s*2
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict #すべてのkeyが用意されてる defaultdict(int)で初期化
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal as D  #変換後の末尾桁を0や0.01で指定
  #Decimal((str(0.5)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
from fractions import Fraction as F  #F(a,b)で正確なa/b
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########


if n==1:
    print(k//2);exit()

def qq(s,n):
    ans=0
    if n==2:
        if s[0]==s[1]:return 1
        return 0
    nows=s[0];now=1
    for i in range(1,n):
        if s[i]==nows:
            now+=1
        else:
            ans+= now//2
            now=1 ;nows=s[i]
    else:
        ans+=now//2
    return ans 

if len(Counter(s))==1:
    print((n*k)//2)
    exit()
if s[0]!=s[-1]:
    print(qq(s,n)*k)
    exit()
st=1; go=1
for i in range(1,n):
    if s[i]==s[0]:
        st+=1
    else:
        break
for i  in range(-2,-n-1,-1):
    if s[i]==s[-1]:
        go+=1
    else:break
print(qq(s,n)*k - (st//2+go//2-(st+go)//2)*(k-1))


Measured memory_bytes: 77324
"""
int(input())
map(int,input().split())
list(map(int,input().split()))

"""

x=int(input())
ans="No"
for  i  in range(1,10):
    for j in range(1,10):
        # print(i,j,x)
        if((i*j)==x):
            ans="Yes"
print(ans)

Measured memory_bytes: 3060
import math

s = input()
i = int(input())

isR = False
head = []
tail = []

for _ in range(i):
    q = input().split(" ")

    if q[0] == "1":
        isR = not isR
    else:
        if isR:
            if q[1] == "1":
                tail.append(q[2])
            else:
                head.append(q[2])
        else:
            if q[1] == "1":
                head.append(q[2])
            else:
                tail.append(q[2])

ans = "".join(head[::-1]) + s + "".join(tail)

if isR:
    print(ans[::-1])
else:
    print(ans)

Measured memory_bytes: 6244
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws FileNotFoundException {

//    	File file = new File("src/in.txt");
//    	Scanner sc = new Scanner(file);

    	Scanner sc = new Scanner(System.in);

    	String S = sc.next();

    	if(S.equals("AAA")||S.equals("BBB")) {
    		System.out.println("No");
    	} else {
    		System.out.println("Yes");
    	}
    }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;//×Ô¶¯È¡Ä£2^64 
const double pi=acos(-1.0);
const int mod = 1e9+7; // 998244353;
const int inf = 0x7fffffff;//2^31-1	
const ll INF = 0x7fffffffffffffff;
const int dx[]={-1,0,1,0},dy[]={0,1,0,-1};
//double begin_time=clock();    double end_time=clock();printf("time= %f ms\n",end_time-begin_time);
//bool operator < (const mmp &a) const{return x<a.x||x==a.x&&y<a.y;}       //map<int,map<int,int> >z;
//map<int,int>::iterator it;for(it=z.begin();it!=z.end();it++)printf("%d %d\n",it->first,it->second);
//ll pow(ll a,ll b){ll s=1;while(b){if(b&1){s=(s*a)%mod;b--;}b/=2;a=a*a%mod;}return s;}  //¿ìËÙÃÝÈ¡Ä£ 
//lower_bound(begin,end,num); µÚÒ»¸ö>=numµÄÊý×Ö upper_bound(begin,end,num); µÚÒ»¸ö>numµÄÊý×Ö,·µ»ØµØÖ·
//freopen("input.in","r",stdin);     freopen("output.out","w",stdout);      //ÎÄ¼þ¶ÁÐ´Ìá½» 
//reverse(s.begin(),s.end());   //·­×ª×Ö·û´® ||        floor(); ÏòÏÂÈ¡Õû  ceil(); ÏòÉÏÈ¡Õû
//x&(x-1)==0 //ÊÇ2µÄN´Î·½||         x%9 //x¸÷¸öÎ»µÄºÍ||           log10(x)+1   //xµÄÎ»Êý|| 
//ÊýÖáÉÏµÄn¸öµãÒÆ¶¯µ½Í¬Ò»Î»ÖÃ£¬ÒÆ¶¯µ½¸Ã×éÊý×ÖµÄÖÐÎ»ÊýµÄ×Ü¾àÀë×î¶Ì


int main()
{
	int a,b,c,d,e,f,T;
	//scanf("%d",&T);
	//while(T--)
	{
		char z[500];
		scanf("%d%s",&a,z);
		if(strlen(z)<=a)printf("%s\n",z);
		else
		{
			for(int i=0;i<a;i++)printf("%c",z[i]);
			printf("...\n");
		}
		
	}
	
}





Measured memory_bytes: 3712
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int main(int argc, const char *argv[])
{
    int a, b, c;
    cin >> a >> b >> c;

    vector<int> vec{a, b, c};
    sort(vec.begin(), vec.end());

    if (vec[0] == 5 && vec[1] == 5 && vec[2] == 7)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 888
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
typedef long long ll;
int main(){
    int N,A,B;
    string S;
    cin >> N >> A >> B >> S;
    int counter = 0;
    int bcounter = 0;
    REP(i,N){
        if(S[i] == 'a' && counter < A+B){
            cout << "Yes" << endl;
            counter++;
        }
        else if(S[i] == 'b' && counter < A+B && bcounter < B){
            cout << "Yes" << endl;
            counter++;
            bcounter++;
        }
        else{
            cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)

int main(){
	string s,d,n;
	int h,a,b;
	cin >> s >> h;
	for(int i = 0; i < h; i++){
		cin >> d >> a >> b;
		if(d[2] == 'i'){
			cout << s.substr(a,b - a + 1) << endl;
		}
		else if(d[2] == 'v'){
			reverse(s.begin() + a, s.begin() + b + 1);
		}
		else{
			cin >> n;
			s.replace(a,b - a + 1,n);
		}
	}
	return 0;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> D(k);
  vector<int> m(10);
  for (int i = 0; i < k; i++) {
    cin >> D[i];
    m[D[i]] = 1;
  }
  for (int i = 0; i <= 99999; i++) {
    int z  = i;
    bool r = false;
    while (z) {
      if (m[z % 10] == 1) {
        r = true;
        break;
      }
      z /= 10;
    }
    if (r) continue;
    if (i >= n) {
      cout << i << endl;
      return 0;
    }
  }
  cout << 0 << endl;
}

Measured memory_bytes: 256
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<ll> > mat;

int main()
{
  int ans = 0;
  int numB = 0;
  int numA = 0;
  bool check = false;
  int n;
  cin >> n;
  string s;
  bool headB, tailA;
  for (int i = 0; i < n; i++)
  {
    cin >> s;
    int size = s.size();
    for (int j = 0; j < size - 1; j++)
    {
      if (s[j] == 'A' && s[j + 1] == 'B')
      {
        ans++;
      }
    }
    headB = (s[0] == 'B' ? true : false);
    if (s[0] == 'B')
    {
      numB++;
    }
    tailA = (s[size - 1] == 'A' ? true : false);
    if (s[size - 1] == 'A')
    {
      numA++;
    }
    if (headB != tailA)
    {
      check = true;
    }
  }
  cout << (check ? ans + min(numB, numA) : ans + max(min(numB, numA) - 1, 0)) << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>

using namespace std;
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; }

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

const ll INF = 1LL << 60;
const ll MOD = 1000000007;



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

	ll A, B, C;
	cin >> A >> B >> C;

	ll ans = min(B / A, C);

	cout << ans << endl;

	//system("pause");
}

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

class Main {

    // Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        String S;
        S = sc.next();
        String T;
        T = sc.next();
        solve(S, T);
    }

    static void solve(String S, String T){
        int ans = 0;
        for (int i = 0; i < S.length(); ++i) {
            if (S.charAt(i) == T.charAt(i)) ans++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
let rev_iter (f : int -> unit) (a : int array) =
  for i = Array.length a - 1 downto 0 do
    f a.(i)
  done

let counting_sort a b k =
  let c = Array.make (k + 1) 0 in
  Array.iter (fun e -> c.(e) <- c.(e) + 1) a;
  Array.iteri (fun i _ -> if i <> 0 then c.(i) <- c.(i) + c.(i-1)) c;
  rev_iter (fun e -> b.(c.(e)-1) <- e; c.(e) <- c.(e) - 1) a

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun e -> e)) in
  let b = Array.make n 0 in
  counting_sort a b 10000;
  Array.iteri (fun i e -> Printf.printf (if i <> 0 then " %d" else "%d") e) b;
  print_newline ()

Measured memory_bytes: 36128
N, M = map(int, input().split())
d = (N-1)//2
ans = []

while d>0:
    if len(ans)==0:
        ans.append((0, d))
    else:
        a, b = ans[-1]
        ans.append((a+1, b-1))
    
    if len(ans)==M:
        for a, b in ans:
            print(a+1, b+1)
        exit()
        
    d -= 2

d = (N-1)//2
ans.append((d+1, d+1+(d-1)))

if len(ans)==M:
    for a, b in ans:
        print(a+1, b+1)
    exit()

while True:
    a, b = ans[-1]
    ans.append((a+1, b-1))
    
    if len(ans)==M:
        for a, b in ans:
            print(a+1, b+1)
        exit()

Measured memory_bytes: 73804
n = gets.to_i
ind = Array.new(n)
max = 0

for k in 0..n-1 do
    ind[gets.to_i-1] = k
end
size = 1
for j in 0..n-2 do
    if ind[j] < ind[j+1]
        size += 1
    elsif size > max
    max = size
    size = 1
    else
    size = 1
    end
end

puts n - [max,size].max

Measured memory_bytes: 3580
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H,K;
	string s,t;
	while(cin>>s>>t) {
		ll ans=t.substr(0, s.size())==s;
		cout<<YN(ans)<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3036
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){

	int N;
	cin>>N;
	
	vector<int> numbers(N);
	
	REP(i,N){
		cin>>numbers[i];
	}
	
	int count = 0;

	for(int i = 1; i < N - 1 ; i++){

		int pim = numbers[i-1];
		int pi = numbers[i];
		int pip = numbers[i+1];

		if( (pim < pi &&  pi < pip )|| ( pim > pi && pi > pip)){
			count++;
		}
	}

	cout<<count<<endl;
	return 0;

}



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

typedef long long ll;
typedef vector<int> vi;

const double PI=acos(-1.0);

int a,b;
void input()
{
    cin>>a>>b;
}

void solve()
{
    cout<<a*b<<endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

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

int main(){
    int x, y, z;
    
    while(1){
        cin >> x >> y;
        if(x==0 && y==0){break;}
        if(x>y){
            z=x;
            x=y;
            y=z;
        }
        cout << x << " " << y <<endl;
    }
    return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

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

    int N, K;
    cin >> N >> K;

    int ans = 1;
    REP(i, N) {
        int cand1 = ans * 2;
        int cand2 = ans + K;
        ans = min(cand1, cand2);
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; long long x; cin >> n >> x;
  vector<long long> b(n), l(n), u(n); REP(i, n) cin >> b[i] >> l[i] >> u[i];
  vector<int> idx(n);
  iota(ALL(idx), 0);
  sort(ALL(idx), [&](int p, int q) {
    long long lhs = b[p] * l[p] + (x - b[p]) * u[p];
    long long rhs = b[q] * l[q] + (x - b[q]) * u[q];
    return lhs > rhs;
  });
  vector<long long> cum_u(n + 1, 0);
  long long lb = -1, ub = 0, sum = 0;
  REP(i, n) {
    int p = idx[i];
    ub += b[p];
    cum_u[i + 1] = b[p] * l[p] + (x - b[p]) * u[p];
    cum_u[i + 1] += cum_u[i];
    sum += b[p] * l[p];
  }
  while (ub - lb > 1) {
    long long mid = (ub + lb) / 2;
    int manten = mid / x, amari = mid % x;
    bool ok = false;
    REP(i, manten) {
      long long tmp = sum - cum_u[min(manten + 1, n)];
      int p = idx[i];
      tmp += b[p] * l[p] + (x - b[p]) * u[p];
      if (amari <= b[p]) tmp -= amari * l[p];
      else tmp -= b[p] * l[p] + (amari - b[p]) * u[p];
      if (tmp <= 0) ok = true;
    }
    FOR(i, manten, n) {
      long long tmp = sum - cum_u[manten];
      int p = idx[i];
      if (amari <= b[p]) tmp -= amari * l[p];
      else tmp -= b[p] * l[p] + (amari - b[p]) * u[p];
      if (tmp <= 0) ok = true;
    }
    (ok ? ub : lb) = mid;
  }
  cout << ub << '\n';
  return 0;
}


Measured memory_bytes: 3840
a, b = [ int(v) for v in input().split() ]
big = [1,3,5,7,8,10,12]
small = [4,6,9,11]
ans = "Yes"
if a == 2 or b ==2:
  ans = "No"
elif a in big and b in small:
  ans = "No"
elif b in big and a in small:
  ans = "No"
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct Node{
    int key;
    struct Node *next;
    struct Node *pref;
};
struct Node *head;
struct Node *lastNode;


void MakeHead(){
    head = malloc(sizeof(struct Node));
    head->key = 0;
    head->next = NULL;
    head->pref = NULL;
    lastNode = head;
}


void Insert(int num){
    struct Node *node;

    node = malloc(sizeof(struct Node));
    node->key = num;
    if(head->next == NULL){
        lastNode = node;
    }

    node->next = head->next;
    node->pref = head;
    if(head->next!=NULL)head->next->pref = node;
    head->next = node;
}


void Delete(int num){
    struct Node *i;

    for(i=head->next; i!=NULL; i=i->next){
        if(num == i->key){
            if(i->next != NULL){
                i->pref->next = i->next;
                i->next->pref = i->pref;
            }else{
                lastNode = i->pref;
                i->pref->next = NULL;
            }
            free(i);
            break;
        }
    }
}


void DeleteFirst(){
    if(head->next==NULL)return;
    if(head->next == lastNode){
        free(head->next);
        head->next = NULL;
        lastNode = head;
    }else{
        head->next = head->next->next;
        free(head->next->pref);
        head->next->pref = head;
    }
}


void DeleteLast(){
    if(lastNode == head)return;
    lastNode = lastNode->pref;
    lastNode->next = NULL;
    free(lastNode->next);
}

void OutputList(){
    struct Node *i;

    for(i=head; i->next!=NULL; i=i->next){
        printf("%d",i->next->key);
        if(i->next->next!=NULL) printf(" ");
    }
    printf("\n");
}


void Order(char *input,int num){
    char *order;

    order = malloc(sizeof(char) * (strlen(input)+1));
    strcpy(order,input);

    if(!strcmp(order,"insert")) Insert(num);
    else if(!strcmp(order,"delete")) Delete(num);
    else if(!strcmp(order,"deleteFirst")) DeleteFirst();
    else if(!strcmp(order,"deleteLast")) DeleteLast();
    else{
        printf("Invalid Order!!\n");
        free(order);
        exit(1);
    }
    free(order);
}


int main(){
    int order,n,i,keyNum=0;
    char buf[15];

    MakeHead();

    scanf("%d",&n);
    for(i=1; i<=n; i++){
        scanf("%s",buf);
        if(buf[6]=='\0'){
            scanf("%d",&keyNum);
        }
        Order(buf,keyNum);
    }

    OutputList();
    return 0;
}


Measured memory_bytes: 33144
#include<stdio.h>
#include<iostream>
using namespace std;

int main(){
long long int heap[300];
int n, i;

scanf("%d",&n);

for(i=1;i<=n;i++)
	cin>>heap[i];

for(i=1;i<=n;i++){
	printf("node %d: key = %d, ",i,heap[i]);
	if(i/2>0)
		printf("parent key = %d, ",heap[i/2]);
	if(i*2<=n)
		printf("left key = %d, ",heap[i*2]);
	if(i*2+1<=n)
		printf("right key = %d, ",heap[i*2+1]);
		printf("\n");
}

return 0;
} 


Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n;
    vector<int> GCD;
    cin >> n;
    vector<int> a, D(1e6 + 1);

  int cnt = 0;

    rep(i, n) {
        int x;
        cin >> x;
        if (x != 1) {
            cnt++;
        }
        a.push_back(x);
    }

    rep(i, 1e6+1){
        D[i] = i;
    }

    rep2(i, 2, 1e6+1){
        if(D[i]==i){
            rep3(j, i*2, 1e6+1, i){
                D[j] = i;
            }
        }
    }

    set<int> prime;

    bool flag = true;

    rep(i, n){
        int check = a[i];
        while(D[check] != check){
            if(prime.find(D[check])!=prime.end()){
                flag = false;
                break;
            }else{
                prime.insert(D[check]);
            }
            while(D[check]==D[check/D[check]]){
                check /= D[check];
            }
            check /= D[check];
        }
        if (prime.find(check) != prime.end()) {
          flag = false;
          break;
        } else {
            if(check!=1){
                prime.insert(check);
            }
         
        }
        if(!flag){
            break;
        }
    }

    if(flag){
        cout << "pairwise coprime" << endl;
    }else{
        int g = a[0];
        rep2(i, 1, n){
            g = gcd(g, a[i]);
        }
        if(g==1){
            cout << "setwise coprime" << endl;
        }else{
            cout << "not coprime" << endl;
        }
    }

    return 0;
}

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

using namespace std;

using int64 = long long;

int main() {
  int A, B;
  cin >> A >> B;
  if(A + B == 15) {
    cout << "+" << endl;
  } else if(A * B == 15) {
    cout << "*" << endl;
  } else {
    cout << "x" << endl;
  }
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <memory.h>
#include <set>
#include <cmath>
#define fio ios::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
ll _pow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; b >> i; i++) {
		if ((b >> i) & 1) ans *= a;
		a *= a;
	}
	return ans;
}
ll gcd(ll a, ll b) {
	if (a < b) swap(a, b);
	if (!b) return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	int x = gcd(a, b);
	return x * (a / x) * (b / x);
}
ll getCnt(ll a, ll b, ll x) {
	ll l = a / x;
	if (a%x) l += 1;
	ll r = b / x;
	return r - l + 1;
}
int main(void) {
	ll a, b, c, d; scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
	ll ans = b - a + 1 - getCnt(a, b, c) - getCnt(a, b, d) + getCnt(a, b, lcm(c, d));
	printf("%lld\n", ans);
	return 0;
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        Reader sc = new Reader();
        PrintWriter pw = new PrintWriter(System.out);
        
        try {
            int n = sc.nextInt();
            int x = sc.nextInt();
            int t = sc.nextInt();
            pw.println((n+x-1)/x*t);
        }
        finally {
            pw.flush();
            pw.close();
        }
    }
    
    static class Reader {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while(!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch(IOException io) {
                    io.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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


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

int main(){
    long goal;
    cin >> goal;

    long time = 1;
        
    while(true){
        long ans = (time * (time + 1))/2;
        if(ans >= goal){
            break;
        }
        else{
            time++;
        }
    }
    cout << time << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

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

    cout << min(a * n, b) << endl;
    return 0;
}


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

using namespace std;
using ll = long long;

#define rep(i, a) for (int (i) = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int (i) = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int (i) = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int (i) = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
	#define lcout(a) cout << a;
	#define lcoutln(a) cout << a << endl;
	#define lcerr(a) cerr << a;
	#define lcerrln(a) cerr << a << endl;
#else
	#define lcout(a) 
	#define lcoutln(a) 
	#define lcerr(a) 
	#define lcerrln(a) 
#endif

bool memo[7368792];
int n, m;

void reset()
{
	rep(i,7368792) memo[i] = false;
}

void next(int& pos)
{
	while(memo[pos]) pos++;
}

int main()
{
	cin >> m >> n;
	while (n) {
		int pos = m;
		rep(i, n) {
			for (int j = pos; j < 7368792; j+=pos) memo[j] = true;
			next(pos);
		}
		cout << pos << endl;
		cin >> m >> n;
		reset();
	}
}



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

int main(){
    int N, M;
    cin >> N >> M;

    vector<vector<int>> jobs(M+1, vector<int>());

    int A, B;
    for(int i = 0; i < N; i++ ){
        cin >> A >> B;
        if( A <= M ){
            jobs[A].push_back(B);
        }
    }

    priority_queue<int> rewards;

    int total = 0;
    for(int i = 1; i <=M; i++ ){
        for(auto r : jobs[i]){
            rewards.push(r);
        }

        if( !rewards.empty() ){
            total += rewards.top();
            rewards.pop();
        }
    }

    cout << total << endl;
    return 0;
}


Measured memory_bytes: 5504
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
#include <numeric>
#define ll long long
#define INF INT_MAX 
using namespace std;
int main(){
    int N;
    cin >> N;
    string s;
    cin >> s;
    int mx=0,ans=INF;
    vector<int> E(N,0),W(N,0);
    for(int i=0;i<N;i++){
        if(s[i]=='E'){
            E[i]=1;
        }else{
            W[i]=1;
        }
    }
    for(int i=0;i<N;i++){
        if(i!=0){
            E[i] = E[i]+E[i-1];
            W[i] = W[i]+W[i-1];
        }
    }
    for(int i=0;i<N;i++){
        ans = min(ans,W[i-1]+(E[N-1]-E[i]));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3076
import sys
input = sys.stdin.readline

N,M=map(int,input().split())
PY=[[0,0,0] for _ in range(M)]
for i in range(M):
    PY[i][0],PY[i][1]=map(int,input().split())
    PY[i][2]=i

PY.sort()

ans=[None]*M

p=0
x=0
for i in range(M):
    if PY[i][0]!=p:
        p=PY[i][0]
        x=1
    else:
        x+=1
    pp=str(p)
    np=len(pp)
    xx=str(x)
    nx=len(xx)
    ans[PY[i][2]]="0"*(6-np)+pp+"0"*(6-nx)+xx
    
for i in range(M):
    print(ans[i])




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

int main()
{
	string S, T, U;
	int A, B;
		//vector<int> X(10000),L(100000);.
	cin >> S >> T >> A >> B >> U;

	if (S == U) {
		A = A - 1;
	}
	else {
		B = B - 1;
	}

	cout << A<<" "<<B << endl;
}

Measured memory_bytes: 256
#! env python
# -*- coding: utf-8 -*-

import os
import sys

# ac_py.main
# Date: 2020/06/12
# Filename: main 
# Author: acto_mini

d = ["dreamer", "dream", "erase", "eraser"]


def find(s):
    while True:
        for term in d:
            if s.endswith(term):
                s = s[:-1 * len(term)]
                break
        else:
            print("NO")
            break
        if len(s) == 0:
            print("YES")
            break
    return


def main():
    find(input())
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 134168
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=INT_MAX,MOD=1e9+7;

int main(){
    long long n,m; cin>>n>>m;
    long long a[n];
    cin>>a[0]; a[0]%=m;
    for(int i=1;i<n;i++){
        int x; cin>>x;
        a[i]=(a[i-1]+x)%m;
    }
    sort(a,a+n);
    long long ans=0;
    long long tmp=0,cnt=0;
    rep(i,n){
        // cout<<a[i]<<endl;
        if(a[i]==0) ans++;
        if(a[i]==tmp) cnt++;
        else{
            if(cnt>=2){
                ans+=cnt*(cnt-1)/2;
            }
            cnt=1;
            tmp=a[i];
        }
        // cout<<ans<<endl;
    }
    if(cnt>=2){
        ans+=cnt*(cnt-1)/2;
    }
    cout<<ans<<endl;
    return 0;
}


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



int main(){
    int n,m,x;
    cin>>n>>m>>x;
    int tmp;
    int left=0,right=0;
    for(int i=0;i<m;i++){
        cin>>tmp;
        if(tmp<x){
            left++;
        }else{
            right++;
        }
    }
    if(left<right){
        cout<<left<<endl;
    }else{
        cout<<right<<endl;
    }   
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;


fn main() {
    let n: usize = read();
    let mut nums: Vec<i32> = (0..n).map(|_| read::<i32>()).collect();
    nums.sort();
    let max = nums[n-1];
    let min = nums[0];
    println!("{}",max - min);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

typedef vector<ll> vl;
int main(){
	ll n,m;
	while(cin>>n>>m,n|m){
		vl a(n);
		REP(i,n){
			cin>>a[i];
		}
		a.push_back(0);
		vl ds;
		REP(i,a.size()){
			FOR(j,i,a.size()){
				ds.push_back(a[i]+a[j]);
			}
		}
		sort(ALL(ds));
		ll ans=0;
		REP(i,a.size()){
			REP(j,a.size()){
				ll sum=a[i]+a[j];
				if(sum>m){continue;}
				vl::iterator it=upper_bound(ALL(ds),m-sum);
				if(it==ds.begin())continue;
				ll total=sum+*(it-1);
				if(total>m)total=0;
				ans=max(ans,total);
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 9204
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
n = int(input())
s = input()

ans = []
for i in range(len(s)):
    for j in range(len(alpha)):
        if s[i] == alpha[j]:
                ans.append(alpha[(j+n)%26])
print("".join(ans))

Measured memory_bytes: 9280