akhauriyash/Code-Regression huggingface dataset:
import sys

def main():
    input = sys.stdin.readline

    N = int(input())
    P = list(map(int,input().split()))

    #result = list()

    minimum = P[0]
    count = 1
    for i in range(N):
        if(minimum > P[i]):
            minimum = P[i]
            count += 1
    print(count)
#        Pj = list(P[j] for j in range(i+1))
        #print(Pj)
        #Pj = P[0:i+1]
#        min_P = min(Pj)
#        result.append(min_P)
#        print(min_P)
#        if(P[i] == min_P):
#            count += 1

    '''
    count = 0
    flag = True

    for i in range(N):
        for j in range(i):
            if(P[i] > P[j]):
                flag = False
                break
        if(flag):
            count += 1
        flag = True
    print(count)
    '''

if __name__ == "__main__":
    main()

Measured memory_bytes: 24596
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <utility>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define pb push_back

const int inf = 999999999;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main(){
	int a[3], even = 0, ans = 0;
	Rep(i, 3){
		cin >> a[i];
		if(a[i] % 2 == 0){
			even++;
		}
	}
	if(even % 3 == 0){
	}else if(even == 1){
		Rep(i, 3){
			if(a[i] % 2 == 0){
				ans += 1;
				a[i] -= 1;
			}
		}
	}else if(even == 2){
		Rep(i, 3){
			if(a[i] % 2 == 1){
				ans += 1;
				a[i] -= 1;
			}
		}
	}
	sort(a, a + 3);
	ans += (a[2] * 2 - a[1] - a[0]) / 2;
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;



public class Main {
	public static class FastReader {
			BufferedReader br;
			StringTokenizer root;
			
	 
			public FastReader() {
				br = new BufferedReader(new InputStreamReader(System.in));
			}
	 
			String next() {
				while (root == null || !root.hasMoreTokens()) {
					try {
						root = new StringTokenizer(br.readLine());
					} catch (Exception addd) {
						addd.printStackTrace();
					}
				}
				return root.nextToken();
			}
	 
			int nextInt() {
				return Integer.parseInt(next());
			}
	 
			double nextDouble() {
				return Double.parseDouble(next());
			}
	 
			long nextLong() {
				return Long.parseLong(next());
			}
	 
			String nextLine() {
				String str = "";
				try {
					str = br.readLine();
				} catch (Exception addd) {
					addd.printStackTrace();
				}
				return str;
			}
		}
	 
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	public static FastReader sc = new FastReader();
 
	static int mod = (int)(1e9+7),MAX=(int)(1e5+10);
	static List<int[]>[] edges;
	
	public static void main(String[] args) throws IOException{
	
		 char a = sc.next().charAt(0);
		 if(Character.isUpperCase(a)) out.print("A");
		 else out.print("a");
	    
	  out.close();
	}
}

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

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(void){
    int n;
    scanf("%d", &n);
    int num[n];
    for (int i = 0; i < n; i++){
        scanf("%d", &num[i]);
    }
    qsort(num, n, sizeof(int), compare_int);
    int ans = 0;
    for (int i = 0; i < n; i++){
        if(i % 2 == 0){
            ans += num[i];
        }
        else ans -= num[i];
    }
    printf("%d\n", abs(ans));
    return 0; 
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			int N, Q;
			N = Integer.parseInt(line.substring(0, line.indexOf(' ')));
			Q = Integer.parseInt(line.substring(line.indexOf(' ') + 1));

			int[] years = new int[51];
			String[] names = new String[N + 1];

			int yearPrev = 1;
			int idxPrev = 0;
			names[idxPrev] = "kogakubu10gokan";

			for (int i = 0; i < N; i++) {
				line = br.readLine();
				int yearNext = Integer.parseInt(line.substring(0, line.indexOf(' ')));
				names[idxPrev + 1] = line.substring(line.indexOf(' ') + 1);
				for (int j = yearPrev; j < yearNext; j++) {
					years[j] = idxPrev;
				}
				yearPrev = yearNext;
				idxPrev++;
			}
			for (int j = yearPrev; j < 51; j++) {
				years[j] = idxPrev;
			}
			System.out.println(names[years[Q]]);
		}
	}
}

Measured memory_bytes: 17056
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
int main(){
    ld x; 
    cin >> x;
    ld a=100; 
    ld k=0;
    while(x>a){
        ld j=a/100;
        ll b = floor(j);
        a = a + b;
        k++;
    }
    cout << k << endl;
}

Measured memory_bytes: 3788
#include <iostream>
using namespace std;
int n, ans = 0, j;
bool a[100005];
int main()
{
	cin >> n;
	for(int i = 1; i <=n; i++)
	{
		a[i] = false;
	}
	for(int i = 1; i <= n; i++)
	{
		cin >> j;
		if(a[j] == true)
		{
			ans++;
		}
		else
		{
			a[j] = true;
		}
	}
	if(ans % 2 == 1) ans++;
	cout << n - ans << endl;
	return 0;
}

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

string s;
cin >> s;

cout << s.at(0) << s.size()-2 << s.at(s.size()-1) << endl;
return 0;

}

Measured memory_bytes: 256
package main

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

// IO struct
type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func newIO() *IO {
	return &IO{
		scanner: bufio.NewScanner(os.Stdin),
		writer:  bufio.NewWriter(os.Stdout),
	}
}

func (IO *IO) nextLine() string {
	IO.scanner.Scan()
	return IO.scanner.Text()
}

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

func (IO *IO) nextInt64() int64 {
	a, _ := strconv.ParseInt(IO.nextLine(), 10, 64)
	return a
}

func (IO *IO) scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		num = IO.nextInt()
		nums = append(nums, num)
	}
	return
}

func (IO *IO) printLn(a ...interface{}) {
	fmt.Fprintln(IO.writer, a...)
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

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

func sumSlice(nums []int) int {
	sum := 0
	for _, n := range nums {
		sum += n
	}
	return sum
}

func binarySearch(target int, list []int) int {
	left := 0
	right := len(list) - 1
	mid := (left + right) / 2

	for {
		if list[mid] < target {
			left = mid + 1
		} else {
			right = mid
		}
		mid = (left + right) / 2
		if left >= right {
			break
		}
	}
	return mid
}

// <<<<<<< functions for 2D array
type array2D [][]int

func (a array2D) Len() int {
	return len(a)
}

func (a array2D) Less(i, j int) bool {
	// return a[i][0] < a[j][0] // sort by 1st arg
	return a[i][1] < a[j][1] // sort by 2nd arg
}

func (a array2D) Swap(i, j int) {
	a[i], a[j] = a[j], a[i]
}

func (a array2D) sort() {
	sort.Sort(a)
}

// >>>>>>> functions for 2D array

var io = newIO()

func main() {
	io.scanner.Split(bufio.ScanWords)      // switch to separating by space
	io.scanner.Buffer([]byte{}, 100000009) // switch to read large size input
	defer io.writer.Flush()

	N := io.nextInt()
	robots := array2D{}

	for i := 0; i < N; i++ {
		x := io.nextInt()
		arm := io.nextInt()
		robot := []int{x, x + arm}
		robots = append(robots, robot)
	}

	robots.sort()
	count := 0
	lastR := int(-1e10)
	for _, robot := range robots {
		x := robot[0]
		r := robot[1]
		l := x - (r - x)
		if l < lastR {
			count++
		} else {
			lastR = r
		}
	}
	io.printLn(N - count)
}


Measured memory_bytes: 11264
c=[]
for i in range(3):
    c.append(list(map(int,input().split())))
for i in range(2):
    for j in range(2):
        if c[j][i]-c[j][i+1]!=c[j+1][i]-c[j+1][i+1]:
            print('No')
            exit()
        if c[j][i]-c[j+1][i]!=c[j][i+1]-c[j+1][i+1]:
            print('No')
            exit()
print('Yes')

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

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

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(make_pair(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
const int mod = 1000000007;

int main() {
    int a, b;
    cin >> a >> b;
    if(2 * b >= a) {
        cout << 0 << endl;
    } else {
        cout << a - 2 * b << endl;
    }
    return 0;
}

Measured memory_bytes: 3572
#include<iostream>
using namespace std;
int main()
{
	int n,m,c,count=0,sum,i,j;
	cin>>n>>m>>c;
	int *b,**a;
	b = new int[m];
        a = new int*[n];
	for(i=0;i<n;i++)
	{
           a[i]=new int[m];
	}
	for(i=0;i<m;i++)
		cin>>b[i];

	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			cin>>a[i][j];
			a[i][j]*=b[j];
		}
	}
	for(i=0;i<n;i++)
	{
		sum=0;
		for(j=0;j<m;j++)
	        {
			sum+=a[i][j];
		}
		if(sum+c>0)
			count++;
	}
	cout<<count;

}


Measured memory_bytes: 3592
//In the name of ALLAH
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
const bool DEBUG = false;
#define cerr if(DEBUG)cerr
using namespace std;

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

const long long maxn = 2e5 + 5;
const long long INF = 1e18 + 1;
const long long M = 1e9 + 7;
const int lg = 21;

int n, k;
string s;
char c = 'z';
vector<int> v[26];
vector<string> g;
vector<char> p;

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> s >> k;
	n = s.size();
	for(int i = 0; i < n; i++)
		p.pb(s[i]), v[s[i] - 'a'].pb(i);
	sort(p.begin(), p.end());
	auto it = unique(p.begin(), p.end());
	p.resize(distance(p.begin(), it));
	for(int i = 0; i < p.size(); i++){
		int c = p[i] - 'a';
		vector<string> S;
		if(v[c].size() >= k){
			for(auto u : v[c]){
				string t;
				t.pb(c + 'a');
				S.pb(t);
				for(int j = u + 1; j < min(n, u + k + 1); j++){
					t.pb(s[j]);
					S.pb(t);
				}
			}

			sort(S.begin(), S.end());
			auto it = unique(S.begin(), S.end());
			S.resize(distance(S.begin(), it));

			cout << S[k - 1] << endl;
			return 0;
		}
		for(auto u : v[c]){
			string t;
			t.pb(c + 'a');
			S.pb(t);
			for(int j = u + 1; j < n; j++){
				t.pb(s[j]);
				S.pb(t);
			}
		}
		sort(S.begin(), S.end());
		auto it = unique(S.begin(), S.end());
		S.resize(distance(S.begin(), it));
		
		if(S.size() < k)
			k = k - (S.size());
		else
			return cout << S[k - 1] << endl, 0;
	}	
	return 0;
}


Measured memory_bytes: 1916
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
#define PI 3.14159265358979323846
using namespace std;
//
int main(){
  string S;
  cin>>S;
  int cnt=0;
  FOR(i,0,6){
    if(S[i]=='1'){
      cnt++;
    }
  }
  cout<<cnt<<endl;
  return 0;
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int n;

signed main() {
    cin >> n;
    cout << (n-2) * 180 << endl;
}


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

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;

lli n,k;
vll a;
map<lli,lli> m;
vll ans;

int main(){
  cin >> n >> k;
  a = vll(n);
  for(lli i = 0;i < n;i++) cin >> a[i];
  for(lli i = 0;i < n;i++){
    m[a[i]]++;
  }
  for(auto itr = m.begin();itr != m.end();itr++){
    ans.push_back(itr->second);
  }
  sort(ans.begin(),ans.end());
  if(ans.size() <= k) cout << 0 << endl;
  else cout << accumulate(ans.begin(),ans.end()-k,0) << endl;
  return 0;
}


Measured memory_bytes: 16500
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        //var num = ToInt32(ReadLine());
        var ar = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var hasgset = new HashSet<int>();
        for(var i = 0; i < 4; i++)
        {
            if (ar[i] == 1 || ar[i] == 9 || ar[i] == 7 || ar[i] == 4)
                hasgset.Add(ar[i]);
        }
        WriteLine(hasgset.Count == 4 ? "YES" : "NO");
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, d;
  cin >> n >> d;
  d = 2 * d + 1;
  int a = n % d != 0 ? 1 : 0;
  out(n / d + a);
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String get,ans;
		get = sc.nextLine();
		sc.close();
		ans = get.substring(0, 4)+" "+get.substring(4,12);
		System.out.println(ans);
	}

}

Measured memory_bytes: 10068
h1=Hash.new(0)
max=""
arr=gets.chomp.split(nil)
arr.each do |item|
    h1[item]+=1
    max=item if (item.length>max.length)
end
h2=h1.sort{|a,b|a[1]<=>b[1]}.reverse!
puts "#{h2[0][0]} #{max}"

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int k, a, b;
    cin >> k >> a >> b;
    for (int i=a; i<=b; ++i) {
        if (i%k == 0) {
            cout << "OK" << '\n';
            return;
        }
    }
    cout << "NG" << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3648
n = int(input())
a = []
xy = [[] for i in range(n)]
for i in range(n):
  a.append(int(input()))
  for j in range(a[i]):
    xy[i].append(list(map(int, input().split())))

tf = [0]*n
ans = 0
for i in range(2**n):
  for j in range(n):
    if (i >> j) & 1:
      tf[j] = 1
    else:
      tf[j] = 0
  b = 1
  for k in range(n):
    if tf[k] == 1:
      for l in range(a[k]):
        if tf[xy[k][l][0]-1] != xy[k][l][1]:
          b = 0
          break
  if b == 1 and sum(tf) > ans:
    ans = sum(tf)

print(ans)

Measured memory_bytes: 3188
#include<stdio.h>

int pr[78498];
int x = 0;

int nextpr(int p){
  int nxp = p+2;
  int i;
  int ok;
  x++;
  if(p==2)return 3;
  while(1){
      /*printf("p=%d->",nxp);*/
    for(i=0;pr[i]*pr[i]<=nxp;i++){
      ok = 1;
      if(!(nxp%pr[i])){
        ok = 0;
        break;
      }
    }
    if(ok){
      return nxp;
    }else{
      nxp+=2;
    }
  }
}

int main(){
    int n;
    int i,j=0;
    pr[0] = 2;
    while(scanf("%d",&n)!=EOF&&j<30){
        /*printf("n=%d\n",n);*/
        i=0;
        if(n-1){
            while(pr[i]<=n){
                /*printf("prime:%d(%d)\n",pr[i],i+1);*/
                i++;
                if(i>=x){
                    pr[i] = nextpr(pr[i-1]);
                }
            }
        }
        printf("%d\n",i);
        j++;
    }
}

Measured memory_bytes: 1324
#include <iostream>
#include "string.h"
using namespace std;
int main(){
int a,b,c;
string s1,s2,s3;
cin>>s1>>s2>>s3;
    a=(int)s1[0]-32;
         cout<<(char)a;
    b=(int)s2[0]-32;
         cout<<(char)b;
    c=(int)s3[0]-32;
         cout<<(char)c<<"\n";
}


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


const long long MAXVAL = (long long) 1e18 + 1;
const long long MOD = 1000000007;
const int INF = 1000000000 + 1;

long long poww(int x, long long pow) {
  if (pow == 0ll ) return 1;
  if (pow == 1ll) return x % MOD;
  long long ans = poww(x, pow >> 1) % MOD;
  ans = (ans * ans) % MOD;
  if ((pow & 1) == 1) {
    ans = (ans * x ) % MOD;
  }
  return ans % MOD;
}

void dfs(int curcol, int v, vector<vector<int>>& gr, vector<int>& col) {
  col[v] = curcol;
  for (int next : gr[v]) {
    if (col[next] < 0) {
      dfs(curcol, next, gr, col);
    }
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int q = 1;
  //cin >> q;

  while (q-- >0) {
    string s;
    cin>> s;
    for (int i = 0;i < s.length(); ++i) s[i] = (s[i] == '?' ? 'D' : s[i]);
    cout << s << endl;
  }
  return 0;
}



Measured memory_bytes: 3772
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

ll dp[20][20];

int main() {
  int test;
  scanf("%d", &test);
  while (test--) {
    MEMSET(dp, 0);
    dp[0][0] = 1;
    set<vector<int> > ban;
    int w, h, n;
    scanf("%d %d %d", &w, &h, &n);
    REP(iter, n) {
      int x1, y1, x2, y2;
      scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
      vector<int> b(4);
      b[0] = x1;
      b[1] = y1;
      b[2] = x2;
      b[3] = y2;
      ban.insert(b);
      swap(b[0], b[2]); swap(b[1], b[3]);
      ban.insert(b);
    }
    REP(y, h + 1) REP(x, w + 1) {
      REP(dir, 2) {
        const int dx[2] = { 1, 0 };
        const int dy[2] = { 0, 1 };
        int nx = x + dx[dir];
        int ny = y + dy[dir];
        vector<int> b(4);
        b[0] = x;
        b[1] = y;
        b[2] = nx;
        b[3] = ny;
        if (ban.count(b)) { continue; }
        dp[ny][nx] += dp[y][x];
      }
    }

    if (dp[h][w] == 0) {
      puts("Miserable Hokusai!");
    } else {
      printf("%lld\n", dp[h][w]);
    }
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

const int mod = 998244353;

long long int mypow(long long int a, long long int b) {
    if (b == 0) return 1;
    if (b == 1) return a;
    long long int res = mypow(a, b / 2);
    res = res * res % mod;
    if (b % 2 == 1) res = res * a % mod;
    return res;
}

int main() {
    int n, s;
    cin >> n >> s;
    vector<int> v;
    for (int i = 0; i < n; i++) {
        int t;
        scanf("%d", &t);
        v.push_back(t);
    }
    unordered_map<int, long long int> m1, m2;
    // [sum] = number
    m1[0] = 1;
    long long int res = 0;
    for (int i = 0; i < n; i++) {
        m2 = m1;
        for (auto it = m2.begin(); it != m2.end(); it++) {
            it->second *= 2;
            it->second %= mod;
        }
        for (auto p : m1) {
            if (p.first + v[i] <= s) {
                m2[p.first + v[i]] += p.second;
                m2[p.first + v[i]] %= mod;
            }
        }
        m1 = m2;
    }
    cout << m1[s] << endl;
}


Measured memory_bytes: 3956
import java.util.*;

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

        int prevT = 0;
        int prevX = 0;
        int prevY = 0;

        for(int i = 0; i < t; i++) {
            int curT = sc.nextInt();
            int curX = sc.nextInt();
            int curY = sc.nextInt();

            int dist = Math.abs(curX - prevX) + Math.abs(curY - prevY);
            int diffT = curT - prevT;
            if(diffT < dist || dist % 2 != diffT % 2) {
                System.out.println("No");
                return;
            }

            prevT = curT;
            prevX = curX;
            prevY = curY;
        }


        
        System.out.println("Yes");
    }
}


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

int main() {
  int N; double ans = 0;
  cin >> N;
  for (int i = 1; i <= N; ++i) {
    double m; string str;
    cin >> m >> str;
    if (str == "JPY") ans += m;
    else ans += m * 380000.0;
  }
  printf("%.9lf\n", ans);
  return 0;
}

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


int main() {

long int N;

cin >>N;

long int a[300000];

for(long int i=1; i<=N; i++){
cin >>a[i];
a[i]=a[i]-i;}

sort(a+1,a+N+1);

long int b;
b=a[(N+1)/2];

long int ans;
for(long int i=1; i<=N; i++){
ans=ans+abs(a[i]-b);
}

cout <<ans;

}



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

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let m: i64 = iter.next().unwrap().parse().unwrap();
    let mut a: Vec<i64> = vec![];
    let mut b: Vec<i64> = vec![];

    for _ in 0..n {
        a.push(iter.next().unwrap().parse().unwrap());
        b.push(iter.next().unwrap().parse().unwrap());
    }

    let mut p: Vec<usize> = (0..n).collect();
    p.sort_by(|p,q| a[*p].cmp(&a[*q]));
    let mut ans = 0_i64;
    let mut buyed = 0;
    for i in p {
        //println!("{} {}", a[i], b[i]);
        let buy = std::cmp::min(m - buyed, b[i]);
        if buy == 0 { break; }
        buyed += buy;
        ans += buy * a[i];
    }
    println!("{}", ans);
}


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

string S[3];

int main()
{
	for (int i = 0; i < 3; ++i)
		cin >> S[i];
	int i = 0;
	while (1) {
		if (S[i].empty()) {
			break;
		}
		auto c = S[i].front();
		S[i].erase(0, 1);
		i = c - 'a';
	}
	cout << (char)('A' + i) << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())

a_list = list(map(int, input().split()))

if n != 0 :
    ans = a_list[0]
else :
    ans = 0

if 0 in a_list :
    ans = 0

for i in range(1, n):
    ans = ans * a_list[i]

    if 10**18 < ans :
        ans = -1
        break

print(ans)

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N),B(N),C(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  for(int i=0;i<N;i++){
    cin >> B.at(i);
  }
  for(int i=0;i<N;i++){
    cin >> C.at(i);
  }
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  sort(C.begin(),C.end());
  int64_t ans=0;
  int64_t j=0;
  int64_t k=0;
  for(int i=0;i<N;i++){
    for(;j<N;j++){
      if(B.at(i)<=A.at(j)){
        break;
      }
    }
    for(;k<N;k++){
      if(B.at(i)<C.at(k)){
        break;
      }
    }
    ans+=j*(C.size()-k);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4556
#include <iostream>
#include <map>
#include <string>
#include <complex>
#include <vector>
#include <cmath>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

int main() {
    int n;
    while(cin >> n && n) {
        double s1 = 0, t1 = 0;
        double cur = 0;
        rep(i,n-1){
            double t; cin >> t;
            s1 += sin(t/180*acos(-1));
            cur += t;
        }
        s1 += sin((360-cur)/180*acos(-1));

        cin >> n;
        cur = 0;
        rep(i,n-1){
            double t; cin >> t;
            t1 += sin(t/180*acos(-1));
            cur += t;
        }
        t1 += sin((360-cur)/180*acos(-1));

        if(abs(s1-t1) < 1e-8) cout << 0 << endl;
        else if(s1 > t1) cout << 1 << endl;
        else if(s1 < t1) cout << 2 << endl;
    }
}

Measured memory_bytes: 1268
#define _USE_MATH_DEFINES // for C++  
#include <cmath> 
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <iterator>
#include <utility>
#include <set>
#include <random>
#include <map>
#include <stack>
#include <queue>
#include <list>
#include <functional>
#include <bitset>
#define LL long long

using namespace std;

int main() {
    int n, s = 0;
    int flag = 0;
    cin >> n;
    vector<int> v(n);
    for (size_t i = 0; i < n; i++)
    {
        cin >> v[i];
        s += v[i];
        if (i == 0)
        {
            if (v[i] % 10 == 0)
            {
                flag = 1;
            }
            else
            {
                flag = 0;
            }
        }
        else
        {
            if (v[i] % 10 == 0 && flag == 1)
            {
                flag = 1;
            }
            else
            {
                flag = 0;
            }
        }
    }
    if (flag == 1)
    {
        s = 0;
    }
    else
    {
        if (s % 10 == 0)
        {
            sort(v.begin(), v.end());
            for (size_t i = 0;; i++)
            {
                if (v[i] % 10 != 0)
                {
                    s -= v[i];
                    break;
                }
            }
        }
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int X1, Y1, X2, Y2, N; 
	cin >> X1 >> Y1 >> X2 >> Y2 >> N; 
	double pi = acos(-1); 
	double cut = 20 - 5 * pi; 
	int INF = 1145141919; 
	if(X2 < X1){
		swap(X1, X2); swap(Y1, Y2); 
	}
	bool inv = false; 
	if(Y2 < Y1){
		Y1 *= -1; Y2 *= -1; inv = true; 
	}
	vector<pair<int, int>> F;
	for(int i = 0; i < N; i++){
		int x, y; cin >> x >> y; 
		if(inv) y *= -1; 
		if(x >= X1 && x <= X2 && y >= Y1 && y <= Y2){
			F.push_back(make_pair(x, y)); 
		}
	}
	sort(F.begin(), F.end()); 
	int LIS[200010] = {}; 
	fill(LIS, LIS + 200005, INF); 
	for(int i = 0; i < F.size(); i++){
		int a = lower_bound(LIS, LIS + 200005, F[i].second) - LIS; 
		LIS[a] = F[i].second; 
	}
	int fountain = lower_bound(LIS, LIS + 200005, INF) - LIS; 
	double ans = 100.0 * ((double) X2 - X1 + Y2 - Y1) - cut * fountain;
	if(fountain == min(X2 - X1, Y2 - Y1) + 1) ans += 5 * pi;
	cout.precision(20); 
	cout << ans << endl; 
}

Measured memory_bytes: 3444
#include <stdio.h>

int main(void)
{
  int a, b;
  scanf("%d%d", &a, &b);
  if(a < b)
    { printf("a < b\n");
    }
  else if(a > b)
    { printf("a > b\n");
    }
  else if(a == b)
    { printf("a == b\n");
    }
  return 0;
}

Measured memory_bytes: 576
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        int count = 0;
        int numberCount = sc.nextInt();
        long[] numbers = new long[numberCount];
        for (int i = 0; i < numbers.length; i++) {
            numbers[i] = sc.nextLong();
        }
        
        while (true) {
            boolean end = false;
            for (int i = 0; i < numbers.length; i++) {
                if (numbers[i] % 2 == 1) {
                    end = true;
                    break;
                }
                
                numbers[i] = numbers[i] / 2;
            }
            
            if (end) break;
            count++;
        }
        
        System.out.println(count);
    }
}

Measured memory_bytes: 23764
from functools import reduce
import math

def main():
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    a, b = (int(_) for _ in input().split())
    if a == 1:
        a = 14
    if b==1:
        b = 14
        
    if a>b:
        ans = 'Alice'
    elif a == b:
        ans = 'Draw'
    else:
        ans = 'Bob'
        
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
function Main(input) {

    input = input.split("\n");
    
    N = Number(input[0]);
    let An = input[1].split(" ").map(Number);
    
    if (gcd(An) !== 1) {
        console.log("not coprime");
        return;
    }
        
    let freq = Array(1000001).fill(0);
    for(let A of An) {
        if (A === 1) continue;
        freq[A]++;
    }
    
    for (let i = 2; i <= 1000001; i++) {
        let tmp = 0;
        for (let j = i; j <= 1000001; j += i) {
            tmp += freq[j];
            if (tmp >= 2) {
                console.log("setwise coprime");
                return;
            }
        }
    }
    
    console.log("pairwise coprime");
    
}

function gcd(arg) {
    
    let f = (a, b) => b ? f(b, a % b) : a
    let ans = arg[0];
    for (let i = 1; i < arg.length; i++) {
        ans = f(ans, arg[i]); 
    }
    return ans;
    
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 122204
#include <iostream>

using namespace std;

int main(void) {
    int X,Y;
    cin >> X >> Y;
    int ans = 0;
    if(X == 1) {
        ans += 300000;
    } else if(X == 2) {
        ans += 200000;
    } else if(X == 3) {
        ans += 100000;
    }
    if(Y == 1) {
        ans += 300000;
    } else if(Y == 2) {
        ans += 200000;
    } else if(Y == 3) {
        ans += 100000;
    }
    if(X == 1 && Y == 1) {
        ans += 400000;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>
#include<map>

using namespace std;

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

typedef vector<int> vec;
typedef vector<vec> mat;

const ll mod = 1000000007;



int main(){
    int n;
    cin >> n;
    vector<vector<int> > v(n);
    vector<P> dec;
    rep(i, n - 1){
        int x, y;
        cin >> x >> y;
        x--; y--;
        if(x > y) swap(x, y);
        dec.push_back(P(x, y));
        v[x].push_back(y);
        v[y].push_back(x);
    }
    vector<bool> visited(n, false);
    queue<P> que;
    que.push(P(0, 0));
    visited[0] = true;
    int k = 0;
    map<P, int> mp;
    while(que.size() > 0){
        P p = que.front();
        que.pop();
        int e = p.first;
        int num = p.second;
        int num_ = 1;
        rep(i, v[e].size()){
            int x = e, y = v[e][i];
            if(visited[y]) continue;
            if(num_ == num) num_++;
            visited[y] = true;
            que.push(P(y, num_));
            if(x > y) swap(x, y);
            mp.insert(make_pair(P(x, y), num_));
            k = max(k, num_);
            num_++;
        }
    }
    cout << k << endl;
    rep(i, n - 1){
        cout << mp.at(dec[i]) << endl;
    }
}

Measured memory_bytes: 15908
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 998244353;
ll pow_mod (ll a, ll b) {
    if (b == 0) return 1;
    ll k = pow_mod(a, b/2);
    k *= k;
    k %= mod;
    if (b % 2 == 0) return k;
    return (k*a) % mod;
}
ll n[200010] = {1};
ll nCm (ll a, ll b) {
    ll X = n[a], Y = (n[b]*n[a-b]) % mod;
    return (X*pow_mod(Y, mod-2)) % mod;
}
int main () {
    ll N, M, K;
    cin >> N >> M >> K;
    for (int i = 1; i < N; i++) {
        n[i] = (n[i-1]*i) % mod;
    }
    ll ans = pow_mod(M, N);
    for (int k = K+1; k <= N-1; k++) {
        ll res = M*pow_mod(M-1, N-k-1);
        res %= mod;
        res *= nCm(N-1, k);
        res %= mod;
        ans -= res;
        ans %= mod;
    }
    ans += mod+mod;
    ans %= mod;
    cout << ans << endl;
}

Measured memory_bytes: 5196
n = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)
cnt = 1
ans = a[0]
for ai in a[1:]:
    if cnt + 2 >= n-1:
        ans += ai * (n-1-cnt)
        break
    ans += 2 * ai
    cnt += 2

print(ans)



Measured memory_bytes: 94212
#include<bits/stdc++.h>
using namespace std;
#define V vector
#define L long long
#define W V<L>
#define R(n) for(L i=0;i<n;i++)
L E=70;W S(V<W>p){if(!E){return{1,0};}V<V<W>>T(2);for(W x:p){T[x[1]&1].push_back({x[0]/2,x[1]/2});if(x[0]&1){T[(x[1]+1)&1].push_back({x[0]/2,(x[1]+1)/2});}}R(2){L c=0;for(W x:T[!i]){L Q=(2*x[0]+x[1])%3;c^=Q+1;}if(!c){E--;W A=S(T[i]);A[0]*=2;A[1]*=2;A[1]+=i;return A;}}for(W&v:p){v[0]++;}W A=S(p);A[0]--;return A;}
int main(){L M=2e17,n;cin>>n;V<W>p(n);R(n){L a,b;cin>>a>>b;p[i]={a+M,b+M};}W x=S(p);cout<<x[0]-M<<" "<<x[1]-M;}

Measured memory_bytes: 62908
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	x := readInt()

	y := 100
	n := 0
	for {
		y = int(float64(y) * 1.01)
		n++
		if y >= x {
			break
		}
	}
	fmt.Println(n)
}


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

int main() {
    int i, j;
    int n, k;
    char s[51];

    scanf("%d %d\n", &n, &k);
    scanf("%s\n", s);
    s[k-1] -= ('A' - 'a');

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

    return 0;
}


Measured memory_bytes: 128
module mod_two_dim_merge_sort
  implicit none
  integer, private, parameter :: intkind = 8
contains
  logical function less(a, b) result(res)
    integer(intkind), intent(in) :: a(:), b(:)
    real(8) :: a1, b1
    a1 = a(1) / real(a(2) + 1, 8)
    b1 = b(1) / real(b(2) + 1, 8)
    res = a1 > b1 .or. (a1 == b1 .and. a(2) >= b(2))
  end
  subroutine merge_sort(a)
    integer(intkind), intent(inout) :: a(:, :)
    integer :: n, m, l, i, u
    n = size(a, 1)
    m = n
    l = 1
    do while (m > 1)
      do i = 1, m / 2
        u = min(2 * i * l, n)
        call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), &
        a((2 * i - 1) * l + 1:u, :))
      end do
      l = 2 * l
      m = (m + 1) / 2
    end do
  end
  subroutine merger(a1, a2)
    integer(intkind), intent(inout) :: a1(:, :), a2(:, :)
    integer(intkind) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))
    integer :: i1, i2, n1, n2
    i1 = 1
    i2 = 1
    n1 = size(a1, 1)
    n2 = size(a2, 1)
    do while (i1 <= n1 .and. i2 <= n2)
      if (less(a1(i1, :), a2(i2, :))) then
        a(i1 + i2 - 1, :) = a1(i1, :)
        i1 = i1 + 1
      else
        a(i1 + i2 - 1, :) = a2(i2, :)
        i2 = i2 + 1
       end if
    end do
    if (i1 <= n1) then
      a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)
    else
      a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)
    end if
    a1 = a(1:n1, :)
    a2 = a(n1 + 1:n1 + n2, :)
  end
end module mod_two_dim_merge_sort
program manga_market
  use mod_two_dim_merge_sort
  implicit none
  integer(8), parameter :: inf = 3e18
  integer, parameter :: k = 30
  integer :: n, l, i, j, m = 0
  integer(8) :: t, r, tmp
  integer(8), allocatable :: c(:, :), dp(:), s(:)
  read(*,*) n, t
  allocate(c(n, 2))
  do i = 1, n
    read(*,*) c(i, :)
  end do
  call merge_sort(c(1:n, 1:2))
  l = n + 1
  do while (c(l - 1, 1) == 0)
    l = l - 1
  end do
  allocate(dp(0:k), s(0:n - l + 1))
  dp = inf
  dp(0) = 0
  do i = 1, l - 1
    do j = min(k, i), 1, -1
      if (dp(j - 1) > t) cycle
      tmp = dp(j - 1) + 1
      dp(j) = min(dp(j), tmp + c(i, 1) * tmp + c(i, 2))
    end do
  end do
  s(0) = 0
  do i = n, l, -1
    s(n - i + 1) = s(n - i) + c(i, 2) + 1
  end do
  do i = 0, min(k, l - 1)
    r = t - dp(i)
    if (r < 0) cycle
    do j = 0, n - l + 1
      if (s(j) > r) exit
      m = max(m, i + j)
    end do
  end do
  write(*,'(i0)') m
end program manga_market

Measured memory_bytes: 9928
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define N 2000010
int n;
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};

vi fac(N+1);
void fact()
{
    fac[0] = 1;
    for(int i = 1; i<= N; i++)
        fac[i] = 1LL*fac[i-1]*i%mod;
}


ll bigmod(ll x, ll p)
{
    ll res = 1;
    while(p)
    {
        if(p&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        p >>= 1;
    }
    return res;
}


ll ncr(int n, int r)
{
    ll res = (fac[n] * bigmod(1LL*fac[r] * fac[n-r]%mod, mod - 2))%mod;
    return res;
}



//=============================================ASIFAZAD==============================================//

int32_t main()
{
    io;
    fact();
    int r1, c1, r2, c2;
    cin>>r1>>c1>>r2>>c2;
    ll ans = 0;
    for(int i = c1; i <= c2; i++)
        ans = (ans + ncr(r2+i+1, i+1) - ncr(r1+i, i+1) + mod)%mod;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 10948
#include<iostream>
using namespace std;
int main()
{
  int N;
  int t[110000],x[110000],y[110000];
  cin>>N;
  t[0]=x[0]=y[0]=0;
  for (int i =0; i<N; ++i) cin>>t[i+1]>>x[i+1]>>y[i+1];
  
  
  bool can = true;
  for (int i =0; i<N; ++i){
    int dt =t[i+1]-t[i];
    int dist = abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
                     if (dt < dist) can =false;
                     if (dist%2!=dt%2)can =false;
  }
                     
       if(can) cout <<"Yes" <<endl;
       else cout <<"No"<<endl;
}
                     

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(9,0);
    for(int i = 0; i < n; i++){
        int t;
        cin>>t;
        if(t<3200)
            a[t/400]++;
        else
            a[8]++;
    }
    int count=0;
    for(int i = 0; i < a.size()-1; i++){
        if(a[i]>0)
            count++;
    }
    if(a[8]!=n)
        cout<<count<<" "<<count+a[8];
    else
        cout<<"1"<<" "<<a[8];
}

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

int main(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a,a+3);
    if(a[0]+a[1]-a[2])cout << "No" << endl;
    else cout << "Yes" << endl;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>
#include <type_traits>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

//~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

int main() {

    int N;
    cin >> N;

    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    multiset<int> mst;
    for (int i = 0; i < N; i++) {
        auto it = mst.lower_bound(A[i]);
        if (distance(mst.begin(), it) == 0) {
            mst.insert(A[i]);
        } else {
            it--;
            mst.erase(it);
            mst.insert(A[i]);
        }
    }

    cout<<mst.size() << endl;

}

































Measured memory_bytes: 5376
class Eratosthenes():  # エラトステネスの篩
    def __init__(self, N):  # 素数リスト生成 O(n*log(log n))
        self.fact = [i for i in range(N + 1)]
        for i in range(2, int(N ** 0.5) + 1):
            if self.fact[i] < i:
                continue
            for j in range(i ** 2, N + 1, i):
                self.fact[j] = i
        self.prime = [i for i in range(2, N + 1) if i == self.fact[i]]

n = int(input())

prime = Eratosthenes(55555).prime
ans = [p for p in prime if p % 5 == 1]
print(*ans[:n])


Measured memory_bytes: 70752
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let mut n: u32 = sc.read();
    let k: u32 = sc.read();
    let v: Vec<u8> = (0..k).map(|_| sc.read::<u8>()).collect();
    loop {
        if !n.to_string().chars().map(|c| (c as u8) - b'0').collect::<Vec<u8>>().iter().any(|&x| v.contains(&x)) {
            println!("{}", n);
            break;
        }else {
            n = n + 1;
        }
    }
}

use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
 
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
 
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

Measured memory_bytes: 4352
package main

import (
        "fmt"
)

func solution(n int, a []int) []int {

        memo := make(map[int]int)
        for i := range a {
                memo[a[i]]++
        }
        var tot int64
        for _, v := range memo {
                tot += combi2(int64(v))
        }
        out := make([]int, n)
        for i := 0; i < n; i++ {
                var ans int64 = tot
                ans -= combi2(int64(memo[a[i]]))
                memo[a[i]]--
                ans += combi2(int64(memo[a[i]]))
                memo[a[i]]++
                out[i] = int(ans)
        }
        return out
}

func combi2(x int64) int64 {
        return x * (x - 1) / 2
}

func main() {
        var n int
        fmt.Scan(&n)
        a := make([]int, n)
        for i := range a {
                fmt.Scan(&a[i])
        }
        for _, t := range solution(n, a) {
                fmt.Println(t)
        }
}

Measured memory_bytes: 16452
#include<bits/stdc++.h>
#define debug(x) cout<<#x<<"="<<x<<endl
typedef long long ll;
using namespace std;
const int maxn = 200009;

int fa[maxn],siz[maxn],son[maxn][2];
struct line{int from,to,val;}a[maxn];
int n,tot;
ll ans[maxn],val[maxn];

inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
bool cmp(const line &x,const line &y){return x.val>y.val;}

void dfs(int x)
{
	int L=son[x][0],R=son[x][1];
	if(L+R==0) return ;
	ans[L]=ans[R]=ans[x];
	ans[L]+=siz[R]*val[x];
	ans[R]+=siz[L]*val[x];
	dfs(L);dfs(R);
}

int main()
{
	n=read();tot=n;
	for(int i=1;i<=n;i++) siz[i]=1,fa[i]=i;
	for(int i=1;i<n;i++) a[i]=(line){read(),read(),read()};
	sort(a+1,a+n,cmp);
	for(int i=1;i<n;i++)
	{
		int x=find(a[i].from),y=find(a[i].to),z=a[i].val;
		tot++;fa[tot]=tot;siz[tot]=siz[x]+siz[y];val[tot]=z;
		fa[x]=fa[y]=tot;
		son[tot][0]=x;son[tot][1]=y;
	}
	dfs(tot);
	for(int i=1;i<=n;i++) printf("%lld\n",ans[i]);
	return 0;
}


Measured memory_bytes: 11136
var
	n,i,p,x,s:Longint;
	t:array[1..100] of Longint;
begin
	read(n);
	for i:=1 to n do begin
		read(t[i]);
		inc(s,t[i]);
	end;
	read(n);
	for i:=1 to n do begin
		read(p,x);
		writeln(s-t[p]+x);
	end;
end.


Measured memory_bytes: 128