akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
int p = 998244353;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define sq(a) (a)*(a)
int kai_size = 400001;
vel kai(kai_size, 1);
vel ink(kai_size, 1);
vel dist;
int RE() {
	vel v(3, 2);
	return v.at(4);
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, kai_size) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, kai_size) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p; ans *= ink[n - r]; ans %= p;
	return ans;
}
int per(int n, int r) {
	int ans = kai[n] * ink[n - r];
	ans %= p;
	return ans;
}
signed main() {
	make_kai();
	int n, a, b, k; cin >> n >> a >> b >> k;
	int ans = 0;
	rep(i, n+1) {
		int ex = k - a * i;
		int sb = ex / b;
		if (ex%b == 0 and 0 <= sb and sb <= n) {
			ans += com(n, i)*com(n, sb);
			ans %= p;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;


void solve(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int count = 1;
  for(int i=1; i<n; i++){
      if(s[i-1]!=s[i]) count++;
  }
  cout << count << endl;
}

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


Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
int a,b;
int main(){
	scanf("%d%d",&a,&b);
	if (a%b) printf("1\n");else printf("0\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

const int MAX_V = 16;
const int MAX_E = (1<<MAX_V); 
const int INF = INT_MAX / 3; 
const int NONE = -1; 

int V, E;
int dist[MAX_V][MAX_V];
int dp[MAX_E][MAX_V]; //?????£?????????????????????is_visit??§????????¨???????????????v?????§???????????????

// v: ?????¨????????????is_visit: ?????£??????????????????
int dfs(int v, int is_visit) {
	if(dp[is_visit][v] != NONE) return dp[is_visit][v];	
	if(is_visit == (1<<V)-1) return dist[v][0];	
	dp[is_visit][v] = INF;

	rep(i, V) {
		if(is_visit & (1<<i)) continue;
		dp[is_visit][v] = min(dfs(i, (is_visit | (1<<i))) + dist[v][i], dp[is_visit][v]);
	}
	return dp[is_visit][v];
}

int main() {
	cin >> V >> E;		
	fill_n((int *)dist, sizeof(dist) / sizeof(int), INF);
	fill_n((int *)dp, sizeof(dp) / sizeof(int), NONE);
	int s, t, d;
	rep(i, E) {
		cin >> s >> t >> d;
		dist[s][t] = d;
	}

	int is_visit = 0;
	int ans = dfs(0, (is_visit | 1));

	cout << ((ans == INF) ? -1 : ans) << endl;
	return 0;
}

Measured memory_bytes: 5260
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
#define SortAsc(c) std::sort(c.begin(), c.end())
#define SortDesc(c) std::sort(c.rbegin(), c.rend())
int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1};

ll total(ll n) { return n * (n + 1) / 2; }

int main() {
  ll N, K;
  cin >> N >> K;

  ll res = 0;

  for (ll i = K; i <= N + 1; i++) {
    ll n = N + 1;

    ll maxSum = total(N) - total(N - i);
    ll minSum = total(i - 1);
    // cout << "i = " << i << ", maxSum = " << maxSum << ", minSum = " << minSum
    // << endl;
    res += (maxSum - minSum + 1) % MOD;
  }

  cout << res % MOD << endl;
}

/*

2 out of {0 1 2 3} => (3 + 2) - (1 + 0) + 1
2 out of {0 1 2 3 4} => (4 + 3) - (1 + 0) + 1
3 out of {0 1 2 3 4 5} => (5 + 4 + 3) - (2 + 1 + 0) + 1

*/

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define vll vector<ll>
#define fast ios:: sync_with_stdio(false),cin.tie(0);
#define COUT cout<<fixed<<setprecision(9)
#define SET set<ll,greater<ll>>gquiz
#define ITERATOR set<ll,greater<ll>> :: iterator itr
#define V vector<ll>vector
#define sz size()
#define A vector<pair<ll,ll>>vect
ll N=100000,M=100000;
#define B vect.push_back(make_pair(N,M));
 
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k){ll ans=1;
	while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;
}
ll ncr(ll n,ll r){if(n==1 || r==0)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=((ans * n )/i);n--;}return ans;
}
ll ncrsum(ll n,ll r, ll mod){
	if(n==1 || r==0)return 1;
	ll ans=1,sum=1;for(ll i=1;i<=r;i++){ans=(((ans * n )/i)%mod);n--;sum+=ans;sum%=mod;}return sum;
}
bool isprime(ll n){if(n==1 || (n!=2 && n%2==0))return false; if(n==2)return true; 
		for(ll i=3;i<=sqrt(n);i+=2)if(n%i==0)return false; return true; }
		
vll factor(ll n){
	vll ans;
	if(n>0)ans.pb(1);if(n==2)ans.pb(2);
	for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
	return ans;
}
ll numoffactor(ll n){ return factor(n).sz;}
ll gcd(ll a,ll b) 
{ 
	if (a == 0) 
		return b; 
	return gcd(b%a, a); 
} 
 
int main()
{
	ll n,m,k;
	cin>>n>>m>>k;
	if(n>m)
	{
		ll h=k/n;
	    ll w=k%n;
		if(w>0)
		h++;
		cout<<h;
	}
	else
	{
		ll h=k/m;
		ll w=k%m;
		if(w>0)
		h++;
		cout<<h;
	}
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc155/tasks/abc155_e

# dp?
# もしXiが6より大きかったらX(i-1)という上の桁10借りてくればお釣りで枚数が減る
# そうなると上位桁では1枚増えるけどi桁では減る
# 解けなかったね ピッタリ払うときと一枚余分に払うときというアイデアは合ってたけど、一枚余分はdpの数字に反映させるんじゃなくて、前の桁に反映させよう


N = '0' + read()[:-1]
pre_is_kuriagari = False
dp1 = int(N[0])
dp2 = dp1 + 1
for i in ra(1, len(N)):
    n = int(N[i])
    # ピッタリ払うときの最小
    oturi = dp2 + (10 - n)
    pay = dp1 + n
    dp1_new = min(oturi, pay)

    # 1多く払うときの最小
    oturi = dp2 + (10 - (n + 1))
    pay = dp1 + n + 1
    dp2_new = min(oturi, pay)
    dp1, dp2 = dp1_new, dp2_new
print(dp1)


Measured memory_bytes: 54512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <complex>
#include <numeric>
#include <string.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

ll N, T;
pair<ll,ll> A[3000];
ll ans = 0;
ll dp[3001];

int main() {
    cin >> N >> T;
    rep(i,N) cin >> A[i].first >> A[i].second;
    sort(A, A+N);
    for (int i = 0; i < N; i++) {
        for (int j = T-1; j >= 0; j--) {
            ans = max(ans, dp[j]+A[i].second);
            if (j+A[i].first < T) {
                dp[j+A[i].first] = max(dp[j+A[i].first], dp[j]+A[i].second);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct restaurant{
    string name;
    int score;
    int number;
};

bool cmp(const restaurant &a, const restaurant &b){
    if (a.name == b.name) return a.score > b.score;
    return a.name < b.name;
}
int main() {
    int N=0;
    cin >> N;
    vector<restaurant> restaurant_array(N);
    for (int i = 0; i < N; ++i) {
        cin >> restaurant_array[i].name >> restaurant_array[i].score;
        restaurant_array[i].number = i+1;
    }
    for (int i = 0; i < N; ++i) {
        stable_sort(restaurant_array.begin(), restaurant_array.end(),cmp);
    }
    for (int i = 0; i < N; ++i) {
        cout << restaurant_array[i].number<< endl ;
    }
    return 0;
}

Measured memory_bytes: 764
/*author  ADITYA BANSAL
         MNNIT ALLAHABAD     */
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace std;
#define ll long long
ll power(ll,ll);
ll mul(ll a,ll b);
#define watch(x) cerr<<(#x)<<"is"<<x<<nl;
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi(a,b) for(ll i=a; i<b; i++)
#define fk(a,b) for(ll k=a; k<b; k++)
#define fri(a,b) for(ll i=a; i>b; i--)
#define fj(a,b) for(ll j=a; j<b; j++)
#define ffi(a,b) for(ll i=a;i*i<=b;i++)
#define mp make_pair
#define ff first 
#define  tc ll t; cin>>t; while(t--)
#define all(v) (v).begin(),(v).end()
#define ss second
#define pb push_back
#define mem(v) memset((v),0,sizeof(v));
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define sll set<ll>
#define vll vector<ll>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ad(a,b)  (a%mod+b%mod+mod)%mod
#define pob pop_back
#define nl endl
const int mod=1e9+7;
const ll  N=100002LL;

signed main(){ fast
  
  
  
   //tc
  // calc();
 {   ll h[100001],n;
	 ll dp[100001];
	 mem(dp)
	 cin>>n;
	 fi(1,n+1) cin>>h[i];
	 
	 dp[1]=0;
	 dp[2]=abs(h[2]-h[1]);
	
	fi(3,n+1) dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
	
	fi(1,n+1) cerr<<dp[i]<<" "; 
	 cout<<dp[n]<<nl;
	  
 }
    return 0;
}


/******************************************************************************/

ll mul(ll a,ll b){
    return ((a)*1LL*(b))%13;
}

ll power(ll a,ll n){
  ll res=1;
  while(n){
      if(n&1) res= mul(res,a);
     n>>=1; 
     a= mul(a,a);
  }
    return res;
}


Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long N = scan.nextLong();
        if (N <= 2) {
            System.out.println(2);
        } else if (N % 2 == 0) {
            System.out.println(N);
        } else {
            System.out.println(N * 2);
        }
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

int main(){
  string s,t;
  cin>>s>>t;
  int n=s.size();
  bool ans=true;
  rep(i,n){
    if(s.at(i)!=t.at(i))
      ans=false;
  }
  if(ans)
    Yes;
  else
    No;
}

Measured memory_bytes: 3600
// 問題名: The Number of Inversions
// URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_D&lang=jp
// 所要時間: 20分
// --感想--
// 転倒数の計算は平衡二分木やセグメント木を使った実装しかしたことがなかったため、マージソートを用いた実装が
// 経験できて勉強になった。

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

int a[200010];
// [l,r)での反転数とソートした配列を返す
pair<long long, vector<int> > calc(int l, int r){
    long long ans = 0;
    vector<int> v;
    if(l + 1 == r)
        v.push_back(a[l]);
    else if(l + 1 < r){
        int c = (l + r) / 2;
        pair<long long, vector<int> > p1 = calc(l, c), p2 = calc(c, r);
        ans = p1.first + p2.first;
        int s1 = c - l, s2 = r - c; // 左半分、右半分の数列の要素数
        int t1 = 0, t2 = 0; // 左半分、右半分の数列から取り出した数
        for (int i = 0; i < r - l; i++){
            if(t1 == s1){
                v.push_back(p2.second[t2]);
                t2++;
                ans += s1 - t1;
            }
            else if(t2 == s2){
                v.push_back(p1.second[t1]);
                t1++;
            }
            else if(p1.second[t1] < p2.second[t2]){
                v.push_back(p1.second[t1]);
                t1++;
            }
            else{
                v.push_back(p2.second[t2]);
                t2++;
                ans += s1 - t1;
            }
        }
    }
    return make_pair(ans, v);
}

int main(){
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    cout << calc(0, n).first << endl;
}


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

using namespace std;

typedef long long ll;

#ifdef RED
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

const int N = (int)1e6 + 5;

int n, k;

int main() {
#ifdef RED
  freopen("a.in", "r", stdin);
#endif
  ios_base :: sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    int tall;
    cin >> tall;
    if (tall >= k) {
      ++ans;
    }
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
 
int main(){
    int i,j,k,n,h,ren;
    char card[201],shuf[999],x[201],emp[201];
     
    while(1){
        scanf("%s",card);
        if(card[0]=='-')break;
    ren=strlen(card);
    strcpy(shuf,card);
    scanf("%d",&n);
     
    for(i=0;i<n;i++){
            scanf("%d",&h);
                strncat(shuf,card,h);
        for(j=ren+h;j>=h;j--){
        x[j-h]=shuf[j];
            }
            strcpy(shuf,x);
            strcpy(card,shuf);
        }
        printf("%s\n",shuf);
    }
return 0;
}



Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

using namespace std;

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

template <typename T> void max_self(T& a, T b){
  a = max(a,b);
}

void solve(){	
  ll memo[(int)1e6+1];
  memset(memo,0,sizeof memo);

  ll op = 0;
  for(int i=1;i<1e6+1;i++){
    memo[i] = op;
    if(i%3 == 0) continue;
    if(i%5 == 0) continue;
    op += i;
    memo[i] += i;
  }
  int n;cin>>n;
  cout << memo[n]<<endl;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  //int t; cin >> t;
  //while(t--) solve();
  solve();
  return 0;
}


Measured memory_bytes: 11460
import sys
nq = int(input())
lines = sys.stdin.readlines()
ans = [None] * nq
s = set()
for i in range(nq):
    q, x = lines[i].split()
    if q == '0':    # insert x
        s.add(x)
        ans[i] = str(len(s))
    else:   # find x
        ans[i] = str(int(x in s))

print('\n'.join(ans))


Measured memory_bytes: 54068
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll qrt, hlf,sgl,dbl;
    ll n;
    cin >> qrt >> hlf >> sgl >> dbl >> n;
    ll sum = 0;
    if(dbl > 8 * qrt)
    dbl = 8 * qrt;
    if(dbl > 4 * hlf)
    dbl = 4 * hlf;
    if(dbl > 2 * sgl)
    dbl = 2 * sgl;
    if(sgl > 4 * qrt)
    sgl = 4 * qrt;
    if(sgl > 2 * hlf)
    sgl = 2 * hlf;
    while(n){
        if(n >= 2){
            sum += n / 2 * dbl;
            n -= n / 2 * 2;
        }
        if(n == 1){
            n--;
            sum += sgl;
        }
    }
    cout << sum << endl;
}

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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define se cout << "test ok" << endl;
#define sp << " " <<
using namespace std;
using ll = long long;
using ld = long double;
ll mod = ll(1e9)+7;
ll inf = ll(1e18);
template<typename T1, typename T2> ll ceill(T1 a, T2 b){ return (a+b-1)/b; }
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

namespace dbg {
    using ll = long long;

    class Debug {
    public:
        Debug(){}
        template<typename T>
        void vd(vector<T> vec);
        template<typename T>
        void vd2(vector<vector<T>> vec);
        template<typename T>
        void ad(T *arr, ll n);
        template<typename T, size_t N>
        void ad2(T (&arr)[N], ll n);
        template<typename T>
        void md(T mp);
    };

    template<typename T>
    void Debug::vd(vector<T> vec) {
        for (auto vv : vec) cout << vv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::vd2(vector<vector<T>> vec) {
        for (auto vv : vec) for (auto vvv : vv) cout << vvv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::ad(T *arr, ll n) {
        for (int i = 0; i <= n; i++) cout << arr[i] << " ";
        cout << endl;
    }

    template<typename T, size_t N>
    void Debug::ad2(T (&arr)[N], ll n) {
        for (int i = 0; i <= N; i++) for (int j = 0; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::md(T mp) {
        cout << "key : value" << endl;
        for (auto const &m : mp) cout << m.first << " : " << m.second << endl;
        cout << endl;
    }

}

#endif //INCLUDE_DEBUG_HPP

using dbg::Debug;
Debug debug;

class C100To105 {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll x;
	    in >> x;
	    ll hun = x%100;

        int cnt = 0;
        while(hun > 0){
            for(int i=5; i>0; i--){
                if(hun >= i){
                    hun -= i;
                    break;
                }
            }
            cnt++;
        }

        ll hungt = x/100;
//        cout << hungt sp cnt << endl;
        if(hungt >= cnt) out << 1 << endl;
        else out << 0 << endl;
	}
};


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


Measured memory_bytes: 256
/*
	Solved!
	Time: 05:23:26 PM
	Date: 05-04-2020
*/
#include <bits/stdc++.h>
using namespace std;
 
typedef unsigned long long  ll;
typedef vector<int>         vi;
typedef vector<ll>          vll;

#define ff                  first
#define sf                  scanf
#define pf                  printf
#define ss                  second
#define ppb                 pop_back
#define pb                  push_back
#define MP                  make_pair
#define MAXN                5000005
#define MOD                 100000007
#define inf                 0x3f3f3f3f
#define PI                  (2.0*acos(0.0))
#define INF                 0x3f3f3f3f3f3f3f3f
#define rev(v)              reverse(all(v))
#define all(v)              v.begin(), v.end()
#define __lcm(x, y)         (x * y) / __gcd(x, y)
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define si(n)               scanf("%d", &n)
#define sl(n)               scanf("%lld", &n)
#define sii(a, b)           scanf("%d %d", &a, &b)
#define sll(a, b)           scanf("%lld %lld", &a, &b)
#define siii(a, b, c)       scanf("%d %d %d", &a, &b, &c)
#define slll(a, b, c)       scanf("%lld %lld %lld", &a, &b, &c)
#define siiii(a, b, c, d)   scanf("%d %d %d %d", &a, &b, &c, &d)
#define sllll(a, b, c, d)   scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl;}

int main(){
    /*#ifndef ONLINE_JUDGE
        double start = clock(); READ(); WRITE();
    #endif*/
        int n, k; sii(n, k);
        int ans;
        if(n < k) ans = 0;
        else ans = 10;

        pf("%d\n", ans);

    /*#ifndef ONLINE_JUDGE
        printf("\n>>Runtime: %.10fs\n", (double)(clock() - start) / CLOCKS_PER_SEC);
    #endif*/

    return 0;
}

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

int main () {
	int r;
	cin >> r;
	if (r<1200){
		cout << "ABC" <<endl;
	}
	if (r<2800&&r>=1200){
		cout << "ARC" << endl;
	}
	if (r>=2800&&r<=4208) {
		cout << "AGC" << endl;
	}
	
	return 0;
	

}

Measured memory_bytes: 384
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	s := next()
	t := next()

	sSlice := strings.Split(s, "")
	tSlice := strings.Split(t, "")

	min := len(tSlice)

	for i := 0; i < len(sSlice)-len(tSlice)+1; i++ {
		size := len(tSlice)
		// fmt.Fprintf(out, "%s\n", "check")
		k := 0
		for j := i; j < i+len(tSlice); j++ {
			// fmt.Fprintf(out, "%s:%s\n", sSlice[j], tSlice[k])
			if sSlice[j] == tSlice[k] {
				size--
			}
			k++
		}
		if min > size {
			min = size
		}
	}
	fmt.Fprintf(out, "%d\n", min)
}

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func quickSort(val []int) []int {
	if len(val) < 2 {
		return val
	}

	pivot := val[0]

	left := []int{}
	right := []int{}

	for _, v := range val[1:] {
		if pivot > v {
			left = append(left, v)
		} else {
			right = append(right, v)
		}
	}

	left = quickSort(left)
	right = quickSort(right)

	ret := append(left, pivot)
	ret = append(ret, right...)

	return ret
}


Measured memory_bytes: 1860
#include<stdio.h>
int main()
{
     int n,i,j,cnt=0,temp;
     while(scanf("%d",&n)==1)
     {
          int array[n];
          for(i=0;i<n;i++)
               scanf("%d",&array[i]);
          for(i=0;i<n;i++)
               for(j=n-1;j>=i+1;j--)
          {
               if(array[j]<array[j-1])
               {
                    temp=array[j];
                    array[j]=array[j-1];
                    array[j-1]=temp;
          cnt++;
               }
          }
          for(i=0;i<n;i++)
               {
                    if(i>0)
                       printf(" ");
                    printf("%d",array[i]);
               }
               printf("\n");
               printf("%d\n",cnt);
          for(i=0;i<n;i++)
               array[i]=0;
               cnt=0;
     }
     return 0;
}

Measured memory_bytes: 604
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 62;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    ll n, k;
    cin >> n >> k;

    cout << min(n % k, abs((n % k) - k)) << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
  var n int
  fmt.Scanf("%d", &n)
  var s string
  fmt.Scanf("%s", &s)

  // R 82
  // W 87
  a := 0 // R
  b := 0 // W

  for i := 0; i < len(s); i++ {
    if s[i] == 82 {
      a = a + 1
    }
  }

  var ans int
  if a > b {
    ans = a
  } else {
    ans = b
  }

  for i := 0; i < len(s); i++ {
    if s[i] == 82 {
      a = a - 1
    } else {
      b = b + 1
    }
    var now int
    if a > b {
      now = a
    } else {
      now = b
    }
    if ans > now {
      ans = now
    }
  }
  fmt.Println(ans)
}

Measured memory_bytes: 3272
# /usr/bin/python
# -*- coding: utf-8 -*-
#
import sys
 

Sn = {'M':0,'A':0,'R':0,'C':0,'H':0}
for i in range(int(input())):
  s = str(input())[0]
  if s in Sn:
    Sn[s] += 1

ans = 0
Sn = list(Sn.values())
for i in range(5):
  if Sn[i] == 0:
    continue
  for j in range(i+1,5):
    if Sn[j] == 0:
      continue
    for k in range(j+1,5):
      if Sn[k] == 0:
        continue
      ans += Sn[i]*Sn[j]*Sn[k]

print(ans)




Measured memory_bytes: 45160
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include<list>
#include<map>
#include<utility>
#include<tuple>
#include<numeric>
#include<set>

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

int main()
{
	int a, b;
	cin >> a >> b;
	string ans;
	if ((a*b) % 2 == 0)ans = "Even";
	else ans = "Odd";
	cout << ans << endl;
}



Measured memory_bytes: 256
N, K = map(int, input().split())
p = list(map(int, input().split()))

def calc_e(v):
    if v % 2 == 0:
        return v // 2 + 0.5
    return v // 2 + 1

sum_max = 0
tmp = 0
max_i = 0
for i in range(N):
    sum_max += p[i]
    if i >= K - 1:
        # 合計値の最大値を出す
        if tmp < sum_max:
            # iを管理
            max_i = i
            tmp = sum_max
        sum_max -= p[i-(K-1)]

ret = 0
for i in range(max_i-K+1,max_i+1):
    ret += calc_e(p[i])
print(ret)


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

using namespace std;

int n;
string a;
int main() {
    cin >> n >> a;
    for (int i = 0; i < a.size(); i++)
        cout << (char)((((a[i] - 'A') + n) % 26) + 'A');
    return 0;
}


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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

const int N = 2010;

VI edge[N];

int n, k, dep[N], mxd;

void dfs(int u, int fa, int d)
{
	if (k & 1) if(d > k / 2 + 1) return;
	if (!(k & 1)) if (d > k / 2) return;
	++dep[d];
	mxd = max(mxd, d);
	for (auto v : edge[u])
		if (v != fa)
		{
			dfs(v, u, d + 1);
		}
}

int main()
{
	gii(n, k);
	for (int i = 1; i < n; ++i)
	{
		int u, v;
		gii(u, v);
		edge[u].pb(v);
		edge[v].pb(u);
	}
	int res = 0;
	for (int root = 1; root <= n; ++root)
	{
		int mx = 0, s = 1;
		for (auto son : edge[root])
		{
			mxd = 0;
			dfs(son, root, 1);
			if (k & 1) mx = max(mx, dep[k / 2 + 1]);
			if (k & 1) s -= dep[k / 2 + 1];
			for (int i = 1; i <= mxd; ++i) s += dep[i], dep[i] = 0;
		}
		res = max(res, s + mx);
	}
	printf("%d\n", n - res);
	return 0;
}



Measured memory_bytes: 384
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repe(i, n) REPN(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

Graph graph;
Vec dist;
ll cnt = 0;

int BellmanFord(ll node, ll V){
	dist[node] = 0;
	bool flg = true;
	ll cnt = 0;
	while(flg && cnt < V+5){
		flg = false;
		rep(i, V){
			if(dist[i] == -LINF) continue;
			for(P j : graph[i]) if(chmax(dist[j.sc], dist[i]+j.fs)){
				flg = true;
			}
		}
		cnt++;
	}

	cnt = 0;
	while(flg && cnt < V+5){
		flg = false;
		rep(i, V){
			if(dist[i] == -LINF) continue;
			for(P j : graph[i])
				if(chmax(dist[j.sc], dist[i]+j.fs)){
					dist[j.sc] = LINF;
					flg = true;
					if(j.sc == V-1) return 1;
				}
		}
		cnt++;
	}

	return 0;
}

int main(void){
	ll n, m, p;
	cin >> n >> m >> p;
	graph.resize(n);
	dist.assign(n, -LINF);

	ll a, b, c;
	rep(i, m){
		cin >> a >> b >> c;
		a--, b--;
		graph[a].pb({c-p, b});
	}

	ll res = BellmanFord(0, n);

	if(!res && dist[n-1] != -LINF) co(max(0LL, dist[n-1]));
	else co(-1);

	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define lc (now<<1)
#define rc (now<<1|1)

using namespace std;

const int N=3e5+10;
int w,h,n,top1,stk1[N],top2,stk2[N],mx[N<<2],tag[N<<2],ans;
struct node{int x,y;}a[N];

const bool cmp(node x,node y){return x.x<y.x;}

void build(int now,int l,int r){
	mx[now]=tag[now]=0;
	if (l==r) return;
	int mid=(l+r)>>1;
	build(lc,l,mid); build(rc,mid+1,r);
	mx[now]=max(mx[lc],mx[rc]);
}

void down(int now,int l,int r){
	if (tag[now]){
		mx[lc]+=tag[now],tag[lc]+=tag[now];
		mx[rc]+=tag[now],tag[rc]+=tag[now];
		tag[now]=0;
	}
}

void mdy(int now,int l,int r,int x,int y,int z){
	if (x<=l&&r<=y){tag[now]+=z,mx[now]+=z; return;}
	down(now,l,r);
	int mid=(l+r)>>1;
	if (x<=mid) mdy(lc,l,mid,x,y,z);
	if (y>mid) mdy(rc,mid+1,r,x,y,z);
	mx[now]=max(mx[lc],mx[rc]);
}

void work(){
	sort(a+2,a+1+n,cmp);
	build(1,1,n);
	mdy(1,1,n,1,n,h);
	top1=top2=0; stk1[0]=stk2[0]=1;
	rep (i,2,n){
		mdy(1,1,n,1,i-1,a[i].x-a[i-1].x);
		ans=max(ans,mx[1]);
		if (a[i].y<=h/2){
			mdy(1,1,n,stk1[top1],i-1,0-a[i].y);
			while (top1&&a[stk1[top1]].y<a[i].y){
				mdy(1,1,n,stk1[top1-1],stk1[top1]-1,a[stk1[top1]].y-a[i].y);
				top1--;
			}
			stk1[++top1]=i;
		} else{
			mdy(1,1,n,stk2[top2],i-1,a[i].y-h);
			while (top2&&a[stk2[top2]].y>a[i].y){
				mdy(1,1,n,stk2[top2-1],stk2[top2]-1,a[i].y-a[stk2[top2]].y);
				top2--;
			}
			stk2[++top2]=i;
		}
	}
}

int main(){
	scanf("%d%d%d",&w,&h,&n); ++n;
	rep (i,2,n) scanf("%d%d",&a[i].x,&a[i].y);
	a[++n].x=w,a[n].y=h;
	work();
	swap(w,h); rep (i,1,n) swap(a[i].x,a[i].y);
	work();
	printf("%d\n",ans<<1);
	return 0;
}

Measured memory_bytes: 12800
cnt = 0
R, G, B, N = map(int, input().split())
comb = []
tmp = []
rgb = [R, G, B]

for r in range((N//R)+2):
    for g in range((N//G)+2):
        m = N - r*R - g*G
        if m == 0 or (m % B == 0 and m >= B):
            cnt += 1

print(cnt)


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

using namespace std;

int main() {
  string N;
  cin>>N;
  int sum = 0;
  for(int i = 0; i < N.length(); i++){
    sum += N.at(i) - '0';
  }
  if(sum%9==0) cout<<"Yes";
  else cout<<"No";
  return 0;
}

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

using namespace std;

typedef long long int LL;

#define st first
#define nd second
#define PLL pair <LL, LL>
#define PII pair <int, int>

const int N = 107;
const int MX = 1e9 + 7;
const LL INF = 1LL * MX * MX;

int n, m;
int dp[N][N];
char in[N][N];

int main(){
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; ++i)
		scanf("%s", in[i] + 1);
	
	dp[1][1] = in[1][1] == '#';
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= m; ++j){
			if(i == 1 && j == 1)
				continue;
			
			dp[i][j] = i + j;
			if(i > 1)
				dp[i][j] = min(dp[i][j], dp[i - 1][j] + (in[i - 1][j] == '.' && in[i][j] == '#'));
			if(j > 1)
				dp[i][j] = min(dp[i][j], dp[i][j - 1] + (in[i][j - 1] == '.' && in[i][j] == '#'));
		}
	
	printf("%d\n", dp[n][m]);
	return 0;
}

Measured memory_bytes: 256
def main():
    length = int(input())
    numbers = list(map(int, input().split()))
    even_num = 0
    odd_num = 0
    multiple_of_4 = 0
    for num in numbers:
        if not num % 4:
            multiple_of_4 += 1
        elif not num % 2:
            even_num += 1
        else:
            odd_num += 1
    if multiple_of_4 >= odd_num or (multiple_of_4 + 1 >= odd_num and even_num == 0):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()



Measured memory_bytes: 14252
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

int aa[10000][800];

int main() {
	while (1) {
		memset(aa, 0, sizeof(aa));
		int N, M; cin >> N >> M;
		if (!N)break;
		int R; cin >> R;
		for (int i = 0; i < R; ++i) {

			int t, n, m, s; cin >> t >> n >> m >> s;
			t -= 500;
			m-=1;
			if (s)aa[m][t]++;
			else aa[m][t]--;
		}
		
		for (int i = 0; i < 10000; ++i) {
			for (int j = 0; j < 799; ++j) {
				aa[i][j + 1] += aa[i][j];
			}
		}
		for (int i = 0; i < 10000; ++i) {
			for (int j = 0; j <= 799; ++j) {
				aa[i][j] =min(1,aa[i][j]);
			}
		}
		int Q; cin >> Q;
		for (int i = 0; i < Q; ++i) {
			int s, e, m; cin >> s >> e >> m;
			s -= 500; e -= 500;
			m--;
			int ans = 0;
			for (int j = s; j < e; ++j) {
				ans += aa[m][j];
			}
			cout << ans << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 34260
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+87, M=1e9+7;
int s[N],t[N],x[N],d[N],ans[N];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,q;
    cin >> n >> q;
    vector<pair<int,int>> e;
    for (int i = 0; i < n; ++i) {
        cin >> s[i] >> t[i] >> x[i];
        s[i] -= x[i];
        t[i] -= x[i];
        e.emplace_back(s[i],x[i]);
        e.emplace_back(t[i],-x[i]);
    }
    for (int i = 0; i < q; ++i) {
        cin >> d[i];
        e.emplace_back(d[i], M+i);
    }
    sort(begin(e),end(e));
    multiset<int> st{M};
    for (auto p : e) {
        int x = p.second;
        if (x >= M) {
            ans[x-M] = *begin(st);
        } else if (x > 0) {
            st.insert(x);
        } else {
            st.erase(st.lower_bound(-x));
        }
    }
    for (int i = 0; i < q; ++i)
        cout << (ans[i] == M ? -1 : ans[i]) << '\n';
}


Measured memory_bytes: 20200
n, m, c = map(int, input().split())
b_list = list(map(int, input().split()))

result = 0

for i in range(n):
  total = c
  a_list = list(map(int, input().split()))
  
  for j in range(m):
    total += a_list[j]*b_list[j]
  
  if total > 0:
    result += 1

print(result)


Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
#define N 100050
typedef long long ll;
int n,K,a[N];
ll check(ll mn,ll mx) {
	if(mx<=0) return -mn;
	if(mn>=0) return mx;
	mn=-mn;
	return min(mx+(mx+mn),mn+(mn+mx));
}
int main() {
	scanf("%d%d",&n,&K);
	int i;
	for(i=1;i<=n;i++) {
		scanf("%d",&a[i]);
	}
	ll ans=1ll<<60;
	for(i=1;i<=n-K+1;i++) {
		int mn=a[i],mx=a[i+K-1];
		ans=min(ans,check(mn,mx));
	}
	printf("%lld\n",ans);
}

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define SUM(x) accumulate(ALL(x), 0)
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000

int main()
{
  string s, t; cin >> s >> t;
  REP(i, SIZE(s)) {
    stringstream ss;
    ss << s[SIZE(s) - 1];
    REP(j, SIZE(s) - 1) ss << s[j];
    s = ss.str();
    if (s == t) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
    int n,i,k,j,cnt,ans=0;
    cin>>n;
    vector<int>v;
    int p[1000001]={0};
    for(i=2;i<=1000000;i++){
        cnt=0;
        if(p[i])continue;
        for(j=i;j<=1000000;j+=i){p[j]=1;}
        while(1){
            if(n%i)break;
            cnt++;
            n/=i;
        }
        if(cnt)v.push_back(cnt);
    }
    if(n>1)v.push_back(1);
    n=v.size();
    int b[50];
    b[0]=0;
    for(i=1;i<=45;i++){cnt=0;
        for(j=1;j<=10;j++){
            cnt+=j;
            if(cnt>i){b[i]=j-1;break;}
        }
    }
    for(i=0;i<n;i++){
        ans+=b[v[i]];
        //cout<<ans<<" ";
    }cout<<ans;
    return 0;
}

Measured memory_bytes: 11444
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,x[100];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    for(int j=n-1;j>=0;j--){
        if(j==0){
            cout<<x[j]<<endl;
            break;
        }cout<<x[j]<<" ";
    }
}


Measured memory_bytes: 3088
// B - Do Not Duplicate
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);

	long long n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];

	vector<int> p(200000 + 1, -1);
	vector<long long> next(n);
	for (int i = 0; i < n * 2; i++) {
		if (p[a[i % n]] >= 0) next[p[a[i % n]] % n] = i - p[a[i % n]];
		p[a[i % n]] = i;
	}

	long long x = 0;
	for ( ; ; ) {
		x += next[x % n] + 1;
		if (x % n == 0) break;
	}

	long long m = x / n, r = k % m * n;

	for (x = 0; x + next[x % n] < r; )
		x += next[x % n] + 1;
	vector<int> ans;
	p.assign(p.size(), 0);
	for (long long i = x; i < r; i++) {
		long long j = i % n;
		if (ans.size() > p[a[j]] && ans[p[a[j]]] == a[j])
			ans.resize(p[a[j]]);
		else
			ans.push_back(a[j]), p[a[j]] = ans.size() - 1;
	}

	for (int i = 0; i < ans.size(); i++) cout << (i ? " " : "") << ans[i];
	cout << endl;

	return 0;
}


Measured memory_bytes: 5620
def main():
    n = int(input())
    a = [int(s) for s in input().split()]
    ans = 1
    if 0 in a:
        print(0)
        return
    for i in a:
        ans *= i
        if ans > (10 ** 18):
            ans = -1
            break
    print(ans)
main()

Measured memory_bytes: 21712
package main

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

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans int

func main() {
	reader.Split(bufio.ScanWords)
	N, _ := strconv.Atoi(read())
	H := make([]int, N)
	for i := 0; i < N; i++ {
		H[i], _ = strconv.Atoi(read())
	}

	for i := 0; i < N-1; i++ {
		if H[i+1] == (H[i] - 1) {
			H[i]--
			H[i+1]++
			continue
		}
		if H[i+1] < (H[i] - 1) {
			fmt.Println("No")
			return
		} else if H[i+1] > (H[i] - 1) {
			H[i]--
		}
	}
	fmt.Println("Yes")
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; 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
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy [][]int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i][0] < a[j][0] }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 3072
#include <stdio.h>
int main(void)
{
  int N;
  int a[100000];
  int Flag = 0;
 
  int i;
 
  scanf("%d",&N);
  
  for ( i = 0; i < N; i++)
    scanf("%d",&a[i]);
  
  for ( i = N - 1; i > 0 && Flag == 0; i-- ){
    if ( a[i] < a[i - 1] )
      if ( a[i] != a[i-1] - 1 ){
        Flag = 1;
      }
      else{
        a[i-1] -= 1;
      }
  }
 
  if ( Flag == 1 )
    printf("No\n");
  else
    printf("Yes\n");
 
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

int main(){
    int n, shower;
    std::cin >> n >> shower;

    int ans = 0;
    std::vector<int> t(n);
    std::cin >> t.at(0);
    for(int i = 1; i < n; ++i){
        std::cin >> t.at(i);
        if(t.at(i) - t.at(i - 1) < shower){
            ans += t.at(i) - t.at(i - 1);
        }else{
            ans += shower;
        }
    }

    std::cout << ans + shower << std::endl;

    return 0;
}


Measured memory_bytes: 1024
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())

for i in range(N):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if A[j][k] == b:
                A[j][k] = -1

for j in range(3):
    f = True
    for k in range(3):
        if A[j][k] != -1:
            f = False
    if f:
        print('Yes')
        exit()

for x in range(3):
    f = True
    for y in range(3):
        if A[y][x] != -1:
            f = False
    if f:
        print('Yes')
        exit()

f = True
for x in range(3):
    if A[x][x] != -1:
        f = False
if f:
    print('Yes')
    exit()

f = True
for x in range(3):
    if A[2 - x][x] != -1:
        f = False
if f:
    print('Yes')
    exit()

print('No')



Measured memory_bytes: 3188
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val keys = readLine()!!.split(" ").sorted()
    for (i in 0 until n-1) {
        if (keys[i] == keys[i+1]) {
            return println("NO")
        }
    }
    println ("YES")
}


Measured memory_bytes: 79332
minus :: [Int] -> [Int] -> [Int]
minus (x : xs) (y : ys) = case (compare x y) of
  LT -> x : minus xs (y : ys)
  EQ -> minus xs ys
  GT -> minus (x : xs) ys
minus xs _ = xs

primesToG :: Int -> [Int]
primesToG m = 2 : sieve [3, 5 .. m]
 where
  sieve (p : xs) | p * p > m = p : xs
                 | otherwise = p : sieve (xs `minus` [p * p, p * p + 2 * p ..])
  sieve _ = []

lowerBound'' :: (Ord a) => a -> Int -> Int -> [a] -> Int
lowerBound'' num left right array
  | right == left + 1 = right
  | midValue < num    = lowerBound'' num mid right array
  | otherwise         = lowerBound'' num left mid array
 where
  mid      = (left + right) `div` 2
  midValue = array !! mid

lowerBound :: (Ord a) => a -> [a] -> Int
lowerBound num array | num <= head array = 0
                     | last array < num = length array
                     | otherwise = lowerBound'' num 0 (length array - 1) array

lowerBoundValue :: (Ord a) => a -> [a] -> Maybe a
lowerBoundValue num array | i == length array = Nothing
                          | otherwise         = Just (array !! i)
  where i = lowerBound num array

main :: IO ()
main = do
  [x] <- map read . words <$> getLine
  let Just ans = lowerBoundValue x (primesToG $ 2 * x)
  putStrLn $ show ans

Measured memory_bytes: 2300
from math import ceil
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

K = int(input())
L = list(map(int, input().split()))

maxr = 2
minr = 2
r = 0
for n in reversed(L):
    # [minr,maxr]にnの倍数があるか
    if ceil(maxr//n)*n >= minr:
        minr = ceil(minr/n)*n
        maxr = (maxr)//n*n+n-1
    else:
        print(-1)
        exit()

print(int(minr), maxr)


Measured memory_bytes: 14252