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

#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;


int main()
{
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;

    if (m1 != m2) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}



Measured memory_bytes: 256
#include <list>
#include <stdio.h>
#include <algorithm>
#include <string.h>

using namespace std;


typedef struct {
	char nood[11];
	int time;
} WORM;

unsigned int makeHash(char nood[])
{
	int i = 0;
	unsigned int ret = 0;
	while (nood[i] != -1){
		ret += nood[i];
		ret *= 3;
		i++;
	}
	
	return (ret);
}

int add_worm(list<WORM>* lstWorm, list<unsigned>& lstHash)
{
	WORM add;
	
	add.time = lstWorm->front().time + 1;
	
	int i = 0;
	while (lstWorm->front().nood[i + 1] != -1){
		if (lstWorm->front().nood[i] != lstWorm->front().nood[i + 1]){
			memcpy(add.nood, lstWorm->front().nood, 11);
			add.nood[i] = add.nood[i + 1] = 3 - (lstWorm->front().nood[i] + lstWorm->front().nood[i + 1]);
			if (find(lstHash.begin(), lstHash.end(), makeHash(add.nood)) == lstHash.end()){
				lstWorm->push_back(add);
				lstHash.push_back(makeHash(add.nood));
			}
		}
		i++;
	}
	
	return (0);
}

bool checkNood(char nood[])
{
	int i = 1;
	int d = nood[0];
	bool ret = true;
	
	while (nood[i] != -1){
		if (d != nood[i]){
			ret = false;
			break;
		}
		i++;
	}
	
	return (ret);
}

int main(void)
{
	list<unsigned int> lstHash;
	list<WORM> lstWorm;
	WORM add;
	
	while (1){
		lstHash.clear();
		lstWorm.clear();
		scanf("%s", add.nood);
		if (add.nood[0] == '0'){
			break;
		}
		int i = 0;
		while (add.nood[i] != '\0'){
			switch(add.nood[i]){
			  case 'r': add.nood[i] = 0; break;
			  case 'g': add.nood[i] = 1; break;
			  case 'b': add.nood[i] = 2; break;
			}
			i++;
		}
		add.nood[i] = -1;
		add.time = 0;
		
		lstWorm.push_back(add);
		lstHash.push_back(makeHash(add.nood));
		
		while (lstWorm.empty() == false && checkNood(lstWorm.front().nood) == false){
			add_worm(&lstWorm, lstHash);
			lstWorm.pop_front();
		}
		
		if (lstWorm.empty() == true){
			puts("NA");
		}
		else {
			printf("%d\n", lstWorm.front().time);
		}
	}
	
	return (0);
}

Measured memory_bytes: 1104
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Thu Jan 10 22:18:19 2019
//
package main

import "fmt"

func printSlice(slice []int) {
	for i := range slice {
		if i != 0 {
			fmt.Print(" ")
		}
		fmt.Print(slice[i])
	}
	fmt.Println()
}

func main() {
	var K int
	fmt.Scan(&K)
	n := 50

	arr := make([]int, n)
	for i := range arr {
		arr[i] = i
	}

	q, r := K/50, K%50
	for i := range arr {
		arr[i] += q
	}
	for i := 0; i < r; i++ {
		arr[49-i]++
	}

	fmt.Println(n)
	printSlice(arr)
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
			
		int x = scan.nextInt();
		int n = scan.nextInt();
		Set<Integer> set = new HashSet<>();
		for(int i = 0; i < n; i++)
			set.add(scan.nextInt());
		scan.close();
		
		int min = 101;
		for(int i = 0; i < 101; i++) 
			if(!set.contains(i))
				if(Math.abs(x-i) < Math.abs(x-min)) {
					min = i;
				}else if(Math.abs(x-i) == Math.abs(x-min) && i < min) {
					min = i;
				}
				
		System.out.println(min);
	}

}


Measured memory_bytes: 35836
#include <iostream>
#include <algorithm>
#include <string>
#define rep(i, a, b) for(int i = a; i < b; i++)
using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  rep(i, 0, s.size()) {
    if(s[i] != t[i]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
}


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

P = [int(i) for i in input().split(" ")]
count = 0
for i in range(1,N-1):
    p_0 = P[i-1]
    p_1 = P[i]
    p_2 = P[i+1]
    
    bool_1 = p_1>p_0 and p_1<p_2
    bool_2 = p_1<p_0 and p_1>p_2
    
    if bool_1 or bool_2:
        count+=1
print(count)

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

using namespace std;

int main(){
  int n,l;
  cin >> n >> l;
  
  vector<string> s(n);
  for(int i=0;i<n;i++)
    cin >> s.at(i);
  
  sort(s.begin(),s.end());
  
  string ss;
  for(int i=0;i<n;i++)
   	ss+=s.at(i);
  
  cout << ss << endl;
  
  return 0;
}


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

int getNumber();
int* creatArrayWithNumberOfElements(int number);
void bubbleSort(int* array, int number, int* count);
void swap(int* a, int* b);
void printArray(int* array, int number);

int main(void)
{
	int numberOfElements = getNumber();
	int *sequence = creatArrayWithNumberOfElements(numberOfElements);
	int count = 0;
	bubbleSort(sequence, numberOfElements, &count);
	printArray(sequence, numberOfElements);
	printf("%d\n", count);
}

int getNumber()
{
	int input;
	scanf("%d", &input);
	return input;
}

int* creatArrayWithNumberOfElements(int number)
{
	int i;
	int *array = (int*) malloc(number * sizeof(int));
	for (i = 0; i < number; i++)
		scanf("%d", array + i);
	return array;
}

void bubbleSort(int* array, int number, int* count)
{
	int i, j;
	for (i = 0; i < number - 1; i++)
	{
		for (j = number - 1; j > i; j--)
		{
			if (*(array + j) < *(array + j - 1))
			{
				swap(array + j, array + j - 1);
				(*count)++;
				// printf("count = %d\n", *count);
			}
		}
	}
}

void swap(int* a, int* b)
{
	int temp = *a;
	*a = *b;
	*b = temp;
}

void printArray(int* array, int number)
{
	int i;
	for (i = 0; i < number - 1; i++)
	{
		printf("%d ", *(array + i));
	}
	printf("%d\n", *(array + i));
}


Measured memory_bytes: 1984
// JavaProgram.cpp
// Author : Priydarshi Singh (@dryairship)
// One cat just leads to another. One bug leads to two others.

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

// I like my types defined.
typedef long long           ll;
typedef pair<int, int>      pii;
typedef pair<ll, ll>        pll;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef vector<pii>         vii;
typedef vector<pll>         vll;
typedef set<int>            si;
typedef map<string, int>    msi;
typedef map<int, int>       mii;

// Traditional science is all about finding "hashtag define"s.
#define fr(i, n)            for(int i=0; i<(n); ++i)
#define frC(i, n, c)        for(int i=0; (i<(n)) && (c); ++i)
#define frA(i, a, n)        for(int i=a; i<=(n); ++i)
#define frD(i, a, n)        for(int i=a; i>=(n); --i)
#define fill(a)             memset(a, 0, sizeof(a))
#define fill1(a)            memset(a, -1, sizeof(a))
#define revsort(a, b)       sort(a, b, greater<int>())
#define ff                  first
#define ss                  second
#define pb                  push_back 
#define dout                if(DEBUGGING) cout
#define dbg                 if(DEBUGGING) 
#define endl                "\n"

// When you realize MOD > INF...
int DEBUGGING    =          0;
const int INF    =          1000000000;
const int MOD    =          1000000007;
const ll LINF    =          1e18;
const double PI  =          3.1415926535897932;
const double EPS =          1e-7;

// I'D SPAM. Hehe.
ll gcdEx                    (ll a, ll b, ll *x, ll *y){if(!a){*x=0;*y=1;return b;} 
ll x1,y1,gcd=gcdEx          (b%a,a,&x1,&y1); *x=y1-(b/a)*x1;*y=x1; return gcd;}
ll modI(ll b, ll m)         {ll x,y;gcdEx(b,m,&x,&y);return (x%m+m)%m;}
ll modD(ll a, ll b)         {return (modI(b,MOD)*(a%MOD))%MOD;}
ll modS(ll a, ll b)         {return ((a%MOD)-(b%MOD)+MOD)%MOD;}
ll modP(ll x, ll y)         {ll r=1; x%=MOD; while(y>0){if(y&1){r=(r*x)%MOD;} y=y>>1; x=(x*x)%MOD;} return r;}
ll modA(ll a, ll b)         {return ((a%MOD)+(b%MOD))%MOD;}
ll modM(ll a, ll b)         {return ((a%MOD)*(b%MOD))%MOD;}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int a[200005];
int v[200005];

void solve(int TEST_CASE){
    ll n,k;
    cin >> n >> k;
    fr(i,n){
        cin >> a[i];
        a[i]--;
    }
    fr(i,n+2) v[i]=0;
    int rp=-1;
    int cp=0;
    vi pth;
    while(!v[cp]){
        v[cp]=1;
        pth.pb(cp);
        cp = a[cp];
    }
    ll nrl=0;
    fr(i,pth.size()){
        if(pth[i]==cp) break;
        nrl=i+1;
    }
    if(k<=nrl){
        cout << pth[k]+1;
    }else{
        k-=nrl;
        k%=((int)pth.size())-nrl;
        k+=nrl;
        cout << pth[k]+1;
    }
}

int main(int argc, char* argv[]){
    if(argc==2 && argv[1][1]=='v') DEBUGGING = 1;
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin.exceptions(cin.failbit);
    int nTestCases=1;
    //cin >> nTestCases;
    frA(i,1,nTestCases) solve(i);
    return 0;
}

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

using namespace std;

typedef long long ll;
const int maxn = (int) 1e5 + 1;
const int mod = (int) 1e9 + 7;

int n;
ll k;
int a[maxn];
ll ans;
ll t[maxn];

void build(int v, int tl, int tr){
    t[v] = 0;
    if(tl == tr){
        return ;
    }
    else {
        int mid = (tl + tr) / 2;
        build(v * 2, tl, mid);
        build(v * 2 + 1, mid + 1, tr);
    }
}

void upd(int v, int tl, int tr, int p){
    if(tl == tr){
        t[v]++;
    }
    else {
        int mid = (tl + tr) / 2;
        if(p <= mid){
            upd(v * 2, tl, mid, p);
        }
        else {
            upd(v * 2 + 1, mid + 1, tr, p);
        }
        t[v] = t[v * 2] + t[v * 2 + 1];
    }
}

ll get(int v, int tl ,int tr, int l, int r){
    if(l > tr || tl > r){
        return 0;
    }
    if(l <= tl && tr <= r){
        return t[v];
    }
    int mid = (tl + tr) / 2;
    return get(v * 2, tl, mid, l, r) + get(v * 2 + 1, mid + 1, tr, l, r);
}


int main(){
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        ans += ((((k) * (k + 1)) / 2) % mod) * (get(1, 1, 2000, a[i] + 1, 2000)) % mod;
        upd(1, 1, 2000, a[i]);
        ans %= mod;
    }
    build(1, 1, 2000);
    reverse(a + 1, a + n + 1);
    for(int i = 1; i <= n; i++){
        ans += ((((k) * (k - 1)) / 2) % mod) * (get(1, 1, 2000, a[i] + 1, 2000)) % mod;
        upd(1, 1, 2000, a[i]);
        ans %= mod;
    }
    cout << ans;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace AOJ
{
  class Program
  {
    public static void Main()
    {
      int numberOfDatasets = int.Parse(Console.ReadLine());
      foreach (var numStrings in ReadStrings(numberOfDatasets))
      {
        var numArrays = numStrings.Select(
            arr => arr.Select(s => int.Parse(s.ToString())).Reverse().ToList()).ToArray();
        var lengthDiff = numArrays[0].Count - numArrays[1].Count;
        if (lengthDiff > 0)
          numArrays[1].AddRange(Enumerable.Repeat(0, lengthDiff));
        else if (lengthDiff < 0)
          numArrays[0].AddRange(Enumerable.Repeat(0, -lengthDiff));
        var result = Enumerable.Repeat(0, numArrays.Select(x => x.Count).Max()).ToList();
        foreach (var i in Enumerable.Range(0, result.Count))
        {
          result[i] += numArrays.Select(x => x[i]).Sum();
          if (result[i] > 9)
          {
            if (result.Count <= i + 1)
              result.Add(1);
            else
              result[i + 1] += 1;
            result[i] %= 10;
          }
        }
        if (result.Count > 80)
        {
          Console.WriteLine("overflow");
          continue;
        }
        var builder = new System.Text.StringBuilder();
        result.Reverse();
        foreach (var n in result)
          builder.AppendFormat("{0}", n);
        var resultStr = builder.ToString();
        Console.WriteLine(resultStr);
      }
    }

    static IList<int> SplitNumber(string s)
    {
        return s.Select((x, i) => new { Index = i, Value = x })
                .GroupBy(x => x.Index / 4)
                .Select(x => x.Select(v => v.Value).ToArray())
                .Select(x => int.Parse(new string(x)))
                .Reverse()
                .ToList();
    }

    static IEnumerable<IList<string>> ReadStrings(int n)
    {
      foreach (var i in Enumerable.Range(0, n))
      {
        var s = new string[2];
        s[0] = Console.ReadLine();
        if (string.IsNullOrEmpty(s[0]))
          break;
        s[1] = Console.ReadLine();
        if (string.IsNullOrEmpty(s[1]))
          break;
        if (s.Any(x => x.Length > 80))
        {
          Console.WriteLine("overflow");
          continue;
        }
        yield return s;
      }
    }
  }
}

Measured memory_bytes: 6292
//   Rishabh Agarwal
#include <bits/stdc++.h>
#define F first
#define S second
#define MAX 10000003
using namespace std;

typedef long long int ll;
const ll mod = 1e17;
long double PI=3.1415926;

ll power(ll a,ll b){
    if(b==0){
        return 1;
    }
    ll temp=power(a,b/2)%mod;
    if(b%2==0){
        return (temp*temp)%mod;
    }
    else{
        return ((a*temp)%mod*temp)%mod;
    }
}

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

vector<ll>v;
vector<ll>::iterator it;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t;
    //cin>>t;
    t=1;
    //ll c=1;
    while(t--){
        long double a,b;
        cin>>a>>b;
        long double ans=(long double)a*(long double)b;
        cout<<(long long )ans<<"\n";
        v.clear();
        //cout<<"Case #"<<c<<": "<<ans<<"\n";
        //c++;
    }
    return 0;
}

Measured memory_bytes: 3796
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc =new Scanner(System.in);

		String s=sc.next();
		String t=sc.next();
		
		char[] ss=s.toCharArray();
		char[] tt=t.toCharArray();
		
		int ans =0;
		
		for(int i=0;i<3;i++) {
			if(ss[i]==tt[i])ans++;
		}
		
		System.out.println(ans);
		





	}


}




Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int N;
  int a,b,c,d,e,f,g,h;//1~8桁目
  int S;//和
  
  cin>>N;
  
  a=N/10000000;
  b=(N-a*10000000)/1000000;
  c=(N-a*10000000-b*1000000)/100000;
  d=(N-a*10000000-b*1000000-c*100000)/10000;
  e=(N-a*10000000-b*1000000-c*100000-d*10000)/1000;
  f=(N-a*10000000-b*1000000-c*100000-d*10000-e*1000)/100;
  g=(N-a*10000000-b*1000000-c*100000-d*10000-e*1000-f*100)/10;
  h=N-a*10000000-b*1000000-c*100000-d*10000-e*1000-f*100-g*10;
  
  S=a+b+c+d+e+f+g+h;
  
  if(N%S==0){
    cout<<"Yes"<<endl;
  }
  
  else{
    cout<<"No"<<endl;
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
//FILE *fi = freopen("1.txt", "r", stdin);
//FILE *fo = freopen("1", "w", stdout);
//FILE *fi = freopen("P.inp", "r", stdin);
//FILE *fo = freopen("P.out", "w", stdout);
int main()
{
    //------------------------------
    // Faster
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //-------------------------------
    string a, b;
    cin >> a >> b;
    int ans = 1e9;
    int n = a.size();
    int m = b.size();
    for (int i = 0; i < n - m + 1; i++)
    {
        int cnt = 0;
        int j = 0;
        int x = i;
        for (int k = 1; k <= m; k++)
        {
            cnt += (a[x] != b[j]);
            x++;
            j++;
        }

        ans = min(ans, cnt);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3584
#include<stdio.h>

int main(void){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  
  int k;
  scanf("%d",&k);
  
  if(a>b){int tmp=a;a=b;b=tmp;}
  if(b>c){int tmp=b;b=c;c=tmp;}
  
  for(int i=0;i<k;i++){c*=2;}
  
  printf("%d",a+b+c);
  
  return 0;
  
}

  
  


Measured memory_bytes: 128
#include<iostream>
#include<string>

#define R input[0][1]

using namespace std;

int input() {
	int input[51][2];
	cin >> input[0][0] >> input[0][1];								//まずnとr
	if (input[0][0] == 0 && input[0][1] == 0) {
		return 0;
	}
	for (char pos = 1; pos <= input[0][1]; pos++) {					//r回のシャッフルの仕方を入力
		cin >> input[pos][0] >> input[pos][1];
	}																//ここまで入力

	/*シャッフルもどし*/
	int whtop = 1;													//最後一番上にいるカードは、今何番目にいる？
	if (R==0)return input[0][0];									//一回もシャッフルしないならコレ

	whtop = input[input[0][1]][0];									//一回目のもどしだけ別枠
	R--;
	while (input[0][1] != 0) {	
		if (whtop <= input[R][1]) whtop = whtop + input[R][0] - 1;
		else if ((input[R][0] + input[R][1] - 1) < whtop) whtop = whtop;
		else whtop = whtop - input[R][1];
		R--;
	}
	return input[0][0] - whtop + 1;

}


int main()
{
	while (1) {
		int check;
		check = input();
		if (check == 0)break;
		else {
			cout << check << endl;
		}
	}
}


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

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

    for (long i = sqrt(n); i >= 1; i--) {
        if (n % i == 0) {
            cout <<  i + n / i - 2 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#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;
    cin >> n;
vector<tuple<string, int, int>> tabelog;
rep(i,n){
    string temp0;
    int temp1, temp2;
    cin >> temp0 >> temp1;
    temp1 *= -1;
    temp2 = i+1;
    tabelog.push_back(make_tuple(temp0, temp1, temp2));
}
sort(tabelog.begin(), tabelog.end());
rep(i, n){
    cout << get<2>(tabelog[i]) <<endl;
}
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<" ";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll ans=0;
    ll cnt=0;
    for(int i=0; i<n; i++){ 
        cin >> a[i]; 
    }
    auto it = (find(a.begin(), a.end(), 1));
    if (it == a.end()) {
        ans = -1;
    } else {
        for(int i=1; i<n; i++) {
            for(int j=cnt+i-1; j<n; j++) {
                if(a[j]!=i){
                    cnt++;
                }else{
                    break;
                }
            }
        }
        ans = cnt;
    }
 
    cout<<ans<<endl;
    return  0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
struct pp
{
    int x,y,s;
};
pp a[90010];
int main()
{
    int h,w,d;
    while(~scanf("%d%d%d",&h,&w,&d))
    {
        for(int i=1;i<=h;i++)
            for(int j=1;j<=w;j++)
            {
                int b;
                scanf("%d",&b);
                a[b].x=i;
                a[b].y=j;
            }
        for(int i=d+1;i<=h*w;i++)
            a[i].s=a[i-d].s+fabs(a[i].x-a[i-d].x)+fabs(a[i].y-a[i-d].y);
        int t,l,r;
        scanf("%d",&t);
        for(int i=1;i<=t;i++)
        {
            scanf("%d%d",&l,&r);
            long long s=a[r].s-a[l].s;
            printf("%lld\n",s);
        }
    }
    return 0;
}


Measured memory_bytes: 2176
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
using namespace std;
#define ll long long
#define pb push_back
#define pll pair<ll,ll> 
#define mll map<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0; i<n; i++)
#define All(x,v) for(auto x:v)
#define arrin(a,n) ll a[n]; rep(i,n) cin>>a[i]
#define vi vector<int>
#define nl "\n"
#define print(arr) All(x,arr) cout<<x<<" "; cout<<nl
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define ing(m,ad) rep(i,m){ int u,v; cin>>u>>v; u--;v--; ad[u].pb(v); ad[v].pb(u);}
#define vdsort(v) sort(v.begin(),v.end(),greater<int>())
#define F first
#define S second
#define mod 1000000007
const int MAXN=100005;
int spf[MAXN];
ll fac1[MAXN],fac2[MAXN],inv[MAXN];
ll gcd(ll x, ll y){ return y?gcd(y,x%y):x; }

void sieve(){  
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++)  spf[i] = i; 
    for (int i=4; i<MAXN; i+=2) spf[i] = 2; 
    for (int i=3; i*i<MAXN; i++) { 
        if (spf[i] == i) 
            for (int j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j)  spf[j] = i; 
    } 
} 
vector<int> getFactorization(int x){
    vector<int> ret; 
    while (x != 1) { 
        ret.push_back(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
}

ll exp(ll n, ll m){
    ll a = 1;
    while (m){
        if (m & 1) a = (a * n % mod) % mod;
        m /= 2;
        n = (n*n) % mod;
    }
    return a;
}

void pre(){
    fac1[0]=fac2[0]=inv[1]=1;
    for(int i=1;i<MAXN;i++){
        fac1[i]=(fac1[i-1]*i)%mod;
        if(i>1) inv[i]=( mod - ((ll)(mod/i)*inv[mod%i])%mod ) %mod;
    }
    for(int i=1;i<MAXN;i++) fac2[i]=(fac2[i-1]*inv[i])%mod;
}
ll C(int n,int k){
    if(n<k) return 0;
    return ((fac1[n]*fac2[n-k]%mod)*fac2[k]%mod);
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    // freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    ll n,d,t=1;
    // cin>>t;
    while(t--){
        cin>>n>>d;
        int cnt=0;
        ll x,y;
        rep(i,n){
            cin>>x>>y;
            if(x*x+y*y<=d*d) cnt++;
        }
        cout<<cnt<<nl;
    }
    return 0;
}

Measured memory_bytes: 3160
/*

Author: @karngyan
Team: BlundersPride

*/

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

typedef long long ll;
typedef long double ld;
typedef std::vector<ll> vll;
typedef std::pair<ll,ll> pll;
typedef std::vector<vll> vvll;

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define max3( a, b, c ) max( a , max(b , c))
#define cres(c,n) (c).clear(),(c).resize(n)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define ff first
#define ss second
#define mk make_pair
ll n;
ll a[20];
signed main()
{

	fast;
////////////////////////////////////////////////////////////////////////////////////////////
	cin >> n;
	ll mx = -1;
	ll sumi = 0;
	rep(i,0,n)
	{
		cin >> a[i];
		sumi+=a[i];
		mx = max(mx , a[i]);
	}

	if(sumi - mx > mx)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;








	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(N);
    rep(i, 0, M) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].pb(b);
    }

    vi ans(N + 1);
    rep(i, 0, N) {
        queue<int> q;
        q.push(i);
        vector<bool> vis(N, false);
        vi from(N, -1);
        vis[i] = true;
        vi tmp;
        while (sz(q)) {
            int v = q.front(); q.pop();
            for (int w : G[v]) {
                if (w == i) {
                    int cur = v;
                    while (cur != -1) {
                        tmp.pb(cur);
                        cur = from[cur];
                    }
                    goto update;
                }
                if (vis[w]) continue;
                vis[w] = true;
                from[w] = v;
                q.push(w);
            }
        }
        if (false) {
            update:
            if (sz(ans) > sz(tmp)) {
                ans = tmp;
            }
        }
    }
    if (sz(ans) == N + 1) {
        cout << -1 << endl;
    } else {
        cout << sz(ans) << endl;
        for (int x : ans) cout << x + 1 << endl;
    }
    return (0^_^0);
}



Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

int main(void) {
  cout.precision(12);

  long A, B;
  cin >> A >> B;

  if (A >= 13) cout << B << endl;
  else if (A >= 6) cout << (B/2) << endl;
  else cout << 0 << endl;

  return 0;
}


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

int main() {
  int a;
  int b;

  cin >> a;
  cin >> b;
  
  int sum = a + b;
  int ave = sum / 2;

  if (sum % 2 == 1) {
      ave++;
  }

  cout << ave << endl;
}

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, M;
  IN(N,M);
  vll A(N);
  REP(i,N) IN(A[i]);
  ll A_total = 0;
  REP(i,N) A_total += A[i];

  ll count=0;
  REP(i,N){
    if(A_total<=A[i]*4*M) count++;
  }

  if(count>=M){
    OUT("Yes");
  }else{
    OUT("No");
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define iof ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pi 3.1415926535897
#define mod 1000000007
#define inf (1ll<<60)
using namespace std;


int main()
{
    iof;
    ll n,k; cin>>n>>k;
    ll arr[n];
    for(ll i=0;i<n;i++)
        cin>>arr[i];
    ll dp[n];
    for(ll i=0;i<n;i++)
        dp[i]=inf;
    dp[0]=0;
    for(ll i=1;i<n;i++)
    {
        ll t=1;
        while(i-t>=0 and t<=k)
        {
            dp[i]=min(dp[i],abs(arr[i]-arr[i-t])+dp[i-t]);
            t++;
        }
    }
    cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 1792
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VB> VVB;

// conversion
#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<decltype((c).front())>())
#define SZ(x) (INT((x).size()))
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1<<25;
// const ll INF = 1LL<<50;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;

#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


// --------------------------------------------------------


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

  int H, W;
  cin >> H >> W;
  VS C(H);
  REP(i, H) {
    cin >> C[i];
  }

  REP(i, H) {
    cout << C[i] << endl
         << C[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = [list(map(int,input().split())) for i in range(n)]
cnt = 0
ans = 0
for i in range(n):
    for j in range(m):
        cnt += a[i][j]*b[j]
    cnt += c
    if cnt > 0:
        ans += 1
    cnt = 0
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, x;
  cin >> A >> B;
  for(int i = A; i <= B; i++){
    if(i/10000 == (i - i/10*10) && i/1000 - (i/10000 * 10) == (i - i/100*100 - i%10)/10){
      x++;
    }
  }
  cout << x << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

ll n;
ll a[200001],b[200001];

int main(){
  cin>>n;
  rep(i,n)cin>>a[i]>>b[i];

  bool ok=true;
  rep(i,n){
    if(a[i]!=b[i])ok=false;
  }
  if(ok){
    cout<<0<<endl;
    return 0;
  }

  ll res=0;
  ll mn=INF;
  ll sum=0;
  rep(i,n){
    if(a[i]>b[i]){
      minch(mn,b[i]);
    }
    sum+=a[i];
  }
  cout<<sum-mn<<endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define mod 838627288460106
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int main()
{
    fast_io
    ll n,x,y,i,j,ans=0;
    map<ll,ll>mp;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
    cin>>a[i];
    for(i=0;i<n;i++)
    mp[a[i]]++;

    for(auto s:mp)
    {
        x=s.first;
        y=s.second;
        if(x>y) ans+=y;
        else ans+=y-x;
    }

    cout<<ans<<endl;

    return 0;
}





Measured memory_bytes: 10380
#include<stdio.h>
int main(void){
	int a,b,c,i,e=0;
	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if(c%i==0){
			e++;
		}
	}
	printf("%d\n",e);
	return 0;
}

Measured memory_bytes: 596
/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void test_case();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << (a * b) / 2 << "\n";
}

Measured memory_bytes: 256
import fractions
import math
a,b,c,d = map(int, input().split())
x1 = (a-1)//c
x2 = b//c
x = x2-x1
y1 = (a-1)//d
y2 = b//d
y = y2-y1
z1 = (a-1)//((c*d)//fractions.gcd(c,d))
z2 = b//((c*d)//fractions.gcd(c,d))
z = z2-z1
print(int((b-a+1)-x-y+z))

Measured memory_bytes: 5304
N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
counter = 0
while x > 0 and counter <= len(a)-1:
  if len(a) - 1 > counter and x >= a[counter]:
    x -= a[counter]
    counter += 1
  elif len(a) - 1 == counter and x == a[counter]:
    x = 0
    counter += 1
  else:
    x = 0

print(counter)

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<map>
#include<queue>
#include<vector>
#include<utility>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int , int> PII;
const int MaxN = 3000;

int a[MaxN + 5][MaxN + 5];
int cnt[MaxN + 5];
bool used[MaxN + 5];
queue<int> q[MaxN + 5];
int n, m;

bool check(int x){
	for(int i = 1; i <= m; i++){ cnt[i] = 0; used[i] = false;}
	for(int i = 1; i<= n; i++){
		while(!q[i].empty()) q[i].pop();
		for(int j = 1; j <= m; j++) q[i].push(a[i][j]);
	}
	while(true){
		int p = -1;
		for(int i = 1; i <= n; i++){
			cnt[q[i].front()]++;
			if(cnt[q[i].front()] > x) p = q[i].front();
		}
		if(p == -1) return true;
		used[p] = true;
		for(int i = 1; i <= n; i++){
			while(!q[i].empty() && used[q[i].front()]) q[i].pop();
			if(q[i].empty()) return false;
		}
		for(int i = 1; i <= m; i++) cnt[i] = 0;
	}
}

void solve(){
	int l = 0, r = n, ans = 0;
	while(l <= r){
		int mid = (l + r) >> 1;
		if(check(mid)) ans = mid, r = mid - 1;
		else l = mid + 1;
	}
	printf("%d\n", ans);
}

int main(){
	while(~scanf("%d %d", &n, &m)){
		for(int i = 1; i <= n; i++)
			for(int j = 1; j <= m; j++)
				scanf("%d", &a[i][j]);
		solve();
	}
	return 0;
}

Measured memory_bytes: 5632
// 素朴な全探索
#include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;
int N;
vector<int> a;

int cnt_same_clr(int i, bool incre) { // inclre = true なら i 増加
  int cnt = 0;
  int clr = a[i];
  if (incre) {
    while(i < N && a[i] == clr) {
      cnt++;
      i++;
    }
  } else {
    while(i >= 0 && a[i] == clr) {
      cnt++;
      i--;
    }
  }
  return cnt;
}

int cnt_left(int i, int clr) {
  int tmp = a[i];
  a[i] = clr; // 一時的に a[i] を変更
  int cnt = 0;
  int f = i;
  int e = i;
  if (a[i] == a[i+1])
    e++;
  else
    f++;
  while (f >= 0 && e < N && a[f] == a[e]) {
    int cnt_f = cnt_same_clr(f, false);
    int cnt_e = cnt_same_clr(e, true);
    if (cnt_f + cnt_e < 4) break;
    cnt++;
    f -= cnt_f;
    e += cnt_e;
  }
  a[i] = tmp; // 色を戻す

  // 残ったキャラ数を計算
  int left = N - (e - f - 1);
  // cout << N << " " << left << endl;
  return left;
}

int main() {
  // ifstream cin("../test.txt");
  while (true) {
    cin >> N;
    if (!N) break;
    a = vector<int>(N);
    for (int i = 0; i < N; i++) {
      cin >> a[i];
    }

    int left_min = N;
    int three = 0;
    for (int i = 1; i < N-1; i++) {

      if (a[i-1] == a[i+1] && a[i] != a[i-1]) {
        left_min = min(left_min, cnt_left(i, a[i-1]));
      }

      if (three == 2) {
        left_min = min(left_min, cnt_left(i, a[i-1]));
      }
      if (a[i] == a[i-1])
        three++;
      else
        three = 0;
    }
    three = 0;
    for (int i = N-2; i > 0; i--) {
      if (three == 2) {
        left_min = min(left_min, cnt_left(i, a[i+1]));
      }

      if (a[i] == a[i+1])
        three++;
      else
        three = 0;
    }

    cout << left_min << endl;
  }
}

Measured memory_bytes: 1340
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA cerr << "AAAAA" << endl
#define debug_ cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

template <typename T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T &b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
void quit(T a)
{
    cout << a << endl;
    exit(0);
}

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from,
                                      // to}}的に使う。
const ll LINF = 10010020030040056ll;
const int INF = 1001001001;
const double pi = acos(-1);

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

vector<pair<ll, ll>> prime_factor(ll N)
{
    vector<pair<ll, ll>> res;
    for (ll a = 2; a * a <= N; ++a)
    {
        if (N % a != 0)
            continue;
        ll ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0)
        {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1)
        res.push_back({N, 1});
    return res;
}

void solve()
{
    int n;
    cin >> n;
    cout << n/3 << endl;
}

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

    solve();
    return 0;
}


Measured memory_bytes: 3592
N,K=map(int,input().split())
h=list(map(int,input().split()))
cost=[0,abs(h[1]-h[0])]

for i in range(2,N):
    cand=10**10
    for j in range(K):
        if j==i:
            break
        cand=min(cand,cost[i-j-1]+abs(h[i]-h[i-j-1]))
    cost.append(cand)
print(cost[-1])


Measured memory_bytes: 58080
n=int(input())
s=input()

nr=s.count('R')
ng=s.count('G')
nb=s.count('B')
ans=nr*ng*nb 
cnt=0

for i in range(n):
    for j in range(i+1,n):
        k=2*j-i
        if n<=k or k<=j:
            continue
        if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
            cnt+=1
print(ans-cnt)


Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int n; cin >> n;
	VI a(n); REP(i, n)cin >> a[i];
	REP(i, n) {
		if (a[i] % 2 == 0) {
			if (a[i] % 3 != 0 && a[i] % 5 != 0) {
				cout << "DENIED" << endl;
				return 0;
			}
		}
	}
	cout << "APPROVED" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Mashu cout << "UUZ ate it." << endl
#define RE register int
#define ll long long
using namespace std;

struct QAQ{
	int l, r;
};

QAQ qwq[100001];

bool cmp(QAQ a, QAQ b){
	return a.l < b.l;
}

int main(){
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++){
		int x, len;
		cin >> x >> len;
		qwq[i].l = x - len;
		qwq[i].r = x + len - 1;
	}
	sort(qwq + 1, qwq + 1 + n, cmp);
	int sum = 0;
	for (int i = 1; i < n; i++){
		if (qwq[i].r >= qwq[i + 1].l){
			sum++;
			if (!(qwq[i].r >= qwq[i + 1].r)){
				qwq[i + 1].r = qwq[i].r; 
			}
		}
	}
	cout << n - sum << endl;
	return 0;
	Mashu;
}


Measured memory_bytes: 1024
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
typedef pair<LL, LL> P;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))),(c).end())
# define mp          make_pair
# define eb          emplace_back
# 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 REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)

bool p, w, g, y;

int n;
char c;

int main() {
	cin >> n;
	REP(i, n) {
		cin >> c;
		if (c == 'P')p = true;
		if (c == 'W')w = true;
		if (c == 'G')g = true;
		if (c == 'Y')y = true;
	}
	cout << ((p + w + g + y) == 3 ? "Three" : "Four") << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int ie1,ie2,ie3,ie4;
	int kei,hun,byo1;
	
	scanf("%d",&ie1);
	scanf("%d",&ie2);
	scanf("%d",&ie3);
	scanf("%d",&ie4);
	
	kei = ie1+ie2+ie3+ie4;
	
	hun = kei/60;
	
	byo1=kei-hun*60;
	
	printf("%d\n",hun);
	printf("%d\n",byo1);
}


Measured memory_bytes: 2728
#include <iostream>
#include <algorithm>
#include <cstdint>
using namespace std;
int main()
{
    // スペース区切りの整数の入力
    int n,k;
    cin >> n >> k;
  
    int h[n];
    for (int i = 0; i < n; ++i) {
       cin >> h[i];
    }

    // ソート
	sort(h, h+n);
	
    // hの小さい順から上位N－K個の合計を得る
    uint64_t result = 0;
    for (int i = 0; i < (n - k); ++i) {
      result += h[i];
    }
  
    // 出力
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i++)
#define reprev(i, n) reprrev(i, 0, n)

#define PI M_PI
#define INF 100000000
#define NINF -100000000

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<bool>> vvb;

const int limit = 50;
int N, M;
vvb graph(limit, vb(limit, false));
vb visited(limit, 0);
vi a(limit, 0);
vi b(limit, 0);

void dfs(int v)
{
	visited[v] = true;

	rep(v2, N) {
		if (graph[v][v2] == false)continue;
		if (visited[v2] == true)continue;
		dfs(v2);
	}
}


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

	rep(i, M) {
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}

	int ans = 0;

	rep(i, M) {
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;

		rep(j, N) visited[j] = false;

		dfs(0);

		bool bridge = false;
		rep(j, N) if (visited[j] == false) bridge = true;
		if (bridge) ans++;

		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}

	cout << ans << endl;

	return 0;
}



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

const int MAX = 1e5+5;
vector<int> graph[MAX];
int visited[MAX];
vector<int> res;
int N, M;

void dfs(int cur) {
    res.push_back(cur);
    visited[cur] = true;
    for (int& child : graph[cur]) {
        if (!visited[child]) {
            dfs(child);
            return;
        }
    }
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; ++i) {
        int a, b; cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    dfs(1);
    reverse(res.begin(), res.end());
    res.pop_back();
    dfs(1);
    cout << res.size() << endl;
    for (int& i : res) cout << i << " ";
    return 0;
}


Measured memory_bytes: 10104