akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

// Priority Queue
type Item struct {
	priority, index int
}

type PQ []*Item

func (pq PQ) Len() int {
	return len(pq)
}

func (pq PQ) Less(i, j int) bool {
	return pq[i].priority > pq[j].priority
}

func (pq PQ) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *PQ) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Item)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *PQ) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	item.index = -1
	*pq = old[0 : n-1]
	return item
}

// End Priority Queue

func main() {
	sc.Split(bufio.ScanWords)

	N, M := getInt(), getInt()

	pq := make(PQ, 0)
	heap.Init(&pq)
	for i := 0; i < N; i++ {
		a := getInt()
		heap.Push(&pq, &Item{a, 0})
	}

	for i := 0; i < M; i++ {
		item := heap.Pop(&pq).(*Item)
		heap.Push(&pq, &Item{item.priority / 2, 0})
	}

	ans := 0
	for i := 0; i < N; i++ {
		item := heap.Pop(&pq).(*Item)
		ans += item.priority
	}
	out(ans)
}


Measured memory_bytes: 7296
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#define GYOU_MAX 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define s_pri(str) printf("%s\n",str);
#define PRINT(str) printf(#str "\n")
#define v_pri(val) printf("%d\n",val);
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define pi acos(-1.0)
#define sca(x) scanf("%d",&x);

typedef long long int ll;


int main(void) {
	
	int K, X;
	sca(K);
	sca(X);
	if (500 * K >= X) {
		s_pri("Yes");
	}
	else {
		s_pri("No");
	}


	return 0;
}


Measured memory_bytes: 128
S = input()
T = input()
s = len(S)
t = len(T)

if S[0:s] == T[0:s]:
  if s <= 10 and s >= 1:
    if t == s + 1:
      if T.islower() == True and T.isalpha() == True and S.islower() == True and T.isalpha() == True:
        print('Yes')
      else:
        print('No')
    else:
      print('No')
  else:
    print('No')
  
else:
  print('No')

Measured memory_bytes: 9136
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 10000;
static const int VMAX = 100000;

int n,A[MAX],s;
int B[MAX],T[VMAX+1];

int solve(){
    int i,ans = 0;
    
    bool V[MAX];
    for(i=0;i<n;i++){
        B[i] = A[i];
        V[i] = false;
    }
    sort(B,B+n);
    for(i=0;i<n;i++)
        T[B[i]] = i;
    for(i=0;i<n;i++){
        if(V[i])
               continue;
        int cur=i;
        int S = 0;
        int m = VMAX;
        int an = 0;
        while(1){
            V[cur] = true;
            an++;
            int v=A[cur];
            m = min(m,v);
            S+=v;
            cur = T[v];
            if(V[cur]) 
                   break;
        }
        ans += min(S+(an-2)*m,m+S+(an+1)*s);
    }
    return ans;
}


int main(){
    cin>>n;
    s=VMAX;
    for(int i=0;i<n;i++){
        cin>>A[i];
        s=min(s,A[i]);
    }
    int ans = solve();

    cout<<ans<<endl;

    return 0;
}




Measured memory_bytes: 3176
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

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

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

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int N,M;
vi v[MX];
int ans = 0;
map<int,int> tmp[2];
set<int> odd[2];

void rem(int ind, int x) {
    if (odd[ind].count(x)) odd[ind].erase(x);
    tmp[ind][x] --;
    if (tmp[ind][x] == 0) {
        tmp[ind].erase(x);
        return;
    }
    if (tmp[ind][x]&1) odd[ind].insert(x);
}

void solve(int x) {
    if (x == 0 || x == M-x) {
        ans += sz(v[x])/2;
        // cout << "HUH " << x << "\n";
    } else {
        F0R(k,2) tmp[k].clear(), odd[k].clear();
        for (auto a: v[x]) tmp[0][a] ++;
        for (auto a: v[M-x]) tmp[1][a] ++;
        F0R(k,2) for (auto& a: tmp[k]) if (a.s&1) odd[k].insert(a.f);
        
        while (sz(odd[0]) || sz(odd[1])) {
            if (sz(odd[0]) && sz(odd[1])) {
                rem(0,*odd[0].begin());
                rem(1,*odd[1].begin());
                ans ++;
            } else if (sz(odd[0])) {
                if (sz(tmp[1])) {
                    rem(0,*odd[0].begin());
                    rem(1,tmp[1].begin()->f);
                    ans ++;
                } else break;
            } else {
                if (sz(tmp[0])) {
                    rem(1,*odd[1].begin());
                    rem(0,tmp[0].begin()->f);
                    ans ++;
                } else break;
            }
        }
        
        F0R(k,2) for (auto& a: tmp[k]) ans += a.s/2;
        /*cout << "HI\n";
        for (int i: v[x]) cout << i << " ";
        cout << "\n---\n";
        for (int i: v[M-x]) cout << i << " ";
        cout << "\n---\n";*/
    }
    // cout << "OH " << x << " " << ans << "\n";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> M;
    F0R(i,N) {
        int x; cin >> x;
        v[x%M].pb(x);
    }
    for (int i = 0; i <= M-i; ++i) solve(i);
    cout << ans;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 6912
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stdlib.h>
#include <cmath>
#include <math.h>
#include <fstream>
#include <bitset>
#include <time.h>
#define int long long
using namespace std;
int x, y, z, ai, bi, ci;
vector<int> a, b, c;
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin >> x >> y >> z;
    for (int i=0; i < x+y+z; i++){
        cin >> ai >> bi >> ci;
        a.push_back(ai);
        b.push_back(bi);
        c.push_back(ci);
    }
    vector<int> f, s;
    int ans = 0;
    for (int i=0; i < x+y+z; i++){
        ans += a[i];
        f.push_back(b[i] - a[i]);
        s.push_back(c[i] - a[i]);
    }
    vector<vector<int> > last;
    for (int i=0; i < x+y+z; i++){
        vector<int> help;
        help.push_back(f[i] - s[i]);
        help.push_back(f[i]);
        help.push_back(s[i]);
        last.push_back(help);
    }
    sort(last.begin(), last.end(), greater<vector<int> >());
    multiset<int> ms;
    int ns = 0;
    for (int i=0; i < y; i++){
        ms.insert(last[i][1]);
        ns += last[i][1];
    }
    multiset<int>::iterator it = ms.begin();
    vector<int> pref, suff;
    pref.push_back(ns);
    for (int i=y; i < y+x; i++){
        int ll = *it;
        int nv = last[i][1];
        ms.insert(nv);
        if (nv >= ll){
            ns += (nv-ll);
            it++;
        }
        pref.push_back(ns);
    }
    multiset<int> ms2;
    int ns2 = 0;
    for (int i=0; i < z; i++){
        ms2.insert(last[x+y+z-i-1][2]);
        ns2 += last[x+y+z-i-1][2];
    }
    it = ms2.begin();
    suff.push_back(ns2);
    for (int i=y+x-1; i >= y; i--){
        int ll = *it;
        int nv = last[i][2];
        ms2.insert(nv);
        if (nv >= ll){
            ns2 += (nv-ll);
            it++;
        }
        suff.push_back(ns2);
    }
    int result = 0;
    for (int i=0;i < pref.size(); i++){
        int profit = pref[i] + suff[suff.size() - i - 1];
        result = max(result, ans + profit);
    }
    cout << result << endl;
    return 0;
}

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

int main(void) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans=0;
    for(int a=0; a<10; a++){
        for(int b=0; b<10; b++){
            for(int c=0; c<10; c++){
                int k=0;
                for(int i=0; i<n; i++){
                    int x = stoi((string)(s.substr(i,1)));
                    if((k==0 & a==x)|(k==1 & b==x)|(k==2 & c==x)) k++;
                }
                if (k==3) ans++;
            }
        }
    }
    cout << ans << endl;
}

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

int main(){

    size_t n;
    std::cin >> n;
    
    std::vector<size_t> p(n);

    for(auto&& e : p){
        std::cin >> e;
    }

    size_t min = n, cnt = 0;

    for(const auto& e : p){
        min = std::min(min, e);

        if(min >= e) cnt++;
    }

    std::cout << cnt << std::endl;

    return 0;
}


Measured memory_bytes: 1792
//g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g $PROGRAM -o $OUTPUT -DLOCAL -lasan -lubsan
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define alli(a, n, k) (a + k), (a + n + k)
#define FP(i, a, b, k) for (__typeof(a) i = a; i < b; i += k)
#define FS(i, a, b, k) for (__typeof(a) i = a; i > b; i -= k)
#define IT(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template <class T>
inline T gcd(T x, T y)
{
	if (!y)
		return x;
	return gcd(y, x % y);
}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef vector<pair<int, PII>> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;

inline ll modulo(ll a, ll m)
{
	return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
	assert(__gcd(a, m) == 1);
	ll m0 = 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 += m0;

	return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
	if (y == 0)
		return 1LL;
	else if (y == 1)
		return x;
	else
	{
		ll ans = modPow(x, y / 2, m) % m;
		if (y & 1)
		{
			return (((ans * ans) % m) * x) % m;
		}
		else
		{
			return (ans * ans) % m;
		}
	}
}

vector<string> split(char d,string s)
{
	stringstream ss(s);
	string t;
	vector<string> words;
	while(getline(ss,t,d))
	{
		words.pb(t);
	}

	return words;
}

int main(int argc, char *argv[])
{
#ifdef LOCAL
	auto start = chrono::high_resolution_clock::now();
#endif
	
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int t = 1;
	while(a>0 && c>0)
	{
		if(t)
			c -= b;
		else
			a -= d;
		t = 1 - t;
	}
	if(a>0)
		cout << "Yes";
	else
		cout << "No";


#ifdef LOCAL
	auto end = chrono::high_resolution_clock::now();
	double time_taken =
		chrono::duration_cast<chrono::nanoseconds>(end - start).count();

	time_taken *= 1e-9;

	cerr << "\nTime taken by program is : " << fixed
		 << time_taken << setprecision(9);
	cerr << " sec" << endl;
#endif
	return 0;
}


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

int main() {
  string S;
  cin >> S;
  int n = 0, w = 0, s = 0, e = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] == 'N') n = 1;
    else if (S[i] == 'S') s = 1;
    else if (S[i] == 'E') e = 1;
    else w = 1;
  }
  cout << (n == s && e == w ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
/*
    author: masab hasnain
*/

#include<bits/stdc++.h>
using namespace std;

const double PI  = 3.141592653589793238463;

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

    double r;
    cin >> r;
    r = 2.0 * PI * r;
    cout << r << endl;
}


Measured memory_bytes: 3824
import Control.Applicative
import Control.Monad

main :: IO ()
main = do
  n <- readLn
  unless (n == 0) $ do
    solve <$> f >>= print
    main
  where
    f = words <$> getLine

solve :: [String] -> Int
solve = subtract 1 . length . f [DD] DD 
  where
    f ls st [] = ls
    f ls DD ("lu" : cs) = f ls UD cs
    f ls DD ("ru" : cs) = f ls DU cs
    f ls UD ("ld" : cs) = f (if head ls == DD then ls else DD:ls) DD cs
    f ls UD ("ru" : cs) = f (if head ls == UU then ls else UU:ls) UU cs
    f ls DU ("lu" : cs) = f (if head ls == UU then ls else UU:ls) UU cs
    f ls DU ("rd" : cs) = f (if head ls == DD then ls else DD:ls) DD cs
    f ls UU ("rd" : cs) = f ls UD cs
    f ls UU ("ld" : cs) = f ls DU cs
    
data State = DD | DU | UD | UU deriving (Show, Eq)



Measured memory_bytes: 4144
n,k=map(int,input().split())
MOD=10**9+7
l=[0]*(k+1)
for i in range(k,0,-1):
  l[i]=pow(k//i,n,MOD)
for i in range(k,0,-1):
  for j in range(k//i,1,-1):
    l[i]=(l[i]-l[i*j])%MOD
ans=0
for i,c in enumerate(l):
  ans+=i*c
  ans%=MOD
print(ans)

Measured memory_bytes: 11200
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

int main() {

  long long X;
  cin>>X;

  if(X <= 6){
    cout<<1<<endl;
    return 0;
  }
  if(X <= 11){
    cout<<2<<endl;
    return 0;
  }

  if(X <= 11*(X/11) + 6){
    if(X % 11 == 0) cout<<2 * (X / 11)<<endl;
    else cout<<2 * (X / 11) + 1<<endl;
  } else{
    cout<<2 * (X / 11) + 2<<endl;
  }

  return 0;
}


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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[8] = {-1, 0, 1, 1, -1, 1, 0, -1};

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H, W, A, B;
  cin >> H >> W >> A >> B;
  vector<vector<int>> ans(H, vector<int>(W));
  for (int i = 0; i < B; i++)
  {
    for (int j = A; j < W; j++)
    {
      ans[i][j] = 1;
    }
  }
  for (int i = B; i < H; i++)
  {
    for (int j = 0; j < A; j++)
    {
      ans[i][j] = 1;
    }
  }
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      cout << ans[i][j];
    }
    cout << endl;
  }
  return 0;
}

// 条件としてAやBは必ずW/2やH/2以下であることに着目して上手く4分割すれば必ず実現できる．


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

typedef long long ll;

ll N, M, L;
ll K[100002], S[100002];
ll dp[2002][2002];
ll sum[100002];

ll getCost(int a, int b){
  a = K[a];
  b = K[b];
  if(a > b) swap(a, b);
  ll tmp = sum[b] - (a - 1 < 0 ? 0 : sum[a - 1]);
  tmp /= L;
  return tmp;
}

ll update(ll a, ll b){
  if(a == -1) return b;
  return min(a, b);
}

void solve(){
  sum[0] = S[0];
  for(int i = 1; i < M; i++){
    sum[i] = sum[i - 1] + S[i];
  }

  sort(K, K + N);
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;

  for(int i = 0; i < N - 1; i++){
    for(int j = 0; j < N - 1; j++){
      if(dp[i][j] == -1) continue;

      int next = max(i + 1, j + 1);
      dp[next][j] = update(dp[next][j], dp[i][j] + getCost(i, next));
      dp[i][next] = update(dp[i][next], dp[i][j] + getCost(j, next));
    }
  }

  ll ans = -1;

  for(int i = 0; i < N; i++){
    if(dp[N - 1][i] != -1){
      ans = update(ans, dp[N - 1][i] + getCost(N - 1, i));
    }
    if(dp[i][N - 1] != -1){
      ans = update(ans, dp[i][N - 1] + getCost(N - 1, i));
    }
  }

  cout << ans << endl;
}

int main(){
  while(cin >> N >> M >> L){
    for(int i = 0; i < N; i++){
      cin >> K[i];
      K[i]--;
    }
    for(int i = 0; i < M; i++){
      cin >> S[i];
    }
    solve();
  }
}

Measured memory_bytes: 32000
def resolve():
    '''
    code here
    '''
    import collections
    N, K = [int(item) for item in input().split()]
    A_list = [int(item) for item in input().split()]

    cnt_dict = collections.Counter(A_list)

    temp_dict = sorted(cnt_dict.items(), key=lambda x:x[1])

    delta = len(cnt_dict) - K

    if delta > 0:
        res = 0
        cnt = 0
        for i, v in temp_dict:
            if cnt < delta:
                res += v
                cnt += 1
            else:
                break
    else:
        res = 0

    print(res)
if __name__ == "__main__":
    resolve()


Measured memory_bytes: 39288
N, C = int(input()), [temp for temp in input().split()]
D    = list(C)

for i in range(N) :
    for j in range(i + 1, N)[ : : -1] :
        if int(C[j][1 :]) < int(C[j - 1][1 :]) :
            C[j], C[j - 1] = C[j - 1], C[j]
print(*C)
print('Stable')

for i in range(N) :
    minj = i
    for j in range(i, N) :
        if int(D[j][1 :]) < int(D[minj][1 :]) :
            minj = j
    D[i], D[minj] = D[minj], D[i]
print(*D)

cou = 0
for che in range(N) :
    if C[che] != D[che] :
        cou = 1
if cou == 0 : print('Stable')
else        : print('Not stable')

Measured memory_bytes: 7800
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll N,M,i,A,B;cin>>N>>M;bool ans=true;
  vector<bool>X(N,false),Y(N,false);
  REP(i,M){
    cin>>A>>B;
    if(A==1)X.at(B-1)=true;
    if(B==N)Y.at(A-1)=true;
  }
  REP(i,N)if(X.at(i)&&Y.at(i))ans=false;
  if(ans)cout<<"IM";
  cout<<"POSSIBLE"<<endl;
  return 0;
}

Measured memory_bytes: 256
import sys;input=sys.stdin.readline


N, = map(int, input().split())
M = 51
C2 = [0]*M
C5 = [0]*M
C = [[0]*(M+1) for _ in range(M+1)]
CC = []
for _ in range(N):
    c2, c5 = 9, 9
    s = input().strip()
    if "." in s:
        a, b = s.split(".")
        b.rstrip("0")
        if len(b) != 0:
            c2 -= len(b)
            c5 -= len(b)
        x = int(a + b)
    else:
        x = int(s)
#    print(x, c2, c5)
    while x % 2 == 0:
        x//=2
        c2 += 1
    while x % 5 == 0:
        x//=5
        c5 += 1
    C[c2][c5] += 1
    CC.append((c2, c5))
R = [[0]*(M+1) for _ in range(M+1)]
for i in range(1, M+1):
    for j in range(1, M+1):
        R[i][j] = R[i-1][j] + R[i][j-1] - R[i-1][j-1] + C[i-1][j-1]
r = 0
for a, b in CC:
    if a >= 9 and b >= 9:
        r -= 1
    a, b = max(18-a, 0), max(18-b, 0)
    r += R[M][M] - R[a][M] - R[M][b] + R[a][b]
print(r//2)




Measured memory_bytes: 85388
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n=0;
    int ac=0,wa=0,tle=0,re=0;
    cin>>n;
    while(n--)
    {
        string str;
        cin>>str;
        if(str=="AC")
        {
            ac++;
        }
        else if(str=="WA")
        {
            wa++;
        }
        else if(str=="TLE")
        {
            tle++;
        }
        else if(str=="RE")
        {
            re++;
        }
    }
    cout<<"AC x"<<" "<<ac<<endl;
    cout<<"WA x"<<" "<<wa<<endl;
    cout<<"TLE x"<<" "<<tle<<endl;
    cout<<"RE x"<<" "<<re<<endl;
}

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

int main() {
  
  int64_t L, R; cin >> L >> R; int ans = 2020;
  
  if (2020LL < R - L) { cout << 0 << endl; return 0; }
  
  for (int64_t i = L; i < R; i++) {
    
    for (int64_t j = i + 1; j < R + 1; j++) {
      
      int64_t left = i % 2019, right = j % 2019;
      
      int tmp = left * right % 2019;
      
      ans = min(ans, tmp);
      
    }
    
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 3640
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

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

	int last = 0;
	REP(i, K) {
		int num = A + i;
		if (num <= B) {
			cout << num << endl;
			last = num;
		}
		else {
			break;
		}
	}

	if ((B - K + 1) <= (A + K - 1)) {
		REPS(i, last + 1, B + 1) {
			cout << i << endl;
		}
	}
	else {
		REPS(i, B - K + 1, B + 1) {
			cout << i << endl;
		}
	}

	system("pause");
	return 0;
}

Measured memory_bytes: 504
matrix = []
row, col = map(int, input().split())
for i in range(row):
  matrix.append(list(map(int, input().split() )))
  matrix[i].append(sum(matrix[i]))

matrix.append([])
for i in range(col):
  col_sum = 0
  for j in range(row):
    col_sum += matrix[j][i]
  matrix[row].append(col_sum)
matrix[row].append(sum(matrix[row]))

for i in range(row+1):
  strings = ''
  for j in range(col+1):
    strings += str(matrix[i][j]) + ' '
  print(strings[:-1])


Measured memory_bytes: 5700
#include <stdio.h>

int s_length(const char s[]){
   int len = 0;

   while (s[len])
      len++;
   return len;
}

int main() {
   int n, i;
   char s[100], p[100], rings[200];
   char *ret;

   scanf("%s", s);
   scanf("%s", p);

   n = s_length(s);

   for (i = 0; i < n; i++) {
      rings[i] = s[i];
      rings[i + n] = s[i];
   }
   
   if ((ret = strstr(rings, p)) != NULL) {
      printf("Yes\n");
   } else {
      printf("No\n");
   }

   return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
 
int main(){
   int t;
  cin >> t;
  int a[t];
  for (int i =0 ;i < t; i++){
    cin >> a[i];
  }
  
  sort(a,a+t);
  double rtr = a[0];
  for (int i = 1; i < t; i++){
    rtr = (rtr + a[i])/2;
  }
  
  cout << rtr;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int uhen = sc.nextInt();
		int jouhen = sc.nextInt();
		int sahen = 0;
		int teihen = 0;
		int N = sc.nextInt();

		for (int i = 0; i < N; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int a = sc.nextInt();

			switch (a) {
			case 1:
				sahen = Math.max(x, sahen);
				break;
			case 2:
				uhen = Math.min(x, uhen);
				break;
			case 3:
				teihen = Math.max(y, teihen);
				break;
			case 4:
				jouhen = Math.min(jouhen, y);
				break;
			}



		}
		int W = (uhen - sahen) > 0 ? uhen - sahen : 0;
		int H = (jouhen - teihen) > 0 ? jouhen - teihen : 0;

		System.out.println(H * W);

	}
}


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

void Main()
{
  ll n,k,r,s,p; cin >> n >> k;
  cin >> r >> s >> p;
  string t; cin >> t;
  vector<ll> score(n);
  if (t[0] == 'r') score[0] = p;
  else if (t[0] == 's') score[0] = r;
  else score[0] = s;
  for(int i = 1; i < k; i++) {
    if(t[i] == 'r') score[i] = score[i-1] + p;
    else if (t[i] == 's') score[i] = score[i-1] + r;
    else score[i] = score[i-1] + s;
  }
  for(int i = k; i < t.size(); i++) {
    if (t[i] == 'r') {
      if (t[i-k] == 'r') {
        t[i] = '*';
        score[i] = score[i-1];
      } else score[i] = score[i-1] + p;
    } else if (t[i] == 's') {
      if (t[i-k] == 's') {
        t[i] = '*';
        score[i] = score[i-1];
      } else score[i] = score[i-1] + r;
    } else if (t[i] == 'p') {
      if (t[i-k] == 'p') {
        t[i] = '*';
        score[i] = score[i-1];
      } else score[i] = score[i-1] + s;
    }
  }
  //rep(i,n) cout << score[i] << ",";
  cout << score[n-1] << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


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

int main() {
  
  std::vector<std::string> keys; 
  std::vector<int> scores;
  
  string str; // dummy 
  
  int N;
  cin >> N;
  for(int i = 0; i < N; i++)
  {
   	cin >> str; 
    std::vector<string>::iterator iter = std::find(keys.begin(), keys.end(), str);
    if( iter == keys.end() )
    {
      keys.push_back(str);
      scores.push_back(1);
    }
    else
    {
      scores.at(iter - keys.begin()) += 1;
    }     
  }
  
  int M;
  cin >> M;
  for(int i = 0; i < M; i++)
  {
    cin >> str; 
    std::vector<string>::iterator iter = std::find(keys.begin(), keys.end(), str);
    if( iter == keys.end() )
    {
      keys.push_back(str);
      scores.push_back(-1);
    }
    else
    {
      scores.at(iter - keys.begin()) -= 1;
    }     
  }
  std::vector<int>::iterator maxiter = std::max_element(scores.begin(), scores.end());
  cout << max(0, scores.at(std::distance(scores.begin(), maxiter))) << endl;
}


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

#define ll long long int
#define ld long double
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();

using namespace std;
const int N= 1e3+10, mod= 1e9+7;

int main() {
  ios_base::sync_with_stdio(false);cin.tie(NULL);
/*
  #ifndef ONLINE_JUDGE
  freopen("in.txt","r",stdin);
  freopen("out.txt","w",stdout);
  #endif
*/
  int n, res=0;  string s;
  cin>>n>>s;

  for(int i=0;i<n-2; ){
    if(s[i]=='A'&& s[i+1]=='B'&& s[i+2]=='C'){
      res++; 
      i+=3;
    }else i++;
  }
  cout<<res<<"\n";


  return 0;
}


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



int main(void){
    int N=0;
    int A[102]={};
    int max=0;

    int i=0,j=0;
	scanf("%d ",&N); 
    for(i=1;i<=N;i++){
        scanf("%d ",&A[i]); 
    }

    for(i=1;i<=N;i++){
        for(j=1;j<=N;j++){
            if(abs(A[i]-A[j])>max){max=abs(A[i]-A[j]);}
        }
    }

    printf("%d",max);
    return 0;


}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n,x[1000];
  int HP=0;
  int p;
  int sum=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>x[i];
    sum=sum+x[i];
  }
  if(sum==1){
    cout<<0<<endl;
    return 0;
  }
  if(sum%n>=n/2){
    p=sum/n+1;
  }
  else if(sum%n<n/2){
    p=sum/n;
  }
  //p=sum/n;
  for(int j=0;j<n;j++){
    HP=HP+(x[j]-p)*(x[j]-p);
  }
  cout<<HP<<endl;
  
}


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

int main() {
  int N;
  cin >> N;
  for ( int i = 0; i < N; i++) {
    string s;
    cin >> s;
    if ( s == "Y" ) {
      cout << "Four" << endl;
      break;
    }
    else if ( s != "Y" && i == N-1 ){
      cout << "Three" << endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  int N;
  cin>>N;
  N%=10;
  vector<int>a={2,4,5,7,9};
  vector<int>b={0,1,6,8};
  for(int i=0;i<5;i++){
    if(N==a[i]){cout<<"hon"<<endl;}
  }
  for(int i=0;i<4;i++){
    if(N==b[i]){cout<<"pon"<<endl;}
  }
  if(N==3){cout<<"bon"<<endl;}
  return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Tasks
{
    public class D
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var S = Scanner.Scan<string>();
            var Q = Scanner.Scan<int>();
            var rev = false;
            var lsb = new StringBuilder();
            var rsb = new StringBuilder(S);
            for (var i = 0; i < Q; i++)
            {
                var query = Scanner.ScanEnumerable<string>().ToArray();
                if (int.Parse(query[0]) == 1) rev = !rev;
                else
                {
                    var (f, c) = (int.Parse(query[1]), query[2][0]);
                    if (f == 1)
                    {
                        if (rev) rsb.Append(c);
                        else lsb.Append(c);
                    }
                    else
                    {
                        if (rev) lsb.Append(c);
                        else rsb.Append(c);
                    }
                }
            }
            var l = lsb.ToString();
            var r = rsb.ToString();
            var answer = rev ? Reverse(r) + l : Reverse(l) + r;
            Console.WriteLine(answer);
        }

        static string Reverse(string str)
        {
            var chars = str.ToCharArray();
            for (int i = 0, j = str.Length - 1; i < j; i++, j--)
            {
                (chars[i], chars[j]) = (chars[j], chars[i]);
            }
            return new string(chars);
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
            public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T)));
        }
    }
}


Measured memory_bytes: 43760
//	created : 15/12/27
// 	autor   : Rp7rf
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>

using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = 0 ; i < a ; i ++)
#define vi vector<int>


int main(void){
	int n;
	while(cin>>n,n){
		vi in(n),l(n);
		int ret = 0;
		rep(i,n)cin>>in[i];
		while(true){
			//rep(i,n)cout<<in[i]<<" ";cout<<endl;
			/*
			int cnt[13];
			rep(i,13)cnt[i]=0;
			rep(i,n)cnt[in[i]]++;
			rep(i,n)in[i] = cnt[in[i]];
			*/
			rep(i,n){
				l[i] = 0;
				rep(j,n)l[i] += (in[i] == in[j]);
			}
			if(in == l)break;
			ret ++;
			in = l;
		}
		cout<<ret<<endl;
		rep(i,n-1)cout<<in[i]<<" ";
		cout<<in[n-1]<<endl;
	}
}

Measured memory_bytes: 1216
n = int(input())
AB,B_A, _A,B_ = 0,0,0,0
for _ in range(n):
    s = input()
    AB +=s.count('AB')
    if s[0] == 'B' and s[-1] == 'A':
        B_A +=1
    elif s[0] == 'B':
        B_ +=1
    elif s[-1] == 'A':
        _A +=1
if B_A == 0:
    print(AB + min(B_,_A))
else:
    if _A + B_==0:
        print(AB + B_A -1)
    else:
        print(AB + B_A + min(B_,_A))


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

int main(){
  string s;
  cin >> s;
  int ans = 700;
  if(s[0] == 'o') ans += 100;
  if(s[1] == 'o') ans += 100;
  if(s[2] == 'o') ans += 100;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
s=input()
k=int(input())
d=[]
w=""
cnt=0
for i in s:
    if w!=i:
        w=i
        if cnt:
            d.append(cnt)
        cnt=1
    else:
        cnt+=1
d.append(cnt)
t=len(d)
if t==1:
    print(d[0]*k//2)
else:
    ans=0
    for i in range(t):
        if i==0 and s[0]!=s[-1] and d[0]>1:
            ans+=d[0]//2*k
        elif i==0 and s[0]==s[-1] and d[0]>1:
            ans+=d[0]//2
        elif i==t-1 and s[0]==s[-1]:
            ans+=(d[0]+d[-1])//2*(k-1)
            ans+=d[-1]//2
        elif i==t-1 and s[0]!=s[-1]:
            ans+=d[-1]//2*k
        elif d[i]>1:
            ans+=d[i]//2*k
    print(ans)

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

using namespace std;

int main()
{
    set<string> s;

    int n;
    cin >> n;
    map<string, int> blue;
    for(int i = 0; i < n; i++) {
        string in;
        cin >> in;
        blue[in] = blue[in] + 1;
        s.insert(in);
    }

    int m;
    cin >> m;
    map<string, int> red;
    for(int i = 0; i < m; i++) {
        string in;
        cin >> in;
        red[in] = red[in] + 1;
        s.insert(in);
    }

    int ans = -1000;
    for(auto itr = s.begin(); itr != s.end(); itr++) {
        string key = *itr;
        ans = max(ans, blue[key] - red[key]);
    }

    cout << max(0, ans) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

const int64_t MOD = 1e9 + 7;
int64_t dpow(int64_t x, int64_t y)
{
    if (y == 0) {
        return 1;
    }
    if (y % 2 == 0) {
        return dpow(x * x % MOD, y / 2);
    } else {
        return x * dpow(x, y - 1) % MOD;
    }
}

int64_t inv(int64_t x)
{
    return dpow(x, MOD - 2);
}

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

    vector<int> a(n), b(m);
    rep(i, n)
    {
        cin >> a[i];
    }
    rep(i, m)
    {
        cin >> b[i];
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    rep(i, n - 1)
    {
        if (a[i] == a[i + 1]) {
            cout << 0 << endl;
            return 0;
        }
    }
    rep(i, m - 1)
    {
        if (b[i] == b[i + 1]) {
            cout << 0 << endl;
            return 0;
        }
    }

    vector<int> c(n + m);
    copy(a.begin(), a.end(), c.begin());
    copy(b.begin(), b.end(), c.begin() + n);
    sort(c.begin(), c.end());
    c.erase(unique(c.begin(), c.end()), c.end());

    vector<bool> isFree(c.size(), true);
    vector<int> ag(n, 0), bg(m, 0);
    rep(i, n) rep(j, m)
    {
        if (a[i] < b[j]) {
            ag[i]++;
        } else if (a[i] > b[j]) {
            bg[j]++;
        } else {
            ag[i]++;
            isFree[lower_bound(c.begin(), c.end(), a[i]) - c.begin()] = false;
        }
    }

    vector<int> cg(c.size(), 0);
    rep(i, n)
    {
        int idx = lower_bound(c.begin(), c.end(), a[i]) - c.begin();
        cg[idx] += ag[i];
    }
    rep(i, m)
    {
        int idx = lower_bound(c.begin(), c.end(), b[i]) - c.begin();
        cg[idx] += bg[i];
    }

    vector<int64_t> fact(n * m + 1);
    irep(i, n * m)
    {
        if (i == 0) {
            fact[i] = 1;
        } else {
            fact[i] = fact[i - 1] * i % MOD;
        }
    }

    int64_t result = 1, used = 0;
    rep(i, c.size())
    {
        int64_t r = c[i] - used;
        //cout << "i=" << i << " c[i]=" << c[i] << " used=" << used << " r=" << r << " cg[i]=" << cg[i] << " free=" << boolalpha << isFree[i]
        //     << " result=" << result << endl;
        if (r < cg[i]) {
            cout << 0 << endl;
            return 0;
        }
        if (isFree[i]) {
            result = result * cg[i] % MOD;
        }
        result = result * (fact[r - 1] * inv(fact[r - 1 - (cg[i] - 1)]) % MOD) % MOD;
        used += cg[i];
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 8064
#include<stdio.h>
int main(){
  int d;
  scanf("%d",&d);
  switch(d){
    case 25:
      printf("Christmas");
      break;
    case 24:
      printf("Christmas Eve");
      break;
    case 23:
      printf("Christmas Eve Eve");
      break;
    case 22:
      printf("Christmas Eve Eve Eve");
      break;
  
  }
  return 0;
}


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

using namespace std;

#define str to_string
#define rep(i, n) for (int i=0; i<int(n); i++)
#define all(c) (c).begin(), (c).end()

#define MAX_N 101

int N;
int score[MAX_N];
int ranks[MAX_N];

int main() {
  cin >> N;
  // scoring
  rep(i, N*(N-1)/2) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if (c == d) {
      score[a-1] += 1;
      score[b-1] += 1;
    }
    else if (c > d) score[a-1] += 3;
    else            score[b-1] += 3;
  }

  // ranking
  int num = 1;
  for (int i=1+(3*(N*(N-1)/2)); i>0; i--) {
    int c = 0;
    rep(j, N) {
      if (score[j] == i) {
        ranks[j] = num;
        c++;
      }
    }
    num += c;
  }
  // print
  rep(i, N) cout << ranks[i] << '\n';
  return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int, int>
#define f first
#define s second 
using namespace std;
const LL INF = (LL) 1e9 + 5;
const LL MOD = (LL) 1e9 + 7;
const int MAXN = 2000005;

LL fac[MAXN], inv[MAXN];

LL C(LL n, LL k) {
	return fac[n] * inv[k] % MOD * inv[n - k] % MOD;
}

LL qpow(LL a, LL pw) {
	LL res = 1;
	while (pw) {
		if (pw & 1) res = res * a % MOD;
		a = a * a % MOD;
		pw >>= 1;
	}
	return res;
}

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

	fac[0] = inv[0] = 1;
	for (int i = 1; i < MAXN; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = qpow(fac[i], MOD - 2);
	}

	LL r1, c1, r2, c2, ans = 0;
	cin >> r1 >> c1 >> r2 >> c2;
	for (int i = r1; i <= r2; i++) {
		ans += C(i + c2 + 1, c2) - C(i + c1, c1 - 1);
	}
	
	cout << (ans % MOD + MOD) % MOD << '\n';
	
	return 0;
}

Measured memory_bytes: 31488
//皆さん、第9回シンデレラガール総選挙は、トップでオンリーワンを目指す城ヶ崎美嘉に
//そしてボイスアイドルオーディションは、プログラミングが趣味の才女大石泉に、ぜひ投票をお願いします！
//#城ヶ崎美嘉を009のシンデレラに
//#大石泉の必勝プログラム
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int out[200100];
int main()
{
	int n,a;cin>>n;memset(out,0,sizeof(out));
	rep(i,n-1){
		cin>>a;out[a-1]++;
	}
	rep(i,n) cout<<out[i]<<endl;
}


Measured memory_bytes: 4416
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A753 solver = new A753();
        solver.solve(1, in, out);
        out.close();
    }

    static class A753 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            String str = "753";
            out.print(str.contains(s) ? "YES" : "NO");
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public void close() {
        }

    }
}



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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

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

const int N = 3005;
pii arr[N];
int dp[N][N];
int n , t;

int solve(int idx , int cur){
    if(idx == n)return 0;
    if(cur >= t)return 0;
    int &ret = dp[idx][cur];
    if(~ret)return ret;
    ret = solve(idx + 1, cur);
    ret = max(ret, solve(idx + 1 , cur + arr[idx].fr) + arr[idx].sc);
    return ret;
}



int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    cin >> n >> t;
    loop(i,n)cin >> arr[i].fr >> arr[i].sc;
    sort(arr,arr+n);
    //reverse(arr,arr+n);
    memset(dp,-1,sizeof dp);
    cout << solve(0,0) << endl;


    return 0;
}


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

int main()
{
    int a,b,c,d;
    while(~scanf("%d %d %d %d",&a,&b,&c,&d))
    {
        if(a>=b&&c>=d)
        {
            printf("%d\n",b+d);
        }
        else if(a<=b&&c>=d)
            printf("%d\n",a+d);
        else if(a>=b&&c<=d)
            printf("%d\n",b+c);
        else if(a<=b&&c<=d)
        {
            printf("%d\n",a+c);
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end());
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
void dout(double d){printf("%.12f\n",d);}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int n, m, x[N];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  FOR(i, 0, m) cin >> x[i];
  sort(x, x+m);
  FOR(i, 0, m-1) x[i] = x[i+1]-x[i];
  sort(x, x+m-1);
  ll ans = 0;
  FOR(i, 0, m-n) ans += x[i];
  cout << ans << endl;
}

Measured memory_bytes: 640
# coding: utf-8
a = list(input())
b = list(input())
c = list(input())
trash = a.pop(0)

while True:
  if trash == "a":
    if len(a) == 0:
      print("A")
      break
    trash = a.pop(0)
  elif trash == "b":
    if len(b) == 0:
      print("B")
      break
    trash = b.pop(0)
  elif trash == "c":
    if len(c) == 0:
      print("C")
      break
    trash = c.pop(0)

Measured memory_bytes: 3064
N,A = map(int,input().split())
*X, = map(int,input().split())
dp=[[[0]*2510 for _ in [0]*(N+10)] for _ in [0]*(N+10)]
for n in range(0,N+1):dp[n][0][0] = 1
for n in range(1,N+1):
    x = X[n-1]
    for k in range(1,n+1):
        for s in range(2501):
            dp[n][k][s] = dp[n-1][k][s]
            if s>=x:
                dp[n][k][s] += dp[n-1][k-1][s-x]
print(sum(dp[N][k][k*A] for k in range(1,N+1)))

Measured memory_bytes: 112220
/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;
public class Main {
	public static void main (String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt(), x = sc.nextInt();
	    int min =10002;
	    int sum = 0;
	    int cnt =0;
	    for(int i=0;i<n;i++){
	        int t =sc.nextInt();
	        sum+=t;
	        min = Math.min(min, t);
	    }
	    cnt+=n;
	    int val = x-sum;
	    //System.out.println(val);
	    
	    System.out.println(cnt+val/min);
	}
}

Measured memory_bytes: 21716
from math import ceil

N, K = map(int, input().split())
A = list(map(int, input().split()))


def check(l):
    cnt = sum(ceil(a / l) - 1 for a in A)
    return cnt <= K

lb, ub = 0, max(A)
for _ in range(50):
    mid = (lb + ub) / 2
    if check(mid):
        ub = mid
    else:
        lb = mid
print(ceil(ub))

Measured memory_bytes: 31156
mcxi = {"m": 1000, "c": 100, "x": 10, "i": 1}
nums = [str(i) for i in range(2, 10)]

def calc(s):
    tmp = 0
    while s:
        c = s.pop()
        if c in nums:
            a = int(c)
            if len(s) == 0:
                tmp += a
                break
            c = s.pop()
            tmp += a * mcxi[c]
        else:
            tmp += mcxi[c]
    return tmp

n = int(input())
for _ in range(n):
    mcxis = input().split()
    a = ' '.join(mcxis[0]).split()[::-1]
    b = ' '.join(mcxis[1]).split()[::-1]
    tmp = calc(a) + calc(b)
    m, tmp = divmod(tmp, 1000)
    c, tmp = divmod(tmp, 100)
    x, i = divmod(tmp, 10)
    ans = ""
    if m > 0:
        ans += str(m)+"m"
    if c > 0:
        ans += str(c)+"c"
    if x > 0:
        ans += str(x)+"x"
    if i > 0:
        ans += str(i)+"i"
    print(ans.replace("1", ""))

Measured memory_bytes: 7612