akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define pb push_back
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s, t;
	cin >> s >> t;
	int cnt = 0;
	for (int i = 0; s[i]; i++)
		if (s[i] != t[i]) cnt++;
	cout << cnt << "\n";	
	return 0;
}

Measured memory_bytes: 3772
using System;

public class Program
{
    private int N;
    private int[] A;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        A = new int[N];

        for (int i = 0; i < N; i++)
        {
            A[i] = sc.NextInt();
        }

        long ans = 0;

        int t = 1;

        ans += A[0] - 1;

        for (int i = 1; i < N; i++)
        {
            // A[i]をPを t+1以上にしてt以下にする
            if (A[i] == t+1)
            {
                t++;
            }
            else
            {
                ans += (A[i] - 1) / (t + 1);
            }
        }
        
        Console.WriteLine(ans);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 17332
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<map>
#include<queue>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

/*#define int ll*/
long long N, M, a[100009][3], maxn = -(1LL << 60);
 
int main() {
	cin >> N >> M;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j < 3; j++) cin >> a[i][j];
	}
	for (int i = 0; i < 8; i++) {
		vector<long long>vec;
		for (int j = 1; j <= N; j++) {
			long long S = 0;
			for (int k = 0; k < 3; k++) { if (i & (1 << k)) S += a[j][k]; else S -= a[j][k]; }
			vec.push_back(S);
		}
		sort(vec.begin(), vec.end()); reverse(vec.begin(), vec.end());
		long long ans = 0;
		for (int j = 0; j < M; j++) ans += vec[j];
		maxn = max(maxn, ans);
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse = True)
l = [0,2,5,5,4,5,6,3,7,6]

dp = [-1**10]*(n+1)
dp[0] = 0
for i in range(1,n+1):
    
    for j in range(m):
        if i >= l[a[j]] and dp[i] < dp[i-l[a[j]]]+1:
            dp[i] = dp[i-l[a[j]]]+1
            

ans = []
remain = dp[-1]
now = n
for i in a:
    x = l[i]
    while now -x >= 0 and dp[now] == dp[now-x]+1:
        ans.append(i)
        now -= x 
print(*ans,sep="")

Measured memory_bytes: 4324
n, m, l = map(int, input().split())
A = []
B = []

for i in range(n):
    A.append(list(map(int, input().split())))

for j in range(m):
    B.append(list(map(int, input().split())))

for i in range(n):
    table = []
    for j in range(l):
        c = 0
        for k in range(m):
            c += A[i][k]*B[k][j]
        table.append(str(c))
    print(' '.join(table))


Measured memory_bytes: 6248
#include<iostream>
using namespace std;
static const int MAX = 100;

void insertionSort(int A[], int N){
  for ( int i = 0; i < N; i++ ) {
    int v = A[i];
    int j = i - 1;
    while (j >= 0 && A[j] > v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;

    for(int k = 0; k < N; k++ ){
      cout << A[k];
      if (k != N-1) cout << ' ';
    }
   cout << endl;
  }
}

int main()
{
  int R[MAX], N;

  cin >> N;
  for ( int i = 0; i < N; i++ ) cin >> R[i];
  insertionSort(R, N);

  return 0;
}



Measured memory_bytes: 3108
// Ryo Kamoi
// #define DEBUG

#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>

using namespace std;

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

typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;

int INF = 1000000000;

struct edge{
  int to; int d;
};

int n;
vector<edge> g[1000];
int p[1000];
int dist[1000];
bool done[1000];
int t;
int maxdist;

void solve(int idx) {
  done[idx] = true;
#ifdef DEBUG
  cout << idx << " " << t << endl;
#endif
  REP(i, g[idx].size()) {
    if (done[g[idx][i].to]) continue;

    if (g[g[idx][i].to].size() == 1) {
      t += g[idx][i].d;
      done[g[idx][i].to] = true;
      continue;
    }

    t += g[idx][i].d * 3;
    solve(g[idx][i].to);
  }
}

int calcdist(int idx) {
  int innerdist[1000];
  bool innerdone[1000];
  REP(i, n) {
    innerdist[i] = 0;
    innerdone[i] = false;
  }
  innerdone[idx] = true;

  queue<int> que;
  que.push(idx);
  while(!que.empty()) {
    int cur = que.front(); que.pop();
    REP(i, g[cur].size()) {
      if (innerdone[g[cur][i].to]) continue;
      if (g[g[cur][i].to].size() == 1) continue;
      
      innerdist[g[cur][i].to] = innerdist[cur] + g[cur][i].d;
      que.push(g[cur][i].to);
      innerdone[g[cur][i].to] = true;
    }
  }

  int maxdist = 0;
  REP(i, n) {
    maxdist = max(maxdist, innerdist[i]);
  }
  return maxdist;
}

int main(){
  while(1) {
    cin >> n;
    if (n==0) break;

    t = 0;
    REP(i, n) {
      g[i] = vector<edge>();
      done[i] = false;
    }

    REP(i, n-1) {
      int to;
      cin >> to;
      p[i] = to-1;
    }
    REP(i, n-1) {
      cin >> dist[i];
    }
    REP(i, n-1) {
      edge e1;
      e1.to = p[i];
      e1.d = dist[i];
      g[i+1].push_back(e1);

      edge e2;
      e2.to = i+1;
      e2.d = dist[i];
      g[p[i]].push_back(e2);
    }

    int start;
    REP(i, n) {
      if (g[i].size() == 1) {
        start = i; break;
      }
    }
    solve(g[start][0].to);

    maxdist = 0;
    REP(i, n) {
      if (g[i].size() > 1) {
        maxdist = max(maxdist, calcdist(i));
#ifdef DEBUG
        cout << i << " " << g[i].size() << " " << calcdist(i) << endl;
#endif
      }
    }

#ifdef DEBUG
    cout << t << " " << maxdist << endl;
#endif
    cout << t - maxdist << endl;
  }
}



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

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

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void _main() {
        string s;
        cin >> s;
        if (s == "SUN") cout << 7;
        else if (s == "MON") cout << 6;
        else if (s == "TUE") cout << 5;
        else if (s == "WED") cout << 4;
        else if (s == "THU") cout << 3;
        else if (s == "FRI") cout << 2;
        else cout << 1;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 3600
s = list(map(int, list(input())))
s2 = s[:]

ans1 = 0
ans2 = 1

for i in range(1, len(s)):
    if (s[i-1] + s[i]) % 2 == 0:
        s[i] = abs(s[i]-1)
        ans1 += 1

if s2[0] == 0:
    s2[0] = 1
else:
    s2[0] = 0

for i in range(1, len(s)):
    if (s2[i-1] + s2[i]) % 2 == 0:
        s2[i] = abs(s2[i]-1)
        ans2 += 1

print(ans1 if ans1 <= ans2 else ans2)


Measured memory_bytes: 4652
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
vector<vector<long int> > dp;
vector<vector<vector<long int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));

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

	int D,G;
	int p[10],c[10];
	cin>>D>>G;
	REP(i,D)cin>>p[i]>>c[i];
	int ans=INF;
	for(int mask=0;mask<(1<<D);mask++){
		int s=0,num=0,rest_max=-1;
		REP(i,D){
			if(mask>>i&1){
				s+=100*(i+1)*p[i]+c[i];
				num+=p[i];
			}else
				rest_max=i;
		
		}
		if(s<G){
			int s1=100*(rest_max+1);
			int need=(G-s+s1-1)/s1;
			if(need>=p[rest_max])continue;
			
			num+=need;
		}
		ans=min(num,ans);
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(){
  int N;
  int sum;
  cin >> N ;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N-1);
  for(int i = 0;i < N; i++){
      cin >> A.at(i);
  }
  for(int i = 0;i < N; i++){
      cin >> B.at(i);
  }
  for(int i = 0;i < N - 1; i++){
      cin >> C.at(i);
  }

  sum = accumulate(B.begin(),B.end(),0);

  for(int i = 0;i < N - 1 ;i++){
      if( (A[i+1] - A[i]) == 1){
          sum += C[A[i]-1];
      }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
 int n=0;
 int c=0;
 int d=0;
 int i=0;
 int all=0;
 int ama=0;
 cin>>n;
 cin>>c;
 int cake[c];
 for(i=1;i<=c;i=i+1){
    cin>>cake[i];
 }
 for(i=c;i>=1;i=i-1){
    d=d+cake[i];
 }
 all=d/(n+1);
 ama=d%(n+1);
 if(ama==0){
   cout<<all<<endl;
 }else{
   cout<<all+1<<endl;
 }
}


Measured memory_bytes: 3120
use std::io::Read;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let n: usize = s.trim().parse().unwrap();
    let mut a: Vec<Vec<u64>> = vec![vec![0; 10]; 10];
    let mut ans = 0u64;
    for i in 1..n + 1 {
        let k2 = i % 10;
        let mut k1 = i;
        while k1 >= 10 {
            k1 /= 10;
        }
        a[k1][k2] += 1;
    }
    for i in 1..10 {
        for j in 1..10 {
            ans += a[i][j] * a[j][i];
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,mn,ans=0;
  int num[100];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>num[i];
  }
  for(int i=0;i<n;i++){
    mn=i;
    for(int j=i;j<n;j++){
      if(num[j]<num[mn]) mn=j;
    }
    swap(num[i],num[mn]);
    if(mn!=i) ans++;
  }
  for(int i=0;i<n;i++){
    if(i!=n-1) cout<<num[i]<<" ";
    else cout<<num[i];
  }
  cout<<endl;
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3084
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<LL> a(n), r(n);
	LL all_sum = 0, odd_sum = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		all_sum += a[i];
		if (i % 2) {
			odd_sum += a[i];
		}
	}
	r[0] = all_sum - 2 * odd_sum;
	for (int i = 1; i < n; ++i) {
		r[i] = 2 * a[i - 1] - r[i - 1];
	}
	for (int i = 0; i < n; ++i) {
		if (i)cout << " ";
		cout << r[i];
	}
	cout << endl;
	return 0;
}	


Measured memory_bytes: 2944
#include <iostream>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#define Rep(i,a) for(int i = 0; i < (a); i++)
#define rep(i,a,b) for(int i = (a); i <= (b); i++)//(a)!
#define dep(i,a,b) for(int i = (a); i >= (b); i--)
#define ab(a) ((a) > 0 ? (a) : -(a))
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
char s[200000];
int main() {
	int n, a, b; scanf("%d%d%d",&n,&a,&b);
	int tot = 0, ab = 0; scanf("%s",s + 1);
	rep(i,1,n) {
		if (s[i] == 'a') {
			if (tot < a + b) printf("Yes\n"), tot++;
			else printf("No\n");
		} else if (s[i] == 'b') {
			if (tot < a + b && ab < b) printf("Yes\n"), tot++, ab++;
			else printf("No\n");
		} else printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 768
# gets.to_i
# gets.split.map(&:to_i)
# N.times.map{gets.to_i}
# N.times.map{gets.split.map(&:to_i)}
# 

#N,M=gets.split.map(&:to_i)

A,B=gets.split.map(&:to_i)


(10**5).times do |i|
    fa=i*8/100
    fb=i*10/100
    if fa==A && fb==B
        puts i
        exit
    end
end
puts -1


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<lli>
#define pb  push_back
#define mp  make_pair
#define ss  second
#define ff  first
#define all(x) x.begin(),x.end()
//const lli mod = 1000000007;

lli p2(lli n){lli ans=0;while(n>=1){n=n/2;ans++;}return ans;}
lli b_ex(lli n,lli a){lli res=1;while(n){if(n%2==1)res*=a;n>>=1;a=a*a;}return res;}
lli ncr(lli n,lli k){lli ans=1;if(k>n-k)k=n-k;for(lli i=1;i<=k;i++){ans*=(n-i+1),ans=ans/i;}return ans;}
//lli add(lli a,lli b){return(a+b)%mod;}
//lli mul(lli a,lli b){return (a*b)%mod;}
//lli power(lli a , lli n){lli ans = 1;while(n){if(n % 2)ans = (ans * a) % mod;n /= 2;a = (a * a) % mod;}return ans;}
lli lcm(lli a,lli b)
{
    lli ans=(a*b)/(__gcd(a,b));
    return ans;
}
///------------------ALWAYS lli-----TEMP TSF99--------------------------------------------------------------------------------------///
void solve()
{
    int mod;cin>>mod;
    int val=7%mod;
    for(int i=1;i<1e7;i++)
    {
        if(val==0)
        {
            cout<<i<<endl;return;
        }
        val=(val*10+7)%mod;
    }
    cout<<-1<<endl;
}
int main()
{
    solve();
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n; cin >> n;
	vector<ll> trades;
	vector<ll> v(n);
	for(ll &i : v)cin >> i;
	ll stock = 0;
	ll money = 1000;
	for(int i = 0; i < n-1; ++i){
		if(v[i] < v[i+1]){
			stock +=money/v[i];
			money%=v[i];
		}
		else if(v[i] > v[i+1]){
			money+=stock * v[i];
			stock = 0;
		}
	}
	cout << money + (stock * v[n-1]) << "\n";
}


Measured memory_bytes: 3628
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a,b=mi()
print(max(a-b-b,0))

Measured memory_bytes: 3444
using System;
using System.Linq;
class P
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    string[] input = Console.ReadLine().Split(' ');
    int[] array = new int[N];
    for (int i = 0; i < N; i++) {
      array[i] = int.Parse(input[i]);
    }
    int min = 999;
    for (int i = 0; i < N-1; i++) {
      int sum1 = array.Skip(0).Take(i+1).ToArray().Sum();
      int sum2 = array.Skip(i+1).Take(N-(i+1)).ToArray().Sum();
      int abs = Math.Abs(sum1 - sum2);
      if (abs < min) {
        min = abs;
      }
    }
    Console.WriteLine(min);
  }
}

Measured memory_bytes: 13268
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n,m;
  cin >> n >> m;
  priority_queue<int> q;
  rep(i,n){
    int a; cin >> a;
    q.push(a);
  }
  rep(i,m){
    int a=q.top();
    a/=2;
    q.pop();
    q.push(a);
  }
  ll ans=0;
  rep(i,n){
    ans+=q.top();
    q.pop();
  }
  cout << ans << endl;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
//#pragma GCC optimize "trapv"
int main()
{
	// ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
	int n;
	cin>>n;
	int a[10000];
	for(int i=0;i<n;i++)
		cin>>a[i];
	ll ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			for(int k=j+1;k<n;k++)
			{
				if(a[i]!=a[j] && a[i]!=a[k] && a[j]!=a[k])
				{
					int c[3];
					c[0]=a[i];
					c[1]=a[j];
					c[2]=a[k];
					sort(c,c+3);
					if(c[0]+c[1]>c[2])
						ans++;
				}
			}
		}
	}
	cout<<ans<<"\n";
}

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

int n, a[1025][1025], z;
bool vis[1025], flag;
bool ok() {
  for (int i = 1; i <= n; i++)
    if (a[i][0] != n) return 0;
  return 1;
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n - 1; ++j) cin >> a[i][j];
    a[i][0] = 1;
  }
  while (1) {
    if (ok()) {
      cout << z << '\n';
      return 0;
    }
    flag = 0;
    z++;
    memset(vis, 0, sizeof vis);
    for (int i = 1; i <= n; i++) {
      if (vis[i] || a[i][0] == n) continue;
      int x = a[i][a[i][0]];
      if (a[x][a[x][0]] == i && !vis[i] && !vis[x]) {
        a[i][0]++;
        a[x][0]++;
        vis[i] = vis[x] = 1;
        flag = 1;
      }
    }
    if (!flag) {
      cout << -1 << '\n';
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 4352
//B - ISU: 
//Assunto: 
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define loop(i, a, b) for(int i = a; i < b; i++)
#define loopBack(i, a, b) for(int i = a; i >= b; i--)
#define INF INT_MAX
#define LINF LLONG_MAX
#define DINF DBL_MAX
#define MAX 100050
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int x, y, z, space, ans;
    cin >> x >> y >> z;
    space = y + z;
    ans = (x-z) / space;
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
#define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {
    
    ll x;
    cin>>x;
    ll ans=x/11*2;
    x%=11;
    if(x>6){
        ans++;
        x-=6;
    }
    if(x>0)ans++;
    fin(ans);

}



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

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

	bool flag = false;
	for (int i = 0; i < s.length(); i++) {
		int match = 0;
		while (p[match] == s[(i + match) % s.length()]) match++;
		if (match == p.length()) flag = true;
	}
	cout << (flag ? "Yes" : "No") << endl;

	return 0;
}

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

using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;

lli ncr(lli left, lli right) {
	right = min(left - right, right);
	lli ans = 1;
	for (lli i = 1; i <= right; i++) {
		ans = ans * (left - right + i) / i;
	}
	return ans;
}

int main() {
	int N;
	cin >> N;
	vector<string> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
		sort(v[i].begin(), v[i].end());
	}
	map<string, lli> m;
	for (int i = 0; i < N; i++) {
		m[v[i]]++;
	}
	lli ans = 0;
	for (auto i : m) {
		if (i.second != 1) {
			ans += ncr(i.second, 2);
		}
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

int n;
string s;

int main()
{
    cin >> s;
    n = s[s.length()-1]-48;
    if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
    {
        cout << "hon" << endl;
    }
    else
    {
        if(n == 0 || n == 1 || n == 6 || n == 8)
        {
            cout << "pon" << endl;
        }
        else
        {
            cout << "bon" << endl;
        }
    }
    return 0;
}


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

using namespace std;

#define ll long long
ll input(){
	ll x=0,f=0;char ch=getchar();
	while(ch<'0'||ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return f? -x:x;
}

const int N=107,M=1e5+7;
const ll mod=1e9+7;

ll dp[N][M],sum[M];
int a[N];

int main(){
	int n=input(),k=input();
	
	for(int i=0;i<n;i++) a[i]=input();
	for(int i=0;i<=n;i++) dp[i][0]=1;
	for(int i=1;i<=n;i++){
		sum[0]=0;
		for(int j=1;j<=k+1;j++) sum[j]=sum[j-1]+dp[i-1][j-1];
		for(int j=1;j<=k;j++) dp[i][j]=(sum[j+1]-sum[max(0,j-a[i-1])])%mod;
	}

	printf("%lld\n",dp[n][k]);
}

Measured memory_bytes: 79360
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__;
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    unsigned long long N; cin >> N;
    unsigned long long A,B; cin >> A >> B;
    unsigned long long cnt=0;
    if(A==0){
        cout << 0 << endl;
        return 0;
    }
    if(B==0){
        cout << N << endl;
        return 0;
    }
    if(A<=N%(A+B)){
        cnt = A;
    }else{
        cnt = N%(A+B);
    }
    cout << N/(A+B)*A+cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int N,i,j,com,minj,num=0;
	scanf("%d",&N);
	int A[N];
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	/*selection sort*/
	for(i=0;i<=N-1;i++){
		minj = i;
		for(j=i;j<=N-1;j++){
			if(A[j]<A[minj]){
				minj = j;
			}
		}
		com = A[i];
		A[i] = A[minj];
		A[minj] = com;
		if(i != minj){
			num++;
		}
	}
	for(i=0;i<N;i++){
		printf("%d",A[i]);
		if(i<N-1){
			printf(" ");
		}
	}
	printf("\n");
	printf("%d\n",num);
    return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;

  for (int i = 0; i < S.size(); i++) {
    S.at(i) += N;
    if (S.at(i) > 'Z') S.at(i) -= 26;
    cout << S.at(i);
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int N;
int h[110];
 
int solve(int x, int y) {
    if (x >= y) return 0;
    int minh = 1000, arg;
    bool flag = true;
    for (int i=x; i<y; i++) {
        if (h[i] > 0) flag = false;
        if (minh > h[i]) {
            arg = i;
            minh = h[i];
        }
    }
    if (flag) return 0;
    for (int i=x; i<y; i++) h[i] -= minh;
    return minh + solve(x, arg) + solve(arg+1, y);
}
 
int main() {
    cin >> N;
    for (int i=0; i<N; i++) cin >> h[i];
    cout << solve(0, N) << endl;
    return 0;
}

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++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}

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

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

    int a, b;
    cin >> a >> b;

    if(a + b >= 10) cout << "error" << endl;
    else cout << a + b << endl;
}

Measured memory_bytes: 384
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < n; i++)
const int INF = 1001001001;

pair<int, int> f(int n) {
	int a, b;
	a = n % 10;
	while (n) {
		b = n;
		n /= 10;
	}
	pair<int, int> ret(a, b);
	return ret;
}

int main() {
	int n;
	cin >> n;
	map<pair<int,int>,int> data;
	for (int i = 1; i <= n; i++) {
		pair<int, int> now = f(i);
		data[now]++;
	}
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		pair<int, int> now = f(i);
		pair<int, int> cntr(now.second, now.first);
		ans += data[cntr];
	}
	cout << ans << endl;
	return 0;
}

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

int main(void){

  int N;
  scanf("%d\n", &N);

  /*
  int *A;
  A = (int*)malloc(N*sizeof(int));
  for(int i=0; i<N; i++){
    scanf("%d", &A[i]);
  }
  */
  int ans=N;

  if(N%2!=0) ans = N*2;

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


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    string s,p;
    cin>>s>>p;
    s += s; //1≤pの長さ≤sの長さ≤100
    //REP(i,100)
    //    s += s;

    if(s.find(p) != string::npos) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 3212
n, k = gets.chomp!.split(" ").map(&:to_i)
MOD = (10 ** 9) + 7 

$pascal = {
    0 => {0 => 1},
    1 => {0 => 1, 1 => 1},
}

def pascal(n, i)
    return 1 if n == 0
    return $pascal[n][i] if $pascal[n] && $pascal[n][i]

    if n == i || i == 0
        $pascal[n] ||= {}
        $pascal[n][i] = 1
    else
        $pascal[n] ||= {}
        $pascal[n][i] = (pascal(n-1, i-1) + pascal(n-1, i)) % MOD
    end

    return $pascal[n][i]
end

# 入れられる場所の数
red = n - k + 1

1.upto(k) do |i|
    if i > red
        puts 0
    else
        # i回の操作 => i個に青を分割する
        # 入れられる場所の数に対してi個
        x = pascal(red, i)
        y = pascal(k - 1, i - 1)
        puts (x * y) % MOD
    end
end


Measured memory_bytes: 45692
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int a, b, c; cin >> a >> b >> c;
	if(c + b >= a) println(b+c-a);
	else println(0);
}


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

namespace abc078_a
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] c = Console.ReadLine().Split().Select(char.Parse).ToArray();
            if (c[0] == c[1]) Console.WriteLine("=");
            else Console.WriteLine(c[0] > c[1] ? ">" : "<");
        }
    }
}

Measured memory_bytes: 13268
from collections import deque

#Dinic法 from https://ikatakos.com/pot/programming_algorithm/graph_theory/maximum_flow
class Dinic:
  def __init__(self, n):
    self.n = n
    self.links = [[] for _ in range(n)]
    self.depth = None
    self.progress = None
 
  def add_link(self, _from, to, cap):
    self.links[_from].append([cap, to, len(self.links[to])])
    self.links[to].append([0, _from, len(self.links[_from]) - 1])
 
  def bfs(self, s):
    depth = [-1] * self.n
    depth[s] = 0
    q = deque([s])
    while q:
      v = q.popleft()
      for cap, to, rev in self.links[v]:
        if cap > 0 and depth[to] < 0:
          depth[to] = depth[v] + 1
          q.append(to)
    self.depth = depth
 
  def dfs(self, v, t, flow):
    if v == t:
      return flow
    links_v = self.links[v]
    for i in range(self.progress[v], len(links_v)):
      self.progress[v] = i
      cap, to, rev = link = links_v[i]
      if cap == 0 or self.depth[v] >= self.depth[to]:
        continue
      d = self.dfs(to, t, min(flow, cap))
      if d == 0:
        continue
      link[0] -= d
      self.links[to][rev][0] += d
      return d
    return 0
 
  def max_flow(self, s, t):
    flow = 0
    while True:
      self.bfs(s)
      if self.depth[t] < 0:
        return flow
      self.progress = [0] * self.n
      current_flow = self.dfs(s, t, float('inf'))
      while current_flow > 0:
        flow += current_flow
        current_flow = self.dfs(s, t, float('inf'))

#入力
N=int(input())
red=[]
blue=[]
for i in range(N):
  a,b=map(int,input().split())
  red.append([a,b])
for i in range(N):
  a,b=map(int,input().split())
  blue.append([a,b])

#N個とN個のマッチング。source/sinkを加えた2+2*Nの最大流に帰着させる
#各点からsource/sinkにパスを張る
mf=Dinic(2*N+2)
for i in range(1,N+1):
  mf.add_link(0, i, 1)
for i in range(N+1,2*N+1):
  mf.add_link(i, 2*N+1, 1)

#マッチング条件を満たす２点にパスを張る
for i in range(N):
  for j in range(N):
    a,b=red[i]
    c,d=blue[j]
    if a<c and b<d:
      mf.add_link(i+1, N+1+j, 1)
      
print(mf.max_flow(0, 2*N+1))

Measured memory_bytes: 3956
/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog oi.ender-zzm.pro
*/
#include <bits/stdc++.h>
using namespace std;

template<class T>
inline void read(T &a) {
    register T x = 0, flag = 1;
    register char ch;
    while (!isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), isdigit(ch = getchar()));
    a = x * flag;
}

template <class T>
inline void write(T x) {
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10); 
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define For(i, a, b) for (int i = (a); i <= (b); i++) 
#define Rep(i, a, b) for (int i = (a); i >= (b); i--) 
#define For_edge(x) for (int i = head[x]; i; i = net[i])
#define mem0(a) memset(a, 0, sizeof a)

double b;
unsigned long long a, c;
int main() {
	cin >> a >> b;
	c = (unsigned long long)(b * 1000.0);
	printf("%lld", a * c / 1000);
}


Measured memory_bytes: 3784
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    N = int(input())
    S = input()

    ans = 0
    for i in range(1000):
        s = str(i).zfill(3)
        j = 0
        flg0 = False
        flg1 = False
        flg2 = False
        for j in S:
            if not flg0 and j==s[0]:
                flg0 = True
            elif flg0 and not flg1 and j==s[1]:
                flg1 = True
            elif flg0 and flg1 and not flg2 and j==s[2]:
                flg2 = True
        if flg0 and flg1 and flg2:
            ans +=1

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 41308
class Array
  def cumsum!(s = 0); map!{|t| s += t } end
end

n, k = gets.to_s.split.map{|t| t.to_i }
a    = gets.to_s.split.map{|t| t.to_i }

if k >= 41
  puts "#{n} " * (n - 1) + "#{n}"
  exit
end

ans = []
[k, 41].min.times do |i|
  ans = [0] * n
  a.each_with_index do |t, i|
    
    j = i - t
    if 0 <= j
      ans[j] += 1
    else
      ans[0] += 1
    end
    
    j = i + t + 1
    ans[j] += -1 if j < n
  end
  ans.cumsum!
  a = ans.dup
end

puts ans * ' '

Measured memory_bytes: 80900
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);

    	String X=sc.next();
    	String Y=sc.next();

    	if(X.compareTo(Y)<0) {
    		System.out.println("<");
    	}else if(X.compareTo(Y)>0) {
    		System.out.println(">");
    	}else {
    		System.out.println("=");
    	}
    	

    }
}



Measured memory_bytes: 21844
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
typedef long long LL;
using namespace std;

char u;
void scan(int &x){
	int f=1;
    while(u = getchar(), u < '0' || u > '9'){if(u=='-') f=-1;};
    x = u-'0';
    while(u = getchar(), u >= '0' && u <= '9') x = x * 10 + u -'0';
    x*=f;
}

int l[200010],r[200010];

int main(){
	int n;
	scan(n);
	string st;
	cin >> st;
	memset(l,0,sizeof(l));
	memset(r,0,sizeof(r));
	for(int i=1; i<=st.size(); i++){
		if(st[i-1]=='#'){
			l[i+1]=l[i]+1; 
		}
		else l[i+1]=l[i];
	}
	for(int i=st.size(); i>=0; i--){
		if(st[i+1]=='.'){
			r[i+1]=r[i+2]+1;
		}
		else r[i+1]=r[i+2];
	}
	r[0]=r[1];
	int ans=2147483647;
	for(int i=0; i<=n+1; i++){
		ans=min(ans,l[i]+r[i]);
	}
	cout << ans <<endl;
	return 0;
}


Measured memory_bytes: 5304
#include <iostream>
#include <stdio.h>
using namespace std;

int n, A[100];

void ShowArray(int *arr)
{
    for (int i = 0; i < n; i++)
    {
        if (i != n-1) printf("%d ", arr[i]);
        else printf("%d\n", arr[i]);
    }
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++) cin >> A[i];
    ShowArray(A);
    for (int i = 1; i < n; i++) 
    {
        int target = A[i];
        int j = i-1;
        while (j >= 0 && A[j] > target)
        {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = target;
        ShowArray(A);
    }

    return 0;
}


Measured memory_bytes: 3204
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(S: int):
    dp = [0] * (S+1)
    dp[0] = 1
    for i in range(1, S+1):
        for j in range(0, (i-3)+1):
            dp[i] += dp[j]
            dp[i] %= MOD
    print(dp[S])

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 64528
#include <iostream>
#include <cmath>

using namespace std;

int main(){
	unsigned long n, p;
	cin >> n >> p;

    unsigned long tmp = p;
	unsigned long k = (unsigned long)(sqrt(p));
    unsigned long* ord = new unsigned long[k];

    if(p == 1){
        cout << 1 << endl;
    }else if(n == 1){
    	cout << p << endl;
    }else{
    	ord[0] = 1;
        for(unsigned long i = 1; i < k; i++){
		    unsigned long cnt = 0;

        	if(p % (i+1) == 0){
        		while(p % (i+1) == 0){
        			cnt++;
        			p = p / (i + 1);
        		}
        		ord[i] = cnt;
        		p = tmp;

        	}else{
        		ord[i] = 0;
        	}
        }
    
	    unsigned long maximum = 1;

    	for(unsigned long j = 0; j < k; j++){
    		if(ord[j]>=n && j+1 > maximum) maximum = j+1;
    	}
    	cout << maximum << endl;
    }

}

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

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <ll, ll> dl;
typedef pair <int, int> ii;
typedef vector <ii> vii;
typedef vector <vi> graph;

int n;
ll w[110];
ll value[110];
ll dp[110][100010];

ll solve (int id, ll res) {
	if (res < 0) {
		return -10000000000;
	}
	if (id == n) {
		return 0;
	}
	if (dp[id][res] != -1) return dp[id][res];
	return dp[id][res] = max (value[id] + solve(id + 1, res - w[id]), solve(id + 1, res));
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    ll weig;
	cin >> n >> weig;
	for (int i = 0; i < n; ++i)
	{
		cin >> w[i] >> value[i];
	}
	for (int i = 0; i < 110; ++i)
	{
		for (int j = 0; j < 100010; ++j)
		{
			dp[i][j] = -1;
		}
	}
	cout << solve(0, weig) << "\n";
    return 0;
}


Measured memory_bytes: 86272
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 1e18;
int main() {
    ll N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    for(int i=0; i<N; ++i) {
        cin >> v[i] >> w[i];
    }
    ll n2 = N/2;
    vector<P> ps(1 << n2);
    for(int i=0; i<1<<n2; ++i) {
        ll sw = 0, sv = 0;
        for(int j=0; j<n2; ++j) {
            if(i >> j & 1) {
                sw += w[j];
                sv += v[j];
            }
        }
        ps[i] = make_pair(sw, sv);
    }
    sort(ps.begin(), ps.end());
    int m=1;
    for(int i=1; i<1<<n2; ++i) {
        if(ps[m-1].second < ps[i].second) {
            ps[m++] = ps[i];
        }
    }
    ll res = 0;
    for(int i=0; i<1<<(N-n2); ++i) {
        ll sw = 0, sv = 0;
        for(int j=0; j<N-n2; ++j) {
            if(i >> j & 1) {
                sw += w[n2+j];
                sv += v[n2+j];
            }
        }
        if(sw <= W) {
            ll tv = (lower_bound(ps.begin(), ps.begin() + m, make_pair(W-sw, INF)) - 1)->second;
            res = max(res, sv + tv);
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 19204
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;

inline int highbit(int x) {
    for (int i = 1048576; i; i >>= 1)
        if (x & i) return i;
    puts(" :) ");
} 

int main() {
#ifdef isLOCAL
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    int n;
    cin >> n;
    if (n == (n & (-n))) return puts("No"), 0;
    puts("Yes");

    if (n & 1) {
        for (int i = 2; i <= n; ++i)
            printf("%d %d\n%d %d\n", 1, i, i, (i ^ 1) + n);
        cout << n + 1 << " " << n + 2 << endl;
    } else {
        for (int i = 2; i < n; ++i)
            printf("%d %d\n%d %d\n", 1, i, i, (i ^ 1) + n);
        cout << n + 1 << " " << n + 2 << endl;
        int a = highbit(n), b = n ^ a ^ 1;
        cout << a << " " << n << endl;
        cout << b << " " << n + n << endl;
    }

    return 0;
}


Measured memory_bytes: 2304
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}


int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, m;
vector<int> vec[100010];
bool d[100010];
int ans;

void dfs(int x) {
	if (d[x])return;
	d[x] = true;
	for (int i = 0; i < (int)vec[x].size(); i++) {
		dfs(vec[x][i]);
	}
	return;
}

signed main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int x, y, z;
		cin >> x >> y >> z;
		vec[x].push_back(y);
		vec[y].push_back(x);
	}
	for (int i = 1; i <= n; i++) {
		if (d[i])continue;
		dfs(i);
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 8960
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
struct node 
{
	long long x,y;
}a[100010];
bool cmp(node q,node p)
{
	return q.x<p.x;
	
}
int main ()
{
	long long n;
	cin>>n;
	long long k;
	cin>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].x>>a[i].y;
	}
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		if(k<=a[i].y)
		{
			cout<<a[i].x<<endl;
			break;
		}else
		{
			k-=a[i].y;
		}
		
	}
	
	
	
	
	
	
	
 } 

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define int long long
#define M 1000000007
#define sz(c) c.size()
#define fr first
#define sc second
#define pb push_back
#define sz(c) c.size()
#define ppb  pop_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define rep(i,a,n)   for( int i=a ; i<n ; i++)
#define what_is(x)  cout << #x << " is " << x << endl;
#define U 1000000007
#define N 100005
using namespace std;
signed main()
{
  ios_base::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[n][3];
  rep(i,0,n) rep(j,0,3) cin>>a[i][j];
  int dp[n][3];
  dp[0][0]=a[0][0];
  dp[0][1]=a[0][1];
  dp[0][2]=a[0][2];

  rep(i,1,n)
  {
    dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
    dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
    dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][0]);
  }
  cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));



}

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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

int main() {
  VI g = {0,2,0,1,0,1,0,0,1,0,1,0};
  
  int x,y;
  cin >> x >> y;
  
  if(g.at(x-1) == g.at(y-1)) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
  
}


Measured memory_bytes: 256
a,b,c=map(int,input().split())
k=int(input())

bb=b
bcnt=0
while a>=bb:
    bb=bb*2
    bcnt+=1

cc=c
ccnt=0
while bb>=cc:
    cc=cc*2
    ccnt+=1

if bcnt+ccnt<=k:
    print("Yes")
else:
    print("No")

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

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    int x,y,z;
    cin >> x >> y >> z;
    x-=z;
    cout << x/(y+z) << endl;
}

Measured memory_bytes: 256