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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

using pii = pair<int,int>;

int main() {

    int N,M;
    Scd2(N,M);
    int A,B;

    auto secless = []( pii A, pii B ){ return A.second > B.second; };
    priority_queue< pii, vector<pii>, decltype(secless) > p( secless );
    Rep(i,M){
        Scd2(A,B);
        p.push( pii(A,B) );
    }

    int ans = 0;
    int wall = 0;
    pii tmp;

    while( !p.empty() ){
        tmp = p.top();
        // printf ("%d %d\n", tmp.first, tmp.second );
        if( wall <= tmp.first ){
            wall = tmp.second;
            ans++;
        }
        p.pop();
    }

    printf ("%d\n", ans );

    return 0;
}



Measured memory_bytes: 1400
#include<iostream>
#include<sstream>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<string>
#include<numeric>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using vi = vector<int>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using vpii = vector<pii>;

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

  int cnt = 1;

  rep2(i, 1, N){
    if(S[i] != S[i-1])
      cnt++;
  }

  cout << cnt << endl;
  
  return 0;
}

Measured memory_bytes: 512
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	resolve()
}

func resolve() {
	// load and prepare
	h, w := scanInt(sc), scanInt(sc)
	grid := make([]string, h)
	whiteRow := make([]bool, h)
	whiteNum := make([]int, w)
	for i := 0; i < h; i++ {
		grid[i] = scanString(sc)
		whiteRow[i] = true
		for j := range grid[i] {
			if grid[i][j] != '.' {
				whiteRow[i] = false
			} else {
				whiteNum[j]++
			}
		}
	}

	// build output
	builder := &strings.Builder{}
	for i := 0; i < h; i++ {
		if whiteRow[i] {
			continue
		}
		for j := 0; j < w; j++ {
			if whiteNum[j] == h {
				continue
			}
			builder.WriteByte(grid[i][j])
		}
		builder.WriteByte('\n')
	}
	// write answer
	fmt.Printf("%s", builder.String())
	return
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1924
using AtCoderBeginnerContest124.Questions;
using AtCoderBeginnerContest124.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest124.Questions
{
    public class QuestionB : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var n = inputStream.ReadInt();
            var heights = inputStream.ReadIntArray();

            var max = int.MinValue;
            var count = 0;
            foreach (var height in heights)
            {
                if (max <= height)
                {
                    count++;
                    max = height;
                }
            }

            yield return count;
        }
    }
}


namespace AtCoderBeginnerContest124
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionB();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest124.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest124.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

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

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

  int N;
  cin >> N;

  vector<long long> A(N), B(N), C(N);
  for(size_t i = 0; i < N; i++) cin >> A[i];
  for(size_t i = 0; i < N; i++) cin >> B[i];
  for(size_t i = 0; i < N; i++) cin >> C[i];

  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());

  long long ans = 0;
  for(size_t i = 0; i < N; i++) {
    long long upper = distance(A.begin(), lower_bound(A.begin(), A.end(), B.at(i)));
    long long bottom = N - distance(C.begin(), upper_bound(C.begin(), C.end(), B.at(i)));
    ans += upper * bottom;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 5572
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>

typedef long long ll;
using namespace std;

ll Mod = 1e9 + 7;

int N, Q;
string S;
vector <char> s, t;

int isDropped (int now) {
    for (int i = 0; i < Q; i++) {
        if (now != -1 && now != N && S[now] == s[i]) {
            if (t[i] == 'R') now++;
            else now--;
        }
    }
    if (now == -1) return -1; //left drop
    else if (now == N) return 1; // right drop
    else return 0;
};


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

    for (int i = 0; i < Q; i++) {
		char a, b;
		cin >> a >> b;
		s.push_back(a);
		t.push_back(b);
    }

    int left = 0, right = N;
    // 左に落ちる右端
    while (right - left > 1) {
        int mid = (left + right) / 2;
        if (isDropped(mid) >= 0) {
            right = mid;
        } else {
            left = mid;
        }
    }
    int LE = right;

    // 右に落ちる左端
    left = 0; right = N;
    while (right - left > 1) {
        int mid = (left + right) / 2;
        if (isDropped(mid) <= 0) {
            left = mid;
        } else {
            right = mid;
        }
    }
    int RE = left;
    cout << RE - LE + 1<< endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
#define ld long double
#define MAX 100001
#define MOD 1000000007
#define pii pair<long long , long long >
using namespace std;

vector<int> a,tree;
int type(int temp1, int temp2)
{
    // Change this type according to the question
    // Example - max , min, sum 
    return max(temp1 , temp2);
}
void build(int s =0,int e = a.size()-1, int treeNode = 1)
{
    if(s==e)
    {
        tree[treeNode]=a[s];
        return;
    }
    int mid=(s+e)/2;
    build(s,mid,2*treeNode);
    build(mid+1,e,2*treeNode+1);
    tree[treeNode] = type(tree[2*treeNode] , tree[2*treeNode + 1]);
}
void update(int pos, int val ,int s = 0,int e = a.size()-1,int treeNode = 1)
{
    if(s==e)
    {
        a[pos]=val;
        tree[treeNode]=val;
        return ;
    }
    int mid=(s+e)/2;
    if(pos<=mid)
        update(pos, val, s, mid, 2*treeNode);
    else
        update(pos, val, mid+1, e, 2*treeNode+1);
    tree[treeNode] = type(tree[2*treeNode] , tree[2*treeNode + 1]);
}
int query(int l, int r, int s=0, int e=a.size()-1, int treeNode = 1)
{
    if(s>r||e<l)
        return 0;
    if(s>=l&&e<=r)
        return tree[treeNode];
    int mid=(s+e)/2;
    int left_result = query(l, r, s, mid, 2*treeNode) ;
    int right_result = + query(l, r, mid+1, e, 2*treeNode+1);
    return  type(left_result ,right_result);
}
 
int32_t main()
{
    int n;
    cin>>n;
    int h[n],arr[n];
    for(int i=0;i<n;++i)
        cin>>h[i];
    for(int i=0;i<n;++i)
        cin>>arr[i];

    a.resize(n);
    tree.resize(4*n+5);
    fill(a.begin(),a.end(),0);
    build();

    for(int i=0;i<n;++i)
    {
        if(h[i]==1)
        {
            update(0,arr[i]);
            continue;
        }
        //cout<<query(0,h[i]-2)<<endl;
        update(h[i]-1 , query(0,h[i]-2)+arr[i]);
    }

    cout << *max_element(a.begin(),a.end()) <<endl ;





    return 0;
}

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

using namespace std;
#define brokenheart "TEST"
#define pb	push_back
typedef long double ld;
typedef long long ll;
const int maxn = 5e3 + 5;
const int inf = 1e9 + 5;

struct TVal
{
    int l , h;
    bool operator < (const TVal & other){return l + h < other.l + other.h;}
}a[maxn];

int n;
int dp[maxn];

void input()
{
    cin >> n;
    for(int i = 1 ; i <= n ; ++i)cin >> a[i].l >> a[i].h;
    sort(a + 1 , a + n + 1);
}

void solve()
{
    int res = 0;
    fill_n(&dp[0],maxn,inf);
    dp[0] = 0;
    for(int i = 1 ; i <= n ; ++i)
    {
//        cout << a[i].l << " " << a[i].h << endl;
        for(int j = i ; j >= 1 ; --j)
            if(dp[j - 1] <= a[i].l)dp[j] = min(dp[j] , dp[j - 1] + a[i].h) , res = max(j , res);
    }
    cout << res;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	if(fopen(brokenheart".INP","r"))
        freopen(brokenheart".INP", "r",stdin) ,
        freopen(brokenheart".OUT", "w",stdout);
    input();solve();
}


Measured memory_bytes: 384
n, x = map(int, input().split())
if x == 1 or x == 2 * n - 1:
    print("No")
else:
    numli = [i for i in range(1, 2 * n)]
    displayli = [0] * (2 * n - 1)
    if n == 2:
        if x == 2:
            print("Yes")
            for i in range(3):
                print(i + 1)
        else:
            print("No")
    else:
        k = 0
        if x == 2:
            for i in range(-3, 1):
                if abs(i) % 2 == 1:
                    displayli[n + i] = x - i - 1
                    numli.remove(x - i - 1)
                else:
                    displayli[n + i] = x + i + 1
                    numli.remove(x + i + 1)
            for i in range(2 * n - 1):
                if n - 3 <= i <= n:
                    pass
                else:
                    displayli[i] = numli[k]
                    k += 1

        elif x == 2 * n - 2:
            for i in range(-2, 2):
                if abs(i) % 2 == 1:
                    displayli[n + i] = x - i - 1
                    numli.remove(x - i - 1)
                else:
                    displayli[n + i] = x + i + 1
                    numli.remove(x + i + 1)
            for i in range(2 * n - 1):
                if n - 2 <= i <= n + 1:
                    pass
                else:
                    displayli[i] = numli[k]
                    k += 1
        else:
            for i in range(-3, 2):
                if abs(i) % 2 == 1:
                    displayli[n + i] = x - i - 1
                    numli.remove(x - i - 1)
                else:
                    displayli[n + i] = x + i + 1
                    numli.remove(x + i + 1)
            for i in range(2 * n - 1):
                if n - 3 <= i <= n + 1:
                    pass
                else:
                    displayli[i] = numli[k]
                    k += 1

        print("Yes")
        for i in range(2 * n - 1):
            print(displayli[i])

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

int main() {
	int n, k, r, s, p;
	string t;
	cin >> n >> k >> r >> s >> p >> t;
	int win[n] = {};
	long long res = 0;
	for (int i = 0; i < n; i++)
	{
		if(i < k) {
			if(t[i] == 'r') res += p;
			else if(t[i] == 's') res += r;
			else res += s;
			win[i] = 1;
		}
		else {
			if(win[i-k] && t[i] == t[i-k]) continue;
			if(t[i] == 'r') res += p;
			else if(t[i] == 's') res += r;
			else res += s;
			win[i] = 1;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 896
#include<stdio.h>
int linearSearch(int[],int,int);

main(){
  int i,n,q;
  int res=0;
  int S[10000];
  int T[500];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&q);

  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }



  for(i=0;i<q;i++){
    if(linearSearch(S,T[i],n)==0) res++;
  }

  printf("%d\n",res);



  return 0;
}


int linearSearch(int S[],int key,int n){
  int i;
  for(i=0;i<n;i++){
    if(S[i]==key) return 0;
  }
  return 1;
}

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

int main() {
	bool used[] = {false, false, false, false};
	string s; cin >> s;
	for (int i = 0; i < s.size(); i++) {
		switch (s[i]) {
		case 'N': used[0] = true; break;
		case 'S': used[1] = true; break;
		case 'W': used[2] = true; break;
		case 'E': used[3] = true; break;
		}
	}
	cout << (used[0] != used[1] || used[2] != used[3] ? "No" : "Yes") << '\n';
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ReadInt();
            var d = ReadInts();

            var ans = 0;
            for (int i = 0; i < n; i++)
            {
                for (int l = i+1; l < n; l++)
                {
                    ans += d[i] * d[l];
                }
            }
            WriteLine(ans);
        }


        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }


        public static bool IsPrime(int num)
        {
            if (num < 2) return false;
            else if (num == 2) return true;
            else if (num % 2 == 0) return false;

            double sqrtNum = Sqrt(num);
            for (int i = 3; i <= sqrtNum; i += 2)
            {
                if (num % i == 0)
                {
                    return false;
                }
            }
            return true;
        }

        //最大公約数
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
        public static void debuglist(List<int> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debuglist(List<string> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(int[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(string[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
    }
}


Measured memory_bytes: 11092
N = int(input())
A = list(map(int, input().split()))
A_G = []
A_K = []
for i in A:
    if i % 2 == 0:
        A_G.append(i)
    else:
        A_K.append(i)
if len(A_K) % 2 == 0:
    key = "YES"
elif len(A_G) == 0 or len(A_K) == 0:
    key = "YES"
else:
    key = "NO"
print(key)

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

bool solve(vector<int> v) {
  int d = v[0];
  for (int i = 1; i < v.size(); i++) {
    if (d >= 10)  d = max(v[i], d - 10);
    else return false;
  }
  return true;
}

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> d(n);
  for (auto& e : d) cin >> e;
  vector<int> rd(d);
  reverse(rd.begin(), rd.end());
  cout << (solve(d) && solve(rd) ? "yes\n" : "no\n");
}


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

#define ll long long
#define pb push_back
#define fori(a,b) for(int i=a;i<b;i++)
#define ford(b,a) for(int i=b;i>=a;i--)
typedef pair<int, int> pi;
#define PI 3.14159265359
long long mod=1000000007;
//int count=INT_MAX;

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

// void solve(vector<int> a,vector<int> b,vector<int> add,vector<int> mult, int &ans,int t){
//     if(a[0]==b[0]&&a[1]==b[1]&&a[2]==b[2]){
//         ans=min(ans,t);
//     }
//     int d;
//     //for a[0]
//     d=add[0];
//     a[0]+=d;
//     add[0]-=d;
//     solve(a,b,add,mult,ans,t+1);
//     a[1]+=d;
//     add[1]-=d;




//     // vector<int> a1(3),vector<int> b1(3);
//     // fori(0,3){
//     //     int d=add[i];
//     //     //add to itself
//     //     a[i]+=d;
//     //     add[i]-=d;
//     //     solve(a,b,add,mult,ans,t+1);
        
//     // }
// }


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    //cin>>t;
    //cout<<t;
    //scanf("%d",&t);
    while(t--){
        //int 5;
        //cin>>n;
        int a[5];
        fori(0,5){
            cin>>a[i];
            if(!a[i]){
                cout<<i+1<<endl;
                return 0;
            }
        }
        
        // vector<int> a(3);
        // vector<int> b(3);
        // cin>>a[0]>>a[1]>>a[2]>>b[0]>>b[1]>>b[2];
        // int ans=3;
        // vector<int> add(3);
        // vector<int> mult(3);
        // fori(0,3){
        //     add[i]=b[i]-a[i];
        //     if(b[i]%a[i]==0){
        //         mult[i]=b[i]/a[i];
        //     }
        //     else{
        //         mult[i]=0;
        //     }
        // }
        // if(a[0]==b[0]&&a[1]==b[1]&&a[2]==b[2]){
        //     cout<<0<<endl;
        //     continue;
        // }
        // int t=0;
        // solve(a,b,add,mult,ans,t);
        // if(add[0]==add[1]&&add[1]==add[2]){
        //     cout<<1<<endl;
        //     continue;
        // }
        // if(mult[0]==mult[1]&&mult[1]==add[2]){
        //     cout<<1<<endl;
        //     continue;
        // }
        // if(a[1]==b[1]&&a[2]==b[2]){
        //     cout<<1<<endl;
        //     continue;
        // }
        // if(a[0]==b[0]&&a[2]==b[2]){
        //     cout<<1<<endl;
        //     continue;
        // }
        // if(a[1]==b[1]&&a[0]==b[0]){
        //     cout<<1<<endl;
        //     continue;
        // }

    }
    
    return 0;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int A = Integer.parseInt(S.substring(0,1)), B = Integer.parseInt(S.substring(1,2)),
    C = Integer.parseInt(S.substring(2,3)), D = Integer.parseInt(S.substring(3,4));
    int p1 = A+B+C+D, p2=A+B+C-D, p3=A+B-C+D, p4=A+B-C-D,
    p5=A-B+C+D, p6=A-B+C-D, p7=A-B-C+D, p8=A-B-C-D;
    
    if(p1==7) {
      System.out.println(A + "+" + B + "+" + C + "+" +D + "=7");
    } else if(p2==7) {
      System.out.println(A + "+" + B + "+" + C + "-" +D + "=7");
    } else if(p3==7) {
      System.out.println(A + "+" + B + "-" + C + "+" +D + "=7");
    } else if(p4==7) {
      System.out.println(A + "+" + B + "-" + C + "-" +D + "=7");
    } else if(p5==7) {
      System.out.println(A + "-" + B + "+" + C + "+" +D + "=7");
    } else if(p6==7) {
      System.out.println(A + "-" + B + "+" + C + "-" +D + "=7");
    } else if(p7==7) {
      System.out.println(A + "-" + B + "-" + C + "+" +D + "=7");
    } else {
      System.out.println(A + "-" + B + "-" + C + "-" +D + "=7");
    }
  }
}

Measured memory_bytes: 39772
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define outD(fpv) cout << setprecision(20) << fpv << endl;
inline void yes(bool cond) { cond ? puts("YES") : puts("NO"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
template<typename Type> inline void unique(Type& arr) { sort(arr); arr.erase(unique(arr.begin(), arr.end()), arr.end()); }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<ll>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> P(N);
    ll mn = BIGP;
    ll ans = 0;
    rep(i, N)
    {
        ll p;
        cin >> p;
        if (mn >= p)
        {
            ++ans;
        }
        mn = min(p, mn);
    }
    cout << ans;
    //
    return 0;
}

Measured memory_bytes: 4728
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

int n;
ll L[110];

void solve(){
    cin >> n;
    rep(i,n) cin >> L[i];
    sort(L,L+n);
    ll ans=0;
    rep(i,n){
        rep(j,i){
            rep(k,j){
                if(L[i]==L[j] || L[j]==L[k] || L[k]==L[i]) continue;
                if(L[k]+L[j]<=L[i]) continue;
                //cout << k << " " << j << " " << i << endl; 
                //cout << L[k] << " " << L[j] << " " << L[i] << endl;
                ans+=1;
            }
        }
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3644
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i32,
        px: [i32; n],
    }

    let mut px = px;
    px.sort();
    px.reverse();

    px[0] /= 2;

    println!("{}", px.iter().sum::<i32>());
}

Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#define f first
#define s second
using namespace std;
int n, m, i, j, a, b, x, y;
char s[1005][1005];
pair<int, int> p[1005];
int main(){
    cin>> n >> m >> a >> b;
    x = -1;
    for(i = 0; i <= n; i++){
        for(j = 0; j <= m; j++){
            if(a * i + (n - i) * (m - a) == b * j + (m - j) * (n - b) ){
                x = i;
                y = j;
                break;
            }
        }
        if(x != -1){
            break;
        }
    }
    if(x == -1){
        cout<< -1;
        return 0;
    }
    for(i = 1; i <= n; i++){
        for(j = 1; j <= m; j++){
            s[i][j] = '0';
        }
    }
    for(i = 1; i <= y; i++){
        p[i] = make_pair(b, i);
    }
    for(i = y + 1; i <= m; i++){
        p[i] = make_pair(n - b, i);
    }
    for(i = x + 1; i <= n; i++){
        sort(p + 1, p + m + 1);
        for(j = m; j > a; j--){
            s[i][ p[j].s ] = '1';
            p[j].f--;
        }
    }
    for(i = 1; i <= x; i++){
        sort(p + 1, p + m + 1);
        for(j = m; j >= m - a + 1; j--){
            s[i][ p[j].s ] = '1';
            p[j].f--;
        }
    }
    for(i = 1; i <= n; i++){
        cout<< s[i] + 1 <<"\n";
    }
}


Measured memory_bytes: 2176
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num::clamp;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: usize,
        ta: [(usize, usize); n]
    }

    let (mut prev_t, mut prev_a) = (1, 1);
    for (t, a) in ta {
        let t_fac = (prev_t + t - 1) / t;
        let a_fac = (prev_a + a - 1) / a;
        let factor = max(t_fac, a_fac);
        prev_t = t * factor;
        prev_a = a * factor;
    }
    println!("{}", prev_t + prev_a);
}


Measured memory_bytes: 2188
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
"""
t,x = LI()
print(t/x)
"""

#B
"""
n= II()
a = LI()
m = max(a)
if m >= sum(a)-m:
    print("No")
else:
    print("Yes")
"""

#C
"""
n,m = LI()
x = LI()
x.sort()
l = [x[i+1]-x[i] for i in range(m-1)]
l.sort()
l = l[::-1]
ans = sum(l[max(n-1,0):])
print(ans)
"""

#D
n,k = LI()
a = LI()
k = list(map(int,list(bin(k)[2:])))
l = len(k)
for i in range(n):
    a[i] = list(map(int,list(bin(a[i])[2:])))
    l = max(l,len(a[i]))
for i in range(n):
    for j in range(l-len(a[i])):
        a[i].insert(0,0)
for j in range(l-len(k)):
    k.insert(0,0)
s = [[0,0] for i in range(l)]
pow2 = [1 for i in range(l)]
for i in range(l-1)[::-1]:
    pow2[i] = pow2[i+1]*2
for i in a:
    for j in range(l):
        s[j][0] += pow2[j]*i[j]
        s[j][1] += pow2[j]*(not i[j])
dp = [0 for i in range(l+1)]
small = False
for i in range(l):
    if not small:
        if not k[i]:
            dp[i+1] += dp[i]+s[i][0]
        else:
            if s[i][0] >= s[i][1]:
                dp[i+1] += dp[i]+s[i][0]
                small = True
            else:
                dp[i+1] += dp[i]+s[i][1]
    else:
        dp[i+1] += dp[i]+max(s[i])
print(dp[l])
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 116256
def calc(k, ax, ay):
    bx = ax - ay/(k**0.5)
    by = ay + ax/(k**0.5)
    return(bx, by)


while True:
    n = int(input())
    if n == -1:
        break

    ax, ay = 1, 0
    for i in range(n-1):
        ax, ay = calc(i+1, ax, ay)
    
    print(round(ax, 3))
    print(round(ay, 3))


Measured memory_bytes: 5664
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
int main() {
  ios::sync_with_stdio(0); 
  cin.tie(0); 

  int n, k;
  cin >> n >> k;

  int res = 0;
  for (int i = 0; i < n; ++i) {
    int x; cin >> x;
    res += min(abs(x - 0), abs(x - k)) * 2;
  }

  cout << res << "\n";
}


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

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

    if (S.length() > K) {
        for (int i = 0; i < K; i++) cout << S[i];
        cout << "..." << endl;
    } else {
        cout << S << endl;
    }

    return 0;
}

Measured memory_bytes: 3592
#include<stdio.h>

int main(){
  int N,ans=0;
  scanf("%d",&N);
  char S[N+1];
  char T[N+1];
  scanf("%s",S);
  scanf("%s",T);

  int i=N-1;
  int j=i;
  while (i>=0)
  {
    int i=N-1;
    while (j>=0&&S[i]!=T[j])
    {
      j--;
    }
    if(j>=0){
      while (j>=0&&S[i]==T[j]){ i--; j--; }
      if (j<0){
        ans=2*N-(N-i-1);
        break;
      }
    }else
    {
      ans=2*N-(N-i-1);
      break;
    }
  }

  printf("%d",ans);

  return 0;
}

Measured memory_bytes: 1688
#include <iostream>
#include <climits>
#include <algorithm>

using namespace std;

// 入力
int n, W;
long int weight[101], value[101];

// DPテーブル
long int dp[101][100001];

int main() {
  cin >> n >> W;
  for (int i = 0; i < n; ++i) cin >> weight[i] >> value[i];

  // DP初期条件: dp[0][w] = 0
  for (int w = 0; w <= W; ++w) dp[0][w] = 0;

  // DPループ
  for (int i = 0; i < n; ++i) {
    for (int w = 0; w <= W; ++w) {
      if (w >= weight[i]) dp[i+1][w] = max(dp[i][w-weight[i]] + value[i], dp[i][w]);
      else dp[i+1][w] = dp[i][w];
    }
  }

  cout << dp[n][W] << endl;
  
  return 0;
}

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

int main()
{
  int n;
  cin >> n;
  int a = n % 10;
  if (a == 2 || a == 4 || a == 5 || a == 7 || a == 9)
  {
    cout << "hon"
         << "\n";
  }
  else if (a == 0 || a == 1 || a == 6 | a == 8)
  {
    cout << "pon"
         << "\n";
  }
  else
  {
    cout << "bon"
         << "\n";
  }
}

Measured memory_bytes: 3632
N , M = map(int,input().split())
 
H = list(map(int,input().split()))
 
A = [0]*M
B = [0]*M
for i in range(M):
  A[i] ,B[i] = map(int,input().split())
 
 
S=[1]*N
 
 
for m in range(M):
  if H[A[m]-1] == H[B[m]-1]:
    S[A[m]-1] = 0
    S[B[m]-1] = 0
  elif H[A[m]-1] <= H[B[m]-1]:
    S[A[m]-1] = 0
  elif H[A[m]-1] >= H[B[m]-1]:
    S[B[m]-1] = 0
 
 
print(sum(S))   

Measured memory_bytes: 21848
void main(){
	string[] judgest = ["AC", "WA", "TLE", "RE"];
	int n = _scan();
	int[4] judged;
	foreach(i; 0..n){
		switch( readln().chomp() ){
			case "AC": judged[0]++; break;
			case "WA": judged[1]++; break;
			case "TLE": judged[2]++; break;
			case "RE": judged[3]++; break;
			default: break;
		}
	}
	foreach(i, elm; judgest)writefln("%s x %d", elm, judged[i]);
}
import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 3784
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H, W;
    cin >> H >> W;
    ll h, w;
    cin >> h >> w;
    ll ans = H * W - (h * W + H * w - h * w);
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long h = sc.nextLong();
        long w = sc.nextLong();
        long ans = Math.min(h, w);
        if(h % 3 == 0 || w % 3 == 0){
            ans = 0;
        }else{
            long whalf = w / 2;
            long hhalf = h / 2;
            for (int i = 1; i <= (h+1)/2; i++) {
                long s1 = w * i;
                long s2 = whalf * (h - i);
                long s3 = (w - whalf) * (h - i);
                long max = Math.max(s1, Math.max(s2, s3));
                long min = Math.min(s1, Math.min(s2, s3));
                ans = Math.min(ans, max - min);
            }
            for (int i = 1; i <= (w+1)/2; i++) {
                long s1 = h * i;
                long s2 = hhalf * (w - i);
                long s3 = (h - hhalf) * (w - i);
                long max = Math.max(s1, Math.max(s2, s3));
                long min = Math.min(s1, Math.min(s2, s3));
                ans = Math.min(ans, max - min);
            }
        }

        System.out.println(ans);
        sc.close();
    }

}


Measured memory_bytes: 22736
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int A,P;
  cin >> A >> P;
  cout << (3*A+P)/2 << endl;
  return 0;
}


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

using namespace std;

int main(){
    
    long long int i,j,k,n,m;
    cin>>n;
    long long int a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    long long int cost[n];
    for(i=0;i<n;i++){
        cost[i]=1000000000;
    }
    cost[0]=0;
    cost[1]=abs(a[1]-a[0]);
   // cout<<cost[1];
    for(i=2;i<n;i++){
        cost[i]=min(cost[i],min(cost[i-1]+abs(a[i]-a[i-1]),cost[i-2]+abs(a[i]-a[i-2])));
    }
    cout<<cost[n-1];
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long a,v,b,w,t;
  cin>>a>>v>>b>>w>>t;
  if(v<=w){
    cout<<"NO"<<endl;
    return 0;
  }else{
    long long kyori0=b-a;
    long long kyori1=v-w;
    if(abs(kyori0)<=t*kyori1){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll MOD=1e9+7;
int n;
ll dp[101][4][4][4],ans;
int main()
{
	cin>>n;
	dp[0][3][3][3]=1;
	for (int len=1;len<n+1;++len)
		for (int i=0;i<4;++i)
			for (int j=0;j<4;++j)
				for (int k=0;k<4;++k)
					for (int l=0;l<4;++l)
					{
						if (j==0 && k==2 && l==1) continue;
						if (j==2 && k==0 && l==1) continue;
						if (j==0 && k==1 && l==2) continue;
						if (i==0 && k==2 && l==1) continue;
						if (i==0 && j==2 && l==1) continue;
						dp[len][j][k][l]+=dp[len-1][i][j][k];
						dp[len][j][k][l]%=MOD;
					}
	for (int i=0;i<4;++i)
		for (int j=0;j<4;++j)
			for (int k=0;k<4;++k)
				ans+=dp[n][i][j][k],ans%=MOD;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}




int main() {
  string s;
  cin >> s;
  vector<int> a(2020);
  int b=0;
  int d=1;
  for(int i=s.size()-1 ; i>=0; i--) {
      int f=s[i]-'0';
      b+=d*f;
      b%=2019;
      a[b]++;
      d*=10;
      d%=2019;

  }
  int ans=a[0];
  rep(i,2020) {
      if(a[i]>1) {
          ans+=a[i]*(a[i]-1)/2;
      }
  }
  pt(ans);
  return 0;
}

Measured memory_bytes: 3724
tmp = input()
abcd = [int(t) for t in tmp]

for i in range(2**3):
    total = abcd[0]
    eq = tmp[0]
    for j in range(3):
        if (i >> j) & 1:
            eq += '+' + tmp[j+1]
            total += abcd[j+1]
        else:
            eq += '-' + tmp[j+1]
            total -= abcd[j+1]
    if total == 7:
        eq += '=7'
        break
print(eq)

Measured memory_bytes: 3064
def main():
    S = input()
    Q = int(input())
    rev = False # rev=1で反転した状態
    tail = ""
    head = ""
    for i in range(Q):
        query = input()
        if len(query)==1:
            rev = not rev
        else:
            tmp = list(query.split())
            f = int(tmp[1])
            c = tmp[2]
            if rev:
                if f==1:
                    tail+=c
                else:
                    head=c+head
            else:
                if f==1:
                    head=c+head
                else:
                    tail+=c

    ans = tail[::-1]+S[::-1]+head[::-1] if rev else head+S+tail
    print(ans)

main()


Measured memory_bytes: 4476
#include<stdio.h>
#include<bits/stdc++.h>
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define ll long long int
#define F first
#define S second
#define f(i,x,n) for(ll i=x;i<n;i++)
using namespace std;
int main(){
	ll n,k,sum=0;
	cin>>n>>k;
	ll v[n],dp[n];
	f(i,0,n) cin>>v[i];
	dp[0]=0;
	dp[1]=abs(v[1]-v[0]);
	f(i,2,n){
		ll temp=INT_MAX;
		for(ll j=1;j<k+1 && j<=i;j++)
		temp=min(dp[i-j] +abs(v[i]-v[i-j]),temp);
		dp[i]=temp;
	}
	cout<<dp[n-1];
return 0;
}

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

int solve (long long int n, int i){
    while(n%i==0) {
        n = n/i;
    }
    if (n%i==1){
        return 1;
    }   
    else return 0;
}

int main() {

    long long int n;
    cin>>n;
    if (n==2){
        cout<<1;
        return 0;
    }
    int cnt = 0;
    for (long long int i=2; i*i<=n; i++){
        if (n%i==0){
            cnt += solve(n, i);
            if (i*i!=n){
                cnt += solve(n, n/i);
            }
        }
    }
    for (long long int i=2; i*i<=n-1; i++){
        if ((n-1)%i==0){
            cnt++;
        }
        if ((n-1)%((n-1)/i)==0 and i*i!=n-1){
            cnt++;
        }
    }

    cout<<cnt+2;

}




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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int res = 0;
  for(int a=0;a<=A;a++){
    for(int b=0;b<=B;b++){
      for(int c=0;c<=C;c++){
        if(X==a*500+b*100+c*50){
          res++;
        }
      }
    }
  }
  cout << res << endl;
}


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

int main(){
  int N,A,B,ans=0;
  cin>>N>>A>>B;
  for(int i=0;i<N;i++){
    int t;
    cin>>t;
    if( A<=t&&t<B )ans++;
  }
  cout<<N-ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1LL << 60;
const long double pi = 3.14159265358979323846;

// ****************************************CODE***************************************//

ll n, m;
ll dp[100100];
vector<vector<ll>> g;

ll rec(ll i) {
    if(dp[i] != -1) return dp[i];

    ll res = 0;
    for(auto j : g[i]){
        res = max(res, rec(j) + 1);
    }

    return dp[i] = res;
}

int main() {
    cin >> n >> m;
    g.assign(n, vector<ll>());
    for(int i = 0; i < m; i++){
        int s, t;
        cin >> s >> t;
        s--; t--;

        g[s].push_back(t); 
    }

    for(int i = 0; i < n; i++) dp[i] = -1;

    ll res = 0;
    for(int i = 0; i < n; i++){
        res = max(res, rec(i));
    }

    cout << res << endl;
}

Measured memory_bytes: 8576
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    if (a % 2 == 0) {
      if (a % 3 != 0 && a % 5 != 0) {
        printf("DENIED\n");
        return 0;
      }
    }
  }
  printf("APPROVED\n");
  return EXIT_SUCCESS;
}


Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) { o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o; }
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) { o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o; }
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) { o << "{" << obj.first << ", " << obj.second << "}"; return o; }
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
void print(void) { cout << endl; }
template <class Head> void print(Head&& head) { cout << head; print(); }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head << " "; print(forward<Tail>(tail)...); }
void YN(bool flg) { cout << ((flg) ? "YES" : "NO") << endl; }
void Yn(bool flg) { cout << ((flg) ? "Yes" : "No") << endl; }
void yn(bool flg) { cout << ((flg) ? "yes" : "no") << endl; }

int main() {
	string S; cin >> S;
	int N = S.size(),flg = 0;
	for(int i = 0; i <= N; ++i){
		for (int j = i; j <= N; ++j) {
			//cout << S.substr(0, i) + S.substr(j, N) << endl;
			if (S.substr(0, i) + S.substr(j, N) == "keyence") flg = 1;
		}
	}
	YN(flg);
	//cin >> N;
	return 0;
}

Measured memory_bytes: 256
import sys
for line in sys.stdin.readlines():
#for line in data.split('\n'):
	a,b,c,d,e,f = [int(s) for s in line.split()]
	x = (c*e-b*f) / (a*e-b*d)
	y = (c*d-a*f) / (b*d-a*e)
	if round(x,3) == 0.0:
		x = 0.0
	if round(y,3) == 0.0:
		y = 0.0
	print('{0:.3f} {1:.3f}'.format(x,y))

Measured memory_bytes: 7720