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

int main(){
  int64_t N,bufP;
  cin >> N >> bufP;
  int64_t prod= bufP;

  int64_t ans= 1;
  int64_t prime= 2;
  while(prime*prime <= prod){
    int64_t exp_prime= 0;
    while(prod % prime==0){
      exp_prime++;
      prod/= prime;
    }

    for(int64_t i=N; i<=exp_prime; i+=N){
      ans*= prime;
    }

    prime++;
  }
  if(N==1){ ans*= prod; }

  cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func toInt(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		panic(err)
	}
	return n
}

type Process struct {
	name string
	time int
}

type Queue struct {
	ps    []*Process
	start int
	end   int
	len   int
}

func (q *Queue) enq(p *Process) {
	if q.len == len(q.ps) {
		panic("")
	}
	if q.end == len(q.ps) {
		q.ps[0] = p
		q.end = 0
	} else {
		q.ps[q.end] = p
	}
	q.end++
	q.len++
}

func (q *Queue) deq() *Process {
	if q.len == 0 {
		panic("")
	}
	result := q.ps[q.start]
	if q.start == len(q.ps)-1 {
		q.start = 0
	} else {
		q.start++
	}
	q.len--
	return result
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanLines)
	sc.Scan()
	in := strings.Split(sc.Text(), " ")
	n := toInt(in[0])
	q := toInt(in[1])

	l := make([]*Process, n)
	queue := Queue{ps: l}
	for i := 0; i < n; i++ {
		sc.Scan()
		p := strings.Split(sc.Text(), " ")
		queue.enq(&Process{name: p[0], time: toInt(p[1])})
	}

	total := 0
	for queue.len > 0 {
		p := queue.deq()
		if p.time > q {
			total = total + q
			p.time = p.time - q
			queue.enq(p)
		} else {
			total = total + p.time
			fmt.Printf("%s %d\n", p.name, total)
		}
	}
}



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

int main()
{
	int N, A, B;
	scanf("%d%d%d", &N, &A, &B);
	using vi = std::vector<int64_t>;
	using vvi = std::vector<vi>;
	vi v(N);
	for (auto& e: v) scanf("%lld", &e);
	vvi dp(N + 1, vi(N + 1, -1));
	dp[0][0] = 0;
	for (int n_i{}; n_i < N; n_i++)
	{
		dp[n_i + 1] = dp[n_i];
		for (int i{}; i + 1 <= N; i++)
			if (dp[n_i][i] >= 0)
				dp[n_i + 1][i + 1] = std::max(dp[n_i + 1][i + 1], dp[n_i][i] + v[n_i]);
	}
	int max_i{A};
	for (int i{A}; i <= B; i++)
		if (dp.back()[i] * max_i > dp.back()[max_i] * i)
			max_i = i;
	std::cout << std::fixed << std::setprecision(10) << (long double)dp.back()[max_i] / max_i << std::endl;
	vvi table(N + 1, vi(N + 1));
	for (int i{A}; i <= B; i++)
		if (dp.back()[i] * max_i == dp.back()[max_i] * i)
			table.back()[i] = 1;
	for (int n_i{N - 1}; n_i >= 0; n_i--)
	{
		for (int i{N}; i > 0; i--)
			if (dp[n_i][i - 1] + v[n_i] == dp[n_i + 1][i])
				table[n_i][i - 1] += table[n_i + 1][i];
		for (int i{N}; i >= 0; i--)
			if (dp[n_i][i] == dp[n_i + 1][i])
				table[n_i][i] += table[n_i + 1][i];
	}
	printf("%lld\n", table.front().front());

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <iomanip>
#include <ios>
#include <vector>
#include <string>
#include <algorithm>
#include <string>
#include<limits>
#include<cstdlib>
#include<functional>
#include<cassert>
#include <cstdio>
#include <stack>
#include <queue>
#include <map>
#define fi(p) for(int i=0;i<(p);i++)
#define ce(d) cout<<d<<endl;

using namespace std;
int N;
int L;
int P;
const int MAX_N = 100000;
const int MAX_W = 100000;


int A[MAX_N+1];
int B[MAX_N+1];

void solve() {
	int n;
	cin >> n;
	if (n % 2 == 0) {
		ce(n);
	}
	else {
		ce(n * 2);
	}
	
}

int main()
{
	solve();

	int a;//止める用
	cin >> a;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

int main(){
  ll n, m;
  cin >> n >> m;
  ll a[n];
  REP(i, n) cin >> a[i];

  ll s[n + 1];

  s[0] = 0;

  REP(i, n) s[i + 1] = (s[i] + a[i]) % m;

  unordered_map<ll, ll> map;

  ll ans = 0;

  REP(i, n + 1){
    ans += map[s[i]];
    map[s[i]]++;
  }

  cout << ans;
}


Measured memory_bytes: 5260
h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
c=0
ans=[]
for i in range(h):
    for j in range(w):
        if i==h-1 and j==w-1:
            break
        if a[i][j]%2!=0:
            c+=1
            if j==w-1:
                a[i+1][j]+=1
                a[i][j]-=1
                ans.append([i+1,j+1,i+2,j+1])
            else:
                a[i][j+1]+=1
                a[i][j]-=1
                ans.append([i+1,j+1,i+1,j+2])
print(c)
for i in range(c):
    print(*ans[i])


Measured memory_bytes: 72668
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int lim = (x % 100 - 1) / 5 + 1;
		
		int ans = 0;
		if (x / 100 >= lim) {
			ans = 1;
		}
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 23764
#include <vector>
#include <cstdio>
using namespace std;

int main(){
	int N,R=1<<29;
	scanf("%d",&N);
	vector<int>v(N);
	for(int i=0;i<N;i++)scanf("%d",&v[i]);
	for(int p=0;p<=v[0];p++){
		int cur=v[0]-p,r=p;
		for(int i=0;i<N-1;i++){
			int x=cur;
			r+=x*2;
			cur=max(v[i+1]-x,0);
		}
		R=min(R,r+cur);
	}
	printf("%d\n",R);
}

Measured memory_bytes: 2780
import sys
input = sys.stdin.buffer.readline

class UnionFind:
    def __init__(self, n=0):
        self.data = [-1]*(n+1)
    
    def root(self, x):
        if self.data[x] < 0:
            return x
        self.data[x] = self.root(self.data[x])
        return self.data[x]
    
    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x != y:
            if self.data[x] < self.data[y]:
                self.data[x] += self.data[y]
                self.data[y] = x
            else:
                self.data[y] += self.data[x]
                self.data[x] = y
    
    def same(self, x, y):
        return self.root(x) == self.root(y)
    
    def size(self, x):
        return -self.data[self.root(x)]
                


def main():
    n, m, k = map(int, input().split())
    friends = [0]*(n+1)
    blocks = [[] for _ in range(n+1)]
    uf = UnionFind(n)
    ans = []
    for _ in range(m):
        a, b = map(int, input().split())
        friends[a] += 1
        friends[b] += 1
        uf.unite(a, b)
    for _ in range(k):
        c, d = map(int, input().split())
        blocks[c].append(d)
        blocks[d].append(c)
    for i in range(1, n+1):
        nf = friends[i]
        nb = 0
        for b in blocks[i]:
            if uf.same(i, b):
                nb += 1
        ans.append(uf.size(i) - 1 - nf - nb)
    print(" ".join(list(map(str, ans))))


if __name__ == "__main__":
    main()

Measured memory_bytes: 33280
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
int main()
{
	int n, m; cin>>n>>m;
	int s[2010], t[2010];
	for(int i=0; i<n; i++) cin>>s[i];
	for(int i=0; i<m; i++) cin>>t[i];
	ll dp[2][2][2010][2010]={};
	for(int i=0; i<=n; i++) dp[0][0][i][0]=1;
	for(int i=0; i<=m; i++) dp[0][0][0][i]=1;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			dp[1][0][i][j]=(dp[1][0][i][j-1]+dp[1][1][i][j-1])%MOD;
			dp[0][1][i][j]=(dp[0][1][i-1][j]+dp[1][1][i-1][j])%MOD;
			dp[0][0][i][j]=(dp[0][0][i-1][j-1]+dp[1][0][i-1][j-1]+dp[0][1][i-1][j-1]+dp[1][1][i-1][j-1])%MOD;
			if(s[i-1]==t[j-1]) dp[1][1][i][j]=dp[0][0][i][j];
		}
	}
	cout<<(dp[0][0][n][m]+dp[1][0][n][m]+dp[0][1][n][m]+dp[1][1][n][m])%MOD<<endl;
	return 0;
}

Measured memory_bytes: 126592
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a);i<=(b);i++)
#define ROF(i,a,b) for(int i = (a);i>=(b);i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 1000005
#define M 1000005
#define INF 10000000000007
#define MOD 1000000007
#define MOD2 1000000009
#define eps 1e-7
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
    while(cin>>a>>b)
    {

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


Measured memory_bytes: 256
s=input().replace("BC","D")+"E"

A=[]
word=""
for i in s:
    if i=="A" or i=="D":word +=i
    else:A.append(word);word=""

cnt=0
for i in A:
    a=0
    for j in i:
        if j=="A":a +=1
        else:cnt +=a

print(cnt)

Measured memory_bytes: 5412
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int mn[2005];

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

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int n,x;
    cin>>n>>x;
    int a[2*n+1];
    int tot=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        a[n+i]=a[i];
        mn[i]=a[i];
        tot+=a[i];
    }

    for(int i=1;i<=n;i++)
    {
        int sum=0;
        for(int j=1+n;j<=2*n;j++)
        {
            mn[j-n]=min(mn[j-n],a[j-i]);
            sum+=mn[j-n];
        }
        tot=min(tot,sum+i*x);
    }
    cout<<tot;

} 


Measured memory_bytes: 256
import sys
# input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
def getlist2():
    return [int(x) * 100000 for x in input().split()]
import math
import bisect
import heapq
from decimal import Decimal
# from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15
def main():
    a,b,c = getlist()
    print(c,a,b)

if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

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

#define swap(type,a,b) {type t; t=a; a=b; b=t;}
#define forN(i,n) for(int i=0;i<n;i++)
#define forS(i,start,n) for(int i=start;i<n;i++)
#define ll long long
#define pb(t,d,n) {t p;int i;forN(i,n){cin>>p;d.push_back(p);}}
#define DOUBLE fixed << setprecision(15)

using namespace std;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;

bool cmp(int a,int b){
    return false;
}
int main(){
    int m,n,cnt=0;
    string s;

    cin >>n>>m;
    vi x(m);
    vi l(m-1);
    forN(i,m)cin>>x[i];
    sort(x.begin(),x.end());
    forN(i,m-1)l[i]=x[i+1]-x[i];
    sort(l.begin(),l.end());
    forN(i,m-n) cnt+=l[i];
    cout<<cnt<<endl;
}

Measured memory_bytes: 4028
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a,b;
  cin>>a>>b;
  if(a>b){
    cout<<'>'<<endl;
  }else if(a<b){
    cout<<'<'<<endl;
  }else{
    cout<<'='<<endl;
  }
  return 0;
}

Measured memory_bytes: 3572
N = input()
A = map(int, raw_input().split())
ans = 0
for i in xrange(N):
    minj = i
    for j in xrange(i, N):
        if A[j] < A[minj]:
            minj = j
    if i != minj:
        ans += 1
        A[i], A[minj] = A[minj], A[i]
print ' '.join(map(str, A))
print ans

Measured memory_bytes: 6452
#include <bits/stdc++.h>
#define debug(x) cout << #x << " -> " << x << endl
#define booga cout << "booga" << endl
#define ll long long int
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;


void testcase(){
	int x,y;
	cin >> x >> y;
	if(y&1){
		cout << "No \n";
		return;
	}
	if(y > 4*x){
		cout << "No \n";
		return;
	}
	if(y < 2*x){
		cout << "No \n";
		return;
	}
	cout << "Yes \n";
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t;
	t = 1;
	while(t--){
		testcase();
	}
	return 0;
}


Measured memory_bytes: 3632
n, X = map(int, input().split())
x = list(map(int, input().split()))

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

num = abs(X - x[0])
for i in range(1, n):
    num = gcd(num, abs(X - x[i]))
print(num)

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

vector<int> A;
int n, m, q; 
int a[50], b[50], c[50], d[50];

ll score(vector<int> A){
    ll ans = 0;
    rep(i,q) if(A[b[i]] - A[a[i]] == c[i]) ans += d[i];
    return ans;
}

ll dfs(vector<int> &A){
    if(A.size() == n){
        return score(A);
    }
    int prev_last = (A.empty()? 0 : A.back());
    ll ans = 0;
    for(int add = prev_last; add < m; ++add){
        A.push_back(add);
        ans = max(ans, dfs(A));
        A.pop_back();
    }
    return ans;
}

int main(){
    cin >> n >> m >> q;
    rep(i,q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        --a[i], --b[i];
    }
    cout << dfs(A) << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int  
#define pb push_back 
#define mp make_pair 
vector <pair <ll , ll> >adj[100005] ;
queue < ll > q ;
ll dis[100005] ;
void bfs(ll i){
	q.push(i) ;
	while(!q.empty()){
		int p = q.front() ;
		q.pop() ;
		for(auto it : adj[p]){
			if(dis[it.first] == (ll)1e18){
				dis[it.first] = dis[p] + it.second ;
				q.push(it.first) ;
			}
		}
	}
}
int main(){
	ios_base::sync_with_stdio(false) ;
	cin.tie(NULL) ;
	int n ;
	cin >> n ;
	for(int i = 1 ; i < n; i++){
		ll u ,v , w ;
		cin >> u >> v >> w ;
		adj[u].push_back(make_pair(v, w)) ;
		adj[v].push_back(make_pair(u, w)) ;
	}
	for(int i = 1 ; i<= n ; i++){
		dis[i] = (ll)1e18 ;
	}
	dis[1] = 0 ;
	bfs(1) ;
	for(int i = 1 ; i <= n ; i++)
		cout << dis[i] %2 << '\n';
}

Measured memory_bytes: 8704
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
//get_be biger & equal
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
//ll a[Max];
ll n;
void solve(){
	string s;
	cin>>s;
	n = sz(s);
	int i=0,pre = 0;
	VI ans(n,0);
	while(i<n){
		while(i<n&&s[i]=='R')i++;
		//now s[i] = 'L' s[i-1] = 'R'
		int l = i-1,r = i;
		while(i<n&&s[i]=='L')i++; 
		// and from s[pre] to s[l] are all 'R'
		//now from s[r] to s[i-1] are all 'L' 
		int len = l-pre;
		if(len&1){
			len--;
			len/=2;
			ans[l]+=len;ans[r]+=len;
			ans[r]+=1;//右边多一个 
		}else{
			len/=2;
			ans[l]+=len;ans[r]+=len;
		}
		len = i-1-r;
		if(len&1){
			len--;
			len/=2;
			ans[l]+=len;ans[r]+=len;
			ans[l]+=1;//左边多一个 
		}else{
			len/=2;
			ans[l]+=len;ans[r]+=len;
		} 
		ans[l] += 1;
		ans[r] += 1;
		pre = i;
	}
	rep(i,0,n)cout<<ans[i]<<" "; 
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}





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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

const int n = 10;
vvi c(n, vi(n));

void WarshallFloyd(){
	rep(k,n){
		rep(i,n){
			rep(j,n){
				c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
			}
		}
	}
	return;
}

void Main(){
	int h, w;
	cin >> h >> w;
	
	rep(i,n){
		rep(j,n){
			cin >> c[i][j];
		}
	}
	
	WarshallFloyd();
  
	/*
	rep(i,n){
		rep(j,n){
			cout << c[i][j] << " ";
		}
		cout << endl;
	}
	*/
  
	int a;
	ll ans = 0;
	rep(i,h){
		rep(j,w){
			cin >> a;
			if(a!=-1) ans += c[a][1];
		}
	}
	cout << ans << endl;
	return;
}

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
from functools import reduce
import fractions
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # greatest common divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # least common multiple
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


n = II()
a = LI()
counter = 0
for i in a:
    while(i % 2 == 0):
        i //= 2
        counter += 1
P(counter)


Measured memory_bytes: 6456
#include<iostream>
#include<string>
using namespace std;
int h,w,sum;
int main()
{
	cin>>h>>w;
	for(int i=0;i<h;i++)
	{
		string s;
		cin>>s;
		for(int i=0;i<w;i++)
		{
			sum += (s[i]=='#');
		}
	}
    if(sum==h+w-1) cout<<"Possible\n";
    else cout<<"Impossible\n";
	return 0;
}

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

int main(){
	char p[5][6] =
	{{'a','f','k','p','u','z'},
	 {'b','g','l','q','v','.'},
	 {'c','h','m','r','w','?'},
	 {'d','i','n','s','x','!'},
	 {'e','j','o','t','y',' '}};
	string s;	
	while(cin >> s){
		bool flag = false;
		for(size_t i=0;i<s.size();i+=2){
			if(s[i]>'6' || s[i]<'1' || s[i+1]>'5' || s[i+1]<'1')
				flag = true;
		}
		if(flag||s.size()%2){
			cout << "NA" << endl;
		}else{
			for(size_t i=0;i<s.size();i+=2){
				cout << p[s[i+1]-'0'-1][s[i]-'0'-1];
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 0
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


x = inp()
print(8 - (x - 400) // 200)


Measured memory_bytes: 68368
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String T = in.next();
		int sl = S.length();
		int tl = T.length();
		char[] s = new char[sl];
		char[] t = new char[tl];
		for(int i=0;i<sl;i++) {
			s[i] = S.charAt(i);
		}
		for(int i=0;i<tl;i++) {
			t[i] = T.charAt(i);
		}
		
		int idx = -1;
		for(int i=0;i<=sl-tl;i++) {
			boolean match = true;
			for(int j=0;j<tl;j++) {
				if(s[i+j]=='?') continue;
				if(s[i+j]==t[j]) continue;
				match = false;
				break;
			}
			if(match) idx = i;
		}
		
		if(idx<0) System.out.println("UNRESTORABLE");
		else {
			for(int i=idx;i<idx+tl;i++) {
				s[i] = t[i-idx];
			}
			for(int i=0;i<sl;i++) {
				if(s[i]=='?') System.out.print('a');
				else System.out.print(s[i]);
			}
		}
		in.close();

	}

}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    string s, t;
    cin >> s >> t;
    
    map<char, pair<int, vector<int>>> p, q;
    
    repeat (i, s.length()) {
        if (p.count(s[i]) == 0) {
            int order = p.size() + 1;
            vector<int> v;
            v.push_back(i);
            p[s[i]] = make_pair(order, v);
        }
        else {
            p[s[i]].snd.push_back(i);
        }
    }
    
    vector<pair<int, vector<int>>> v;
    for (auto &e: p) {
        v.push_back(e.snd);
    }
    sort(v.begin(), v.end());
    
    ///////////////////////////////////////////
    repeat (i, t.length()) {
        if (q.count(t[i]) == 0) {
            int order = q.size() + 1;
            vector<int> v;
            v.push_back(i);
            q[t[i]] = make_pair(order, v);
        }
        else {
            q[t[i]].snd.push_back(i);
        }
    }
    
    vector<pair<int, vector<int>>> w;
    for (auto &e: q) {
        w.push_back(e.snd);
    }
    sort(w.begin(), w.end());
    
    /*
    repeat (i, v.size()) {
        auto e = v[i];
        cout << e.fst << "番目文字 位置 ";
        repeat (j, e.snd.size()) {
            cout << e.snd[j] << " ";
        }
        el;
    }
    repeat (i, w.size()) {
        auto e = w[i];
        cout << e.fst << "番目文字 位置 ";
        repeat (j, e.snd.size()) {
            cout << e.snd[j] << " ";
        }
        el;
    }
    */
    bool ans = true;
    if (v.size() != w.size()) {
        ans = false;
    }
    else {
        repeat (i, v.size()) {
            if (v[i] != w[i]) {
                ans = false;
                break;
            }
        }
    }
    if (ans) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 4360
candidates = []
m = 1
while true
    candidates << 7 * m + 1
    candidates << 7 * m + 6
    m += 1
    break if candidates.last > 300000
end
primes = [6]
candidates.each{|x|
    prime = true
    primes.each{|y|
        break if y > Math.sqrt(x)
        if x % y == 0
            prime = false
            break
        end
    }
    primes << x if prime
}
while true
    n = gets.to_i
    break if n == 1
    print "#{n}:"
    primes.each{|y| print " #{y}" if n % y == 0}
    puts
end



Measured memory_bytes: 7956
z=list(map(int,input().split()))
n,k,a,b,c=z[0],z[1],[],0,0
for i in range(n):
    a.append(list(map(int,input().split())))
a.sort()
while True:
    b+=a[c][1]
    if b>=k:
        print(a[c][0])
        break
    c+=1

Measured memory_bytes: 27872
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class278
    {
        static void Main()
        {
            int K = int.Parse(Console.ReadLine());

            long ans = 0;
            for(int a = 1; a <= K; a++)
            {
                for(int b = 1; b <= K; b++)
                {
                    for(int c = 1; c <= K; c++)
                    {
                        ans += GCD(GCD(a, b), c);
                    }
                }
            }
            Console.WriteLine(ans);
        }
        static int GCD(int a,int b)
        {
            return a == 0 ? b : GCD(b % a, a);
        }
    }
}


Measured memory_bytes: 27476
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <ctype.h>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(n * a, b) << endl;
    return 0;
}

Measured memory_bytes: 256
// Created by arvybhatt

#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define p_b push_back
#define m_p make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)

using namespace std;
using ll = long long;

ll power(ll x, ll y) { ll temp; if( y == 0) return 1; temp = power(x, y/2); if (y%2 == 0) return temp*temp; else return x*temp*temp; } 

int main()
{
    fast;
    int a,b,c,d;cin>>a>>b>>c>>d;
    int f=0;
    while(1)
    {
    	if(f==0)
    	{
    		c-=b;
    		if(c<=0)
    		{
    			cout<<"Yes";
    			break;
    		}
    		f=1;
    	}	
    	else
    	{
    		a-=d;
    		if(a<=0)
    		{
    			cout<<"No";
    			break;	
    		}
    		f=0;
    	}
    }

    
}





Measured memory_bytes: 3672
#include"bits/stdc++.h"

using namespace std;

int main() {
	int N, X;
	cin >> N >> X;
	vector<int>A(N);
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	int ans = 1;
	int sum = 0;
	for (int i = 0; i < N; i++)
	{
		sum += A[i];
		if (sum <= X) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

constexpr size_t n = 55;

template<size_t maxN>
class PascalTri{
public:
    uint_fast64_t val[maxN][maxN];

    constexpr PascalTri() : val(){
        for(size_t i = 0; i < maxN; ++i)
            for(size_t j = 0; j < maxN; ++j)
                val[i][j] = 0;
        val[0][0] = 1;
        for(size_t i = 1; i < maxN; ++i)
            for(size_t j = 0; j < maxN; ++j)
                val[i][j] = val[i - 1][j] + (j ? val[i - 1][j - 1] : 0);
    }
};

constexpr PascalTri<n> C = PascalTri<n>();

constexpr long long binom(int a, int b){
    if(a < 0 || b < 0 || a < b)return 0;
    return C.val[a][b];
}

long long int N, A, B, a, b;
vector<long long> v;

int main(){
    scanf("%lld%lld%lld", &N, &A, &B);
    for(int i = 0; i < N; ++i){
        scanf("%lld", &a);
        v.push_back(a);
    }
    sort(v.rbegin(), v.rend());
    a = 0;
    for(int i = 0; i < A; ++i)a += v[i];
    printf("%.20Lf\n", static_cast<long double>(a) / A);
    if(v[0] != v[A - 1]){
        a = v.rend() - A - lower_bound(v.rbegin(), v.rend(), v[A - 1]);
        b = upper_bound(v.rbegin(), v.rend(), v[A - 1]) - lower_bound(v.rbegin(), v.rend(), v[A - 1]);
        cout << binom(b, a) << endl;
    }else{
        a = v.rend() - lower_bound(v.rbegin(), v.rend(), v[A - 1]);
        b = 0;
        for(; A <= B; ++A)b += binom(a, A);
        cout << b << endl;
    }
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	string sd, t;
	cin >> sd >> t;

	int n = sd.size();
	int m = t.size();
	if(n < m){
		cout << "UNRESTORABLE" << endl;
		return 0;
	}

	vector<string> v;
	for(int i = 0; i+m-1 < n; i++){
		char c[n];
		bool ok = true;
		for(int j = 0; j < n; j++){
			if(j < i || i+m-1 < j){
				c[j] = (sd[j] == '?' ? 'a' : sd[j]);
			}else{
				if(sd[j] == '?' || sd[j] == t[j-i]){
					c[j] = t[j-i];
				}else{
					ok = false;
					break;
				}
			}
		}
		if(ok) {
			string a(c, n);
			v.push_back(a);
		}
	}

	if(v.size() == 0){
		cout << "UNRESTORABLE" << endl;
	}else{
		sort(v.begin(), v.end());
		cout << v[0] << endl;
	}
}


Measured memory_bytes: 256
import math
n,d = (int(i) for i in input().split())
x = []
ans = 0
for i in range(n):
  x.append([int(i) for i in input().split()])
for i in range(n-1):
  for j in range(i+1,n):
    s = 0
    for k in range(d):
      s += (x[i][k]-x[j][k])**2
    a = math.sqrt(s)
    if a.is_integer():
      ans += 1
print(ans)

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

#include <iostream>
#include <stdio.h>
#include <array>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <algorithm>
#include <map>
#include <cmath>

using namespace std;

typedef double db;
typedef long long ll;
typedef pair<int, int> PII;

int a, b;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(i=(a);i<=(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REPP(i,n) FORR(i,0,n)
#define MAX(a,b) a>b? a:b
#define MIN(a,b) a>b? b:a


const int MOD = 1e9 + 7;
const ll INF=1e10;
const db PI = acos(-1.0);
const db EPS = 1e-10;


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


ll MAXX(vector<ll> a,ll k) {
	ll max = 0;
	REP(i, k) {
		if (a[i] >= max) max = a[i];
	}
	return max;
}

ll MINN(vector<ll> a,ll k) {
	ll min = 1e10;
	REP(i, k) {
		if (a[i] <= min)min = a[i];
	}
	return min;
}

ll SUM(vector<ll> a, ll k) {
	ll sum = 0;
	REP(i, k) {
		sum += a[i];
	}
	return sum;
}

db AVE(vector<ll> a, ll k) {
	db ave = SUM(a,k)/(db)k;
	return ave;
}


int main() {
	string s;
	cin >> s;
	if (s[0] == s[1] && s[1] == s[2] && s[2] == s[3]) cout << "No";
	else if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2])cout << "Yes";
	else if (s[0] == s[2] && s[1] == s[3] && s[0] != s[1])cout << "Yes";
	else if (s[0] == s[3] && s[1] == s[2] && s[0] != s[1])cout << "Yes";
	else cout << "No";



	return 0;
}

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

int main(int argc, char *argv[])
{
    int k, x;

    std::cin >> k >> x;

    if (500 * k >= x) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }


    return 0;
}


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

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

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    if (B < C|| D < A) {
        cout << 0 << endl;
        return 0;
    }
    cout << (min(B, D) - max(A, C)) << endl;
}

Measured memory_bytes: 256
N=int(input())
d=input().split()
di=[]
for i in range(N):
    di.append(int(d[i]))

result=0
for i in range(N):
    for j in range(N):
        if i!=j:
            tmp=di[i]*di[j]
            result+=tmp
print(int(result/2))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <numeric>
#include <math.h>
#include <climits>
#include <stack>
#include <iomanip>
#include <sstream>

using namespace std;

template <typename T>
inline bool sign(T A) {
    return (A>0)-(A<0);
}

#define REP(i,s,n) for(int i=s; (n-i)*sign(n-s)>0; i+=sign(n-s))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

bool _less(pair<int, int> a, pair<int, int> b) {
    return a.second < b.second;
}

template <template<class,class,class...> class C, typename K, typename V, typename... Args>
V map_get(const C<K,V,Args...>& m, K const& key, const V & defval)
{
    typename C<K,V,Args...>::const_iterator it = m.find( key );
    if (it == m.end())
        return defval;
    return it->second;
}

#define MOD (1'000'000'000+7)

int main() {
    int N;
    cin >> N;
    int cnt = 0;
    REP(i, 1, N+1) {
        if (int(log10(i))%2 == 0) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 888
/*
ID: wangjun30
TASK:
LANG: C++
*/
#include<iostream>
using namespace std;
int main(){
	char ch;
	cin>>ch;
	if(ch=='A')
		cout<<"T";
	else
		if(ch=='T')
			cout<<"A";
		else
			if(ch=='G')
				cout<<"C";
			else
				cout<<"G";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int n,x,y,d,t,ti,xo,yo,to;
	cin>>n;
	bool res=true;
	xo=yo=to=0;
	for(int i=0;i<n;i++){
		cin>>ti>>x>>y;
		d=abs(x-xo)+abs(y-yo);
		xo=x;yo=y;
		t=ti-to;
		to=ti;
		if(t<d or (t-d)%2>0) res=false;

	}
	if(res) cout<<"Yes";
	else cout<<"No";
	cout<<endl;
    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <cmath>
#include <string>
#include <map>
#include <queue>
using namespace std;
#define N 3
#define N2 9

struct Puzzle {
  int f[N2];
  int space;
  string path;

  bool operator < (const Puzzle &p) const {
    for(int i=0; i<N2; i++){
      if(f[i] == p.f[i]) continue;
      return f[i] > p.f[i];
    }
    return false;
  }
};

static const int dx[4] = {-1, 0, 1, 0};
static const int dy[4] = {0, -1, 0, 1};
static const char dir[4] = {'u', 'l', 'd','r'};

bool isTarget(Puzzle p) {
  for(int i=0; i<N2; i++)
    if(p.f[i] != (i+1)) return false;
  return true;
}

string bfs(Puzzle s){
  queue<Puzzle> Q;
  map<Puzzle, bool> V;
  Puzzle u, v;
  s.path = "";
  Q.push(s);
  V[s] = true;

  while(!Q.empty()){
    u = Q.front(); Q.pop();
    if(isTarget(u)) return u.path;
    int sx = u.space / N;
    int sy = u.space % N;
    for(int r=0; r<4; r++){
      int tx = sx+dx[r];
      int ty = sy+dy[r];
      if(tx<0 || ty<0 || tx>=N || ty>=N) continue;
      v=u;
      swap(v.f[u.space], v.f[tx*N+ty]);
      v.space = tx*N+ty;
      if(!V[v]){
        V[v] = true;
        v.path += dir[r];
        Q.push(v);
      }
    }
  }
  return "usdolvable";
}

int main(){
  Puzzle in;

  for(int i=0; i<N2; i++){
    cin >> in.f[i];
    if(in.f[i] == 0){
      in.f[i] = N2;
      in .space = i;
    }
  }

  string ans = bfs(in);
  cout << ans.size() << endl;

  return 0;
}

Measured memory_bytes: 30616
#include<bits/stdc++.h>
    using namespace std;
    int main(void)
    {
       long long int n,a[100001],m=1;
       cin>>n;
       for(long long int i=0;i<n;i++)
       {
          cin>>a[i];
       }
       sort(a,a+n);
       if(a[0]==0)
       {
          cout<<0<<endl;;
          return 0;
       }
       for(long long int i=0;i<n;i++)
       {
          if(a[i]<=(1000000000000000000/m))
          {
             m=m*a[i];
          }
          else
          {
             cout<<-1<<endl;
             return 0;
          }
       }
       cout<<m<<endl;
       return 0;
    }


Measured memory_bytes: 4376
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.end()

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

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

int main(){
    int n; cin >> n;
    ll ans = 0;
    vector<ll> data(n); rep(i,n) cin >> data[i];
    rep(i,n) rep(j,n) rep(k,n){
        if(i == j || j == k || k == i) continue;
        if(data[i] == data[j] || data[j] == data[k] || data[k] == data[i]) continue;
        if(data[i] + data[j] > data[k] && data[j] + data[k] > data[i] && data[k] + data[i] > data[j]) ans++;
    }
    cout << ans/6 << endl;
}

Measured memory_bytes: 3624
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 
const int MAXN = 1e5 + 10 ; 
int main(){
    fastio
    int n , m ;
    vector<int> v[MAXN] ; 
    cin >> n >> m ; 
    for(int i=0;i<n;i++){
    	int a , b ; 
    	cin >> a >> b ; 
    	v[a].push_back(b) ; 
    }
    priority_queue<int> pq ;
    int cur = m ; 
    int ans = 0 ; 
    for(int i=1;i<=m;i++){
    	for(int &c : v[i]){
    		pq.push(c) ; 
    	}
    	if ( cur <= 0 ) break ; 
    	if ( not pq.empty() ){
    		cur-- ; 
    		ans += pq.top() ; 
    		pq.pop() ;
    	}
    }
    cout << ans << endl;

    return 0 ;
}


Measured memory_bytes: 5632
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, W;
	cin >> N >> W;

	vector<vector<Int>> val(4);

	Int w0;
	cin >> w0;

	Int w, v;
	cin >> v;
	val[0].push_back(v);

	//重さごとに価値を分ける
	for (Int i = 0; i < N-1; i++) {
		cin >> w >> v;
		val[w - w0].push_back(v);
	}

	for (Int i = 0; i < 4; i++) {
		sort(val[i].begin(), val[i].end(), greater<Int>());
	}

	Int len0 = val[0].size();
	Int len1 = val[1].size();
	Int len2 = val[2].size();
	Int len3 = val[3].size();

	//それぞれの重さの価値の累積和
	vector<Int> s0(len0 + 1);
	vector<Int> s1(len1 + 1);
	vector<Int> s2(len2 + 1);
	vector<Int> s3(len3 + 1);

	for (Int i = 0; i < len0; i++) {
		s0[i + 1] = s0[i] + val[0][i];
	}

	for (Int i = 0; i < len1; i++) {
		s1[i + 1] = s1[i] + val[1][i];
	}
	for (Int i = 0; i < len2; i++) {
		s2[i + 1] = s2[i] + val[2][i];
	}
	for (Int i = 0; i < len3; i++) {
		s3[i + 1] = s3[i] + val[3][i];
	}

	Int ans = -INF;
	for (Int i = 0; i < len0+1; i++) {//w0から選ぶ個数
		for (Int j = 0; j < len1+1; j++) {//w1から選ぶ個数
			for (Int k = 0; k < len2+1; k++) {//w2から選ぶ個数
				for (Int m = 0; m < len3+1; m++) {//w3から選ぶ個数
					w = w0 * i + (w0 + 1) * j + (w0 + 2) * k + (w0 + 3) * m;
					if (w<=W) {
						v = s0[i] + s1[j] + s2[k] + s3[m];
						ans = max(ans, v);
					}
				}
			}
		}

	}

	cout << ans << "\n";

}


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

#define  BeatMeScanf  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define  tc(x)        int x; cin >> x; while(x--)
#define  ll           long long
#define  vi           vector<int>
#define  pii          pair<int,int>
#define  mii          map<int,int>
#define  inf          1<<28
#define  mem(x,y)     memset(x, y, sizeof(x))
#define  ps(x,y)      fixed<<setprecision(y)<<x
#define  show(val)    cout<< #val << " -> " << val << endl
#define  Case         cout<< "Case "<< ++cs << ": "
#define  all(v)       (v).begin(), (v).end()
#define  rall(v)      (v).rbegin(), (v).rend()
#define  MOD          1000000007
#define  MAX          100005
#define  PI           3.14159265358979323846264338327950L

int main()
{
    BeatMeScanf;
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    
    if(a>=k) cout << k << '\n';
    else if(a+b>=k)cout << a << '\n'; 
    else cout << a - (k-a-b) << '\n';

    return 0;
}



Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
using namespace std;
#define MATH_PI 3.14159265358979323846
int main(){
	ios::sync_with_stdio(false);
	string sOdd, sEven;
	register int i;
	getline(cin, sOdd);
	getline(cin, sEven);
	for (i = 0; i < sOdd.length(); ++i){
		cout << sOdd[i];
		if (i < sEven.length()){
			cout << sEven[i];
		}
	}
	cout << endl;
endapp:
	//system("pause > nul");
	return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
A = []
for i in range(H):
    x = input()
    if x.count('#') == 0:
        continue
    A.append(x)

c = set()
for a in A:
    for i in range(W):
        if a[i] == '#':
            c.add(i)

for a in A:
    for i in range(W):
        if i in c:
            print(a[i], end='')
    print()


Measured memory_bytes: 9180
#include <iostream>
#include <vector>
#include <string>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=a,i##_len=(b);i<i##_len;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;
typedef long long ll;

int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
    ll h, w;
    cin >> h >> w;
    
    if (h == 1 || w == 1) {
        cout << 1 << endl;
        return 0;
    }

    if ((h * w) % 2 == 0) {
        cout << (h * w / 2) << endl;
    } else {
        cout << (h * w / 2) + 1 << endl;
    }


    return 0;
}


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

using namespace std;
#define int long long
#define float double
//const int INF = 100000000000000000;

signed main(void){
  int n,a,b;
  cin >> n >> a >> b;
  int ret;
  ret = (b - a) * (n - 1) - (b - a) + 1;
  if(ret > 0) cout << ret << "\r\n";
  else cout << 0 << "\r\n";
}


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

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
    int n, m, p;
    while(cin >> n >> m >> p, n+m+p){
        vector<int> x(n);
        int sum = 0;
        rep(i, n){cin >> x[i]; sum += x[i];}
        if(x[m-1] == 0) cout << 0 << endl;
        else cout << sum*(100-p)/x[m-1] << endl;
    }
}

Measured memory_bytes: 1192
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());

        for (int i = 0; i < n; i++) {
            int now = Integer.parseInt(br.readLine());
            int[] arr = new int[8];
            for (int j = 0; j < 8; j++) {
                arr[j] = now % 10;
                now /= 10;
            }
            Arrays.sort(arr);

            int down = 10000000;
            int up = 1;

            int bigger = 0;
            int smaller = 0;

            for (int j = 0; j < 8; j++) {
                bigger += up * arr[j];
                smaller += down * arr[j];

                down /= 10;
                up *= 10;
            }

            System.out.println((bigger - smaller));
        }
    }
}


Measured memory_bytes: 24196
n = int(input())
a = [int(input()) for _ in range(n)]
trace = [False for _ in range(n)]
pos = 0
push_count = 0

while True:
    # push
    push_count +=1

    if a[pos]==2:
        print(push_count)
        break
    if not trace[pos]:
        trace[pos] = True
        pos = a[pos] -1  
    else:
        print(-1)
        break

Measured memory_bytes: 7860
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int A[100001] = {0};

int main() {
    
    int m = 0;
    int N;
    cin >> N;
    
    for ( int i = 0; i < N; i++ ) {
        int a;
        cin >> a;
        a++;
        
        A[a]++;
        A[a+1]++;
        A[a-1]++;
    }
    
    for ( int i = 0; i <= 100001; i++ ) {
        m = max( m , A[i] );        
    }
    
    cout << m << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
int main (void)
{
    char s[10];
    while(scanf("%s",s)!=EOF)
    {
        int count = 0;
        for(int i=0;i<=2;i++)
            if(s[i]=='1')
                count++;
        printf("%d\n",count);
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
#define ppp pair<ll,pp >
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t=1, tt;
void solve(){
	ld a, b;
	cin>>a>>b;
	ld ans=a*b;
	ll res=ans;
	cout<<res;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   	//cin>>t;
   	tt=t;
    while(t--){
        solve();
        if(t)cout<<"\n";
    }
    return 0 ;
}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++) 
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    int N,M; cin >> N >> M;
    vector<vector<int>> vec(N);
    rep(i,M){
        int k;
        cin >> k;
        rep(j,k){
            int x;
            cin >> x;
            vec[x-1].push_back(i);
        }
    }
    int p[M];
    rep(i,M){
        cin >> p[i];
    }
    int cnt=0;
    rep(bit,1<<N){
        int b[M]={};
        bool ans=true;
        rep(i,N){
            if(bit & (1<<i)){
                for(auto x:vec[i]){
                    b[x]++;
                }
            }
        }
        rep(i,M){
            if(b[i]%2!=p[i])ans=false;
        }
        if(ans)cnt++;
    }
    cout << cnt << endl;


}

/*



 */



Measured memory_bytes: 256