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

int n, a, b;
long long g = 1;
int p[200001], s[200001];
const long long M = 1000000007;
vector<int> e[200001];
long long f[200001];

long long pw(long long a, long long b) {
	long long c = 1, d = a;

	while (b) {
		if (b & 1)
			c = c * d % M;

		d = d * d % M;
		b >>= 1;
	}

	return c;
}

void pd(int id) {
	s[id] = 1;
	f[id] = 1;

	for (int i : e[id]) {
		if (!s[i]) {
			pd(i);
			s[id] += s[i];
			p[i] = id;
			f[id] = f[id] * f[i] % M;
		}
	}
	f[id] = f[id] * s[id] % M;
}

void dfs(int id) {
	for (int i : e[id]) {
		if (i != p[id]) {
			f[i] = f[id] * (n - s[i]) % M * pw(s[i], M - 2) % M;
			dfs(i);
		}
	}
}

int main()
{
	cin >> n;

	for (int i = 1; i < n; i++) {
		cin >> a >> b;
		e[a].push_back(b);
		e[b].push_back(a);
	}

	for (int i = 1; i <= n; i++)
		g = g * i % M;

	pd(1);
	dfs(1);

	for (int i = 1; i <= n; i++)
		cout << g * pw(f[i], M - 2) % M << endl;
}


Measured memory_bytes: 17012
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
// #define int ll
using namespace std;
const int INF (1 << 30);
const ll LLINF (1LL << 55LL);
const int MOD = 1000000007;
const int MAX = 510000;
const double pi=3.14159265358979;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,k,dp[1010][1010];
    cin>>n>>k;
    dp[0][0]=1;
    rep2(i,1,k+1){
        rep(j,n+1){
            if(j-i>=0){
                dp[i][j]=(dp[i-1][j]+dp[i][j-i])%MOD;
            }
            else{
                dp[i][j]=dp[i-1][j]%MOD;
            }
        }
    }
    cout<<dp[k][n]<<endl;
    return 0;
}


Measured memory_bytes: 11020
N = int(input())
A = list(map(int, input().split()))


B = []
checked = [0 for _ in range(N)]
for i in range(N, 0, -1):
    num = N // i
    a = A[i-1]
    for j in range(1, num+1):
        a += checked[j*i-1]
    if a % 2 == 1:
        B.append(i)
        checked[i-1] = 1
print(len(B))
print(' '.join([str(b) for b in B]))

Measured memory_bytes: 19876
#include <bits/stdc++.h>
#define ll long long
#define N 100010
using namespace std;
ll n, k, q, point[N];
int main()
{
    cin>>n>>k>>q;
    for(ll i=1; i<=n; i++) point[i]=k;
    for(ll i=1; i<=q; i++)
    {
        ll x;cin>>x;
        point[x]++;
    }
    for(ll i=1;i<=n;i++)
    {
        if (point[i] - q > 0) puts("Yes");
        else puts("No");
    }
    return 0;
}



Measured memory_bytes: 1408
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

int main(){
  string element;
  queue<string> que;
  while(cin >> element){
    que.push(element);
  }

  int total = atoi(que.front().c_str());
  que.pop();
  while(!que.empty()){
    if(que.front() == "+"){
      que.pop();
      total += atoi(que.front().c_str());
      que.pop();
    }
    else if(que.front() == "-"){
      que.pop();
      total -= atoi(que.front().c_str());
      que.pop();
    }
    else if(que.front() == "*"){
      que.pop();
      total *= atoi(que.front().c_str());
      que.pop();
    }
    else if(que.front() == "/"){
      que.pop();
      total /= atoi(que.front().c_str());
      que.pop();
    }
    else{
      que.pop();
    }
  }
  printf("%d\n",total);
}

Measured memory_bytes: 1216
main = do
  s <- getLine
  let ans = compute s
  print ans

{-
結局、左にBがある数だけ、Wを移動させることができる。
なので、前からなめて行って、Wが現れるたびに、それ以前に見たBの数を結果に加える。
でよいはず。
-}

compute :: String -> Int
compute s = loop 0 0 s
  where
    loop a _ "" = a
    loop a c ('B':s) = loop a (succ c) s
    loop a c ('W':s) = loop (a+c) c s


Measured memory_bytes: 14716
#include <bits/stdc++.h>
#define MAX(x,y,z) max(x, max(y,z))
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int dp[3] = {0,0,0};
    int curDp[3] = {0,0,0};
    int n;
    cin >> n;
    while (n--) {
        int a[3];
        for (int i=0; i < 3; i++) cin >> a[i];
        for (int i=0; i < 3; i++) {
            for (int j=0; j < 3; j++)
                if (i != j) curDp[j] = max(curDp[j], dp[i]+a[j]); 
        }
        for (int i=0; i < 3; i++) dp[i] = curDp[i];
    }
    cout << MAX(dp[0],dp[1],dp[2]) << "\n"; 
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    double a[2],b[2],c[2],d[2];
    cin >>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>d[0]>>d[1];
    if((b[0]-a[0])*(d[1]-c[1])-(b[1]-a[1])*(d[0]-c[0]) == 0) cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
  }
  return 0;
}

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


int main() {

  int N;
  cin >> N;

  set<int> st;
  for (int i = 0; i < N; i++) {
    int a_;
    cin >> a_;
    st.insert(a_);
  }

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

  return 0;

}

Measured memory_bytes: 9600
package main

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

func main() {
	sc := NewScanner(os.Stdin)
	p := sc.NextInt()
	q := sc.NextInt()
	r := sc.NextInt()
	fmt.Println(min(min(p+q, q+r), p+r))
}

func vmin(v []int) int {
	mn := math.MaxInt32
	for i := 0; i < len(v); i++ {
		mn = min(mn, v[i])
	}
	return mn
}

func gcd(x, y int) int {
	if y > 0 {
		return gcd(y, x%y)
	}
	return x
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}

func max64(x, y float64) float64 {
	if x > y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func min64(x, y float64) float64 {
	if x < y {
		return x
	}
	return y
}

// scanner
type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner(r io.Reader) *Scanner {
	rdr := bufio.NewReaderSize(r, 1024)
	return &Scanner{r: rdr}
}

func (s *Scanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		line, isp, err := s.r.ReadLine()
		if err != nil {
			os.Exit(1)
		}
		s.buf = append(s.buf, line...)
		if !isp {
			break
		}
	}
}

func (s *Scanner) NextInt64() int64 {
	i, err := strconv.ParseInt(s.Next(), 10, 64)
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) NextInt() int {
	i, err := strconv.Atoi(s.Next())
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) NextFloat64() float64 {
	i, err := strconv.ParseFloat(s.Next(), 64)
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	next := string(s.buf[start:s.p])
	s.p++
	return next
}

func (s *Scanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}


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

#define ll long long
#define sz(x) (int)x.size();
#define go ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

const int N=2e5+5;
ll a[N];

int main(){
	go;
	int n;
	cin>>n;
	ll x;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(!i)x=a[i];
		else x^=a[i];
	}
	for(int i=0;i<n;i++){
		cout<<(x^a[i])<<' ';
	}
	
}

Measured memory_bytes: 5112
import java.util.Scanner;

/**
 * 1%.
 */
public class Main {
    public static void main(String[] args) {
        var scanner = new Scanner(System.in);
        var x = Long.parseLong(scanner.next());

        var deposit = 100L;
        var year = 0;
        while (deposit < x) {
            deposit += deposit * 0.01;
            year++;
        }
        System.out.println(year);
    }
}


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

#ifdef RUBICK
#include "dbg.h"
#endif

using namespace std;
using namespace __gnu_pbds;

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

typedef long long ll;

constexpr ll solve(ll x) {
    return (ll(sqrt(1 + 8*x)) - 1)/2;
}

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

    ll ans = 0;
    for (ll p = 2; p*p <= n; p ++) {
        if (n % p == 0) {
            ll k = 0;
            while (n % p == 0) {
                k ++;
                n /= p;
            }

            ans += solve(k);
        }
    }

    if (n > 1) {
        ans += 1;
    }

    cout << ans << endl;

    return 0;
}



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

int A[6];
int main(void){
    // Your code here!
    bool flag = false;
    for(int i = 0; i < 6 ; i++){
        cin >> A[i];
    }
    
    for(int i = 0; i <= 3; i++){
        for(int j = i+1; j <= 4; j++){
            if(A[j] - A[i] > A[5]){
                flag = true;
                break;
            }
        }
        
        if(flag){
            break;
        }
        
    }
    
    if(flag){
        cout << ":("<< endl;
    } else{
        cout << "Yay!" << endl;
    }
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define pint pair<int,int>
#define Lower(v,X) lower_bound(v.begin(),v.end(),X)-v.begin();
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
   lli A,B,C,L,R,N,M,K,X=0,Y=0,W,H=INF,sum=0,num=0,flag=0;string S,T,O;
   cin >> N >> M;
   Vec(P,lli,N,0);
   Vec(DP,lli,10000000,INF);
   DP[0]=0;
   rep(i,0,N)cin >> P[i];
   rep(i,0,N){
      rep(j,1,M+1){
         if(i+j>N-1)continue;
         chmin(DP[i+j],DP[i]+abs(P[i+j]-P[i]));
      }
   }
      Out(DP[N-1]);
   }


Measured memory_bytes: 79104
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/28 14:59:15 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

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

// TOP
void	Main()
{
	ll	n;
	cin >> n;
	ll	ans;
	ans = (n / 11) * 2;
	n %= 11;
	if (n > 0 && n <= 6)
		ans++;
	else if (n > 6)
		ans += 2;
	cout << ans << endl;
}
// END

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


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int cnt=0;
    long long h,ans=1,k=2;
    
    scanf("%lld",&h);
    
    while(h>1){
        h/=2;
        cnt++;
    }
    
    for(int i=1;i<=cnt;i++){
        ans+=k;
        k*=2;
    }
    
    printf("%lld\n",ans);
    
    return 0;
    
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;


public class Main {
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner sc = new Scanner(System.in);
		long N = Long.parseLong(sc.next());
		long n = (long) Math.sqrt(N);
		long ans=0;
		for(long i=1;i<=n;i++){
			if(N%i==0){
				//System.out.println((N/i)-1);
				if((((N/i)-1)!=i) && ((N/i)!=i))ans += ((N/i)-1);
			}
		}
		System.out.println(ans);
		
		
		sc.close();
	}
	
	
	
}


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

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

    long long int total = 0;
    for(int i = 1; i < n; i++){
        if(n % i == 0)
            total += (n / i) - 1;
        else
            total += (n / i);
    }
    cout << total << endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    int n;
    cin >> n;
    deque<int> as(n);
    for (int i = 0; i < n; i++) {
        cin >> as[i];
    }
    sort(as.begin(), as.end());
    deque<int> ans;
    deque<int> bs(as);
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            ans.push_back(as.front());
            as.pop_front();
        } else {
            ans.push_back(as.back());
            as.pop_back();
        }
    }
    ans.push_front(ans.back());
    ans.pop_back();
    i64 sum = 0;
    for (int i = 0; i < ans.size() - 1; i++) {
        sum += abs(ans[i] - ans[i + 1]);
    }

    i64 sum2 = 0;
    ans.clear();
    for (int i = 0; i < n; i++) {
        if (i % 2 == 1) {
            ans.push_back(bs.front());
            bs.pop_front();
        } else {
            ans.push_back(bs.back());
            bs.pop_back();
        }
    }
    ans.push_front(ans.back());
    ans.pop_back();
    for (int i = 0; i < ans.size() - 1; i++) {
        sum2 += abs(ans[i] - ans[i + 1]);
    }
    cout << max(sum, sum2) << endl;
}

Measured memory_bytes: 1152
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	class cir {
		int x;
		int y;
		int r;
		int c;

		cir(Scanner sc) {
			this.x = sc.nextInt();
			this.y = sc.nextInt();
			r = sc.nextInt();
			c = sc.nextInt();
		}

		boolean is(cir tar) {
			return (x - tar.x) * (x - tar.x) + (y - tar.y) * (y - tar.y) < (r+tar.r)
					* (r+tar.r);
		}
	}

	void run() {
		for (;;) {
			int n = sc.nextInt();
			if (n == 0) {
				break;
			}
			cir[] cc = new cir[n];
			int[] ic = new int[n];
			for (int i = 0; i < n; i++) {
				cc[i] = new cir(sc);

				for (int j = i - 1; j >= 0; j--) {
					if(cc[i].is(cc[j])){
						ic[i] |= 1<<j;
					}
				}
			}
			
			boolean[] dp  = new boolean[1 << n];
			dp[0] = true;
			int res = 0;
			for(int i = 0; i < 1<<n; i++){
				if(!dp[i]){
					continue;
				}
				res = Math.max(Integer.bitCount(i),res);
				for(int bi = 0 ; bi < n; bi++){
					if((~i & ic[bi]) != 0){
						continue;
					}
					if((i & (1<<bi)) != 0){
						continue;
					}
					for(int bi2 = bi+1 ; bi2 < n; bi2++){
						if((~(i | ic[bi]) & ic[bi2]) != 0){
							continue;
						}
						if((i & (1<<bi2)) != 0){
							continue;
						}
						
						if(cc[bi].c != cc[bi2].c){
							continue;
						}
						dp[i |(1<< bi) |(1<< bi2)] = true;
					}
				}				
			}
			System.out.println(res);
		}
	}

	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 0
N, M, X, Y = tuple(int(i) for i in input().split())
x = tuple(int(i) for i in input().split())
y = tuple(int(i) for i in input().split())

x_max = max(x)
y_min = min(y)

if x_max >= y_min:
    print("War")
elif y_min <= X or x_max >= Y:
    print("War")
else:
    print("No War")


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

int main(){
	int h,w;
	cin >> h >> w;
	char s[h][w];
	REP(i,h){
		REP(j,w){
			cin >> s[i][j];
		}
	}
	REP(i,h){
		REP(j,w){
			if(s[i][j] == '#'){
				if(!(s[i - 1][j] == '#' || s[i][j - 1] == '#' || s[i][j + 1] == '#' || s[i + 1][j] == '#')){
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
n = 30
dan_lis = [0] * n
dan_lis[0] = 1
dan_lis[1] = 2
dan_lis[2] = 4
for i in range(n - 3):
    dan_lis[i + 3] = dan_lis[i + 2] + dan_lis[i + 1] + dan_lis[i]
while True:
    n = int(input())
    if n == 0:
        break
    ans = dan_lis[n - 1]/10/365
    print(int(ans + 1))

Measured memory_bytes: 7608
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
bool bo[100];
#define ll long long 
int main()
{
	int k,s;
	cin>>k>>s;
	int c=0;
	for(int i=0;i<=k;i++)
	{
		for(int j=0;j<=k;j++)
		{
			if((s-(i+j))<=k && (s-(i+j))>=0)
			{
				c++;
				//cout<<i<<" "<<j<<" "<<s-(i+j)<<endl;
			}
		}
	}
	cout<<c<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long>vll;
typedef pair<int,int> pi;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int n;
  map<string, int> mp;
  cin >> n;

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

  mp[s[0]]=1;
  for(int i = 1; i < n; i++){
    if(s[i][0]==s[i-1][s[i-1].size()-1]&&mp[s[i]]==0){
      mp[s[i]]=1;
    }else{
      cout<<"No"<<endl;
      return 0;
    }
  }

  cout << "Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

long int gcd(int x, int y) {
    if (y == 0) {
        return x;
    } else {
        gcd(y, x % y);
    } 
}

int main(void)
{
    long int a, b, g;
    while (scanf("%ld %ld", &a, &b) != EOF) {
        g = gcd(a, b);
        printf("%ld %ld\n", g, a * b / g);
    }
    return 0;
}

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

int main(){
	int num[10];
	string str;
	while (cin >> str) {
		for (int i = 0; i < 10; i++) {
			num[i] = str[i] - '0';
		}
		for (int i = 9; i > 0; i--) {
			for (int j = 0; j < i; j++) {
				num[j] = num[j] + num[j+1];
				num[j] -= num[j] >= 10 ? 10 : 0;
			}
		}
		cout << num[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main()
{
	int n,a[200000];
	long long int i,x=0,y=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		x+=a[i];
		x=x%(1000000000+7);
	}
	for(i=0;i<n;i++){
		x=x-a[i];
		if(x<0){
			x+=1000000000+7;
		}
		y+=(x*a[i])%(1000000000+7);
		y=y%(1000000000+7);
	}
	printf("%lld\n",y);
	return 0;
}

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

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

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

  int cnt = 0;
  while (cnt *(a-1) < b-1 )
  {
    cnt++;
  }
  cout << cnt << endl;

  return 0;
}

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

using namespace std;

vector<int> Front, Side;
int w,d;

void init(){
  Front.clear();
  Side.clear();
}

void input(){
  Front.resize(w);
  Side.resize(d);
  for(int i = 0; i < w; i++) cin >> Front[i];
  for(int i = 0; i < d; i++) cin >> Side[i];
}

void solve(){
  int ans = 0;
  
  for(int i = 0; i < w; i++){
    ans += Front[i];
    for(int j = 0; j < d; j++){
      if(Front[i] == Side[j]){
	Side[j] = 0;
	break;
      }
    }
  }

  for(int i = 0; i < d; i++) ans += Side[i];
  cout << ans << endl;
}

int main(){

  while(cin >> w >> d && w+d){
    init();
    input();
    solve();
  }
  return 0;
}

Measured memory_bytes: 1196
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K = INT()

tmp = 7
ans = 1
p = 1
mo = tmp % K
checked = [0] *  (10 ** 6 + 1)
checked[mo] = 1

while mo != 0:
    mo = mo + 7 * pow(10, p, K)
    mo %= K
    p += 1
    if checked[mo]:
        # 0には一生辿り着かない
        print(-1)
        break
    checked[mo] = 1
else:
    print(p)


Measured memory_bytes: 80760
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		 Scanner scan = new Scanner(System.in);
	     String str = scan.nextLine();
	     String[] chars = str.split(" ");
	     int N = Integer.valueOf(chars[0]);
	     int K = Integer.valueOf(chars[1]);
	     int Q = Integer.valueOf(chars[2]);
	     int[] scores = new int[N];
	     for(int i=0;i<N;i++) {
	    	 scores[i] = 0;
	     }
	     for(int i=0;i<Q;i++) {
	    	 str = scan.nextLine();
	    	 scores[Integer.valueOf(str)-1]++;
	     }
	     for(int s:scores) {
	    	 if(K-Q+s>0) {
	    		 System.out.println("Yes");
	    	 }
	    	 else {
	    		 System.out.println("No");
	    	 }
	     }
	}

}


Measured memory_bytes: 97220
use itertools::iproduct;
use proconio::input;

#[derive(Debug, Clone, Copy)]
enum Label {
    X,
    Y,
    Integer(usize),
}

fn main() {
    input!(h: usize, w: usize, d: [[usize; w]; h]);
    const MAX: usize = 100;
    let z: Vec<Vec<usize>> = (0..=MAX)
        .map(|i| {
            (0..=MAX)
                .map(|j| {
                    iproduct!(0..h, 0..w)
                        .map(|(x, y)| d[x][y].saturating_sub(i * (x + 1) + j * (y + 1)))
                        .max()
                        .unwrap()
                })
                .collect()
        })
        .collect();

    if iproduct!(0..h, 0..w).any(|(x, y)| {
        iproduct!(0..=MAX, 0..=MAX).all(|(i, j)| i * (x + 1) + j * (y + 1) + z[i][j] != d[x][y])
    }) {
        println!("Impossible");
        std::process::exit(0);
    }
    let vertex_count = 2 * MAX + 2;
    let edges: Vec<_> = (0..MAX)
        .map(|i| (i, i + 1, Label::X))
        .chain((0..MAX).map(|i| (vertex_count - 2 - i, vertex_count - 1 - i, Label::Y)))
        .chain(
            iproduct!(0..=MAX, 0..=MAX)
                .map(|(i, j)| (i, vertex_count - 1 - j, Label::Integer(z[i][j]))),
        )
        .collect();
    let edge_count = edges.len();

    println!("Possible");
    println!("{} {}", vertex_count, edge_count);
    for (u, v, w) in edges {
        println!(
            "{} {} {}",
            u + 1,
            v + 1,
            match w {
                Label::X => 'X'.to_string(),
                Label::Y => 'Y'.to_string(),
                Label::Integer(x) => x.to_string(),
            }
        );
    }
    println!("{} {}", 1, vertex_count);
}


Measured memory_bytes: 2312
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>  // sort, 二分探索, etc
#include <iomanip>  // setprecision (浮動小数点の出力の誤差)
#include <map>
#include <queue>
#include <set>
#include <stack>

#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()
#define cauto const auto&
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

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

template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return true;}return false;}

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll comb(int n, int r) {
    vector<vector<ll> > v(n+1, vector<ll>(r+1, 0));
    for(int i=0;i<n+1;i++) {v[i][0]=1; if(i < r+1)v[i][i]=1; }
    for(int i=1;i<n+1;i++) {for(int j=1;j<min(i,r+1);j++) {v[i][j]=v[i-1][j-1]+v[i-1][j];}}
    return v[n][r];
}

// CHAR_MAX  = 127
// INT_MAX   = 2.1e+09 (2147483647)
// LONG_MAX  = 9.2e+18 (9223372036854775807)
// LLONG_MAX = 9.2e+18 (9223372036854775807)


int main() {
    int x, y, z;
    cin >> x >> y >> z;

    cout << z << ' ' << x << ' ' << y << endl;


    return 0;
}


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

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2")

using namespace std;

#define f first
#define s second
#define mp make_pair
#define all(x) x.begin(), x.end()

#define EPS 1e-9

#define X real()
#define Y imag()

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

using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using point = pair<double, double>;
using Vector = complex<double>;


vector<vi> F, B;
vi t, cc, cc_size;
vector<bool> seen;
int id = 0, c;

void dfs_1(int v) {

	cc[v] = id;
	++cc_size.back();

	for(int u : F[v]) {

		if(cc[u] == -1)
			dfs_1(u);
	}
}

void dfs_2(int v) {

	t[v] = cc_size[cc[v]] - 1;

	seen[v] = true;

	for(int u : B[v]) {

		if(!seen[u])
			dfs_2(u);

		if(cc[u] == cc[v])
			--t[v];
	}

	for(int u : F[v]) {

		if(cc[u] == cc[v])
			--t[v];
	}
}

int main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n, m, k;

	cin >> n >> m >> k;

	F.resize(n);
	B.resize(n);
	cc.assign(n, -1);
	t.resize(n);

	for(int i = 0; i < m; ++i) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		F[u].push_back(v);
		F[v].push_back(u);
	}
	for(int i = 0; i < k; ++i) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		B[u].push_back(v);
		B[v].push_back(u);
	}
	for(int v = 0; v < n; ++v) {
		if(cc[v] == -1) {
			c = 0;
			cc_size.push_back(0);
			dfs_1(v);
			++id;
		}
	}

	seen.assign(n, false);
	for(int v = 0; v < n; ++v) {
		if(!seen[v]) dfs_2(v);
	}
	for(int v = 0; v < n - 1; ++v)
		cout << t[v] << ' ';
	cout << t.back() << '\n';
    return 0;
}



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

vector<int> dx = {-1, 0, 1, 0};
vector<int> dy = {0, 1, 0, -1};

int main() {
  int H, W;
  cin >> H >> W;
  int ch, cw, dh, dw;
  cin >> ch >> cw >> dh >> dw;
  ch--;
  cw--;
  dh--;
  dw--;
  vector<vector<char>> field(H, vector<char> (W));
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      cin >> field.at(i).at(j);
    }
  }
  vector<vector<int>> cost(H, vector<int> (W, 1000000000));
  cost.at(ch).at(cw) = 0;
  deque<pair<int, int>> que;
  que.push_front(make_pair(ch, cw));
  while(!que.empty()) {
    int x = que.front().first;
    int y = que.front().second;
    que.pop_front();
    for(int i = 0; i < 4; i++) {
      int nx = x + dx.at(i);
      int ny = y + dy.at(i);
      if(nx < 0 || nx >= H || ny < 0 || ny >= W) {
        continue;
      }
      else if(field.at(nx).at(ny) == '#') {
        continue;
      }
      else if(cost.at(nx).at(ny) > cost.at(x).at(y)) {
        cost.at(nx).at(ny) = cost.at(x).at(y);
        que.push_front(make_pair(nx, ny));
      }
    }
    for(int i = -2; i <= 2; i++) {
      for(int j = -2; j <= 2; j++) {
        if(i == 0 && j == 0) {
          continue;
        }
        int nx = x + i;
        int ny = y + j;
        if(nx < 0 || nx >= H || ny < 0 || ny >= W) {
          continue;
        }
        else if(field.at(nx).at(ny) == '#') {
          continue;
        }
        else if(cost.at(nx).at(ny) > cost.at(x).at(y) + 1) {
          cost.at(nx).at(ny) = cost.at(x).at(y) + 1;
          que.push_back(make_pair(nx, ny));
        }
      }
    }
  }
  if(cost.at(dh).at(dw) == 1000000000) {
    cout << -1 << endl;
  }
  else {
    cout << cost.at(dh).at(dw) << endl;
  }
}

Measured memory_bytes: 8524
N, M = [int(a) for a in input().split()]
A = [int(a) for a in input().split()]
B = [0] * M
C = [0] * M
for j in range(M):
    B[j], C[j] = [int(a) for a in input().split()]

D = zip(C, B)
D = sorted(D, reverse=True) # Cで降順ソート
C, B = zip(*D)  # 統合していた配列を元に戻す

# C[0]>= C[1] >= ... >= C[M-1]となるように並び替え、
# B[0]枚をC[0]に、B[1]枚をC[1]に書き換えていく。
# すべてのカードがC[j]以上というjに到達したらおしまい。
A.sort()

k = 0 # 現在書き換えを検討しているカード
for j in range(M):
    for _ in range(B[j]):
        if k >= N or A[k] >= C[j]: break
        A[k] = C[j]
        k += 1
    else:
        continue
    break

print(sum(A))

Measured memory_bytes: 82712
import std.stdio, std.conv, std.array, std.string;
import std.algorithm.iteration, std.algorithm.mutation, std.algorithm.searching, std.algorithm.sorting;

void main()
{
    int N = readln().strip.to!int;
    if(N==1)
    {
        writeln("Hello World");
    }else{
        auto r = readln().strip.to!int +
        readln().strip.to!int;
        writeln(r);
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s1,s2;
int main()
{
	cin>>s1;
	s2=s1;
	for(int i=0;i<s1.size();i++){
		if(s1[i]=='p') s1[i]='q';
		else if(s1[i]=='q') s1[i]='p';
		else if(s1[i]=='b') s1[i]='d';
		else if(s1[i]=='d') s1[i]='b';
	}
	reverse(s1.begin(),s1.end());
	if(s1==s2) printf("Yes");
	else printf("No");
	return 0;
}


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

const ll mod = 1000000007;

int main(){
    int N; cin >> N;
    vector<ll> t(N+2, 0), a(N+2, 0);
    for(int i=1; i<=N; i++) cin >> t[i];
    for(int i=1; i<=N; i++) cin >> a[i];

    ll ans = 1LL;
    for(int i=1; i<=N; i++){
        if(t[i-1] == t[i]){
            if(a[i] == a[i+1]){
                ans = ans*min(t[i], a[i])%mod;
            }
            else{
                if(a[i] > t[i]){
                    cout << 0 << endl;
                    return 0;
                }
            }
        }
        else{
            if(a[i] == a[i+1]){
                if(t[i] > a[i]){
                    cout << 0 << endl;
                    return 0;
                }
            }
            else{
                if(t[i] != a[i]){
                    cout << 0 << endl;
                    return 0;
                }
            }
        }
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<bits/stdc++.h>
#define maxn 405
#define mod 998244353
using namespace std;
int fac[maxn],inv[maxn];
int add(int a,int b){a+=b; return a>=mod?a-mod:a;}
void Inc(int &a,int b){a=add(a,b);}
int ksm(int a,int b)
{
	int s=1;
	for(;b;b>>=1,a=1ll*a*a%mod)
		if(b&1) s=1ll*s*a%mod;
	return s;
}
void Pre()
{
	fac[0]=1;
	for(int i=1;i<maxn;i++) fac[i]=1ll*fac[i-1]*i%mod;
	inv[maxn-1]=ksm(fac[maxn-1],mod-2);
	for(int i=maxn-2;i>=0;i--) inv[i]=1ll*inv[i+1]*(i+1)%mod;
}
int A[maxn],B[maxn],sa,sb,n;
int f[maxn][maxn][maxn];
int main()
{
	Pre();
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d",&A[i],&B[i]),sa+=A[i],sb+=B[i];
	f[0][0][0]=mod-1;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=sa;j++)
		{
			for(int k=0;k<=sb-n;k++)
			{
				f[i][j][k]=f[i-1][j][k];
				if(j<A[i]) continue;
				for(int t=0,c=1;t<=min(B[i]-1,k);t++,c=1ll*c*A[i]%mod)
					Inc(f[i][j][k],mod-1ll*f[i-1][j-A[i]][k-t]*c%mod*inv[t]%mod);
			}
		}
	}
	int ans=0;
	for(int i=1;i<=sa;i++)
	{
		int v=ksm(i,mod-2);
		for(int j=0;j<=sb-n;j++)
			Inc(ans,1ll*f[n][i][j]*v%mod*sa%mod*fac[j]%mod*ksm(ksm(i,j),mod-2)%mod);		
	}

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


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

int main(){
	int d,e;
	double r;
	while(1){
		cin>>d>>e;
		if(d==0&&e==0) break;
		r=1000000;
		for(int i=0;i<=d;i++){
			r=min(r,abs(sqrt(i*i+(d-i)*(d-i))-e));
		}
		cout<<r<<endl;
	}
	return 0;
}


Measured memory_bytes: 3228
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_N (100000)

int main() {
  // read inputs
  char cs[MAX_N + 1];
  scanf("%s", cs);
  const int N = strlen(cs);

  // solve
  char c0 = -1;
  int ans;
  for (int k = 1; k <= N; k++) {
    // printf("k = %d, cs[N - k] = %c, cs[k - 1] = %c\n", k, cs[N - k], cs[k - 1]);
    if (N - k - 1 + 1 < k) {
      if (c0 < 0) {
        c0 = cs[k - 1];
      }
      if (!(cs[N - k] == c0 && cs[k - 1] == c0)) {
        break;
      }
      ans = k;
    } else {
      ans = k;
    }
  }
  printf("%d\n", ans);
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  vector<int> h(200000, 0);
  cin >> n >> k;
  rep(i, n){
    cin >> h[i];
  }
  sort(all(h));
  reverse(all(h));
  rep(i, k){
    h[i] = 0; 
  }
  ll ans = 0;
  rep(i, n){
    ans += h[i];
  }
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

const int N_MAX = 1e5+10;
int p[N_MAX] = {0};
int q[N_MAX] = {0}; 

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

    rep(i, m){
        int j; string s;
        cin >> j >> s;
        if(p[j]==0 && s=="AC"){
            p[j] = 1;
        }
        if(p[j]==0 && s=="WA"){
            q[j]++;
        }
    }
    ll lans=0;
    ll rans=0;
    rep(i, N_MAX){
        lans+=p[i];
        if(p[i]==1){
            rans+=q[i];
        }
    }

    cout << lans << " " << rans << endl;
}


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

#ifdef LOCAL
#include "../debug.h"
#else
#define debug(x...) 141
#endif
#define forn(i,x,n) for(int i = x; i < n; ++i)
#define forit(it, m) for(auto it = m.begin(); it!=m.end(); ++it)
typedef long long ll;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,k,sum=0;

    cin>>n>>k;
    vector<int> a(n);
    forn(i,0,n)
    	cin>>a[i];
    sort(a.begin(),a.end());
    forn(i,0,k)
    	sum+=a[i];
    cout<<sum<<'\n';
    
    return 0;
}	

Measured memory_bytes: 3660
(let ((s (string (read))))
    (if (equal s "SUN")
    (princ 7))
    (if (equal s "MON")
    (princ 6))
    (if (equal s "TUE")
    (princ 5))
    (if (equal s "WED")
    (princ 4))
    (if (equal s "THU")
    (princ 3))
    (if (equal s "FRI")
    (princ 2))
    (if (equal s "SAT")
    (princ 1))
)

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

int main() {
	int n;cin>>n;
	vector<int> a(n);
	vector<int> v(100000,0);
	for(int i=0;i<n;i++){
		cin>>a[i];
		v[a[i]]++;
	}
	int flag=1;
	for(int i=0;i<n/2;i++){
		if(v[2*i+1+n%2]!=2){
			flag=0;
			break;
		}
	}
	if(n%2){
		if(v[0]!=1){
			flag=0;
		}
	}
	long long def=1;
	for(int i=0;i<9;i++)def*=10;
	def+=7;
	if(flag){
		long long ans=1;
		for(int i=0;i<n/2;i++){
			ans*=2;
			ans%=def;
		}
		cout<<ans<<endl;
	}else{
		cout<<0<<endl;
	}
	return 0;
}


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

int main() {

  int N;
  cin >> N;

  vector<int> rate(8,0);
  int num = 0;
  for(int i = 0;i < N;i++) {
    int a; 
    cin >> a;
    if(1 <= a && a <= 399) {
      rate.at(0)++;
    }else if(400 <= a && a <= 799) {
      rate.at(1)++;
    }else if(800 <= a && a <= 1199) {
      rate.at(2)++;
    }else if(1200 <= a && a <= 1599) {
      rate.at(3)++;
    }else if(1600 <= a && a <= 1999) {
      rate.at(4)++;
    }else if(2000 <= a && a <= 2399) {
      rate.at(5)++;
    }else if(2400 <= a && a <=2799) {
      rate.at(6)++;
    }else if(2800 <= a && a <= 3199){
      rate.at(7)++;
    }else {
      num++;
    }
  }

  int sorts = 0;
  for(int i = 0;i < 8;i++) {
    if(rate.at(i) != 0) sorts++;
  }

  if(num == N) {
  
  cout << 1 << " " << sorts + num << endl;
  }else {
  cout << sorts << " " << sorts + num << endl;
  }

}

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = (a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (a); i <= (long long)(n); i++)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 


int main(void)
{
    string s;
    cin >> s;

    if(s == "ABC") {
        cout <<"ARC" << endl;
    } else {
        cout <<"ABC" << endl;
    }
    return 0;
}
/** atcoder **/


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n, m, a[10000], b[10000];
vector<int>vec;
int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		if (a[i] < b[i])vec.push_back(b[i] - n);
	}
	sort(vec.begin(), vec.end());
	int r = 0;
	for (int i = 0; i < (int)vec.size() - 1; i++) {
		r += vec[i];
	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 3108
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());

		if(a >= b && a >= c){
			System.out.println((10*a+b+c));
		}else if (b >= a && b >= c){
			System.out.println((a+10*b+c));
		}else{
			System.out.println((a+b+10*c));
		}
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#include <fstream>
#define ll long long
#define ld long double
#define int long long
#define MOD 1000000007
#define mod 1000000007
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define vii vector<pii>
#define vvi vector<vi>
#define mp make_pair
#define endl "\n"
using namespace std;
const int f=100000;
int solvevec(vi vec);
void solve1();
void solve()
{
    int T;cin>>T;
    for(int z=1;z<=T;z++)
    {
        solve1();
    }
}
signed main()
{
    std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    solve1();
    return 0;
}
void solve1()
{
    int n;cin>>n;
    int arr[n],brr[n];int c=0,ans=0;
    cin>>arr[0];brr[0]=arr[0];
    for(int i=1;i<n;i++)
    {
        cin>>arr[i];
        brr[i]=brr[i-1]+arr[i];brr[i]%=MOD;
    }
    for(int i=1;i<n;i++)
    {
        ans+=arr[i]*brr[i-1];ans%=MOD;
    }
    cout<<ans<<endl;
}




Measured memory_bytes: 6776
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&y);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */


int main() {
    int n;
    scanf("%d",&n);
    int x;
    scanf("%d",&x);
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }

    sort(a, a+n); // 配列のソート

    int stock = x;
    int count = 0;
    rep(i,n){
        if(i==n-1){
            if(a[i]==stock){
                count++;
            }
            break;
        }
        if(stock>=a[i]){
            stock -= a[i];
            count++;
        }else{
            break;
        }
    }

    int ans = 0;
    ans = count;
    cout << ans << endl;
   
    return 0;
}
 
 


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).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; }

typedef long long ll;

using namespace std;


class UnionFind
{
public:
  UnionFind(int n)
  {
    parent=vector<int>(n,-1);
  }
  int root(int a)
  {
    if(parent[a]<0)return a;
    return parent[a]=root(parent[a]);
  }
  int size(int a)
  {
    return -parent[root(a)];
  }
  bool connect(int a,int b)
  {
    int A=root(a);
    int B=root(b);
    if(A==B)return false;
    if(size(A)>size(B))swap(A,B);
    parent[B]+=parent[A];
    parent[A]=B;
    return true;
  }
private:
  vector<int> parent;

};
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,k,l;
  cin>>n>>k>>l;
  UnionFind uf1(n),uf2(n);
  vector<pair<pair<int,int>,int>>ci(n);
  rep(i,k){
    int p,q;
    cin>>p>>q;
    p--;q--;
    uf1.connect(p,q);
  }
  rep(i,l){
    int p,q;
    cin>>p>>q;
    p--;q--;
    uf2.connect(p,q);
  }
  rep(i,n){
    ci[i].first.first=uf1.root(i);
    ci[i].first.second=uf2.root(i);
    ci[i].second=i;
  }
  sort(all(ci));
  vector<int>res(n);
  rep(i,n){
    int id=ci[i].second;
    ci[i].second=n;
    auto it=upper_bound(all(ci),ci[i]);
    ci[i].second=0;
    auto it2=lower_bound(all(ci),ci[i]);
    res[id]=it-it2;
  }
  rep(i,n)cout<<res[i]<<" ";
  cout<<endl;

  return 0;

}


Measured memory_bytes: 5376
#include <iostream>
#include <stdlib.h>
#include <string>

using namespace std;

int main(){
	int sum=0;
	
	while(true){
		char c;
		c = getchar();
		if(c == '\n') break;
		sum += c-'0';
	}
	
	if(sum % 9 == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
	
	
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
vector<int>G[N];
int n,dp[N],f;
void dfs(int i,int p)
{
    dp[i]=0;
    int F=0;
    for(auto j:G[i])
    {
        if(j==p)continue;
        dfs(j,i);
        dp[i]+=dp[j];
        if(!dp[j])
        {
            if(!F)F=1;
            else dp[i]++;
        }
    }
}

int main()
{
    scanf("%d",&n);
    for(int i=1,u,v; i<n; i++)
        scanf("%d%d",&u,&v),G[u].push_back(v),G[v].push_back(u);
    f=-1;
    for(int i=0; i<n; i++)
        if(G[i].size()>2)
        {
            f=i;
            break;
        }
    if(f==-1)printf("1\n");
    else dfs(f,-1),printf("%d\n",dp[f]);
    return 0;
}


Measured memory_bytes: 10368
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	int num, i;
	vector<int> d = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	cin >> num;
	cout << d[num - 1] << "\n";
	return 0;
}

Measured memory_bytes: 256