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

#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
    cin.tie(0); //cinとcoutの同期切り
    ios::sync_with_stdio(false); //iostreamとstdioの同期切り

    int H, W;
    char s[60][60];
    cin >> H >> W;
    FOR(i, 0, 60){
        FOR(j, 0, 60){
            s[i][j] == '_';
        }
    }
    FOR(i, 1, H+1){
        FOR(j, 1, W+1){
            cin >> s[i][j];
        }
    }

    string ans = "Yes";
    FOR(i, 1, H){
        FOR(j, 1, W){
            if(s[i][j] == '#'){
                int siro = 0;
                REP(k, 4){
                    if(s[i+dx[k]][j+dy[k]] == '.') siro++;
                }
                if(siro == 4) ans = "No";
            }
        }
    }

    cout << ans << endl;
    
    return 0;
}

/*****************************************************************************/
/*****   1秒間で処理できるfor文ループの回数                                 *****/
/*****   → 10^8 = 100,000,000 回程度                                      *****/
/*****                                                                   *****/
/*****   sort(a, a+N, greater<int>()); // a[0:N) を大きい順にソート        *****/
/*****                                                                   *****/
/*****                                                                   *****/
/*****   std::cout << std::setprecision(2) << 3.0; // "3"                *****/
/*****   std::cout << std::fixed;                                        *****/
/*****   std::cout << std::setprecision(2) << 3.0; // "3.00"             *****/
/*****                                                                   *****/
/*****************************************************************************/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
ll gcd(ll a,ll b){
	if(b==0)
	return a;
	return gcd(b,a%b);
}
string toBin(ll a) {
	string res = "";
	while (a) {
		res += char((a & 1) + '0');
		a >>= 1;
	}
	reverse(res.begin(), res.end());
	return res;
}
const int mod = 1e9+7;
ll expo(ll base,ll pow){
    ll ans = 1;
    while(pow!=0){
        if(pow&1==1){
            ans = ans*base;
            ans = ans%mod;
        }
        base *= base;
        base%=mod;
        pow/=2;
    }
    return ans;
}
ll inv(ll x){
    return expo(x,mod-2);
}
bool isPal(string ss){
    int len = ss.length();
    for(int i = 0 ; i<len/2 ; i++){
	int comp = len-i-1;
	if(ss[i]!=ss[comp])
		return false;
	}
    return true;
}
double pi = 3.141592653589793238462643;
double error = 0.0000001;
/* -------Template ends here-------- */

const int M = 100001;

int main(){
    //freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
    int n;
    si(n);

    string s1 , s2;
    cin>>s1>>s2;

    int i = 0;
    for(i = 0 ; i<n ; i++){
       // cout<<s1[i]<<"  "<<s2[i]<<endl;
       int len = n - i;
       if(s1.substr(i) == s2.substr(0 , len)){
            cout<<2*i + len<<endl;
            return 0;
       }
    }
    //cout<<i<<endl;
    int nas = 2*(n - i) + i;
    cout<<2*n<<endl;






















}














Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PI 3.14159265358979323846264338327950L
#define MOD 1000000007
#define sz 100005
ll inf = 1e16;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}
ll dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int main()
{
 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  ll n;
  cin>>n;
  string str;
  for(ll i='a';i<='z';i++)
    str+=i;
  if(n<=(ll)str.length())
  {
    cout<<str[n-1];
    return 0;
  }
  string ans;
  while(n>0)
  {
        ans+=str[--n%str.length()];
        n/=str.length();
  }
  reverse(ans.begin(), ans.end());
  cout<<ans;
  return 0;
}


Measured memory_bytes: 3616
import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        int c = stdIn.nextInt();
        int max = a;
        int cnt = 0;

        if(max < b)
            max = b;
        if(max < c)
            max = c;

        int xa = max - a;
        int xb = max - b;
        int xc = max - c;

        cnt = (xa + xb + xc) / 2;

        if((xa + xb + xc) % 2 == 1)
            System.out.println(cnt + 2);
        else
            System.out.println(cnt);
    }
}

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

int main() {
  int N;
  cin >> N;
  int h[N];
  rep(i,N) {
    int a;
    cin >> a;
    h[a-1] = i+1;
  }
  
  rep(i, N) cout << h[i] << " ";
  return 0;
}



Measured memory_bytes: 1152
#include <bits/stdc++.h> 
#include <chrono>
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))


int main(){
    LL A,B,V,W,T;
    cin>>A>>V;
    cin>>B>>W;
    cin>>T;
    if(V>W&&abs(A-B)<=(V-W)*T)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 3636
N = int(input())

# mod = 1
# for n in range(N, 0, -1):
#     mod *= n

g = {}
for idx in range(N):
    x, y = map(int,input().split())
    g[idx] = (x, y)

ans = []
def dfs(curr, d):
    if len(seen) == N:
        ans.append(d)
        return
    
    for i in range(N):
        if i not in seen:
            seen.add(i)
            dis = ((g[curr][0] - g[i][0])**2 + (g[curr][1] - g[i][1])**2)**(1/2)
            dfs(i, d + dis)
            seen.discard(i)
    return    

for i in range(N):
    seen = set([i])
    dfs(i, 0)

ret = 0
for a in ans:
    ret += a
print(ret / len(ans))



Measured memory_bytes: 70968
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e15;
using namespace std;
typedef long long ll;
int main() {
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  REP(i, n) {
    ll h;
    cin >> h;
    if (h >= k) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = list()
y = list()
c = list()
for i in range(M):
    _x, _y, _c = map(int, input().split())
    x.append(_x-1)
    y.append(_y-1)
    c.append(_c)
ans = min(a) + min(b)
for i in range(M):
    ans = min(ans, a[x[i]]+b[y[i]]-c[i])
print(ans)

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

using namespace std;

typedef long long ll;

const ll mod = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  vector<char> res;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == 'B') {
      if (res.size() > 0) res.pop_back();
    }
    else {
      res.push_back(s[i]);
    }
  }
  for (auto c : res) cout << c;
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string s;
    cin >> s;

    int l = s.size(), left, right;
    
    // 最も左の'A'
    for(int i=0;i<l;i++){
        if(s.at(i) == 'A'){
            left = i;
            break;
        }
    }

    // 最も右の'Z'
    for(int i=l-1;i>=0;i--){
        if(s.at(i) == 'Z'){
            right = i;
            break;
        }
    }

    cout << right - left + 1 << endl;

}

Measured memory_bytes: 640
// ref: https://atcoder.jp/contests/abc100/submissions/10524878
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int d, n; cin >> d >> n;
    if(n==100){ n=101; }
    cout << (uint64)pow(100,d) * n << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
const int MAX_H = 105;
const int MAX_W = 105;
char D[MAX_H][MAX_W];

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

void dfs(char c, int y, int x, int w, int h) {
  for (int k = 0; k < 4; k++) {
    int x2 = x + dx[k];
    int y2 = y + dy[k];
    if (0 <= x2 && x2 < w && 0 <= y2 && y2 < h && c == D[y2][x2]) {
      D[y2][x2] = '.';
      dfs(c, y2, x2, w, h);
    }
  }
}

int main() {
  int H, W;

  while (true) {
    cin >> H >> W;
    if (H == 0 && W == 0) break;

    for (int i = 0; i < H; i++) {
      cin >> D[i];
    }

    int res = 0;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        char c = D[i][j];
        if (c != '.') {
          dfs(c, i, j, W, H);
          res++;
        }
      }
    }

    cout << res << endl;
  }

  return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}

	int ans = 0;
	bool ok = true;

	for (int i = 0; i < n; i++) {
		ok = true;
		for (int j = 0; j < i; j++) {
			if (h[j] > h[i]) ok = false;;
		}
		if (ok) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    long long x, t; cin >> x >> t;
    cout << (x - t > 0 ? x - t : 0) << endl;
}


Measured memory_bytes: 256
def main():
    H, W = (int(i) for i in input().split())
    C = [[int(i) for i in input().split()] for j in range(10)]
    A = [[abs(int(i)) for i in input().split()] for j in range(H)]
    determined = set()
    from collections import deque
    notdetermined = deque()
    r = [0] * 10
    for k in range(10):
        r[k] = C[k][1]
    
    from itertools import permutations
    for sel in range(1,10):
        for p in permutations([0,2,3,4,5,6,7,8,9,],sel):
            cur = 0
            k = p[0]
            for i in p[1:]:
                cur += C[k][i]
                k = i
            else:
                cur += C[k][1]
            if cur < r[p[0]]:
                r[p[0]] = cur
    ans = 0
    for row in A:
        for a in row:
            ans += r[a]
    print(ans)

if __name__ == '__main__':
    main()

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

int main(void)
{
    string s;
    cin >> s;
    long long K;
    cin >> K;
    vector<string> count;
    for (long long j = 0; j < s.size(); j++)
    {
        string S;
        for (long long i = 0; i < K; i++)
        {
            if (j+i >= s.size())
            {
                break;
            }
            S.push_back(s[j+i]);
            for (long long k = 0; k < K; k++)
            {
                if (k < count.size())
                {
                    if (S < count[k])
                    {
                        count.insert(count.begin()+k, S);
                        break;
                    }
                    else if (S == count[k])
                    {
                        break;
                    }
                }
                else
                {
                    count.push_back(S);
                    break;
                }
            }
        }
    }
    cout << count[K-1] << endl;
}

Measured memory_bytes: 3628
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace  std;
int n,m,k,sum;
int main()
{
	int i,j;
	scanf("%d%d%d",&n,&m,&k);
	if (k==0)
	{
		printf("Yes");
		return 0;
	}
	for (i=1;i<=n;i++)
	  	for (j=1;j<=m;j++)
	  	{
	  		int x=i+1,y=j-1;
	  		sum=0;
		  	sum=(m-j+1)*i;
		  	if (x<=n&&y>=1)  sum+=(n-x+1)*y;
		  	if (sum==k)  {printf("Yes");return 0;}
	  }
	printf("No");
}

Measured memory_bytes: 256
from operator import itemgetter

h,w = [int(i) for i in input().split()]
n = int(input())
a_list = [(j,int(i)) for j,i in enumerate(input().split(),1)]

a_list = sorted(a_list,key = itemgetter(1), reverse=True)
b_list = [i for i,j in a_list for _ in range(j)]

for i in range(h):
    for j in range(w):
        if i%2 == 0:
            print(b_list[w*i+j],end = " ")
        else:
            print(b_list[w*(i+1)-1-j],end = " ")
    print()

Measured memory_bytes: 4544
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
    char a[10],b[10],c[10];
        int i,j;
         memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        memset(c,0,sizeof(c));
        scanf("%s",&a);
        scanf("%s",&b);
        int len=strlen(b);
        for (i=0,j=len-1;i<len,j>=0 ;i++,j--)
        {
            c[i]=b[j];
        }
        if(strcmp(a,c)==0)
            printf("YES\n");
        else
            printf("NO\n");
  return 0;
}


Measured memory_bytes: 504
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <climits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long long,int> pli;
typedef pair<long long, long long> pll;

const int maxQ = 80;

void populateIdx(vector<int>& target, vector<int>& first, vector<int>& second, int modifier) {
  int i = 0;
  int len = second.size();
  for(auto k : first) {
    while(k+modifier > second[i] && i < len) {
      i ++;
    }
    target.push_back(i);
  }
  return;
}

void findTriplets(vector<int>* pos, vector<int>& qs) {
  vector<ll> prefixSum (1, 0);
  int idxB = 0;
  int lenB = pos[1].size();
  ll sum = 0;
  for(int i=0; i<pos[2].size(); i++) {
    while(pos[2][i] > pos[1][idxB] && idxB < lenB) {
      idxB++;
    }
    sum += idxB;
    prefixSum.push_back(sum);
  }

  vector<int> low;
  populateIdx(low, pos[0], pos[2], 0);

  vector<int> high[maxQ];
  for(int q=0; q<qs.size(); q++) {
    populateIdx(high[q], pos[0], pos[2], qs[q]);
  }
  vector<int> offset;
  populateIdx(offset, pos[0], pos[1], 0);


  for(int q=0; q<qs.size(); q++) {
    ll ans = 0;
    for(int i=0; i<pos[0].size(); i++) {
      int h = high[q][i];
      int l = low[i];
      ans += prefixSum[h] - prefixSum[l] - ((long long)offset[i] * (h-l));
    }
    cout << ans << endl;
  }
  return;
}

int main (int argc, char*argv[]) {
  int n, Q;
  string s;
  cin >> n >> s >> Q;
  vector<int> q;
  for(int i=0; i<Q; i++) {
    int z;
    cin >> z;
    q.push_back(z);
  }

  vector<int> pos[3];
  for(int i=0; i<n; i++) {
    if(s[i] == 'D') {
      pos[0].push_back(i);
    } else if (s[i] == 'M') {
      pos[1].push_back(i);
    } else if (s[i] == 'C') {
      pos[2].push_back(i);
    }
  }
  if(pos[0].empty() || pos[1].empty() || pos[2].empty()) {
    cerr << 0 << endl;
  } else {
    findTriplets(pos, q);
  }
  return 0;
}


Measured memory_bytes: 310008
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define mii make_pair<int, int>
#define mll make_pair<ll, ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vc vector<char>
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 
    ll sum = 0;
    int n;
    cin >> n;
    int j = 0;
    for (int i = 1; i <= n; ++i)
    {
        if (i % 3 && i % 5)
            sum += i;
    }
    cout << sum;
}


Measured memory_bytes: 3648
#include<stdio.h>

int main(void){
    char top;
    int turn, score = 0;
    
    scanf("%c", &top);
    
    for(turn = 0; top != '\n'; turn++){
        if(turn % 2 == 0) score--;
        if(top == 'g') score++;
        scanf("%c", &top);
    }
    
    printf("%ld\n", score);
    
    return 0;
}

Measured memory_bytes: 256
/*
    Ujjawal Pabreja [cuber_coder]
*/
#include <bits/stdc++.h> 
#include <functional> 
using namespace std;
#define speed_cubing    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define ld              long double
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define in              insert
#define ff              first
#define ss              second
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define sz(c)           (ll)c.size()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define rev             reverse
#define Y				"YES"
#define N 				"NO"
#define endl            "\n"
#define debug(x)        cout << #x << " : " << x << endl;
const ll inf = 1e18;  
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;

inline ll add(ll a,ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a,ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a,ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x,ll n){
    if(n == 0){
        return 1;
    }
    if(n&1){
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    } else {
        return pwr(mul(x, x), n / 2);
    }
}
ll modInv(ll n){ 
    return pwr(n, mod - 2); 
}
ll gcd(ll a,ll b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
// ====== Useful functions end ======
 
// ====== Global Variables begin ======

// ====== Global Variables end ======

void speed_solve(){
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll r = 0;
    rep(i,n){
        r += (s[i] == 'R');
    }
    string t(n, 'W');
    rep(i,r){
        t[i] = 'R';
    }
    ll ans = 0;
    rep(i,n){
        ans += (t[i] != s[i]);
    }
    cout << ans / 2 << endl;
}

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    speed_cubing;
    ll test_cases = 1;
    // cin >> test_cases;
    rep(i,test_cases){
        // cout << "Case #" << i + 1 << ": ";
        speed_solve();
    }
    return 0;
}

Measured memory_bytes: 3872
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;


int main() {
  int N;
  vector<int> L;
  int in;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> in;
    L.push_back(in);
  }
  sort(L.begin(), L.end(), greater<int>());

  int sum = 0;
  for (int i = 1; i < N; i++) sum += L[i];

  string ans = (L[0] < sum) ? "Yes" : "No";

  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
typedef long long ll;
using namespace std;

int main(){
  string s,t;
  cin >> s >> t;
  int S,T;
  S=s.size();
  T=t.size();

  int dp[S+1][T+1];
  for(int i=0;i<=S;i++) dp[i][0]=0;
  for(int j=0;j<=T;j++) dp[0][j]=0;
  for(int i=1;i<=S;i++){
    for(int j=1;j<=T;j++){
      if(s[i-1]==t[j-1]) dp[i][j]=dp[i-1][j-1]+1;
      else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
  }

  /*for(int i=0;i<=S;i++){
    for(int j=0;j<=T;j++){
      cout << dp[i][j];
    }
    cout << "\n";
  }*/

  int k=min(S,T);
  char tracks[k];
  fill(tracks,tracks+k,'\0');
  int i=S,j=T;
  while(i!=0 && j!=0){
    if(dp[i][j]==dp[i-1][j]) i=i-1;
    else if(dp[i][j]==dp[i][j-1]) j=j-1;
    else {
      tracks[k-1]=s[i-1];
      k--;
      i--;
      j--;
    }
  }

  for(int i=0;i<min(S,T);i++) {
    if(tracks[i]!='\0'){
      cout << tracks[i];
    }
  }
  cout << "\n";

  return 0;
}


Measured memory_bytes: 35456
import sys
k = int(raw_input())
a = map(int,raw_input().split())
l = 2; r = 2;
for i in range(k-1,-1,-1) :
    tl = (l-1)/a[i] + 1; tr = r/a[i];
    if tl > tr :
        print "-1"; sys.exit(0);
    l = tl * a[i]; r = tr * a[i] + a[i]-1;
print l,r

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<ll,ll> pii;
const int MD = 1e9+7; typedef vector<ll> VL;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, m;
	cin >>n >>m;
	
	vector<VI> dt(m, VI(4));
	
	rep(i, m){
		int p, y;
		cin >>p >>y;
		dt[i] = VI{p, y, i, 0};
	}
	sort(all(dt));
	rep(i, m){
		if(i==0 || dt[i-1][0] != dt[i][0]){
			dt[i][3] = 1;
		}else{
			dt[i][3] = dt[i-1][3] + 1;
		}
	}
	sort(all(dt), [](auto l, auto r){return l[2]<r[2];});

	rep(i, m){
		printf("%06d%06d\n", dt[i][0], dt[i][3]);
	}
	return 0;
}


Measured memory_bytes: 7040
import sys
import io
import math
import re

datalist = input().split()
num_summit = int(datalist[0])

max_height = 0
num_available_site = 0

datalist = input().split()
for num in range(num_summit):
  height = int(datalist[num])
  if height >= max_height:
      max_height = height
      num_available_site += 1

print(num_available_site)

Measured memory_bytes: 3188
mod = 10**9+7
N,K = map(int,input().split())
A = list(map(int,input().split()))
canPositive = 0
Positive = 0
ans = 1
def inv(arg):
    return pow(arg,mod-2,mod)
for i in range(N):
    if A[i] >= 0:
        Positive += 1
if N - K >= 1 and Positive >= 1:
    canPositive = 1
if Positive == 0 and K % 2 == 0:
    canPositive = 1
anslist = []
if canPositive:
    A.sort(key=lambda x:abs(x),reverse=True)
    n = 0
    for a in A[:K]:
        anslist.append(a)
        if a < 0:
           n += 1
    if n % 2 == 1:
        minpos = 0
        minneg = 0
        maxpos = 0
        maxneg = 0
        for i in anslist[::-1]:
            if i > 0:
                minpos = i
                break
        for i in anslist[::-1]:
            if i < 0:
                minneg = i
                break
        for i in A[K:]:
            if i < 0:
                maxneg = i
                break
        for i in A[K:]:
            if i > 0:
                maxpos = i
                break
        if maxneg == 0 or minpos == 0:
            ans *= maxpos*inv(minneg) 
        elif maxpos == 0 or minneg == 0:
            ans *= maxneg*inv(minpos) 
        else:
            if abs(minpos*maxpos) > abs(maxneg*minneg):
                ans *= maxpos*inv(minneg) 
            else:
                ans *= maxneg*inv(minpos) 
else:
    A.sort(key=lambda x:abs(x))
    for a in A[:K]:
        anslist.append(a)
for i in anslist:
    ans *= i
    ans %= mod
print(ans)


Measured memory_bytes: 119368
#include <iostream>


using namespace std;

int euclid(int, int);

int main(void) {
	int a, b, gcd;
	cin >> a >> b;

	cout << euclid(a, b) << "\n";

	return 0;
}

int euclid(int a, int b) {
	int r;
	while (1) {
		r = a % b;
		if (r == 0) {
			return b;
		}
		a = b;
		b = r;
	}
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, K;
int dp[MAX_N];
int A[MAX_N];

void solve() {
	cin >> N >> K;
	rep(i, 0, N) cin >> A[i];
	rep(i, 0, K + 1) {
		rep(j, 0, N) {
			if(i - A[j] >= 0 && dp[i - A[j]] == 0) dp[i] = 1;
		}
	}
	if(dp[K]) cout << "First\n";
	else cout << "Second\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
// #define ll long long
typedef long long ll;
typedef pair<int, int> P;

unsigned int len(unsigned int n)
{
    return n ? len(n/10)+1 : 0;
}

int main(int argc, const char * argv[]) {

  int k,x;
  cin >> k >> x;
  // int min_ = -1000000;
  // int max_ = 1000000;
  repd(i, x-(k-1), x+k){
    cout << i << ' ';
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}

	dp := [100][2]int{}
	for i := 0; i < 100; i++ {
		dp[i][0] = -1
		dp[i][1] = -1
	}
	dp[45][0] = 0

	for d := 44; d >= 0; d-- {
		mask := 1 << uint(d)

		num := 0
		for i := 0; i < n; i++ {
			if (as[i] & mask) > 0 {
				num++
			}
		}

		if dp[d+1][1] >= 0 {
			dp[d][1] = max(
				dp[d][1],
				dp[d+1][1]+mask*max(num, n-num),
			)
		}

		if dp[d+1][0] >= 0 {
			if k&(1<<uint(d)) > 0 {
				dp[d][1] = max(
					dp[d][1],
					dp[d+1][0]+mask*num,
				)
				dp[d][0] = max(
					dp[d][0],
					dp[d+1][0]+mask*(n-num),
				)
			} else {
				dp[d][0] = max(
					dp[d][0],
					dp[d+1][0]+mask*num,
				)
			}
		}
	}

	ans := max(dp[0][0], dp[0][1])
	fmt.Println(ans)
}

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


Measured memory_bytes: 7424
import math
A, B, C, D = map(int, input().split())

lcm = C * D // math.gcd(C, D)

def num_multi(num, lb, ub): # [lb, ub]にnumの倍数がいくつあるのかを返す
    lR = lb // num
    lQ = lb % num

    uR = ub // num
    # uQ = ub % num

    ans = uR - lR
    if lQ == 0:
        ans += 1

    return ans

print((B-A+1) - num_multi(C, A, B) - num_multi(D, A, B) + num_multi(lcm, A, B))


Measured memory_bytes: 9144
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

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

  ll n, k;
  cin >> n >> k;
  ll a[5010];
  rep(i, n) cin >> a[i];
  sort(a, a + n);

  //x番目が必要か
  auto need = [&](ll x) {
    if (a[x] >= k)
      return true;
    bool dp[5010][5010] = {};
    dp[0][0] = true;

    rep(i, n)
    {
      rep(j, k)
      {
        dp[i + 1][j] |= dp[i][j];
        if (i == x)
          continue;
        if (j + a[i] < k)
          dp[i + 1][j + a[i]] |= dp[i][j];
      }
    }

    REP(t, k - a[x], k)
    {
      if (dp[n][t])
        return true;
    }

    return false;
  };
  
  auto binary_search = [&]() {
      ll lo = -1, hi = n;
      while (hi - lo > 1)
      {
        ll mi = (lo + hi) / 2;
        if (need(mi))
            hi = mi;
        else
            lo = mi;
      }
      return hi;
  };

  cout << binary_search() << endl;
  return 0;
}

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

int main() {
  int h,w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i,h) cin >> s[i];
  rep(i,h)rep(j,w) {
    if (s[i][j] == '#') continue;
    else {
      int cnt = 0;
      if (i+1 < h && s[i+1][j] == '#') cnt++;
      if (0<= i-1 && s[i-1][j] == '#') cnt++;
      if (j+1 < w && s[i][j+1] == '#') cnt++;
      if (0 <= j-1 && s[i][j-1] == '#') cnt++;
      if (i+1 < h  && j+1 < w && s[i+1][j+1] == '#') cnt++;
      if (i+1 < h && 0 <= j-1 && s[i+1][j-1] == '#') cnt++;
      if (0 <= i-1 && j+1 < w && s[i-1][j+1] == '#') cnt++;
      if (0 <= i-1 && 0 <= j-1 && s[i-1][j-1] == '#') cnt++;
      s[i][j] = char(cnt + '0');
    } 
  }

  rep(i,h) cout << s[i] << endl;
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
#define endl "\n";
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define POSITIVE_INFINITY 9223372036854775807
#define NEGATIVE_INFINITY -9223372036854775807
#define MOD 1000000007

int main()
{
    FASTER;
    int n;
    cin >> n;
    int x;
    bool all = true;
    for (int i = 0; i < n; i++){
        cin >> x;
        if (x & 1)
            all = false;
    }
    if (all)
        cout << "second\n";
    else
        cout << "first\n";


    return 0;
}


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

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();

        int[] ab = new int[N + 1];
        for (int i = 0; i < N; i++) {
            ab[i] = (in.i() << 8) + in.i();
        }
        ab[N] = Integer.MAX_VALUE;
        Arrays.sort(ab);

        int[] cd = new int[N];
        Arrays.setAll(cd, i -> (in.i() << 8) + in.i());
        Arrays.sort(cd);

        int[] list = new int[N];
        int size = 0;

        int ans = 0;
        for (int i = 0, j = 0; i < N; i++) {
            int c = cd[i] >> 8;
            int d = cd[i] & (1 << 8) - 1;
            while ((ab[j] >> 8) < c) {
                list[size++] = ab[j++] & (1 << 8) - 1;
            }

            int max = -1;
            int l = -1;
            for (int k = 0; k < size; k++) {
                if (list[k] < d && max < list[k]) {
                    max = list[k];
                    l = k;
                }
            }
            if (l > -1) {
                ans++;
                list[l] = list[--size];
            }
        }

        System.out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
}


Measured memory_bytes: 33584
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::io::*;
use std::str::FromStr;

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

use std::cmp::{min};
use std::num;

fn main() {
    
    let n = read::<usize>();
    let a : Vec<i64> = (0..n).map(|_|{read::<i64>()}).collect();
    
    let mut sum = 0;
    for j in 0..n {
        if j % 2 == 0 { sum += a[j % n];}
        else { sum -= a[j % n]; }
    }
    print!("{} ", sum);
    for i in 1..n {
        sum = 2*a[i-1] - sum;
        print!("{} ", sum);
    }
}

Measured memory_bytes: 5372
/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

// MACROS SAMPAH
#define Jehian using
#define Norman namespace
#define Saviero std

Jehian Norman Saviero;

// MACROS TYPE
typedef long l;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;

// MACROS FOR PRINT
#define nl printf("\n")
#define sp printf(" ")

// MACROS FOR ATTRIBUTE
#define fi first
#define se second

// MACROS FOR FUNCTION AND METHOD
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ALL(x) (x).begin(), (x).end()
#define ALLN(x,n) (x), (x)+(n)
#define CUBE(x) (SQR(x)*(x))
#define SET(x,y) fill_n(x, sizeof(x)/sizeof(x[0]), y)
#define SQR(x) ((x)*(x))
#define SSORT(x,sz) sort(ALLN(x,sz))
#define RESET(x) memset((x), 0, sizeof(x))
#define VSORT(x) sort(ALL(x))

// MACROS READ INPUT
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scf(x) scanf("%f", &x)
#define scd(x) scanf("%lf", &x)
#define scld(x) scanf("%Lf", &x)
#define scul(x) scl(x)
#define scull(x) scll(x)

int main() {
	int N;
	sci(N);
	string M[3];
	for (int i = 0; i < 3; ++i) {
		cin >> M[i];
	}
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		set<char> dat;
		dat.insert(M[0][i]);
		dat.insert(M[1][i]);
		dat.insert(M[2][i]);
		ans += dat.size()-1;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		if(n>=400 && n<=599) {System.out.println(8);}
		else if(n>=600 && n<=799) {System.out.println(7);}
		else if(n>=800 && n<=999) {System.out.println(6);}
		else if(n>=1000 && n<=1199) {System.out.println(5);}
		else if(n>=1200 && n<=1399) {System.out.println(4);}
		else if(n>=1400 && n<=1599) {System.out.println(3);}
		else if(n>=1600 && n<=1799) {System.out.println(2);}
		else if(n>=1800 && n<=1999) {System.out.println(1);}
		

 
	}
 
}

Measured memory_bytes: 35636
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  int n;
  cin >> n;
  map<char, int> mp;
  REP(i,n){
    char c;
    cin >> c;
    mp[c]++;
  }
  cout << (mp.size()==3 ? "Three\n": "Four\n");
  return 0;
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
typedef long long ll;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}

ll modpow(ll a, ll p)
{
    if (p == 0)
        return 1;
    if (!(p % 2))
    {
        ll halfP = p / 2;
        ll half = modpow(a, p);
        return half * half % mod;
    }
    else
    {
        return a * modpow(a, p - 1) % mod;
    }
}

ll comb(int a, int b)
{
    if (b > a - b)
        return comb(a, a - b);
    ll ansMul = 1;
    ll ansDiv = 1;
    for (int i = 0; i < b; i++)
    {
        ansMul *= a - i;
        ansDiv *= i + 1;
        ansMul %= mod;
        ansDiv %= mod;
    }
    ll ans = ansMul * modpow(ansDiv, mod - 2) % mod;
    return ans;
}

vector<int> L(200010), R(200010);
vector<vector<int>> X(510, vector<int>(510, 0));
vector<vector<int>> C(510, vector<int>(510, 0));
int main() {
    int N, M, Q; cin >> N >> M >> Q;
    rep(i, M) {
        cin >> L[i] >> R[i];
        X[L[i]][R[i]]++;
    }
    REP(i, 1, N+1) {
        REP(j, 1, N+1) {
            C[i][j] = C[i][j-1] + X[i][j];
        }
    }
    REP(i, 1, Q+1) {
        int p, q; cin >> p >> q;
        int sums = 0;
        int cnt = 0;
        REP(j, p, q+1) {
            sums += C[j][q] - C[j][p-1+cnt];
            cnt++;
        }
        cout << sums << endl;
    }
    return 0;
}

Measured memory_bytes: 4608
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections;

static class Extensions
{
    public static int ToInt(this string s) => int.Parse(s);
    public static long ToLong(this string s) => long.Parse(s);
    public static char ToChar(this string s) => char.Parse(s);
    public static double ToDouble(this string s) => double.Parse(s);
    public static int[] ToIntArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToInt()).ToArray();
    public static long[] ToLongArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToLong()).ToArray();
    public static double[] ToDoubleArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToDouble()).ToArray();
}


class Program
{
    static void Main()
    {
        int X = Console.ReadLine().ToInt();

        int max = 1;

        for(int i = 2; i <= X; i++)
        {
            var cands = beki(i).TakeWhile(n => n <= X);
            if (cands.Any())
            {
                max = Math.Max(max, cands.Last());
            }
        }

        Console.WriteLine(max);
    }

    static IEnumerable<int> beki(int n)
    {
        var nCpy = n;

        while(true)
        {
            n *= nCpy;
            yield return n;            
        }
    }
}


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

const int mod = 1e9+7;
const int N = 10000003;
int prime[N];
unordered_map <ll, ll> max_map;

ll power(ll x, ll y){
	x %= mod;
	if(y == 0) return 1;
	if(y == 1) return x;
	ll num = power(x,y/2) % mod;
	if(y%2 ==  0) return (num*num)%mod;
	else return (((num*num)%mod)*x)%mod;
}

void solve(){
 	
 	ll n;
 	cin >> n;
 	if(n%2 == 0){
 		ll tmp = 10, ans = 0;
 		while(true){
 			ans += n/tmp;
 			if(n/tmp == 0) break;
 			tmp *= 5;
 		}
 		cout << ans;
 	}else{
 		cout << 0;
 	}

	return;
}


int main(){

	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int TC = 1,t = 0;
	// cin >> TC;
	while(t++ < TC){
		solve();
		// cout << "\n";
	}

	// cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

	return 0; 
}

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

int main(){
  int a;
  cin >> a;
  if(a<=599) cout << 8 << endl;
  else if(600<=a && a<=799) cout << 7 << endl;
  else if(800<=a && a<=999) cout << 6 << endl;
  else if(1000<=a && a<=1199) cout << 5 << endl;
  else if(1200<=a && a<=1399) cout << 4 << endl;
  else if(1400<=a && a<=1599) cout << 3 << endl;
  else if(1600<=a && a<=1799) cout << 2 << endl;
  else cout << 1 << endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)

int N, R[100];
int S[100], P[100], C[100];


bool ck()
{
  int pt[101] = {};

  vector< pair< int, int > > vs;
  rep(i, N) vs.emplace_back(S[i], i);
  vector< int > rank(N, 0);
  rep(i, N) rep(j, N) if(vs[i].first < vs[j].first) ++rank[vs[i].second];
  rep(i, N) pt[i] += R[rank[i]];

  vs.clear();
  rep(i, N) vs.emplace_back(P[i], i);
  rank.assign(N, 0);
  rep(i, N) rep(j, N) if(vs[i].first < vs[j].first) ++rank[vs[i].second];
  rep(i, N) pt[i] += R[rank[i]];

  vs.clear();
  rep(i, N) vs.emplace_back(C[i], i);
  rank.assign(N, 0);
  rep(i, N) rep(j, N) if(vs[i].first < vs[j].first) ++rank[vs[i].second];
  rep(i, N) pt[i] += R[rank[i]];

  vs.clear();
  rep(i, N) vs.emplace_back(pt[i], i);
  rank.assign(N, 0);
  rep(i, N) rep(j, N) if(vs[i].first < vs[j].first) ++rank[vs[i].second];

  return (rank[0] <= 7);
}

int main()
{
  cin >> N;
  rep(i, N) cin >> R[i];
  rep(i, N) cin >> S[i] >> P[i] >> C[i];

  int ret = 114514;
  rep(i, 101) {
    S[0] += i;
    if(ck()) ret = min(ret, i);
    S[0] -= i;
  }
  rep(i, 101) {
    P[0] += i;
    if(ck()) ret = min(ret, i);
    P[0] -= i;
  }

  rep(i, 101) {
    C[0] += i;
    if(ck()) ret = min(ret, i);
    C[0] -= i;
  }

  if(ret == 114514) cout << "Saiko" << endl;
  else cout << ret << endl;
}

Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))

using namespace std;

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

const int INF = 1 << 24;
#define N 1000000

int main(void){
	bool is_prime[N+1];
	for(int i=0; i<=N;i++)is_prime[i]=true;
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<=N;i++)
		if(is_prime[i])
			for(int j=2*i;j<=N;j+=i)
				is_prime[j]=false;

	int a,d,n;
	while(1){
		cin >> a >> d >> n;
		if(!a&&!d&&!n)
			break;
		int count=1;
		while(!is_prime[a]||count!=n){
			if(is_prime[a])
				count++;
			a+=d;
		}
		cout<< a << endl;
	}

    return 0;
}

Measured memory_bytes: 2136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r, D; cin >> r >> D;
    vector<int> x(11);
    cin >> x[0];
    rep1(i,11) x[i] = r * x[i - 1] - D;
    rep1(i,11) cout << x[i] << endl; 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <cmath>

using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> k(m), p(m);
    vector< vector<int> > s(m, vector<int>(0));
    for(int i=0;i<m;i++){
        cin >> k.at(i);
        for(int j=0;j<k.at(i);j++){
            int tmp;
            cin >> tmp;
            s.at(i).push_back(tmp);
        }
    }
    for(int i=0;i<m;i++){
        cin >> p.at(i);
    }

    int cnt = 0;
    int pattern_max = pow(2, n) - 1;
    vector<bool> swit(n, false);

    for(int i=0;i<=pattern_max;i++){
        int pnum = i;
        for(int j=0;j<n;j++){
            if(pnum >= pow(2, (n-1)-j)){
                swit.at((n-1)-j) = true;
                pnum -= pow(2, (n-1)-j);
            }
        }

        bool flag = true;
        for(int j=0;j<m;j++){
            int s_cnt = 0;
            for(int l=0;l<k.at(j);l++){
                if(swit.at(s.at(j).at(l)-1))s_cnt++;
            }
            if(s_cnt%2 != p.at(j))flag = false;
        }
        if(flag)cnt++;
        for(int j=0;j<n;j++)swit.at(j) = false;
    }

    cout << cnt << endl;
}

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

int a, b, q;
long long s[100005], t[100005];
int main()
{
	std::cin >> a >> b >> q;
	for (int i = 0; i < a; ++i)
		std::cin >> s[i];
	for (int i = 0; i < b; ++i)
		std::cin >> t[i];

	std::sort(s, s + a);
	std::sort(t, t + b);

	for (int i = 0; i < q; ++i) {
		long long x;
		std::cin >> x;

		auto r1 = std::distance(s, std::lower_bound(s, s + a, x));
		decltype(r1) r2;
		if (r1 > 0)
			r2 = r1 - 1;
		else
			r2 = r1;
		if (r1 >= a)
			r1 = r2;

		auto l1 = std::distance(t, std::lower_bound(t, t + b, x));
		decltype(l1) l2;
		if (l1 > 0)
			l2 = l1 - 1;
		else
			l2 = l1;
		if (l2 >= b)
			l1 = l2;

		long long ans = LLONG_MAX;
		long long r[] = { s[r1],s[r2] };
		long long l[] = { t[l1],t[l2] };
		for (int j = 0; j < 2; ++j)
			for (int k = 0; k < 2; ++k) {
				auto d1 = std::abs(r[j] - x) + std::abs(l[k] - r[j]);
				auto d2 = std::abs(l[k] - x) + std::abs(r[j] - l[k]);
				ans = std::min({ ans,d1,d2 });
			}

		std::cout << ans << std::endl;
	}
	return 0;
}


Measured memory_bytes: 2816