akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
 
#define N 101
  
int color[N],time,d[N],f[N],e[N],v[N],A[N][N],B[N][N];
void DFS(int);
void DFEV(int);
int main(int argc, char *argv[]){
  int i,j,n,v1;
   
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      A[i][j]=0;
    }
  }
  
  scanf("%d",&n);
    
  for(i=1;i<=n;i++){
    scanf("%d%d",&v[i],&e[i]);
    for(j=1;j<=e[i];j++){
      scanf("%d",&v1);
      B[i][j]=v1;
      A[i][v1]= 1;
    }
  }
  DFS(n);
  
  return 0;
}

void DFS(int n){
  int i,u;
   
  for(i=1;i<=n;i++){
    u=v[i];
    color[u]=0;
    time=0;
  }
   
  for(i=1;i<=n;i++){
    u=v[i];
    if(color[u]==0){
      DFEV(u);
    }
    printf("%d %d %d\n",u,d[u],f[u]);
  }
}
void DFEV(int k){
  int v,i;
    
  color[k]=2;
  d[k]=++time;
  
  for(i=1;i<=e[k];i++){
    v=B[k][i];
    if(color[v]==0){
      DFEV(v);
    }
  }
  color[k]=1;
  f[k]=++time;
}
  
  

Measured memory_bytes: 676
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
cnt = Counter(a)
ans = []
for k in sorted(cnt.keys(), reverse=True):
    if len(ans) == 2:
        break
    if cnt[k] >= 4:
        ans.append(k)
        ans.append(k)
    elif cnt[k] >= 2:
        ans.append(k)
if len(ans) < 2:
    print(0)
else:
    print(ans[0] * ans[1])

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

vector<vector<int>>use_v = {
	{0,0,0,0},
	{1,1,0,0},
	{0,1,1,0},
	{0,0,1,1},
	{1,1,1,1}
};

int main() {	
	int H,N;cin>>H>>N;
	vector<vector<int>>obs(H,vector<int>(4));
	for (int i = 0; i < N; ++i) {
		int x,y;cin>>x>>y;
		obs[y][x]=true;
	}

	vector<vector<int>>dp(H,vector<int>(5));
	dp[0][0]=0;

	for (int u = 0; u < H-1; ++u) {
		for (int now_use_id = 0; now_use_id < 5; ++now_use_id) {
			for (int next_use_id = 0; next_use_id < 5; ++next_use_id) {
				vector<int>now_use_v(use_v[now_use_id]);
				vector<int>next_use_v(use_v[next_use_id]);
				bool ok=true;
				for (int i = 0; i < 4; ++i) {
					if (now_use_v[i] && next_use_v[i]) {
						ok=false;
					}
				}
				for (int y = u; y < u + 2; ++y) {
					for (int x = 0; x < 4; ++x) {
						if (next_use_v[x] && obs[y][x]) {
							ok=false;
						}
					}
				}
				int plus=(next_use_id+2)/3;
				if (ok) {
					dp[u+1][next_use_id]=max(dp[u+1][next_use_id],dp[u][now_use_id]+plus);
				}
			}
		}
	}
	int ans=0;
	ans=*max_element(dp[H-1].begin(),dp[H-1].end());
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3916
#include<stdio.h>
int main(void){
    int a,b;
    scanf("%d%d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }
    else if(a>b){
        printf("a > b\n");
    }
    else{
        printf("a == b\n");
    }
}



Measured memory_bytes: 2112
word = gets.chomp
sentence = Array.new
while true do
   line = gets.chomp
   if line == "END_OF_TEXT"
      break
   end
   line.split.each do |w|
      sentence << w
   end
end

w = 0
sentence.each do |val|
   if val.upcase == word.upcase
      w += 1
   end
end

puts w

Measured memory_bytes: 8644
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 1e6 + 10;
int n;
int a[N];
ll ans;
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)scanf("%d", &a[i]);
	sort(a + 1, a + n + 1, greater<int>());
	ans = a[1];
	int cnt = 1, p = 2;
	while (cnt < n - 1) {
		if (n - 1 - cnt >= 2) {
			ans += 2 * a[p++];
			cnt += 2;
		}
		else {
			ans += a[p];
			cnt++;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 4624
#include <iostream>

using namespace std;

int main(void){
  char s[19];
  int i;
  for(i = 0; i < 19; i++){
    cin >> s[i];
    if(s[i] == ','){
      s[i] = ' ';
    }
  }
  for(i = 0; i < 19; i++){
    cout << s[i];
  }
  cout << endl;
  return 0;
}


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

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define ull unsigned long long 
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll; 
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int N  =3e5; 
ll F[20][20] ;

int main(){
	int n ; 
	cin >> n ; 
	ll ans=0; 
	for(int i = 1 ; i <= n ; i++ ){
		int x = i , l ; 
		while ( x ) l = x % 10 , x /= 10 ; 
		F[i%10][l] ++ ; 
	}
	for(int i = 1 ; i <= 9 ; i++ )
		for(int j = 1 ; j <= 9 ; j++ ){
			ans += (F[i][j]*F[j][i]) ; 
		}
	cout << ans << endl; 
}
	 



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N,T,ans;
  cin >> N;
  vector<long long> A(N);
  for (int i=0;i<N;i++) {
	cin >> A[i];
  }
  T=1;
  ans=0;
  for (int i=0;i<N;i++) {
    if (A[i]>=T) {T=A[i];ans++;}
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n, a, b;
	cin >> n >> a >> b;
	int M = min(a, b);
	int m;
	if( a + b <= n ){
		m = 0;
	} else {
		m = a + b - n;
	}
    cout << M << " " << m << endl;
	return 0;
}


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

int main(){

    string N;
    cin >> N;

    int SN = 0;
    for(int i = 0; i < N.length(); i++) SN += N[i] - '0';

    if(stoi(N) % SN == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

int main() {
    ll a, b, n;
    cin >> a >> b >> n;
    ll x = min(b-1, n);
    ll res = a*x / b - a * (x/b);
    cout << res << endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a;
    cin >> n;
    vector<bool> b(8);
    int rest = 0;
    REP(i, n) {
        cin >> a;
        int s = a / 400;
        if (s >= 8) {
            rest++;
        } else {
            b[s] = true;
        }
    }
    int ans = 0;
    REP(i, 8) {
        if (b[i]) ans++;
    }
    cout << max(ans, 1) << " " << ans + rest << endl;
}


Measured memory_bytes: 256
//Compiler optimization
#pragma GCC optimize("Ofast")

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

//typedef
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef string S;
typedef queue<int> qi;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<vl> mat;

//macro
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define fr(i,n)for(ll i=0;i<(n);i++)
#define ifr(i,n)for(ll i=(n)-1;i>=0;i--)
#define all(x) x.begin(),x.end()

//abbreviation
#define pb push_back
#define elif else if
#define mp make_pair
#define endl '\n'

//debug
#define debug(x) cerr << #x << ': ' << x << endl

//const
const  ll INF = 1e18;


int main(){
    ll n;cin >> n;
    S c;cin >> c;
    ll red = 0;
    fr(i,n){
        if(c[i] == 'R')red++;
    }
    ll ans = 0;
    fr(i,red){
        if(c[i]=='W')ans++;
    }
    cout << ans << endl;
}

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

using namespace std;

int main()
{
    string s, s1, s2;
    cin >> s >> s1 >> s2;
    long long n = s.size(), m = s1.size();
    if( s[n - 1] == s1[0] && s1[m - 1] == s2[0] )
    {
        cout << "YES";
    }
    else
        cout << "NO";
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n,m;
    cin>>n>>m;
    vector<int> s(m),c(m);
    rep(i,m) cin>>s[i]>>c[i];
    vector<int> a(n,0);

    if(n==1 && m==0){cout<<0;return 0;}
    if(n==1){
        bool fla=1;
        rep(i,m) if(c[i]!=0){fla=0;}
        if(fla){cout<<0<<endl; return 0;}
    }

    bool flag=1;
    rep(i,m) s[i] --;
    rep(i,m){
        if(a[s[i]]!=0 && a[s[i]]!=c[i]){
            flag=0;
            break;
        }
        a[s[i]]=c[i];
        if(s[i]==0 && c[i]==0){ flag=0;break;}
    }
    if(!flag) {cout<<-1<<endl;return 0;}
    else if(a[0]==0){
        a[0]=1;
    }
    rep(i,n) cout<<a[i];
    cout<<endl;
}

Measured memory_bytes: 256
import math
from functools import reduce
from collections import deque

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n,m = get_nums_l()

lamps = []
for i in range(m):
    lamps.append(get_nums_l()[1:])

p = get_nums_l()

ans = 0
# nビット全パターン
for x in range(2**n):
    ok = True
    for ri,r in enumerate(lamps):
        count = 0
        for a in r:
            count += x&(2**(a-1)) > 0
        if count%2 != p[ri]:
            ok = False
            break
    if ok:
        ans += 1

print(ans)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
map<string,int> mp;

int main(){
	cin>>n;
	int mx=0;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		mp[s]++;
		mx=max(mx,mp[s]);
	}
	for(auto i:mp) if(i.second==mx){
		cout<<i.first<<endl;
	}
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x)+modulo)%modulo)


int main(){
	int N,L;
	cin>>N>>L;
	int sum = 0;
	int mini = 9999999;
	
	for(int i=0;i<N;i++){
		sum += L+i;
		if(abs(mini)>abs(L+i)){
			mini = L+i;
		}
	}
	
	cout<<sum-mini<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double db;
const int oo=2139063143;
const int N=1010000;
const int P=1000000007;
const db eps=1e-7;
#define pritnf printf
//char buf[1<<20|1],*p1=buf,*p2=buf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
    if (x< 0) putchar('-'),x=-x;
    if (x>=10) print(x/10);
    putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
template <typename T1,typename T2>
void chkmax (T1 &A,T2 B) { A=A>=B?A:B; }
template <typename T1,typename T2>
void chkmin (T1 &A,T2 B) { A=A<=B?A:B; }
struct LY { int x,y; }a[N];
void update (int i,int d)
{
	if (a[i].y< d) a[i].y=d;
	if (a[i].y> a[i].x) swap (a[i].y,a[i].x);
}
int n;
int main ()
{
    // freopen (".in","r",stdin);
    // freopen (".out","w",stdout);
	sc(n);
	for (int i=0; i< 1<<n; i++)
	{
		int x; sc(x);
		a[i]=(LY){x,-oo};
	}
	for (int j=0; j< n; j++)
		for (int i=0; i< 1<<n; i++) if (!(i>>j&1))
			update (i|(1<<j),a[i].x),update (i|(1<<j),a[i].y);
	int ans=0;
	for (int i=1; i< 1<<n; i++)
	{
		chkmax (ans,a[i].x+a[i].y);
		pr(ans);
	}

    return 0;
}


Measured memory_bytes: 5420
n = gets.to_i
ans = 0
arr = []
n.times do 
  input = gets.chomp.split(" ")
  arr.push(input)
end
x = gets
arr.reverse.each do |v|
  break if v[0] == x[0..x.length-2]
  ans += v[1].to_i
end
puts ans

Measured memory_bytes: 1788
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,ans=0;
  cin>>N;
  REP(i,N){
    ll a;
    cin>>a;
    if(i%2==0 && a%2==1) ans++;
  }
  co(ans);
  return 0;
}

Measured memory_bytes: 3632
//Daniel Grzegorzewski
#include <bits/stdc++.h>

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

int main()
{
    init_ios();
    string s;
    cin >> s;
    cout<<s.substr(0, 4) + " " + s.substr(4)<<"\n";
}

Measured memory_bytes: 764
#include<iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n, k;
llong T[MAX];

// 最大積載量Pのk台のトラックで何個の荷物を詰めるか？

// 最初はP = mid = 500000000

int check(llong P) {
  int i = 0;
  // k台分まで考えるのでkより小さい間だけforまわす
  for ( int j = 0; j < k; j++ ) {
    llong s = 0;
    // 最初は1台目のものを考える 0+T[0] <= P なので最初は 0+8 <= 500000000　になる
    while ( s + T[i] <= P ) {
      // 0+8 <= 500000000はTrue　Trueの場合はsにT[0]の値を足す。例だとs=8

      s += T[i];
      // 次のやつを比較するためiをインクリメント T[1]になる。例だとT[1]=1
      i++;
      // iとn個の数が一緒ならnを返す（n個入ると同義になる）ここだとi=3(n=3)までs+T[i]<=500000000が成り立つので
      // n=3が返される

      if ( i == n ) return n;
    }
  }
  return i;
}

int solve() {
  llong left = 0;
  llong right = 100000 * 10000; // 荷物の個数　×　1個あたりの最大重量 最初は1000000000
  llong mid;
  //最大重量になるまで続ける
  while ( right - left > 1 ) {
    //現時点の最大重量の”半分”を求める
    mid = ( left + right ) / 2;
    // mid == P を決めて何個積めるかチェック
    //半分量で限界まで詰められるかチェック、最初だとmid = 500000000

    int v = check(mid);
    //v=3, v=nなのでrightの値がmidになる。right = 500000000になる。
    //2週目はright - left > 1より500000000 - 0になるのでTrue, mid = 500000000/2 = 250000000
    //限界まで入れられる量を考える。

    if ( v >= n ) right = mid;
    else left = mid;
  }
  return right;
}

int main() {
  //入力値(cin)をnとkに格納

  cin >> n >> k;
  //入力値2行目以降、重さをTにリストとして格納
  for ( int i = 0; i < n; i++ ) cin >> T[i];
  //solve()の結果をansにいれる

    llong ans = solve();
    //最後（endl）にansをcout(出力)
    cout << ans << endl;
  return 0;
}



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

int main(){
	string S;
	int c;
	bool left,right;
	left=false;
	right=false;
	int a=0;
	int sum=0;
	while(true){
		a=0;
		sum=0;
		left=false;
		right=false;
		cin>>c;
		if(c==0){
			break;
		}
		for(int i=0;i<c;i++){
			cin>>S;
			if(S=="lu"){
				left=true;
			}
			if(S=="ru"){
				right=true;
			}
			if(S=="ld"){
				left=false;
			}
			if(S=="rd"){
				right=false;
			}
			if(a==0 && (left==true && right==true)){
				sum++;
				a=1;
			}
			if(a==1 && (left==false && right==false)){
				sum++;
				a=0;
			}
		}
		cout<<sum<<endl;

	}
	return 0;
}

Measured memory_bytes: 1208
#include <iostream>

using namespace std;

static const int ARRAY_NUM = 10;

class sort{
private:
	int tmp;
public:
	int* bable(int a[]);
};

int* sort::bable(int a[]){
	for(int i=0;i<ARRAY_NUM;++i){
		for(int j=ARRAY_NUM-1;j>i;--j){
			if(a[j]>a[j-1]){
				tmp    = a[j-1];
				a[j-1] = a[j];
				a[j]   = tmp;
			}
		}
	}
	return a;
}

int main(void){

	sort sort;
	int hgt_mt[10];
	int* hgt_max;

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

	hgt_max = sort.bable(hgt_mt);

	for(int i=0;i<3;i++){
		cout << hgt_max[i] << endl;
	}

	return 0;
}

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

#define ll long long
#define ull unsigned long long

#define pii pair < int, int >
#define pll pair < ll, ll >
#define pci pair < char, int >
#define psi pair < string, int >

#define vi vector < int >
#define vll vector < ll >
#define vs vector < string >
#define vc vector < char >
#define pvi vector < pii >
#define pvll vector < pll >

#define pb push_back

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;

int main()
{
    fast;

    int l, r, d;

    cin >> l >> r >> d;

    int cnt = 0;

    for(int i = l; i <= r; ){
        if(i % d == 0){
            cnt++;
            i += d;
        }
        else i++;
    }

    cout << cnt << endl;

    return 0;
}



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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && b != c || b == c && c != a || c == a && a != b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
using namespace std;

#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;

int main() {
  for (int i = 0; i < 7; i++) {
    int h, l;
    cin >> h >> l;
    cout << h - l << endl;
  }
}

Measured memory_bytes: 1160
n = str(input())
if n[-1] == '2' or n[-1] == '4' or n[-1] == '5' or n[-1] == '7' or n[-1] == '9':
    print("hon")
elif n[-1] == '0' or n[-1] == '1' or n[-1] == '6' or n[-1] == '8':
    print("pon")
elif n[-1] == '3':
    print("bon")

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

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

int main(void) {
    int n, a;
    bool flg = true;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    REP(i, n) {
        cin >> a;
        if (a % 2 == 0) {
            if (a % 3 != 0 && a % 5 != 0) {
                flg = false;
            }
        }
    }

    cout << (flg? "APPROVED" : "DENIED") << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    int n,x;
    int count=0;
    while(true){
        count=0;
        cin>>n>>x;
        if(n==0&&x==0)
            break;
        for(int i=1;i<=n-2;i++){
            for(int j=i+1;j<=n-1;j++){
                for(int k=j+1;k<=n;k++){
                    if(i+j+k==x){
                        count++;
                    }
                }
            }
        }
        cout<<count<<endl;
    }
    return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li a[200100];

inline li calc(li x, li y) {
    if (x == y)return x;
    return abs(x - y);
}

int main() {
    li a, b, c;
    cin >> a >> b >> c;
    cout << a << " ";
    cout << b << " ";
    cout << 3 * c - a - b << endl;
    cout << 4 * c - b - 2 * a << " ";
    cout << c << " ";
    cout << 2 * a + b - 2 * c << endl;
    cout << a + b - c << " ";
    cout << 2 * c - b << " ";
    cout << 2 * c - a << endl;

    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Usize1};
use proconio::{fastout, input};
use std::collections::HashMap;
#[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }
    let mut map: HashMap<usize, usize> = HashMap::new();
    let mut ans = 0;
    for i in a.iter() {
        map.entry(*i).and_modify(|e| *e += 1).or_insert(1);
        if map.get(&*i).unwrap() > i {
            ans += 1;
        }
    }
    for (i, v) in map.iter() {
        if i > v {
            ans += v;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 7128
#include <iostream>
using namespace std;
 
int main() {
 int x, y;
 cin >> x >> y;
 if (x == 1) {
   if (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y ==12)
     cout << "Yes";
   else
     cout << "No";
 }
  if (x == 2) {
    if (y == 2)
      cout << "Yes";
    else
      cout << "No";
 }
  if (x == 3) {
   if (y == 1 || y == 3 ||  y == 5 || y == 7 || y == 8 || y == 10 || y ==12)
     cout << "Yes";
   else
     cout << "No";
 }
   if (x == 4) {
   if (y == 4|| y == 6 ||  y == 9 || y == 11)
     cout << "Yes";
   else
     cout << "No";
 }
   if (x == 5) {
   if (y == 1 || y == 3 ||  y == 5 || y == 7 || y == 8 || y == 10 || y ==12)
     cout << "Yes";
   else
     cout << "No";
 }
     if (x == 6) {
   if (y == 4|| y == 6 ||  y == 9 || y == 11)
     cout << "Yes";
   else
     cout << "No";
 }
     if (x == 7) {
   if (y == 1 || y == 3 ||  y == 5 || y == 7 || y == 8 || y == 10 || y ==12)
     cout << "Yes";
   else
     cout << "No";
 }
     if (x == 8) {
   if (y == 1 || y == 3 ||  y == 5 || y == 7 || y == 8 || y == 10 || y ==12)
     cout << "Yes";
   else
     cout << "No";
 }
       if (x == 9) {
   if (y == 4|| y == 6 ||  y == 9 || y == 11)
     cout << "Yes";
   else
     cout << "No";
 }
       if (x == 10) {
   if (y == 1 || y == 3 ||  y == 5 || y == 7 || y == 8 || y == 10 || y ==12)
     cout << "Yes";
   else
     cout << "No";
 }
        if (x == 11) {
   if (y == 4|| y == 6 ||  y == 9 || y == 11)
     cout << "Yes";
   else
     cout << "No";
 }
         if (x == 12) {
   if (y == 1 || y == 3 ||  y == 5 || y == 7 || y == 8 || y == 10 || y ==12)
     cout << "Yes";
   else
     cout << "No";
 }
}

Measured memory_bytes: 3532
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値

int main() {
    // input
    ll N, x, half;
    cin >> N;
    half = N/2;
    vector<ll> vec_A, vec_B, A(100010, 0), B(100010, 0);
    REP(i, N) {
        cin >> x;
        if (i%2 == 0) {
            vec_A.push_back(x);
            A[x]++;
        } else {
            vec_B.push_back(x);
            B[x]++;
        }
    }
    
    // calculation
    ll res_A = 0, a, res_B = 0, b;
    REP(i, 100010) {
        if (res_A < A[i]) {
            res_A = A[i];
            a = i;
        }
        if (res_B < B[i]) {
            res_B = B[i];
            b = i;
        }
    }
    
    ll sec_A = 0, sA, sec_B = 0, sB;
    REP(i, 100010) {
        if (i != a) {
            if (sec_A < A[i]) {
                sec_A = A[i];
            }
        }
    }
    REP(i, 100010) {
        if (i != b) {
            if (sec_B < B[i]) {
                sec_B = B[i];
            }
        }
    }
    
    
    
    if (a == b) {
        ll res = min((half-res_A)+(half-sec_B), (half-sec_A)+(half-res_B));
        cout << res << "\n";
    } else {
        cout << (half - res_A) + (half - res_B) << "\n";
    }
    
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    bool ookii=false;
    bool hikui=false;

    int cnt=1;

    
    for(int i=0;i<n-1;i++){
        
        if(a[i]<a[i+1]){
            ookii=true;
        }
        else if(a[i]>a[i+1]){
            hikui=true;
        }
        if(ookii && hikui){
            ookii=false;
            hikui=false;
            cnt++;
        }
    }
    cout<<cnt;
    
    
    return 0;
    }


Measured memory_bytes: 3716
#include<iostream>
#include<cstring>
using namespace std;
char a[100001],b[100001];
int main()
{
	cin>>a;
	int len=strlen(a);
	for(int i=0;i<len;i++)
	{
		if(a[i]=='p') b[len-i-1]='q';
		if(a[i]=='q') b[len-i-1]='p';
		if(a[i]=='b') b[len-i-1]='d';
		if(a[i]=='d') b[len-i-1]='b';
	}
	//cout<<a<<endl<<b;
	if((strcmp(a,b))==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 384
N = gets.to_i
P = gets.split(" ").map(&:to_i)
# S = gets.chomp

cnt = 0
P.each_with_index do |v, i|
    cnt += 1 if v != (i+1)
end

if cnt <= 2
    puts 'YES'
else
    puts 'NO'
end

Measured memory_bytes: 3836
using System;
using System.Linq;
class p
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    string[] ipt = Console.ReadLine().Split(' ');
    int[] arr = new int[N];
    for (int i = 0; i < N; i++) {
      arr[i] = int.Parse(ipt[i]);
    }
    Console.WriteLine((arr.Length == arr.Distinct().ToArray().Length) ? "YES" : "NO");
  }
}

Measured memory_bytes: 42268
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    if (v.size() == 0) return os;
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    os << v[v.size() - 1];
    return os;
}

void solve() {
    ll n, d;
    cin >> n>> d;
    int cnt = 0;
    REP(i, n) {
        ll x, y;
        cin >> x >> y;
        if (x*x + y*y <= d*d) {
            ++cnt;
        }
    }
    cout << cnt << endl;
}

int main() {
    char tmp;
    while (cin >> tmp) {
        cin.putback(tmp);
        solve();
    }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1<<29;
using Graph = vector<vector<int>>;
int main() {
    int A[4];
    for (int i=0;i<4;++i){
        char x; cin >> x;
        A[i] = x-'0';
    }    
    int tmp;
    string ans;
    for (int bit=0; bit<(1<<3); ++bit){
        tmp = A[0];
        ans = to_string(A[0]);
        for (int i=0;i<3;++i){
            if (bit&(1<<i)) {
                tmp += A[i+1];
                ans += '+'; 
            }else {
                tmp -= A[i+1];
                ans += '-';
            }
            ans += ('0'+A[i+1]);
        }
        if (tmp==7) {
            cout << ans << "=7" << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3704
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vec> mat;
int main(){
    ll n,A[200001];
    cin>>n;
    rep(i,n) cin>>A[i];
    sort(A,A+n);
    int z=1;
    rep(i,n-1) if(A[i]==A[i+1]) z=0;
    if(z) cout<<"YES";
    else cout<<"NO";
}


Measured memory_bytes: 1792
#include <cstdio>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <queue>
#include <numeric>
#include <stack>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  string s; long w;
  cin >> s >> w;
  
  for (long i=0;i<s.size();i+=w) cout << s[i];
  cout << endl;

  return 0;
}








Measured memory_bytes: 888
/*  3_2
    Y_Aizaki    */

#include <stdio.h>

int main(void){
    int pencil; // 本数

    scanf("%d", &pencil);

    int first = pencil % 10; // first place
    if(first == 2 || first == 4 || first == 5 || first == 7 || first == 9){
        printf("hon\n");
    }else if(first == 3){
        printf("bon\n");
    }else{
        printf("pon\n");
    }

    return 0;
    
}

Measured memory_bytes: 1624
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;

static void solve(){
 int cnt=0;
 for(;;){
  int n=ir.nextInt();
  if(n==0) break;
  cnt++;
  Vector[] vs=new Vector[n];
  for(int i=0;i<n;i++) vs[i]=new Vector(ir.nextInt(),ir.nextInt());
  double ans=0;
  for(int i=0;i<n;i++) ans+=vs[i].crossP(vs[(i+1)%n])/2;
  out.println(cnt+" "+Math.abs(ans));
 }
}
 
static class Vector{
 
 double x,y;
 
 public Vector(double x,double y){this.x=x; this.y=y;}
 
 public double crossP(Vector v){return this.x*v.y-this.y*v.x;}
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
 
 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
 
 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
 
 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
 
 public boolean hasNext(){skip(); return hasNextByte();}
 
 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }
 
 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }
 
 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

 public double nextDouble(){return Double.parseDouble(next());}

 public int[] nextIntArray(int n){
  int[] a=new int[n];
  for(int i=0;i<n;i++) a[i]=nextInt();
  return a;
 }

 public long[] nextLongArray(int n){
  long[] a=new long[n];
  for(int i=0;i<n;i++) a[i]=nextLong();
  return a;
 }

 public char[][] nextCharMap(int n,int m){
  char[][] map=new char[n][m];
  for(int i=0;i<n;i++) map[i]=next().toCharArray();
  return map;
 }
}
}

Measured memory_bytes: 24488
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int ms = 2e5+9;
ll vet[ms];
int main(){
	ll n,a,b,ans=0;
	cin >> n >> a >> b;
	for(int i = 0;i<n;i++)
		cin >>vet[i];
	for(int i= 0;i<n-1;i++){
		ll a1 = (vet[i+1]-vet[i])*a;
		ans+=min(a1,b);
	}
	cout<<ans;

}

Measured memory_bytes: 1024
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    string S;
    cin >> S;
    for (auto & s : S) {
        switch (s)
        {
        case 'A':
            cout << 'T';
            break;
        case 'C':
            cout << 'G';
            break;
        case 'G':
            cout << 'C';
            break;
        case 'T':
            cout << 'A';
            break;
        default:
            break;
        }
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int n=0,m=0;
	cin>>n>>m;
	if((n+m)%3==0||n%3==0||m%3==0){
		cout<<"Possible";
	}else{
		cout<<"Impossible";
	}
	cout<<endl;
	return 0;
}

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

int main(){
int n;
cin >> n;
map<string,int> mp;
ll ans = 0;
for(int i = 0; i < n; i++){
string s; cin >> s;
sort(s.begin(), s.end());
mp[s]++;
if(mp[s]>=2)ans += mp[s]-1;
}
cout << ans << endl;
return 0 ;
}

Measured memory_bytes: 11416
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
if n%2==1:
    print(0)
    exit()
ans=0
i=0
m=10
while n>=m:
    ans+=n//m
    i+=1
    m*=5
print(ans)

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

struct Card {
  char mark;
  int value;
};

int bubbleSort(Card card[], int n) {
  int count = 0;
  Card tmpc;
  for (int i = 0; i < n; ++i) {
    for (int j = n - 1; j > i; --j) {
      if (card[j].value < card[j - 1].value) {
        tmpc = card[j];
        card[j] = card[j - 1];
        card[j - 1] = tmpc;
        count++;
      }
    }
  }
  return count;
}

int selectionSort(Card card[], int n) {
  int count = 0;
  Card tmpc;
  for (int i = 0; i < n; ++i) {
    int minj = i;
    for (int j = i; j < n; ++j) {
      if (card[j].value < card[minj].value) {
        minj = j;
      }
    }
    if (i != minj) {
      tmpc = card[i];
      card[i] = card[minj];
      card[minj] = tmpc;
      count++;
    }
  }
  return count;
}

bool isStable(struct Card bS[], struct Card sS[], int n) {
  for (int i = 0; i < n; ++i) {
    if (bS[i].mark != sS[i].mark || bS[i].value != sS[i].value)
      return false;
  }
  return true;
}

void print(struct Card card[], int n) {
  for (int i = 0; i < n; ++i) {
    cout << card[i].mark << card[i].value;
    if (i != n - 1)
      cout << " ";
    else
      cout << "\n";
  }
}

int main(int argc, char *argv[]) {
  int n;
  cin >> n;
  Card card1[n], card2[n];
  string s;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    card1[i].mark = s[0];
    card1[i].value = (int)s[1] - '0';
  }
  for (int i = 0; i < n; ++i) {
    card2[i] = card1[i];
  }
  selectionSort(card1, n);
  bubbleSort(card2, n);
  print(card2, n);
  cout << "Stable" << endl;
  print(card1, n);
  cout << (isStable(card1, card2, n) ? "Stable" : "Not stable") << endl;

  return 0;
}



Measured memory_bytes: 3152
import sys
mod = 7 + 10 ** 9

def lcm(a, b):
    a, b = max(a, b), min(a, b)
    c = a * b
    while a % b > 0:
        a, b = b, a % b
    return c // b

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    L = A[0]
    for i in range(1, N): L = lcm(L, A[i])
    L %= mod
    ans = 0
    for a in A:
        ans += (L * pow(a, mod - 2, mod)) % mod
        ans %= mod
    print(ans)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 42220
#include<iostream>
#include<string>
#include<vector>
using namespace std;
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
int x[4]={1,0,-1,0};
int y[4]={0,1,0,-1};
int func(int i,int j,int n,int m,vector<string>& in,int& co){
  co++;
  //cout<<co<<endl;
  in[i][j]='!';
  rep(k,4){
    int nx=i+x[k];
    int ny=j+y[k];
    if(nx>=0 && nx<=n-1 && ny>=0 && ny<=m-1 && in[nx][ny]!='!' && in[nx][ny]=='.')func(nx,ny,n,m,in,co);
  }
  return co;
}
int main(){
  int n,m;
  while(cin>>m>>n,n||m){
    vector<string>in(n);
    int co=0;
    rep(i,n)cin>>in[i];
    rep(i,n)rep(j,m)if(in[i][j]=='@')co=func(i,j,n,m,in,co);
    cout<<co<<endl;
  }
}

Measured memory_bytes: 1264
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,dp[100001],a[100001],b;
int main() {
  cin >> n >> m;
  for(int i=1; i<=m; i++) {
    cin >> b;
    a[b]=1;
  }
  dp[0]=1;
  for(int i=1; i<=n; i++) {
    if(a[i-1]==0) {
      dp[i]+=dp[i-1];
    }
    if(a[i-2]==0) {
      dp[i]+=dp[i-2];
    }
    dp[i]%=1000000007;
  }
  cout << dp[n] << endl;
}

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

using namespace std;

#define fread(x)        freopen(x,"r",stdin)
#define fwrite(x)       freopen (x,"w",stdout)

#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define MEMSET(a,x)     memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))
#define keepunique(v)   (v).erase(unique(all(v)),v.end())

#define white           1
#define grey            2
#define black           3

#define ll              long long
#define pb              push_back
#define pf              push_front
#define INF             9e18
#define PI              acos(-1.0)
#define pii             pair<int,int>
#define pll             pair<ll, ll>

#define all(v)          v.begin(), v.end()

#define fastread        ios_base::sync_with_stdio(0);cin.tie(nullptr);
int on(int N,int pos){return N=N | (1<<pos);}
int off(int N,int pos){return N= N & ~(1<<pos);}
bool check(int N,int pos){return (bool)(N & (1<<pos));}
int lcm(int a, int b){return (a*b)/__gcd(a, b);}
//======================= let the game begin ====================//
const int maxn = 1e5 + 5;
int dis[maxn];
#define inf 1000005

int main(){
  fastread
  int k;
  cin>>k;
  for(int i=0; i<k; i++){
    dis[i]=inf;
  }
  dis[1]=1;
  deque<int>que;
  que.push_back(1);
  while(!que.empty()){
    int s = que.front();
    que.pop_front();
    if(dis[(s+1)%k] > dis[s]+1){
      dis[(s+1)%k]=dis[s]+1;
      que.pb((s+1)%k);
    }
    if(dis[(s*10)%k] > dis[s]){
      dis[(s*10)%k]=dis[s];
      que.pf((s*10)%k);
    }
  }
  cout<<dis[0]<<endl;
}


Measured memory_bytes: 896
import itertools
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


H, W = list(map(int, sys.stdin.buffer.readline().split()))
A = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(H)]
B = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(H)]

grid = [[0] * W for _ in range(H)]
for h, w in itertools.product(range(H), range(W)):
    grid[h][w] = A[h][w] - B[h][w]

# 符号をどっちにするか選べる
dp = [[set() for _ in range(W)] for _ in range(H)]
dp[0][0] = {grid[0][0] % 800, -(grid[0][0]) % 800}
for h, w in itertools.product(range(H), range(W)):
    g = grid[h][w]
    s = dp[h][w]
    if h - 1 >= 0:
        for c in dp[h - 1][w]:
            s.add((c + g) % 800)
            s.add((c - g) % 800)
    if w - 1 >= 0:
        for c in dp[h][w - 1]:
            s.add((c + g) % 800)
            s.add((c - g) % 800)
# print(grid)
# print(dp)
ans = INF
for s in dp[-1][-1]:
    ans = min(ans, s)
    ans = min(ans, (-s) % 800)
print(ans)


Measured memory_bytes: 235656
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

	int n, a, b;
	cin >> n;
	if(n==1){
		cout << "Hello World" << endl;
	} else {
		cin >> a >> b;
		cout << a+b << endl;
	}

	return 0;
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
int main(){
  int n,k;cin>>n>>k;
  vector<ll>x(n+10);
  for(int i=0;i<n;i++){
    cin>>x[i];
  }
  if(k==1&&n==1){
    cout<<abs(x[0])<<endl;
    return 0;
  }
  ll ans=llINF;
  for(int i=0;i<n-k+1;i++){
    if((x[i]<=0&&x[i+k-1]>=0)){
      //cout<<x[i+k-1]-x[i]<<endl;
      ans=min(ans,(x[i+k-1]-x[i])+min(abs(x[i]),x[i+k-1]));
    }else if(x[i+k-1]<=0){
      ans=min(abs(x[i]),ans);
    }else if(x[i]>=0){
      ans=min(abs(x[i+k-1]),ans);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
// Problem: A - Don't be late
// Contest: AtCoder - AtCoder Beginner Contest 177
// URL: https://atcoder.jp/contests/abc177/tasks/abc177_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Muallif: Azimjon Mehmonali o'g'li

//=========================================================

// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")

//=========================================================
#ifdef DEBUG
#define xtp xtp1
#else
#define xtp(x)
#endif
//=========================================================

#include <bits/stdc++.h>

using namespace std;

#define int long long

typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define F first
#define S second
#define pb push_back
#define endl "\n"

#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SORT(a) sort(ALL(a))
#define rSORT(a) sort(rALL(a))
#define REV(a) reverse(ALL(a))
#define sqr(x) ((x) * (x))

#define TEZ                  \
	ios::sync_with_stdio(0); \
	cin.tie(0);

const long double PI = 3.1415926535897;
const int mod = 1000000007LL;
const int INF = 1e18;

signed main() {
	TEZ;

	int d, t, s;
	cin >> d >> t >> s;

	if (1. * d / s <= 1. * t)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3648