akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

public class Main {
  private static int solve(int[] as) {
    Set<Integer> set = new HashSet<>();
    for (int a : as) {
      set.add(a);
    }
    return set.size();
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int[] as = reader.nextInt(3);
    out.println(solve(as));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 21204
/*     *******************Bismillahir Rahmanir Rahim************************
                          MD. ASFAKUL GHANI!
                          *ProMAGFAT*!
 SECRET_warning :)->FAT   CSE-25!
                          JAHANGIRNAGAR UNIVERSITY!
                          Dhaka,Bangladesh!
*/

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

#define           fasterIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define           Im int main()
#define           ll long long
#define           sc scanf
#define           pf printf
#define           rn0 return 0
#define           rn return
#define           f0(i,n) for(ll i=0;i<n;i++)
#define           f1(i,n) for(ll i=1;i<=n;i++)
#define           f2(i,n) for(ll i=n-1;i>=0;i--)
#define           pi 2*acos(0.0)
#define           modulo 1000003
#define           dd double
#define           PI 3.14159265358979
#define           pi 2*acos(0.0)
#define           p_b push_back
#define           ps push

/*
ll for_binarySearch(ll a,ll b,ll aa[],ll x){while(a<=b){ll mid=(a+b)/2;if(aa[mid]==x) return 1;else if(aa[mid] > x) b=mid-1;else a=mid+1;}return -1;}
ll for_gcd(ll a,ll b){if(a==0) return b;else return for_gcd(b%a,a);}
ll for_prime(ll x){for (ll i=2;i*i<=x;i++){if(x%i==0) return 0;}return 1;}
void for_swap(char *x,char *y){char temp;temp=*x;*x=*y;*y=temp;}
ll for_big_mod(ll b,ll p,ll m){if(p==0) return 1;else if(p%2==0){ll k=for_big_mod(b,p/2,m);return (k*k)%m;}else return ((b%m)*(for_big_mod(b,p-1,m)))%m;}
ll for_josephus(ll n,ll k){if(n==1) return 1;return (for_josephus(n-1,k)+k-1)%n+1;}
ll for_gcdExtended(ll a,ll b,ll *x,ll *y){if(a==0){*x=0;*y=1;return b;}ll x1,y1;ll gcd=for_gcdExtended(b%a,a,&x1,&y1);*x=y1-(b/a)*x1;*y=x1;return gcd;}
*/
/*
void debug1()
{
    cout << "***" << endl;
}

void debug11(ll n)
{
    cout << n << endl;
}
*/

Im
{
    /*#ifdef FAT
       freopen("input.txt","w",stdin);
    #endif // FAT*/

    fasterIO;

    ll n;
    cin>>n;
    ll a1[n+5];
    for (ll i = 0; i < n; i += 1) cin>>a1[i];
    for (ll i = 0; i < n; i += 1){
        if (i==0) cout << a1[i];
        else cout << " " << a1[i];
    }
    cout << endl;
    for (ll i = 1; i < n; i += 1){
        ll pos = a1[i];
        ll j = i-1;
        while (j >= 0 && a1[j] > pos){
            a1[j+1] = a1[j];
            j -= 1;
        }
            a1[j+1] = pos;
        for (ll k = 0; k < n; k += 1){
            if (k==0) cout << a1[k];
            else cout << " " << a1[k];
        }
        cout << endl;
    }

   // main();

    rn0;
}

Measured memory_bytes: 3220
#include<iostream>
using namespace std;
int main(){
  int n,a[10000],b[10000],ap,bp;
  while(1){
    cin>>n;
    if(n==0)break;
    ap=0,bp=0;
    for(int i=0;i<n;i++){
      cin>>a[i]>>b[i];
    }
    for(int i=0;i<n;i++){
      if(a[i]>b[i]){
	ap+=a[i]+b[i];
      }else if(a[i]<b[i]){
	bp+=a[i]+b[i];
      }else if(a[i]==b[i]){
	ap+=a[i];
	bp+=b[i];
      }
    }
    cout<<ap<<" "<<bp<<endl;
  }
  return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <cmath>
#include <cstring>

using namespace std;

const int maxN = 110, maxW = 1e5 + 10;

int w[maxN], v[maxN], W, n;
long long f[maxN][maxW];

// Max value chon tu i -> n with capacity weight
long long calculate(int i, int weight) {
    if (i > n) return 0;
    if (f[i][weight] != -1) return f[i][weight];
    long long ret = calculate(i + 1, weight);
    if (w[i] <= weight)
        ret = max(ret, calculate(i + 1, weight - w[i]) + v[i]);
    return f[i][weight] = ret;
}

int main() {
    cin >> n >> W;
    for (int i = 1; i <= n; ++i) scanf("%d %d", &w[i], &v[i]);
    memset(f, 255, sizeof(f));
    cout << calculate(1, W);
}


Measured memory_bytes: 86272
import java.util.*;

public class Main
{
	public static void main(String args[])
	{
		Scanner s1=new Scanner (System.in);
		int n,r;
		n=s1.nextInt();
		r=s1.nextInt();
		if(n<10)
		{
			System.out.print(r+100*(10-n));
		}
		else
		{
			System.out.println(r);
		}
	}
}

Measured memory_bytes: 21076
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>
 
using namespace std;
 
//conversion
//------------------------------------------
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(); }
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())
 
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const ll MOD = (ll)1000000007;//10^9+7
const ll INF2 = (ll)100000000000000000;//10^18


int main() {
    string s;
    cin>>s;
    VI p(26,0);
    int flag = 0;
    for(auto t:s){
        p[t-'a'] += 1;
    }
    REP(i,26){
        if(p[i]%2!=0){
            flag++;
        }
    }
    if(flag>0){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<ll> a, b;
    ll ans=0;
    for (int i = 0; i < n; i++)
    {
        int tmp;
        cin >> tmp;
        if (tmp < 0)
        {
            b.push_back(tmp);
            ans-=tmp;
        }
        else
        {
            a.push_back(tmp);
            ans+=tmp;
        }
    }
    sort(all(a));
    sort(all(b),greater<ll>());
    if(b.empty()){
        cout<<ans-2*a[0]<<endl;
        ll hoge=a[0];
        for(int i=1;i<a.size()-1;i++){
            cout<<hoge<<" "<<a[i]<<endl;
            hoge-=a[i];
        }
        cout<<a.back()<<" "<<hoge<<endl;
    }
    else if(a.empty()){
        cout<<ans+2*b[0]<<endl;
        ll hoge=b[0];
        for(int i=1;i<b.size();i++){
            cout<<hoge<<" "<<b[i]<<endl;
            hoge-=b[i];
        }
    }
    else{
        cout<<ans<<endl;
        ll hoge=b[0];
        for(int i=0;i<a.size()-1;i++){
            cout<<hoge<<" "<<a[i]<<endl;
            hoge-=a[i];
        }
        cout<<a.back()<<" "<<hoge<<endl;
        hoge=a.back()-hoge;
        for(int i=1;i<b.size();i++){
            cout<<hoge<<" "<<b[i]<<endl;
            hoge-=b[i];
        }
    }
}

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

#define MAX 40

int n;
pair<char, int> card4Bubble[MAX];
pair<char, int> card4Selection[MAX];

void bubbleSort();
void selectionSort();

int main(void) {

  char type;
  int number;

  cin >> n;

  //input.
  for(int i = 0; i < n; i++) {
    cin >> type;
    cin >> number;
    card4Bubble[i].first = type;
    card4Bubble[i].second = number;

    card4Selection[i].first = type;
    card4Selection[i].second = number;
  }


  bubbleSort();
  selectionSort();


  //bubble sort is stable sort.
  for(int i = 0; i < n; i++) {
    if(i == 0) {
      cout << card4Bubble[i].first << card4Bubble[i].second;
    }
    else {
      cout << " " << card4Bubble[i].first << card4Bubble[i].second;
    }
  }
  cout << endl;
  cout << "Stable" << endl;


  int flag = 1;

  for(int i = 0; i < n; i++) {
    //check stable.
    if(card4Bubble[i].first != card4Selection[i].first) {
      flag = 0;
    }
    if(i == 0) {
      cout << card4Selection[i].first << card4Selection[i].second;
    }
    else {
      cout << " " <<card4Selection[i].first << card4Selection[i].second;
    }
  }
  cout << endl;

  if(flag) {
    cout << "Stable" << endl;
  }
  else {
    cout << "Not stable" << endl;
  }
  return 0;
}

void bubbleSort() {
  for(int i = 0; i < n; i++) {
    for(int j = n - 1; j > i; j--) {
      if(card4Bubble[j].second < card4Bubble[j - 1].second) {
        pair<char, int> tmp;
        tmp = card4Bubble[j];
        card4Bubble[j] = card4Bubble[j - 1];
        card4Bubble[j - 1] = tmp;
      }
    }
  }
}

void selectionSort() {
  for(int i = 0; i < n; i++) {
    int minJ = i;
    for(int j = i; j < n; j++) {
      if(card4Selection[j].second < card4Selection[minJ].second) {
        minJ = j;
      }
    }
    pair<char, int> tmp;
    tmp = card4Selection[i];
    card4Selection[i] = card4Selection[minJ];
    card4Selection[minJ] = tmp;
  }
}

Measured memory_bytes: 1164
n=int(input())
inf=float("inf")
DP=[inf]*(n+1)
DP[0]=0

for i in range(1,n+1):
    DP[i]=DP[i-1]+1
    for P in (6,9):
        cnt=1
        while P**cnt<=i:
            DP[i]=min(DP[i-1]+1,DP[i-P**cnt]+1,DP[i])
            cnt +=1
            
print(DP[n])

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll>G[100005];
ll dp[100005],MOD,ans[100005],par[100005];
int n;
void go(int v, int p) {
	dp[v] = 1;
	for(int i=0;i<G[v].size();i++)
	{
		ll u=G[v][i];
		if(u==p)continue;
		go(u,v);
		dp[v]=dp[v]*(1+dp[u])%MOD;
	}
}
void dfs(int v,int p)
{
	vector<ll>pre,suf;
	int cur=1;
	for(int i=0;i<G[v].size();i++)
	{
		ll u=G[v][i];
		if(u==p)
		{
			pre.push_back(cur);
			continue;
		}
		cur=cur*(1+dp[u])%MOD;
		pre.push_back(cur);
	}
	cur=1;
	for(int i=G[v].size()-1;i>=0;i--)
	{
		int u=G[v][i];
		if(u==p)
		{
			suf.push_back(cur);
			continue;
		}
		cur=cur*(1+dp[u])%MOD;
		suf.push_back(cur);
	}
	reverse(suf.begin(),suf.end());
	for(int i=0;i<G[v].size();i++)
	{
		int u=G[v][i];
		if(u==p)continue;
		if(v==1)par[v]=1;
		else par[v]=1+par[p];
		if(i)par[v]=par[v]*pre[i-1]%MOD;
		if(i<G[v].size()-1)par[v]=par[v]*suf[i+1]%MOD;
		ans[u]=dp[u]*(1+par[v])%MOD;
		dfs(u,v);
	}
}
int main(){
	cin>>n>>MOD;
	for(int i=1;i<n;i++)
	{
		ll x,y;
		cin>>x>>y;
		G[x].push_back(y);
		G[y].push_back(x);
	}
	go(1,1);
	ans[1]=dp[1];
	dfs(1,1);
	for(int i=1;i<=n;i++)
		cout<<ans[i]<<endl;
	return 0;
}

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

int main(){
    ll a;
    cin>>a;
    ll ans=0;
    for (int i = 0; i <= a; ++i) {
        if(i%3!=0 && i%5!=0)ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(){
    vector<char> c(9);
    rep(i,9){
        cin >> c.at(i);
        if(i==0||i==4||i==8){
            cout << c.at(i);
        }
    }
    cout << endl; 
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        String str = sc.next();
        int cnt = 0;
        for(int i = 0; i<str.length()/2; i++) {
            char a = str.charAt(i);
            char b = str.charAt(str.length()-1-i);
            if(a != b) {
                cnt++;
            }
        }
	    System.out.println(cnt);
    }
}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
 
    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }
 
    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
 
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }
 
    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
 
    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
 
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 22996
#include<stdio.h>
int main(){
  int K;
  int A,B;
  scanf("%d%d%d",&K,&A,&B);
  for(int i=0;i<1000;i++){
    if(K*i<=B&&K*i>=A){
      printf("OK");
      return 0;
    }
  }
  printf("NG");
  return 0;
}



Measured memory_bytes: 1728
function Main(input) {
	input = input.trim();
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  	var list = [input[0]+input[1],input[2]+input[1],input[0]+input[2]];	
  console.log(Math.min.apply(null,list));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		long[] a = new long[n];
		for(int i = 0; i < n; i++) {
			a[i] = stdIn.nextLong();
		}
		
		long[]s = new long[n+1];
		for(int i = 0; i < n; i++) {
			s[i+1] = s[i] + a[i];
		}
		//Map<Long,Integer> map = new HashMap<>();
		Map<Long,Long> map = new HashMap<>();
		
		
		for(int i = 0; i < n+1; i++) {
			if(!map.containsKey(s[i])) {
				map.put(s[i], (long)0);
			}
			map.put(s[i], map.get(s[i])+1);
		}
		long cnt = 0;
		
		/*for(int i = 0; i < map.size(); i++) {
			if(map.get(s[i]) < 1) {
				continue;
			}else {
				cnt += map.get(s[i])*(map.get(s[i])-1)/2;
			}
		}*/
		
		for(long ss: map.keySet()) {
			if(map.get(ss) < 2) {
				continue;
			}else {
				cnt += map.get(ss)*(map.get(ss)-1)/2;
			}
		}
		
		System.out.println(cnt);
		
	}

}


Measured memory_bytes: 101124
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vll a(n);
  rep (i, n) {
    scanf("%lld", &a[i]);
  }
  map<ll, ll> cnt;
  ll sum = 0;
  cnt[sum] += 1;
  rep (i, n) {
    sum += a[i];
    cnt[sum] += 1;
  }
  ll ans = 0;
  for (auto cn : cnt) {
    ll cs = cn.second;
    ans += cs * (cs - 1) / 2;
  }
  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 14336
//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>

//macros
#define INF 1e9
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define vecuni(a) (a).erase(unique((a).begin(),(a).end()),(a).end())

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvs = vector<vector<string>>;
template<class T>
using vec = vector<T>;

//frequent functions
int gcd(int a, int b){
  if (a == 0) 
    return b; 
  return gcd(b % a, a); 
}
int findGCD(vector<int> &arr, int n){
  int result = arr[0]; 
  for (int i = 1; i < n; i++) 
    result = gcd(arr[i], result); 
  return result; 
}
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; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
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 << "\t";
  }
  return s;
}
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;
}
//end

int a,b;
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> a >> b;
  cout << (a-1) + ((b>=a)?1:0) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll h; cin >> h;
  ll n=0;
  while(h > 0){
    h /= 2;
    n++;
  }
  cout << ll(pow(2,n)-1) << endl;
}

Measured memory_bytes: 4100
import math
from itertools import permutations

#print(math.factorial(5))
bi = 0
ci = 0

a = int(input())
b = list(input().split())
c = list(input().split())

bstr = ''.join(b)
cstr = ''.join(c)

blist = sorted([''.join(p) for p in permutations(b)])
clist = sorted([''.join(p) for p in permutations(c)])

for i in range(math.factorial(a)):
	if bstr == blist[i]:
		bi = i
	if cstr == clist[i]:
		ci = i
print(abs(bi - ci))
#print(blist)
#print(clist)

Measured memory_bytes: 9304
#include <bits/stdc++.h>
#define INF 1e9
#define endl '\n'
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define FORE(i, a, b) for (int i = (a), e = (b); i < e; ++i)
#define RFORE(i, a, b) for (int i = (b)-1, e = (a); i >= e; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())
using namespace std;
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, C, K;
    cin >> N >> C >> K;
    vector<int> T(N);
    for (int i = 0; i < N; i++) {
        cin >> T.at(i);
    }
    SORT(T);
    int ans = 0;
    for (int i = 0; i < N;) {
        int passenger = 0;
        int first     = T.at(i);
        int end       = T.at(i);
        while ((i < N) && (C > passenger)) {
            end = T.at(i);
            if (K < end - first) { break; }
            ++passenger;
            ++i;
        }
        ++ans;
    }
    cout << ans << endl;
}


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

    int n;
    int d[100];

    cin>>n;
    rep(i,n)    cin>>d[i];

    int ans=0;

    for(int i=0;i<n;i++) {
        for(int j=i+1;j<n;j++) {
            ans+=d[i]*d[j];
        }
    }
    cout<<ans<<endl;

 return 0;
}

Measured memory_bytes: 256
void main() {
	(700 + readln.chomp.count!"a == 'o'" * 100).writeln;
}

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

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
cnt = 0

while True:
    for i in range(n):
        if a[i] % 2 == 0:
            a[i] /= 2
        else:
            break
    else:
        cnt += 1
        continue
    break

print(cnt)


Measured memory_bytes: 2940
/* Author: Dhruv Rastogi */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int> 
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
const long double PI = acos(-1.0);

void solve(){  
	int a;
	cin>>a;
	string b;
	cin>>b;
	b.erase(b.begin()+sz(b)-3);

	cout<<a*(stoi(b))/100<<endl;  
}

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

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  string a, b;
  cin >> a >> b;

  if (a.size() > b.size()) cout << "GREATER" << endl;
  else if (a.size() < b.size()) cout << "LESS" << endl;
  else if (a > b) cout << "GREATER" << endl;
  else if (a < b) cout << "LESS" << endl;
  else cout << "EQUAL" << endl;

  return 0;
}


Measured memory_bytes: 3596
from collections import defaultdict

n = int(input())
d = defaultdict(int)
for i in range(1, n + 1):
    d[str(i)[0] + str(i)[-1]] += 1
ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += d[str(i) + str(j)] * d[str(j) + str(i)]
print(ans)

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <numeric>
#include <vector>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

int main(){
    lli n;
    cin >> n;
    vector<lli> v;
    for(lli i = 0; i < n; i++){
        lli z;
        cin >> z;
        v.push_back(z);
    }

    //sort(v.begin(), v.end());

    lli ans = v[0], g = v[0];
    for(lli i = 1; i < n; i++){
        g = __gcd(ans, v[i]);
        ans = v[i] / g * ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

vi f(vi a, vi b) {
  vi c(3);
  rep(i, 3) {
    c[b[i]] = a[i];
  }
  return c;
}

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

  int n;
  cin >> n;
  map<vi, int> mp;
  vvi perms = {
    {0, 1, 2},
    {0, 2, 1},
    {1, 0, 2},
    {1, 2, 0},
    {2, 0, 1},
    {2, 1, 0}
  };
  rep(i, n) {
    int w;
    cin >> w;
    vi perm(3);
    iota(all(perm), 0);
    rep(j, w) {
      int a;
      cin >> a;
      if (a == 0) {
        swap(perm[0], perm[1]);
      }
      else {
        swap(perm[1], perm[2]);
      }
    }
    mp[perm]++;
  }

  /*
  for (auto p : mp) {
    rep(i, 3) cerr << p.first[i] << " ";
    cerr << ": " << p.second << endl;
  }
  */

  if (mp[perms[0]] >= 1
    || mp[perms[1]] >= 2
    || mp[perms[2]] >= 2
    || mp[perms[3]] >= 3
    || mp[perms[4]] >= 3
    || mp[perms[5]] >= 2)
  {
    cout << "yes" << endl;
    return 0;
  }

  vvi list;
  rep(i, 6) {
    rep(j, mp[perms[i]]) {
      list.push_back(perms[i]);
    }
  }

  rep(state, 1 << list.size()) {
    // cerr << "state = " << state << endl;
    if (state == 0) continue;
    vvi chosen;
    rep(i, list.size()) {
      if ((state >> i) & 1) {
        chosen.push_back(list[i]);
      }
    }
    sort(all(chosen));
    do {
      // printVV(chosen);
      vi perm(3);
      iota(all(perm), 0);
      rep(i, chosen.size()) {
        perm = f(perm, chosen[i]);
      }
      if (perm == perms[0]) {
        cout << "yes" << endl;
        return 0;
      }
    } while (next_permutation(all(chosen)));
  }

  cout << "no" << endl;

}



Measured memory_bytes: 3236
<?php
fscanf(STDIN, "%d", $n);
if (!$n) exit('0');
$b = 1;
$x = null;
while ($n) {
	if ($n % ($b * 2)) {
		$n -= $b;
		$x = '1' . $x;
	} else {
		$x = '0' . $x;
	}
	$b *= -2;
}
echo $x;

Measured memory_bytes: 4604
#include<stdio.h>

int main()
{

	int a,b,d,r;
	double f;

	scanf("%d %d",&a,&b);
	d=a/b;
	r=a%b;
	f=(double)a/b;
	printf("%d %d %f\n",d,r,f);

	return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <stdio.h>
using namespace std;
 
int main(){
  int a,b,c,d,n,count = 0;
  while(scanf("%d",&n)!=EOF){
     
    count=0;
    for(a = 0;a <= 9;a++){
    for(b = 0;b <= 9;b++){
      for(c = 0;c <= 9;c++){
    for(d = 0;d <= 9;d++){
      if((a+b+c+d) == n)count++;
    }
      }
    }
    }
    cout << count <<endl;
  }
  return 0;
}

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

using namespace std;

#define INF (1ll << 62)
#define pb push_back
#define ii pair<int,int>
#define OK cerr <<"OK"<< endl
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define endl '\n'

int mod(int n) {
	return (n % ((int)1e9 + 7) + ((int)1e9 + 7))%((int)1e9 + 7);
}

signed main () {
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n, k;

  cin >> n >> k;

  int dp[n + 1][k + 1];
  int pref[n + 1][k + 1];

  memset(dp, 0, sizeof(dp));
  memset(pref, 0, sizeof(pref));

  for(int i = 0; i <= n; i++) dp[i][0] = 1;
  for(int i = 0; i <= n; i++) pref[i][0] = 1;
  for(int i = 0; i <= k; i++) pref[0][i] = 1;

  for(int i = 1; i <= n; i++) {
  	int x; cin >> x;
  	for(int j = 1; j <= k; j++) {

  		int l = max(0ll, j - x);
  		if(l == 0)
  			dp[i][j] = pref[i - 1][j];
  		else
  			dp[i][j] = mod(pref[i - 1][j] - pref[i - 1][j - x - 1]);

  		// cerr << dp[i][j] << " \n"[j==k];
  		pref[i][j] = mod(dp[i][j] + pref[i][j - 1]);
  	}
  }

  cout << dp[n][k] << endl << flush;

  // assert(false);

}

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

#define ll long long int
ll const mod = 1e9 + 7;

ll power(ll x, ll y, ll p){ //x^y % p
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or equal to p 
    while (y > 0) {
        if (y & 1) // If y is odd, multiply x with result 
        res = (res*x) % p; 
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
}

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll n, k;
    cin>>n>>k;
    ll min=n-k*(n/k);
    
    if(min<abs(min-k))
    cout<<min;
    else
    cout<<abs(min-k);
    
	// your code goes here
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
  string S;
  cin >> S;
  int l = (int)S.size(), t = 0;
  string T = "";
  for(int i = 0; i < l; ++i){
    if(S[i] != 'w'){
      T += S[i];
      ++t;
    }else{
      if(t >= 2 && T[t-2] == 'm' && T[t-1] == 'e'){
	T.erase(T.end()-2,T.end());
	t -= 2;
      }else{
	cout << "Rabbit" << endl;
	return 0;
      }
    }
    if(i < l-1 && T == ""){
      cout << "Rabbit" << endl;
      return 0;
    }
    //cout << T << endl;
  }
  if(T == "") cout << "Cat" << endl;
  else cout << "Rabbit" << endl;
  return 0;
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;

int main(){
    int n,m;
    cin>>n>>m;
    std::vector<bool> han(n,0);
    std::vector<int> ba(n,1);
    han[0]=1;
    rep(i,m){
        int x,y;
        std::cin >> x>>y;
        x--;y--;
        ba[x]--;
        ba[y]++;
        if(han[x])han[y]=1;
        if(ba[x]==0)han[x]=0;
    }
    int ans=0;
    rep(i,n)if(han[i])ans++;
    std::cout << ans << std::endl;

    
}


Measured memory_bytes: 640
#include <cstdio>

using namespace std;
int gcd(int x, int y) {
	while(y) {
		int t = x%y;x=y;y=t;
	}
	return x;
}

int main() {
	while(true) {
		int a,b;
		if(scanf("%d%d", &a, &b)<2)break;
		int g = gcd(a,b);
		int l = a/g*b;
		printf("%d %d\n", g, l);
	}
	return 0;
}

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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  int L = A+B, R=C+D ;
  if ( L>R ) { puts("Left");}
  else if ( L<R ) { cout << "Right";}
  else { cout << "Balanced";}
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

    public static void main(String[] args) throws Exception {
        Scanner stdId = new Scanner(System.in);
        int W = stdId.nextInt();
        int H = stdId.nextInt();
        int x = stdId.nextInt();
        int y = stdId.nextInt();
        int r = stdId.nextInt();

        String j = "No";

        if (x >= r && y >= r) {
            if (x <= (W - r) && y <= (H - r)) {
                j = "Yes";
            }
        }

        System.out.println(j);

    }
}

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

int main(){
  string S;
  cin >> S;
  
  reverse(S.begin(),S.end());
  
  bool ans=false;
  
  int i=0;
    
  while(i<S.size()){
    if(S.at(i)=='r'&&S.at(i+1)=='e'&&S.at(i+2)=='s'&&S.at(i+3)=='a'&&S.at(i+4)=='r'&&S.at(i+5)=='e'){
      i=i+6;
    }
    else if(S.at(i)=='e'&&S.at(i+1)=='s'&&S.at(i+2)=='a'&&S.at(i+3)=='r'&&S.at(i+4)=='e'){
      i=i+5;
    }
    else if(S.at(i)=='m'&&S.at(i+1)=='a'&&S.at(i+2)=='e'&&S.at(i+3)=='r'&&S.at(i+4)=='d'){
      i=i+5;
    }
    else if(S.at(i)=='r'&&S.at(i+1)=='e'&&S.at(i+2)=='m'&&S.at(i+3)=='a'&&S.at(i+4)=='e'&&S.at(i+5)=='r'&&S.at(i+6)=='d'){
      i=i+7;
    }
    else{
      break;
    }
  }

    
  
  
  if(i==S.size()){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}
    
      
  
  

Measured memory_bytes: 512
#include <stdio.h>
#define MAX 100000
#define NIL -1

void rec(int,int);
void print(int);
struct Node{
  int parent;
  int left;
  int right;
};

struct Node gNode[MAX];
int gDepth[MAX];

int main(){

  int nodeNum,nodeIndex,node,left,root,n,i,j;
  scanf("%d",&n);
  //初期化
  for(i=0;i<n;i++){
    gNode[i].parent=gNode[i].left=gNode[i].right=NIL;
  }
  //nodeに代入
  for(i=0;i<n;i++){
    scanf("%d%d",&nodeIndex,&nodeNum);
    for(j=0;j<nodeNum;j++){
      scanf("%d",&node);
      if(j==0){
	gNode[nodeIndex].left=node;
      }
      else{
	gNode[left].right=node;
      }
      left=node;
      gNode[node].parent=nodeIndex;
    }
  }
  //rootを探す
  for(i=0;i<n;i++){
    if(gNode[i].parent==NIL){
      root=i;
    }
  }
  //根からはじまって深さを代入
  rec(root,0);

  //nodeのindexごと出力する
  for(i=0;i<n;i++){
    print(i);
  
  }
  return 0;
}

  void rec(int node, int parent){
  
    gDepth[node]=parent;
    if(gNode[node].right != NIL){
      //右の兄弟に同じ深さを設定
      rec(gNode[node].right,parent);
    }
    if(gNode[node].left != NIL){
      //最も左の子に自分の深さ+1を設定
      rec(gNode[node].left,parent+1);
    }
  }

  void print(int node){
    
    int left;
    printf("node %d: ",node);
    printf("parent = %d, ",gNode[node].parent);
    printf("depth = %d, ",gDepth[node]);

    if(gNode[node].parent==NIL)
      printf("root, ");

    else if(gNode[node].left==NIL)
      printf("leaf, ");
   
    else printf("internal node, ");

    printf("[");

    for(left = gNode[node].left; left != NIL; left = gNode[left].right){
      printf("%d",left);
      if(gNode[left].right!=-1)printf(", ");
    }
    printf("]\n");
  }

   



Measured memory_bytes: 6416
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define MAP map<int,int>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;
const ll INF = (ll)1e17;

void ANS(bool flag){
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Ans(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void ans(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	int N, A, B;
	cin >> N;
	cout << N / 3;




	return 0;
}


Measured memory_bytes: 764
class Factorial:
    def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
    def factorial(self, j):
        return self.f[j]
    def ifactorial(self, j):
        return self.i[j]
    def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0

from collections import *
MOD = 10 ** 9 + 7
# n = int(input())
# a = map(int, input().split())
n, *a = map(int, open(0).read().split())
v, _ = Counter(a).most_common(1)[0]
l = -1
for i, b in enumerate(a):
    if b == v:
        if l < 0:l = i
        else: r = n - i
c = Factorial(n + 1, MOD).comb
for k in range(n + 1):
    print ((c(n + 1, k + 1) - c(l + r, k)) % MOD)

Measured memory_bytes: 19680
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll bucket[100001] = {0};
    ll res = 0;

    for (ll i = 0; i < n; ++i){
        ll a;
        cin >> a;
        if(a > 100000)res++;
        else bucket[a-1] += 1;
    }

    for (ll i = 0; i < 100001; ++i){
        if(bucket[i] != 0 && bucket[i] != i+1) {
            if(bucket[i] < i+1) res += bucket[i];
            else res += bucket[i] - i - 1;
        }
    }
    cout << res << endl;


}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用

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

	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	int ans = 0;
	rep(i, n)
	{
		cin >> h[i];
		if (h[i] >= k)
		{
			ans++;
		}
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 640
//
//  spy.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
#define PI 3.14159265


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

  ll n;

  std::cin >> n;
  std::map<ll, ll> m;
  ll a[n];

  for (int i = 0; i < n; i++) {
    std::cin >> a[i];

    m[i+a[i]] += 1;
  }

  ll sum = 0;
  for (int i = 0; i < n; i++) {
    if (i > a[i]) {
      if (m.count(i-a[i])) {
        sum += m[i-a[i]];
        // std::cout << i-a[i] << " " << m[i-a[i]] << std::endl;
      }
    }
  }
  // for (std::map<ll, ll>::iterator it = m.begin(); it != m.end(); it++) {
  //   sum += it->second - 1;
  //   std::cout << it->first << " " << it->second << std::endl;
  // }

  std::cout << sum << std::endl;


  return 0;
}


Measured memory_bytes: 17616
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0

for ai in range(a+1):
  if 500 * ai > x:
    break
  for bi in range(b+1):
    if 500 * ai + 100 * bi > x:
      break
    for ci in range(c+1):
      if 500*ai + 100 * bi + 50 * ci == x:
        count += 1
      if 500*ai + 100 * bi + 50 * ci > x:
        break

print(count)

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

using namespace std;

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

    int n, x, t, r = 0, temp = 0;

    cin >> n >> x >> t;

    while (true) {
        temp += x;
        r++;
        if (temp >= n) {
            break;
        }
    }
     
    cout << r * t;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll a, b;
	cin >> a >> b;

	ll tall = 0;
	REP(i, b-a+1) tall += i;
	cout << tall - b << endl;
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    int counter = 0;
    if (s[0] == 'o') ++counter;
    if (s[1] == 'o') ++counter;
    if (s[2] == 'o') ++counter;
    cout << 700 + 100 * counter << endl;
}

Measured memory_bytes: 256
def insertionSort(N):
    print(' '.join(map(str, A)))
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(' '.join(map(str, A)))


if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    insertionSort(N)



Measured memory_bytes: 5604