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

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 static 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());}
}

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    int a = sc.nextInt();
    String s = sc.next();
    if(a >= 3200) out.println(s);
    else out.println("red");
  }
}

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

void out(vector<int> &v)
{
    for(int i = 0;i < v.size();i++)
    {
        cout << v.at(i);
        if(i + 1 != v.size())
        {
            cout << " ";
        }
        else
        {
            cout << endl;
        }
    }
}

int main()
{
    int n;
    cin >> n;
    vector<int> v;
    for(int i = 0;i < n;i++)
    {
        int t;
        cin >> t;
        v.push_back(t);
    }
    out(v);
    for(int i = 1;i < n;i++)
    {
        int it = i;
        while(v.at(it) < v.at(it -1))
        {
            int t = v.at(it - 1);
            v.at(it - 1) = v.at(it);
            v.at(it) = t;
            it--;
            if(it == 0)
            {
                break;
            }
        }
        out(v);
    }
}

Measured memory_bytes: 1220
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
    if(a.S==b.S)
        return a.F>b.F;

       return (a.S > b.S);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;

   cin>>n;

     ll ara[n+3];

  for(i=1; i<=n; i++)cin>>ara[i];

  ll L[n+2],G[n+2];

  L[1]=ara[1];
  G[n]=ara[n];


    for(i=2; i<=n; i++)
    {
        L[i]=__gcd(L[i-1],ara[i]);
    }

    for(i=n-1; i>=1; i--)
    {
        G[i]=__gcd(ara[i],G[i+1]);
    }

    for(i=2; i<=n; i++)
    {
        ll g=__gcd(L[i-1],G[i+1]);

        ans=max(g,ans);
    }

    ans=max3(ans,G[2],L[n-1]);

    cout<<ans<<endl;
}



Measured memory_bytes: 5968
import math

n,d=map(int,input().split())

x=[]

for i in range(n):
    x.append([int(x) for x in input().split()])
    
count=0
buf=0

for i in range(n):
    for j in range(i+1,n):
        for k in range(d):
            buf+=(x[i][k]-x[j][k])**2
        if math.sqrt(buf).is_integer() == True:
            count+=1
        buf=0
print(count)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

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

    return 0;
}


Measured memory_bytes: 888
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        String s;
        try (Scanner cin = new Scanner(System.in)) {
            s = cin.next();
        }
        int cindex = s.indexOf('C');
        if (s.startsWith("A") && cindex > 1 && cindex < s.length() - 1) {
            for (int i = 1; i < s.length(); i++) {
                if (i != cindex && !Character.isLowerCase(s.charAt(i))) {
                    System.out.println("WA");
                    return;
                }
            }
            System.out.println("AC");
            return;
        }

        System.out.println("WA");
    }
}

Measured memory_bytes: 21716
/******************************************
* AUTHOR : SHASHANK *
* NICK : lance_lot *
* INSTITUTION : BIT MESRA *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define N 100005
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl "\n"
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <ll, ll> pll;
const ll M=1e9+7;
ll inf=1e18;
ll w[105],v[105];
ll n;
ll dp[105][100005];
ll rec(ll i,ll W) {
    if(i >= n || W <= 0)
        return 0;
    if(dp[i][W] != -1)
        return dp[i][W];
    if(W-w[i] >= 0)
        dp[i][W] = max(v[i]+rec(i+1,W-w[i]),rec(i+1,W));
    else
        dp[i][W] = rec(i+1,W);
    return dp[i][W];
}

int main() {
fast;
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll W;
    cin>>n>>W;
    for(ll i = 0;i < n;i++)
        cin>>w[i]>>v[i];
    for(ll i = 0;i < 105;i++) {
        for(ll j = 0;j < 100005;j++)
            dp[i][j] = -1;
    }
    ll ans = rec(0,W);
    cout<<ans;
}

Measured memory_bytes: 82304
import java.util.Scanner;

public class Main {

	private static final long x = (long) Math.pow(10, 18);

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		long c = sc.nextInt();
		long k = sc.nextLong();

		if (k % 2 == 0) {
			System.out.println(a - b);
		} else {
			System.out.println(b - a);
		}

		sc.close();
	}

}


Measured memory_bytes: 35608
#include<stdio.h>

//マクロの定義
#define TRUE 1
#define FALSE 0
#define X1 0
#define Y1 1
#define X2 2
#define Y2 3
#define D_SET 4

#define compile 0 //デバッグ用,0:実装,1:func_judgeのデバッグ,2:func_outputのデバッグ

//構造体の宣言
struct straight
{
	double cdn[D_SET]; //座標を代入する配列
};

//関数のプロトタイプ宣言
int func_judge(double cdn1[], double cdn2[]);
void func_output(int flag);

main()
{
	int i = 0, n = 0, flag = 0; //i:制御変数,n:データセット数を代入する変数,flag:フラグ管理変数
	
	scanf("%d", &n); //データセット数を取得
	
	for(i = 0; i < n; i++)
	{
		flag = 0; //フラグ変数を初期化
		struct straight s1 = {0, 0, 0, 0}; //構造体変数の初期化
		struct straight s2 = {0, 0, 0, 0}; //構造体変数の初期化
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &s1.cdn[X1], &s1.cdn[Y1], &s1.cdn[X2], &s1.cdn[Y2], &s2.cdn[X1], &s2.cdn[Y1], &s2.cdn[X2], &s2.cdn[Y2]);
		//入力を取得
#if compile == 1
		printf("%lf %lf %lf %lf %lf %lf %lf %lf\n", s1.cdn[X1], s1.cdn[Y1], s1.cdn[X2], s1.cdn[Y2], s2.cdn[X1], s2.cdn[Y1], s2.cdn[X2], s2.cdn[Y2]);
#endif
		flag = func_judge(s1.cdn, s2.cdn); //判定を行う関数への値渡し
#if compile == 1
		printf("flag = %d\n", flag);
#endif
		func_output(flag);
	}
	
	return 0;
}
int func_judge(double cdn1[], double cdn2[])
{
	double temp = 0; //値入れ替え用の変数
	double delta1 = 0, delta2 = 0; //傾き代入用変数
	
#if compile == 2
	int r = 0;
	for(r = 0; r < D_SET; r++)
	{
		printf("cdn1[%d] = %lf\n", r, cdn1[r]);
	}
	for(r = 0; r < D_SET; r++)
	{
		printf("cdn2[%d] = %lf\n", r, cdn2[r]);
	}
#endif
	if((cdn1[X2] == cdn1[X1]) && ((cdn2[X2] == cdn2[X1])))
	{
		return TRUE;
	}
	
	delta1 = (cdn1[Y2] - cdn1[Y1]) / (cdn1[X2] - cdn1[X1]); //傾きの計算
	
#if compile == 2
	printf("delta1 = %lf\n", delta1);
#endif
	delta2 = (cdn2[Y2] - cdn2[Y1]) / (cdn2[X2] - cdn2[X1]);
	
#if compile == 2
	printf("delta2 = %lf\n", delta2);
#endif
	if(delta1 < delta2)
	{
		temp = delta1;
		delta1 = delta2;
		delta2 = temp;
	}
	
	if(0.0000000001 > (delta1 - delta2))
	{
		return TRUE;
	}
	else
	{
		return FALSE;
	}
}
void func_output(int flag)
{
	if(FALSE == flag)
	{
		printf("NO\n");
	}
	else
	{
		printf("YES\n");
	}
}

Measured memory_bytes: 620
import sys

[n, y] = map(int, raw_input().split())
a = y // 10000
r = y % 10000
b = r // 5000
r = r % 5000
c = r // 1000
d = n - (a + b + c)
if d < 0:
    print -1, -1, -1
    sys.exit(0)
else:
    if d >= 9:
        k = d // 9
        k = min(a, k)
        a -= k
        c += k * 10
        d -= k * 9
    if d >= 4:
        k = d // 4
        if k > b and a >= 1 and (d != 4 and d != 8 or b == 0):
            a -= 1
            b += 2
            d -= 1
            k = d // 4
        k = min(b, k)
        b -= k
        c += k * 5
        d -= k * 4
    if d > 0:
        if a < d:
            print -1, -1, -1
            sys.exit(0)
        else:
            a -= d
            b += d * 2
    print a, b, c


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

#define ll long long 
#define mkp make_pair 
#define fi first 
#define se second

using namespace std ;

int z ;

int	 main ( ) {

	int n ;
	cin >> n ;
	string s ;
	cin >> s ;
	int k = s.size();
	for(int i = 0 ; i < n - 1 ; i ++ ){
		if( s[i] == s[i+1] ){
			k -- ;
		}
	}
	cout << k ;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

int main()
{
    ll a,b;
    cin>>a>>b;
    if(a==b&&a>0){
        cout<<"Positive"<<endl;
    }
    else if(a==b&&b<0){
        cout<<"Negative"<<endl;
    }
    else if(0<a){
        cout<<"Positive"<<endl;
    }
    else if(b<0){
        if((b-a)%2==1){
            cout<<"Positive"<<endl;
        }
        else{
            cout<<"Negative"<<endl;
        }
    }
    else{
        cout<<"Zero"<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin>>N;

    int V[N], C[N];
    for(int i=0; i<N; i++) {
        cin>>V[i];
    }
    for(int i=0; i<N; i++) {
        cin>>C[i];
    }

    int sum = 0;
    for(int i=0; i<N; i++) {
        if(V[i]>C[i]) {
            sum += (V[i] - C[i]);
        }
    }

    cout<<sum<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  cin >> A;
  cin >> B;
  
  int X = 0;
  for(; A <= B; A++) {
    int A1,A2,A4,A5;
    A1 = A / 10000;
    A2 = A % 10000 / 1000;
    A4 = A % 100 / 10;
    A5 = A % 10;
    
    if(A1 == A5 && A2 == A4){
      X++;
    }
  }
  cout << X << endl;
}

Measured memory_bytes: 256
#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 ld = long double;
using ii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vii = vector<ii>;
using vvii = vector<vii>;

template<class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template<class TIn, class TOut = null_type>
using order_tree = tree<TIn, TOut, less<TIn>, rb_tree_tag,
	tree_order_statistics_node_update>;

constexpr int INF = 1000000010;
constexpr ll LLINF = 1000000000000000010LL;

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

	ll Q, H, S, D, N;
	cin >> Q >> H >> S >> D >> N;
	H = min(2 * Q, H);
	S = min(2 * H, S);
	D = min(2 * S, D);
	
	cout << (D * (N / 2) + (N&1) * S) << endl;
	
	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  if(S == "RRR"){
    cout << 3;
  }
  if(S == "RRS" || S == "SRR"){
    cout << 2;
  }
  if(S == "RSR" || S == "RSS" || S == "SRS" || S == "SSR"){
    cout << 1;
  }
  if(S == "SSS"){
    cout << 0;
  }
  cout << endl;
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<vector>
#include<queue>
using namespace std;

int main(){
	string S;
	cin>>S;
	int length=S.length()-1;
	long ans=stoll(S);
	for(int bit=1;bit<(1<<length);++bit){
		vector<int>arr;
		for(int i=0;i<length;++i){
			if(bit&(1<<i)) arr.push_back(i);
		}
		if(arr.size()>1){
			ans+=stoi(S.substr(0,arr[0]+1));
			for(int i=0;i<(int)arr.size()-1;++i){
				ans+=stoi(S.substr(arr[i]+1,arr[i+1]-arr[i]));
			}
			ans+=stoi(S.substr(arr[(int)arr.size()-1]+1));
		}
		else {
			ans+=stoi(S.substr(0,arr[0]+1))+stoi(S.substr(arr[0]+1));
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
# define ll int
#define M 998244353
#define pb push_back                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
 
							
 
 int main(){
   ios::sync_with_stdio(0);
   cin.tie(0); cout.tie(0);
   char s;
   cin>>s;
   cout<<char(s+1);
   
}

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

namespace LinqTest
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());

            if(N == 1)
            {
                Console.WriteLine("Hello World");
            }

            if(N == 2)
            {
                var A = int.Parse(Console.ReadLine());
                var B = int.Parse(Console.ReadLine());
                Console.WriteLine(A+B);
            }
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "]"; return os; }



int main(){
    LL r, d, x;
    cin >> r >> d >> x;
    for(LL i = 0; i < 10; ++i){
        x = r * x - d;
        cout << x << endl;
    }
    return 0;
}



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

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		String s = fs.next();
		char c[] = s.toCharArray();
		if(c[0]==c[1]&&c[1]==c[2]) System.out.println("No");
		else System.out.println("Yes");
	}

	//MOD culculations
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

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

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

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

Measured memory_bytes: 21204
#include <bits/stdc++.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/irange.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::irange;
using boost::algorithm::join;

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/4;
constexpr int INF=inf<int>;
constexpr ll LINF=inf<ll>;

#define Sort(x) sort(begin(x),end(x))
#define Reverse(x) reverse(begin(x),end(x))
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ull<<(n))
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,(v).size())

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========

int main(int argc, char** argv) {
  int N;
  cin >> N;
  vll A(N);
  for (auto& a : A) {
    cin >> a;
  }

  ll ret = 0;
  REP(i, N) {
    ret += A[i]/2;
    if (i<N-1 && A[i]%2 && A[i+1]) {
      ret += 1;
      A[i+1]--;
    }
  }

  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5+5;
int n, k;
int h[maxN];
int f[maxN];
int main() {
    cin >> n >> k;
    for(int i = 1; i <= n; ++i) cin >> h[i];
    f[1] = 0;
    //f[2] = abs(h[1] - h[2]);
    for(int i = 2; i <= n; ++i) {
        f[i] = 2e9;
        for(int j = 1; j <= k; ++j)
            if (i - j > 0)
                f[i] = min(f[i], f[i-j]+abs(h[i-j]-h[i]));
    }
    cout << f[n] << endl;
}


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


int main(){
  long x,ans;
  cin >> x;


  ans = (x / 11)*2;

  if(x % 11 >= 7){
    ans += 2;
  }
  else if(x % 11 > 0){
    ans +=1;
  }

  cout << ans << endl;

}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N, i, t;
  int cnt = 0;
  
  scanf("%d", &N);
  for (i=3; i<=N; i++) {
    if (i % 3 == 0) {
      printf(" %d", i);
    } else {
      t = i;
      while (t > 0) {
        if (t % 10 == 3) {
          printf(" %d", i);
          break;
        } else {
          t /= 10;
        }
      }
    }
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N, M;cin >> N >> M;
	vector<pair<int, int>>vec(M);
	rep(i, 0, M) {
		int a, b;
		cin >> a >> b;
		--a;--b;
		vec[i] = make_pair(a, b);
	}
	vector<int>cnt(N, 1);
	vector<bool>is(N, false);
	is[0] = true;
	rep(i, 0, M) {
		int a = vec[i].first;
		int b = vec[i].second;
		cnt[a]--;
		cnt[b]++;
		if (is[a]) {
			is[b] = true;
			if (cnt[a] == 0)is[a] = false;
		}
	}
	int ans = 0;
	rep(i, 0, N)if (is[i])++ans;
	cout << ans << "\n";

	return 0;
}

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

int main() {
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> A(N, K-Q);
  for (int i = 0; i < Q; i++) {
    int num;
    cin >> num;
    A.at(num-1)++;
  }

  for (int i = 0; i < N; i++) {
    cout << (A.at(i) > 0 ? "Yes" : "No") << endl;
  }

}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> votes(N);
    int all_votes = 0;
    for (int i = 0; i < N; i++){
        cin >> votes[i];
        all_votes += votes[i];
    }
    sort(votes.begin(), votes.end(), greater<int>());
    bool judge = true;
    for (int i = 0; i < M; i++){
        if(votes[i] * 4 * M < all_votes){
            judge = false;
        }
    }

    if(judge){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
int main()
{
    long long a,b;
    char op;
    scanf("%lld %c %lld",&a,&op,&b);
    switch (op)
    {
    case '+':
        std::cout<<a+b;
        break;
    
    default:
        std::cout<<a-b;
        break;
    }
    return 0;
}

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

int main(){
	vector<int> v;
	int n;
	while(cin>>n&&n){
		v.resize(n);
		for(int i=0;i<n;i++){
			cin>>v[i];
		}
		sort(v.begin(),v.end());
		long long ans=0,s=0;
		for(int i=0;i<n;i++){
			ans+=s;
			s+=v[i];
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1248
cnt = 0
g = []


def insertionSort(a, n, g):
    global cnt
    for i in range(g, n):
        v = a[i]
        j = i - g
        while (j >= 0 and a[j] > v):
            a[j + g] = a[j]
            j -= g
            cnt += 1
        a[j + g] = v


def shellSort(a, n):
    h = 1
    global g
    while (1):
        if h > n:
            break
        g.append(h)
        h = 3 * h + 1

    for gi in reversed(g):
        insertionSort(a, n, gi)


n = int(input())
a = list(int(input()) for i in range(n))
shellSort(a, n)
print(len(g))
for i in range(len(g)-1, -1, -1):
    print(g[i], end="")
    if (i):
        print(end=" ")
print()
print(cnt)
for i in a:
    print(i)



Measured memory_bytes: 45476
# -*- coding: utf-8 -*-
from fractions import gcd
from bisect import bisect_left
def inpl(): return list(map(int, input().split()))
N, M = inpl()

S = input()
T = input()

if N > M:
    N, M = M, N
    S, T = T, S

G = N*M // gcd(N, M)

a = G//N
b = G//M

X = [a*i for i in range(N)]
Y = [b*j for j in range(M)]

for i, x in enumerate(X):
    j = bisect_left(Y, x)
    if j < M and Y[j] == x:
        if S[i] != T[j]:
            print(-1)
            break
else:
    print(G)

Measured memory_bytes: 12216
#include <bits/stdc++.h> 
using namespace std; 
typedef long long ll;
const ll mxN = 1e5;
const ll mod = 1e9 + 7;
 
ll pow(ll a,ll b){
    ll r =1;
    while(b){
        if(b%2!=0) r=(r*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return r;
}
 
const int sz = 5e5+20;
ll fact[sz], inv[sz];
void pre(){
	fact[0] = 1;
	inv[0] = pow(fact[0], mod-2);
	for(int i=1;i<sz;i++){
		fact[i] = (fact[i-1]*i)%mod;
	}
}
 
int spf[10];
void sieve(){
    spf[1]=1;
    for(int i=2;i<mxN;i++) spf[i]=i;
    for(int i=4;i<mxN;i+=2) spf[i]=2;
    for(int i=3;i*i<mxN;i++){
    }
}

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

    ll n;
    cin>>n;

    ll ans = 0;

    vector<vector<ll>> v(n,vector<ll> (2));
    for(int i=0;i<n;i++) cin>>v[i][0]>>v[i][1];

    vector<int> s1(n);
    vector<int> s2(n);

    for(int i=0;i<n;i++){
        int x=v[i][0];
        int y=v[i][1];
        s1[i] = x+y;
        s2[i] = x-y;
    }

    sort(s1.begin(),s1.end());
    sort(s2.begin(),s2.end());

    cout<<max((s1[n-1]-s1[0]), (s2[n-1] - s2[0]))<<endl;
}

Measured memory_bytes: 15856
s = input()
t = input()

dp = [[0]*(len(t)+1) for _ in range(len(s)+1)]

for i in range(len(s)):
    for j in range(len(t)):
        if (s[i]==t[j]):
            dp[i+1][j+1] = dp[i][j]+1
        else:
            dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])
        
i = len(s)
j = len(t)
ans = ''
while i>0 and j>0:
    if (dp[i-1][j] == dp[i][j]):
        i -= 1
    elif (dp[i][j-1] == dp[i][j]):
        j -= 1
    else:
        ans = s[i-1]+ans
        i -= 1
        j -= 1

print(ans)

Measured memory_bytes: 112220
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll       long long
#define DS       pair<ll, ll>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 25;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

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

int h, w, vis[N][N], dis[N][N];
char m[N][N];
vector<DS> v;

bool ok(int x, int y) {
    return (x >= 0 && x < h) && (y >= 0 && y < w) && m[x][y] != '#';
}

int bfs(int sx, int sy) {
    queue<DS> q;
    q.push({sx, sy});
    memset(vis, 0, sizeof vis);
    memset(dis, 0, sizeof dis);
    vis[sx][sy] = 1;
    int tmp = 0;
    while (!q.empty()) {
        DS now = q.front();
        q.pop();
        for (int i = 0; i < 4; i++) {
            int nx = dx[i] + now.first;
            int ny = dy[i] + now.second;
            if (!ok(nx, ny)) continue;
            if (vis[nx][ny] == 0) {
                vis[nx][ny] = 1;
                q.push({nx, ny});
                dis[nx][ny] = dis[now.first][now.second] + 1;
                tmp = max(tmp, dis[nx][ny]);
            }
        }
    }
    return tmp;
}

int main() {
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> m[i][j];
            if (m[i][j] != '#') v.push_back({i, j});
        }
    }
    int ans = 0;
    for (int i = 0; i < v.size(); i++) {
        int tmp = bfs(v[i].first, v[i].second);
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >>a[i];
  }
  sort(a.begin(),a.end(), [&](int x,int y){return x<y ;});
  if(a[n/2]==a[n/2 - 1]){
    cout << 0 <<endl;
  }else{
    cout <<a[n/2]-a[n/2 -1] <<endl;
  }
}


Measured memory_bytes: 640
N = gets.to_i
A = gets.split.map(&:to_i)
MOD = 10 ** 9 + 7

result = Array.new(60) do |i|
  base = 1 << i
  c = [0, 0]
  A.each do |a|
    c[a[i]] += 1
  end
  2 * c[0] * c[1] * base
end.inject(&:+)

puts result / 2 % MOD


Measured memory_bytes: 34820
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    map<int,int> mp;
    mp[0] = 1;
    rep(i,n) {
        int x; cin >> x;
        mp[x]++;
    }
    bool corner = false;
    if (mp[0] >= 2 || mp[12] >= 2) corner = true;
    vint search;
    vint x;
    if (mp[0] == 1) x.push_back(0);
    if (mp[12] == 1) x.push_back(12);
    for (P p : mp) {
        if (p.second >= 3) corner = true;
        if (p.first == 0 || p.first == 12) continue;
        if (p.second == 1) search.push_back(p.first);
        if (p.second == 2) {
            x.push_back(p.first);
            x.push_back(24-p.first);
        }
    }
    if (corner) cout << 0 << endl;
    else {
        int n_ = search.size();
        int ans = 0;
        rep(i,1<<n_) {
            vint tmp = x;
            rep(j,n_) {
                if (i>>j&1) tmp.push_back(search[j]);
                else tmp.push_back((24-search[j])%24);
            }
            int diff = inf;
            rep(i,tmp.size())rep(j,i) {
                int diff_ = abs(tmp[i]-tmp[j]);
                diff = min(diff,min(diff_,24-diff_));
            }
            ans = max(diff,ans);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int n,mp[301][301];

int cal(int x1,int x2,int y1,int y2){
  if(x1>x2 || y1>y2){
    return 0;
  }
  int res=mp[y2][x2];
  if(x1)res-=mp[y2][x1-1];
  if(y1)res-=mp[y1-1][x2];
  if(x1&&y1)res+=mp[y1-1][x1-1];
  return res;
  
}

int cal(int a,int b){
  int res=-1e9,mx=-1e9;

  for(int i=0;i<n;i++){
    res=max(res,mx+cal(i,i,a,b));
    res=max(res,cal(i,i,a,b));
    mx=max(mx+cal(i,i,a,a)+(a!=b?cal(i,i,b,b):0),cal(i,i,a,b));
  }
  return res;
}


int main(){

  cin>>n;
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++){
      cin>>mp[i][j];
      if(i)mp[i][j]+=mp[i-1][j];
      if(j)mp[i][j]+=mp[i][j-1];
      if(i&&j)mp[i][j]-=mp[i-1][j-1];
    }

  int ans=-1e9;
  for(int i=0;i<n;i++)
    for(int j=i;j<n;j++)ans=max(ans,cal(i,j));
  cout <<ans<<endl;
   
  return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 105;
int n, m, d, x, ans;

int main() {
    cin >> n >> d >> x;
    for (int i = 0; i < n; ++i) {
        cin >> m;
        ans += (d + m - 1) / m;
    }
    cout << x + ans << endl;

    return 0;
}


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

int main()
{
    int H,W;
    cin >> H >> W;
    char a[H][W];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> a[i][j];
        }
    }
    for(int i=0;i<W+2;i++){
        cout << "#";
    }
    cout << "\n";
    for(int i=0;i<H;i++){
        cout << "#";
        for(int j=0;j<W;j++){
            cout << a[i][j];
        }
        cout << "#";
        cout << "\n";
    }
    for(int i=0;i<W+2;i++){
        cout << "#";
    }
    cout << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner in=new Scanner (System.in);
      int n=in.nextInt();
	int a[]=new int[n];
	int dp[]=new int[n];
	for(int i=0;i<n;i++)
		a[i]=in.nextInt();
	dp[0]=0;dp[1]=dp[0]+Math.abs(a[1]-a[0]);
	
	for(int i=2;i<n;i++)
	{
		dp[i]=Math.min(dp[i-1]+Math.abs(a[i]-a[i-1]), dp[i-2]+Math.abs(a[i]-a[i-2]));
	}
	
	System.out.println(dp[n-1]);
    }
}

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

int main()
{
    int k, s, count = 0;
    cin >> k >> s;

    for (int i = 0; i <= k; i++)
    {
        for (int j = 0; j <= k; j++)
        {
            if (s - i - j >= 0 && s - i - j <= k)
            {
                count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
// AOJ ITP1_9_D Transformation
// 2018.4.30 bal4u
 
#include <stdio.h>
 
char str[1005];
char p[1005];
 
int main()
{
    int q, a, b;
    char op[10], *x, *y, c;
     
    scanf("%s%d", str, &q);
    while (q--) {
        scanf("%s%d%d", op, &a, &b);
        if (op[2] == 'i') {             // print
            b++, c = *(str+b), *(str+b) = 0, puts(str+a), *(str+b) = c;
        } else if (op[2] == 'v') {      // reverse
            x = str+a, y = str+b;
            while (x < y) {
                c = *x, *x = *y, *y = c;
                x++, y--;
            }
        } else {                        // replace
            scanf("%s", p);
            x = str+a, y = p;
            while (*y) *x++ = *y++;
        }
    }
    return 0;
}


Measured memory_bytes: 2112
import sys

input=sys.stdin.readline

Q=int(input())
ques=[[] for i in range(0,Q)]
value=set([])
for i in range(0,Q):
    ques[i]=list(map(int,input().split()))
    if ques[i][0]==1:
        value.add(ques[i][1])

value=list(value)
value.sort()
n=len(value)
dic={}
for i in range(n):
    dic[value[i]]=0
    dic[value[i]]=i

#####segfunc######
def segfunc(x,y):
    return x+y

def init(init_val):
    #set_val
    for i in range(n):
        seg[i+num-1]=init_val[i]
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2])

def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])

def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

#####単位元######
ide_ele =0

#num:n以上の最小の2のべき乗
num =2**(n-1).bit_length()
seg=[ide_ele]*2*num

index=dic[ques[0][1]]
update(index,1)
minx=ques[0][1]
minf=0
B=ques[0][2]
count=1
for i in range(1,Q):
    if ques[i][0]==2:
        print(minx,minf+B)
    else:
        a=ques[i][1]
        b=ques[i][2]
        index=dic[a]
        count+=1
        B+=b
        minf+=abs(a-minx)
        update(index,seg[index+num-1]+1)
        start=0
        end=n-1
        while end-start>1:
            test=(end+start)//2
            if query(0,test+1)>=(count+1)//2:
                end=test
            else:
                start=test

        if query(0,start+1)>=(count+1)//2:
            t=start
        else:
            t=end

        if value[t]>minx:
            if count%2==1:
                minf-=value[t]-minx
                minx=value[t]
            else:
                minf-=2*(value[t]-minx)
                minx=value[t]
        elif minx>value[t]:
            if count%2==1:
                minf-=value[t]-minx
                minx=value[t]
            else:
                minx=value[t]

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import collections
c = collections.Counter(prime_factorize(N))

tmp = []
for i in range(1,40):
    tmp.append((1+i)*i//2)
import bisect
ans = 0
for i in list(c.values()):
    ans += bisect.bisect_right(tmp,i)
print(ans)

Measured memory_bytes: 9476
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int k = Integer.parseInt(in.next());
            long h[] = new long[n];
            for (int i = 0; i < n; i++) {
                h[i] = Long.parseLong(in.next());
            }
            long ans = 1 << 30;

            Arrays.sort(h);

            for (int i = 0; i < n - k + 1; i++) {
                ans = Math.min(ans, h[i + k - 1] - h[i]);
            }

            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 48552
#include <iostream>
#include <vector>
#include <string>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

int main(){

    int n;
    cin >> n;

    if(n>=195){
        cout << 5 << endl;
    }
    else if(n>=189){
        cout << 4 << endl;
    }
    else if(n>=165){
        cout << 3 << endl;
    }else if(n>=135){
        cout << 2 << endl;
    }
    else if(n>=105){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 888
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=57;
const ll mod=1000*1000*1000+7;

int n, k;

ll dp[nax][nax][nax*nax];

void dod(ll &a, ll b)
{
	a=(a+b)%mod;
}

int main()
{
	scanf("%d%d", &n, &k);
	dp[0][0][0]=1;
	for (int i=0; i<n; i++)
	{
		for (int j=0; j<=n; j++)
		{
			for (int l=0; l<=n*n; l++)
			{
				if (!dp[i][j][l])
					continue;
				dod(dp[i+1][j+1][l+2*j], dp[i][j][l]);
				dod(dp[i+1][j][l+2*j], dp[i][j][l]);
				dod(dp[i+1][j][l+2*j], dp[i][j][l]*(2*j));
				if (j)
					dod(dp[i+1][j-1][l+2*j], dp[i][j][l]*j*j);
				
				
				
				
				//~ dod(dp[i+1][j][l+2*j], dp[i][j][l]*(j+1));
				//~ dod(dp[i+1][j+1][l+2*j], dp[i][j][l]);
				//~ dod(dp[i+1][j][l+2*j], dp[i][j][l]*j);
				//~ if (j)
					//~ dod(dp[i+1][j-1][l+2*j], dp[i][j][l]*j);
			}
		}
	}
	//~ for (int i=0; i<=n; i++)
		//~ debug() << range(dp[n][i], dp[n][i]+n*n+1);
	//~ ll s=0;
	//~ for (int i=0; i<=n*n; i++)
		//~ s+=dp[n][0][i];
	//~ debug() << imie(s);
	printf("%lld\n", dp[n][0][k]);
	return 0;
}


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

typedef long long ll;

using namespace std;

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

    int v[100001] = {};
    bool a[100001] = {};

    for (int i = 0; i < n; i++) {
        int xi;
        cin >> xi;
        v[i] = xi;
    }

    int now = 0;
    int acc = 0;

    while (!a[now]) {
        a[now] = true;
        if (v[now] == 2) {
            a[1]=true;
            break;
        }
        now = v[now] - 1;
        acc += 1;
    }

    if (a[1]) {
        cout << acc + 1 << endl;
    } else {
        cout << -1 << endl;
    }
}

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

int main() {
  int r,g,b,n;
  long long ans = 0;
  cin >> r >> g >> b >> n;
  for(int i = 0;i <= n/r;i++){
    for(int j = 0;j <= (n-r*i)/g;j++){
      if((n-r*i-g*j)%b == 0) ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define rever(vec) reverse(all(vec));
#define cend cout << endl;
#define prique(T) priority_queue<T,vector<T>,greater<T>>
struct edge { int to, cost; };
using P = pair<int, int>;
using PP=pair<P, int>;
const int mod = 1e9 + 7, inf = 1e16;

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			if (mod <= ans * x) ans = ans * x % mod;
			else ans *= x;
		}
		if (mod <= x * x) x = x * x % mod;
		else x *= x;
		n >>= 1;
	}
	return ans;
}

int fact_memo[114514];
int fact(int n) {
	int ans = 1;
	if (fact_memo[n]) return fact_memo[n];
	rep(i, n) {
		ans *= (i + 1);
		if (mod <= ans) ans %= mod;
		fact_memo[i + 1] = ans;
	}
	return (ans + mod) % mod;
}

int comb(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod * modpow(fact(r), mod - 2) + mod) % mod;
}

int perm(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod + mod) % mod;
}

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

int lcm(int a, int b) {
	return a * b / gcd(a, b);
}

bool pri(int p) {
	for (int i = 2; i * i <= p; i++) if (p % i == 0) return false;
	return p > 1;
}

int n;
int a[55],b[55];
signed main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		b[i] = a[i];
	}
	bool can = true;
	rep(i, n - 1) {
		if (a[i] < a[i + 1]) continue;
		can = false;
		break;
	}
	if (can) { 
		cout << "YES" << endl;
		return 0;
	}
	rep(i, n) {
		for (int j = i + 1; j < n; j++) {
			swap(b[i], b[j]);
			can = true;
			rep(k, n - 1) {
				if (b[k] < b[k + 1]) continue;
				can = false;
				break;
			}
			if (can) {
				cout << "YES" << endl;
				return 0;
			}
			rep(k, n) {
				b[k] = a[k];
			}
		}
	}
	cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
  
  
      
int main(){
 

int i,j,r,k,n,count;

while(scanf("%d",&n)!=EOF){
	count=0;
for(i=0;i<10;i++)
	for(j=0;j<10;j++)
		for(r=0;r<10;r++)
			for(k=0;k<10;k++)
				if(n==i+j+k+r)count++;

printf("%d\n",count);

}

    return 0;
}

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

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

    vector <int> d(n);
    vector <int> l(n);

    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    d[0] = l[0];
    for (int i=1;i<n;i++){
        d[i] = d[i-1] + l[i];
    }
    int ans = 1;
    for(int i=0;i<n;i++){
        if(d[i]<=x){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256