akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    ll sum = 0, now = 1;
    while(now < n){
        ll d = n/now;
        ll from = now, to = n/d;
        if((n%from)-d >= 0 && ((n%from)-d)%d==0){
            sum += from+(n%from-d)/d;
        }
        now = to+1;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 384
import * as fs from 'fs'

const input: string = fs.readFileSync('/dev/stdin', 'utf8');
const args: string[][] = input.split('\n').map(l => l.split(' '));

const n = args[0][0];

const isContained = n.split('').some(x => x === '7');

const msg = isContained ? 'Yes' : 'No';

console.log(msg);

Measured memory_bytes: 29620
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
int n,cnt[4];
double p,dp[310][310][310];
int main() {
	//freopen("1.txt","r",stdin);
	read(n); int x; p=1.0/n;
	for (int i=1;i<=n;i++) read(x),cnt[x]++;
	for (int c=0;c<=n;c++) 
	for (int b=0;b<=n;b++)
	for (int a=0;a<=n;a++) {
		if (!a&&!b&&!c) continue;
		int d=n-a-b-c;
		if (a) dp[a][b][c]+=a*p*(dp[a-1][b][c]+1);
		if (b) dp[a][b][c]+=b*p*(dp[a+1][b-1][c]+1);
		if (c) dp[a][b][c]+=c*p*(dp[a][b+1][c-1]+1);
		dp[a][b][c]+=d*p;
		dp[a][b][c]/=(1.0-d*p);
		//printf("%d %d %d %.5lf\n",a,b,c,dp[a][b][c]);
	}
	printf("%.10lf\n",dp[cnt[1]][cnt[2]][cnt[3]]);
	return 0;
}

Measured memory_bytes: 227584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll myXOR(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
} 
  
int main()
{
	string s;
	cin>>s;
	if(s[s.size()-1]=='2' || s[s.size()-1]=='4' || s[s.size()-1]=='5' || s[s.size()-1]=='7' || s[s.size()-1]=='9'){
		cout<<"hon"<<endl;
	}
	else if(s[s.size()-1]=='0' || s[s.size()-1]=='1' || s[s.size()-1]=='6' || s[s.size()-1]=='8' )
	{
		cout<<"pon"<<endl;
	}
	else if(s[s.size()-1]=='3') cout<<"bon"<<endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include<algorithm>
#include<vector>
#include<string>
#include <cmath>
#include <iomanip>
#include <math.h>
using namespace std;

int main() {
	int s;
	cin >> s; 
	int cnt[10000000] = {};
	cnt[s]++;
	for (int i = 2; i <= 1000000;i++) {
		if (s % 2 == 0)s = s / 2;
		else s = (3 * s) + 1;
		cnt[s]++;
		if (cnt[s]>=2) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 39296
#include <iostream>
#include <string>
using namespace std;
int main(void){
  int64_t N,A,B;
  cin >> N >> A >> B;
  
  int64_t sum = A+B;
  int64_t q = N / sum;
  int64_t mod = N % sum;
  int64_t answer = A * q;
  if(mod >= A){
    answer += A;
  } else {
    answer += mod;
  }

  cout << answer << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int x[200010];
int y[200010];
int main()
{
	int n,i,m;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&m);
    	x[i]=y[i]=m;
    }
    sort(y,y+n);
    for(i=0;i<n;i++)
    {
        if(x[i]<=y[n/2-1])
			printf("%d\n",y[n/2]);
        else
			printf("%d\n",y[n/2-1]);
    }
    return 0;
}

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

using namespace std;

template <typename T>
using vec1 = vector<T>;

template <typename T>
T cin2var()
{
    T val;
    cin >> val;
    return val;
}

template <typename T>
vec1<T> cin2vec(size_t size)
{
    vec1<T> vec1(size);
    for (auto& v : vec1) {
        v = cin2var<T>();
    }
    return vec1;
}

void sub()
{
    const auto N(cin2var<size_t>());
    const auto M(cin2var<size_t>());
    const auto As(cin2vec<uint64_t>(N));
    auto m(M);
    priority_queue<uint64_t> pq;
    for (const auto& a : As) {
        pq.push(a);
    }
    while (m-- > 0) {
        const auto discount = pq.top() / 2;
        pq.pop();
        pq.push(discount);
    }
    uint64_t sum = 0ull;
    while (!pq.empty()) {
        sum += pq.top();
        pq.pop();
    }
    cout << sum << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    sub();
    return 0;
}

Measured memory_bytes: 2168
#include "bits/stdc++.h"
using namespace std;
int Array[1005][1005] , InDegree[1000005];
vector<int> Graph[1000005];
bool Visited[1000005] , Extra[1000005];
queue<int> Q;

inline int VertexValue( int i , int j , int N ){
    return (i - 1) * N + j;
}

void BuildGraph( int N ){
    int i , j , u , v , a , b;

    for( i = 1 ; i <= N ; ++i ){
        for( j = 1 ; j < N - 1 ; ++j ){
            a = Array[i][j];
            b = Array[i][j + 1];
            u = VertexValue( min(i,a) , max(i,a) , N );
            v = VertexValue( min(i,b) , max(i,b) , N );
            Graph[u].emplace_back( v );
        }
    }
}

bool IsCycle( int root ){
    bool Flag;
    Visited[root] = Extra[root] = true;

    for( int i = 0 ; i < Graph[root].size() ; ++i ){
        if( Visited[Graph[root][i]] == true ) return true;
        else{ 
            if( Extra[Graph[root][i]] == false ){
                Flag = IsCycle( Graph[root][i] );
                if( Flag == true ) return true;
            }
        }
    }

    Visited[root] = false;
    return false;
}

void PopulateInDegree( int N ){
    int i , j , k , u;

    for( i = 1 ; i <= N ; ++i ){
        for( j = i + 1 ; j <= N ; ++j ){
            u = VertexValue( i , j , N );

            for( k = 0 ; k < Graph[u].size() ; ++k )
                ++InDegree[Graph[u][k]];
        }
    } 
}

int TopologicalSort( int N ){
    int i , j , Ans = 0 , u;
    PopulateInDegree( N );

    for( i = 1 ; i <= N ; ++i ){
        for( j = i + 1 ; j <= N ; ++j ){
            u = VertexValue( i , j , N );
            if( InDegree[u] == 0 ) Q.push( u ); 
        }
    }

    Q.push( -1 );

    while( true ){
        u = Q.front();
        Q.pop();

        if( u == -1 ){
            ++Ans;
            if( Q.empty() ) break;
            else Q.push( -1 ); 
        } 

        for( i = 0 ; i < Graph[u].size() ; ++i ){
            --InDegree[Graph[u][i]];
            if( InDegree[Graph[u][i]] == 0 ) Q.push( Graph[u][i] );
        }
    }

    return Ans;
}

int main(){
    int N , u , i , j;  
    scanf( "%d" , &N );

    for( i = 1 ; i <= N ; ++i ){
        for( j = 1 ; j < N ; ++j )
            scanf( "%d" , &Array[i][j] ); 
    }

    BuildGraph( N );

    for( i = 1 ; i <= N ; ++i ){
        for( j = i + 1 ; j <= N ; ++j ){
            u = VertexValue( i , j , N );

            if( Extra[u] == false ){
                if( IsCycle( u ) ){ 
                    puts( "-1" );
                    return 0;
                }
            }
        }
    }

    printf( "%d\n" , TopologicalSort( N ) );
    return 0;   
}

Measured memory_bytes: 49152
#include<stdio.h>

int main()

{
    int n,m,i,sum=0,s;

    scanf("%d%d",&n,&m);

    int a[m];

    for(i=0;i<m;i++){

            scanf("%d",&a[i]);

            sum=sum+a[i];

    }

    s=n-sum;

    if(n<sum){

            printf("-1\n");

    }

    else{

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

    }

    return 0;
}

Measured memory_bytes: 1736
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,k = m()

dp = [0 for i in range(k+1)]

for i in range(1,k+1):
    dp[i] = pow(k//i,n,mod)

for i in range(k,0,-1):
    for j in range(2,k//i + 1):
        dp[i] -= dp[i*j]
co = 0

for i in range(1,k+1):
    co += ( dp[i] * i  )% mod
    co %= mod
print(co)




Measured memory_bytes: 74808
// import scala.io.{StdIn => in}
import java.io._
import scala.collection.{mutable => mu}

object Main extends App {
  import MapHelper._

  val in = new BufferedReader(new InputStreamReader(System.in))
  val Array(n, m) = in.readLine.split(" ").map(_.toInt)
  val map = mu.HashMap.empty[Long,Int]

  in.readLine.split(" ").map(_.toLong).foreach(map.addOrUpdate(_,1))
  Iterator.continually(in.readLine)
    .take(m)
    .map(_.split(" ").map(_.toInt))
    .foreach(e => map.addOrUpdate(e(1), e(0)))

  val keys = map.keys.toArray.sorted(Ordering[Long].reverse)
  def rec(acc:Long, cnt:Int, i:Int):Long = {
    val v = keys(i)
    val p =  map(keys(i))
    if(cnt + p >= n) acc + v * (n - cnt)
    else rec(acc + v * p, cnt + p, i + 1)
  }

  val ans = rec(0, 0, 0)
  println(ans)

  object MapHelper {
    implicit class AddOrUpdate[A](map:mu.HashMap[Long,Int]) {
      def addOrUpdate(key:Long, value:Int):mu.HashMap[Long,Int] =
      {
        if(map.contains(key)) map(key) += value
        else map += (key -> value)
        map
      }
    }
  }
}

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

using namespace std;

typedef long long ll;

int main()
{
    int N;
    while(cin>>N)
    {
        int i;
        string s;
        cin>>s;
        if(s.length()%2==1)
            cout<<"No"<<endl;
        else
        {
            int k,flag=1;
            k=s.length()/2;
            for(i=0; i<k; i++)
            {
                if(s[i]!=s[i+k])
                {
                    flag=0;
                    break;
                }
            }
            if(flag)
                cout<<"Yes"<<endl;
            else
                cout<<"No"<<endl;
        }
    }
    return 0;
}


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

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


Measured memory_bytes: 256
#include<stdio.h>
 
int main(void){
  int N,M,a=-1;
  int A[10000];
  int sum=0;
  scanf("%d",&N);
  scanf("%d",&M);
  for(int i=0;i<M;i++){
    scanf("%d",&A[i]);
    sum=sum+A[i];
  }
  if(sum<=N){
    printf("%d",N-sum);
  }
  else{
    printf("%d",a);
  }
  return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B,C,D;
  int count;
  
  cin >> N ;
  A=N/1000;
  B=(N-A*1000)/100;
  C=(N-A*1000-B*100)/10;
  D=N-A*1000-B*100-C*D;
  
  if (A==B)
    count++;
  if (A==C)
    count++;
  if (A==D)
    count++;
  if (B==C)
    count++;
  if (B==D)
    count++;
  if (C==D)
  	count++;
  
  if(count>=3)
  {
  	cout << "Yes" << endl;
  }
  else
  {
  	cout << "No" << endl;
  }
}

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

using D = long double;
const D PI = acos(-1);
const D C = 2.0 * PI * 10.0;

struct Point {D x, y;};
bool operator<(Point l, Point r) {return l.y < r.y;}

D LIS(auto S) {
  vector<Point> dp = {S.front()};
  for(const auto& i: S) {
    if(dp.back() < i) dp.push_back(i);
    else              *lower_bound(dp.begin(), dp.end(), i) = i;
  }
  return dp.size();
}

int main() {
  Point S, G;
  cin >> S.x >> S.y >> G.x >> G.y;

  int N;
  cin >> N;

  vector<Point> P;
  for(auto i = 0; i < N; ++i) {
    D x, y;
    cin >> x >> y;
    auto lx = min(S.x, G.x), hx = max(S.x, G.x);
    auto ly = min(S.y, G.y), hy = max(S.y, G.y);
    if(lx <= x && x <= hx && ly <= y && y <= hy) P.push_back({x, y});
  }

  if(S.x > G.x) {
    S.x = -S.x;
    G.x = -G.x;
    for(auto& i: P) i.x = -i.x;
  }
  if(S.y > G.y) {
    S.y = -S.y;
    G.y = -G.y;
    for(auto& i: P) i.y = -i.y;
  }
  if(G.x-S.x > G.y-S.y) {
    swap(S.x, S.y);
    swap(G.x, G.y);
    for(auto& i: P) swap(i.x, i.y);
  }

  sort(begin(P), end(P), [](auto l, auto r) {return l.x < r.x;});
  auto res = 100 * (G.x - S.x) + 100 * (G.y - S.y);
  if(!P.empty()) {
    auto s = LIS(P);
    auto d = G.x-S.x;
    if(s < d+1) res += s * (C / 4 - 20);
    else        res += (s-1) * (C / 4 - 20) + C / 2 - 20;
  }
  cout << setprecision(10) << fixed << res << endl;
}


Measured memory_bytes: 28776
N = int(input())
a = [input()for i in range(N)]
p = []
a.sort()
q = 1
for i  in range(N-1):
    if a[i] == a[i+1]:
        q = q+1
    else:
        p.append([q,a[i]])
        q = 1
p.append([q,a[N-1]])
s = 0
for i in range(len(p)):
    s = max(s,p[i][0])
for i in range(len(p)):
    if p[i][0] == s:
        print(p[i][1])

Measured memory_bytes: 39104
#include <bits/stdc++.h>
 
using namespace std;
 
#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
 
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
 
typedef long long LL;
 
const int oo = 0x3f3f3f3f;
 
const int maxn = 100000;
 
int n;
int a[maxn + 5];
 
map<int, int> pos;
 
int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	REP(i, 0, n) scanf("%d", a + i);
	REP(i, 0, n) pos[a[i]] = i;
	sort(a, a + n);
	int cnt = 0;
	REP(i, 0, n) if ((pos[a[i]] ^ i) & 1) ++cnt;
	printf("%d\n", cnt >> 1);
	return 0;
}

Measured memory_bytes: 5376
n = int(input())
l = list(map(int,input().split()))

l = list(reversed(l))

c = 0
max = 0

for i in range(n-1):
    if l[i] <= l[i+1]:
        c += 1
    else:
        if c > max:
            max = c
        
        c = 0
        
if c > max:
    max = c

print(max)

Measured memory_bytes: 15020
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 10e9;

void SnakeToy(){

	int n, k;
	cin >> n >> k;
	int t[100];
	for (size_t i = 0; i < n; i++)
	{
		cin >> t[i];
	}
	sort(t, t + n, std::greater<int>());
	int sum = 0;
	for (size_t i = 0; i < k; i++)
	{
		sum += t[i];
	}
	cout << sum << endl;
}

int main() {
	SnakeToy();
	return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    ll ans = A[0] - 1;
    int M = 1;
    rep(i, 1, N) {
        if (A[i] == M + 1) {
            M = M + 1;
        }
        else if (A[i] > M + 1) {
            int c = (A[i] - 1) / (M + 1);
            ans += c;
        }
    }

    write(ans);
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> l(N);
  for(int i = 0; i < N; i++) {
    cin >> l.at(i);
  }
  sort(l.begin(), l.end());
  reverse(l.begin(), l.end());
  int S = 0;
  for(int i = 0; i < K; i++) {
    S += l.at(i);
  }
  cout << S << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		
		StringBuffer alpha = new StringBuffer("abcdefghijklmnopqrstuvwxyz");
		for(int i = 0; i < s.length(); i++) {
			alpha.setCharAt(s.charAt(i)-'a', '0');			
		}
		int i;
		for(i = 0; i < alpha.length(); i++) {
			if(alpha.charAt(i) != '0') {
					break;
		}
		}
		if(i < alpha.length()) {
			System.out.println(alpha.charAt(i));
		} else {
			System.out.println("None");
		}
	}

}


Measured memory_bytes: 23912
def main():
  n = int(input())
  ans = ""
  dics = []
  
  az = "abcdefghijklmnopqrstuvwxyz"

  for i in range(n):
    dic = {}
    s = input()
    for c in az:
      dic[c] = s.count(c)
    dics.append(dic)

  for c in az:
    can_use = True
    m = 50

    for dic in dics:
      if dic[c] == 0:
        can_use = False
        break

      m = min(m, dic[c])

    if(can_use):
      ans += c * m

  print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <unordered_set>
#include <iostream>


using namespace std;


class B {
	int N, d;
	unordered_set <int> s;

public:
	void solve()
	{
		cin >> N;
		for (int i{ 0 }; i < N; i++)
		{
			cin >> d;
			s.insert(d);
		}

		cout << s.size() << endl;
	}
};


int main()
{
	B solution;
	solution.solve();
	return 0;
}

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

#define ll long long
#define mod 1e9+7
#define pll pair<long long,long long>
#define pdd pair<long double,long double>
#define vll vector<ll>
#define rep(i,j,n) for(int i=j;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define inf 1e17
#define N 1000001
priority_queue<pll,vector<pll>,greater<pll> >pq;
priority_queue<ll,vector<ll>,greater<ll> >pq1;

ll arr[N];
ll dp[N];

int main(){
	if(fopen("input.txt", "r"))
	freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++){
    	cin>>arr[i];
    	dp[arr[i]]=1;
    }
    for(int i=1;i<=k;i++){
    	ll d=0;
    	if(dp[i])
    		continue;
    	for(int j=0;j<n;j++){
    		if(i>=arr[j]){
    			if(dp[i-arr[j]]==0)
    				dp[i]=1;
    			else
    				d++;
    		}
    	}
    	if(d==n)
    		dp[i]=0;
    }
    if(dp[k]==1)
    	cout<<"First";
    else
    	cout<<"Second";

    return 0;
}


Measured memory_bytes: 3072
//Ojas Kumar Dubey //
// el_freki //
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define v1 vector<int>
#define mapp map<int,int>
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int modulo=1000000007;
#define test int t;cin>>t;while(t--)
#define f(i,j,n) for(int i=j;i<n;i++)
#define r(i,j,n) for(int i=j-1;i>=n;i--)
#define min INT_MIN
#define maxx INT_MAX
#define all(container) container.begin() , container.end()
#define sz(container) (int)container.size()
#define pii pair <int , int>
#define pll pair <long long int , long long int>
#define setp(x) setprecision(x)
int power(int a,int n){
    a%=modulo;
    n%=modulo;
    int var=a,ans=1;
    while(n){
        if(n&1)
            ans=((ans%modulo)*(var%modulo))%modulo;
        var=((var%modulo)*(var%modulo))%modulo;
        n=n>>1;
    }
    return ans;
}
// ------------------------------------Template End------------------------------ //
void solve(){
    int n;
    cin>>n;
    int c0,c1,c2,c3;
    c0=c1=c2=c3=0;
    f(i,0,n){
        string a;
        cin>>a;
        if(a=="AC")
            c0++;
        else if(a=="WA")
            c1++;
        else if(a=="TLE")
            c2++;
        else if(a=="RE")
            c3++;
    }
    cout<<"AC x "<<c0<<endl;
    cout<<"WA x "<<c1<<endl;
    cout<<"TLE x "<<c2<<endl;
    cout<<"RE x "<<c3<<endl;
     
}
signed main(){
	fast;
    #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt",
    #endif
	solve();
}

			
	



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

//コピペここから

// extended Euclidean Algorithm
// ax + by = gcd(a, b)
// return : gcd(a, b)
template<typename Integer = int_fast64_t>
constexpr Integer extgcd(Integer a, Integer b, Integer &x, Integer &y){
    Integer u = 0, v = 1, q = 0, tmp = 0;
    x = v = 1;
    y = u = 0;

    while(b){
        q = a / b;
        x ^= u ^= x ^= u;
        u = u - q * x;
        y ^= v ^= y ^= v;
        v = v - q * y;
        a ^= b ^= a ^= b;
        b = b - q * a;
    }

    return a;
}

// mod inverse(設計が変わるかもしれません)
// return : val^(-1) mod MOD
template<uint_fast64_t MOD, typename Integer = int_fast64_t>
constexpr Integer modinv(Integer val){
    int_fast64_t ret = 0, tmp = 0;

    extgcd<int_fast64_t>(static_cast<int_fast64_t>(val), static_cast<int_fast64_t>(MOD), ret, tmp);

    return static_cast<Integer>(ret > 0 ? ret % MOD : (MOD - (-ret % MOD)));
}

// const expression factorial mod MOD
template<std::size_t N, std::uint_fast64_t MOD>
struct Fact {
    std::uint_fast64_t val[N + 1];

    constexpr Fact() : val() {
        val[0] = 1;
        for (std::size_t i = 1; i <= N; ++i) val[i] = val[i - 1] * i % MOD;
    }
};

// const expression factorial inverse mod MOD
template<std::size_t N, std::uint_fast64_t MOD, std::uint_fast64_t F>
struct IFact {
    std::uint_fast64_t val[N + 1];

    constexpr IFact() : val() {
        val[N] = F;
        for (std::size_t i = N; i; --i) val[i - 1] = val[i] * i % MOD;
    }
};

constexpr std::uint_fast64_t MOD = 1000000007, maxN = 2000009;

constexpr auto fact = Fact<maxN, MOD>();
constexpr auto ifact = IFact<maxN, MOD, modinv<MOD>(fact.val[maxN])>();

// const expression binomial mod MOD
constexpr std::uint_fast64_t binommod(std::uint_fast64_t n, std::uint_fast64_t r){
    if(r < 0 || r > n)return 0;
    return fact.val[n] * (ifact.val[r] * ifact.val[n - r] % MOD) % MOD;
}

//コピペここまで(ある部分を使うためにはそれより上を全てコピーしてください)

//verified : AtCoder Grand Contest 025 B - RGB Coloring
// https://github.com/259-Momone/momo_lib/blob/master/modbinomial.cpp
// thanks
int main(){
	using namespace std;
	long long r1,r2,c1,c2,ans=0;
	cin >> r1 >> c1 >> r2 >> c2;
	for(int i=c1;i<c2+1;i++){
		ans += binommod(i+r2+1,r2);
		ans %= MOD;
		ans += MOD - binommod(i+r1,r1-1);
		ans %= MOD;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  lint n; cin >> n;
  vector<lint> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }

  lint l; cin >> l;
  lint q; cin >> q;
  vector<lint> a(q);
  vector<lint> b(q);
  for (int i = 0; i < q; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    if (a[i] > b[i]) {
      swap(a[i], b[i]);
    }
  }


  vector<vector<lint>> dp(32, vector<lint> (n)); // 2^i 日でどこまでいけるか

  // 1 にちでどこまでいけるかの前処理
  for (int i = 0; i < n; i++) {
    lint ok = i;
    lint ng = n;
    while (ng - ok > 1) {
      lint mid = (ok + ng) / 2;
      (x[mid] - x[i] <= l ? ok : ng) = mid;
    }



    dp[0][i] = ok;
  }

  for (int i = 1; i < 32; i++) {
    for (int j = 0; j < n; j++) {
      // cerr << dp[i - 1][j] << " ";
      dp[i][j] = dp[i - 1][dp[i - 1][j]];
    }
    // cerr << endl;
  }

  vector<lint> po(32);
  po[0] = 1;
  for (int i = 1; i < 32; i++) {
    po[i] = po[i - 1] * 2;
  }
  

  // クエリ処理
  for (int i = 0; i < q; i++) {
    // cerr << i << " th query " << endl;
    // a[i] -> b[i] へ行く
    lint cur = a[i];
    lint ans = 0;
    
    // b[i] 以上にならない最大の日数
    while (cur < b[i]) {
      lint ok = 0;
      lint ng = 32;
      while (ng - ok > 1) {
        lint mid = (ok + ng) / 2;
        (dp[mid][cur] < b[i] ? ok : ng) = mid;
      }
  
      cur = dp[ok][cur];
      // cerr << ok << " " << cur << endl;
      ans += po[ok];
    } 

    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 28416
#include<stdio.h>

void main(void){
  char s[4];
  for(int i=0;i<4;i++){
    scanf("%c",&s[i]);
  }
  if(s[0] != s[1] &&s[1] != s[2]&&s[2] != s[3]){
    printf("Good");
  }else printf("Bad");
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <vector>
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; }

int main() {
    string s, t; cin >> s >> t;

    vector<vector<int>> dp(s.length() + 1, vector<int>(t.length() + 1, 0));
    vector<vector<int>> prev(dp);
    for (int i = 0; i < s.length(); i++) {
        for (int j = 0; j < t.length(); j++) {
            if (chmax(dp[i + 1][j + 1], dp[i][j + 1])) {
                prev[i + 1][j + 1] = 0;
            }
            if (chmax(dp[i + 1][j + 1], dp[i + 1][j])) {
                prev[i + 1][j + 1] = 1;
            }
            if (s[i] == t[j] && chmax(dp[i + 1][j + 1], dp[i][j] + 1)) {
                prev[i + 1][j + 1] = 2;
            }
        }
    }
    string res = "";
    int i = s.length(), j = t.length();
    while (i > 0 && j > 0) {
        if (prev[i][j] == 2) i--, j--, res += s[i];
        if (prev[i][j] == 1) j--;
        if (prev[i][j] == 0) i--;
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
    return 0;
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n' //toggle off for interactive problems
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define int long long
// #define pow mypow

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9+5;
const int MOD = 1e9+7;

int n;
int pow_n(int b, int n){
	int res = 1LL;
	while(n--){
		res = (res*b) % MOD;
	}
	return res;
}
int32_t main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n;
	int ans = pow_n(10, n) + 2*MOD - 2*pow_n(9, n) + pow_n(8, n);
	cout << ans % MOD << endl;
	return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

using ll = long long int;
using P = pair<int,int>;

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; }

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int main(){
  int ans=0;
  int mi=10;
  REP(i,5){
    int a;
    cin >> a;
    ans += (a+9)/10*10;
    if(a%10>0)chmin(mi, a%10);
  }
  ans -= (10-mi);
  cout << ans << endl;
}



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

const int INF = 1001001001;

int main(){
    int n;
    cin>>n;
    if(n>=30){
        cout<<"Yes";
        return 0;
    }
    cout<<"No";
    return 0;
}


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

int main(){
	ll a, b, n;
	string s;
	cin >> s;
	for(int i = 0; i < s.size() - 1; ++i){
		if(s[i] == 'A' && s[i + 1] == 'C'){
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
	return 0;
}

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

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

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

int INF = 1001001001;

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;
}

int main() {
    char c;
    cin >> c;
    c++;
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 3500
import java.util.Scanner


object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n, a, b = sc.nextInt()
    val s = sc.next().toCharArray

    var now = 0
    var oversea = 0

    for (i <- s.indices) {
      s(i) match {
        case 'a' => if (now < a + b) {
          println("Yes")
          now += 1
        } else {
          println("No")
        }
        case 'b' => if (now < a + b && oversea < b) {
          println("Yes")
          now += 1
          oversea += 1
        } else {
          println("No")
        }
        case _ => println("No")
      }
    }

  }
}

Measured memory_bytes: 37476
#曜日を入力する
weekday=input()

if weekday=='SUN':
    print(7)
elif weekday=='MON':
    print(6)
elif weekday=='TUE':
    print(5)
elif weekday=='WED':
    print(4)
elif weekday=='THU':
    print(3)
elif weekday=='FRI':
    print(2)
elif weekday=='SAT':
    print(1)

Measured memory_bytes: 8940
K,N = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
A.append(A[0]+K)
max = 0
for i in range(N):
    if A[i+1]-A[i] >= max:
        max = A[i+1]-A[i]
print(K-max)

Measured memory_bytes: 26436
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func main() {

	scanner := NewBufScanner(os.Stdin)
	n := scanner.Int()


	as := make([]float64, 200000)
	for i := 0; i < n; i++ {
		//fmt.Scan(&as[i])
		as[i] = scanner.Float64()
	}

	var maxv, minv float64
	maxv = -2000000000
	minv = as[0]

	for i := 1; i < n; i++ {
		maxv = math.Max(maxv, as[i]-minv)
		minv = math.Min(minv, as[i])
	}
	fmt.Println(int(maxv))
}


func (s *BufScanner) UInt() uint64 {
	s.Scan()
	i, e := strconv.ParseUint(s.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func (s *BufScanner) Int() int {
	return int(s.UInt())
}

func (s *BufScanner) Float64() float64 {
	s.Scan()
	i, e := strconv.ParseFloat(s.Text(),64)
	if e != nil {
		panic(e)
	}
	return i
}

type BufScanner struct {
	*bufio.Scanner
}

func NewBufScanner(r io.Reader) *BufScanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	// s.Split(scanWords)
	return &BufScanner{s}
}

func scanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	start := 0
	for isSpace(data[start]) {
		start++
	}
	for i := start; i < len(data); i++ {
		if isSpace(data[i]) {
			return i+1, data[start:i], nil
		}
	}
	if atEOF && len(data) > start {
		return len(data), data[start:], nil
	}
	return start, nil, nil
}
func isSpace(b byte) bool {
	return b == ' ' || b == '\n' || b == '\r' || b == '\t'
}



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

typedef long long lint;
typedef long double louble;

#define so(a) ((int)((a).size()))

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

const char lf = '\n';

namespace ae86
{
	const int bufl = 1 << 15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0;int b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 500007 , mo = 998244353;

template<typename T1,typename T2> inline T1 ad(T1 &a,T2 b){return a=a+b>=mo?a+b-mo:a+b;}
template<typename T1,typename T2> inline T1 dl(T1 &a,T2 b){return a=a>=b?a-b:a-b+mo;}
template<typename T1,typename T2> inline T1 add(T1 a,T2 b){return a+b>=mo?a+b-mo:a+b;}
template<typename T1,typename T2> inline T1 del(T1 a,T2 b){return a>=b?a-b:a-b+mo;}

lint powa(lint a,lint t)
{
	lint b=1;
	while(t){if(t&1)b=b*a%mo;a=a*a%mo,t>>=1;}
	return b;
}

inline lint inva(lint a)
{
	return powa(a,mo-2);
}

lint jc[_],rjc[_];

void fuck(int n=_-1)
{
	jc[0]=jc[1]=rjc[0]=1;
	for(int i=2;i<=n;i++)jc[i]=jc[i-1]*i%mo;
	rjc[n]=inva(jc[n]);
	for(int i=n-1;i>=1;i--)rjc[i]=rjc[i+1]*add(1,i)%mo;
}

lint C(int n,int m)
{
	if(n<m || n<0 || m<0)return 0;
	return jc[n]*rjc[m]%mo*rjc[n-m]%mo;
}

int n,m;

int main()
{
	ios::sync_with_stdio(0),cout.tie(nullptr);

	fuck();

	n=ty(),m=ty();

	lint ans=0;
	for(int i=n;i<=m;i++)
	{
		if(i>m-i)ad(ans,del(C(m,i),C(m,i+i-n+1)));
		else if(i==m-i)ad(ans,del(C(m-1,i),C(m-1,i+i-n+1)));
	}
	cout<<ans<<lf;
	
	return 0;
}


Measured memory_bytes: 8064
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

h, w = na()
c = nsn(h)

for i in range(h):
    print(c[i])
    print(c[i])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=(b); i++)
#define per(i,a,b) for (int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;

const int maxn = 100005;
ll p[maxn], x[maxn], ans;
int n, S, l, r, last;

int main() {
	cin >> n >> S;
	rep (i, 1, n) 
		cin >> x[i] >> p[i];
	l = 1; r = n; last = 0;
	while (x[l] < S && S < x[r])
		if (p[l] >= p[r]) {
			if (last) ans += abs(x[r] - x[last]);
			last = r;
			p[l] += p[r--];
		}
		else {
			if (last) ans += abs(x[l] - x[last]);
			last = l;
			p[r] += p[l++];
		}
	if (x[l] < S) {
		if (last) ans += abs(x[l] - x[last]);
		ans += abs(S - x[l]);
	}
	if (x[r] > S) {
		if (last) ans += abs(x[r] - x[last]);
		ans += abs(x[r] - S);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int INF = (int)1e9 + 7;
template<class T> inline bool chmin(T &a, T b) { return a > b ? (a = b, 1) : 0; }

int main() {
    const int MAX = 400;
    int n; cin >> n;
    int ma, mb; cin >> ma >> mb;
    vector<vector<int>> dp(MAX + 1, vector<int>(MAX + 1, INF));
    dp[0][0] = 0;
    while (n--) {
        int a, b, c; cin >> a >> b >> c;
        for (int na = MAX; na >= a; na--) {
            // for (int nb = MAX; nb >= b; nb--) {
            for (int nb = b; nb <= MAX; nb++) {
                chmin(dp[na][nb], dp[na - a][nb - b] + c);
            }
        }
    }
    int mi = INF;
    for (int a = 1; a <= MAX; a++) for (int b = 1; b <= MAX; b++) {
        if (a * mb == b * ma) chmin(mi, dp[a][b]);
    }
    cout << (mi == INF ? -1 : mi) << endl;
    return 0;
}


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

R = [0]
G = [0]
B = [0]

for i in range(n):
    R.append(R[-1])
    G.append(G[-1])
    B.append(B[-1])
    if s[i]=='R':
        R[-1]+=1
    elif s[i]=='G':
        G[-1]+=1
    else:
        B[-1]+=1

ans = 0

for j in range(1,n-1):
    if s[j]=='R':
        ans += G[j]*(B[n]-B[j+1])
        ans += B[j]*(G[n]-G[j+1])
        for i in range(j):
            if j+i+1<n:
                if s[j-i-1]=='B' and s[j+i+1]=='G':
                    ans-=1
                elif s[j-i-1]=='G' and s[j+i+1]=='B':
                    ans-=1
            else:
                break
    elif s[j]=='G':
        ans += R[j]*(B[n]-B[j+1])
        ans += B[j]*(R[n]-R[j+1])
        for i in range(j):
            if j+i+1<n:
                if s[j-i-1]=='R' and s[j+i+1]=='B':
                    ans-=1
                elif s[j-i-1]=='B' and s[j+i+1]=='R':
                    ans-=1
            else:
                break
    elif s[j]=='B':
        ans += G[j]*(R[n]-R[j+1])
        ans += R[j]*(G[n]-G[j+1])
        for i in range(j):
            if j+i+1<n:
                if s[j-i-1]=='R' and s[j+i+1]=='G':
                    ans-=1
                elif s[j-i-1]=='G' and s[j+i+1]=='R':
                    ans-=1
            else:
                break
print(ans)







Measured memory_bytes: 74376
import sys
input = sys.stdin.readline

N, M, K = map(int, input().split())
A_temp = [int(i) for i in input().split()]
B_temp = [int(i) for i in input().split()]

A, B = [0]*(N+1), [0]*(M+1)
for i in range(1, N+1):
    A[i] = A[i-1] + A_temp[i-1]
for i in range(1, M+1):
    B[i] = B[i-1] + B_temp[i-1]

ans = 0
b = M
for a in range(N+1):
    if A[a] > K:
        break
    while B[b] > K - A[a]:
        b -= 1
    ans = max(ans, a + b)
print(ans)

Measured memory_bytes: 48760
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int n,ans = 0;
	cin >> n;
	for(int i = 1;i <= n;i += 2){
		int cnt = 0;
		for(int j = 1;j <= i;j++){
			if(i % j == 0) cnt++;
		}
		if(cnt == 8) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define em3 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define X real()
#define Y imag()
#define cross(a, b) ((conj(a) * (b)).Y)
#define dot(a, b) ((conj(a) * (b)).X)
#define EPS 1e-7
long long mod = 1e9 + 7;
const int N = 2e5 + 5;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const double pi = acos(-1);
typedef complex <double> point;
typedef tuple<int, int, int> line;
typedef vector<point> polygon;
///           x , y , index
vector<pair<pair<ll, ll> , ll>> v1 , v2;
///  cost , index1 , index2
map < ll , vector<pair<ll , ll>>> mp;
ll rep[N], sz[N], n, nc, m, ans;
int fnd(int u)
{
    if(rep[u] == u)
        return u;
    else
        u = fnd(rep[u]);
    return u;
}
bool join(int a, int b)
{
    a = fnd(rep[a]);
    b = fnd(rep[b]);
    if(a == b)
        return true ;
    if(sz[a] < sz[b])
        swap(a, b);
    sz[a] += sz[b];
    rep[b] = a;
    nc--;
    return false;
}
int main()
{
    em3
    cin >> n ;
    nc = n;
    for(int i = 0 ; i < n ; i++)
        sz[i] = 1, rep[i] = i;
    for(int i = 0 ; i < n ; i++)
    {
        pair<ll , ll > a ;
        cin >> a.first >> a.second;
        v1.push_back({a , i});
        v2.push_back({{a.second , a.first} , i});
    }
    sort(v1.begin() , v1.end());
    sort(v2.begin() , v2.end());
    for(int i = 0 ; i < n - 1 ; i++)
    {
        mp[abs(v1[i].first.first - v1[i + 1].first.first)].push_back({v1[i].second , v1[i + 1].second});
        mp[abs(v2[i].first.first - v2[i + 1].first.first)].push_back({v2[i].second , v2[i + 1].second});
    }
    for(auto i : mp)
    {
        for(int j = 0 ; j < i.second.size() ; j++)
        if(!join(i.second[j].first , i.second[j].second))
        {
            ///edges.push_back({v[i].second.first, v[i].second.second});
            ans += i.first;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 16288
#ifndef ___Class_RMQ
#define ___Class_RMQ

#include <limits>
#include <vector>
#include <algorithm>

template <typename Type, class Calculate> class RMQ
{
private:

	int size;

	std::vector<Type> value;

	Type _query(int a, int b, int k, int l, int r)
	{
		if (r <= a || b <= l) { return val; }
		if (a <= l && r <= b) { return value[k]; }

		Type vl = _query(a, b, 2 * k, l, (l + r) / 2);
		Type vr = _query(a, b, 2 * k + 1, (l + r) / 2, r);

		return Calculate()(vl, vr);
	}

public:

	Type val;

	RMQ(int size_, int val_) : val(val_)
	{
		for (size = 1; size < size_;) { size <<= 1; }

		value = std::vector<Type>(size * 2, val);
	}

	void update(int i, const Type& x)
	{
		i += size; value[i] = x;

		while (i > 1) { i = i / 2; value[i] = Calculate()(value[2 * i], value[2 * i + 1]); }
	}

	Type query(int s, int t) { return _query(s, t, 1, 0, size); }
};

#endif


// ------ main ------ //

#include <cstdio>

using namespace std;

#pragma warning(disable: 4996)

template<typename Type>
struct minimum : public binary_function<Type, Type, Type>
{
	Type operator() (Type first, Type second)
	{
		return min(first, second);
	}
};

int n, q, com, x, y;

int main()
{
	scanf("%d", &n);
	scanf("%d", &q);

	RMQ<int, minimum<int> > r(n, numeric_limits<int>::max());

	for (int i = 0; i < q; i++)
	{
		scanf("%d", &com);
		scanf("%d", &x);
		scanf("%d", &y);

		if (com == 0) 
		{
			r.update(x, y);
		}
		if (com == 1) 
		{
			printf("%d\n", r.query(x, y + 1));
		}
	}

	return 0;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    REP(i, h) {
        cin >> s[i];
    }

    vector<vector<int>> hh(h, vector<int>(w, 0));
    REP(i, h) {
        int p = -1;
        REP(j, w) {
            if (s[i][j] == '#') {
                FOR(k, p + 1, j) {
                    hh[i][k] = j - p - 1;
                }
                p = j;
            }
        }
        if (p != w - 1) {
            FOR(k, p + 1, w) {
                hh[i][k] = w - p - 1;
            }
        }
    }
    vector<vector<int>> ww(h, vector<int>(w, 0));
    REP(i, w) {
        int p = -1;
        REP(j, h) {
            if (s[j][i] == '#') {
                FOR(k, p + 1, j) {
                    ww[k][i] = j - p - 1;
                }
                p = j;
            }
        }
        if (p != h - 1) {
            FOR(k, p + 1, h) {
                ww[k][i] = h - p - 1;
            }
        }
    }

    int m = 0;
    REP(i, h) {
        REP(j, w) {
            chmax(m, hh[i][j] + ww[i][j]);
        }
    }
    cout << m - 1 << endl;
}


Measured memory_bytes: 35712
import fractions
a, b = map(int, input().split())
n = fractions.gcd(a, b)

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

print(len(set(prime_decomposition(n)))+1)

Measured memory_bytes: 5048
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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; }



int main() 
{
  ll N,X,Y; cin>>N>>X>>Y; X--; Y--;
  vector<vector<ll>> graph(N,vector<ll>(0));
  rep(i,N-1)
  {
    graph.at(i).push_back(i+1);
    graph.at(i+1).push_back(i);
  }
  graph.at(X).push_back(Y);
  graph.at(Y).push_back(X);
  
  vector<ll> ans_list(N,0);
  rep(i,N)
  {
    vector<bool> checked(N,false);
    vector<ll> min_path(N,INF);
    queue<ll> que;
    que.push(i);
    min_path.at(i)=0;
    checked.at(i)=true;
    while(!que.empty())
    {
      auto n=que.front();
      que.pop();
      //if(checed.at(n)) continue;
      //checked.at(n)=true;
      auto vec=graph.at(n);
      for(auto node:vec)
      {
        //if(node<=i) continue;
        if(checked.at(node)) continue;
        chmin(min_path.at(node),min_path.at(n)+1);
        que.push(node);
        checked.at(node)=true;
        ans_list.at(min_path.at(node))++;
      }  
    }
    /*
    rep(i,N)
    {
      if(i!=0) cout<<" ";
      cout<<min_path.at(i);
    }
    cout<<endl;
    */
  }
  
  for(int i=1;i<N;i++)
  {
    cout<<ans_list.at(i)/2<<endl;
  }  
  return 0;
}


Measured memory_bytes: 3844
#include "bits/stdc++.h"
using namespace std;

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

    int N; cin >> N;
    int cnt = 0;
    for (int i = 0; i < N; ++i) {
        string s; cin >> s;
        if (s == "E869120") ++cnt;
    }
    cout << cnt << endl;

    return 0;
}



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

#define MOD (1000 * 1000 * 1000 + 7)
#define INF (1LL << 60)
#define pb push_back
#define po pop_back
#define fi first
#define se second

typedef long long ll;
typedef long double ld;

#define maxn 105
#define maxv 300005
ll A[maxn][2];
ll dp[maxv];

int main() {
    int N, W;
    scanf("%d%d", &N, &W);

    for (int i = 1; i <= N; ++i)
        scanf("%lld%lld", &A[i][0], &A[i][1]);
    
    for(int i = 0; i < maxv; ++i)
        dp[i] = INF;

    for(int i = 1; i <= N; ++i) {
        for(int v = maxv - 1; v >= 1; --v) {
            if(dp[v] + A[i][0] <= W && dp[v] != 0) {
                dp[v + A[i][1]] = min(dp[v + A[i][1]], dp[v] + A[i][0]);
            }
        }
        dp[A[i][1]] = min(dp[A[i][1]], A[i][0]);

    }

    ll m = 0;
    for(ll i = 1; i < maxv; ++i) {
        m = max(m, ((dp[i] != INF) ? i : 0));
    }
    printf("%lld\n", m);



   
    return 0;
}

Measured memory_bytes: 2560