akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
typedef pair<int, int> PII;
typedef long long ll;
template<typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

string s, t;

int main() {

	cin >> s >> t;

	t += s;

	cout << t << endl;

	return 0;
}



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

int main() {
    int R;
    cin >> R;
    
    if (R < 1200) cout << "ABC" << endl;
    else if (R < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    A.sort()
    M = A.pop()
    m = A.pop(0)

    ans = []
    while A:
        a = A.pop()
        if a < 0:
            ans.append((M, a))
            M -= a
        else:
            ans.append((m, a))
            m -= a

    print(M-m)
    for x, y in ans:
        print(x, y)
    print(M, m)


def main():
    N = read_int()
    A = read_int_n()
    (slv(N, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 21304
import java.io.BufferedReader; 
import java.io.*;
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.util.*;
import java.math.*;
public class Main 
{ 
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader()
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next()
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine();
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
   public static void main(String args[])
    {
        FastReader sc=new FastReader();
        PrintWriter pw=new PrintWriter(System.out);
        int t=1;//sc.nextInt();
        while(t-->0)
        {
           String s[]=sc.next().split("S");int max=0;
           for(String w:s)
           {
               max=Math.max(w.length(),max);
           }
           pw.println(max);
        }
           pw.close();
    }
}
  

Measured memory_bytes: 32976
/*
    CCBESTGIRL
*/

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n , k;
    cin>>n>>k;
    if(n%k == 0){
        cout<<"0";
    }
    else{
        ll val = (n%k);
        ll val2 = val;
        val2 = min(val2 , abs(val2-k));
        ll val3 = val2;
        while(true){
            val3 = min(val3 , abs(val3-k));
            if(val3>=val2){
                cout<<val2;
                break;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b < c+d){cout<<"Right";}
    if(a+b > c+d){cout<<"Left";}
    if(a+b == c+d){cout<<"Balanced";}
    return 0;
}


Measured memory_bytes: 3092
use std::io::*;

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).unwrap();

    let mut nums = String::new();
    std::io::stdin().read_line(&mut nums).unwrap();
    let nums: Vec<&str> = nums.trim_right().split(" ").collect();

    let mut vec_a: Vec<i32> = Vec::new();
    for num in nums {
        let n: i32 = num.parse::<i32>().unwrap();
        vec_a.push(n);
    }

    let cnt = count(vec_a, 0);

    let out = stdout();
    let mut out = out.lock();
    writeln!(out, "{}\n", cnt).unwrap();

}

fn count(nums: Vec<i32>, cnt: i32) -> i32 {
    let mut new_nums: Vec<i32> = Vec::new();

    for num in nums {
        if num % 2 == 0 {
            let n: i32 = num / 2;
            new_nums.push(n);
        } else { 
            return cnt;
        }
    }

    count(new_nums, cnt + 1)
}


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

namespace ConsoleApp1111
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var a = Console.ReadLine().Trim().Split(' ');
            var c = a.Distinct().Count();

            Console.WriteLine((a.Length == c) ? "YES" : "NO");
        }
    }
}


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

double odd;

main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		if(i%2==1)
			odd++;
	}
	double ans=odd/n;
	printf("%.10lf",ans);
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

R = [False]*(N+1)
D = []
p = 1
while True:
    if R[p]:
        break
    D.append(p)
    R[p] = True
    p = A[p-1]
m = D.index(p)
c = len(D)-m

if K <= m:
    print(D[K])
else:
    print(D[m+(K-m) % c])


Measured memory_bytes: 32292
import java.io.BufferedInputStream
import java.util.StringTokenizer

class FastScanner(){
    private val reader = BufferedInputStream(System.`in`).bufferedReader()
    private var st: StringTokenizer? = null
    fun next(): String {
        while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
        return st!!.nextToken()
    }
    fun hasNext(): Boolean {
        while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine() ?: return false)
        return true
    }
}

const val YES = "Yes"
const val NO = "No"

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    fun iterateTokens(): Iterator<String> {
        val reader = BufferedInputStream(System.`in`).bufferedReader()
        return reader.use{ it.readText() }.split("\n| ".toRegex()).iterator()
    }
    val tokens = FastScanner()
    val N = tokens.next().toLong()
    val A = LongArray(N.toInt())
    val B = LongArray(N.toInt())
    for(i in 0 until N.toInt()){
        A[i] = tokens.next().toLong()
        B[i] = tokens.next().toLong()
    }
    solve(N, A, B)
}

fun solve(N: Long, A: LongArray, B: LongArray){
    val n = N.toInt()
    val ab = Array<Pair<Long, Long>>(n){
            A[it] to B[it]
        }.sortedBy{ it.second }
    var time = 0L
    for ( i in 0 until n){
        time += ab[i].first
        if (time > ab[i].second){
            println(NO)
            return
        }
    }
    println(YES)
    return
}



Measured memory_bytes: 130456
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define INF 1 << 30
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define FORALL(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef valarray<int> Array;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cout<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}

class P
{
private:
  double add(double a,double b){if(abs(a+b)<1e-10*(abs(a)+abs(b)))return 0;else return a+b;}
public:
  double x,y;
  P(){};P(double x,double y):x(x),y(y){};
  P operator+(const P&q){return P(add(x,q.x),add(y,q.y));}
  P operator+=(const P&q){x+=q.x;y+=q.y;return *this;}
  P operator-(const P&q){return P(add(x,-q.x),add(y,-q.y));}
  P operator-=(const P&q){x-=q.x;y-=q.y;return *this;}
  template<typename T> P operator*(T d){return P(x*d,y*d);}
  template<typename T> P operator*=(T d){x*=d;y*=d;return *this;}
  bool operator<(const P&q){return (x!=q.x)?(x<q.x):(y<q.y);}
  bool operator>(const P&q){return (x!=q.x)?(x>q.x):(y>q.y);}
  bool operator<=(const P&q){return (x!=q.x)?(x<=q.x):(y<=q.y);}
  bool operator>=(const P&q){return (x!=q.x)?(x>=q.x):(y>=q.y);}
  static bool comp(const P&p,const P&q){return (p.x!=q.x)?(p.x<q.x):(p.y<q.y);}
  double dot(const P&q){return x*q.x+y*q.y;}
  double det(const P&q){return x*q.y-y*q.x;}
  bool on_seg(P p1,P p2,P q){return (p1-q).det(p2-q)==0&&(p1-q).dot(p2-q)<=0;}
  P intersection(P p1,P p2,P q1,P q2){return p1+(p2-p1)*((q2-q1).det(q1-p1)/(q2-q1).det(p2-p1));}
};

vector<P> convex_hull(vector<P> ps)
{
  sort(ps.begin(),ps.end(),P::comp);
  int k = 0, n = ps.size();
  vector<P> qs(n*2);
  for(int i=0;i<n;i++)
  {
    while(k>1&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)k--;
    qs[k++]=ps[i];
  }
  for(int i=n-2,t=k;i>=0;i--)
  {
    while(k>t&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)k--;
    qs[k++]=ps[i];
  }
  qs.resize(k-1);
  return qs;
}

int main()
{
  int n;
  while(cin >> n, n)
  {
    vector<P> ps,qs;
    REP(i,n){P t;scanf("%lf,%lf\n",&t.x,&t.y);ps.push_back(t);}
    qs = convex_hull(ps);
    cout << n-qs.size() << endl;
  }
  return 0;
}

Measured memory_bytes: 3204
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	Q := sc.nextInt()
	A := sc.nextIntSlice(N)
	for i := 0; i < Q; i++ {
		x := sc.nextInt()
		ans, right, sum := 0, 0, 0
		for left := 0; left < N; left++ {
			for right < N && sum+A[right] <= x {
				sum += A[right]
				right++
			}
			ans += right - left
			if right == left {
				right++
			} else {
				sum -= A[left]
			}
		}
		fmt.Fprintln(wtr, ans)
	}

	wtr.Flush()
}



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

int main()
{
    int n;
    cin >> n;
    int studnum[n], output[n] = {0};
    for(int i = 0; i < n; i++)
    {
        cin >> studnum[i];
    }
    int index = 1;
    while(index<=n)
    {
        for(int i = 0; i < n; i++)
        {
            if(studnum[i] == index)
            {
                output[index-1] = i+1;
                cout << output[index-1] << " ";
                index++;
                break;
            }
        }
    }
    cout << endl;
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            ////入力した値を数値変換する
            int num = int.Parse(Console.ReadLine());
            string str = Console.ReadLine();
            string[] strArray = new string[num];
            strArray = str.Split(' ');
            int[] intArray = Array.ConvertAll(strArray, int.Parse);

            int intSum = intArray.Sum();
            int result = intSum - num;

            Console.WriteLine(result);


        }
    }

}

Measured memory_bytes: 28504
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int n, dp[1 << 15][15];
string s[20];
int p[20][20];

int main(){
	while(cin >> n, n){
		rep(i, n) cin >> s[i];
		vector<string> v;
		rep(i, n){
			bool ok = 1;
			rep(j, n) if(i != j) if(s[j].find(s[i]) != s[j].npos) ok = 0;
			if(ok) v.pb(s[i]);
		}
		int m = v.size();
		rep(i, m) rep(j, m){
			for(int l = min(v[i].size(), v[j].size()); l >= 0; l--)
			if(v[i].substr(v[i].size() - l) == v[j].substr(0, l)){
				p[i][j] = l;
				break;
			}
		}
		rep(i, 2 << m) rep(j, m) dp[i][j] = inf;
		rep(i, m) dp[1 << i][i] = v[i].size();
		rep(i, 1 << m) rep(j, m) if(dp[i][j] < inf) rep(k, m) if(!(i & 1 << k)){
			dp[i | 1 << k][k] = min(dp[i | 1 << k][k], dp[i][j] + (int)v[k].size() - p[j][k]);
		}
		int ans = inf;
		rep(i, m) ans = min(ans, dp[(1 << m) - 1][i]);
		cout << ans << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 3140
import java.util.Scanner;

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

        int X = sc.nextInt();
        int A = sc.nextInt();

        if(X < A){
            System.out.println(0);
        } else {
            System.out.println(10);
        }
    }
}

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

typedef long long ll;

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

    int dist[n+1];
    dist[1] = 0;

    for(int i = 2; i <= n; i++){
        cin >> dist[i];
        dist[i] += dist[i-1];
    }

    ll ans = 0;
    int now = 1, next;

    for(int i = 0; i < m; i++){
        cin >> next;
        if(next < 0){
            ans += dist[now] - dist[now+next];
        }else{
            ans += dist[now+next] - dist[now];
        }
        now += next;
    }

    cout << ans % 100000 << endl;

    return 0;
}


Measured memory_bytes: 3464
import java.util.Arrays;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int n = Integer.parseInt(scanner.nextLine());


		int[][] list = new int[n][3];

		for(int i = 0; i < n; i++) {
			String[] temp = scanner.nextLine().split(" ");
			for(int j = 0; j < 3; j ++) {
				list[i][j] = Integer.parseInt(temp[j]);
			}
		}

		for(int i = 0; i < n; i++) {

			if(i > 0){
			list[i][0] += Math.max(list[i - 1][1], list[i - 1][2]);
			list[i][1] += Math.max(list[i - 1][0], list[i - 1][2]);
			list[i][2] += Math.max(list[i - 1][0], list[i - 1][1]);
			}
		}

		int ans = Math.max(list[n - 1][0], list[n - 1][1]);
		ans = Math.max(ans, list[n - 1][2]);

		System.out.println(ans);

	}

}


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

#define Max_number 210

void shuffle ( char *str, int num );

int main(void) {
	char cards[Max_number]			= {};
	int num_order					= 0;
	int cmd							= 0;
	char result[10][Max_number]		= {};
	int i							= 0;
	int number						= 0;
	
	
	while ( 1 ) {
		scanf( "%s", cards );
		if ( cards[0] == '-' ) {
			break;
		}
		
		scanf( "%d", &num_order );
		
		for ( i = 0; i < num_order; i++ ) {
			scanf("%d", &cmd );
			shuffle( cards, cmd );
		}
		
		for ( i = 0;  cards[i] != '\0'; i++ ) {
			result[number][i] = cards[i];
		}
		result[number][i] = '\0';
		
		number++;
	}
	
	for ( i = 0; i < number; i++ ) {
	    printf("%s\n", result[i]);
	}
	
	return 0;
}

void shuffle ( char *str, int num )
{
	char front[Max_number] = {};
	char back[Max_number] = {};

	strcpy( back, &str[num] );
	str[num] = '\0';
	strcpy( front, &str[0] );
	strcat(back, front);
	
	strcpy(str, back );
	return;
}


Measured memory_bytes: 2104
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    if(a<b){
        cout<<"a < b"<<endl;
    }
    if(a>b){
        cout<<"a > b"<<endl;
    }
    if(a==b){
        cout<<"a == b"<<endl;
    }
    return 0;
}




Measured memory_bytes: 3096
import sys

stdin = sys.stdin

mod = 1000000007
inf = 1 << 60

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

h, n = na()
a = na()
a.sort()
a.reverse()

for i in range(n):
    h -= a[i]

if h > 0:
    print("No")
else:
    print("Yes")

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

namespace abc159
{
    class Program
    {
        static void Main(string[] args)
        {
            // a();
            b();
        }

        public static void a()
        {
            int[] nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = nm[0], m = nm[1];
            int ans = 0;
            
            Console.WriteLine(ans);
        }

        public static void b()
        {
            string s = Console.ReadLine();
            int n = s.Length;
            for(int i = 1; i < n; i++)
            {
                if (s[i - 1] != s[n - i])
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            for(int i = 1; i < (n - 1)/2; i++)
            {
                if(s[i -1] != s[(n - 1)/2 - i]) // i + 1 ?
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            int j = 0;
            for(int i = (n + 3)/2 - 1; i < n; i++)
            {

                if(s[i] != s[n - j - 1])
                {
                    Console.WriteLine("No");
                    return;
                }
                j++;
            }
            Console.WriteLine("Yes");
        }
    }
}


Measured memory_bytes: 11092
// スタックサイズ: 100MB

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }




int main() {
	
	string a, b; ll N;
	cin >> a >> b;
	N = stoll(a + b);

	bool ans = false;
	fori(i, 2, sqrt(N) + 1) {
		if (N / i == i && N % i == 0) ans = true;
	}
	cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
f x a = a * (x `div` a)

ans [[h,w],[a,b]] = h * w - h' * w'
  where
    h' = f h a
    w' = f w b

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = ans i
  print o
  



Measured memory_bytes: 3676
while True:
    n,k = map(int,input().split())
    if n==0 and k==0:
        break
    else:
        a=[int(input()) for _ in range(n)]
        s=sum(a[0:k])
        ss=[s]
        for i in range(k,n):
            s = s+a[i]-a[i-k]
            ss.append(s)
        print(max(ss))


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

using namespace std;

int parent(int i)
{
    return i / 2;
}
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }

bool hasParent(int i, int n) { return parent(i) >= 1; }
bool hasLeft(int i, int n) { return left(i) <= n; }
bool hasRight(int i, int n) { return right(i) <= n; }

void maxHeapify(vector<int> &a, const int i)
{
    int l = left(i);
    int r = right(i);
    int max = i, h = a.size();
    if (l <= h && a[l] > a[max])
        max = l;
    if (r <= h && a[r] > a[max])
        max = r;
    if (max != i)
    {
        swap(a[i], a[max]);
        maxHeapify(a, max);
    }
}

void buildMaxHeap(vector<int> &a)
{
    int h = a.size();
    for (int i = h / 2; i > 0; i--)
    {
        maxHeapify(a, i);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
    }

    buildMaxHeap(a);

    for (int i = 1; i <= n; i++)
    {
        printf(" %d", a[i]);
    }
    printf("\n");

    return 0;
}



Measured memory_bytes: 4624
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(ll __x = __start; __x < __end; __x++)

vector<ll> ALL(51, 0);
vector<ll> P(51, 0);

/*
xが1の時: 0
x>=All(n)の時: All(n)
x<=1+P(n-1)の時: g(n-1, x-1)
x==1+P(n-1)+1: g(n-1, x-2) + 1
x<=1+P(n-1)+1+P(n-1): g(n-1, x-2-P(n-1)) + 1 + P(n-1)

   P P     P P
  B P B   B P B
B       P       B

P_0 = 1, P_1 = 3, P_2 = 7
2 7

*/


ll g(int n, ll x) {
  if (n == 0) return 1;
  if (x == 1) return 0;
  if (x <= 1 + ALL[n-1]) return g(n-1, x-1);
  if (x == 1 + ALL[n-1] + 1) return g(n-1, x-2) + 1;
  if (x <= 1 + ALL[n-1] + 1 + ALL[n-1]) return P[n-1] + 1 + g(n-1, x-2-ALL[n-1]);
  return P[n];
}

int main() {
  int n; ll x; cin >> n >> x;
  ALL[0] = P[0] = 1;
  loop(i,1,n+1) ALL[i] = ALL[i-1] * 2 + 3;
  loop(i,1,n+1) P[i] = P[i-1] * 2 + 1;
  cout << g(n, x) << endl;
  return 0;
}


Measured memory_bytes: 3644
# include "cstdio"
# include "iostream"

using namespace std;

inline int n_lowbit(int x){
	int count=0;
	while(x){
		if(x&1){
			return count; 
		}
		count++; 
		x>>=1; 
	}
	return count; 
} 

long long
	ans; 

int
	N, 
	a; 

int main(){
	scanf("%d",&N);
	while(N--){
		scanf("%d",&a);
		ans+=n_lowbit(a); 
	}
	printf("%lld",ans); 
	return 0; 
} 

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

typedef std::pair<char, int> card;

void print_array(const card a[], int n) {
  for (int i = 0; i < n; ++i) {
    if (i > 0)
      std::cout << " ";
    std::cout << a[i].first << a[i].second;
  }
  std::cout << std::endl;
}

void bubble_sort(card a[], int n) {
  bool flag = true;
  while (flag) {
    flag = false;
    for (int i = n - 1; i > 0; --i) {
      if (a[i].second < a[i - 1].second) {
        std::swap(a[i], a[i - 1]);
        flag = true;
      }
    }
  }
}

void selection_sort(card a[], int n) {
  for (int i = 0; i < n; ++i) {
    int minj = i;
    for (int j = i; j < n; ++j) {
      if (a[minj].second > a[j].second)
        minj = j;
    }
    std::swap(a[minj], a[i]);
  }
}

int main() {
  int n;
  std::cin >> n;
  std::pair<char, int> a[n], b[n];
  for (int i = 0; i < n; i++) {
    std::cin >> a[i].first >> a[i].second;
  }
  std::copy(a, a + n, b);

  bubble_sort(a, n);
  print_array(a, n);
  std::cout << "Stable" << std::endl;

  selection_sort(b, n);
  print_array(b, n);
  for (int i = 0; i < n; i++) {
    if (a[i].first != b[i].first) {
      std::cout << "Not stable" << std::endl;
      return 0;
    }
  }

  std::cout << "Stable" << std::endl;
}



Measured memory_bytes: 3108
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      String a = sc.next();
      String b = sc.next();

      if (a.equals("H")&&b.equals("H")) {
        System.out.println("H");
        System.exit(0);
      }
      if (a.equals("H")&&b.equals("D")) {
        System.out.println("D");
        System.exit(0);
      }
      if(a.equals("D")&&b.equals("H")){
        System.out.println("D");
          System.exit(0);
      }
      if(a.equals("D")&&b.equals("D")){
        System.out.println("H");
          System.exit(0);
      }

  }


}



Measured memory_bytes: 21716
n = int(input())
room = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

for _ in range(n):
    b,f,r,v = map(int,input().split())
    room[b-1][f-1][r-1] += v

for c in range(4):
    for d in range(3):
        print('',*room[c][d])
    if c != 3:
        print('#' *20)


Measured memory_bytes: 5620
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
//vector<vector<int> > dp(500,vector<int> (500,-1));

long long int solve(vector<long long int> &A,int i, int j,vector<vector<long long int> > &dp){
    if(i+1==j){
        return max(A[i],A[j]);
    }
    if(i==j){
        return A[i];
    }
    if(dp[i][j]!=-1){
        return dp[i][j];
    }
    dp[i][j] = max(A[i]+min(solve(A,i+2,j,dp),solve(A,i+1,j-1,dp)),A[j]+min(solve(A,i,j-2,dp),solve(A,i+1,j-1,dp)));
    return dp[i][j];
}
int main(){
  int n;
  cin>>n;
  std::vector<long long int>A(n) ;
  long long int sum =0;
  for(int i=0;i<n;i++){
      cin>>A[i];
      sum+=A[i];
  }
  vector<vector<long long int> > dp(n,vector<long long int> (n,-1));
  long long int X = solve(A,0,n-1,dp);
  long long int Y = sum-X;
  std::cout << X-Y << std::endl;
  return 0;
}

Measured memory_bytes: 73976
N, Z, W = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)

if N == 1
   puts ( A[0] - W ).abs
   exit
end

e = ( A[-1] - W).abs
b1 = ( A[-2] - A[-1] ).abs

if e > b1
  puts e
else
  puts b1
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;cin>>n;
	int arr[n];
	for(int i = 0; i< n;++i) cin>>arr[i];
	int sum = accumulate(arr, arr + n, 0);
	int dp[n];
	dp[0] = arr[0];
	int mx = INT_MAX;
	for(int i = 1; i < n; ++i){
		dp[i] = dp[i-1] + arr[i];
		mx = min(mx, abs(sum - dp[i] - dp[i]));
	}
	cout<<mx<<endl;
	return 0;
}



Measured memory_bytes: 256
fn main() {
    use std::collections::HashMap;
    use std::collections::HashSet;
    let n: u64 = read();
    let m: u64 = read();
    let mut table: HashSet<u64> = HashSet::new();
    let mut ac = 0;
    let mut penalty_table: HashMap<u64, u64> = HashMap::new();
    let mut penalty = 0;
    for _ in 0..m {
        let p: u64 = read();
        let s: String = read();
        if s == "AC" {
            if !table.contains(&p) {
                ac += 1;
                table.insert(p);
                if let Some(pena) = penalty_table.get(&p) {
                    penalty += *pena;
                }
            }
        } else {
            if !table.contains(&p) {
                if !penalty_table.contains_key(&p) {
                    penalty_table.insert(p, 1);
                } else {
                    if let Some(old) = penalty_table.get_mut(&p) {
                        *old += 1;
                    }
                }
            }
        }
    }
    println!("{} {}", ac, penalty);
}

use std::io::stdin;
use std::io::Read;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let token: String = cin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


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

using namespace std;

#define li long long int

const int N 	= 1e5 + 5;
const li mod 	= 1e9 + 7;

int n, m;
vector <int> g[N];
int indeg[N];
int vis[N];
int dis[N];

void solve() {
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		int x, y;
		cin >> x >> y;
		g[x].push_back(y);
		indeg[y]++;
	}
	queue <int> q;
	for (int i = 1; i <= n; i++) {
		if (indeg[i] == 0) {
			q.push(i);
		}
	}
	while (!q.empty()) {
		int u = q.front();
		q.pop();
		for (auto v : g[u]) {
			indeg[v]--;
			dis[v] = max(dis[v], dis[u] + 1);
			if (indeg[v] == 0) {
				q.push(v);
			}
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		ans = max(ans, dis[i]);
	}
	cout << ans;
}

int main() {
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 6528
/// referenced: https://beta.atcoder.jp/contests/abc066/submissions/2252964
#include <bits/stdc++.h>
using namespace std;

constexpr int64_t MOD = 1000000007;

int64_t Power(int64_t base, int64_t exp) {
  int64_t x = 1;
  while (exp) {
    if (exp % 2) {
      x = x * base % MOD;
    }
    base = base * base % MOD;
    exp /= 2;
  }
  return x;
}

int64_t Inv(int64_t x) {
  return Power(x, MOD - 2);
}

int64_t Factorial(int64_t x) {
  static vector<int64_t> xs;
  if (xs.size() == 0) {
    xs.resize(100002);
    xs[0] = 1;
    for (int i = 1; i < xs.size(); ++i) {
      xs[i] = xs[i - 1] * i % MOD;
    }
  }
  return xs[x];
}

int64_t InvFact(int64_t x) {
  static vector<int64_t> xs;
  if (xs.size() == 0) {
    xs.resize(100002);
    xs[100001] = Inv(Factorial(100001));
    for (int i = 100000; i >= 0; --i) {
      xs[i] = xs[i + 1] * (i + 1) % MOD;
    }
  }
  return xs[x];
}

int64_t Combination(int64_t n, int64_t r) {
  if (n < r) return 0;
  int64_t x = Factorial(n);
  x = x * InvFact(r) % MOD;
  x = x * InvFact(n - r) % MOD;
  return x;
}


int main(){
  int64_t n,a;
  bool c[100002];
  cin >> n;
  for(int64_t i=1;i<=n;i++) c[i]=false;
  int64_t p[100002];
  int64_t x,y;

  for(int64_t i=0;i<=n;i++){
    cin >> a;
    if(c[a]){
      x=p[a];
      y=i;
    }
    c[a]=true;
    p[a]=i;
  }


//  Factorial[0]=1;
//  for(int64_t i=1;i<=n+1;i++) Factorial[i]=i*Factorial[i-1]%MOD;
//  for(int64_t i=0;i<=n+1;i++) InvFact[i]=Inv(Factorial(i));

  for(int64_t i=1;i<=n+1;i++){
    int64_t ans;
    ans=Combination(n+1,i);
    if(i-1<=n-(y-x)) ans+=MOD-Combination(n-(y-x),i-1);
    cout << (ans%MOD) << endl;
  }

  return 0;
}


Measured memory_bytes: 3712
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

char ts[300000], ds[300000];

int main() {
  int N, Q;
  string s;

  cin >> N >> Q >> s;

  for (int i = Q - 1; i >= 0; i--) {
    char t, d;
    scanf("\n%c %c", &t, &d);
    ts[i] = t; ds[i] = d;
  }

  s = " " + s + " ";
  int l = 1, r = N;

  for (int i = 0; i < Q; i++) {
    char t = ts[i], d = ds[i];
    if (d == 'L') {
      if (s[l] == t && l != 0) l++;
      if (s[r+1] == t && r != 0) r++;
    }
    else if (d == 'R') {
      if (s[r] == t && r != N + 1) r--;
      if (s[l-1] == t && l != N + 1) l--;
    }
  }

  cout << r - l + 1 << endl;
}



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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int x, a, b;cin >> x >> a >> b;
    if(b <= a) cout << "delicious" << endl;
    else if(b <= a+x) cout << "safe" << endl;
    else cout << "dangerous" << endl;
    return 0;
}


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

int n;
int a[100001];
int b[100001];
map<int, vector<int>> ma;
map<int, vector<int>> mb;
vector<int> G[100001];
bool used[100001];

void rec(int from) {
  if (used[from]) return;
  used[from] = true;
  for (int to : G[from]) {
    rec(to);
  }
}

int cat() {
  for (auto&& p : ma) {
    int val = p.first;
    auto it = mb.find(val);
    if (it == mb.end()) continue;
    int to = it->second.front();
    for (int from : p.second) {
      G[from].push_back(to);
    }
    
    for (int i = 1; i < it->second.size(); ++i) {
      int from = it->second[i - 1];
      int to = it->second[i];
      G[from].push_back(to);
    }
  }
  
  int vertices = 0;
  int cnt = 0;
  for(int i = n; i >= 0; --i) {
    if (a[i] == b[i]) continue;
    ++vertices;
    if (used[i]) continue;
    rec(i);
    ++cnt;
  }
  return (vertices - 1) + (cnt - 1);
}

bool ok() {
  for (auto&& p : mb) {
    int val = p.first;
    int cnt = p.second.size();
    auto it = ma.find(val);
    if (it == ma.end() || it->second.size() < cnt) return false;
  }
  return true;
}

int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  int sum = 0;
  for (int i = 0; i < n; ++i) sum ^= a[i];
  a[n] = sum;
  b[n] = -1;
  for (int i = 0; i <= n; ++i) ma[a[i]].push_back(i);
  for (int i = 0; i < n; ++i) mb[b[i]].push_back(i);
  
  if (ok()) {
    cout << cat() << endl;
  } else {
    cout << -1 << endl;
  }
}

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

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e9

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll H, W, h, w, ans[501][501];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> H >> W >> h >> w;
	if(H%h==0 && W%w==0){
		cout << "No\n";
	}
	else{
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				ans[i][j]=(1e9-1)/(h*w-1);
			}
		}
		for(int i = h-1; i < H; i+=h){
			for(int j = w-1; j < W; j+=w){
				ans[i][j]=-1e9;
			}
		}
		cout << "Yes\n";
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				cout << ans[i][j] << " ";
			}
			cout << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 4864
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 200000;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    vector<ll> c(26,0);
    rep(i,s.length()){
        c[s[i]-'a']++;
    }
    bool ok = 1;
    rep(i,26){
        if (c[i]%2) ok = 0;
    }
    Yes(ok);
}


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

int main(){
  long a,b;
  long sum=1;
  cin>>a>>b;
  for(int i=1;i<b+1;i++){
    if(a%i==0 && b%i==0){
      sum=sum*i;
      a=a/i;
      b=b/i;
      i=1;
    }
  }
  cout<<a*b*sum<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long read()
{
	char ch=getchar();long long x=0,ff=1;
	while(ch<'0'||ch>'9') {if(ch=='-') ff=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*ff;
}
void write(long long aa)
{
	if(aa<0) putchar('-'),aa=-aa;
	if(aa>9) write(aa/10);
	putchar('0'+aa%10);
	return;
}
const long long mod=1e9+7;
long long n,K,cnt,ans;
long long shu[1000005],f[1000005],vis[1000005];
long long ksm(long long aa,long long bb)
{
	long long now=1;
	while(bb)
	{
		if(bb&1) now=now*aa%mod;
		aa=aa*aa%mod;bb>>=1;
	}
	return now;
}
void solve(long long aa)
{
	if(vis[aa]) return;
	vis[aa]=1;
	f[aa]=ksm(K,(shu[aa]+1)/2);
	for(long long i=1;i<aa;++i)
	if(shu[aa]%shu[i]==0) 
	{
		solve(i);
		f[aa]=(f[aa]-f[i]+mod)%mod;
	}
	if(shu[aa]%2==0) (ans+=(shu[aa]/2)*f[aa]%mod)%=mod;
	else (ans+=shu[aa]*f[aa]%mod)%=mod;
	return;
}
int main()
{
	n=read(),K=read();
	for(long long i=1;i*i<=n;++i) if(n%i==0)
	{
		shu[++cnt]=i;
		if(i*i!=n) shu[++cnt]=n/i;
	}
	sort(shu+1,shu+cnt+1);
	solve(cnt);
	write(ans);
	return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;
#define ll long long
#define cpp mp::cpp_int
#define dequeue deque
#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 vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
const double PI = 3.1415926535897932384626433832795;
struct edge {
	int to;
	ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
void reverse(string* s) {
	reverse((*s).begin(), (*s).end());
}
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
int main() {
	COME_LET_THE_GAMES_BEGIN();
	int h, w;
	cin >> h >> w;
	char c[100][100];
	rep(i, h) {
		rep(j, w) {
			cin >> c[i][j];
		}
	}
	rep(i, h + h) {
		rep(j, w) {
			cout << c[i / 2][j];
		}
		cout << "\n";
	}
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    int n;
    int[] brackets;

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

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextInt();
        brackets = new int[9];
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            if (a < 400) {
                brackets[0]++;
            } else if (a < 800) {
                brackets[1]++;
            } else if (a < 1200) {
                brackets[2]++;
            } else if (a < 1600) {
                brackets[3]++;
            } else if (a < 2000) {
                brackets[4]++;
            } else if (a < 2400) {
                brackets[5]++;
            } else if (a < 2800) {
                brackets[6]++;
            } else if (a < 3200) {
                brackets[7]++;
            } else {
                brackets[8]++;
            }
        }
        int count = 0;
        for (int i = 0; i < 8; i++) {
            if (brackets[i] > 0) {
                count++;
            }
        }
        int min = count;
        if (min == 0) {
            min = 1;
        }
        int max = count + brackets[8];
        System.out.println(min + " " + max);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 21204
import math
S=int(input())
q,m = divmod(S,3)
#print(q,m)

if S<=2:
    print(0)
else:
    ans=0
    M=10**9+7
    
    for b in reversed(range(2,q+1)):
        #print(b,m)
        #(m+b-1)!/(b-1)!(m)!
        if m==1:
            s=b
        else:
            s=(math.factorial(b+m-1) // (math.factorial(b-1)*math.factorial(m)))
        ans+=s
        if ans>=M:
            ans%=M
            
        m+=3
    print(ans+1)

Measured memory_bytes: 9212
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 60;
constexpr auto mod = 1000000007;
constexpr auto MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

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

    int n;
    ll h;
    cin >> n >> h;
    ll a, b;
    vector<pair<ll, char>> k(2 * n);
    FOR(i, 0, n) {
        cin >> a >> b;
        k[2 * i] = { a,'a' };
        k[2 * i + 1] = { b,'b' };
    }

    rSORT(k, [](auto a, auto b) {return a.first > b.first; });
    ll ans = 0;
    int itr = 0;
    while (h > 0) {
        if (k[itr].second == 'a') {
            ans += h / k[itr].first + (bool)(h % k[itr].first);
            h = 0;
        }
        else {
            ans++;
            h -= k[itr++].first;
        }
    }

    cout << ans << "\n";
}

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

int main(){
  int w,h,n;
  cin >> w >> h >> n;
  int ue,sita,hidari,migi;
  ue=h, sita=0, hidari=0, migi=w;
  int x,y,a;
  for(int i=0;i<n;i++){
    cin >> x >> y >> a;
    switch (a) {
      case 1:
        hidari=(hidari<x)?x:hidari;
        break;
      case 2:
        migi=(migi>x)?x:migi;
        break;
      case 3:
        sita=(sita<y)?y:sita;
        break;
      case 4:
        ue=(ue>y)?y:ue;
        break;
    }
  }


  cout << ((ue>sita)?(ue-sita):0)*((migi>hidari)?(migi-hidari):0) << endl;



  return 0;
}


Measured memory_bytes: 256
var
  s1,s2,s3:ansistring;
  i:longint;
  b:boolean;
begin
  readln(s1);
  readln(s2);
  if length(s1)<length(s2) then
    begin
      s3:=s1; s1:=s2; s2:=s3;
    end;
  if(length(s1)<>length(s2))then b:=true;
  if b then
    begin
      for i:=1 to length(s1)-1 do write(s1[i],s2[i]);
      write(s1[length(s1)]);
    end
    else
      begin
        for i:=1 to length(s1) do write(s1[i],s2[i]);
      end;
end.

Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		int array[] = new int[3];
		
		array[0] = a;
		array[1] = b;
		array[2] = c;
		
		Arrays.sort(array);
		
		System.out.println(array[2] * 10 + array[1] + array[0]);

	
	}
}

Measured memory_bytes: 22612
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    val x = sc.nextInt()
    val y = sc.nextInt()

    var sum = a * x + b * y

    if (c * 2 >= a + b) {
        println(sum)
        return
    }

    var c_count = Math.min(x, y)

    var x_rest = x - c_count
    var y_rest = y - c_count

    c_count *= 2

    while (x_rest != 0 ||  y_rest != 0) {
        if ((Math.min(x_rest, 1) * a + Math.min(y_rest, 1) * b) > c * 2) {
            x_rest = Math.max(0, x_rest - 1)
            y_rest = Math.max(0, y_rest - 1)
            c_count += 2
        } else {
            break
        }
    }

    println(x_rest * a + y_rest * b + c_count * c )

}


Measured memory_bytes: 29732
#include "bits/stdc++.h"
using namespace std;
using lint = long long;
const int INF = 1e9;

signed main(){
  int N, Q; string s; cin >> N >> s >> Q;
  vector<set<int> > alp(26, set<int> {INF});
  for(int i = 0; i < N; i++) alp[s[i] - 'a'].insert(i);
  for(int i = 0; i < Q; i++){
    int t; cin >> t;
    if(t == 1){
      int l; char c; cin >> l >> c; --l;
      if(s[l] != c){
        alp[s[l] - 'a'].erase(l);
        alp[c - 'a'].insert(l);
        s[l] = c;
      }
    }
    if(t == 2){
      int l, r; cin >> l >> r; --l;
      int ans = 0;
      for(int c = 0; c < 26; c++){
        if(alp[c].empty()) continue;
        if(*alp[c].lower_bound(l) < *alp[c].lower_bound(r)) ans++;
      }
      cout << ans << '\n';
    }
  }
}

Measured memory_bytes: 26244
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;


int main(){
  ll a,b,c;
  cin >> a >> b >> c;

  cout << (a+b>=c?"Yes":"No")<< endl; 
  return 0;
}


Measured memory_bytes: 256