akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

int v[1000];
int w[1000];
int dp[1001][1001];

int main(){
	int W,N;
	int idx = 1;
	while(~scanf("%d",&W)){
		if(W==0) break;
		memset(dp,0,sizeof(dp));

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

		for(int i=0;i<N;i++){
			for(int j=0;j<=W;j++){
				
				if(j-w[i] >= 0){
					dp[i+1][j] = max(dp[i][j-w[i]] + v[i],dp[i][j]);
				}
				else{
					dp[i+1][j] = dp[i][j];
				}
			}
		}

		int resv = 0;
		int resw = 0;
		for(int j=0;j<=W;j++){
			if(dp[N][j] > resv){
				resv = dp[N][j];
				resw = j;
			}
		}

		printf("Case %d:\n%d\n%d\n",idx++,resv,resw);
	}
}

Measured memory_bytes: 5116
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vll vector<ll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define Fo(i,s,e) for(ll i=(s);(s>e)?i>e:i<e;(s>e)?i--:i++)
ll mod1 = 1e9 + 7;
ll mod2 = 998244353;

//ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}







int main(){
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll ans = 0;
    ll cg[n+1],cr[n+1],cb[n+1];
    fo(i,n+1)cr[i]=cg[i]=cb[i]=0;
    for(ll i =n-1;i>=0;i--){
        cr[i] = cr[i+1] + (s[i]=='R');
        cg[i] = cg[i+1] + (s[i]=='G');
        cb[i] = cb[i+1] + (s[i]=='B');
    }
    fo(i,n-3){
        if(s[i]=='R'){
            for(ll j = i+1;j<n-1;j++){
                ll f = 0;
                if(s[j]=='G'){
                    if(s[j+j-i]=='B')f = 1;
                    ans+=cb[j+1];
                    if(f&&ans>0)ans--;
                }
            }
            for(ll j = i+1;j<n-1;j++){
                ll f = 0;
                if(s[j]=='B'){
                    if(s[j+j-i]=='G')f = 1;
                    ans+=cg[j+1];
                    if(f&&ans>0)ans--;
                }
            }


        }
        if(s[i]=='B'){
            for(ll j = i+1;j<n-1;j++){
                ll f = 0;
                if(s[j]=='G'){
                    if(s[j+j-i]=='R')f = 1;
                    ans+=cr[j+1];
                    if(f&&ans>0)ans--;
                }
            }
            for(ll j = i+1;j<n-1;j++){
                ll f = 0;
                if(s[j]=='R'){
                    if(s[j+j-i]=='G')f = 1;
                    ans+=cg[j+1];
                    if(f&&ans>0)ans--;
                }
            }


        }
        if(s[i]=='G'){
            for(ll j = i+1;j<n-1;j++){
                ll f = 0;
                if(s[j]=='R'){
                    if(s[j+j-i]=='B')f = 1;
                    ans+=cb[j+1];
                    if(f&&ans>0)ans--;
                }
            }
            for(ll j = i+1;j<n-1;j++){
                ll f = 0;
                if(s[j]=='B'){
                    if(s[j+j-i]=='R')f = 1;
                    ans+=cr[j+1];
                    if(f&&ans>0)ans--;
                }
            }


        }


    }
    cout<<ans<<endl;
	
	
}

Measured memory_bytes: 3736
#include <stdio.h>
int main(){
  int n,b,f,r,v,i,j,k;
  scanf("%d",&n);
  int house[4][3][10]={0};
  for(i=0;i<n;i++){
    scanf("%d %d %d %d",&b,&f,&r,&v);
    house[b-1][f-1][r-1]+=v;
    if(house[b-1][f-1][r-1]<0)house[b-1][f-1][r-1]=0;
    if(house[b-1][f-1][r-1]>9)house[b-1][f-1][r-1]=9;
  }
  for(i=0;i<4;i++){
    for(j=0;j<3;j++){
      for(k=0;k<10;k++){
	printf(" %d",house[i][j][k]);
	if(k==9)printf("\n");
      }
    }
    if(i!=3){
      for(j=0;j<20;j++){
	printf("#");
	if(j==19)printf("\n");
      }
    }
  }
  return 0;
}

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

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

  vector<int> t(N);
  rep(i, N) cin >> t[i];

  int ans = T;
  rep(i, N) {
    ans += T;
    if (t[i] < t[i - 1] + T)
      ans -= T - t[i] + t[i - 1];
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc= new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		
		if(a<b) {
			System.out.println("a < b");
		}else
		
		if(a>b) {
			System.out.println("a > b");
		}else {
			System.out.println("a == b");
		}
		
		sc.close();
	}

}



Measured memory_bytes: 26408
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli N;
int main() {
  cin >> N;

  // 4hnw = N(nw + hw + hn)
  // n(4hw - Nh - Nw) = Nhw
  for (lli h = 1; h <= 3500; ++h) {
    for (lli w = 1; w <= 3500; ++w) {
      lli a = 4*h*w - N*h - N*w,
          b = N*h*w;
      if (a > 0 && b >= a && b % a == 0) {
        lli n = b / a;
        cout << h << ' ' << n << ' ' << w << '\n';
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 384
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()
ge = []
l = 1
r = n-1
for i in range(m):
    if i%2:
        ge.append(l)
    else:
        ge.append(r)
    l += 1; r -= 1
ge.sort(reverse = True)
for i in range(m):
    print(i+1,i+1+ge[i])


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

int main() {
  ll n; cin >> n;
  int m = 26;
  int cnt;
  string ans = "";
  while (n != 0) {
    n--;
    ll r = n % m;
    n /= m;
    char c = r + 97;
    ans += c;
    cnt++;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}

Measured memory_bytes: 3636
using AtcoderBeginnerContest160.Questions;
using AtcoderBeginnerContest160.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtcoderBeginnerContest160.Questions
{
    public class QuestionC : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var kn = inputStream.ReadIntArray();
            var k = kn[0];
            var n = kn[1];
            var a = inputStream.ReadIntArray();
            var distances = new int[n];

            for (int i = 0; i < distances.Length - 1; i++)
            {
                distances[i] = a[i + 1] - a[i];
            }

            distances[distances.Length - 1] = k + a[0] - a[a.Length - 1];

            yield return k - distances.Max(i => i);
        }
    }
}


namespace AtcoderBeginnerContest160
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionC();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtcoderBeginnerContest160.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtcoderBeginnerContest160.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 34524
import string

S = input()
C = [i + 2 for i, s in enumerate(S[2:-1]) if s == 'C']
U = [s for s in S[1:] if s in string.ascii_uppercase]

if S[0] == 'A' and len(C) == 1 and len(U) == 1:
    print('AC')
else:
    print('WA')


Measured memory_bytes: 3832
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  int n; cin >> n;
  n %= 10;
  string out;
  if (n==2 || n==4|| n==5 || n==7 || n==9) out = "hon";
  if (n==0 || n==1 ||n==6||n==8) out = "pon";
  if (n==3) out ="bon";
  cout << out << endl;
  return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)
bool a[500][500] = {};
char c[500][500];
bool search(int x,int w,int h,int y) {
	if (x < 0 || x >= w || y < 0 || y >= h) {
		return false;

	}
	else if (c[y][x] == '#') {
		return false;
	}
	if (a[y][x] == true) {
		return false;
	}
	if (c[y][x] == 'g') {
		return true;
	}
	a[y][x] = true;
	if (search(x + 1, w, h, y) || search(x - 1, w, h, y) || search(x, w, h, y + 1) || search(x, w, h, y - 1)) {
		return true;
	}
	else {
		return false;
	}

}

//小文字=大文字+32
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (b / a >= c) {
		cout << c;
	}
	else {
		cout <<b / a;
	}
}
	



Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define str string
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define eps 1e-6
#define pi atan(1) * 4
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000000
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define FORl(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORDl(i, a, b) for (ll i = (a); i >= (b); i--)
using namespace std;
int main () {
  int a, b, c, k;
  scanf("%d %d %d %d", &a, &b, &c, &k);
  while (k && b <= a) b <<= 1, --k;
  while (k && c <= b) c <<= 1, --k;
  if (a < b && b < c) printf("Yes\n");
  else printf("No\n");
  return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main()
{
int n,m;
cin >> n >> m;
vector<int> ac(n),pena(n);

rep(i,m)
{
    int p;
    string s;
    cin >> p >> s;
    p--; //CAUTION!
    if(ac[p]==1) continue;
    if(s=="AC"){
        ac[p]=1;
    }else{
        pena[p]++;
    }
}

int AC = 0,PENA = 0;
rep(i,n)
{
    AC += ac[i];
    if(ac[i]==1) PENA += pena[i]; //CAUTION!
}
cout << AC << ' ' <<PENA << endl;

return 0;
}

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

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

  vector<int> A(N + 1, 0), B(N + 1, 0);
  rep(i, N) {
    cin >> A.at(i + 1) >> B.at(i + 1);
  }

  vector<vector<int>> dp1(N + 2, vector<int>(T + 1, 0));
  vector<vector<int>> dp2(N + 2, vector<int>(T + 1, 0));
  for (int i = 1; i <= N; i++) {
    rep(j, T) {
      dp1.at(i).at(j) = dp1.at(i - 1).at(j);
      if (j >= A.at(i)) {
        dp1.at(i).at(j) = max(dp1.at(i).at(j), dp1.at(i - 1).at(j - A.at(i)) + B.at(i));
      }
    }
  }

  for (int i = N; i >= 1; i--) {
    rep(j, T) {
      dp2.at(i).at(j) = dp2.at(i + 1).at(j);
      if (j >= A.at(i)) {
        dp2.at(i).at(j) = max(dp2.at(i).at(j), dp2.at(i + 1).at(j - A.at(i)) + B.at(i));
      }
    }
  }

  int ans = 0;
  for (int i = 1; i <= N; i++) {
    rep(j, T) {
      ans = max(ans, dp1.at(i - 1).at(j) + dp2.at(i + 1).at(T - 1 - j) + B.at(i));
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 70912
n,k = map(int,input().split())
li = list(map(int,input().split()))
mux = 0
s = 0

def div(n):
    return (n + 1)/2

for i in range(k):
    s += div(li[i])
mux = s 	

for i in range(k,len(li)):
    s -= div(li[i-k])
    s += div(li[i])
    if s > mux:
        mux = s
print(mux)

Measured memory_bytes: 24804
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    return GCD(b, a % b);
}

int main() {
    ll N, M;
    string S, T;
    cin >> N >> M >> S >> T;

    ll gcd = GCD(N, M);
    ll ans = N * M / gcd;
    bool ok = true;
    REP(i, gcd) {
        if (S[i * N / gcd] != T[i * M / gcd]) {
            ok = false;
            break;
        }
    }

    if (ok) cout << ans << endl;
    else    cout << -1 << endl;

    return 0;
}

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

#include <assert.h>    // LON
#include <math.h>    // sqrt()


using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

int main() {

    int n;
    cin >> n;
    vector<int> training_system(n);
    rep(i, n) {
        int a;
        cin >> a;
        a--;
        training_system[i] = a;
    }

    int now = 0;
    int count = 0;
    while (now != 1 && now != -1) {
        int k = training_system[now];
        training_system[now] = -1;
        now = k;
        count++;
    }
    if (now == 1) {
        cout << count << endl;
    } else {
        cout << "-1" << endl;
    }

}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] arr = line.split(" ");
		int a = Integer.parseInt(arr[0]);
		int b = Integer.parseInt(arr[1]);
		int c = Integer.parseInt(arr[2]);
		if (a < b && b < c) System.out.println("Yes");
		else System.out.println("No");
	}
}

Measured memory_bytes: 16956
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if (b / a < c) {
			System.out.println(b / a);
		} else {
			System.out.println(c);;
		}

	}

}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N,x;
    cin >> N >> x;

    vector<int> a(N);

    for(int i=0;i<N;i++){
        cin >> a.at(i);
    }

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

    int ans=0;

    for(int i=0;i<N;i++){
        if(x>=a.at(i)&&i<N-1){
            ans++;
            x -= a.at(i);
        }
        else if(i=N-1){
            if(x==a.at(i)){
                ans++;
            }
            else{}
        }
        else if(x<a.at(i)){
            break;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ff first
#define ss second
const ll mod = 1e9 + 7 ;
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
///////////////////////////////////////////////////////////
const int nmax = 1e6 + 4 ;
vector < int > p(nmax) ;
ll power ( ll x , ll n){
    if(n==0) return 1 ;
    if(n==1) return x ;
    ll y = power(x,n/2);
    if(n%2==0) return multiply(y,y) ;
    return multiply(x,multiply(y,y));
}
//////////////////////////////////////////////////////////
void solve( ){
    /// b[i]=LCM/a[i]
    /// summation of b[i]%mod
    for( int i = 0 ; i < nmax ; i++) p[i] = i ;
    for( int i = 2 ; i < nmax ; i++){
        if(p[i]==i){
            for( int j = i;  j < nmax ; j+=i){
                p[j] = i ;
            }
        }
    }
    int n ; cin >> n ;
    vector < int > a(n) ;
    for( int i = 0 ; i < n; i++) cin >> a[i] ;
    ll lcm = 1 ;
    vector < int > pp(nmax) ;
    for( int i = 0 ; i < n;i++){
        int x = a[i] ;
        while(x!=1){
            int y = p[x];
            int cnt = 0 ;
            while(x%y==0){
                cnt++;
                x/=y;
            }
            //cout << "( " <<  y << " " << cnt << ") " ;
            pp[y] = max(pp[y],cnt);
        }
        //cout << "\n";
    }
    for( int i = 2 ; i < nmax ; i++){
        if(pp[i]!=0)
            lcm = multiply(lcm,power(i,pp[i]));
    }
    //lcm = 499998500001000000 ;
    //cout << lcm << "\n" ;
    ll ans  = 0 ;
    //cout << power(2,10) << " " ;
    for( int i = 0 ; i < n; i++){
        ans = add(ans,multiply(lcm,power(a[i],mod-2)));
        //ans = add(ans,lcm/a[i]);
    }
    cout << ans << "\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test_case=1 ;
    //cin >> test_case ;
    for( int i = 1 ; i <= test_case ; i++){
        solve( );
    }
}


Measured memory_bytes: 8192
#include <stdio.h>

void merge_sort(long long x[], int n)
{
	static long long y[200001] = {};
	if (n == 1) return;
	merge_sort(&(x[0]), n/2);
	merge_sort(&(x[n/2]), (n+1)/2);
	
	int i, p, q;
	for (i = 0, p = 0, q = n/2; i < n; i++) {
		if (p >= n/2) y[i] = x[q++];
		else if (q >= n) y[i] = x[p++];
		else y[i] = (x[p] < x[q])? x[p++]: x[q++];
	}
	for (i = 0; i < n; i++) x[i] = y[i];
}


int main()
{
	int i, N;
	long long K, A[200001], F[200001];
	scanf("%d %lld", &N, &K);
	for (i = 0; i < N; i++) scanf("%lld", &(A[i]));
	for (i = 0; i < N; i++) scanf("%lld", &(F[i]));
	merge_sort(A, N);
	merge_sort(F, N);
	
	long long l = 0, r = A[N-1] * F[N-1], m, k;
	while (l < r) {
		m = (l + r) / 2;
		for (i = 0, k = 0; i < N; i++) if (A[i] * F[N-i-1] > m) k += (A[i] * F[N-i-1] - m + F[N-i-1] - 1) / F[N-i-1];
		if (k > K) l = m + 1;
		else r = m;
	}
	
	printf("%lld\n", l);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 6416
/**
 *    author:  abhishekvtangod
 *    created: 
**/

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

#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define bits(x) __builtin_popcountll(x)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define debug(x) cerr<<#x<<": "<<x<<" "<< endl;

typedef long long int ll;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// oset<pair<ll,ll>> indexed_set;

// struct HASH{
//   size_t operator()(const pair<int,int>&x)const{
//     return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
//   }
// };

void solve(){
	int n;
	cin >> n;
	vector<int> v(n+2);
	ll dp[n+2];
	dp[0] = 0;
	for(int i = 1; i <= n; i++){
		cin >> v[i];
	}
	dp[1] = 0;
	dp[2] = abs(v[2]-v[1]);
	for(int i =3;i<=n;i++){
		dp[i] = min({dp[i-2] + abs(v[i-2]-v[i]), dp[i-1] + abs(v[i-1]-v[i])});
		// cout << dp[i] << " ";
	}
	cout << dp[n] ;
}


int main()
{   
	IOS;

	#ifndef ONLINE_JUDGE
		freopen("C:\\Users\\Thangod\\Desktop\\zAbhi\\input.txt", "r", stdin);
		freopen("C:\\Users\\Thangod\\Desktop\\zAbhi\\output.txt", "w", stdout);
	#endif


	// ll t;cin>>t;
	// while(t--){
		solve();
	// }
	

    return 0;
}

Measured memory_bytes: 4472
#include <iostream>
#include <cmath>
using namespace std;
using ll=long long;

int cnt_digits(ll N){
    int digits = 0;
    while(N > 0){
        N /= 10;
        digits++;
    }
    return digits;
}

int main(){
    ll N;
    cin >> N;
    int buf = cnt_digits(N);
    for(ll A = 1; A <= sqrt(N); ++A){
        if(N % A == 0){
            ll B = N / A;
            int F = cnt_digits(B);
            if(F < buf) buf = F;
        }
    }
    cout << buf << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int check(int i,int down,int up)
{
  int res=0;
  while(i>0)
  {
    res+=i%10;
    i/=10;
  }
  
  
  if(res>=down&&res<=up)
    return 1;
  else
    return 0;
}
int main()
{
  int n,a,b;
  int total=0;
  cin>>n>>a>>b;
  for(int i = 1;i<=n;i++)
  {
    if(check(i,a,b))
    	total+=i;
  }
  cout<<total<<endl;
  return 0;
}

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


int main(){
	string s,t;
	int a[30],b[30];

	cin>>s>>t;

	for(int i=0;i<30;i++)a[i]=b[i]=-1;
	for(int i=0;i<s.size();i++){
		int j=s[i]-'a',k=t[i]-'a';
		if(a[j]==-1)a[j]=k;
		if(b[k]==-1)b[k]=j;
		if(a[j]!=k||b[k]!=j){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
}



Measured memory_bytes: 776
from collections import deque

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

ans = 0 # ans >= 0
for l in range(K+1):
    for r in range(K+1-l):
        if l+r > N: break
        ll_max = K+1-l-r
        for ll in range(ll_max):
            rr = K-l-r-ll
            if not all([0<=val<=N for val in [l,r]]):
                break
            # print("l,ll,r,rr:", l,ll,r,rr)
            if ll>N: ll=N
            if rr>N: rr=N
            l_vs = sorted(vs[:l])
            r_vs = sorted(vs[N-r:])
            ans = max(ans, sum(l_vs)+ sum(r_vs))

            l_remain = l_vs[ll:]
            r_remain = r_vs[rr:]
            # print("l_remain:", l_remain)
            # print("r_remain:", r_remain)
            ans = max(ans, sum(l_remain) + sum(r_remain))

print(ans)


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

using namespace std;

int main(void){
  int n;
  while(cin>>n,n){
    vector<vector<int> > road(15,vector<int>(15,1<<22));
    int maxn = 0;
    for(int i = 0 ; i < 15 ; i ++)road[i][i] = 0;
    
    for(int i = 0 ; i < n ; i ++){
      int a,b,c;
      cin>>a>>b>>c;
      road[a][b] = c;
      road[b][a] = c;
      if(maxn<max(a,b))maxn=max(a,b);
    }
    
    for(int k = 0 ; k <= maxn ; k ++)
    for(int i = 0 ; i <= maxn ; i ++)
    for(int j = 0 ; j <= maxn ; j ++)
      road[i][j] = min(road[i][j], road[i][k] + road[k][j]);
    
    int min = 1<<22;
    int num = 0;
    
    for(int i = 0 ; i <= maxn ; i ++){
      int sum = 0;
      for(int j = 0 ; j <= maxn ; j ++){
        sum += road[i][j];
      }
      if(min>sum){
        min = sum;
        num = i;
      }
      
    } 
    cout<< num << " " << min << endl;
  }
  
}

Measured memory_bytes: 1216
from copy import copy

N = int(input())
AAA = list(map(int, input().split()))
BBB = list(map(int, input().split()))

n_defeated = 0
for idx, (A, B) in enumerate(zip(AAA[:N + 1], BBB)):
    A = AAA[idx]
    Ap1 = AAA[idx + 1]
    mp_b = copy(B)
    # print('0:',AAA, mp_b)
    # position i
    if A > B:
        n_defeated += B
        AAA[idx] -= B
        mp_b = 0
    else:
        n_defeated += A
        AAA[idx] = 0
        mp_b = B - A
    # position i+1
    # print('1:',AAA, mp_b)
    if Ap1 > mp_b:
        n_defeated += mp_b
        AAA[idx + 1] -= mp_b
        mp_b = 0
    else:
        n_defeated += Ap1
        AAA[idx + 1] = 0
        mp_b -= Ap1
    # print('2:',AAA, mp_b)

print(n_defeated)

Measured memory_bytes: 18904
from math import factorial
from Queue import PriorityQueue

FACTORIAL=[factorial(i) for i in xrange(13)]
LEFT,UP,RIGHT,DOWN=0,1,2,3
MOVE=[[0] for u in xrange(13)]
MOVE[0] =[-1,-1,-1, 2]
MOVE[1] =[-1,-1, 2, 5]
MOVE[2] =[ 1, 0, 3, 6]
MOVE[3] =[ 2,-1,-1, 7] 
MOVE[4] =[-1,-1, 5,-1]
MOVE[5] =[ 4, 1, 6, 9]
MOVE[6] =[ 5, 2, 7,10]
MOVE[7] =[ 6, 3, 8,11]
MOVE[8] =[ 7,-1,-1,-1]
MOVE[9] =[-1, 5,10,-1]
MOVE[10]=[ 9, 6,11,12]
MOVE[11]=[10, 7,-1,-1]
MOVE[12]=[-1,10,-1,-1]

def hash(cell):
    work = cell[:]
    hash = 0
    for i in xrange(12):
        hash += work[i] * FACTORIAL[13-1-i]
        for ii in xrange(i+1,13):
            if work[ii]>work[i]:
                work[ii]-=1
    return hash

def dehash(key):
    cell=[]
    for i in xrange(13):
        cell.append(key/FACTORIAL[13-1-i])
        key %= FACTORIAL[13-1-i]
    for i in xrange(13-1,-1,-1):
        for ii in xrange(i+1,13):
            if cell[i]<=cell[ii]:
                cell[ii]+=1
    return cell

def evaluate(cell):
    point=[[0,2],
           [1,1],[1,2],[1,3],
           [2,0],[2,1],[2,2],[2,3],[2,4],
           [3,1],[3,2],[3,3],
           [4,2]]
    eva=0
    for i in xrange(0,13):
        if not (cell[i]==0 or cell[i]==12):
            eva+=abs(point[cell[i]][0]-point[i][0])
            eva+=abs(point[cell[i]][1]-point[i][1])
    return eva

if __name__== "__main__":
    while True:
        p=[input()]
        if p==[-1]:
            break
        for u in xrange(4):
            for pp in map(int,raw_input().split()):
                p.append(pp)
        p[p.index(0)]=12
        pq=PriorityQueue()
        init_hash=hash(p)
        init_eva=evaluate(p)
        pq.put([init_eva,init_hash,0])
        visited={}
        visited[init_hash]=True
        ans=0 if init_eva==0 else "NA"
        count=0
        #cur=[eva,hashkey,step]
        while not pq.empty():
            count+=1
            cur_eva,cur_hash,cur_step=pq.get()
            cur_cell=dehash(cur_hash)
            if not (cur_eva<=20 and ans=="NA"):
                break
            for i in xrange(13):
                if cur_cell[i]==0 or cur_cell[i]==12:
                    for ii in [LEFT,UP,RIGHT,DOWN]:
                        if not MOVE[i][ii]==-1:
                            cur_cell[i],cur_cell[MOVE[i][ii]]=cur_cell[MOVE[i][ii]],cur_cell[i]
                            hashkey=hash(cur_cell)
                            if not hashkey in visited:
                                eva=evaluate(cur_cell)
                                if eva==0:
                                    ans=cur_step+1
                                    break
                                pq.put([evaluate(cur_cell)+cur_step+1,hashkey,cur_step+1])
                                visited[hashkey]=True
                            cur_cell[i],cur_cell[MOVE[i][ii]]=cur_cell[MOVE[i][ii]],cur_cell[i]
        print ans

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


const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main(){
  ll n,k;
  cin >> n >> k;
  mint ans=0;
  for(ll i=k;i<=n+1;++i){
    ll l = (i-1)*i/2;
    ll r = (n-i+1+n)*i/2;
    ans += r-l+1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdlib>
#include<cstdio>
#include<utility>
#include<list>
using namespace std;
int main(){
	int A,B,C,sum=0;
	cin>>A>>B>>C;
	sum = A+B;
	if(sum>=C)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(M)]
P = list(map(int,input().split()))

ans = 0
for b in range(1<<N):
    for i in range(M):
        c = 0
        for s in src[i][1:]:
            if b&(1<<(s-1)):
                c += 1
        if c%2 != P[i]: break
    else:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T = ll> constexpr T TEN(int n) {return (n==0)?1:10*TEN<T>(n-1);}

const int MN = 110;
int h, w;
char g[MN][MN];
int gsm[MN][MN];
int sx, sy;
int ex, ey;

int dx, dy;

int sm(int l, int r, int d, int u) {
    return gsm[u][r] - gsm[d][r] - gsm[u][l] + gsm[d][l];
}

int dp[MN][MN];
int calc(int x, int y) {
    if (ex <= x || ey <= y) return 0;
    if (dp[y][x] != -1) return dp[y][x];
    int ans = 0;
    // x
    ans = max(ans, sm(x, x+1, y, min(ey, y+dy)) + calc(x+1, y));
    // y
    ans = max(ans, sm(x, min(ex, x+dx), y, y+1) + calc(x, y+1));
    return dp[y][x] = ans;
}

void main2() {
    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            gsm[y+1][x+1] = gsm[y+1][x] + gsm[y][x+1] - gsm[y][x];
            if (g[y][x] == 'o') {
                gsm[y+1][x+1]++;
            }
        }
    }
    dx = sx+1; dy = sy+1;
    int ans = 0;
    for (int a = 0; a <= sy; a++) {
        for (int b = 0; b <= sx; b++) {
            ex = w-(sx-b);
            ey = h-(sy-a);
            memset(dp, -1, sizeof(dp));
            ans = max(ans, calc(b, a));
        }
    }
    cout << ans << endl;
}

int main() {
    cin >> h >> w;

    for (int y = 0; y < h; y++) {
        string s; cin >> s;
        for (int x = 0; x < w; x++) {
            g[y][x] = s[x];
            if (g[y][x] == 'E') {
                sx = x; sy = y;
            }
        }
    }

    if (sx > w-1-sx) {
        char g2[MN][MN];
        for (int y = 0; y < h; y++) {
            for (int x = 0; x < w; x++) {
                g2[y][x] = g[y][x];
            }
        }
        for (int y = 0; y < h; y++) {
            for (int x = 0; x < w; x++) {
                g[y][x] = g2[y][w-1-x];
            }
        }
    }
    if (sy > h-1-sy) {
        char g2[MN][MN];
        for (int y = 0; y < h; y++) {
            for (int x = 0; x < w; x++) {
                g2[y][x] = g[y][x];
            }
        }
        for (int y = 0; y < h; y++) {
            for (int x = 0; x < w; x++) {
                g[y][x] = g2[h-1-y][x];
            }
        }
    }

    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            if (g[y][x] == 'E') {
                sx = x; sy = y;
            }
        }
    }

    main2();
    return 0;
}


Measured memory_bytes: 384
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    n = I()
    cnt = 0
    for i in range(1, n+1):
        if len(str(i)) %2 == 1:
            cnt += 1
    print(cnt)

main()



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

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int> > s(m);
    for(int i=0; i<m; i++){
        int k;
        cin >> k;
        // ここでvectorのresizeを行う
        s[i].resize(k);
        for(int j=0; j<k; j++){
            cin >> s[i][j];
            s[i][j]--;
        }
    }

    vector<int> p(m);
    for(int i=0; i<m; i++){
        cin >> p[i];
    }

    int ans=0;
    // ビット全探索
    for(int i=0; i < (1 << n); i++){
        bool flag = true;
        for(int j=0; j<m; j++){ 
            int count = 0;
            for(auto l: s[j]){
                // iのl番目にフラグが立っているかどうか
                if((i >> l) & 1){
                    count++; 
                }
            }
            if(count%2 != p[j]){
                flag=false;
            }
        }
        if(flag){
            ans++;
        }
    }

    cout << ans << endl;
    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==1) {
			System.out.println("Hello World");
		} else {
			int a = sc.nextInt();
			int b = sc.nextInt();
			System.out.println(a+b);
		}
	}
}


Measured memory_bytes: 21844
s = list(input())

if len(set(s)) == 1:
    print(0)
    exit()

ans = 0
tmp = s[0]
state = False
for i in range(1,len(s)):
    if tmp == "B" and s[i] == "W":
        state = True
    elif tmp == "B" and s[i] == "B":
        if state:
            ans += 2
            state = False
            tmp = "B"
    if tmp == "W" and s[i] == "B":
        state = True
    elif tmp == "W" and s[i] == "W":
        if state:
            ans += 2
            state = False
            tmp = "W"

if state:
    ans += 1
print(ans)




Measured memory_bytes: 3956
solver3::Int->Int->Int->Int->Int
solver3 r g b n = sum [solver2 g b (n-(j*r)) | j<-[0..div n r] ]

solver2::Int->Int->Int->Int
solver2 g b n = sum [solver1 b (n-(j*g)) |j<-[0..div n g]]

solver1::Int->Int->Int
solver1 b n = if mod n b == 0 then 1 else 0

main::IO()
main=do
  (r:g:b:n:[])<-return.map read.words=<<getLine
  print (solver3 r g b n)

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

int main() {
  long long h;
  cin >> h;
  long long result = 0;
  long long fork = 1;
  while (h) {
    result += fork;
    fork *= 2;
    h /= 2;
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
N, M, X, Y = list(map(int, input().split()))

x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.append(X)
y.append(Y)

x.sort(reverse=True)
y.sort()

if x[0] < y[0]:
    print("No War")
else:
    print("War")


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<deque>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
template<class T> inline bool chmax(T&a , T b){ if(a<b){ a=b; return true; } else{ return false; } }
template<class T> inline bool chmin(T&a , T b){ if(a>b){ a=b; return true; } else{ return false; } } 

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main(){
    int s,w;
    cin >> s >> w;
    if(s<=w){
        cout << "unsafe" << endl;
    }else{
        cout << "safe" << endl;
    }
    return 0;
}

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

using namespace std;

int n, k;

int main(){
	scanf("%d%d", &n, &k);
	
	long long res = 0;
	
	for(int i = k + 1; i <= n; i++){
		int mx = floor(n / i);
		int lt = n % i;
		
		res += 1LL * mx * (i - k);
		if(k == 0)
		res--;
		
		res += max(0, lt - k + 1);
	}
	
	printf("%lld\n", res);
}


Measured memory_bytes: 256
h,w,k = map(int, input().split())
c = [list(input()) for _ in range(h)]
ans = 0
for ib in range(1<<h):
    for jb in range(1<<w):
        cc = 0
        for i in range(h):
            if ib&(1<<i):continue
            for j in range(w):
                if jb&(1<<j):continue
                cc += c[i][j]=="#"
        if cc==k: ans += 1
print(ans)

Measured memory_bytes: 9012
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)

	if n%2 != 0 {
		fmt.Println(0)
		return
	}

	ans := 0
	divisor := 2 * 5
	for divisor <= n {
		ans += n / divisor
		divisor *= 5
	}
	fmt.Println(ans)
}


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

int n;
double a[88888],L;

bool ch(double m){
  double x=L;
  r(i,86400){
    x -= a[i];
    x += m;
    if(x>L) x=L;
    if(x<0) return 0;
  }
  double y=x;
  r(i,86400){
    y -= a[i];
    y += m;
    if(y>L) y=L;
    if(y<0) return 0;
  }
  return abs(x-y) <1e-15;
}


signed main(){
  while(cin>>n>>L,n){

    r(i,88888)a[i]=0;

    r(i,n){
      int l,r,c;
      cin>>l>>r>>c;
      for(int i=l;i<r;i++){
        a[i]+=c;
      }
    }

    double l=0,r=1e15;
    for(int i=0;i<100;i++){
      double mid=(l+r)/2;
      if(ch(mid)) r=mid;
      else l=mid;
    }

    printf("%.9f\n",l);
  }
}


Measured memory_bytes: 3868
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t1=0;
     string s,t;
     cin>>s>>t;
     int l=s.size();
     for(int i=0;i<l;i++)
     {
        if(s[i]!=t[i])
        {
            t1++;
        }
     }
    cout<<t1<<endl;
}

Measured memory_bytes: 3916
main::IO ()

main = do
  [a, b] <- map read . words <$> getLine
  putStrLn $ judge a b

judge:: Integer -> Integer -> String
judge 1 13 = "Alice"
judge 13 1 = "Bob"
judge a b | a > b   = "Alice"
          | a < b   = "Bob"
          | otherwise = "Draw"


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

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

const ll MOD = 26;

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

  ll tmp = 0;
  string ans;
  while (true) {
    tmp++;
    if (n - pow(MOD, tmp) > 0) {
      n -= pow(MOD, tmp);
      continue;
    }
    n--;

    while (true) {
      char c = n % MOD + 'a';
      ans = c + ans;
      n /= MOD;
      if (n == 0) {
        if (ans.size() != tmp) {
          ll count = tmp - ans.size();
          for (long i = 0; i < count; i++) {
            ans = 'a' + ans;
          }
        }
        break;
      }
    }
    break;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4076
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;

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

  int p[1001];
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  sort(p, p + n);

  int ans = 0;
  for (int i = 0; i < k; i++) {
    ans += p[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
const int maxn = 400000 +10;
const int inf = 0x7f7f7f7f;
int read(){
	int x=0,flag=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')flag=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*flag;
}
char str[maxn];
int n,cnte;
int head[maxn],to[maxn*2],nxt[maxn*2];
int vis[maxn],Max1[maxn],Max2[maxn],dep[maxn],dis[maxn];
int siz[maxn];
int low[maxn],height[maxn];
void AddEdge(int x,int y){ ++cnte;to[cnte]=y;nxt[cnte]=head[x];head[x]=cnte; }
int Dfs(int x,int fa){
	siz[x]=vis[x];
	Max1[x] = Max2[x] = 0;
	dis[x] = inf; dep[x] = 0;

	for(int i=head[x];i;i=nxt[i])if(to[i]^fa){
		int tmp = Dfs(to[i],x); 
		siz[x] = siz[x] + tmp;

		if(tmp) dis[x] = min( dep[to[i]], dis[x] );

		dep[x] = max( dep[to[i]]+1, dep[x] );

		if( Max1[x] == 0 || dep[to[i]] > dep[Max1[x]] ){
			Max2[x] = Max1[x];
			Max1[x] = to[i]; 
		}
		else if( Max2[x] == 0 || dep[to[i]] > dep[Max2[x]] )Max2[x] = to[i];

	}	
//	printf("x:%d dep:%d Max1:%d Max2:%d\n",x,dep[x],Max1[x],Max2[x]);

	return siz[x];
}
void dfs(int x,int fa,int Lim){
//	printf("x:%d Lim:%d\n",x,Lim);

	int t1=dep[Max1[x]]+1,t2=dep[Max2[x]]+1;

	if(Max1[x]==0)t1=0;
	if(Max2[x]==0)t2=0;

	if(Lim>t1){t2=t1;t1=Lim;}
	else if(Lim>t2)t2=Lim;

//	printf("x:%d max1:%d max2:%d\n",x,t1,t2);
	height[x] = min(t2+1,t1-1) ;

	if(!vis[x])low[x]=min(dis[x]+1,((siz[1]-siz[x]>0)?Lim:inf));
	else low[x]=0;

//	printf("x:%d dis[x]:%d Lim:%d\n",x,dis[x],Lim);

	for(int i=head[x];i;i=nxt[i])if(to[i]^fa){
		if(to[i] == Max1[x]) dfs(to[i],x,max(Lim,((Max2[x])?dep[Max2[x]]+1:-inf))+1);
		else dfs(to[i],x,max(Lim,dep[Max1[x]]+1)+1);
	}
}

int main(){
	//freopen("test.in","r",stdin),freopen("test.out","w",stdout);
	n=read();
	for(int i=1;i<=n-1;i++){
		int x,y;
		x=read();y=read();
//		x=i;y=i+1;
		AddEdge(x,y);AddEdge(y,x);
	}

	scanf("%s",str+1);
	for(int i=1;i<=n;i++)if(str[i]=='1')vis[i]=1;

	Dfs(1,0);
	dfs(1,0,0);

	long long Ans=0;
	for(int i=1;i<=n;i++){
		if(low[i]<=height[i])Ans += 1LL * (height[i] - low[i] + 1);
//		printf("i:%d low:%d height:%d\n",i,low[i],height[i]);
	}
	printf("%lld",Ans+1);
	return 0;
}

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

using namespace std;

#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


signed main(){

    IOS;
    string s;
    cin >> s;
    int k;
    cin >>k;

    int n = s.size(),a = 0,b = 0,c = 0, ans = 0,ans1 = 0;

    string S = s;
        for(int i = 1;i<n;i++){
            if(S[i]==S[i-1]){
                S[i] = '0';
                a++;
            }
        }

    string t = s + s;
    for(int i = 1;i<2*n;i++){
        if(t[i]==t[i-1]){
            t[i] = '0';
            b++;
        }

    }
    //cout << s << endl;

    string s1 = s+s+s;
    n = s1.size();

    for(int i = 1;i<n;i++){
        if(s1[i]==s1[i-1]){ s1[i] = '0' ;c++;}

    }

    int sum = a;
    ans = b-a;
    ans1 = c-b;

    if(k%2){
        sum += (k - 1)*(ans1+ans)/2;
    }
    //cout << ans1 << " " << ans << endl;
    if(k%2==0) sum += ((k-1)/2)*ans1 +  k*ans/2;

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc146/abc146_b.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;
  string S;
  cin >> S;

  string ans = "";
  rep(i, S.size()) {
    ans += S[i] + N;
    if (ans[i] > 'Z') ans[i] -= 26;
  }

  cout << ans << endl;
}

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

using namespace std;

#define f first
#define s second
#define pub push_back
#define pob pop_back

typedef vector<int> vi;
typedef vector<vi> graf;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> wgraf;

typedef vector<double> vd;
typedef pair<double,double> dd;
typedef vector<dd> vdd;

typedef uint64_t ui64;

int main(){

	int n, k, q;
	cin >> n >> k >> q;
	
	vi players(n,0);


	int a;

	for(int i = 0; i < q; i++){

		cin >> a;
		a --;

		players[a] ++; 

	}

	if(k > q){

		for(int i = 0; i < n; i++)
			printf("Yes\n");

		return 0;

	}

	int s = q - k + 1;

	for(auto p: players){
		if(p >= s){
			printf("Yes\n");
		}else{
			printf("No\n");
		}
	}


	return 0;
}


Measured memory_bytes: 1152